Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions framework/decode/custom_dx12_struct_decoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_FEATURE_DA
(buffer + bytes_read), (buffer_size - bytes_read), &(value->MinimumABISupportVersion));
bytes_read += ValueDecoder::DecodeUInt64Value(
(buffer + bytes_read), (buffer_size - bytes_read), &(value->MaximumABISupportVersion));
bytes_read +=
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->CompilerVersion.Version));
bytes_read += ValueDecoder::DecodeUInt64Value(
(buffer + bytes_read), (buffer_size - bytes_read), &(value->CompilerVersion.Version));
bytes_read += ValueDecoder::DecodeUInt64Value(
(buffer + bytes_read), (buffer_size - bytes_read), &(value->ApplicationProfileVersion.Version));

Expand All @@ -776,11 +776,12 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_APP
value->pExeFilename = wrapper->pExeFilename.GetPointer();
bytes_read += wrapper->pName.Decode((buffer + bytes_read), (buffer_size - bytes_read));
value->pName = wrapper->pName.GetPointer();
bytes_read += ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->Version.Version));
bytes_read +=
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->Version.Version));
bytes_read += wrapper->pEngineName.Decode((buffer + bytes_read), (buffer_size - bytes_read));
value->pEngineName = wrapper->pEngineName.GetPointer();
bytes_read +=
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->EngineVersion.Version));
bytes_read += ValueDecoder::DecodeUInt64Value(
(buffer + bytes_read), (buffer_size - bytes_read), &(value->EngineVersion.Version));

return bytes_read;
}
Expand Down Expand Up @@ -820,7 +821,6 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_RAY
return bytes_read;
}


size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_PIPELINE_STATE_STREAM_DESC* wrapper)
{
assert((wrapper != nullptr) && (wrapper->decoded_value != nullptr));
Expand Down Expand Up @@ -1307,8 +1307,7 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
value->pDesc = wrapper->raytracing_pipeline_config1->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_WORK_GRAPH:
wrapper->work_graph_desc =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_WORK_GRAPH_DESC>>();
wrapper->work_graph_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_WORK_GRAPH_DESC>>();
bytes_read += wrapper->work_graph_desc->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->work_graph_desc->GetPointer();
break;
Expand All @@ -1329,17 +1328,20 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
reinterpret_cast<uint32_t*>(const_cast<void*>(value->pDesc)));
break;
case D3D12_STATE_SUBOBJECT_TYPE_RASTERIZER:
wrapper->rasterizer_desc2 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RASTERIZER_DESC2>>();
wrapper->rasterizer_desc2 =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RASTERIZER_DESC2>>();
bytes_read += wrapper->rasterizer_desc2->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->rasterizer_desc2->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL:
wrapper->depth_stencil_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC>>();
wrapper->depth_stencil_desc =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC>>();
bytes_read += wrapper->depth_stencil_desc->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->depth_stencil_desc->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT:
wrapper->input_layout_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_INPUT_LAYOUT_DESC>>();
wrapper->input_layout_desc =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_INPUT_LAYOUT_DESC>>();
bytes_read += wrapper->input_layout_desc->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->input_layout_desc->GetPointer();
break;
Expand All @@ -1358,8 +1360,7 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
reinterpret_cast<D3D12_PRIMITIVE_TOPOLOGY_TYPE*>(const_cast<void*>(value->pDesc)));
break;
case D3D12_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS:
wrapper->rt_format_array =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RT_FORMAT_ARRAY>>();
wrapper->rt_format_array = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RT_FORMAT_ARRAY>>();
bytes_read += wrapper->rt_format_array->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->rt_format_array->GetPointer();
break;
Expand All @@ -1383,22 +1384,26 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
reinterpret_cast<D3D12_PIPELINE_STATE_FLAGS*>(const_cast<void*>(value->pDesc)));
break;
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1:
wrapper->depth_stencil_desc1 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC1>>();
wrapper->depth_stencil_desc1 =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC1>>();
bytes_read += wrapper->depth_stencil_desc1->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->depth_stencil_desc1->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING:
wrapper->view_instancing_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_VIEW_INSTANCING_DESC>>();
wrapper->view_instancing_desc =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_VIEW_INSTANCING_DESC>>();
bytes_read += wrapper->view_instancing_desc->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->view_instancing_desc->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_GENERIC_PROGRAM:
wrapper->generic_program_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_GENERIC_PROGRAM_DESC>>();
wrapper->generic_program_desc =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_GENERIC_PROGRAM_DESC>>();
bytes_read += wrapper->generic_program_desc->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->generic_program_desc->GetPointer();
break;
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2:
wrapper->depth_stencil_desc2 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC2>>();
wrapper->depth_stencil_desc2 =
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC2>>();
bytes_read += wrapper->depth_stencil_desc2->Decode(buffer2, buffer_size2);
value->pDesc = wrapper->depth_stencil_desc2->GetPointer();
break;
Expand Down
6 changes: 3 additions & 3 deletions framework/decode/dx12_dump_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2430,15 +2430,15 @@ void DefaultDx12DumpResourcesDelegate::WriteSingleData(const std::vector<std::pa
const std::string& key,
uint64_t value)
{
auto* jdata_node = FindDrawCallJsonNode(json_path);
auto* jdata_node = FindDrawCallJsonNode(json_path);
(*jdata_node)[key] = value;
}

