Skip to content

Commit 2dc58f4

Browse files
committed
Updated some dx12 code with the clang-format
1 parent 7dc2d26 commit 2dc58f4

9 files changed

Lines changed: 77 additions & 45 deletions

framework/decode/custom_dx12_struct_decoders.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_FEATURE_DA
757757
(buffer + bytes_read), (buffer_size - bytes_read), &(value->MinimumABISupportVersion));
758758
bytes_read += ValueDecoder::DecodeUInt64Value(
759759
(buffer + bytes_read), (buffer_size - bytes_read), &(value->MaximumABISupportVersion));
760-
bytes_read +=
761-
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->CompilerVersion.Version));
760+
bytes_read += ValueDecoder::DecodeUInt64Value(
761+
(buffer + bytes_read), (buffer_size - bytes_read), &(value->CompilerVersion.Version));
762762
bytes_read += ValueDecoder::DecodeUInt64Value(
763763
(buffer + bytes_read), (buffer_size - bytes_read), &(value->ApplicationProfileVersion.Version));
764764

@@ -776,11 +776,12 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_APP
776776
value->pExeFilename = wrapper->pExeFilename.GetPointer();
777777
bytes_read += wrapper->pName.Decode((buffer + bytes_read), (buffer_size - bytes_read));
778778
value->pName = wrapper->pName.GetPointer();
779-
bytes_read += ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->Version.Version));
779+
bytes_read +=
780+
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->Version.Version));
780781
bytes_read += wrapper->pEngineName.Decode((buffer + bytes_read), (buffer_size - bytes_read));
781782
value->pEngineName = wrapper->pEngineName.GetPointer();
782-
bytes_read +=
783-
ValueDecoder::DecodeUInt64Value((buffer + bytes_read), (buffer_size - bytes_read), &(value->EngineVersion.Version));
783+
bytes_read += ValueDecoder::DecodeUInt64Value(
784+
(buffer + bytes_read), (buffer_size - bytes_read), &(value->EngineVersion.Version));
784785

785786
return bytes_read;
786787
}
@@ -820,7 +821,6 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_RAY
820821
return bytes_read;
821822
}
822823

