Skip to content

Commit 0125594

Browse files
Don't use auto where unnecessary in engine headers
1 parent 0aff5d9 commit 0125594

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+199
-200
lines changed

Graphics/Archiver/include/SerializedPipelineStateImpl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use file except in compliance with the License.
@@ -101,7 +101,7 @@ class SerializedPipelineStateImpl final : public ObjectBase<ISerializedPipelineS
101101
using DeviceType = DeviceObjectArchive::DeviceType;
102102
using TPRSNames = DeviceObjectArchive::TPRSNames;
103103

104-
static constexpr auto DeviceDataCount = static_cast<size_t>(DeviceType::Count);
104+
static constexpr size_t DeviceDataCount = static_cast<size_t>(DeviceType::Count);
105105

106106
struct Data
107107
{
@@ -140,7 +140,7 @@ class SerializedPipelineStateImpl final : public ObjectBase<ISerializedPipelineS
140140
static void GetRayTracingShaderMap(const std::vector<ShaderStage>& ShaderStages, RayTracingShaderMapType& ShaderMap)
141141
{
142142
Uint32 ShaderIndex = 0;
143-
for (const auto& Stage : ShaderStages)
143+
for (const ShaderStage& Stage : ShaderStages)
144144
{
145145
for (const auto* pShader : Stage.Serialized)
146146
{

Graphics/Archiver/include/SerializedResourceSignatureImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class SerializedResourceSignatureImpl final : public ObjectBase<IPipelineResourc
104104
template <typename SignatureType>
105105
SignatureType* GetDeviceSignature(DeviceType Type) const
106106
{
107-
constexpr auto TraitsType = SignatureTraits<SignatureType>::Type;
107+
constexpr DeviceType TraitsType = SignatureTraits<SignatureType>::Type;
108108
VERIFY_EXPR(Type == TraitsType || (Type == DeviceType::Metal_iOS && TraitsType == DeviceType::Metal_MacOS));
109109

110110
return ClassPtrCast<SignatureType>(GetDeviceSignature(Type));

Graphics/GraphicsAccessories/interface/ResourceReleaseQueue.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class ResourceReleaseQueue
339339
std::lock_guard<std::mutex> ReleaseQueueLock(m_ReleaseQueueMutex);
340340
while (!m_StaleResources.empty())
341341
{
342-
auto& FirstStaleObj = m_StaleResources.front();
342+
ReleaseQueueElemType& FirstStaleObj = m_StaleResources.front();
343343
if (FirstStaleObj.first <= SubmittedCmdBuffNumber)
344344
{
345345
m_ReleaseQueue.emplace_back(FenceValue, std::move(FirstStaleObj.second));
@@ -363,7 +363,7 @@ class ResourceReleaseQueue
363363
// See http://diligentgraphics.com/diligent-engine/architecture/d3d12/managing-resource-lifetimes/
364364
while (!m_ReleaseQueue.empty())
365365
{
366-
auto& FirstObj = m_ReleaseQueue.front();
366+
ReleaseQueueElemType& FirstObj = m_ReleaseQueue.front();
367367
if (FirstObj.first <= CompletedFenceValue)
368368
m_ReleaseQueue.pop_front();
369369
else

Graphics/GraphicsEngine/include/DeviceObjectArchive.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class DeviceObjectArchive
276276

277277
ResourceData& GetResourceData(ResourceType Type, const char* Name) noexcept
278278
{
279-
constexpr auto MakeCopy = true;
279+
constexpr bool MakeCopy = true;
280280
return m_NamedResources[NamedResourceKey{Type, Name, MakeCopy}];
281281
}
282282

@@ -285,7 +285,7 @@ class DeviceObjectArchive
285285
return m_DeviceShaders[static_cast<size_t>(Type)];
286286
}
287287

288-
const auto& GetSerializedShader(DeviceType Type, size_t Idx) const noexcept
288+
const SerializedData& GetSerializedShader(DeviceType Type, size_t Idx) const noexcept
289289
{
290290
const auto& DeviceShaders = m_DeviceShaders[static_cast<size_t>(Type)];
291291
if (Idx < DeviceShaders.size())

Graphics/GraphicsEngine/include/EngineFactoryBase.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -102,7 +102,7 @@ class EngineFactoryBase : public BaseInterface
102102

103103
virtual void DILIGENT_CALL_TYPE CreateDataBlob(size_t InitialSize, const void* pData, IDataBlob** ppDataBlob) const override final
104104
{
105-
if (auto pDataBlob = DataBlobImpl::Create(InitialSize, pData))
105+
if (RefCntAutoPtr<DataBlobImpl> pDataBlob = DataBlobImpl::Create(InitialSize, pData))
106106
pDataBlob->QueryInterface(IID_DataBlob, reinterpret_cast<IObject**>(ppDataBlob));
107107
}
108108

Graphics/GraphicsEngine/include/FenceBase.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class FenceBase : public DeviceObjectBase<typename EngineImplTraits::FenceInterf
9393
#ifdef DILIGENT_DEVELOPMENT
9494
if (!this->GetDevice()->GetFeatures().NativeFence)
9595
{
96-
auto EnqueuedValue = m_EnqueuedFenceValue.load();
96+
Uint64 EnqueuedValue = m_EnqueuedFenceValue.load();
9797
DEV_CHECK_ERR(Value <= EnqueuedValue,
9898
"Can not wait for value ", Value, " that is greater than the last enqueued for signal value (", EnqueuedValue,
9999
"). This is not supported when NativeFence feature is disabled.");
@@ -104,7 +104,7 @@ class FenceBase : public DeviceObjectBase<typename EngineImplTraits::FenceInterf
104104
protected:
105105
void UpdateLastCompletedFenceValue(Uint64 NewValue)
106106
{
107-
auto LastCompletedValue = m_LastCompletedFenceValue.load();
107+
Uint64 LastCompletedValue = m_LastCompletedFenceValue.load();
108108
while (!m_LastCompletedFenceValue.compare_exchange_weak(LastCompletedValue, std::max(LastCompletedValue, NewValue)))
109109
{
110110
// If exchange fails, LastCompletedValue will hold the actual value of m_LastCompletedFenceValue.

Graphics/GraphicsEngine/include/FramebufferBase.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -73,20 +73,20 @@ class FramebufferBase : public DeviceObjectBase<typename EngineImplTraits::Frame
7373
{
7474
for (Uint32 i = 0; i < this->m_Desc.AttachmentCount; ++i)
7575
{
76-
auto* const pAttachment = Desc.ppAttachments[i];
76+
ITextureView* const pAttachment = Desc.ppAttachments[i];
7777
if (pAttachment == nullptr)
7878
continue;
7979

80-
const auto& ViewDesc = pAttachment->GetDesc();
80+
const TextureViewDesc& ViewDesc = pAttachment->GetDesc();
8181
if (ViewDesc.ViewType == TEXTURE_VIEW_SHADING_RATE)
8282
{
8383
// Dimensions of the shading rate texture are less than the dimensions of other attachments
8484
// and can't be used to compute the frame buffer size.
8585
continue;
8686
}
8787

88-
const auto& TexDesc = pAttachment->GetTexture()->GetDesc();
89-
const auto MipLevelProps = GetMipLevelProperties(TexDesc, ViewDesc.MostDetailedMip);
88+
const TextureDesc& TexDesc = pAttachment->GetTexture()->GetDesc();
89+
const MipLevelProperties MipLevelProps = GetMipLevelProperties(TexDesc, ViewDesc.MostDetailedMip);
9090
if (this->m_Desc.Width == 0)
9191
this->m_Desc.Width = MipLevelProps.LogicalWidth;
9292
if (this->m_Desc.Height == 0)
@@ -128,12 +128,12 @@ class FramebufferBase : public DeviceObjectBase<typename EngineImplTraits::Frame
128128
const RenderPassDesc& RPDesc = this->m_Desc.pRenderPass->GetDesc();
129129
for (Uint32 subpass = 0; subpass < RPDesc.SubpassCount; ++subpass)
130130
{
131-
const auto& SubpassDesc = RPDesc.pSubpasses[subpass];
132-
if (SubpassDesc.pDepthStencilAttachment == nullptr)
131+
const SubpassDesc& Subpass = RPDesc.pSubpasses[subpass];
132+
if (Subpass.pDepthStencilAttachment == nullptr)
133133
continue;
134-
if (SubpassDesc.pDepthStencilAttachment->AttachmentIndex == ATTACHMENT_UNUSED)
134+
if (Subpass.pDepthStencilAttachment->AttachmentIndex == ATTACHMENT_UNUSED)
135135
continue;
136-
if (SubpassDesc.pDepthStencilAttachment->State != RESOURCE_STATE_DEPTH_READ)
136+
if (Subpass.pDepthStencilAttachment->State != RESOURCE_STATE_DEPTH_READ)
137137
continue;
138138

139139
if (m_ppReadOnlyDSVs == nullptr)
@@ -143,10 +143,10 @@ class FramebufferBase : public DeviceObjectBase<typename EngineImplTraits::Frame
143143
memset(m_ppReadOnlyDSVs, 0, sizeof(m_ppReadOnlyDSVs[0]) * RPDesc.SubpassCount);
144144
}
145145

146-
auto* pDepthAttachment = m_ppAttachments[SubpassDesc.pDepthStencilAttachment->AttachmentIndex];
146+
ITextureView* pDepthAttachment = m_ppAttachments[Subpass.pDepthStencilAttachment->AttachmentIndex];
147147
VERIFY_EXPR(pDepthAttachment != nullptr);
148148

149-
auto DSVDesc = pDepthAttachment->GetDesc();
149+
TextureViewDesc DSVDesc = pDepthAttachment->GetDesc();
150150
if (DSVDesc.ViewType == TEXTURE_VIEW_READ_ONLY_DEPTH_STENCIL)
151151
{
152152
m_ppReadOnlyDSVs[subpass] = pDepthAttachment;
@@ -180,7 +180,7 @@ class FramebufferBase : public DeviceObjectBase<typename EngineImplTraits::Frame
180180

181181
if (m_ppReadOnlyDSVs != nullptr)
182182
{
183-
const auto SubpassCount = this->m_Desc.pRenderPass->GetDesc().SubpassCount;
183+
const Uint32 SubpassCount = this->m_Desc.pRenderPass->GetDesc().SubpassCount;
184184
for (Uint32 i = 0; i < SubpassCount; ++i)
185185
{
186186
if (m_ppReadOnlyDSVs[i] != nullptr)

Graphics/GraphicsEngine/include/TopLevelASBase.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -121,9 +121,9 @@ class TopLevelASBase : public DeviceObjectBase<typename EngineImplTraits::TopLev
121121

122122
for (Uint32 i = 0; i < InstanceCount; ++i)
123123
{
124-
const auto& Inst = pInstances[i];
125-
const char* NameCopy = this->m_StringPool.CopyString(Inst.InstanceName);
126-
InstanceDesc Desc = {};
124+
const TLASBuildInstanceData& Inst = pInstances[i];
125+
const char* NameCopy = this->m_StringPool.CopyString(Inst.InstanceName);
126+
InstanceDesc Desc = {};
127127

128128
Desc.pBLAS = ClassPtrCast<BottomLevelASImplType>(Inst.pBLAS);
129129
Desc.ContributionToHitGroupIndex = Inst.ContributionToHitGroupIndex;
@@ -177,18 +177,18 @@ class TopLevelASBase : public DeviceObjectBase<typename EngineImplTraits::TopLev
177177

178178
for (Uint32 i = 0; i < InstanceCount; ++i)
179179
{
180-
const auto& Inst = pInstances[i];
181-
auto Iter = this->m_Instances.find(Inst.InstanceName);
180+
const TLASBuildInstanceData& Inst = pInstances[i];
181+
auto Iter = this->m_Instances.find(Inst.InstanceName);
182182

183183
if (Iter == this->m_Instances.end())
184184
{
185185
UNEXPECTED("Failed to find instance with name '", Inst.InstanceName, "' in instances from the previous build");
186186
return false;
187187
}
188188

189-
auto& Desc = Iter->second;
190-
const auto PrevIndex = Desc.ContributionToHitGroupIndex;
191-
const auto pPrevBLAS = Desc.pBLAS;
189+
InstanceDesc& Desc = Iter->second;
190+
const Uint32 PrevIndex = Desc.ContributionToHitGroupIndex;
191+
RefCntAutoPtr<BottomLevelASImplType> pPrevBLAS = Desc.pBLAS;
192192

193193
Desc.pBLAS = ClassPtrCast<BottomLevelASImplType>(Inst.pBLAS);
194194
Desc.ContributionToHitGroupIndex = Inst.ContributionToHitGroupIndex;
@@ -250,7 +250,7 @@ class TopLevelASBase : public DeviceObjectBase<typename EngineImplTraits::TopLev
250250
auto Iter = this->m_Instances.find(Name);
251251
if (Iter != this->m_Instances.end())
252252
{
253-
const auto& Inst = Iter->second;
253+
const InstanceDesc& Inst = Iter->second;
254254
Result.ContributionToHitGroupIndex = Inst.ContributionToHitGroupIndex;
255255
Result.InstanceIndex = Inst.InstanceIndex;
256256
Result.pBLAS = Inst.pBLAS;
@@ -364,7 +364,7 @@ class TopLevelASBase : public DeviceObjectBase<typename EngineImplTraits::TopLev
364364
Desc.ContributionToHitGroupIndex = InstanceOffset;
365365
switch (BindingMode)
366366
{
367-
// clang-format off
367+
// clang-format off
368368
case HIT_GROUP_BINDING_MODE_PER_GEOMETRY: InstanceOffset += Desc.pBLAS->GetActualGeometryCount() * HitGroupStride; break;
369369
case HIT_GROUP_BINDING_MODE_PER_INSTANCE: InstanceOffset += HitGroupStride; break;
370370
case HIT_GROUP_BINDING_MODE_PER_TLAS: /* InstanceOffset is constant */ break;

Graphics/GraphicsEngineD3D11/include/D3D11TileMappingHelper.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ struct D3D11TileMappingHelper : D3DTileMappingHelper<D3D11_TILED_RESOURCE_COORDI
112112
private:
113113
void Commit(ID3D11DeviceContext2* pd3d11DeviceContext2, ID3D11Resource* pResource)
114114
{
115-
auto* const pd3d11TilePool = pMemory != nullptr ? pMemory->GetD3D11TilePool() : nullptr;
115+
ID3D11Buffer* const pd3d11TilePool = pMemory != nullptr ? pMemory->GetD3D11TilePool() : nullptr;
116116

117117
#ifdef DILIGENT_ENABLE_D3D_NVAPI
118118
if (UseNVApi)
@@ -152,7 +152,7 @@ struct D3D11TileMappingHelper : D3DTileMappingHelper<D3D11_TILED_RESOURCE_COORDI
152152

153153
void SetMemory(IDeviceMemory* pNewMemory)
154154
{
155-
auto pNewMemD3D11 = RefCntAutoPtr<IDeviceMemoryD3D11>{pNewMemory, IID_DeviceMemoryD3D11};
155+
RefCntAutoPtr<IDeviceMemoryD3D11> pNewMemD3D11{pNewMemory, IID_DeviceMemoryD3D11};
156156
DEV_CHECK_ERR(pNewMemory == nullptr || pNewMemD3D11, "Failed to query IID_DeviceMemoryD3D11 interface");
157157
if (pMemory != nullptr && pNewMemD3D11 != nullptr && pMemory != pNewMemD3D11)
158158
{

Graphics/GraphicsEngineD3D11/include/EngineD3D11ImplTraits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -85,7 +85,7 @@ struct PipelineResourceSignatureInternalDataD3D11;
8585

8686
struct EngineD3D11ImplTraits
8787
{
88-
static constexpr auto DeviceType = RENDER_DEVICE_TYPE_D3D11;
88+
static constexpr RENDER_DEVICE_TYPE DeviceType = RENDER_DEVICE_TYPE_D3D11;
8989

9090
using RenderDeviceInterface = IRenderDeviceD3D11;
9191
using DeviceContextInterface = IDeviceContextD3D11;

0 commit comments

Comments
 (0)