Skip to content

Commit

Permalink
Fix unwrapping and replay of AddToStateObject
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed May 17, 2024
1 parent 4ba41da commit 1019b7f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions renderdoc/driver/d3d12/d3d12_device_wrap7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ bool WrappedID3D12Device::Serialise_AddToStateObject(SerialiserType &ser,

if(m_pDevice7)
{
hr = m_pDevice7->CreateStateObject(&Addition, guid, (void **)&ret);
hr = m_pDevice7->AddToStateObject(&Addition, Unwrap(pStateObjectToGrowFrom), guid,
(void **)&ret);
}
else
{
Expand Down Expand Up @@ -147,21 +148,22 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Device::AddToStateObject(
REFIID riid, _COM_Outptr_ void **ppNewStateObject)
{
if(pAddition == NULL)
return m_pDevice7->AddToStateObject(pAddition, pStateObjectToGrowFrom, riid, ppNewStateObject);
return m_pDevice7->AddToStateObject(pAddition, Unwrap(pStateObjectToGrowFrom), riid,
ppNewStateObject);

D3D12_UNWRAPPED_STATE_OBJECT_DESC unwrappedDesc(*pAddition);

if(ppNewStateObject == NULL)
return m_pDevice7->AddToStateObject(&unwrappedDesc, pStateObjectToGrowFrom, riid,
return m_pDevice7->AddToStateObject(&unwrappedDesc, Unwrap(pStateObjectToGrowFrom), riid,
ppNewStateObject);

if(riid != __uuidof(ID3D12StateObject))
return E_NOINTERFACE;

ID3D12StateObject *real = NULL;
HRESULT ret;
SERIALISE_TIME_CALL(ret = m_pDevice7->AddToStateObject(&unwrappedDesc, pStateObjectToGrowFrom,
riid, (void **)&real));
SERIALISE_TIME_CALL(ret = m_pDevice7->AddToStateObject(
&unwrappedDesc, Unwrap(pStateObjectToGrowFrom), riid, (void **)&real));

if(SUCCEEDED(ret))
{
Expand Down Expand Up @@ -215,6 +217,8 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Device::AddToStateObject(
}
}

record->AddParent(GetRecord(pStateObjectToGrowFrom));

if(vendorChunk)
record->AddChunk(vendorChunk);
record->AddChunk(scope.Get());
Expand Down

0 comments on commit 1019b7f

Please sign in to comment.