From ce4edad1639c56a29993c1a43c0f26743962fa50 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 Sep 2025 12:40:38 +0100 Subject: [PATCH] Fix calculation of remapped 3D mips in image viewer. Closes #3697 * For OpenGL we need to remap a 3D block-compressed texture to a 2D array for display, when doing so we need to account for the mip size when calculating the size of each chunk of data. --- renderdoc/core/image_viewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index 313b26af1..c670d3050 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -1055,7 +1055,7 @@ void ImageViewer::CreateProxyTexture(TextureDescription &texDetails, read_tex_da const uint32_t slice = i / texDetails.mips; // size of each subresource is 1/Nth for an N-sized array - size_t size = oldSubs[mip].second / texDetails.arraysize; + size_t size = oldSubs[mip].second / RDCMAX(1U, texDetails.arraysize >> mip); // and the offset is slice steps further on size_t offset = oldSubs[mip].first + size * slice;