Fix GL & Vulkan selected slice clamping. Closes #1366

This commit is contained in:
baldurk
2019-04-30 10:30:35 +01:00
parent 6b97a9cffa
commit e8a794c026
2 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -368,11 +368,15 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, int flags)
ubo->MipLevel = (int)cfg.mip;
if(texDetails.curType != eGL_TEXTURE_3D)
{
ubo->Slice = (float)cfg.sliceFace + 0.001f;
uint32_t numSlices =
RDCMAX((uint32_t)texDetails.depth, 1U) * RDCMAX((uint32_t)texDetails.samples, 1U);
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, numSlices - 1);
ubo->Slice = (float)sliceFace + 0.001f;
}
else
{
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, uint32_t(texDetails.samples - 1));
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, RDCMAX((uint32_t)texDetails.depth, 1U) - 1);
ubo->Slice = (float)(sliceFace >> cfg.mip);
}
+6 -2
View File
@@ -275,11 +275,15 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
data->Slice = 0;
if(iminfo.type != VK_IMAGE_TYPE_3D)
{
data->Slice = (float)cfg.sliceFace + 0.001f;
uint32_t numSlices =
RDCMAX((uint32_t)iminfo.arrayLayers, 1U) * RDCMAX((uint32_t)iminfo.samples, 1U);
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, numSlices - 1);
data->Slice = (float)sliceFace + 0.001f;
}
else
{
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, uint32_t(iminfo.samples - 1));
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, iminfo.extent.depth - 1);
data->Slice = (float)(sliceFace >> cfg.mip);
}