|
1 |
| -/** |
| 1 | +/** |
2 | 2 |
|
3 | 3 | spoutGLDXinterop.cpp
|
4 | 4 |
|
|
190 | 190 | - CleanupInterop after sender creation fail
|
191 | 191 | - CleanupDX9 change to prevent crash with Milkdrop
|
192 | 192 | - add pQuery->Release() to FlushWait
|
| 193 | + 04.02.17 - corrected test for fbo blit extension |
193 | 194 |
|
194 | 195 | */
|
195 | 196 |
|
@@ -486,7 +487,7 @@ bool spoutGLDXinterop::DX11available()
|
486 | 487 | //
|
487 | 488 | // https://code.google.com/p/chromium/issues/detail?id=106438
|
488 | 489 | //
|
489 |
| -// NOTES : On a normal system EnumDisplayDevices and IDXGIAdapter::GetDesc always concur |
| 490 | +// NOTES : On a “normal” system EnumDisplayDevices and IDXGIAdapter::GetDesc always concur |
490 | 491 | // i.e. the device that owns the head will be the device that performs the rendering.
|
491 | 492 | // On an Optimus system IDXGIAdapter::GetDesc will return whichever device has been selected for rendering.
|
492 | 493 | // So on an Optimus system it is possible that IDXGIAdapter::GetDesc will return the dGPU whereas
|
@@ -1642,31 +1643,32 @@ bool spoutGLDXinterop::WriteGLDXtexture(GLuint TextureID, GLuint TextureTarget,
|
1642 | 1643 | status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
1643 | 1644 | if(status == GL_FRAMEBUFFER_COMPLETE_EXT) {
|
1644 | 1645 |
|
1645 |
| - // Default invert flag is false so do the flip to get it the right way up if the user wants that |
1646 |
| - if(bInvert) { |
1647 |
| - // Blit method with checks - 0.75 - 0.85 msec |
1648 |
| - // copy one texture buffer to the other while flipping upside down (OpenGL and DirectX have different texture origins) |
1649 |
| - glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
1650 |
| - width, height, // srcX1, srcY1 |
1651 |
| - 0, height, // dstX0, dstY0, |
1652 |
| - width, 0, // dstX1, dstY1, |
1653 |
| - GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter |
1654 |
| - } |
1655 |
| - else { |
1656 |
| - if(m_bBLITavailable) { |
| 1646 | + if(m_bBLITavailable) { |
| 1647 | + // Default invert flag is false so do the flip to get it the right way up if the user wants that |
| 1648 | + if(bInvert) { |
| 1649 | + // Blit method with checks - 0.75 - 0.85 msec |
| 1650 | + // copy one texture buffer to the other while flipping upside down (OpenGL and DirectX have different texture origins) |
| 1651 | + glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
| 1652 | + width, height, // srcX1, srcY1 |
| 1653 | + 0, height, // dstX0, dstY0, |
| 1654 | + width, 0, // dstX1, dstY1, |
| 1655 | + GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter |
| 1656 | + } |
| 1657 | + else { |
1657 | 1658 | // Do not flip during blit
|
1658 | 1659 | glBlitFramebufferEXT(0, 0, // srcX0, srcY0,
|
1659 | 1660 | width, height, // srcX1, srcY1
|
1660 | 1661 | 0, 0, // dstX0, dstY0,
|
1661 | 1662 | width, height, // dstX1, dstY1,
|
1662 | 1663 | GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter
|
1663 | 1664 | }
|
1664 |
| - else { |
1665 |
| - // Copy from the fbo (input texture attached) to the shared texture |
1666 |
| - glBindTexture(GL_TEXTURE_2D, m_glTexture); |
1667 |
| - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height); |
1668 |
| - glBindTexture(GL_TEXTURE_2D, 0); |
1669 |
| - } |
| 1665 | + } |
| 1666 | + else { |
| 1667 | + // No fbo blit extension |
| 1668 | + // Copy from the fbo (input texture attached) to the shared texture |
| 1669 | + glBindTexture(GL_TEXTURE_2D, m_glTexture); |
| 1670 | + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height); |
| 1671 | + glBindTexture(GL_TEXTURE_2D, 0); |
1670 | 1672 | }
|
1671 | 1673 | }
|
1672 | 1674 | else {
|
@@ -1720,30 +1722,31 @@ bool spoutGLDXinterop::ReadGLDXtexture(GLuint TextureID, GLuint TextureTarget, u
|
1720 | 1722 |
|
1721 | 1723 | status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
1722 | 1724 | if(status == GL_FRAMEBUFFER_COMPLETE_EXT) {
|
1723 |
| - // Flip if the user wants that |
1724 |
| - if(bInvert) { |
1725 |
| - // copy one texture buffer to the other while flipping upside down |
1726 |
| - glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
1727 |
| - width, height, // srcX1, srcY1 |
1728 |
| - 0, height, // dstX0, dstY0, |
1729 |
| - width, 0, // dstX1, dstY1, |
1730 |
| - GL_COLOR_BUFFER_BIT, GL_LINEAR); |
1731 |
| - } |
1732 |
| - else { |
1733 |
| - if(m_bBLITavailable) { |
| 1725 | + if(m_bBLITavailable) { |
| 1726 | + // Flip if the user wants that |
| 1727 | + if(bInvert) { |
| 1728 | + // copy one texture buffer to the other while flipping upside down |
| 1729 | + glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
| 1730 | + width, height, // srcX1, srcY1 |
| 1731 | + 0, height, // dstX0, dstY0, |
| 1732 | + width, 0, // dstX1, dstY1, |
| 1733 | + GL_COLOR_BUFFER_BIT, GL_LINEAR); |
| 1734 | + } |
| 1735 | + else { |
1734 | 1736 | // Do not flip during blit
|
1735 | 1737 | glBlitFramebufferEXT(0, 0, // srcX0, srcY0,
|
1736 | 1738 | width, height, // srcX1, srcY1
|
1737 | 1739 | 0, 0, // dstX0, dstY0,
|
1738 | 1740 | width, height, // dstX1, dstY1,
|
1739 | 1741 | GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter
|
1740 | 1742 | }
|
1741 |
| - else { |
1742 |
| - // Copy from the fbo (shared texture attached) to the dest texture |
1743 |
| - glBindTexture(TextureTarget, TextureID); |
1744 |
| - glCopyTexSubImage2D(TextureTarget, 0, 0, 0, 0, 0, width, height); |
1745 |
| - glBindTexture(TextureTarget, 0); |
1746 |
| - } |
| 1743 | + } |
| 1744 | + else { |
| 1745 | + // No fbo blit extension available |
| 1746 | + // Copy from the fbo (shared texture attached) to the dest texture |
| 1747 | + glBindTexture(TextureTarget, TextureID); |
| 1748 | + glCopyTexSubImage2D(TextureTarget, 0, 0, 0, 0, 0, width, height); |
| 1749 | + glBindTexture(TextureTarget, 0); |
1747 | 1750 | }
|
1748 | 1751 | }
|
1749 | 1752 | else {
|
@@ -2109,7 +2112,7 @@ void spoutGLDXinterop::FlushWait()
|
2109 | 2112 |
|
2110 | 2113 | // For a receiver, make sure that the GPU is finished processing commands before accessing the
|
2111 | 2114 | // staging texture and before the sender fills the shared texture again on the next frame.
|
2112 |
| - // For a sender, make sure the SopyResource fnction has completed before the receiver application |
| 2115 | + // For a sender, make sure the CopyResource fnction has completed before the receiver application |
2113 | 2116 | // accesses the shared texture.
|
2114 | 2117 | // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476578%28v=vs.85%29.aspx
|
2115 | 2118 | ZeroMemory(&queryDesc, sizeof(queryDesc));
|
@@ -3969,31 +3972,32 @@ bool spoutGLDXinterop::CopyTexture( GLuint SourceID,
|
3969 | 3972 |
|
3970 | 3973 | status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
3971 | 3974 | if(status == GL_FRAMEBUFFER_COMPLETE_EXT) {
|
3972 |
| - // Default invert flag is false so do the flip to get it the right way up if the user wants that |
3973 |
| - if(bInvert) { |
3974 |
| - // Blit method with checks - 0.75 - 0.85 msec |
3975 |
| - // copy one texture buffer to the other while flipping upside down |
3976 |
| - // (OpenGL and DirectX have different texture origins) |
3977 |
| - glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
3978 |
| - width, height, // srcX1, srcY1 |
3979 |
| - 0, height, // dstX0, dstY0, |
3980 |
| - width, 0, // dstX1, dstY1, |
3981 |
| - GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter |
3982 |
| - } |
3983 |
| - else { |
3984 |
| - if(m_bBLITavailable) { |
| 3975 | + if(m_bBLITavailable) { |
| 3976 | + if(bInvert) { |
| 3977 | + // Blit method with checks - 0.75 - 0.85 msec |
| 3978 | + // copy one texture buffer to the other while flipping upside down |
| 3979 | + // (OpenGL and DirectX have different texture origins) |
| 3980 | + glBlitFramebufferEXT(0, 0, // srcX0, srcY0, |
| 3981 | + width, height, // srcX1, srcY1 |
| 3982 | + 0, height, // dstX0, dstY0, |
| 3983 | + width, 0, // dstX1, dstY1, |
| 3984 | + GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter |
| 3985 | + } |
| 3986 | + else { |
3985 | 3987 | // Do not flip during blit
|
3986 | 3988 | glBlitFramebufferEXT(0, 0, // srcX0, srcY0,
|
3987 | 3989 | width, height, // srcX1, srcY1
|
3988 | 3990 | 0, 0, // dstX0, dstY0,
|
3989 | 3991 | width, height, // dstX1, dstY1,
|
3990 | 3992 | GL_COLOR_BUFFER_BIT, GL_NEAREST); // GLbitfield mask, GLenum filter
|
3991 | 3993 | }
|
3992 |
| - else { |
3993 |
| - glBindTexture(DestTarget, DestID); |
3994 |
| - glCopyTexSubImage2D(DestTarget, 0, 0, 0, 0, 0, width, height); |
3995 |
| - glBindTexture(DestTarget, 0); |
3996 |
| - } |
| 3994 | + } |
| 3995 | + else { |
| 3996 | + // No fbo blit extension |
| 3997 | + // Copy from the fbo (source texture attached) to the dest texture |
| 3998 | + glBindTexture(DestTarget, DestID); |
| 3999 | + glCopyTexSubImage2D(DestTarget, 0, 0, 0, 0, 0, width, height); |
| 4000 | + glBindTexture(DestTarget, 0); |
3997 | 4001 | }
|
3998 | 4002 | }
|
3999 | 4003 | else {
|
|
0 commit comments