Handle multiple swapchain buffers being present in a D3D12 capture

This commit is contained in:
baldurk committed 2016-11-24 19:47:05 +01:00
1 parent 6ef7dbb356
commit 968805b39a
3 files changed
+21 -9

No files matched your search

+1 -1
View File
@@ -671,7 +671,7 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(Serialiser *localSeriali
GetResourceManager()->AddLiveResource(TexID, fakeBB);
m_BackbufferFormat = std::make_pair(wrapped->GetResourceID(), swapFormat);
m_BackbufferFormat[wrapped->GetResourceID()] = swapFormat;
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
+2 -2
View File
@@ -326,7 +326,7 @@ private:
};
map<WrappedIDXGISwapChain4 *, SwapPresentInfo> m_SwapChains;
pair<ResourceId, DXGI_FORMAT> m_BackbufferFormat;
map<ResourceId, DXGI_FORMAT> m_BackbufferFormat;
WrappedIDXGISwapChain4 *m_LastSwap;
@@ -371,7 +371,7 @@ public:
return m_ResourceStates[id];
}
const map<ResourceId, SubresourceStateVector> &GetSubresourceStates() { return m_ResourceStates; }
const pair<ResourceId, DXGI_FORMAT> GetBackbufferFormat() { return m_BackbufferFormat; }
const map<ResourceId, DXGI_FORMAT> &GetBackbufferFormats() { return m_BackbufferFormat; }
void SetLogFile(const char *logfile);
void SetLogVersion(uint32_t fileversion) { m_InitParams.SerialiseVersion = fileversion; }
D3D12Replay *GetReplay() { return &m_Replay; }
+18 -6
View File
@@ -148,11 +148,15 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
{
desc = nonsamp.resource ? NULL : defaultSRV();
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
auto it = bbs.find(GetResID(nonsamp.resource));
// fixup for backbuffers
if(dev->GetBackbufferFormat().first == GetResID(nonsamp.resource))
if(it != bbs.end())
{
D3D12_SHADER_RESOURCE_VIEW_DESC bbDesc = {};
bbDesc.Format = dev->GetBackbufferFormat().second;
bbDesc.Format = it->second;
bbDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
bbDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
bbDesc.Texture2D.MipLevels = 1;
@@ -217,11 +221,15 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
{
desc = nonsamp.resource ? NULL : defaultRTV();
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
auto it = bbs.find(GetResID(nonsamp.resource));
// fixup for backbuffers
if(dev->GetBackbufferFormat().first == GetResID(nonsamp.resource))
if(it != bbs.end())
{
D3D12_RENDER_TARGET_VIEW_DESC bbDesc = {};
bbDesc.Format = dev->GetBackbufferFormat().second;
bbDesc.Format = it->second;
bbDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
dev->CreateRenderTargetView(nonsamp.resource, &bbDesc, handle);
return;
@@ -303,11 +311,15 @@ void D3D12Descriptor::Create(D3D12_DESCRIPTOR_HEAP_TYPE heapType, WrappedID3D12D
{
desc = nonsamp.resource ? NULL : defaultUAV();
const map<ResourceId, DXGI_FORMAT> &bbs = dev->GetBackbufferFormats();
auto it = bbs.find(GetResID(nonsamp.resource));
// fixup for backbuffers
if(dev->GetBackbufferFormat().first == GetResID(nonsamp.resource))
if(it != bbs.end())
{
D3D12_UNORDERED_ACCESS_VIEW_DESC bbDesc = {};
bbDesc.Format = dev->GetBackbufferFormat().second;
bbDesc.Format = it->second;
bbDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
dev->CreateUnorderedAccessView(nonsamp.resource, NULL, &bbDesc, handle);
return;