823-
824824
size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_PIPELINE_STATE_STREAM_DESC* wrapper)
825825
{
826826
assert((wrapper != nullptr) && (wrapper->decoded_value != nullptr));
@@ -1307,8 +1307,7 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
13071307
value->pDesc = wrapper->raytracing_pipeline_config1->GetPointer();
13081308
break;
13091309
case D3D12_STATE_SUBOBJECT_TYPE_WORK_GRAPH:
1310-
wrapper->work_graph_desc =
1311-
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_WORK_GRAPH_DESC>>();
1310+
wrapper->work_graph_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_WORK_GRAPH_DESC>>();
13121311
bytes_read += wrapper->work_graph_desc->Decode(buffer2, buffer_size2);
13131312
value->pDesc = wrapper->work_graph_desc->GetPointer();
13141313
break;
@@ -1329,17 +1328,20 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
13291328
reinterpret_cast<uint32_t*>(const_cast<void*>(value->pDesc)));
13301329
break;
13311330
case D3D12_STATE_SUBOBJECT_TYPE_RASTERIZER:
1332-
wrapper->rasterizer_desc2 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RASTERIZER_DESC2>>();
1331+
wrapper->rasterizer_desc2 =
1332+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RASTERIZER_DESC2>>();
13331333
bytes_read += wrapper->rasterizer_desc2->Decode(buffer2, buffer_size2);
13341334
value->pDesc = wrapper->rasterizer_desc2->GetPointer();
13351335
break;
13361336
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL:
1337-
wrapper->depth_stencil_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC>>();
1337+
wrapper->depth_stencil_desc =
1338+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC>>();
13381339
bytes_read += wrapper->depth_stencil_desc->Decode(buffer2, buffer_size2);
13391340
value->pDesc = wrapper->depth_stencil_desc->GetPointer();
13401341
break;
13411342
case D3D12_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT:
1342-
wrapper->input_layout_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_INPUT_LAYOUT_DESC>>();
1343+
wrapper->input_layout_desc =
1344+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_INPUT_LAYOUT_DESC>>();
13431345
bytes_read += wrapper->input_layout_desc->Decode(buffer2, buffer_size2);
13441346
value->pDesc = wrapper->input_layout_desc->GetPointer();
13451347
break;
@@ -1358,8 +1360,7 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
13581360
reinterpret_cast<D3D12_PRIMITIVE_TOPOLOGY_TYPE*>(const_cast<void*>(value->pDesc)));
13591361
break;
13601362
case D3D12_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS:
1361-
wrapper->rt_format_array =
1362-
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RT_FORMAT_ARRAY>>();
1363+
wrapper->rt_format_array = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_RT_FORMAT_ARRAY>>();
13631364
bytes_read += wrapper->rt_format_array->Decode(buffer2, buffer_size2);
13641365
value->pDesc = wrapper->rt_format_array->GetPointer();
13651366
break;
@@ -1383,22 +1384,26 @@ size_t DecodeStruct(const uint8_t* buffer, size_t buffer_size, Decoded_D3D12_STA
13831384
reinterpret_cast<D3D12_PIPELINE_STATE_FLAGS*>(const_cast<void*>(value->pDesc)));
13841385
break;
13851386
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1:
1386-
wrapper->depth_stencil_desc1 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC1>>();
1387+
wrapper->depth_stencil_desc1 =
1388+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC1>>();
13871389
bytes_read += wrapper->depth_stencil_desc1->Decode(buffer2, buffer_size2);
13881390
value->pDesc = wrapper->depth_stencil_desc1->GetPointer();
13891391
break;
13901392
case D3D12_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING:
1391-
wrapper->view_instancing_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_VIEW_INSTANCING_DESC>>();
1393+
wrapper->view_instancing_desc =
1394+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_VIEW_INSTANCING_DESC>>();
13921395
bytes_read += wrapper->view_instancing_desc->Decode(buffer2, buffer_size2);
13931396
value->pDesc = wrapper->view_instancing_desc->GetPointer();
13941397
break;
13951398
case D3D12_STATE_SUBOBJECT_TYPE_GENERIC_PROGRAM:
1396-
wrapper->generic_program_desc = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_GENERIC_PROGRAM_DESC>>();
1399+
wrapper->generic_program_desc =
1400+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_GENERIC_PROGRAM_DESC>>();
13971401
bytes_read += wrapper->generic_program_desc->Decode(buffer2, buffer_size2);
13981402
value->pDesc = wrapper->generic_program_desc->GetPointer();
13991403
break;
14001404
case D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2:
1401-
wrapper->depth_stencil_desc2 = DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC2>>();
1405+
wrapper->depth_stencil_desc2 =
1406+
DecodeAllocator::Allocate<StructPointerDecoder<Decoded_D3D12_DEPTH_STENCIL_DESC2>>();
14021407
bytes_read += wrapper->depth_stencil_desc2->Decode(buffer2, buffer_size2);
14031408
value->pDesc = wrapper->depth_stencil_desc2->GetPointer();
14041409
break;

framework/decode/dx12_dump_resources.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,15 +2430,15 @@ void DefaultDx12DumpResourcesDelegate::WriteSingleData(const std::vector<std::pa
24302430
const std::string& key,
24312431
uint64_t value)
24322432
{
2433-
auto* jdata_node = FindDrawCallJsonNode(json_path);
2433+
auto* jdata_node = FindDrawCallJsonNode(json_path);
24342434
(*jdata_node)[key] = value;
24352435
}
24362436

24372437
void DefaultDx12DumpResourcesDelegate::WriteSingleData(const std::vector<std::pair<std::string, int32_t>>& json_path,
24382438
const uint32_t index,
24392439
uint64_t value)
24402440
{
2441-
auto* jdata_node = FindDrawCallJsonNode(json_path);
2441+
auto* jdata_node = FindDrawCallJsonNode(json_path);
24422442
(*jdata_node)[index] = value;
24432443
}
24442444

