Преглед изворни кода

Add opt-in compile flag for GL read back emulation (#2305)

Co-authored-by: Christophe Dehais <[email protected]>
Christophe Dehais пре 5 година
родитељ
комит
6b790dc96b
2 измењених фајлова са 6 додато и 2 уклоњено
  1. 2 2
      src/renderer_gl.cpp
  2. 4 0
      src/renderer_gl.h

+ 2 - 2
src/renderer_gl.cpp

@@ -2764,7 +2764,7 @@ namespace bgfx { namespace gl
 					: 0
 					;
 
-				g_caps.supported |= m_readBackSupported
+				g_caps.supported |= (m_readBackSupported || BX_ENABLED(BGFX_GL_CONFIG_TEXTURE_READ_BACK_EMULATION))
 					? BGFX_CAPS_TEXTURE_READ_BACK
 					: 0
 					;
@@ -3263,7 +3263,7 @@ namespace bgfx { namespace gl
 
 				GL_CHECK(glBindTexture(texture.m_target, 0) );
 			}
-			else
+			else if (BX_ENABLED(BGFX_GL_CONFIG_TEXTURE_READ_BACK_EMULATION))
 			{
 				const TextureGL& texture = m_textures[_handle.idx];
 				const bool compressed    = bimg::isCompressed(bimg::TextureFormat::Enum(texture.m_textureFormat) );

+ 4 - 0
src/renderer_gl.h

@@ -43,6 +43,10 @@
 #	define BGFX_GL_CONFIG_BLIT_EMULATION 0
 #endif // BGFX_GL_CONFIG_BLIT_EMULATION
 
+#ifndef BGFX_GL_CONFIG_TEXTURE_READ_BACK_EMULATION
+#	define BGFX_GL_CONFIG_TEXTURE_READ_BACK_EMULATION 0
+#endif // BGFX_GL_CONFIG_TEXTURE_READ_BACK_EMULATION
+
 #define BGFX_GL_PROFILER_BEGIN(_view, _abgr)                                               \
 	BX_MACRO_BLOCK_BEGIN                                                                   \
 		GL_CHECK(glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, s_viewName[view]) ); \