mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-07 06:24:57 +00:00
Fix & clamp array/sample indexing for MSAA array texture display
This commit is contained in:
6 files changed
+29
-5
No files matched your search
@@ -1937,6 +1937,8 @@ void D3D11Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
|
||||
bool wasms = false;
|
||||
|
||||
UINT sampleCount = desc.SampleDesc.Count;
|
||||
|
||||
if(desc.SampleDesc.Count > 1)
|
||||
{
|
||||
desc.ArraySize *= desc.SampleDesc.Count;
|
||||
@@ -2045,6 +2047,8 @@ void D3D11Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx;
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = arrayIdx;
|
||||
if(sampleCount > 1)
|
||||
texDisplay.sliceFace /= sampleCount;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.scale = 1.0f;
|
||||
|
||||
@@ -2940,6 +2940,8 @@ void D3D12Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
bool isDepth = IsDepthFormat(resDesc.Format);
|
||||
bool isStencil = IsDepthAndStencilFormat(resDesc.Format);
|
||||
|
||||
UINT sampleCount = copyDesc.SampleDesc.Count;
|
||||
|
||||
if(copyDesc.SampleDesc.Count > 1)
|
||||
{
|
||||
// make image n-array instead of n-samples
|
||||
@@ -3013,6 +3015,8 @@ void D3D12Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx;
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = arrayIdx;
|
||||
if(sampleCount > 1)
|
||||
texDisplay.sliceFace /= sampleCount;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.scale = 1.0f;
|
||||
|
||||
@@ -367,9 +367,14 @@ 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;
|
||||
}
|
||||
else
|
||||
ubo->Slice = (float)(cfg.sliceFace >> cfg.mip);
|
||||
{
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, uint32_t(texDetails.samples - 1));
|
||||
ubo->Slice = (float)(sliceFace >> cfg.mip);
|
||||
}
|
||||
|
||||
ubo->OutputDisplayFormat = resType;
|
||||
|
||||
|
||||
@@ -2326,9 +2326,11 @@ void GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
texDisplay.overlay = DebugOverlay::NoOverlay;
|
||||
texDisplay.flipY = false;
|
||||
texDisplay.mip = mip;
|
||||
texDisplay.sampleIdx = ~0U;
|
||||
texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx;
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = arrayIdx;
|
||||
if(samples > 1)
|
||||
texDisplay.sliceFace /= samples;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.scale = 1.0f;
|
||||
@@ -2374,9 +2376,11 @@ void GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
texDisplay.overlay = DebugOverlay::NoOverlay;
|
||||
texDisplay.flipY = false;
|
||||
texDisplay.mip = mip;
|
||||
texDisplay.sampleIdx = ~0U;
|
||||
texDisplay.sampleIdx = params.resolve ? ~0U : arrayIdx;
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = arrayIdx;
|
||||
if(samples > 1)
|
||||
texDisplay.sliceFace /= samples;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.scale = 1.0f;
|
||||
|
||||
@@ -274,9 +274,14 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
|
||||
data->MipLevel = (int)cfg.mip;
|
||||
data->Slice = 0;
|
||||
if(iminfo.type != VK_IMAGE_TYPE_3D)
|
||||
{
|
||||
data->Slice = (float)cfg.sliceFace + 0.001f;
|
||||
}
|
||||
else
|
||||
data->Slice = (float)(cfg.sliceFace >> cfg.mip);
|
||||
{
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, uint32_t(iminfo.samples - 1));
|
||||
data->Slice = (float)(sliceFace >> cfg.mip);
|
||||
}
|
||||
|
||||
data->TextureResolutionPS.x = float(RDCMAX(1, tex_x >> cfg.mip));
|
||||
data->TextureResolutionPS.y = float(RDCMAX(1, tex_y >> cfg.mip));
|
||||
|
||||
@@ -2384,7 +2384,7 @@ void VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mi
|
||||
return;
|
||||
}
|
||||
|
||||
VulkanCreationInfo::Image &imInfo = m_pDriver->m_CreationInfo.m_Image[tex];
|
||||
const VulkanCreationInfo::Image &imInfo = m_pDriver->m_CreationInfo.m_Image[tex];
|
||||
|
||||
ImageLayouts &layouts = m_pDriver->m_ImageLayouts[tex];
|
||||
|
||||
@@ -2593,6 +2593,8 @@ void VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mi
|
||||
texDisplay.sampleIdx = imInfo.type == VK_IMAGE_TYPE_3D ? 0 : (params.resolve ? ~0U : arrayIdx);
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = imInfo.type == VK_IMAGE_TYPE_3D ? i : arrayIdx;
|
||||
if(imInfo.samples > 1)
|
||||
texDisplay.sliceFace /= imInfo.samples;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.scale = 1.0f;
|
||||
|
||||
Reference in new issue
Block a user