@@ -2498,7 +2498,7 @@ void DefaultDx12DumpResourcesDelegate::WriteRootParameterInfo(
24982498
uint32_t root_parameter_index,
24992499
const TrackRootParameter& root_parameter)
25002500
{
2501-
auto* jdata_node = FindDrawCallJsonNode(json_path);
2501+
auto* jdata_node = FindDrawCallJsonNode(json_path);
25022502
(*jdata_node)["root_parameter_index"] = root_parameter_index;
25032503
(*jdata_node)["root_signature_type"] = root_parameter.root_signature_type;
25042504
(*jdata_node)["cmd_bind_type"] = root_parameter.cmd_bind_type;

framework/decode/dx12_json_consumer_base.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool Dx12JsonConsumerBase::IsValid() const
5959
void Dx12JsonConsumerBase::ProcessCreateHeapAllocationCommand(uint64_t allocation_id, uint64_t allocation_size)
6060
{
6161
writer_->SetCurrentBlockIndex(block_index_);
62-
auto& jdata = writer_->WriteMetaCommandStart("CreateHeapAllocationCommand");
62+
auto& jdata = writer_->WriteMetaCommandStart("CreateHeapAllocationCommand");
6363
jdata["allocation_id"] = allocation_id;
6464
jdata["allocation_size"] = allocation_size;
6565
writer_->WriteBlockEnd();
@@ -69,7 +69,7 @@ void Dx12JsonConsumerBase::ProcessInitSubresourceCommand(const format::InitSubre
6969
const uint8_t* data)
7070
{
7171
writer_->SetCurrentBlockIndex(block_index_);
72-
auto& jdata = writer_->WriteMetaCommandStart("InitSubresourceCommand");
72+
auto& jdata = writer_->WriteMetaCommandStart("InitSubresourceCommand");
7373
jdata["thread_id"] = command_header.thread_id;
7474
jdata["device_id"] = command_header.device_id;
7575
jdata["resource_id"] = command_header.resource_id;
@@ -95,7 +95,7 @@ void Dx12JsonConsumerBase::ProcessInitDx12AccelerationStructureCommand(
9595
using util::FieldToJson;
9696

9797
writer_->SetCurrentBlockIndex(block_index_);
98-
auto& jdata = writer_->WriteMetaCommandStart("InitDx12AccelerationStructureCommand");
98+
auto& jdata = writer_->WriteMetaCommandStart("InitDx12AccelerationStructureCommand");
9999
jdata["thread_id"] = command_header.thread_id;
100100
// The GPU address D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC.DestAccelerationStructureData
101101
// is mapped from this during replay but we'll just dump the raw capture file value:
@@ -123,7 +123,7 @@ void Dx12JsonConsumerBase::ProcessFillMemoryResourceValueCommand(
123123
const format::FillMemoryResourceValueCommandHeader& command_header, const uint8_t* data)
124124
{
125125
writer_->SetCurrentBlockIndex(block_index_);
126-
auto& jdata = writer_->WriteMetaCommandStart("FillMemoryResourceValueCommand");
126+
auto& jdata = writer_->WriteMetaCommandStart("FillMemoryResourceValueCommand");
127127
jdata["thread_id"] = command_header.thread_id;
128128
jdata["resource_value_count"] = command_header.resource_value_count;
129129
// There are two blocks of values in data so we need to add together their sizes to know how big the blob to dump
@@ -142,7 +142,7 @@ void Dx12JsonConsumerBase::ProcessFillMemoryResourceValueCommand(
142142
void Dx12JsonConsumerBase::ProcessDxgiAdapterInfo(const format::DxgiAdapterInfoCommandHeader& adapter_info_header)
143143
{
144144
writer_->SetCurrentBlockIndex(block_index_);
145-
auto& jdata = writer_->WriteMetaCommandStart("DxgiAdapterInfo");
145+
auto& jdata = writer_->WriteMetaCommandStart("DxgiAdapterInfo");
146146
jdata["thread_id"] = adapter_info_header.thread_id;
147147
FieldToJson(jdata["adapter_desc"], adapter_info_header.adapter_desc);
148148
writer_->WriteBlockEnd();

framework/decode/dx12_replay_consumer_base.h

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
7373
void SetAgsMarkerInjector(AGSContext* ags_context = nullptr);
7474
#endif
7575

76-
void SetFatalErrorHandler(std::function<void(const char*)> handler) { fatal_error_handler_ = handler; }
76+
void SetFatalErrorHandler(std::function<void(const char*)> handler)
77+
{
78+
fatal_error_handler_ = handler;
79+
}
7780

78-
void SetFpsInfo(graphics::FpsInfo* fps_info) { fps_info_ = fps_info; }
81+
void SetFpsInfo(graphics::FpsInfo* fps_info)
82+
{
83+
fps_info_ = fps_info;
84+
}
7985

8086
void PostReplay();
8187

@@ -308,7 +314,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
308314

309315
IDXGIAdapter* GetAdapter();
310316

311-
graphics::dx12::ActiveAdapterMap& GetAdaptersMap() { return adapters_; }
317+
graphics::dx12::ActiveAdapterMap& GetAdaptersMap()
318+
{
319+
return adapters_;
320+
}
312321

313322
protected:
314323
void MapGpuDescriptorHandle(D3D12_GPU_DESCRIPTOR_HANDLE& handle);
@@ -558,7 +567,7 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
558567
D3D12_RENDER_PASS_FLAGS Flags);
559568

560569
template <typename T>
561-
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, T* desc_src) {};
570+
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, T* desc_src){};
562571

563572
template <>
564573
void SetResourceSamplerFeedbackMipRegion(D3D12_RESOURCE_DESC1& desc_dest, D3D12_RESOURCE_DESC1* desc_src)
@@ -1090,9 +1099,15 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
10901099
PointerDecoder<uint8_t>* parameters_data,
10911100
SIZE_T parameters_data_sizeinbytes);
10921101

1093-
const Dx12ObjectInfoTable& GetObjectInfoTable() const { return object_info_table_; }
1102+
const Dx12ObjectInfoTable& GetObjectInfoTable() const
1103+
{
1104+
return object_info_table_;
1105+
}
10941106

1095-
Dx12ObjectInfoTable& GetObjectInfoTable() { return object_info_table_; }
1107+
Dx12ObjectInfoTable& GetObjectInfoTable()
1108+
{
1109+
return object_info_table_;
1110+
}
10961111

10971112
DxObjectInfo* GetObjectInfo(format::HandleId id)
10981113
{
@@ -1105,13 +1120,25 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
11051120
return nullptr;
11061121
}
11071122

1108-
const Dx12DescriptorMap& GetDescriptorMap() const { return descriptor_map_; }
1123+
const Dx12DescriptorMap& GetDescriptorMap() const
1124+
{
1125+
return descriptor_map_;
1126+
}
11091127

1110-
Dx12DescriptorMap& GetDescriptorMap() { return descriptor_map_; }
1128+
Dx12DescriptorMap& GetDescriptorMap()
1129+
{
1130+
return descriptor_map_;
1131+
}
11111132

1112-
const graphics::Dx12GpuVaMap& GetGpuVaTable() const { return gpu_va_map_; }
1133+
const graphics::Dx12GpuVaMap& GetGpuVaTable() const
1134+
{
1135+
return gpu_va_map_;
1136+
}
11131137

1114-
graphics::Dx12GpuVaMap& GetGpuVaTable() { return gpu_va_map_; }
1138+
graphics::Dx12GpuVaMap& GetGpuVaTable()
1139+
{
1140+
return gpu_va_map_;
1141+
}
11151142

11161143
void ReplaceWindowedResolution(uint32_t& width, uint32_t& height)
11171144
{
@@ -1131,7 +1158,10 @@ class Dx12ReplayConsumerBase : public Dx12Consumer
11311158
}
11321159
}
11331160

1134-
Dx12ResourceValueMapper* GetResourceValueMapper() { return resource_value_mapper_.get(); }
1161+
Dx12ResourceValueMapper* GetResourceValueMapper()
1162+
{
1163+
return resource_value_mapper_.get();
1164+
}
11351165

11361166
template <typename CountT>
11371167
void SetOutputArrayCount(format::HandleId object_id, VariableLengthArrayIndices index, CountT count)

framework/decode/dx12_stats_consumer.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Dx12StatsConsumer : public Dx12Consumer
122122
InsertAdapter(new_adapter, gfxr_cmd_adapters_);
123123
format::HandleId object_id = graphics::dx12::ExtractAdapterCaptureId(new_adapter.extra_info);
124124

125-
const int64_t luid = pack_luid(new_adapter);
125+
const int64_t luid = pack_luid(new_adapter);
126126
adapter_submission_mapping_.adapter_to_luid_map[object_id] = luid;
127127
}
128128

@@ -185,10 +185,7 @@ class Dx12StatsConsumer : public Dx12Consumer
185185
return std::to_string(swapchain_width_) + 'x' + std::to_string(swapchain_height_);
186186
}
187187

