From 2cdba37415659bc83f3fb18eb0d239f041631edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Thu, 11 Nov 2021 20:00:18 -0800 Subject: [PATCH] GL: Fixed update surface size when texture is transcoded. --- src/renderer_gl.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 201ae0726..ab352c2cd 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -5697,8 +5697,16 @@ namespace bgfx { namespace gl || swizzle ; - const uint32_t width = _rect.m_width; - const uint32_t height = _rect.m_height; + Rect rect; + rect.setIntersect(_rect + , { + 0, 0, + uint16_t(bx::max(1u, m_width >> _mip) ), + uint16_t(bx::max(1u, m_height >> _mip) ), + }); + + uint32_t width = rect.m_width; + uint32_t height = rect.m_height; uint8_t* temp = NULL; if (convert @@ -5727,11 +5735,11 @@ namespace bgfx { namespace gl ; GL_CHECK(compressedTexSubImage(target+_side , _mip - , _rect.m_x - , _rect.m_y + , rect.m_x + , rect.m_y , _z - , _rect.m_width - , _rect.m_height + , rect.m_width + , rect.m_height , _depth , internalFmt , _mem->size @@ -5759,11 +5767,11 @@ namespace bgfx { namespace gl GL_CHECK(texSubImage(target+_side , _mip - , _rect.m_x - , _rect.m_y + , rect.m_x + , rect.m_y , _z - , _rect.m_width - , _rect.m_height + , rect.m_width + , rect.m_height , _depth , m_fmt , m_type