mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-20 02:51:13 +00:00
The slice parameter for 3D textures should be mip-relative too
This commit is contained in:
11 files changed
+62
-51
No files matched your search
@@ -3530,9 +3530,6 @@ void TextureViewer::on_sliceFace_currentIndexChanged(int index)
|
||||
TextureDescription &tex = *texptr;
|
||||
m_TexDisplay.sliceFace = (uint32_t)qMax(0, index);
|
||||
|
||||
if(tex.depth > 1)
|
||||
m_TexDisplay.sliceFace = (uint32_t)(qMax(0, index) << (int)m_TexDisplay.mip);
|
||||
|
||||
INVOKE_MEMFN(RT_UpdateVisualRange);
|
||||
|
||||
if(m_Output != NULL && m_PickedPoint.x() >= 0 && m_PickedPoint.y() >= 0)
|
||||
@@ -3618,9 +3615,6 @@ void TextureViewer::on_saveTex_clicked()
|
||||
m_SaveConfig.slice.sliceIndex = (int)m_TexDisplay.sliceFace;
|
||||
m_SaveConfig.mip = (int)m_TexDisplay.mip;
|
||||
|
||||
if(texptr->depth > 1)
|
||||
m_SaveConfig.slice.sliceIndex = (int)m_TexDisplay.sliceFace >> (int)m_TexDisplay.mip;
|
||||
|
||||
m_SaveConfig.channelExtract = -1;
|
||||
if(m_TexDisplay.red && !m_TexDisplay.green && !m_TexDisplay.blue && !m_TexDisplay.alpha)
|
||||
m_SaveConfig.channelExtract = 0;
|
||||
|
||||
@@ -632,7 +632,10 @@ std::vector<PixelModification> D3D11Replay::PixelHistory(std::vector<EventUsage>
|
||||
colourCopyParams.intTex = intTex;
|
||||
colourCopyParams.srcxyCBuf = srcxyCBuf;
|
||||
colourCopyParams.storexyCBuf = storexyCBuf;
|
||||
colourCopyParams.subres = details.texArraySize * slice + mip;
|
||||
if(details.texType == eTexType_3D)
|
||||
colourCopyParams.subres = mip;
|
||||
else
|
||||
colourCopyParams.subres = details.texArraySize * slice + mip;
|
||||
|
||||
CopyPixelParams depthCopyParams = colourCopyParams;
|
||||
|
||||
|
||||
@@ -703,12 +703,12 @@ bool D3D11Replay::RenderTextureInternal(TextureDisplay cfg, bool blendAlpha)
|
||||
|
||||
pixelData.MipLevel = (float)cfg.mip;
|
||||
pixelData.OutputDisplayFormat = RESTYPE_TEX2D;
|
||||
pixelData.Slice = float(RDCCLAMP(cfg.sliceFace, 0U, details.texArraySize - 1));
|
||||
pixelData.Slice = float(RDCCLAMP(cfg.sliceFace, 0U, details.texArraySize - 1) + 0.001f);
|
||||
|
||||
if(details.texType == eTexType_3D)
|
||||
{
|
||||
pixelData.OutputDisplayFormat = RESTYPE_TEX3D;
|
||||
pixelData.Slice = float(cfg.sliceFace >> cfg.mip);
|
||||
pixelData.Slice = float(RDCCLAMP(cfg.sliceFace, 0U, (details.texDepth >> cfg.mip) - 1) + 0.001f);
|
||||
}
|
||||
else if(details.texType == eTexType_1D)
|
||||
{
|
||||
|
||||
@@ -1608,7 +1608,10 @@ bool D3D11Replay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mi
|
||||
cdata.HistogramTextureResolution.x = (float)RDCMAX(details.texWidth >> mip, 1U);
|
||||
cdata.HistogramTextureResolution.y = (float)RDCMAX(details.texHeight >> mip, 1U);
|
||||
cdata.HistogramTextureResolution.z = (float)RDCMAX(details.texDepth >> mip, 1U);
|
||||
cdata.HistogramSlice = (float)sliceFace;
|
||||
if(details.texType == eTexType_3D)
|
||||
cdata.HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, (details.texDepth >> mip) - 1);
|
||||
else
|
||||
cdata.HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, details.texArraySize - 1);
|
||||
cdata.HistogramMip = mip;
|
||||
cdata.HistogramSample = (int)RDCCLAMP(sample, 0U, details.sampleCount - 1);
|
||||
if(sample == ~0U)
|
||||
@@ -1655,9 +1658,6 @@ bool D3D11Replay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mi
|
||||
intIdx = 2;
|
||||
}
|
||||
|
||||
if(details.texType == eTexType_3D)
|
||||
cdata.HistogramSlice = float(sliceFace);
|
||||
|
||||
ID3D11Buffer *cbuf = GetDebugManager()->MakeCBuffer(&cdata, sizeof(cdata));
|
||||
|
||||
UINT zeroes[] = {0, 0, 0, 0};
|
||||
@@ -1724,7 +1724,10 @@ bool D3D11Replay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
cdata.HistogramTextureResolution.x = (float)RDCMAX(details.texWidth >> mip, 1U);
|
||||
cdata.HistogramTextureResolution.y = (float)RDCMAX(details.texHeight >> mip, 1U);
|
||||
cdata.HistogramTextureResolution.z = (float)RDCMAX(details.texDepth >> mip, 1U);
|
||||
cdata.HistogramSlice = (float)sliceFace;
|
||||
if(details.texType == eTexType_3D)
|
||||
cdata.HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, (details.texDepth >> mip) - 1);
|
||||
else
|
||||
cdata.HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, details.texArraySize - 1);
|
||||
cdata.HistogramMip = mip;
|
||||
cdata.HistogramSample = (int)RDCCLAMP(sample, 0U, details.sampleCount - 1);
|
||||
if(sample == ~0U)
|
||||
@@ -1760,9 +1763,6 @@ bool D3D11Replay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
intIdx = 2;
|
||||
}
|
||||
|
||||
if(details.texType == eTexType_3D)
|
||||
cdata.HistogramSlice = float(sliceFace);
|
||||
|
||||
ID3D11Buffer *cbuf = GetDebugManager()->MakeCBuffer(&cdata, sizeof(cdata));
|
||||
|
||||
m_pImmediateContext->OMSetRenderTargetsAndUnorderedAccessViews(0, NULL, NULL, 0, 0, NULL, NULL);
|
||||
@@ -2282,7 +2282,7 @@ void D3D11Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
texDisplay.mip = mip;
|
||||
texDisplay.sampleIdx = 0;
|
||||
texDisplay.customShaderId = ResourceId();
|
||||
texDisplay.sliceFace = i << mip;
|
||||
texDisplay.sliceFace = i;
|
||||
texDisplay.rangeMin = params.blackPoint;
|
||||
texDisplay.rangeMax = params.whitePoint;
|
||||
texDisplay.resourceId = tex;
|
||||
|
||||
@@ -446,10 +446,14 @@ bool D3D12Replay::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, Texture
|
||||
|
||||
pixelData.MipLevel = (float)cfg.mip;
|
||||
pixelData.OutputDisplayFormat = RESTYPE_TEX2D;
|
||||
pixelData.Slice = float(RDCCLAMP(cfg.sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)));
|
||||
|
||||
if(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
pixelData.Slice = float(cfg.sliceFace >> cfg.mip);
|
||||
pixelData.Slice =
|
||||
float(RDCCLAMP(cfg.sliceFace, 0U, uint32_t((resourceDesc.DepthOrArraySize >> cfg.mip) - 1)) +
|
||||
0.001f);
|
||||
else
|
||||
pixelData.Slice =
|
||||
float(RDCCLAMP(cfg.sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)) + 0.001f);
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
int resType = 0;
|
||||
|
||||
@@ -2267,10 +2267,12 @@ bool D3D12Replay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
if(resourceDesc.DepthOrArraySize > 1 && resourceDesc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
cdata.HistogramTextureResolution.z = float(resourceDesc.DepthOrArraySize);
|
||||
|
||||
cdata.HistogramSlice = float(RDCCLAMP(sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)));
|
||||
|
||||
if(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
cdata.HistogramSlice = float(sliceFace) / float(resourceDesc.DepthOrArraySize);
|
||||
cdata.HistogramSlice =
|
||||
float(RDCCLAMP(sliceFace, 0U, uint32_t((resourceDesc.DepthOrArraySize >> mip) - 1)));
|
||||
else
|
||||
cdata.HistogramSlice =
|
||||
float(RDCCLAMP(sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)));
|
||||
|
||||
cdata.HistogramMip = mip;
|
||||
cdata.HistogramSample = (int)RDCCLAMP(sample, 0U, resourceDesc.SampleDesc.Count - 1);
|
||||
@@ -2447,10 +2449,12 @@ bool D3D12Replay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mi
|
||||
if(resourceDesc.DepthOrArraySize > 1 && resourceDesc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
cdata.HistogramTextureResolution.z = float(resourceDesc.DepthOrArraySize);
|
||||
|
||||
cdata.HistogramSlice = float(RDCCLAMP(sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)));
|
||||
|
||||
if(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
cdata.HistogramSlice = float(sliceFace) / float(resourceDesc.DepthOrArraySize);
|
||||
cdata.HistogramSlice =
|
||||
float(RDCCLAMP(sliceFace, 0U, uint32_t((resourceDesc.DepthOrArraySize >> mip) - 1)));
|
||||
else
|
||||
cdata.HistogramSlice =
|
||||
float(RDCCLAMP(sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)));
|
||||
|
||||
cdata.HistogramMip = mip;
|
||||
cdata.HistogramSample = (int)RDCCLAMP(sample, 0U, resourceDesc.SampleDesc.Count - 1);
|
||||
@@ -3138,9 +3142,6 @@ void D3D12Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip
|
||||
// scale here
|
||||
texDisplay.scale = 1.0f / float(1 << mip);
|
||||
|
||||
if(copyDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
texDisplay.sliceFace = loop << mip;
|
||||
|
||||
RenderTextureInternal(GetDebugManager()->GetCPUHandle(GET_TEX_RTV), texDisplay, flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -1485,10 +1485,11 @@ bool GLReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uin
|
||||
cdata->HistogramTextureResolution.x = (float)RDCMAX(details.width >> mip, 1U);
|
||||
cdata->HistogramTextureResolution.y = (float)RDCMAX(details.height >> mip, 1U);
|
||||
cdata->HistogramTextureResolution.z = (float)RDCMAX(details.depth >> mip, 1U);
|
||||
if(texDetails.curType != eGL_TEXTURE_3D)
|
||||
cdata->HistogramSlice = (float)sliceFace + 0.001f;
|
||||
if(texDetails.curType == eGL_TEXTURE_3D)
|
||||
cdata->HistogramSlice =
|
||||
(float)RDCCLAMP(sliceFace, 0U, uint32_t(details.depth >> mip) - 1) + 0.001f;
|
||||
else
|
||||
cdata->HistogramSlice = (float)(sliceFace >> mip);
|
||||
cdata->HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, details.arraysize - 1) + 0.001f;
|
||||
cdata->HistogramMip = (int)mip;
|
||||
cdata->HistogramNumSamples = texDetails.samples;
|
||||
cdata->HistogramSample = (int)RDCCLAMP(sample, 0U, details.msSamp - 1);
|
||||
@@ -1745,10 +1746,11 @@ bool GLReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
cdata->HistogramTextureResolution.x = (float)RDCMAX(details.width >> mip, 1U);
|
||||
cdata->HistogramTextureResolution.y = (float)RDCMAX(details.height >> mip, 1U);
|
||||
cdata->HistogramTextureResolution.z = (float)RDCMAX(details.depth >> mip, 1U);
|
||||
if(texDetails.curType != eGL_TEXTURE_3D)
|
||||
cdata->HistogramSlice = (float)sliceFace + 0.001f;
|
||||
if(texDetails.curType == eGL_TEXTURE_3D)
|
||||
cdata->HistogramSlice =
|
||||
(float)RDCCLAMP(sliceFace, 0U, uint32_t(details.depth >> mip) - 1) + 0.001f;
|
||||
else
|
||||
cdata->HistogramSlice = (float)(sliceFace >> mip);
|
||||
cdata->HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, details.arraysize - 1) + 0.001f;
|
||||
cdata->HistogramMip = mip;
|
||||
cdata->HistogramNumSamples = texDetails.samples;
|
||||
cdata->HistogramSample = (int)RDCCLAMP(sample, 0U, details.msSamp - 1);
|
||||
|
||||
@@ -368,14 +368,12 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, int flags)
|
||||
ubo->MipLevel = (int)cfg.mip;
|
||||
if(texDetails.curType != eGL_TEXTURE_3D)
|
||||
{
|
||||
uint32_t depth = RDCMAX((uint32_t)texDetails.depth, 1U);
|
||||
uint32_t numSlices = RDCMAX((uint32_t)texDetails.depth, 1U);
|
||||
if(texDetails.curType == eGL_TEXTURE_CUBE_MAP)
|
||||
depth *= 6;
|
||||
numSlices *= 6;
|
||||
|
||||
if(texDetails.curType == eGL_TEXTURE_1D_ARRAY)
|
||||
depth = RDCMAX((uint32_t)texDetails.height, 1U);
|
||||
|
||||
uint32_t numSlices = depth * RDCMAX((uint32_t)texDetails.samples, 1U);
|
||||
numSlices = RDCMAX((uint32_t)texDetails.height, 1U);
|
||||
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, numSlices - 1);
|
||||
ubo->Slice = (float)sliceFace + 0.001f;
|
||||
@@ -383,7 +381,7 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, int flags)
|
||||
else
|
||||
{
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, RDCMAX((uint32_t)texDetails.depth, 1U) - 1);
|
||||
ubo->Slice = (float)(sliceFace >> cfg.mip);
|
||||
ubo->Slice = (float)sliceFace + 0.001f;
|
||||
}
|
||||
|
||||
ubo->OutputDisplayFormat = resType;
|
||||
|
||||
@@ -279,8 +279,7 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
|
||||
data->Slice = 0;
|
||||
if(iminfo.type != VK_IMAGE_TYPE_3D)
|
||||
{
|
||||
uint32_t numSlices =
|
||||
RDCMAX((uint32_t)iminfo.arrayLayers, 1U) * RDCMAX((uint32_t)iminfo.samples, 1U);
|
||||
uint32_t numSlices = RDCMAX((uint32_t)iminfo.arrayLayers, 1U);
|
||||
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, numSlices - 1);
|
||||
data->Slice = (float)sliceFace + 0.001f;
|
||||
@@ -288,7 +287,7 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
|
||||
else
|
||||
{
|
||||
uint32_t sliceFace = RDCCLAMP(cfg.sliceFace, 0U, iminfo.extent.depth - 1);
|
||||
data->Slice = (float)(sliceFace >> cfg.mip);
|
||||
data->Slice = (float)sliceFace + 0.001f;
|
||||
}
|
||||
|
||||
data->TextureResolutionPS.x = float(RDCMAX(1, tex_x >> cfg.mip));
|
||||
|
||||
@@ -2328,10 +2328,11 @@ bool VulkanReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip,
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width) >> mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height) >> mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.extent.depth) >> mip, 1U);
|
||||
if(iminfo.type != VK_IMAGE_TYPE_3D)
|
||||
data->HistogramSlice = (float)sliceFace + 0.001f;
|
||||
if(iminfo.type == VK_IMAGE_TYPE_3D)
|
||||
data->HistogramSlice =
|
||||
(float)RDCCLAMP(sliceFace, 0U, uint32_t(iminfo.extent.depth >> mip) - 1) + 0.001f;
|
||||
else
|
||||
data->HistogramSlice = (float)(sliceFace >> mip);
|
||||
data->HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, (uint32_t)iminfo.arrayLayers - 1) + 0.001f;
|
||||
data->HistogramMip = (int)mip;
|
||||
data->HistogramNumSamples = iminfo.samples;
|
||||
data->HistogramSample = (int)RDCCLAMP(sample, 0U, uint32_t(iminfo.samples) - 1);
|
||||
@@ -2648,10 +2649,11 @@ bool VulkanReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t m
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width) >> mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height) >> mip, 1U);
|
||||
data->HistogramTextureResolution.z = (float)RDCMAX(uint32_t(iminfo.extent.depth) >> mip, 1U);
|
||||
if(iminfo.type != VK_IMAGE_TYPE_3D)
|
||||
data->HistogramSlice = (float)sliceFace + 0.001f;
|
||||
if(iminfo.type == VK_IMAGE_TYPE_3D)
|
||||
data->HistogramSlice =
|
||||
(float)RDCCLAMP(sliceFace, 0U, uint32_t(iminfo.extent.depth >> mip) - 1) + 0.001f;
|
||||
else
|
||||
data->HistogramSlice = (float)(sliceFace >> mip);
|
||||
data->HistogramSlice = (float)RDCCLAMP(sliceFace, 0U, (uint32_t)iminfo.arrayLayers - 1) + 0.001f;
|
||||
data->HistogramMip = (int)mip;
|
||||
data->HistogramNumSamples = iminfo.samples;
|
||||
data->HistogramSample = (int)RDCCLAMP(sample, 0U, uint32_t(iminfo.samples) - 1);
|
||||
|
||||
@@ -1567,7 +1567,15 @@ rdcarray<PixelModification> ReplayController::PixelHistory(ResourceId target, ui
|
||||
if(m_Textures[t].msSamp == 1)
|
||||
sampleIdx = ~0U;
|
||||
|
||||
slice = RDCCLAMP(slice, 0U, m_Textures[t].arraysize);
|
||||
if(m_Textures[t].dimension == 3)
|
||||
{
|
||||
slice = RDCCLAMP(slice, 0U, m_Textures[t].depth >> mip);
|
||||
}
|
||||
else
|
||||
{
|
||||
slice = RDCCLAMP(slice, 0U, m_Textures[t].arraysize);
|
||||
}
|
||||
|
||||
mip = RDCCLAMP(mip, 0U, m_Textures[t].mips);
|
||||
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user