瀏覽代碼

Fixes example 08 when using OpenGL (#2233)

This example was broken on Windows and Linux when using OpenGL.
The code path when using immutable compressed textures was wrong.
kingscallop 5 年之前
父節點
當前提交
cb8f6dfcec
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/renderer_gl.cpp

+ 6 - 4
src/renderer_gl.cpp

@@ -5178,8 +5178,8 @@ namespace bgfx { namespace gl
 			const TextureFormatInfo& tfi = s_textureFormat[m_textureFormat];
 			const TextureFormatInfo& tfi = s_textureFormat[m_textureFormat];
 
 
 			const GLenum fmt = srgb
 			const GLenum fmt = srgb
-				? s_textureFormat[m_textureFormat].m_fmt
-				: s_textureFormat[m_textureFormat].m_fmtSrgb
+				? s_textureFormat[m_textureFormat].m_fmtSrgb
+				: s_textureFormat[m_textureFormat].m_fmt
 				;
 				;
 
 
 			m_fmt  = fmt;
 			m_fmt  = fmt;
@@ -5490,7 +5490,8 @@ namespace bgfx { namespace gl
 					}
 					}
 					else if (!computeWrite)
 					else if (!computeWrite)
 					{
 					{
-						if (compressed)
+						if (compressed
+						&& !convert)
 						{
 						{
 							uint32_t size = bx::max<uint32_t>(1, (width  + 3)>>2)
 							uint32_t size = bx::max<uint32_t>(1, (width  + 3)>>2)
 										  * bx::max<uint32_t>(1, (height + 3)>>2)
 										  * bx::max<uint32_t>(1, (height + 3)>>2)
@@ -5604,7 +5605,8 @@ namespace bgfx { namespace gl
 			GL_CHECK(glPixelStorei(GL_UNPACK_ROW_LENGTH, srcpitch*8/bpp) );
 			GL_CHECK(glPixelStorei(GL_UNPACK_ROW_LENGTH, srcpitch*8/bpp) );
 		}
 		}
 
 
-		if (compressed)
+		if (compressed
+		&& !convert)
 		{
 		{
 			const uint8_t* data = _mem->data;
 			const uint8_t* data = _mem->data;