188-
std::pair<UINT, UINT> GetSwapchainDimensions()
189-
{
190-
return {swapchain_width_, swapchain_height_};
191-
}
188+
std::pair<UINT, UINT> GetSwapchainDimensions() { return { swapchain_width_, swapchain_height_ }; }
192189

193190
virtual void Process_IDXGIFactory_CreateSwapChain(const ApiCallInfo& call_info,
194191
format::HandleId object_id,

framework/encode/dx12_object_wrapper_info.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ struct AccelerationStructureBuildTrackingObjects
318318
graphics::dx12::ID3D12ResourceComPtr _resource,
319319
graphics::dx12::ID3D12CommandAllocatorComPtr _post_build_copy_cmd_allocator,
320320
graphics::dx12::ID3D12GraphicsCommandList4ComPtr _post_build_copy_cmd_list) :
321-
resource(_resource), post_build_copy_cmd_allocator(_post_build_copy_cmd_allocator),
321+
resource(_resource),
322+
post_build_copy_cmd_allocator(_post_build_copy_cmd_allocator),
322323
post_build_copy_cmd_list(_post_build_copy_cmd_list)
323324
{}
324325

framework/encode/dx12_state_writer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Dx12StateWriter::Dx12StateWriter(util::FileOutputStream* output_stream,
3838
util::Compressor* compressor,
3939
format::ThreadId thread_id,
4040
util::FileOutputStream* asset_file_stream) :
41-
output_stream_(output_stream), compressor_(compressor), thread_id_(thread_id), encoder_(&parameter_stream_)
41+
output_stream_(output_stream),
42+
compressor_(compressor), thread_id_(thread_id), encoder_(&parameter_stream_)
4243
{
4344
assert(output_stream != nullptr);
4445
}

framework/generated/dx12_generators/dx12_struct_decoders_to_json_body_generator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ def makeUnionFieldToJson(self, properties, struct_name, union_index):
515515
case D3D_ROOT_SIGNATURE_VERSION_1_2:
516516
{
517517
FieldToJson(jdata["Desc_1_2"], meta_struct.Desc_1_2);
518-
GFXRECON_LOG_ERROR("Unknown D3D_ROOT_SIGNATURE_VERSION_1_2 in D3D12_VERSIONED_ROOT_SIGNATURE_DESC.");
519518
break;
520519
}
521520
default:

framework/generated/generated_dx12_struct_decoders_to_json.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,6 @@ void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_D3D12_VERSIONED_RO
25192519
case D3D_ROOT_SIGNATURE_VERSION_1_2:
25202520
{
25212521
FieldToJson(jdata["Desc_1_2"], meta_struct.Desc_1_2);
2522-
GFXRECON_LOG_ERROR("Unknown D3D_ROOT_SIGNATURE_VERSION_1_2 in D3D12_VERSIONED_ROOT_SIGNATURE_DESC.");
25232522
break;
25242523
}
25252524
default:

0 commit comments

Comments
 (0)