diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index c84e442c2..9b8c55f0c 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -1005,6 +1005,7 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu case D3D12Chunk::Device_CreateStateObject: case D3D12Chunk::Device_AddToStateObject: case D3D12Chunk::CreateAS: + case D3D12Chunk::StateObject_SetPipelineStackSize: RDCERR("Unexpected chunk while processing frame: %s", ToStr(chunk).c_str()); return false; diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index 51e49f264..8334e6a7f 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -1223,5 +1223,6 @@ enum class D3D12Chunk : uint32_t List_DispatchRays, List_SetPipelineState1, CreateAS, + StateObject_SetPipelineStackSize, Max, }; diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index feaa6c3c7..a3140a2f8 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -3816,6 +3816,47 @@ void WrappedID3D12Device::SetShaderExtUAV(GPUVendor vendor, uint32_t reg, uint32 INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, SetShaderExtUAV, GPUVendor vendor, uint32_t reg, uint32_t space, bool global); +template +bool WrappedID3D12Device::Serialise_SetPipelineStackSize(SerialiserType &ser, + ID3D12StateObject *pStateObject, + UINT64 StackSize) +{ + SERIALISE_ELEMENT(pStateObject); + SERIALISE_ELEMENT(StackSize); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading() && pStateObject) + { + ID3D12StateObjectProperties *properties = NULL; + pStateObject->QueryInterface(__uuidof(ID3D12StateObjectProperties), (void **)&properties); + + properties->SetPipelineStackSize(StackSize); + + SAFE_RELEASE(properties); + } + + return true; +} + +void WrappedID3D12Device::SetPipelineStackSize(ID3D12StateObject *pStateObject, UINT64 StackSize) +{ + if(IsCaptureMode(m_State)) + { + D3D12ResourceRecord *record = GetRecord(pStateObject); + + { + WriteSerialiser &ser = GetThreadSerialiser(); + SCOPED_SERIALISE_CHUNK(D3D12Chunk::StateObject_SetPipelineStackSize); + Serialise_SetPipelineStackSize(ser, pStateObject, StackSize); + record->AddChunk(scope.Get()); + } + } +} + +INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, SetPipelineStackSize, + ID3D12StateObject *pStateObject, UINT64 StackSize); + void WrappedID3D12Device::SetShaderExt(GPUVendor vendor) { // just overwrite, we don't expect to switch back and forth on a given device. @@ -4455,6 +4496,8 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context) case D3D12Chunk::Device_AddToStateObject: return Serialise_AddToStateObject(ser, NULL, NULL, IID(), NULL); case D3D12Chunk::CreateAS: return Serialise_CreateAS(ser, NULL, 0, {}, NULL); + case D3D12Chunk::StateObject_SetPipelineStackSize: + return Serialise_SetPipelineStackSize(ser, NULL, 0); // in order to get a warning if we miss a case, we explicitly handle the list/queue chunks here. // If we actually encounter one it's an error (we should hit CaptureBegin first and switch to diff --git a/renderdoc/driver/d3d12/d3d12_device.h b/renderdoc/driver/d3d12/d3d12_device.h index cdaa4f34d..5828f0834 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -1280,6 +1280,8 @@ public: ID3D12PipelineState **state); // Resource + IMPLEMENT_FUNCTION_THREAD_SERIALISED(void, SetPipelineStackSize, ID3D12StateObject *pStateObject, + UINT64 StackSize); IMPLEMENT_FUNCTION_THREAD_SERIALISED(void, SetName, ID3D12DeviceChild *pResource, const char *Name); IMPLEMENT_FUNCTION_THREAD_SERIALISED(HRESULT, SetShaderDebugPath, ID3D12DeviceChild *pResource, const char *Path); diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index 7fd8d2e73..3d81d6b4c 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -1207,6 +1207,7 @@ public: } virtual void STDMETHODCALLTYPE SetPipelineStackSize(UINT64 PipelineStackSizeInBytes) { + m_pDevice->SetPipelineStackSize(this, PipelineStackSizeInBytes); properties->SetPipelineStackSize(PipelineStackSizeInBytes); } }; diff --git a/renderdoc/driver/d3d12/d3d12_stringise.cpp b/renderdoc/driver/d3d12/d3d12_stringise.cpp index 637db5257..61ed0a3a5 100644 --- a/renderdoc/driver/d3d12/d3d12_stringise.cpp +++ b/renderdoc/driver/d3d12/d3d12_stringise.cpp @@ -28,7 +28,7 @@ template <> rdcstr DoStringise(const D3D12Chunk &el) { - RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1132, "Chunks changed without updating names"); + RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1133, "Chunks changed without updating names"); BEGIN_ENUM_STRINGISE(D3D12Chunk) { @@ -234,6 +234,8 @@ rdcstr DoStringise(const D3D12Chunk &el) STRINGISE_ENUM_CLASS_NAMED(List_SetPipelineState1, "ID3D12GraphicsCommandList4::SetPipelineState1"); STRINGISE_ENUM_CLASS_NAMED(CreateAS, "Internal::Acceleration Structure Create"); + STRINGISE_ENUM_CLASS_NAMED(StateObject_SetPipelineStackSize, + "ID3D12StateObjectProperties::SetPipelineStackSize"); STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk"); } END_ENUM_STRINGISE()