diff --git a/USAGE_desktop_D3D12.md b/USAGE_desktop_D3D12.md index a321642302..69e8d67d97 100644 --- a/USAGE_desktop_D3D12.md +++ b/USAGE_desktop_D3D12.md @@ -290,6 +290,9 @@ Optional arguments: --dx12-override-object-names Generates unique names for all ID3D12Objects and assigns each object the generated name. This is intended to assist replay debugging. + --dx12-ags-inject-markers + Label each API calls as block index of the trace + Radeon GPU Detective could dump the label for debugging. --batching-memory-usage Limits the max amount of additional memory that can be used to batch resource data uploads during trim state load. Batching resource data uploads may reduce the number diff --git a/framework/decode/CMakeLists.txt b/framework/decode/CMakeLists.txt index 9babfcf4b6..b9f6c17095 100644 --- a/framework/decode/CMakeLists.txt +++ b/framework/decode/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################### # Copyright (c) 2018-2023 LunarG, Inc. -# Copyright (c) 2019-2023 Advanced Micro Devices, Inc. +# Copyright (c) 2019-2025 Advanced Micro Devices, Inc. # All rights reserved # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -272,6 +272,8 @@ target_sources(gfxrecon_decode ${CMAKE_CURRENT_LIST_DIR}/custom_ags_replay_consumer.h ${CMAKE_CURRENT_LIST_DIR}/custom_ags_replay_consumer.cpp ${CMAKE_CURRENT_LIST_DIR}/ags_detection_consumer.h + ${CMAKE_CURRENT_LIST_DIR}/ags_gpu_cmd_wrapper.h + ${CMAKE_CURRENT_LIST_DIR}/ags_gpu_cmd_wrapper.cpp ) endif() diff --git a/framework/decode/ags_gpu_cmd_wrapper.cpp b/framework/decode/ags_gpu_cmd_wrapper.cpp new file mode 100644 index 0000000000..e022891f23 --- /dev/null +++ b/framework/decode/ags_gpu_cmd_wrapper.cpp @@ -0,0 +1,107 @@ +/* +** Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. +** +** 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 "decode/ags_gpu_cmd_wrapper.h" + +#include "generated/generated_dx12_call_id_to_string.h" +#include "graphics/dx12_ags_marker_injector.h" + +#include +#include + +GFXRECON_BEGIN_NAMESPACE(gfxrecon) +GFXRECON_BEGIN_NAMESPACE(decode) + +AgsGpuCmdWrapper::AgsGpuCmdWrapper(DxReplayOptions* options, + ID3D12GraphicsCommandList* command_list, + format::HandleId capture_id, + format::ApiCallId call_id, + uint64_t block_idx) +{ + if ((options != nullptr)) + { + current_options = options; + + if (current_options->ags_inject_markers) + { + if (command_list != nullptr) + { + current_command_list = command_list; + + if (call_id == format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_BeginEvent || + call_id == format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_EndEvent || + call_id == format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetMarker) + { + bypass_marker_ = true; + } + + if (bypass_marker_ == false) + { + graphics::Dx12AgsMarkerInjector* injector = graphics::Dx12AgsMarkerInjector::Get(); + + if (injector != nullptr) + { + std::wstring api_id_w = gfxrecon::util::GetDx12CallIdString(call_id); + + std::wstring_convert, wchar_t> temp_convert; + std::string api_id = temp_convert.to_bytes(api_id_w); + + std::string marker_str = "gfxr_cmd_list_"; + marker_str.append(std::to_string(capture_id)); + marker_str.append(" - "); + marker_str.append(api_id); + marker_str.append(" - "); + marker_str.append("block_idx_"); + marker_str.append(std::to_string(block_idx)); + + injector->PushMarker(current_command_list, marker_str); + } + } + } + } + } +} + +AgsGpuCmdWrapper::~AgsGpuCmdWrapper() +{ + if (current_options != nullptr) + { + if (current_options->ags_inject_markers) + { + if (current_command_list != nullptr) + { + if (bypass_marker_ == false) + { + graphics::Dx12AgsMarkerInjector* injector = graphics::Dx12AgsMarkerInjector::Get(); + + if (injector != nullptr) + { + injector->PopMarker(current_command_list); + } + } + } + } + } +} + +GFXRECON_END_NAMESPACE(decode) +GFXRECON_END_NAMESPACE(gfxrecon) diff --git a/framework/decode/ags_gpu_cmd_wrapper.h b/framework/decode/ags_gpu_cmd_wrapper.h new file mode 100644 index 0000000000..8180ca9524 --- /dev/null +++ b/framework/decode/ags_gpu_cmd_wrapper.h @@ -0,0 +1,56 @@ +/* +** Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. +** +** 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. +*/ + +#ifndef GFXRECON_AGS_GPU_CMD_WRAPPER_H +#define GFXRECON_AGS_GPU_CMD_WRAPPER_H + +#include "util/defines.h" +#include "format/format.h" + +#include "decode/dx_replay_options.h" + +#include + +GFXRECON_BEGIN_NAMESPACE(gfxrecon) +GFXRECON_BEGIN_NAMESPACE(decode) + +class AgsGpuCmdWrapper +{ + public: + AgsGpuCmdWrapper(DxReplayOptions* options, + ID3D12GraphicsCommandList* command_list, + format::HandleId capture_id, + format::ApiCallId call_id, + uint64_t block_idx); + + ~AgsGpuCmdWrapper(); + + private: + DxReplayOptions* current_options{ nullptr }; + ID3D12GraphicsCommandList* current_command_list{ nullptr }; + bool bypass_marker_ = false; +}; + +GFXRECON_END_NAMESPACE(decode) +GFXRECON_END_NAMESPACE(gfxrecon) + +#endif // GFXRECON_AGS_GPU_CMD_WRAPPER_H diff --git a/framework/decode/custom_ags_replay_consumer.cpp b/framework/decode/custom_ags_replay_consumer.cpp index 846523310a..b92bbb2a75 100644 --- a/framework/decode/custom_ags_replay_consumer.cpp +++ b/framework/decode/custom_ags_replay_consumer.cpp @@ -163,6 +163,7 @@ void AgsReplayConsumer::Process_agsInitialize(const ApiCallInfo& call_info, if (result == AGS_SUCCESS) { context_map_[context] = replay_context; + dx12_replay_consumer_->SetAgsMarkerInjector(replay_context); } CheckReplayResult("Process_agsInitialize", return_value, result); diff --git a/framework/decode/dx12_replay_consumer_base.cpp b/framework/decode/dx12_replay_consumer_base.cpp index 288d5690b3..6184b16627 100644 --- a/framework/decode/dx12_replay_consumer_base.cpp +++ b/framework/decode/dx12_replay_consumer_base.cpp @@ -117,6 +117,10 @@ Dx12ReplayConsumerBase::Dx12ReplayConsumerBase(std::shared_ptr(get_object_func, shader_id_map_, gpu_va_map_, descriptor_map_); } +#ifdef GFXRECON_AGS_SUPPORT +void Dx12ReplayConsumerBase::SetAgsMarkerInjector(AGSContext* ags_context) +{ + if (options_.ags_inject_markers) + { + ags_marker_injector_ = graphics::Dx12AgsMarkerInjector::Create(); + + if (ags_marker_injector_ != nullptr) + { + AGSConfiguration ags_config = {}; + AGSGPUInfo ags_gpu_info = {}; + + if (ags_context == nullptr) + { + AGSReturnCode ags_return = + agsInitialize(AGS_MAKE_VERSION(AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH), + &ags_config, + &ags_context, + &ags_gpu_info); + + if (ags_return != AGS_SUCCESS) + { + GFXRECON_LOG_WARNING("Failed to initialize AGS. Marker injection disabled."); + + options_.ags_inject_markers = false; + ags_marker_injector_ = nullptr; + } + } + if (ags_context != nullptr) + { + ags_marker_injector_->SetContext(ags_context); + } + } + } +} +#endif + void Dx12ReplayConsumerBase::EnableDebugLayer(ID3D12Debug* dx12_debug) { if (!debug_layer_enabled_) @@ -1077,8 +1118,57 @@ HRESULT Dx12ReplayConsumerBase::OverrideD3D12CreateDevice(HRESULT IUnknown* adapter = GetCreateDeviceAdapter(adapter_info); - auto replay_result = - D3D12CreateDevice(adapter, minimum_feature_level, *riid.decoded_value, device->GetHandlePointer()); + auto replay_result = E_FAIL; +#ifdef GFXRECON_AGS_SUPPORT + if (options_.ags_inject_markers) + { + AGSDX12DeviceCreationParams creation_params = {}; + creation_params.pAdapter = GetAdapter(); + creation_params.iid = IID_ID3D12Device; + creation_params.FeatureLevel = minimum_feature_level; + + AGSDX12ExtensionParams extension_params = {}; + AGSDX12ReturnedParams returned_params = {}; + + // Create AGS device for marker injection + AGSReturnCode ags_return = agsDriverExtensionsDX12_CreateDevice( + ags_marker_injector_->Context(), &creation_params, &extension_params, &returned_params); + + if (ags_return == AGS_SUCCESS) + { + GFXRECON_LOG_DEBUG("Created AGS device."); + + if (device->GetHandlePointer() != nullptr) + { + *device->GetHandlePointer() = returned_params.pDevice; + } + + replay_result = S_OK; + + if (returned_params.extensionsSupported.userMarkers == 0) + { + GFXRECON_LOG_WARNING("Device does not support the AGS marker extension. Marker injection disabled."); + + options_.ags_inject_markers = false; + } + } + else + { + GFXRECON_LOG_WARNING("Failed to create AGS device, so falling back to creation of regular ID3D12Device. " + "Marker injection disabled."); + + options_.ags_inject_markers = false; + + replay_result = + D3D12CreateDevice(adapter, minimum_feature_level, *riid.decoded_value, device->GetHandlePointer()); + } + } + else +#endif + { + replay_result = + D3D12CreateDevice(adapter, minimum_feature_level, *riid.decoded_value, device->GetHandlePointer()); + } if (SUCCEEDED(replay_result) && !device->IsNull()) { diff --git a/framework/decode/dx12_replay_consumer_base.h b/framework/decode/dx12_replay_consumer_base.h index 51497798a9..7eff4085e3 100644 --- a/framework/decode/dx12_replay_consumer_base.h +++ b/framework/decode/dx12_replay_consumer_base.h @@ -42,6 +42,10 @@ #include "graphics/dx12_util.h" #include "application/application.h" +#ifdef GFXRECON_AGS_SUPPORT +#include "graphics/dx12_ags_marker_injector.h" +#endif + #include #include #include @@ -64,6 +68,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer gfxrecon::util::filepath::CheckReplayerName(info_record.AppName); } +#ifdef GFXRECON_AGS_SUPPORT + void SetAgsMarkerInjector(AGSContext* ags_context = nullptr); +#endif + void SetFatalErrorHandler(std::function handler) { fatal_error_handler_ = handler; } void SetFpsInfo(graphics::FpsInfo* fps_info) { fps_info_ = fps_info; } @@ -1170,6 +1178,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer std::unique_ptr screenshot_handler_; std::unordered_map resource_init_infos_; uint64_t frame_end_marker_count_; + +#ifdef GFXRECON_AGS_SUPPORT + graphics::Dx12AgsMarkerInjector* ags_marker_injector_{ nullptr }; +#endif }; GFXRECON_END_NAMESPACE(decode) diff --git a/framework/decode/dx_replay_options.h b/framework/decode/dx_replay_options.h index 9d76c236e5..db69fa4882 100644 --- a/framework/decode/dx_replay_options.h +++ b/framework/decode/dx_replay_options.h @@ -1,7 +1,7 @@ /* ** Copyright (c) 2019-2020 Valve Corporation ** Copyright (c) 2019-2021 LunarG, Inc. -** Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +** Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and associated documentation files (the "Software"), @@ -47,6 +47,7 @@ struct DxReplayOptions : public ReplayOptions std::vector AllowedDebugMessages; std::vector DeniedDebugMessages; bool override_object_names{ false }; + bool ags_inject_markers{ false }; int32_t memory_usage{ kDefaultBatchingMemoryUsage }; }; diff --git a/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py b/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py index 3056b73ac4..ced932f586 100644 --- a/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py +++ b/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py @@ -115,6 +115,19 @@ def write_include(self): file=self.outFile ) self.newline() + write( + '#ifdef GFXRECON_AGS_SUPPORT', + file=self.outFile + ) + write( + '#include "decode/ags_gpu_cmd_wrapper.h"', + file=self.outFile + ) + write( + '#endif', + file=self.outFile + ) + self.newline() def genStruct(self, typeinfo, typename, alias): """Method override.""" @@ -165,6 +178,15 @@ def generate_dx12_method_feature(self): " {\n" ) + if 'ID3D12GraphicsCommandList' in class_name: + cmddef += ("#ifdef GFXRECON_AGS_SUPPORT\n".format(method) + ) + cmddef += ( + " AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_{0}, GetCurrentBlockIndex());\n".format(method) + ) + cmddef += ("#endif\n\n".format(method) + ) + body = self.make_consumer_func_body(return_type, method, values) code_list = body.split('\n') for code in code_list: diff --git a/framework/generated/generated_dx12_replay_consumer.cpp b/framework/generated/generated_dx12_replay_consumer.cpp index e3a5918d37..3d0cf015a3 100644 --- a/framework/generated/generated_dx12_replay_consumer.cpp +++ b/framework/generated/generated_dx12_replay_consumer.cpp @@ -31,6 +31,10 @@ #include "decode/custom_dx12_replay_commands.h" #include "generated/generated_dx12_struct_object_mappers.h" +#ifdef GFXRECON_AGS_SUPPORT +#include "decode/ags_gpu_cmd_wrapper.h" +#endif + GFXRECON_BEGIN_NAMESPACE(gfxrecon) GFXRECON_BEGIN_NAMESPACE(decode) @@ -6057,6 +6061,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_Close( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_Close, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6091,6 +6099,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_Reset( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_Reset, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6123,6 +6135,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ClearState( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ClearState, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6158,6 +6174,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_DrawInstanced( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_DrawInstanced, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6205,6 +6225,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_DrawIndexedInstanced( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_DrawIndexedInstanced, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6254,6 +6278,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_Dispatch( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_Dispatch, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6297,6 +6325,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_CopyBufferRegion( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_CopyBufferRegion, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6339,6 +6371,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_CopyTextureRegion( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_CopyTextureRegion, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6380,6 +6416,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_CopyResource( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_CopyResource, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6413,6 +6453,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_CopyTiles( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_CopyTiles, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6470,6 +6514,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ResolveSubresource( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ResolveSubresource, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6519,6 +6567,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_IASetPrimitiveTopolog auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_IASetPrimitiveTopology, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6551,6 +6603,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_RSSetViewports( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_RSSetViewports, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6587,6 +6643,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_RSSetScissorRects( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_RSSetScissorRects, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6622,6 +6682,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_OMSetBlendFactor( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_OMSetBlendFactor, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6653,6 +6717,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_OMSetStencilRef( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_OMSetStencilRef, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6684,6 +6752,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetPipelineState( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetPipelineState, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6717,6 +6789,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ResourceBarrier( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ResourceBarrier, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6753,6 +6829,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ExecuteBundle( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ExecuteBundle, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6778,6 +6858,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetDescriptorHeaps( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetDescriptorHeaps, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6814,6 +6898,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRootSignatu auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRootSignature, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6846,6 +6934,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRootSignat auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRootSignature, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6879,6 +6971,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRootDescrip auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRootDescriptorTable, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6916,6 +7012,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRootDescri auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6954,6 +7054,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRoot32BitCo auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRoot32BitConstant, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -6995,6 +7099,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRoot32BitC auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstant, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7037,6 +7145,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRoot32BitCo auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRoot32BitConstants, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7083,6 +7195,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRoot32BitC auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7127,6 +7243,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRootConstan auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRootConstantBufferView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7164,6 +7284,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRootConsta auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7201,6 +7325,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRootShaderR auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRootShaderResourceView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7238,6 +7366,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRootShader auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRootShaderResourceView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7275,6 +7407,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetComputeRootUnorder auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetComputeRootUnorderedAccessView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7312,6 +7448,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetGraphicsRootUnorde auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetGraphicsRootUnorderedAccessView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7348,6 +7488,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_IASetIndexBuffer( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_IASetIndexBuffer, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7374,6 +7518,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_IASetVertexBuffers( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_IASetVertexBuffers, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7406,6 +7554,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SOSetTargets( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SOSetTargets, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7449,6 +7601,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_OMSetRenderTargets( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_OMSetRenderTargets, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7499,6 +7655,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ClearDepthStencilView auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ClearDepthStencilView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7554,6 +7714,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ClearRenderTargetView auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ClearRenderTargetView, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7603,6 +7767,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ClearUnorderedAccessV auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7662,6 +7830,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ClearUnorderedAccessV auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7717,6 +7889,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_DiscardResource( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_DiscardResource, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7755,6 +7931,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_BeginQuery( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_BeginQuery, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7797,6 +7977,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_EndQuery( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_EndQuery, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7842,6 +8026,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ResolveQueryData( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ResolveQueryData, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7897,6 +8085,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetPredication( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetPredication, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7939,6 +8131,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_SetMarker( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_SetMarker, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -7980,6 +8176,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_BeginEvent( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_BeginEvent, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8018,6 +8218,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_EndEvent( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_EndEvent, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8052,6 +8256,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList_ExecuteIndirect( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList_ExecuteIndirect, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8099,6 +8307,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_AtomicCopyBufferUINT auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_AtomicCopyBufferUINT, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8165,6 +8377,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_AtomicCopyBufferUINT auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_AtomicCopyBufferUINT64, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8226,6 +8442,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_OMSetDepthBounds( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_OMSetDepthBounds, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8265,6 +8485,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_SetSamplePositions( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_SetSamplePositions, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8314,6 +8538,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_ResolveSubresourceRe auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_ResolveSubresourceRegion, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8381,6 +8609,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList1_SetViewInstanceMask( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList1_SetViewInstanceMask, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -8416,6 +8648,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList2_WriteBufferImmediate auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList2_WriteBufferImmediate, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12597,6 +12833,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList3_SetProtectedResource auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList3_SetProtectedResourceSession, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12663,6 +12903,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_BeginRenderPass( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_BeginRenderPass, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12696,6 +12940,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_EndRenderPass( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_EndRenderPass, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12729,6 +12977,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_InitializeMetaComman auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_InitializeMetaCommand, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12773,6 +13025,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_ExecuteMetaCommand( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_ExecuteMetaCommand, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12817,6 +13073,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_BuildRaytracingAccel auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_BuildRaytracingAccelerationStructure, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12850,6 +13110,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_EmitRaytracingAccele auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_EmitRaytracingAccelerationStructurePostbuildInfo, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12898,6 +13162,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_CopyRaytracingAccele auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_CopyRaytracingAccelerationStructure, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12941,6 +13209,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_SetPipelineState1( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_SetPipelineState1, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -12965,6 +13237,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList4_DispatchRays( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList4_DispatchRays, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14099,6 +14375,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList5_RSSetShadingRate( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList5_RSSetShadingRate, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14136,6 +14416,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList5_RSSetShadingRateImag auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList5_RSSetShadingRateImage, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14172,6 +14456,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList6_DispatchMesh( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList6_DispatchMesh, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14214,6 +14502,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList7_Barrier( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList7_Barrier, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14253,6 +14545,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList8_OMSetFrontAndBackSte auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList8_OMSetFrontAndBackStencilRef, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14292,6 +14588,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList9_RSSetDepthBias( auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList9_RSSetDepthBias, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, @@ -14333,6 +14633,10 @@ void Dx12ReplayConsumer::Process_ID3D12GraphicsCommandList9_IASetIndexBufferStri auto replay_object = GetObjectInfo(object_id); if ((replay_object != nullptr) && (replay_object->object != nullptr)) { +#ifdef GFXRECON_AGS_SUPPORT + AgsGpuCmdWrapper ags_gpu_cmd_wrapper(&options_, static_cast(replay_object->object), object_id, format::ApiCallId::ApiCall_ID3D12GraphicsCommandList9_IASetIndexBufferStripCutValue, GetCurrentBlockIndex()); +#endif + CustomReplayPreCall::Dispatch( this, call_info, diff --git a/framework/graphics/CMakeLists.txt b/framework/graphics/CMakeLists.txt index f69ee7c3ca..794deb7c2a 100644 --- a/framework/graphics/CMakeLists.txt +++ b/framework/graphics/CMakeLists.txt @@ -1,5 +1,6 @@ ############################################################################### # Copyright (c) 2021 LunarG, Inc. +# Copyright (c) 2025 Advanced Micro Devices, Inc. # All rights reserved # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -57,6 +58,14 @@ target_sources(gfxrecon_graphics ${CMAKE_CURRENT_LIST_DIR}/vulkan_struct_extract_handles.cpp ) +if (${GFXRECON_AGS_SUPPORT_FINAL}) +target_sources(gfxrecon_graphics + PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/dx12_ags_marker_injector.h + ${CMAKE_CURRENT_LIST_DIR}/dx12_ags_marker_injector.cpp + ) +endif() + target_include_directories(gfxrecon_graphics PUBLIC ${CMAKE_SOURCE_DIR}/build diff --git a/framework/graphics/dx12_ags_marker_injector.cpp b/framework/graphics/dx12_ags_marker_injector.cpp new file mode 100644 index 0000000000..b04ea92293 --- /dev/null +++ b/framework/graphics/dx12_ags_marker_injector.cpp @@ -0,0 +1,117 @@ +/* +** Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. +** +** 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 "graphics/dx12_ags_marker_injector.h" + +#include "graphics/dx12_util.h" + +GFXRECON_BEGIN_NAMESPACE(gfxrecon) +GFXRECON_BEGIN_NAMESPACE(graphics) + +Dx12AgsMarkerInjector* instance_ = nullptr; + +Dx12AgsMarkerInjector* Dx12AgsMarkerInjector::Get() +{ + return instance_; +} + +Dx12AgsMarkerInjector* Dx12AgsMarkerInjector::Create() +{ + if (instance_ == nullptr) + { + instance_ = new Dx12AgsMarkerInjector(); + } + + return instance_; +} + +bool Dx12AgsMarkerInjector::PushMarker(ID3D12GraphicsCommandList* command_list, const std::string& marker) +{ + bool result = false; + + if ((ags_context_ != nullptr) && (command_list != nullptr)) + { + char marker_buf[graphics::dx12::kMaxMarkerStrLength] = {}; + strcpy(marker_buf, marker.c_str()); + + AGSReturnCode ags_return = agsDriverExtensionsDX12_PushMarker(ags_context_, command_list, marker_buf); + + if (ags_return == AGS_SUCCESS) + { + result = true; + } + else + { + GFXRECON_LOG_WARNING("AGS PushMarker() failed"); + } + } + + return result; +} + +bool Dx12AgsMarkerInjector::PopMarker(ID3D12GraphicsCommandList* command_list) +{ + bool result = false; + + if ((ags_context_ != nullptr) && (command_list != nullptr)) + { + AGSReturnCode ags_return = agsDriverExtensionsDX12_PopMarker(ags_context_, command_list); + + if (ags_return == AGS_SUCCESS) + { + result = true; + } + else + { + GFXRECON_LOG_WARNING("AGS PopMarker() failed"); + } + } + + return result; +} + +bool Dx12AgsMarkerInjector::SetMarker(ID3D12GraphicsCommandList* command_list, const std::string& marker) +{ + bool result = false; + + if ((ags_context_ != nullptr) && (command_list != nullptr)) + { + char marker_buf[graphics::dx12::kMaxMarkerStrLength] = {}; + strcpy(marker_buf, marker.c_str()); + + AGSReturnCode ags_return = agsDriverExtensionsDX12_SetMarker(ags_context_, command_list, marker_buf); + + if (ags_return == AGS_SUCCESS) + { + result = true; + } + else + { + GFXRECON_LOG_WARNING("AGS SetMarker() failed"); + } + } + + return result; +} + +GFXRECON_END_NAMESPACE(graphics) +GFXRECON_END_NAMESPACE(gfxrecon) diff --git a/framework/graphics/dx12_ags_marker_injector.h b/framework/graphics/dx12_ags_marker_injector.h new file mode 100644 index 0000000000..338671e572 --- /dev/null +++ b/framework/graphics/dx12_ags_marker_injector.h @@ -0,0 +1,53 @@ +/* +** Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. +** +** 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. +*/ + +#ifndef GFXRECON_DX12_AGS_MARKER_INJECTOR_H +#define GFXRECON_DX12_AGS_MARKER_INJECTOR_H + +#include "util/defines.h" + +#include +#include +#include + +GFXRECON_BEGIN_NAMESPACE(gfxrecon) +GFXRECON_BEGIN_NAMESPACE(graphics) + +class Dx12AgsMarkerInjector +{ + public: + static Dx12AgsMarkerInjector* Get(); + static Dx12AgsMarkerInjector* Create(); + bool PushMarker(ID3D12GraphicsCommandList* command_list, const std::string& marker); + bool PopMarker(ID3D12GraphicsCommandList* command_list); + bool SetMarker(ID3D12GraphicsCommandList* command_list, const std::string& marker); + void SetContext(AGSContext* context) { ags_context_ = context; } + AGSContext* Context() { return ags_context_; } + + private: + AGSContext* ags_context_{ nullptr }; +}; + +GFXRECON_END_NAMESPACE(graphics) +GFXRECON_END_NAMESPACE(gfxrecon) + +#endif // GFXRECON_DX12_AGS_MARKER_INJECTOR_H diff --git a/framework/graphics/dx12_util.h b/framework/graphics/dx12_util.h index 8b52a4cb42..aee41041fa 100644 --- a/framework/graphics/dx12_util.h +++ b/framework/graphics/dx12_util.h @@ -1,6 +1,6 @@ /* ** Copyright (c) 2021 LunarG, Inc. -** Copyright (c) 2021-2023 Advanced Micro Devices, Inc. All rights reserved. +** Copyright (c) 2021-2025 Advanced Micro Devices, Inc. All rights reserved. ** Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining a @@ -136,6 +136,8 @@ static const uint32_t kAdapterTypeShift = 0; static const uint32_t kAdapterIdMask = 0xFFFFFFFc; static const uint32_t kAdapterIdShift = 2; +static const uint32_t kMaxMarkerStrLength = 1024; + struct AdapterSubmissionMapping { std::unordered_map queue_to_device_map; diff --git a/tools/replay/replay_settings.h b/tools/replay/replay_settings.h index a69bee8b42..268342884e 100644 --- a/tools/replay/replay_settings.h +++ b/tools/replay/replay_settings.h @@ -1,6 +1,6 @@ /* ** Copyright (c) 2019-2023 LunarG, Inc. -** Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +** Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and associated documentation files (the "Software"), @@ -32,10 +32,10 @@ const char kOptions[] = "screenshot-all,--onhb|--omit-null-hardware-buffers,--qamr|--quit-after-measurement-range,--fmr|--flush-" "measurement-range,--flush-inside-measurement-range,--vssb|--virtual-swapchain-skip-blit,--use-captured-swapchain-" "indices,--dcp,--discard-cached-psos,--use-colorspace-fallback,--use-cached-psos,--dx12-override-object-names,--" - "offscreen-swapchain-frame-boundary,--wait-before-present,--dump-resources-before-draw," - "--dump-resources-dump-depth-attachment,--dump-" - "resources-dump-vertex-index-buffers,--dump-resources-json-output-per-command,--dump-resources-dump-immutable-" - "resources,--dump-resources-dump-all-image-subresources,--dump-resources-dump-raw-images,--dump-resources-dump-" + "dx12-ags-inject-markers,--offscreen-swapchain-frame-boundary,--wait-before-present,--dump-resources-before-draw," + "--dump-resources-dump-depth-attachment,--dump-resources-dump-vertex-index-buffers," + "--dump-resources-json-output-per-command,--dump-resources-dump-immutable-resources," + "--dump-resources-dump-all-image-subresources,--dump-resources-dump-raw-images,--dump-resources-dump-" "separate-alpha,--pbi-all,--preload-measurement-range, --add-new-pipeline-caches"; const char kArguments[] = "--log-level,--log-file,--gpu,--gpu-group,--pause-frame,--wsi,--surface-index,-m|--memory-translation," @@ -367,6 +367,9 @@ static void PrintUsage(const char* exe_name) GFXRECON_WRITE_CONSOLE(" \t\tGenerate unique names for all ID3D12Objects and"); GFXRECON_WRITE_CONSOLE(" \t\tassign each object the generated name."); GFXRECON_WRITE_CONSOLE(" \t\tThis is intended to assist in replay debugging."); + GFXRECON_WRITE_CONSOLE(" --dx12-ags-inject-markers"); + GFXRECON_WRITE_CONSOLE(" \t\tLabel each API calls as block index of the trace"); + GFXRECON_WRITE_CONSOLE(" \t\tRadeon GPU Detective could dump the label for debugging."); GFXRECON_WRITE_CONSOLE(" --batching-memory-usage "); GFXRECON_WRITE_CONSOLE(" \t\tMax amount of memory consumption while loading a trimmed capture file."); GFXRECON_WRITE_CONSOLE(" \t\tAcceptable values range from 0 to 100 (default: 80)"); diff --git a/tools/tool_settings.h b/tools/tool_settings.h index 76ed3a95b7..a98a9316a3 100644 --- a/tools/tool_settings.h +++ b/tools/tool_settings.h @@ -1,6 +1,6 @@ /* ** Copyright (c) 2019-2023 LunarG, Inc. -** Copyright (c) 2021-2023 Advanced Micro Devices, Inc. All rights reserved. +** Copyright (c) 2021-2025 Advanced Micro Devices, Inc. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and associated documentation files (the "Software"), @@ -131,6 +131,7 @@ const char kCreateNewPipelineCacheOption[] = "--add-new-pipeline-caches"; #if defined(WIN32) const char kDxTwoPassReplay[] = "--dx12-two-pass-replay"; const char kDxOverrideObjectNames[] = "--dx12-override-object-names"; +const char kDxAgsMarkRenderPasses[] = "--dx12-ags-inject-markers"; const char kBatchingMemoryUsageArgument[] = "--batching-memory-usage"; #endif @@ -1195,6 +1196,15 @@ static gfxrecon::decode::DxReplayOptions GetDxReplayOptions(const gfxrecon::util replay_options.override_object_names = true; } + if (arg_parser.IsOptionSet(kDxAgsMarkRenderPasses)) + { +#ifdef GFXRECON_AGS_SUPPORT + replay_options.ags_inject_markers = true; +#else + GFXRECON_LOG_ERROR("Unsupported option --dx12-ags-inject-markers"); +#endif + } + const std::string& dump_resources = arg_parser.GetArgumentValue(kDumpResourcesArgument); if (!dump_resources.empty() && dump_resources.find_first_not_of("0123456789,") == std::string::npos) {