Ensure view instancing array is properly copied in D3D12 pipeline desc

This commit is contained in:
baldurk
2020-09-21 18:18:23 +01:00
parent c8c138a7ef
commit 28463fd716
2 changed files with 29 additions and 0 deletions
@@ -141,6 +141,20 @@ bool WrappedID3D12Device::Serialise_CreatePipelineState(SerialiserType &ser,
{
wrapped->graphics->StreamOutput.pBufferStrides = NULL;
}
if(wrapped->graphics->ViewInstancing.ViewInstanceCount)
{
wrapped->graphics->ViewInstancing.pViewInstanceLocations =
new D3D12_VIEW_INSTANCE_LOCATION[wrapped->graphics->ViewInstancing.ViewInstanceCount];
memcpy((void *)wrapped->graphics->ViewInstancing.pViewInstanceLocations,
Descriptor.ViewInstancing.pViewInstanceLocations,
sizeof(D3D12_VIEW_INSTANCE_LOCATION) *
wrapped->graphics->ViewInstancing.ViewInstanceCount);
}
else
{
wrapped->graphics->ViewInstancing.pViewInstanceLocations = NULL;
}
}
GetResourceManager()->AddLiveResource(pPipelineState, ret);
@@ -265,6 +279,20 @@ HRESULT WrappedID3D12Device::CreatePipelineState(const D3D12_PIPELINE_STATE_STRE
{
wrapped->graphics->StreamOutput.pBufferStrides = NULL;
}
if(wrapped->graphics->ViewInstancing.ViewInstanceCount)
{
wrapped->graphics->ViewInstancing.pViewInstanceLocations =
new D3D12_VIEW_INSTANCE_LOCATION[wrapped->graphics->ViewInstancing.ViewInstanceCount];
memcpy((void *)wrapped->graphics->ViewInstancing.pViewInstanceLocations,
expandedDesc.ViewInstancing.pViewInstanceLocations,
sizeof(D3D12_VIEW_INSTANCE_LOCATION) *
wrapped->graphics->ViewInstancing.ViewInstanceCount);
}
else
{
wrapped->graphics->ViewInstancing.pViewInstanceLocations = NULL;
}
}
}
+1
View File
@@ -801,6 +801,7 @@ public:
SAFE_DELETE_ARRAY(graphics->InputLayout.pInputElementDescs);
SAFE_DELETE_ARRAY(graphics->StreamOutput.pSODeclaration);
SAFE_DELETE_ARRAY(graphics->StreamOutput.pBufferStrides);
SAFE_DELETE_ARRAY(graphics->ViewInstancing.pViewInstanceLocations);
SAFE_DELETE(graphics);
}