From cb8f6dfcec20c82cb407ca353b725524844e9e37 Mon Sep 17 00:00:00 2001 From: kingscallop <54776947+kingscallop@users.noreply.github.com> Date: Sun, 16 Aug 2020 19:42:42 +0100 Subject: [PATCH] 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. --- src/renderer_gl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 8a867a41f..cbae2ee2f 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -5178,8 +5178,8 @@ namespace bgfx { namespace gl const TextureFormatInfo& tfi = s_textureFormat[m_textureFormat]; 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; @@ -5490,7 +5490,8 @@ namespace bgfx { namespace gl } else if (!computeWrite) { - if (compressed) + if (compressed + && !convert) { uint32_t size = bx::max(1, (width + 3)>>2) * bx::max(1, (height + 3)>>2) @@ -5604,7 +5605,8 @@ namespace bgfx { namespace gl GL_CHECK(glPixelStorei(GL_UNPACK_ROW_LENGTH, srcpitch*8/bpp) ); } - if (compressed) + if (compressed + && !convert) { const uint8_t* data = _mem->data;