Fix D3D12 depth targets using the wrong formats in TextureViewer

This commit is contained in:
Steve Karolewics
2020-12-03 21:36:05 -08:00
committed by Baldur Karlsson
parent e2d47fa1a5
commit 07fce392a6
2 changed files with 11 additions and 13 deletions
+10 -11
View File
@@ -59,7 +59,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY;
srvDesc.Texture2DMSArray.ArraySize = ~0U;
if(IsDepthFormat(resourceDesc.Format))
if(IsDepthFormat(srvDesc.Format))
srvOffset = RESTYPE_DEPTH_MS;
}
else
@@ -69,7 +69,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
srvDesc.Texture2D.MipLevels = ~0U;
srvDesc.Texture2DArray.ArraySize = ~0U;
if(IsDepthFormat(resourceDesc.Format))
if(IsDepthFormat(srvDesc.Format))
srvOffset = RESTYPE_DEPTH;
}
}
@@ -85,7 +85,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
// if it's a depth and stencil image, increment (as the restype for
// depth/stencil is one higher than that for depth only).
if(IsDepthAndStencilFormat(resourceDesc.Format))
if(IsDepthAndStencilFormat(srvDesc.Format))
resType++;
if(IsUIntFormat(srvDesc.Format))
@@ -100,8 +100,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
D3D12_SHADER_RESOURCE_VIEW_DESC altSRVDesc = {};
// for non-typeless depth formats, we need to copy to a typeless resource for read
if(IsDepthFormat(resourceDesc.Format) &&
GetTypelessFormat(resourceDesc.Format) != resourceDesc.Format)
if(IsDepthFormat(srvDesc.Format) && GetTypelessFormat(srvDesc.Format) != srvDesc.Format)
{
realResourceState = D3D12_RESOURCE_STATE_COPY_SOURCE;
copy = true;
@@ -127,11 +126,11 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
}
}
if(IsYUVFormat(resourceDesc.Format))
if(IsYUVFormat(srvDesc.Format))
{
altSRVDesc = srvDesc;
srvDesc.Format = GetYUVViewPlane0Format(resourceDesc.Format);
altSRVDesc.Format = GetYUVViewPlane1Format(resourceDesc.Format);
srvDesc.Format = GetYUVViewPlane0Format(srvDesc.Format);
altSRVDesc.Format = GetYUVViewPlane1Format(srvDesc.Format);
// assume YUV textures are 2D or 2D arrays
RDCASSERT(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D);
@@ -141,7 +140,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
}
// even for non-copies, we need to make two SRVs to sample stencil as well
if(IsDepthAndStencilFormat(resourceDesc.Format) && altSRVDesc.Format == DXGI_FORMAT_UNKNOWN)
if(IsDepthAndStencilFormat(srvDesc.Format) && altSRVDesc.Format == DXGI_FORMAT_UNKNOWN)
{
switch(GetTypelessFormat(srvDesc.Format))
{
@@ -159,7 +158,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
}
}
if(altSRVDesc.Format != DXGI_FORMAT_UNKNOWN && !IsYUVFormat(resourceDesc.Format))
if(altSRVDesc.Format != DXGI_FORMAT_UNKNOWN && !IsYUVFormat(srvDesc.Format))
{
D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {};
formatInfo.Format = srvDesc.Format;
@@ -307,7 +306,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
m_pDevice->CreateShaderResourceView(resource, &srvDesc, srv);
if(altSRVDesc.Format != DXGI_FORMAT_UNKNOWN)
{
if(IsYUVFormat(resourceDesc.Format))
if(IsYUVFormat(srvDesc.Format))
{
srv = GetCPUHandle(FIRST_TEXDISPLAY_SRV);
// YUV second plane is in slot 10
+1 -2
View File
@@ -712,8 +712,7 @@ void D3D12Replay::FillResourceView(D3D12Pipe::View &view, const D3D12Descriptor
{
const D3D12_DEPTH_STENCIL_VIEW_DESC &dsv = desc->GetDSV();
// we deliberately don't apply the DSV format
// fmt = dsv.Format;
fmt = dsv.Format;
view.type = MakeTextureDim(dsv.ViewDimension);