void DefaultDx12DumpResourcesDelegate::WriteSingleData(const std::vector<std::pair<std::string, int32_t>>& json_path,
const uint32_t index,
uint64_t value)
{
auto* jdata_node = FindDrawCallJsonNode(json_path);
auto* jdata_node = FindDrawCallJsonNode(json_path);
(*jdata_node)[index] = value;
}

Expand Down Expand Up @@ -2498,7 +2498,7 @@ void DefaultDx12DumpResourcesDelegate::WriteRootParameterInfo(
uint32_t root_parameter_index,
const TrackRootParameter& root_parameter)
{
auto* jdata_node = FindDrawCallJsonNode(json_path);
auto* jdata_node = FindDrawCallJsonNode(json_path);
(*jdata_node)["root_parameter_index"] = root_parameter_index;
(*jdata_node)["root_signature_type"] = root_parameter.root_signature_type;
(*jdata_node)["cmd_bind_type"] = root_parameter.cmd_bind_type;
Expand Down
10 changes: 5 additions & 5 deletions framework/decode/dx12_json_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool Dx12JsonConsumerBase::IsValid() const
void Dx12JsonConsumerBase::ProcessCreateHeapAllocationCommand(uint64_t allocation_id, uint64_t allocation_size)
{
writer_->SetCurrentBlockIndex(block_index_);
auto& jdata = writer_->WriteMetaCommandStart("CreateHeapAllocationCommand");
auto& jdata = writer_->WriteMetaCommandStart("CreateHeapAllocationCommand");
jdata["allocation_id"] = allocation_id;
jdata["allocation_size"] = allocation_size;
writer_->WriteBlockEnd();
Expand All @@ -69,7 +69,7 @@ void Dx12JsonConsumerBase::ProcessInitSubresourceCommand(const format::InitSubre
const uint8_t* data)
{
writer_->SetCurrentBlockIndex(block_index_);
auto& jdata = writer_->WriteMetaCommandStart("InitSubresourceCommand");
auto& jdata = writer_->WriteMetaCommandStart("InitSubresourceCommand");
jdata["thread_id"] = command_header.thread_id;
jdata["device_id"] = command_header.device_id;
jdata["resource_id"] = command_header.resource_id;
Expand All @@ -95,7 +95,7 @@ void Dx12JsonConsumerBase::ProcessInitDx12AccelerationStructureCommand(
using util::FieldToJson;

writer_->SetCurrentBlockIndex(block_index_);
auto& jdata = writer_->WriteMetaCommandStart("InitDx12AccelerationStructureCommand");
auto& jdata = writer_->WriteMetaCommandStart("InitDx12AccelerationStructureCommand");
jdata["thread_id"] = command_header.thread_id;
// The GPU address D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC.DestAccelerationStructureData
// is mapped from this during replay but we'll just dump the raw capture file value:
Expand Down Expand Up @@ -123,7 +123,7 @@ void Dx12JsonConsumerBase::ProcessFillMemoryResourceValueCommand(
const format::FillMemoryResourceValueCommandHeader& command_header, const uint8_t* data)
{
writer_->SetCurrentBlockIndex(block_index_);
auto& jdata = writer_->WriteMetaCommandStart("FillMemoryResourceValueCommand");
auto& jdata = writer_->WriteMetaCommandStart("FillMemoryResourceValueCommand");
jdata["thread_id"] = command_header.thread_id;
jdata["resource_value_count"] = command_header.resource_value_count;
// There are two blocks of values in data so we need to add together their sizes to know how big the blob to dump
Expand All @@ -142,7 +142,7 @@ void Dx12JsonConsumerBase::ProcessFillMemoryResourceValueCommand(
void Dx12JsonConsumerBase::ProcessDxgiAdapterInfo(const format::DxgiAdapterInfoCommandHeader& adapter_info_header)
{
writer_->SetCurrentBlockIndex(block_index_);
auto& jdata = writer_->WriteMetaCommandStart("DxgiAdapterInfo");
auto& jdata = writer_->WriteMetaCommandStart("DxgiAdapterInfo");
jdata["thread_id"] = adapter_info_header.thread_id;
FieldToJson(jdata["adapter_desc"], adapter_info_header.adapter_desc);
writer_->WriteBlockEnd();
Expand Down
52 changes: 41 additions & 11 deletions framework/decode/dx12_replay_consumer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
void SetAgsMarkerInjector(AGSContext* ags_context = nullptr);
#endif

void SetFatalErrorHandler(std::function<void(const char*)> handler) { fatal_error_handler_ = handler; }
void SetFatalErrorHandler(std::function<void(const char*)> handler)
{
fatal_error_handler_ = handler;
}

void SetFpsInfo(graphics::FpsInfo* fps_info) { fps_info_ = fps_info; }
void SetFpsInfo(graphics::FpsInfo* fps_info)
{
fps_info_ = fps_info;
}

void PostReplay();

Expand Down Expand Up @@ -308,7 +314,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer

IDXGIAdapter* GetAdapter();

graphics::dx12::ActiveAdapterMap& GetAdaptersMap() { return adapters_; }
graphics::dx12::ActiveAdapterMap& GetAdaptersMap()
{
return adapters_;
}

protected:
void MapGpuDescriptorHandle(D3D12_GPU_DESCRIPTOR_HANDLE& handle);
Expand Down Expand Up @@ -558,7 +567,7 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
D3D12_RENDER_PASS_FLAGS Flags);

template <typename T>
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, T* desc_src) {};
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, T* desc_src){};

template <>
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, D3D12_RESOURCE_DESC1* desc_src)
Expand Down Expand Up @@ -1090,9 +1099,15 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
PointerDecoder<uint8_t>* parameters_data,
SIZE_T parameters_data_sizeinbytes);

const Dx12ObjectInfoTable& GetObjectInfoTable() const { return object_info_table_; }
const Dx12ObjectInfoTable& GetObjectInfoTable() const
{
return object_info_table_;
}

Dx12ObjectInfoTable& GetObjectInfoTable() { return object_info_table_; }
Dx12ObjectInfoTable& GetObjectInfoTable()
{
return object_info_table_;
}

DxObjectInfo* GetObjectInfo(format::HandleId id)
{
Expand All @@ -1105,13 +1120,25 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
return nullptr;
}

const Dx12DescriptorMap& GetDescriptorMap() const { return descriptor_map_; }
const Dx12DescriptorMap& GetDescriptorMap() const
{
return descriptor_map_;
}

Dx12DescriptorMap& GetDescriptorMap() { return descriptor_map_; }
Dx12DescriptorMap& GetDescriptorMap()
{
return descriptor_map_;
}

const graphics::Dx12GpuVaMap& GetGpuVaTable() const { return gpu_va_map_; }
const graphics::Dx12GpuVaMap& GetGpuVaTable() const
{
return gpu_va_map_;
}

graphics::Dx12GpuVaMap& GetGpuVaTable() { return gpu_va_map_; }
graphics::Dx12GpuVaMap& GetGpuVaTable()
{
return gpu_va_map_;
}

void ReplaceWindowedResolution(uint32_t& width, uint32_t& height)
{
Expand All @@ -1131,7 +1158,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
}
}

Dx12ResourceValueMapper* GetResourceValueMapper() { return resource_value_mapper_.get(); }
Dx12ResourceValueMapper* GetResourceValueMapper()
{
return resource_value_mapper_.get();
}

template <typename CountT>
void SetOutputArrayCount(format::HandleId object_id, VariableLengthArrayIndices index, CountT count)
Expand Down
2 changes: 1 addition & 1 deletion framework/decode/dx12_stats_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Dx12StatsConsumer : public Dx12Consumer
InsertAdapter(new_adapter, gfxr_cmd_adapters_);
format::HandleId object_id = graphics::dx12::ExtractAdapterCaptureId(new_adapter.extra_info);

const int64_t luid = pack_luid(new_adapter);
const int64_t luid = pack_luid(new_adapter);
adapter_submission_mapping_.adapter_to_luid_map[object_id] = luid;
}

