diff --git a/renderdoc/driver/d3d12/d3d12_command_list.h b/renderdoc/driver/d3d12/d3d12_command_list.h index 641c7c1e8..b09750446 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list.h +++ b/renderdoc/driver/d3d12/d3d12_command_list.h @@ -283,6 +283,11 @@ public: m_PendingASCallbacks.clear(); } + template + bool Serialise_SetCommandAnnotation(SerialiserType &ser, rdcstr key, + RENDERDOC_AnnotationType valueType, uint32_t valueVectorWidth, + RENDERDOC_AnnotationValue value); + ////////////////////////////// // implement IUnknown ULONG STDMETHODCALLTYPE AddRef() { return m_RefCounter.SoftRef(m_pDevice); } diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index e11adeed0..84c7037ef 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -29,6 +29,7 @@ #include "driver/ihv/amd/official/DXExt/AmdExtD3DCommandListMarkerApi.h" #include "d3d12_command_queue.h" #include "d3d12_debug.h" +#include "d3d12_replay.h" RDOC_EXTERN_CONFIG(bool, D3D12_Debug_RT_Auditing); @@ -3217,6 +3218,44 @@ void WrappedID3D12GraphicsCommandList::EndEvent() } } +template +bool WrappedID3D12GraphicsCommandList::Serialise_SetCommandAnnotation( + SerialiserType &ser, rdcstr key, RENDERDOC_AnnotationType valueType, uint32_t valueVectorWidth, + RENDERDOC_AnnotationValue value) +{ + ID3D12GraphicsCommandList *pCommandList = this; + SERIALISE_ELEMENT(pCommandList).Unimportant(); + SERIALISE_ELEMENT(key); + SERIALISE_ELEMENT(valueType); + ser.SetStructArg(valueType); + SERIALISE_ELEMENT(valueVectorWidth); + SERIALISE_ELEMENT(value); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading()) + { + m_Cmd->m_LastCmdListID = GetResID(pCommandList); + + if(IsLoading(m_State)) + { + if(!m_Cmd->m_RootAnnotation) + m_Cmd->m_RootAnnotation = new SDObject("Event Annotations"_lit, "Event Annotations"_lit); + + ResourceId cmdId = GetResID(pCommandList); + + PendingAnnotation annot = {m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].curEventID, key, + valueType, valueVectorWidth, value}; + + m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].annotations.push_back(annot); + + m_pDevice->GetReplay()->WriteFrameRecord().frameInfo.containsAnnotations = true; + } + } + + return true; +} + #pragma endregion Queries / Events #pragma region Draws @@ -5708,6 +5747,9 @@ INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, SetMarke INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, BeginEvent, UINT Metadata, const void *pData, UINT Size); INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, EndEvent); +INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, SetCommandAnnotation, + rdcstr key, RENDERDOC_AnnotationType valueType, + uint32_t valueVectorWidth, RENDERDOC_AnnotationValue value); INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, DrawInstanced, UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation); diff --git a/renderdoc/driver/d3d12/d3d12_command_queue.h b/renderdoc/driver/d3d12/d3d12_command_queue.h index 972775134..a174f9095 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue.h +++ b/renderdoc/driver/d3d12/d3d12_command_queue.h @@ -237,6 +237,11 @@ public: void CheckAndFreeRayDispatches(); + template + bool Serialise_SetQueueAnnotation(SerialiserType &ser, rdcstr key, + RENDERDOC_AnnotationType valueType, uint32_t valueVectorWidth, + RENDERDOC_AnnotationValue value); + RDResult ReplayLog(CaptureState readType, uint32_t startEventID, uint32_t endEventID, bool partial); void SetFrameReader(StreamReader *reader) { m_FrameReader = reader; } D3D12CommandData *GetCommandData() { return &m_Cmd; } diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index c6adf88f2..df2fb29a5 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -25,6 +25,7 @@ #include "d3d12_command_queue.h" #include "core/settings.h" #include "d3d12_command_list.h" +#include "d3d12_replay.h" #include "d3d12_resources.h" RDOC_EXTERN_CONFIG(bool, D3D12_Debug_SingleSubmitFlushing); @@ -628,7 +629,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se // insert the baked command list in-line into this list of notes, assigning new event and // drawIDs - m_Cmd.InsertActionsAndRefreshIDs(cmd, cmdListInfo.action->children); + m_Cmd.InsertActionsAndRefreshIDs(cmd, cmdListInfo); for(size_t e = 0; e < cmdListInfo.action->executedCmds.size(); e++) { @@ -1552,6 +1553,47 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::Present( return m_pDownlevel->Present(Unwrap(pOpenCommandList), Unwrap(pSourceTex2D), hWindow, Flags); } +template +bool WrappedID3D12CommandQueue::Serialise_SetQueueAnnotation(SerialiserType &ser, rdcstr key, + RENDERDOC_AnnotationType valueType, + uint32_t valueVectorWidth, + RENDERDOC_AnnotationValue value) +{ + ID3D12CommandQueue *pQueue = this; + SERIALISE_ELEMENT(pQueue); + SERIALISE_ELEMENT(key); + SERIALISE_ELEMENT(valueType); + ser.SetStructArg(valueType); + SERIALISE_ELEMENT(valueVectorWidth); + SERIALISE_ELEMENT(value); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading()) + { + if(IsLoading(m_State)) + { + if(!m_Cmd.m_RootAnnotation) + m_Cmd.m_RootAnnotation = new SDObject("Event Annotations"_lit, "Event Annotations"_lit); + + SDObject *root = m_Cmd.m_RootAnnotation; + + if(valueType == eRENDERDOC_Empty) + { + root->EraseChildByKeyPath(key); + } + else + { + WriteAnnotation(root->CreateChildByKeyPath(key), valueType, valueVectorWidth, value); + } + + m_pDevice->GetReplay()->WriteFrameRecord().frameInfo.containsAnnotations = true; + } + } + + return true; +} + INSTANTIATE_FUNCTION_SERIALISED( void, WrappedID3D12CommandQueue, UpdateTileMappings, ID3D12Resource *pResource, UINT NumResourceRegions, const D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates, @@ -1578,3 +1620,7 @@ INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12CommandQueue, Signal, ID3D12F UINT64 Value); INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12CommandQueue, Wait, ID3D12Fence *pFence, UINT64 Value); + +INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12CommandQueue, SetQueueAnnotation, rdcstr key, + RENDERDOC_AnnotationType valueType, uint32_t valueVectorWidth, + RENDERDOC_AnnotationValue value); diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index 81b6c340c..501d98bc3 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -562,6 +562,11 @@ WrappedID3D12CommandQueue::~WrappedID3D12CommandQueue() SAFE_RELEASE(m_RayFence); + for(SDObject *o : m_Cmd.m_EventAnnotations) + delete o; + + delete m_Cmd.m_RootAnnotation; + if(m_CreationRecord) m_CreationRecord->Delete(m_pDevice->GetResourceManager()); @@ -1006,6 +1011,15 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu ret = m_ReplayList->Serialise_SetPipelineState1(ser, NULL); break; + case D3D12Chunk::SetCommandAnnotation: + ret = m_ReplayList->Serialise_SetCommandAnnotation(ser, rdcstr(), eRENDERDOC_AnnotationMax, 0, + RENDERDOC_AnnotationValue()); + break; + case D3D12Chunk::SetQueueAnnotation: + ret = Serialise_SetQueueAnnotation(ser, rdcstr(), eRENDERDOC_AnnotationMax, 0, + RENDERDOC_AnnotationValue()); + break; + // in order to get a warning if we miss a case, we explicitly handle the device creation chunks // here. If we actually encounter one it's an error (we shouldn't see these inside the captured // frame itself) @@ -1103,6 +1117,9 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu { // also ignore, this just pops the action stack } + else if(chunk == D3D12Chunk::SetCommandAnnotation || chunk == D3D12Chunk::SetQueueAnnotation) + { + } else { if(!m_Cmd.m_AddedAction) @@ -1326,7 +1343,8 @@ RDResult WrappedID3D12CommandQueue::ReplayLog(CaptureState readType, uint32_t st else { // these events are completely omitted, so don't increment the curEventID - if(context != D3D12Chunk::List_Reset && context != D3D12Chunk::List_Close) + if(context != D3D12Chunk::List_Reset && context != D3D12Chunk::List_Close && + context != D3D12Chunk::SetCommandAnnotation) m_Cmd.m_BakedCmdListInfo[m_Cmd.m_LastCmdListID].curEventID++; } } @@ -2018,6 +2036,12 @@ void D3D12CommandData::AddEvent() } else { + if(m_RootAnnotation) + { + apievent.annotations = m_RootAnnotation->Duplicate(); + m_EventAnnotations.push_back(apievent.annotations); + } + m_RootEvents.push_back(apievent); m_Events.resize_for_index(apievent.eventId); m_Events[apievent.eventId] = apievent; @@ -2421,9 +2445,16 @@ void D3D12CommandData::AddAction(const ActionDescription &a) RDCERR("Somehow lost action stack!"); } -void D3D12CommandData::InsertActionsAndRefreshIDs(ResourceId cmd, - rdcarray &cmdBufNodes) +void D3D12CommandData::InsertActionsAndRefreshIDs(ResourceId cmd, const BakedCmdListInfo &cmdListInfo) { + const rdcarray &cmdBufNodes = cmdListInfo.action->children; + + SDObject *localAnnotations = NULL; + if(m_RootAnnotation) + localAnnotations = m_RootAnnotation->Duplicate(); + + size_t curAnnot = 0; + // assign new action IDs for(size_t i = 0; i < cmdBufNodes.size(); i++) { @@ -2433,6 +2464,29 @@ void D3D12CommandData::InsertActionsAndRefreshIDs(ResourceId cmd, for(APIEvent &ev : n.action.events) { + if(localAnnotations) + { + for(; curAnnot < cmdListInfo.annotations.size(); curAnnot++) + { + const PendingAnnotation &annot = cmdListInfo.annotations[curAnnot]; + if(annot.eventId == ev.eventId) + { + if(annot.valueType == eRENDERDOC_Empty) + localAnnotations->EraseChildByKeyPath(annot.key); + else + WriteAnnotation(localAnnotations->CreateChildByKeyPath(annot.key), annot.valueType, + annot.valueVectorWidth, annot.value); + } + else if(annot.eventId > ev.eventId) + { + break; + } + } + + ev.annotations = localAnnotations->Duplicate(); + m_EventAnnotations.push_back(ev.annotations); + } + ev.eventId += m_RootEventID; m_Events.resize(ev.eventId + 1); m_Events[ev.eventId] = ev; diff --git a/renderdoc/driver/d3d12/d3d12_commands.h b/renderdoc/driver/d3d12/d3d12_commands.h index a026e7d06..606c8fb4e 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.h +++ b/renderdoc/driver/d3d12/d3d12_commands.h @@ -199,6 +199,7 @@ struct BakedCmdListInfo rdcarray curEvents; rdcarray debugMessages; rdcarray actionStack; + rdcarray annotations; rdcarray> resourceUsage; @@ -257,6 +258,9 @@ struct D3D12CommandData D3D12RenderState m_RenderState; + rdcarray m_EventAnnotations; + SDObject *m_RootAnnotation = NULL; + D3D12RenderState &GetCurRenderState() { return m_LastCmdListID == ResourceId() ? m_RenderState @@ -319,7 +323,7 @@ struct D3D12CommandData // so we just set this command list ID3D12GraphicsCommandListX *m_OutsideCmdList = NULL; - void InsertActionsAndRefreshIDs(ResourceId cmd, rdcarray &cmdBufNodes); + void InsertActionsAndRefreshIDs(ResourceId cmd, const BakedCmdListInfo &cmdListInfo); // this is a list of uint64_t file offset -> uint32_t EIDs of where each // action is used. E.g. the action at offset 873954 is EID 50. If a diff --git a/renderdoc/driver/d3d12/d3d12_common.cpp b/renderdoc/driver/d3d12/d3d12_common.cpp index cb44b03ff..8d65e7438 100644 --- a/renderdoc/driver/d3d12/d3d12_common.cpp +++ b/renderdoc/driver/d3d12/d3d12_common.cpp @@ -549,6 +549,10 @@ bool D3D12InitParams::IsSupportedVersion(uint64_t ver) if(ver == 0x15) return true; + // 0x16 -> 0x17 - added serialised annotations + if(ver == 0x16) + return true; + return false; } diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index 8b12b93bd..a74cbe749 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -1320,5 +1320,7 @@ enum class D3D12Chunk : uint32_t Device_CreateRootSignatureFromSubobjectInLibrary, List_SetProgram, List_DispatchGraph, + SetQueueAnnotation, + SetCommandAnnotation, Max, }; diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 697b65607..b13175a46 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -931,6 +931,9 @@ WrappedID3D12Device::~WrappedID3D12Device() SAFE_DELETE(m_StoredStructuredData); + for(auto it = m_Annotations.begin(); it != m_Annotations.end(); ++it) + delete it->second; + RenderDoc::Inst().RemoveDeviceFrameCapturer((ID3D12Device *)this); if(!m_InternalCmds.pendingcmds.empty()) @@ -2744,6 +2747,34 @@ bool WrappedID3D12Device::Serialise_BeginCaptureFrame(SerialiserType &ser) m_InitialResourceStates); } + if(ser.VersionAtLeast(0x17)) + { + SCOPED_LOCK(m_AnnotationsLock); + + SERIALISE_ELEMENT_LOCAL(numAnnotations, uint32_t(m_Annotations.size())); + + auto it = m_Annotations.begin(); + for(uint32_t i = 0; i < numAnnotations; i++) + { + SERIALISE_ELEMENT_LOCAL(id, it->first); + SDObject *annotation = it->second; + if(ser.IsReading()) + annotation = new SDObject(""_lit, ""_lit); // will be overwritten below + ser.Serialise("annotation"_lit, *annotation); + + if(ser.IsReading() && IsLoading(m_State)) + { + m_Annotations[id] = annotation; + m_Replay->GetResourceDesc(id).annotations = annotation; + } + + ++it; + } + + if(numAnnotations > 0) + m_Replay->WriteFrameRecord().frameInfo.containsAnnotations = true; + } + SERIALISE_CHECK_READ_ERRORS(); if(IsReplayingAndReading() && !barriers.empty()) @@ -3358,6 +3389,121 @@ bool WrappedID3D12Device::DiscardFrameCapture(DeviceOwnedWindow devWnd) return true; } +uint32_t WrappedID3D12Device::SetObjectAnnotation(void *object, const char *key, + RENDERDOC_AnnotationType valueType, + uint32_t valueVectorWidth, + const RENDERDOC_AnnotationValue *value) +{ + ID3D12Object *d3d12Obj = (ID3D12Object *)object; + + D3D12ResourceType type = TryIdentifyTypeByPtr(d3d12Obj); + + if(type == Resource_Unknown) + return 2; + + ResourceId id = GetResID(d3d12Obj); + + if(id != ResourceId()) + { + RENDERDOC_AnnotationValue val = value ? *value : RENDERDOC_AnnotationValue(); + + if(valueType == eRENDERDOC_APIObject) + { + ResourceId valId = GetResID((ID3D12Object *)val.apiObject); + RDCCOMPILE_ASSERT(sizeof(val.uint64) == sizeof(valId), "ResourceId isn't 64-bit!"); + memcpy(&val.uint64, &valId, sizeof(valId)); + } + + SDObject *root = NULL; + { + SCOPED_LOCK(m_AnnotationsLock); + root = m_Annotations[id]; + if(!root) + root = m_Annotations[id] = new SDObject("Object Annotations"_lit, "Object Annotations"_lit); + } + + if(valueType == eRENDERDOC_Empty) + { + root->EraseChildByKeyPath(key); + } + else + { + WriteAnnotation(root->CreateChildByKeyPath(key), valueType, valueVectorWidth, val); + } + + return 0; + } + + return 2; +} + +uint32_t WrappedID3D12Device::SetCommandAnnotation(void *queueOrCommandBuffer, const char *key, + RENDERDOC_AnnotationType valueType, + uint32_t valueVectorWidth, + const RENDERDOC_AnnotationValue *value) +{ + ID3D12Object *d3d12Obj = (ID3D12Object *)queueOrCommandBuffer; + + D3D12ResourceType type = TryIdentifyTypeByPtr(d3d12Obj); + + if(type == Resource_CommandQueue) + { + WrappedID3D12CommandQueue *queue = (WrappedID3D12CommandQueue *)d3d12Obj; + + if(IsActiveCapturing(m_State)) + { + CACHE_THREAD_SERIALISER(); + ser.SetActionChunk(); + SCOPED_SERIALISE_CHUNK(D3D12Chunk::SetQueueAnnotation); + + RENDERDOC_AnnotationValue val = value ? *value : RENDERDOC_AnnotationValue(); + + if(valueType == eRENDERDOC_APIObject) + { + ResourceId id = GetResID((ID3D12Object *)val.apiObject); + RDCCOMPILE_ASSERT(sizeof(val.uint64) == sizeof(id), "ResourceId isn't 64-bit!"); + memcpy(&val.uint64, &id, sizeof(id)); + } + + queue->Serialise_SetQueueAnnotation(ser, key, valueType, valueVectorWidth, val); + + m_FrameCaptureRecord->AddChunk(scope.Get()); + } + + return 0; + } + else if(type == Resource_GraphicsCommandList) + { + WrappedID3D12GraphicsCommandList *list = (WrappedID3D12GraphicsCommandList *)d3d12Obj; + + if(IsCaptureMode(m_State)) + { + CACHE_THREAD_SERIALISER(); + ser.SetActionChunk(); + SCOPED_SERIALISE_CHUNK(D3D12Chunk::SetCommandAnnotation); + + RENDERDOC_AnnotationValue val = value ? *value : RENDERDOC_AnnotationValue(); + + if(valueType == eRENDERDOC_APIObject) + { + ResourceId id = GetResID((ID3D12Object *)val.apiObject); + RDCCOMPILE_ASSERT(sizeof(val.uint64) == sizeof(id), "ResourceId isn't 64-bit!"); + memcpy(&val.uint64, &id, sizeof(id)); + } + + list->Serialise_SetCommandAnnotation(ser, key, valueType, valueVectorWidth, val); + + GetRecord(list)->AddChunk(scope.Get()); + } + + return 0; + } + else + { + return 2; + } +} + void WrappedID3D12Device::UploadBLASBufferAddresses() { if(m_addressBufferUploaded) @@ -3504,6 +3650,11 @@ void WrappedID3D12Device::ReleaseResource(ID3D12DeviceChild *res) m_SparseHeaps.erase(id); } + { + SCOPED_LOCK(m_AnnotationsLock); + m_Annotations.erase(id); + } + D3D12ResourceRecord *record = GetRecord(res); if(record) @@ -5092,6 +5243,8 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context) case D3D12Chunk::List_SetPipelineState1: case D3D12Chunk::List_SetProgram: case D3D12Chunk::List_DispatchGraph: + case D3D12Chunk::SetCommandAnnotation: + case D3D12Chunk::SetQueueAnnotation: 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 644819868..cbab20869 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -64,7 +64,7 @@ struct D3D12InitParams UINT SDKVersion = 0; // check if a frame capture section version is supported - static const uint64_t CurrentVersion = 0x16; + static const uint64_t CurrentVersion = 0x17; static bool IsSupportedVersion(uint64_t ver); }; @@ -771,6 +771,9 @@ private: bool m_FirstFrameCapture = false; void *m_FirstFrameCaptureWindow = NULL; + Threading::CriticalSection m_AnnotationsLock; + std::unordered_map m_Annotations; + Threading::RWLock m_CapTransitionLock; CaptureState m_State; @@ -1117,16 +1120,10 @@ public: bool EndFrameCapture(DeviceOwnedWindow devWnd); bool DiscardFrameCapture(DeviceOwnedWindow devWnd); uint32_t SetObjectAnnotation(void *object, const char *key, RENDERDOC_AnnotationType valueType, - uint32_t valueVectorWidth, const RENDERDOC_AnnotationValue *value) - { - return 2; - } + uint32_t valueVectorWidth, const RENDERDOC_AnnotationValue *value); uint32_t SetCommandAnnotation(void *queueOrCommandBuffer, const char *key, RENDERDOC_AnnotationType valueType, uint32_t valueVectorWidth, - const RENDERDOC_AnnotationValue *value) - { - return 2; - } + const RENDERDOC_AnnotationValue *value); template bool Serialise_Present(SerialiserType &ser, ID3D12Resource *PresentedImage, UINT SyncInterval, diff --git a/renderdoc/driver/d3d12/d3d12_resources.cpp b/renderdoc/driver/d3d12/d3d12_resources.cpp index fa9969748..f37dcbec6 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.cpp +++ b/renderdoc/driver/d3d12/d3d12_resources.cpp @@ -42,7 +42,7 @@ const GUID RENDERDOC_ID3D12ShaderGUID_ShaderDebugMagicValue = RENDERDOC_ShaderDe ALL_D3D12_TYPES; -D3D12ResourceType IdentifyTypeByPtr(ID3D12Object *ptr) +D3D12ResourceType TryIdentifyTypeByPtr(ID3D12Object *ptr) { if(ptr == NULL) return Resource_Unknown; @@ -66,6 +66,16 @@ D3D12ResourceType IdentifyTypeByPtr(ID3D12Object *ptr) return Resource_Unknown; } +D3D12ResourceType IdentifyTypeByPtr(ID3D12Object *ptr) +{ + D3D12ResourceType ret = TryIdentifyTypeByPtr(ptr); + + if(ret == Resource_Unknown) + RDCERR("Unknown type for ptr 0x%p", ptr); + + return ret; +} + TrackedResource12 *GetTracked(ID3D12Object *ptr) { if(ptr == NULL) diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index caad2c3a2..7ca5b067c 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -1951,6 +1951,7 @@ D3D12_UNWRAP_EXTENDED(ID3D12Resource, ID3D12Resource1); D3D12_UNWRAP_EXTENDED(ID3D12Resource, ID3D12Resource2); D3D12_UNWRAP_EXTENDED(ID3D12ProtectedResourceSession, ID3D12ProtectedResourceSession1); +D3D12ResourceType TryIdentifyTypeByPtr(ID3D12Object *ptr); D3D12ResourceType IdentifyTypeByPtr(ID3D12Object *ptr); #define WRAPPING_DEBUG 0 diff --git a/renderdoc/driver/d3d12/d3d12_stringise.cpp b/renderdoc/driver/d3d12/d3d12_stringise.cpp index 068949ed7..1daad41db 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 == 1137, "Chunks changed without updating names"); + RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1139, "Chunks changed without updating names"); BEGIN_ENUM_STRINGISE(D3D12Chunk) { @@ -242,6 +242,8 @@ rdcstr DoStringise(const D3D12Chunk &el) "ID3D12Device14::CreateRootSignatureFromSubobjectInLibrary"); STRINGISE_ENUM_CLASS_NAMED(List_SetProgram, "ID3D12GraphicsCommandList10::SetProgram"); STRINGISE_ENUM_CLASS_NAMED(List_DispatchGraph, "ID3D12GraphicsCommandList10::DispatchGraph"); + STRINGISE_ENUM_CLASS_NAMED(SetCommandAnnotation, "Internal::SetCommandAnnotation"); + STRINGISE_ENUM_CLASS_NAMED(SetQueueAnnotation, "Internal::SetQueueAnnotation"); STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk"); } END_ENUM_STRINGISE()