Browse Source

Fixed: Swizzle works only for BGRA8.

Branimir Karadžić 12 years ago
parent
commit
e2532b37ff
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/renderer_gl.cpp

+ 10 - 2
src/renderer_gl.cpp

@@ -1529,7 +1529,11 @@ namespace bgfx
 
 
 			const GLenum internalFmt = s_textureFormat[m_textureFormat].m_internalFmt;
 			const GLenum internalFmt = s_textureFormat[m_textureFormat].m_internalFmt;
 
 
-			const bool swizzle    = GL_RGBA == m_fmt && !s_renderCtx->m_textureSwizzleSupport;
+			const bool swizzle = true
+				&& TextureFormat::BGRA8 == m_textureFormat
+				&& GL_RGBA == m_fmt
+				&& !s_renderCtx->m_textureSwizzleSupport
+				;
 			const bool convert    = m_textureFormat != m_requestedFormat;
 			const bool convert    = m_textureFormat != m_requestedFormat;
 			const bool compressed = TextureFormat::Unknown > m_textureFormat;
 			const bool compressed = TextureFormat::Unknown > m_textureFormat;
 			const uint32_t min    = convert && compressed ? 4 : 1;
 			const uint32_t min    = convert && compressed ? 4 : 1;
@@ -1685,8 +1689,12 @@ namespace bgfx
 
 
 		GLenum target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
 		GLenum target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
 
 
+		const bool swizzle = true
+			&& TextureFormat::BGRA8 == m_textureFormat
+			&& GL_RGBA == m_fmt
+			&& !s_renderCtx->m_textureSwizzleSupport
+			;
 		const bool unpackRowLength = !!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported;
 		const bool unpackRowLength = !!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported;
-		const bool swizzle         = GL_RGBA == m_fmt && !s_renderCtx->m_textureSwizzleSupport;
 		const bool convert         = m_textureFormat != m_requestedFormat;
 		const bool convert         = m_textureFormat != m_requestedFormat;
 		const bool compressed      = TextureFormat::Unknown > m_textureFormat;
 		const bool compressed      = TextureFormat::Unknown > m_textureFormat;