Expand Down
3 changes: 2 additions & 1 deletion framework/encode/dx12_object_wrapper_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ struct AccelerationStructureBuildTrackingObjects
graphics::dx12::ID3D12ResourceComPtr _resource,
graphics::dx12::ID3D12CommandAllocatorComPtr _post_build_copy_cmd_allocator,
graphics::dx12::ID3D12GraphicsCommandList4ComPtr _post_build_copy_cmd_list) :
resource(_resource), post_build_copy_cmd_allocator(_post_build_copy_cmd_allocator),
resource(_resource),
post_build_copy_cmd_allocator(_post_build_copy_cmd_allocator),
post_build_copy_cmd_list(_post_build_copy_cmd_list)
{}

Expand Down
3 changes: 2 additions & 1 deletion framework/encode/dx12_state_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Dx12StateWriter::Dx12StateWriter(util::FileOutputStream* output_stream,
util::Compressor* compressor,
format::ThreadId thread_id,
util::FileOutputStream* asset_file_stream) :
output_stream_(output_stream), compressor_(compressor), thread_id_(thread_id), encoder_(&parameter_stream_)
output_stream_(output_stream),
compressor_(compressor), thread_id_(thread_id), encoder_(&parameter_stream_)
{
assert(output_stream != nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ def makeUnionFieldToJson(self, properties, struct_name, union_index):
case D3D_ROOT_SIGNATURE_VERSION_1_2:
{
FieldToJson(jdata["Desc_1_2"], meta_struct.Desc_1_2);
GFXRECON_LOG_ERROR("Unknown D3D_ROOT_SIGNATURE_VERSION_1_2 in D3D12_VERSIONED_ROOT_SIGNATURE_DESC.");
break;
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2519,7 +2519,6 @@ void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_D3D12_VERSIONED_RO
case D3D_ROOT_SIGNATURE_VERSION_1_2:
{
FieldToJson(jdata["Desc_1_2"], meta_struct.Desc_1_2);
GFXRECON_LOG_ERROR("Unknown D3D_ROOT_SIGNATURE_VERSION_1_2 in D3D12_VERSIONED_ROOT_SIGNATURE_DESC.");
break;
}
default:
Expand Down
Loading