From d3edbc5dd1edafdd90e9a9ca42396e6f7e34de9d Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 19 Apr 2023 16:00:18 +0100 Subject: [PATCH] Stub out new D3D12 device and command buffer interfaces * These are currently non-functional but will be implemented in follow-up commits so they're not committed disabled (inaccessible via QueryInterface etc). --- renderdoc/driver/d3d12/d3d12_command_list.h | 43 ++++++ .../driver/d3d12/d3d12_command_list7_wrap.cpp | 30 ++++ .../driver/d3d12/d3d12_command_list8_wrap.cpp | 30 ++++ .../driver/d3d12/d3d12_command_list9_wrap.cpp | 35 +++++ .../driver/d3d12/d3d12_command_list_wrap.cpp | 15 ++ renderdoc/driver/d3d12/d3d12_commands.cpp | 137 ++++++++++++++++++ renderdoc/driver/d3d12/d3d12_common.h | 13 +- renderdoc/driver/d3d12/d3d12_device.cpp | 109 ++++++++++++-- renderdoc/driver/d3d12/d3d12_device.h | 78 +++++++++- renderdoc/driver/d3d12/d3d12_device_wrap.cpp | 57 +++++++- .../driver/d3d12/d3d12_device_wrap10.cpp | 58 ++++++++ .../driver/d3d12/d3d12_device_wrap11.cpp | 33 +++++ .../driver/d3d12/d3d12_device_wrap12.cpp | 40 +++++ renderdoc/driver/d3d12/d3d12_device_wrap4.cpp | 16 +- renderdoc/driver/d3d12/d3d12_hooks.cpp | 25 +++- renderdoc/driver/d3d12/d3d12_stringise.cpp | 16 +- .../driver/d3d12/renderdoc_d3d12.vcxproj | 6 + .../d3d12/renderdoc_d3d12.vcxproj.filters | 18 +++ 18 files changed, 737 insertions(+), 22 deletions(-) create mode 100644 renderdoc/driver/d3d12/d3d12_command_list7_wrap.cpp create mode 100644 renderdoc/driver/d3d12/d3d12_command_list8_wrap.cpp create mode 100644 renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp create mode 100644 renderdoc/driver/d3d12/d3d12_device_wrap10.cpp create mode 100644 renderdoc/driver/d3d12/d3d12_device_wrap11.cpp create mode 100644 renderdoc/driver/d3d12/d3d12_device_wrap12.cpp diff --git a/renderdoc/driver/d3d12/d3d12_command_list.h b/renderdoc/driver/d3d12/d3d12_command_list.h index a8ae8537b..88cd8c3f0 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list.h +++ b/renderdoc/driver/d3d12/d3d12_command_list.h @@ -155,6 +155,9 @@ private: ID3D12GraphicsCommandList4 *m_pList4 = NULL; ID3D12GraphicsCommandList5 *m_pList5 = NULL; ID3D12GraphicsCommandList6 *m_pList6 = NULL; + ID3D12GraphicsCommandList7 *m_pList7 = NULL; + ID3D12GraphicsCommandList8 *m_pList8 = NULL; + ID3D12GraphicsCommandList9 *m_pList9 = NULL; RefCounter12 m_RefCounter; @@ -203,6 +206,9 @@ public: ID3D12GraphicsCommandList4 *GetReal4() { return m_pList4; } ID3D12GraphicsCommandList5 *GetReal5() { return m_pList5; } ID3D12GraphicsCommandList6 *GetReal6() { return m_pList6; } + ID3D12GraphicsCommandList7 *GetReal7() { return m_pList7; } + ID3D12GraphicsCommandList8 *GetReal8() { return m_pList8; } + ID3D12GraphicsCommandList9 *GetReal9() { return m_pList9; } WrappedID3D12Device *GetWrappedDevice() { return m_pDevice; } D3D12ResourceRecord *GetResourceRecord() { return m_ListRecord; } D3D12ResourceRecord *GetCreationRecord() { return m_CreationRecord; } @@ -213,6 +219,9 @@ public: ID3D12GraphicsCommandList4 *GetCrackedList4(); ID3D12GraphicsCommandList5 *GetCrackedList5(); ID3D12GraphicsCommandList6 *GetCrackedList6(); + ID3D12GraphicsCommandList7 *GetCrackedList7(); + ID3D12GraphicsCommandList8 *GetCrackedList8(); + ID3D12GraphicsCommandList9 *GetCrackedList9(); ID3D12GraphicsCommandListX *GetWrappedCrackedList(); void SetAMDMarkerInterface(IAmdExtD3DCommandListMarker *marker) { m_AMDMarkers = marker; } @@ -583,6 +592,25 @@ public: IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DispatchMesh, _In_ UINT ThreadGroupCountX, _In_ UINT ThreadGroupCountY, _In_ UINT ThreadGroupCountZ); + + ////////////////////////////// + // implement ID3D12GraphicsCommandList7 + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Barrier, UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) + const D3D12_BARRIER_GROUP *pBarrierGroups); + + ////////////////////////////// + // implement ID3D12GraphicsCommandList8 + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMSetFrontAndBackStencilRef, + _In_ UINT FrontStencilRef, _In_ UINT BackStencilRef); + + ////////////////////////////// + // implement ID3D12GraphicsCommandList9 + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSSetDepthBias, _In_ FLOAT DepthBias, + _In_ FLOAT DepthBiasClamp, _In_ FLOAT SlopeScaledDepthBias); + + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IASetIndexBufferStripCutValue, + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue); }; template <> @@ -612,6 +640,12 @@ template <> ResourceId GetResID(ID3D12GraphicsCommandList5 *obj); template <> ResourceId GetResID(ID3D12GraphicsCommandList6 *obj); +template <> +ResourceId GetResID(ID3D12GraphicsCommandList7 *obj); +template <> +ResourceId GetResID(ID3D12GraphicsCommandList8 *obj); +template <> +ResourceId GetResID(ID3D12GraphicsCommandList9 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList1 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList2 *obj); @@ -619,6 +653,9 @@ ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList3 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList4 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList5 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList6 *obj); +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList7 *obj); +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList8 *obj); +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList9 *obj); ID3D12GraphicsCommandList1 *Unwrap1(ID3D12GraphicsCommandList1 *obj); ID3D12GraphicsCommandList2 *Unwrap2(ID3D12GraphicsCommandList2 *obj); @@ -626,6 +663,9 @@ ID3D12GraphicsCommandList3 *Unwrap3(ID3D12GraphicsCommandList3 *obj); ID3D12GraphicsCommandList4 *Unwrap4(ID3D12GraphicsCommandList4 *obj); ID3D12GraphicsCommandList5 *Unwrap5(ID3D12GraphicsCommandList5 *obj); ID3D12GraphicsCommandList6 *Unwrap6(ID3D12GraphicsCommandList6 *obj); +ID3D12GraphicsCommandList7 *Unwrap7(ID3D12GraphicsCommandList7 *obj); +ID3D12GraphicsCommandList8 *Unwrap8(ID3D12GraphicsCommandList8 *obj); +ID3D12GraphicsCommandList9 *Unwrap9(ID3D12GraphicsCommandList9 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList1 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList2 *obj); @@ -633,3 +673,6 @@ WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList3 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList4 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList5 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList6 *obj); +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList7 *obj); +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList8 *obj); +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList9 *obj); diff --git a/renderdoc/driver/d3d12/d3d12_command_list7_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list7_wrap.cpp new file mode 100644 index 000000000..40b536e9f --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_command_list7_wrap.cpp @@ -0,0 +1,30 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_command_list.h" + +void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::Barrier( + UINT32 NumBarrierGroups, const D3D12_BARRIER_GROUP *pBarrierGroups) +{ +} diff --git a/renderdoc/driver/d3d12/d3d12_command_list8_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list8_wrap.cpp new file mode 100644 index 000000000..e0ab3f802 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_command_list8_wrap.cpp @@ -0,0 +1,30 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_command_list.h" + +void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::OMSetFrontAndBackStencilRef( + _In_ UINT FrontStencilRef, _In_ UINT BackStencilRef) +{ +} diff --git a/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp new file mode 100644 index 000000000..31449bd51 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp @@ -0,0 +1,35 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_command_list.h" + +void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::RSSetDepthBias( + _In_ FLOAT DepthBias, _In_ FLOAT DepthBiasClamp, _In_ FLOAT SlopeScaledDepthBias) +{ +} + +void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::IASetIndexBufferStripCutValue( + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue) +{ +} diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 172bb43b3..81197c480 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -64,6 +64,21 @@ ID3D12GraphicsCommandList6 *WrappedID3D12GraphicsCommandList::GetCrackedList6() return Unwrap6(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); } +ID3D12GraphicsCommandList7 *WrappedID3D12GraphicsCommandList::GetCrackedList7() +{ + return Unwrap7(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); +} + +ID3D12GraphicsCommandList8 *WrappedID3D12GraphicsCommandList::GetCrackedList8() +{ + return Unwrap8(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); +} + +ID3D12GraphicsCommandList9 *WrappedID3D12GraphicsCommandList::GetCrackedList9() +{ + return Unwrap9(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); +} + ID3D12GraphicsCommandListX *WrappedID3D12GraphicsCommandList::GetWrappedCrackedList() { return m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back(); diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index 3be689508..ff32ca7b8 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -88,6 +88,30 @@ ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList6 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); } +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList7 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); +} + +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList8 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); +} + +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList9 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); +} + ID3D12GraphicsCommandList1 *Unwrap1(ID3D12GraphicsCommandList1 *obj) { if(obj == NULL) @@ -136,6 +160,30 @@ ID3D12GraphicsCommandList6 *Unwrap6(ID3D12GraphicsCommandList6 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal6(); } +ID3D12GraphicsCommandList7 *Unwrap7(ID3D12GraphicsCommandList7 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal7(); +} + +ID3D12GraphicsCommandList8 *Unwrap8(ID3D12GraphicsCommandList8 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal8(); +} + +ID3D12GraphicsCommandList9 *Unwrap9(ID3D12GraphicsCommandList9 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal9(); +} + template <> ID3D12CommandList *Unwrap(ID3D12CommandList *obj) { @@ -208,6 +256,33 @@ ResourceId GetResID(ID3D12GraphicsCommandList6 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); } +template <> +ResourceId GetResID(ID3D12GraphicsCommandList7 *obj) +{ + if(obj == NULL) + return ResourceId(); + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); +} + +template <> +ResourceId GetResID(ID3D12GraphicsCommandList8 *obj) +{ + if(obj == NULL) + return ResourceId(); + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); +} + +template <> +ResourceId GetResID(ID3D12GraphicsCommandList9 *obj) +{ + if(obj == NULL) + return ResourceId(); + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); +} + template <> ResourceId GetResID(ID3D12CommandList *obj) { @@ -292,6 +367,21 @@ WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList6 *obj) return ((WrappedID3D12GraphicsCommandList *)obj); } +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList7 *obj) +{ + return ((WrappedID3D12GraphicsCommandList *)obj); +} + +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList8 *obj) +{ + return ((WrappedID3D12GraphicsCommandList *)obj); +} + +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList9 *obj) +{ + return ((WrappedID3D12GraphicsCommandList *)obj); +} + ULONG STDMETHODCALLTYPE WrappedID3D12DebugCommandQueue::AddRef() { if(m_pQueue) @@ -857,6 +947,14 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu case D3D12Chunk::Device_CreateCommittedResource2: case D3D12Chunk::Device_CreatePlacedResource1: case D3D12Chunk::Device_CreateCommandQueue1: + case D3D12Chunk::Device_CreateSampler2: + case D3D12Chunk::Device_CreateCommittedResource3: + case D3D12Chunk::Device_CreatePlacedResource2: + case D3D12Chunk::Device_CreateReservedResource1: + case D3D12Chunk::Device_CreateReservedResource2: + case D3D12Chunk::List_OMSetFrontAndBackStencilRef: + case D3D12Chunk::List_RSSetDepthBias: + case D3D12Chunk::List_IASetIndexBufferStripCutValue: RDCERR("Unexpected chunk while processing frame: %s", ToStr(chunk).c_str()); return false; @@ -1419,6 +1517,45 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::QueryInterface(REFII return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12GraphicsCommandList7)) + { + if(m_pList7) + { + *ppvObject = (ID3D12GraphicsCommandList7 *)this; + AddRef(); + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } + else if(riid == __uuidof(ID3D12GraphicsCommandList8)) + { + if(m_pList8) + { + *ppvObject = (ID3D12GraphicsCommandList8 *)this; + AddRef(); + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } + else if(riid == __uuidof(ID3D12GraphicsCommandList9)) + { + if(m_pList9) + { + *ppvObject = (ID3D12GraphicsCommandList9 *)this; + AddRef(); + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else if(riid == __uuidof(ID3D12CommandList)) { *ppvObject = (ID3D12CommandList *)this; diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index ce7656e3d..959a524bb 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -35,7 +35,7 @@ // we need to use the most-derived native interface all over the place. To make things easier when // new versions come out we typedef it here when we don't need the specific interface -using ID3D12GraphicsCommandListX = ID3D12GraphicsCommandList6; +using ID3D12GraphicsCommandListX = ID3D12GraphicsCommandList9; // replay only class for handling marker regions struct D3D12MarkerRegion @@ -408,6 +408,9 @@ struct D3D12CommandSignature SERIALISE_INTERFACE(ID3D12GraphicsCommandList4); \ SERIALISE_INTERFACE(ID3D12GraphicsCommandList5); \ SERIALISE_INTERFACE(ID3D12GraphicsCommandList6); \ + SERIALISE_INTERFACE(ID3D12GraphicsCommandList7); \ + SERIALISE_INTERFACE(ID3D12GraphicsCommandList8); \ + SERIALISE_INTERFACE(ID3D12GraphicsCommandList9); \ SERIALISE_INTERFACE(ID3D12RootSignature); \ SERIALISE_INTERFACE(ID3D12Resource); \ SERIALISE_INTERFACE(ID3D12QueryHeap); \ @@ -904,5 +907,13 @@ enum class D3D12Chunk : uint32_t Device_CreatePlacedResource1, Device_CreateCommandQueue1, CoherentMapWrite, + Device_CreateSampler2, + Device_CreateCommittedResource3, + Device_CreatePlacedResource2, + Device_CreateReservedResource1, + Device_CreateReservedResource2, + List_OMSetFrontAndBackStencilRef, + List_RSSetDepthBias, + List_IASetIndexBufferStripCutValue, Max, }; diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 867f52581..67f6c61a4 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -94,12 +94,14 @@ ULONG STDMETHODCALLTYPE DummyID3D12DebugDevice::Release() HRESULT STDMETHODCALLTYPE DummyID3D12DebugDevice::QueryInterface(REFIID riid, void **ppvObject) { - if(riid == __uuidof(ID3D12InfoQueue) || riid == __uuidof(ID3D12DebugDevice) || - riid == __uuidof(ID3D12Device) || riid == __uuidof(ID3D12Device1) || - riid == __uuidof(ID3D12Device2) || riid == __uuidof(ID3D12Device3) || - riid == __uuidof(ID3D12Device4) || riid == __uuidof(ID3D12Device5) || - riid == __uuidof(ID3D12Device6) || riid == __uuidof(ID3D12Device7) || - riid == __uuidof(ID3D12Device8) || riid == __uuidof(ID3D12Device9)) + if(riid == __uuidof(ID3D12InfoQueue) || riid == __uuidof(ID3D12InfoQueue1) || + riid == __uuidof(ID3D12DebugDevice) || riid == __uuidof(ID3D12Device) || + riid == __uuidof(ID3D12Device1) || riid == __uuidof(ID3D12Device2) || + riid == __uuidof(ID3D12Device3) || riid == __uuidof(ID3D12Device4) || + riid == __uuidof(ID3D12Device5) || riid == __uuidof(ID3D12Device6) || + riid == __uuidof(ID3D12Device7) || riid == __uuidof(ID3D12Device8) || + riid == __uuidof(ID3D12Device9) || riid == __uuidof(ID3D12Device10) || + riid == __uuidof(ID3D12Device11) || riid == __uuidof(ID3D12Device12)) return m_pDevice->QueryInterface(riid, ppvObject); if(riid == __uuidof(IUnknown)) @@ -128,12 +130,14 @@ ULONG STDMETHODCALLTYPE WrappedID3D12DebugDevice::Release() HRESULT STDMETHODCALLTYPE WrappedID3D12DebugDevice::QueryInterface(REFIID riid, void **ppvObject) { - if(riid == __uuidof(ID3D12InfoQueue) || riid == __uuidof(ID3D12DebugDevice) || - riid == __uuidof(ID3D12Device) || riid == __uuidof(ID3D12Device1) || - riid == __uuidof(ID3D12Device2) || riid == __uuidof(ID3D12Device3) || - riid == __uuidof(ID3D12Device4) || riid == __uuidof(ID3D12Device5) || - riid == __uuidof(ID3D12Device6) || riid == __uuidof(ID3D12Device7) || - riid == __uuidof(ID3D12Device8) || riid == __uuidof(ID3D12Device9)) + if(riid == __uuidof(ID3D12InfoQueue) || riid == __uuidof(ID3D12InfoQueue1) || + riid == __uuidof(ID3D12DebugDevice) || riid == __uuidof(ID3D12Device) || + riid == __uuidof(ID3D12Device1) || riid == __uuidof(ID3D12Device2) || + riid == __uuidof(ID3D12Device3) || riid == __uuidof(ID3D12Device4) || + riid == __uuidof(ID3D12Device5) || riid == __uuidof(ID3D12Device6) || + riid == __uuidof(ID3D12Device7) || riid == __uuidof(ID3D12Device8) || + riid == __uuidof(ID3D12Device9) || riid == __uuidof(ID3D12Device10) || + riid == __uuidof(ID3D12Device11) || riid == __uuidof(ID3D12Device12)) return m_pDevice->QueryInterface(riid, ppvObject); if(riid == __uuidof(IUnknown)) @@ -532,6 +536,9 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara m_pDevice7 = NULL; m_pDevice8 = NULL; m_pDevice9 = NULL; + m_pDevice10 = NULL; + m_pDevice11 = NULL; + m_pDevice12 = NULL; m_pDownlevel = NULL; if(m_pDevice) { @@ -544,6 +551,9 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara m_pDevice->QueryInterface(__uuidof(ID3D12Device7), (void **)&m_pDevice7); m_pDevice->QueryInterface(__uuidof(ID3D12Device8), (void **)&m_pDevice8); m_pDevice->QueryInterface(__uuidof(ID3D12Device9), (void **)&m_pDevice9); + m_pDevice->QueryInterface(__uuidof(ID3D12Device10), (void **)&m_pDevice10); + m_pDevice->QueryInterface(__uuidof(ID3D12Device11), (void **)&m_pDevice11); + m_pDevice->QueryInterface(__uuidof(ID3D12Device12), (void **)&m_pDevice12); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedData), (void **)&m_DRED.m_pReal); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedData1), (void **)&m_DRED.m_pReal1); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedDataSettings), @@ -840,6 +850,9 @@ WrappedID3D12Device::~WrappedID3D12Device() SAFE_RELEASE(m_CompatDevice.m_pReal); SAFE_RELEASE(m_SharingContract.m_pReal); SAFE_RELEASE(m_pDownlevel); + SAFE_RELEASE(m_pDevice12); + SAFE_RELEASE(m_pDevice11); + SAFE_RELEASE(m_pDevice10); SAFE_RELEASE(m_pDevice9); SAFE_RELEASE(m_pDevice8); SAFE_RELEASE(m_pDevice7); @@ -979,6 +992,22 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) return hr; } } + else if(riid == __uuidof(IDXGIDevice4)) + { + hr = m_pDevice->QueryInterface(riid, ppvObject); + + if(SUCCEEDED(hr)) + { + IDXGIDevice4 *real = (IDXGIDevice4 *)(*ppvObject); + *ppvObject = (IDXGIDevice4 *)(new WrappedIDXGIDevice4(real, this)); + return S_OK; + } + else + { + *ppvObject = NULL; + return hr; + } + } else if(riid == __uuidof(ID3D12Device)) { AddRef(); @@ -1102,6 +1131,45 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12Device10)) + { + if(m_pDevice10) + { + AddRef(); + *ppvObject = (ID3D12Device10 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } + else if(riid == __uuidof(ID3D12Device11)) + { + if(m_pDevice11) + { + AddRef(); + *ppvObject = (ID3D12Device11 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } + else if(riid == __uuidof(ID3D12Device12)) + { + if(m_pDevice12) + { + AddRef(); + *ppvObject = (ID3D12Device12 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else if(riid == __uuidof(ID3D12DeviceDownlevel)) { if(m_pDownlevel) @@ -1123,6 +1191,15 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) m_DummyInfoQueue.AddRef(); return S_OK; } + else if(riid == __uuidof(ID3D12InfoQueue1)) + { + RDCWARN( + "Returning a dummy ID3D12InfoQueue1 that does nothing. This ID3D12InfoQueue1 will not " + "work!"); + *ppvObject = (ID3D12InfoQueue1 *)&m_DummyInfoQueue; + m_DummyInfoQueue.AddRef(); + return S_OK; + } else if(riid == __uuidof(INVAPID3DDevice)) { // don't addref, this is an internal interface so we just don't addref at all @@ -4098,6 +4175,14 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context) case D3D12Chunk::Swapchain_Present: case D3D12Chunk::List_ClearState: case D3D12Chunk::CoherentMapWrite: + case D3D12Chunk::Device_CreateSampler2: + case D3D12Chunk::Device_CreateCommittedResource3: + case D3D12Chunk::Device_CreatePlacedResource2: + case D3D12Chunk::Device_CreateReservedResource1: + case D3D12Chunk::Device_CreateReservedResource2: + case D3D12Chunk::List_OMSetFrontAndBackStencilRef: + case D3D12Chunk::List_RSSetDepthBias: + case D3D12Chunk::List_IASetIndexBufferStripCutValue: RDCERR("Unexpected chunk while processing initialisation: %s", ToStr(context).c_str()); return false; diff --git a/renderdoc/driver/d3d12/d3d12_device.h b/renderdoc/driver/d3d12/d3d12_device.h index 0fb2d03f3..219c04582 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -582,7 +582,7 @@ class WrappedID3D12CommandQueue; template \ bool CONCAT(Serialise_, func(SerialiserType &ser, __VA_ARGS__)); -class WrappedID3D12Device : public IFrameCapturer, public ID3DDevice, public ID3D12Device9 +class WrappedID3D12Device : public IFrameCapturer, public ID3DDevice, public ID3D12Device12 { private: ID3D12Device *m_pDevice; @@ -595,6 +595,9 @@ private: ID3D12Device7 *m_pDevice7; ID3D12Device8 *m_pDevice8; ID3D12Device9 *m_pDevice9; + ID3D12Device10 *m_pDevice10; + ID3D12Device11 *m_pDevice11; + ID3D12Device12 *m_pDevice12; ID3D12DeviceDownlevel *m_pDownlevel; // list of all queues being captured @@ -1011,7 +1014,9 @@ public: iid == __uuidof(ID3D12Device2) || iid == __uuidof(ID3D12Device3) || iid == __uuidof(ID3D12Device4) || iid == __uuidof(ID3D12Device5) || iid == __uuidof(ID3D12Device6) || iid == __uuidof(ID3D12Device7) || - iid == __uuidof(ID3D12Device8) || iid == __uuidof(ID3D12Device9)) + iid == __uuidof(ID3D12Device8) || iid == __uuidof(ID3D12Device9) || + iid == __uuidof(ID3D12Device10) || iid == __uuidof(ID3D12Device11) || + iid == __uuidof(ID3D12Device12)) return true; return false; @@ -1038,6 +1043,12 @@ public: return (ID3D12Device8 *)this; else if(iid == __uuidof(ID3D12Device9)) return (ID3D12Device9 *)this; + else if(iid == __uuidof(ID3D12Device10)) + return (ID3D12Device10 *)this; + else if(iid == __uuidof(ID3D12Device11)) + return (ID3D12Device11 *)this; + else if(iid == __uuidof(ID3D12Device12)) + return (ID3D12Device12 *)this; RDCERR("Requested unknown device interface %s", ToStr(iid).c_str()); @@ -1129,6 +1140,24 @@ public: this->AddRef(); return S_OK; } + else if(riid == __uuidof(ID3D12Device10)) + { + *ppvDevice = (ID3D12Device10 *)this; + this->AddRef(); + return S_OK; + } + else if(riid == __uuidof(ID3D12Device11)) + { + *ppvDevice = (ID3D12Device11 *)this; + this->AddRef(); + return S_OK; + } + else if(riid == __uuidof(ID3D12Device12)) + { + *ppvDevice = (ID3D12Device12 *)this; + this->AddRef(); + return S_OK; + } return E_NOINTERFACE; } @@ -1589,4 +1618,49 @@ public: IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommandQueue1, _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, REFIID CreatorID, REFIID riid, _COM_Outptr_ void **ppCommandQueue); + + ////////////////////////////// + // implement ID3D12Device10 + + IMPLEMENT_FUNCTION_THREAD_SERIALISED( + virtual HRESULT STDMETHODCALLTYPE, CreateCommittedResource3, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + IMPLEMENT_FUNCTION_THREAD_SERIALISED( + virtual HRESULT STDMETHODCALLTYPE, CreatePlacedResource2, _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, _In_ const D3D12_RESOURCE_DESC1 *pDesc, D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateReservedResource2, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) + const DXGI_FORMAT *pCastableFormats, + REFIID riid, _COM_Outptr_opt_ void **ppvResource); + + ////////////////////////////// + // implement ID3D12Device11 + IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateSampler2, + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + ////////////////////////////// + // implement ID3D12Device12 + + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo3( + UINT visibleMask, UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); }; diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index 186ce39c6..1c1ffcfff 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -323,7 +323,9 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST if(riid != __uuidof(ID3D12GraphicsCommandList) && riid != __uuidof(ID3D12CommandList) && riid != __uuidof(ID3D12GraphicsCommandList1) && riid != __uuidof(ID3D12GraphicsCommandList2) && riid != __uuidof(ID3D12GraphicsCommandList3) && riid != __uuidof(ID3D12GraphicsCommandList4) && - riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6)) + riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6) && + riid != __uuidof(ID3D12GraphicsCommandList7) && riid != __uuidof(ID3D12GraphicsCommandList8) && + riid != __uuidof(ID3D12GraphicsCommandList9)) return E_NOINTERFACE; void *realptr = NULL; @@ -350,6 +352,12 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST real = (ID3D12GraphicsCommandList5 *)realptr; else if(riid == __uuidof(ID3D12GraphicsCommandList6)) real = (ID3D12GraphicsCommandList6 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList7)) + real = (ID3D12GraphicsCommandList7 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList8)) + real = (ID3D12GraphicsCommandList8 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList9)) + real = (ID3D12GraphicsCommandList9 *)realptr; if(SUCCEEDED(ret)) { @@ -404,6 +412,12 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST *ppCommandList = (ID3D12GraphicsCommandList5 *)wrapped; else if(riid == __uuidof(ID3D12GraphicsCommandList6)) *ppCommandList = (ID3D12GraphicsCommandList6 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList7)) + *ppCommandList = (ID3D12GraphicsCommandList7 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList8)) + *ppCommandList = (ID3D12GraphicsCommandList8 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList9)) + *ppCommandList = (ID3D12GraphicsCommandList9 *)wrapped; else if(riid == __uuidof(ID3D12CommandList)) *ppCommandList = (ID3D12CommandList *)wrapped; else @@ -3337,9 +3351,14 @@ HRESULT WrappedID3D12Device::SetStablePowerState(BOOL Enable) HRESULT WrappedID3D12Device::CheckFeatureSupport(D3D12_FEATURE Feature, void *pFeatureSupportData, UINT FeatureSupportDataSize) { - static bool logged = false; - bool dolog = !logged; - logged = true; + static uint64_t logged = 0; + bool dolog = true; + if(uint32_t(Feature) < 64) + { + const uint64_t bit = 1ULL << uint32_t(Feature); + dolog = (logged & bit) == 0; + logged |= bit; + } if(dolog) RDCLOG("Checking feature support for %d", Feature); @@ -3411,6 +3430,36 @@ HRESULT WrappedID3D12Device::CheckFeatureSupport(D3D12_FEATURE Feature, void *pF return S_OK; } + else if(Feature == D3D12_FEATURE_D3D12_OPTIONS12) + { + D3D12_FEATURE_DATA_D3D12_OPTIONS12 *opts = + (D3D12_FEATURE_DATA_D3D12_OPTIONS12 *)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS12)) + return E_INVALIDARG; + + opts->EnhancedBarriersSupported = FALSE; + // could support this but the entry point is tied to barriers + opts->RelaxedFormatCastingSupported = FALSE; + + if(dolog) + RDCLOG("Forcing no new barrier support"); + + return S_OK; + } + else if(Feature == D3D12_FEATURE_D3D12_OPTIONS18) + { + D3D12_FEATURE_DATA_D3D12_OPTIONS18 *opts = + (D3D12_FEATURE_DATA_D3D12_OPTIONS18 *)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS18)) + return E_INVALIDARG; + + opts->RenderPassesValid = FALSE; + + if(dolog) + RDCLOG("Forcing no changed renderpass support"); + + return S_OK; + } return hr; } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap10.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap10.cpp new file mode 100644 index 000000000..53c0e1f1a --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap10.cpp @@ -0,0 +1,58 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2021-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" +#include "driver/dxgi/dxgi_common.h" +#include "d3d12_command_queue.h" +#include "d3d12_resources.h" + +HRESULT WrappedID3D12Device::CreateCommittedResource3( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) +{ + return E_NOTIMPL; +} + +HRESULT WrappedID3D12Device::CreatePlacedResource2( + _In_ ID3D12Heap *pHeap, UINT64 HeapOffset, _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, _COM_Outptr_opt_ void **ppvResource) +{ + return E_NOTIMPL; +} + +HRESULT WrappedID3D12Device::CreateReservedResource2( + _In_ const D3D12_RESOURCE_DESC *pDesc, D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riid, + _COM_Outptr_opt_ void **ppvResource) +{ + return E_NOTIMPL; +} diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap11.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap11.cpp new file mode 100644 index 000000000..cd6d388a4 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap11.cpp @@ -0,0 +1,33 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2021-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" +#include "driver/dxgi/dxgi_common.h" +#include "d3d12_command_queue.h" +#include "d3d12_resources.h" + +void WrappedID3D12Device::CreateSampler2(_In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) +{ +} diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap12.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap12.cpp new file mode 100644 index 000000000..cf7955afb --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap12.cpp @@ -0,0 +1,40 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2021-2023 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" +#include "driver/dxgi/dxgi_common.h" +#include "d3d12_command_queue.h" +#include "d3d12_resources.h" + +D3D12_RESOURCE_ALLOCATION_INFO WrappedID3D12Device::GetResourceAllocationInfo3( + UINT visibleMask, UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) +{ + return m_pDevice12->GetResourceAllocationInfo3(visibleMask, numResourceDescs, pResourceDescs, + pNumCastableFormats, ppCastableFormats, + pResourceAllocationInfo1); +} diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp index c552726dc..b59ffd0e4 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp @@ -94,7 +94,9 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS if(riid != __uuidof(ID3D12GraphicsCommandList) && riid != __uuidof(ID3D12CommandList) && riid != __uuidof(ID3D12GraphicsCommandList1) && riid != __uuidof(ID3D12GraphicsCommandList2) && riid != __uuidof(ID3D12GraphicsCommandList3) && riid != __uuidof(ID3D12GraphicsCommandList4) && - riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6)) + riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6) && + riid != __uuidof(ID3D12GraphicsCommandList7) && riid != __uuidof(ID3D12GraphicsCommandList8) && + riid != __uuidof(ID3D12GraphicsCommandList9)) return E_NOINTERFACE; void *realptr = NULL; @@ -120,6 +122,12 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS real = (ID3D12GraphicsCommandList5 *)realptr; else if(riid == __uuidof(ID3D12GraphicsCommandList6)) real = (ID3D12GraphicsCommandList6 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList7)) + real = (ID3D12GraphicsCommandList7 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList8)) + real = (ID3D12GraphicsCommandList8 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList9)) + real = (ID3D12GraphicsCommandList9 *)realptr; if(SUCCEEDED(ret)) { @@ -169,6 +177,12 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS *ppCommandList = (ID3D12GraphicsCommandList5 *)wrapped; else if(riid == __uuidof(ID3D12GraphicsCommandList6)) *ppCommandList = (ID3D12GraphicsCommandList6 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList7)) + *ppCommandList = (ID3D12GraphicsCommandList7 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList8)) + *ppCommandList = (ID3D12GraphicsCommandList8 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList9)) + *ppCommandList = (ID3D12GraphicsCommandList9 *)wrapped; else if(riid == __uuidof(ID3D12CommandList)) *ppCommandList = (ID3D12CommandList *)wrapped; else diff --git a/renderdoc/driver/d3d12/d3d12_hooks.cpp b/renderdoc/driver/d3d12/d3d12_hooks.cpp index b816626ea..ad01444c4 100644 --- a/renderdoc/driver/d3d12/d3d12_hooks.cpp +++ b/renderdoc/driver/d3d12/d3d12_hooks.cpp @@ -260,7 +260,9 @@ private: riid != __uuidof(ID3D12Device2) && riid != __uuidof(ID3D12Device3) && riid != __uuidof(ID3D12Device4) && riid != __uuidof(ID3D12Device5) && riid != __uuidof(ID3D12Device6) && riid != __uuidof(ID3D12Device7) && - riid != __uuidof(ID3D12Device8) && riid != __uuidof(ID3D12Device9)) + riid != __uuidof(ID3D12Device8) && riid != __uuidof(ID3D12Device9) && + riid != __uuidof(ID3D12Device10) && riid != __uuidof(ID3D12Device11) && + riid != __uuidof(ID3D12Device12)) { RDCERR("Unsupported UUID %s for D3D12CreateDevice", ToStr(riid).c_str()); return E_NOINTERFACE; @@ -338,6 +340,21 @@ private: ID3D12Device9 *dev9 = (ID3D12Device9 *)*ppDevice; dev = (ID3D12Device *)dev9; } + else if(riid == __uuidof(ID3D12Device10)) + { + ID3D12Device10 *dev9 = (ID3D12Device10 *)*ppDevice; + dev = (ID3D12Device *)dev9; + } + else if(riid == __uuidof(ID3D12Device11)) + { + ID3D12Device11 *dev9 = (ID3D12Device11 *)*ppDevice; + dev = (ID3D12Device *)dev9; + } + else if(riid == __uuidof(ID3D12Device12)) + { + ID3D12Device12 *dev9 = (ID3D12Device12 *)*ppDevice; + dev = (ID3D12Device *)dev9; + } WrappedID3D12Device *wrap = WrappedID3D12Device::Create(dev, params, EnableDebugLayer); @@ -363,6 +380,12 @@ private: *ppDevice = (ID3D12Device8 *)wrap; else if(riid == __uuidof(ID3D12Device9)) *ppDevice = (ID3D12Device9 *)wrap; + else if(riid == __uuidof(ID3D12Device10)) + *ppDevice = (ID3D12Device10 *)wrap; + else if(riid == __uuidof(ID3D12Device11)) + *ppDevice = (ID3D12Device11 *)wrap; + else if(riid == __uuidof(ID3D12Device12)) + *ppDevice = (ID3D12Device12 *)wrap; } } else if(SUCCEEDED(ret)) diff --git a/renderdoc/driver/d3d12/d3d12_stringise.cpp b/renderdoc/driver/d3d12/d3d12_stringise.cpp index 0daa1ad7b..3b290b690 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 == 1114, "Chunks changed without updating names"); + RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1122, "Chunks changed without updating names"); BEGIN_ENUM_STRINGISE(D3D12Chunk) { @@ -205,6 +205,20 @@ rdcstr DoStringise(const D3D12Chunk &el) "ID3D12Device8::CreatePlacedResource1"); STRINGISE_ENUM_CLASS_NAMED(Device_CreateCommandQueue1, "ID3D12Device9::CreateCommandQueue1"); STRINGISE_ENUM_CLASS_NAMED(CoherentMapWrite, "Internal::Coherent Mapped Memory Write"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreateSampler2, "ID3D12Device11::CreateSampler2"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreateCommittedResource3, + "ID3D12Device10::Device_CreateCommittedResource3"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreatePlacedResource2, + "ID3D12Device10::Device_CreatePlacedResource2"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreateReservedResource1, + "ID3D12Device4::Device_CreateReservedResource1"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreateReservedResource2, + "ID3D12Device10::Device_CreateReservedResource2"); + STRINGISE_ENUM_CLASS_NAMED(List_OMSetFrontAndBackStencilRef, + "ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef"); + STRINGISE_ENUM_CLASS_NAMED(List_RSSetDepthBias, "ID3D12GraphicsCommandList9::RSSetDepthBias"); + STRINGISE_ENUM_CLASS_NAMED(List_IASetIndexBufferStripCutValue, + "ID3D12GraphicsCommandList9::IASetIndexBufferStripCutValue"); STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk"); } END_ENUM_STRINGISE() diff --git a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj index 39c09c81b..c5d37ea3d 100644 --- a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj +++ b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj @@ -108,6 +108,9 @@ + + + @@ -116,6 +119,9 @@ + + + diff --git a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters index 742c80539..7ec92b2b9 100644 --- a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters +++ b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters @@ -209,5 +209,23 @@ Replay + + Wrapped + + + Wrapped + + + Wrapped + + + Wrapped + + + Wrapped + + + Wrapped + \ No newline at end of file