Skip to content

Commit d5d93ca

Browse files
committed
Remove extra decltype(auto)
1 parent f1ead19 commit d5d93ca

File tree

16 files changed

+105
-109
lines changed

16 files changed

+105
-109
lines changed

src/FlyCube/BindingSet/VKBindingSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const std::vector<vk::DescriptorSet>& VKBindingSet::GetDescriptorSets() const
7474

7575
void VKBindingSet::WriteDescriptor(std::vector<vk::WriteDescriptorSet>& descriptors, const BindingDesc& binding)
7676
{
77-
decltype(auto) vk_view = CastToImpl<VKView>(binding.view);
77+
auto* vk_view = CastToImpl<VKView>(binding.view);
7878
vk::WriteDescriptorSet descriptor = vk_view->GetDescriptor();
7979
descriptor.descriptorType = GetDescriptorType(binding.bind_key.view_type);
8080
descriptor.dstSet = descriptor_sets_[binding.bind_key.space];

src/FlyCube/CommandList/DXCommandList.cpp

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ D3D12_GPU_VIRTUAL_ADDRESS GetVirtualAddress(const RayTracingShaderTable& table)
2727
if (!table.resource) {
2828
return 0;
2929
}
30-
decltype(auto) dx_resource = CastToImpl<DXResource>(table.resource);
30+
auto* dx_resource = CastToImpl<DXResource>(table.resource);
3131
return dx_resource->GetResource()->GetGPUVirtualAddress() + table.offset;
3232
}
3333

@@ -116,7 +116,7 @@ void DXCommandList::BindPipeline(const std::shared_ptr<Pipeline>& pipeline)
116116
command_list_->SetComputeRootSignature(state_->pipeline->GetRootSignature().Get());
117117
auto type = state_->pipeline->GetPipelineType();
118118
if (type == PipelineType::kGraphics) {
119-
decltype(auto) dx_pipeline = CastToImpl<DXGraphicsPipeline>(state_->pipeline);
119+
auto* dx_pipeline = CastToImpl<DXGraphicsPipeline>(state_->pipeline);
120120
command_list_->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
121121
command_list_->SetGraphicsRootSignature(dx_pipeline->GetRootSignature().Get());
122122
command_list_->SetPipelineState(dx_pipeline->GetPipeline().Get());
@@ -130,10 +130,10 @@ void DXCommandList::BindPipeline(const std::shared_ptr<Pipeline>& pipeline)
130130
}
131131
}
132132
} else if (type == PipelineType::kCompute) {
133-
decltype(auto) dx_pipeline = CastToImpl<DXComputePipeline>(pipeline);
133+
auto* dx_pipeline = CastToImpl<DXComputePipeline>(pipeline);
134134
command_list_->SetPipelineState(dx_pipeline->GetPipeline().Get());
135135
} else if (type == PipelineType::kRayTracing) {
136-
decltype(auto) dx_pipeline = CastToImpl<DXRayTracingPipeline>(pipeline);
136+
auto* dx_pipeline = CastToImpl<DXRayTracingPipeline>(pipeline);
137137
command_list4_->SetPipelineState1(dx_pipeline->GetPipeline().Get());
138138
}
139139
}
@@ -143,7 +143,7 @@ void DXCommandList::BindBindingSet(const std::shared_ptr<BindingSet>& binding_se
143143
if (binding_set == state_->binding_set) {
144144
return;
145145
}
146-
decltype(auto) dx_binding_set = CastToImpl<DXBindingSet>(binding_set);
146+
auto* dx_binding_set = CastToImpl<DXBindingSet>(binding_set);
147147
decltype(auto) new_heaps = dx_binding_set->Apply(command_list_);
148148
heaps_.insert(heaps_.end(), new_heaps.begin(), new_heaps.end());
149149
state_->binding_set = binding_set;
@@ -155,7 +155,7 @@ void DXCommandList::BeginRenderPass(const RenderPassDesc& render_pass_desc)
155155
if (!view) {
156156
return D3D12_CPU_DESCRIPTOR_HANDLE{};
157157
}
158-
decltype(auto) dx_view = CastToImpl<DXView>(view);
158+
auto* dx_view = CastToImpl<DXView>(view);
159159
return dx_view->GetHandle();
160160
};
161161

