mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Handle creating backbuffer views with non-NULL non-typed descriptor
* We already handle the case where e.g. D3D12_RENDER_TARGET_VIEW_DESC is NULL and we need to substitute in a typed descriptor for backbuffers. We didn't handle the case where
This commit is contained in:
@@ -547,9 +547,10 @@ D3D12_CPU_DESCRIPTOR_HANDLE D3D12DebugManager::GetTempDescriptor(const D3D12Desc
|
||||
|
||||
const D3D12_RENDER_TARGET_VIEW_DESC *rtvdesc = &desc.GetRTV();
|
||||
if(rtvdesc->ViewDimension == D3D12_RTV_DIMENSION_UNKNOWN)
|
||||
{
|
||||
rtvdesc = NULL;
|
||||
|
||||
if(rtvdesc == NULL || rtvdesc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
const std::map<ResourceId, DXGI_FORMAT> &bbs = m_pDevice->GetBackbufferFormats();
|
||||
|
||||
auto it = bbs.find(GetResID(res));
|
||||
@@ -589,9 +590,10 @@ D3D12_CPU_DESCRIPTOR_HANDLE D3D12DebugManager::GetTempDescriptor(const D3D12Desc
|
||||
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *uavdesc = &unpacked;
|
||||
if(uavdesc->ViewDimension == D3D12_UAV_DIMENSION_UNKNOWN)
|
||||
{
|
||||
uavdesc = NULL;
|
||||
|
||||
if(uavdesc == NULL || uavdesc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
const std::map<ResourceId, DXGI_FORMAT> &bbs = m_pDevice->GetBackbufferFormats();
|
||||
|
||||
auto it = bbs.find(GetResID(res));
|
||||
|
||||
@@ -871,7 +871,7 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser,
|
||||
WrappedID3D12Resource1 *pRes = (WrappedID3D12Resource1 *)realSurface;
|
||||
|
||||
SERIALISE_ELEMENT(Buffer);
|
||||
SERIALISE_ELEMENT_LOCAL(SwapbufferID, GetResID(pRes)).TypedAs("IDXGISwapChain *");
|
||||
SERIALISE_ELEMENT_LOCAL(SwapbufferID, GetResID(pRes)).TypedAs("ID3D12Resource *");
|
||||
SERIALISE_ELEMENT_LOCAL(BackbufferDescriptor, pRes->GetDesc());
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
@@ -187,6 +187,21 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
|
||||
// by referring to a resource that was deleted), use a default descriptor
|
||||
desc = defaultSRV();
|
||||
}
|
||||
else if(desc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
|
||||
|
||||
auto it = bbs.find(GetResID(res));
|
||||
|
||||
// fixup for backbuffers
|
||||
if(it != bbs.end())
|
||||
{
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC bbDesc = *desc;
|
||||
bbDesc.Format = it->second;
|
||||
dev->CreateShaderResourceView(res, &bbDesc, handle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC planeDesc;
|
||||
// ensure that multi-plane formats have a valid plane slice specified. This shouldn't be
|
||||
@@ -262,6 +277,21 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
|
||||
// by referring to a resource that was deleted), use a default descriptor
|
||||
desc = defaultRTV();
|
||||
}
|
||||
else if(desc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
|
||||
|
||||
auto it = bbs.find(GetResID(res));
|
||||
|
||||
// fixup for backbuffers
|
||||
if(it != bbs.end())
|
||||
{
|
||||
D3D12_RENDER_TARGET_VIEW_DESC bbDesc = *desc;
|
||||
bbDesc.Format = it->second;
|
||||
dev->CreateRenderTargetView(res, &bbDesc, handle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
D3D12_RENDER_TARGET_VIEW_DESC planeDesc;
|
||||
// ensure that multi-plane formats have a valid plane slice specified. This shouldn't be
|
||||
@@ -356,6 +386,21 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
|
||||
// default descriptor
|
||||
desc = defaultUAV();
|
||||
}
|
||||
else if(desc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
|
||||
|
||||
auto it = bbs.find(GetResID(res));
|
||||
|
||||
// fixup for backbuffers
|
||||
if(it != bbs.end())
|
||||
{
|
||||
D3D12_UNORDERED_ACCESS_VIEW_DESC bbDesc = *desc;
|
||||
bbDesc.Format = it->second;
|
||||
dev->CreateUnorderedAccessView(res, NULL, &bbDesc, handle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(countRes == NULL && desc && desc->ViewDimension == D3D12_UAV_DIMENSION_BUFFER)
|
||||
desc->Buffer.CounterOffsetInBytes = 0;
|
||||
|
||||
Reference in New Issue
Block a user