@@ -198,8 +198,7 @@ void DXCommandList::BeginRenderPass(const RenderPassDesc& render_pass_desc)
198198
}
199199

200200
if (render_pass_desc.shading_rate_image_view) {
201-
decltype(auto) dx_shading_rate_image =
202-
CastToImpl<DXResource>(render_pass_desc.shading_rate_image_view->GetResource());
201+
auto* dx_shading_rate_image = CastToImpl<DXResource>(render_pass_desc.shading_rate_image_view->GetResource());
203202
command_list5_->RSSetShadingRateImage(dx_shading_rate_image->GetResource());
204203
} else {
205204
command_list5_->RSSetShadingRateImage(nullptr);
@@ -252,7 +251,7 @@ void DXCommandList::ExecuteIndirect(D3D12_INDIRECT_ARGUMENT_TYPE type,
252251
uint32_t max_draw_count,
253252
uint32_t stride)
254253
{
255-
decltype(auto) dx_argument_buffer = CastToImpl<DXResource>(argument_buffer);
254+
auto* dx_argument_buffer = CastToImpl<DXResource>(argument_buffer);
256255
ID3D12Resource* dx_count_buffer = nullptr;
257256
if (count_buffer) {
258257
dx_count_buffer = CastToImpl<DXResource>(count_buffer)->GetResource();
@@ -359,7 +358,7 @@ void DXCommandList::ResourceBarrier(const std::vector<ResourceBarrierDesc>& barr
359358
continue;
360359
}
361360

362-
decltype(auto) dx_resource = CastToImpl<DXResource>(barrier.resource);
361+
auto* dx_resource = CastToImpl<DXResource>(barrier.resource);
363362
D3D12_RESOURCE_STATES dx_state_before = ConvertState(barrier.state_before);
364363
D3D12_RESOURCE_STATES dx_state_after = ConvertState(barrier.state_after);
365364
if (dx_state_before == dx_state_after) {
@@ -393,7 +392,7 @@ void DXCommandList::UAVResourceBarrier(const std::shared_ptr<Resource>& resource
393392
D3D12_RESOURCE_BARRIER uav_barrier = {};
394393
uav_barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
395394
if (resource) {
396-
decltype(auto) dx_resource = CastToImpl<DXResource>(resource);
395+
auto* dx_resource = CastToImpl<DXResource>(resource);
397396
uav_barrier.UAV.pResource = dx_resource->GetResource();
398397
}
399398
command_list_->ResourceBarrier(1, &uav_barrier);
@@ -423,7 +422,7 @@ void DXCommandList::SetScissorRect(uint32_t left, uint32_t top, uint32_t right,
423422
void DXCommandList::IASetIndexBuffer(const std::shared_ptr<Resource>& resource, uint64_t offset, gli::format format)
424423
{
425424
DXGI_FORMAT dx_format = static_cast<DXGI_FORMAT>(gli::dx().translate(format).DXGIFormat.DDS);
426-
decltype(auto) dx_resource = CastToImpl<DXResource>(resource);
425+
auto* dx_resource = CastToImpl<DXResource>(resource);
427426
D3D12_INDEX_BUFFER_VIEW index_buffer_view = {
428427
.BufferLocation = dx_resource->GetResource()->GetGPUVirtualAddress() + offset,
429428
.SizeInBytes = static_cast<uint32_t>(dx_resource->GetResourceDesc().Width - offset),
@@ -435,7 +434,7 @@ void DXCommandList::IASetIndexBuffer(const std::shared_ptr<Resource>& resource,
435434
void DXCommandList::IASetVertexBuffer(uint32_t slot, const std::shared_ptr<Resource>& resource, uint64_t offset)
436435
{
437436
if (state_->pipeline && state_->pipeline->GetPipelineType() == PipelineType::kGraphics) {
438-
decltype(auto) dx_pipeline = CastToImpl<DXGraphicsPipeline>(state_->pipeline);
437+
auto* dx_pipeline = CastToImpl<DXGraphicsPipeline>(state_->pipeline);
439438
auto& strides = dx_pipeline->GetStrideMap();
440439
auto it = strides.find(slot);
441440
if (it != strides.end()) {
@@ -458,7 +457,7 @@ void DXCommandList::IASetVertexBufferImpl(uint32_t slot,
458457
return;
459458
}
460459

461-
decltype(auto) dx_resource = CastToImpl<DXResource>(resource);
460+
auto* dx_resource = CastToImpl<DXResource>(resource);
462461
D3D12_VERTEX_BUFFER_VIEW vertex_buffer_view = {
463462
.BufferLocation = dx_resource->GetResource()->GetGPUVirtualAddress() + offset,
464463
.SizeInBytes = static_cast<uint32_t>(dx_resource->GetResourceDesc().Width - offset),
@@ -495,13 +494,13 @@ void DXCommandList::BuildAccelerationStructure(D3D12_BUILD_RAYTRACING_ACCELERATI
495494
const std::shared_ptr<Resource>& scratch,
496495
uint64_t scratch_offset)
497496
{
498-
decltype(auto) dx_dst = CastToImpl<DXResource>(dst);
499-
decltype(auto) dx_scratch = CastToImpl<DXResource>(scratch);
497+
auto* dx_dst = CastToImpl<DXResource>(dst);
498+
auto* dx_scratch = CastToImpl<DXResource>(scratch);
500499

501500
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC acceleration_structure_desc = {};
502501
acceleration_structure_desc.Inputs = inputs;
503502
if (src) {
504-
decltype(auto) dx_src = CastToImpl<DXResource>(src);
503+
auto* dx_src = CastToImpl<DXResource>(src);
505504
acceleration_structure_desc.SourceAccelerationStructureData = dx_src->GetAccelerationStructureAddress();
506505
acceleration_structure_desc.Inputs.Flags |= D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE;
507506
}
@@ -540,7 +539,7 @@ void DXCommandList::BuildTopLevelAS(const std::shared_ptr<Resource>& src,
540539
uint32_t instance_count,
541540
BuildAccelerationStructureFlags flags)
542541
{
543-
decltype(auto) dx_instance_data = CastToImpl<DXResource>(instance_data);
542+
auto* dx_instance_data = CastToImpl<DXResource>(instance_data);
544543
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS inputs = {};
545544
inputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL;
546545
inputs.Flags = Convert(flags);
@@ -554,8 +553,8 @@ void DXCommandList::CopyAccelerationStructure(const std::shared_ptr<Resource>& s
554553
const std::shared_ptr<Resource>& dst,
555554
CopyAccelerationStructureMode mode)
556555
{
557-
decltype(auto) dx_src = CastToImpl<DXResource>(src);
558-
decltype(auto) dx_dst = CastToImpl<DXResource>(dst);
556+
auto* dx_src = CastToImpl<DXResource>(src);
557+
auto* dx_dst = CastToImpl<DXResource>(dst);
559558
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE dx_mode = {};
560559
switch (mode) {
561560
case CopyAccelerationStructureMode::kClone:
@@ -575,8 +574,8 @@ void DXCommandList::CopyBuffer(const std::shared_ptr<Resource>& src_buffer,
575574
const std::shared_ptr<Resource>& dst_buffer,
576575
const std::vector<BufferCopyRegion>& regions)
577576
{
578-
decltype(auto) dx_src_buffer = CastToImpl<DXResource>(src_buffer);
579-
decltype(auto) dx_dst_buffer = CastToImpl<DXResource>(dst_buffer);
577+
auto* dx_src_buffer = CastToImpl<DXResource>(src_buffer);
578+
auto* dx_dst_buffer = CastToImpl<DXResource>(dst_buffer);
580579
for (const auto& region : regions) {
581580
command_list_->CopyBufferRegion(dx_dst_buffer->GetResource(), region.dst_offset, dx_src_buffer->GetResource(),
582581
region.src_offset, region.num_bytes);
@@ -602,8 +601,8 @@ void DXCommandList::CopyBufferTextureImpl(bool buffer_src,
602601
const std::shared_ptr<Resource>& texture,
603602
const std::vector<BufferTextureCopyRegion>& regions)
604603
{
605-
decltype(auto) dx_buffer = CastToImpl<DXResource>(buffer);
606-
decltype(auto) dx_texture = CastToImpl<DXResource>(texture);
604+
auto* dx_buffer = CastToImpl<DXResource>(buffer);
605+
auto* dx_texture = CastToImpl<DXResource>(texture);
607606
auto format = texture->GetFormat();
608607
DXGI_FORMAT dx_format = static_cast<DXGI_FORMAT>(gli::dx().translate(format).DXGIFormat.DDS);
609608
for (const auto& region : regions) {
@@ -646,8 +645,8 @@ void DXCommandList::CopyTexture(const std::shared_ptr<Resource>& src_texture,
646645
const std::shared_ptr<Resource>& dst_texture,
647646
const std::vector<TextureCopyRegion>& regions)
648647
{
649-
decltype(auto) dx_src_texture = CastToImpl<DXResource>(src_texture);
650-
decltype(auto) dx_dst_texture = CastToImpl<DXResource>(dst_texture);
648+
auto* dx_src_texture = CastToImpl<DXResource>(src_texture);
649+
auto* dx_dst_texture = CastToImpl<DXResource>(dst_texture);
651650
for (const auto& region : regions) {
652651
D3D12_TEXTURE_COPY_LOCATION dst = {};
653652
dst.pResource = dx_dst_texture->GetResource();
@@ -678,7 +677,7 @@ void DXCommandList::WriteAccelerationStructuresProperties(
678677
uint32_t first_query)
679678
{
680679
assert(query_heap->GetType() == QueryHeapType::kAccelerationStructureCompactedSize);
681-
decltype(auto) dx_query_heap = CastToImpl<DXRayTracingQueryHeap>(query_heap);
680+
auto* dx_query_heap = CastToImpl<DXRayTracingQueryHeap>(query_heap);
682681
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC desc = {};
683682
desc.InfoType = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE;
684683
desc.DestBuffer = dx_query_heap->GetResource()->GetGPUVirtualAddress() + first_query * sizeof(uint64_t);
@@ -699,8 +698,8 @@ void DXCommandList::ResolveQueryData(const std::shared_ptr<QueryHeap>& query_hea
699698
uint64_t dst_offset)
700699
{
701700
assert(query_heap->GetType() == QueryHeapType::kAccelerationStructureCompactedSize);
702-
decltype(auto) dx_query_heap = CastToImpl<DXRayTracingQueryHeap>(query_heap);
703-
decltype(auto) dx_dst_buffer = CastToImpl<DXResource>(dst_buffer);
701+
auto* dx_query_heap = CastToImpl<DXRayTracingQueryHeap>(query_heap);
702+
auto* dx_dst_buffer = CastToImpl<DXResource>(dst_buffer);
704703
auto common_to_copy_barrier = CD3DX12_RESOURCE_BARRIER::Transition(
705704
dx_query_heap->GetResource(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_COPY_SOURCE, 0);
706705
command_list_->ResourceBarrier(1, &common_to_copy_barrier);

0 commit comments

Comments
 (0)