Skip to content

Commit a6ae3cc

Browse files
GraphicsEngineGL: don't use auto where unnecessary
1 parent 200a58d commit a6ae3cc

27 files changed

+406
-407
lines changed

Graphics/GraphicsEngineOpenGL/include/GLProgramCache.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-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.
@@ -82,7 +82,7 @@ class GLProgramCache
8282
bool IsSeparableProgram = false;
8383

8484
std::vector<UniqueIdentifier> ShaderUIDs;
85-
std::vector<UniqueIdentifier> SignaturUIDs;
85+
std::vector<UniqueIdentifier> SignatureUIDs;
8686

8787
PipelineResourceLayoutDescX ResourceLayout;
8888
};

Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void BufferGLImpl::UpdateData(GLContextState& CtxState, Uint64 Offset, Uint64 Si
224224
CtxState);
225225

226226
// We must unbind VAO because otherwise we will break the bindings
227-
const auto ResetVAO = m_BindTarget == GL_ARRAY_BUFFER || m_BindTarget == GL_ELEMENT_ARRAY_BUFFER;
227+
const bool ResetVAO = m_BindTarget == GL_ARRAY_BUFFER || m_BindTarget == GL_ELEMENT_ARRAY_BUFFER;
228228
CtxState.BindBuffer(m_BindTarget, m_GlBuffer, ResetVAO);
229229
// All buffer bind targets (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER etc.) relate to the same
230230
// kind of objects. As a result they are all equivalent from a transfer point of view.
@@ -379,7 +379,7 @@ void BufferGLImpl::Unmap(GLContextState& CtxState)
379379
{
380380
constexpr bool ResetVAO = true;
381381
CtxState.BindBuffer(m_BindTarget, m_GlBuffer, ResetVAO);
382-
auto Result = glUnmapBuffer(m_BindTarget);
382+
GLboolean Result = glUnmapBuffer(m_BindTarget);
383383
// glUnmapBuffer() returns TRUE unless data values in the buffer's data store have
384384
// become corrupted during the period that the buffer was mapped. Such corruption
385385
// can be the result of a screen resolution change or other window system - dependent
@@ -404,17 +404,17 @@ void BufferGLImpl::CreateViewInternal(const BufferViewDesc& OrigViewDesc, IBuffe
404404

405405
try
406406
{
407-
auto* const pDeviceGLImpl = GetDevice();
407+
RenderDeviceGLImpl* const pDeviceGLImpl = GetDevice();
408408

409-
auto ViewDesc = OrigViewDesc;
409+
BufferViewDesc ViewDesc = OrigViewDesc;
410410
ValidateAndCorrectBufferViewDesc(m_Desc, ViewDesc, pDeviceGLImpl->GetAdapterInfo().Buffer.StructuredBufferOffsetAlignment);
411411

412-
auto& BuffViewAllocator = pDeviceGLImpl->GetBuffViewObjAllocator();
412+
FixedBlockMemoryAllocator& BuffViewAllocator = pDeviceGLImpl->GetBuffViewObjAllocator();
413413
VERIFY(&BuffViewAllocator == &m_dbgBuffViewAllocator, "Buff view allocator does not match allocator provided at buffer initialization");
414414

415-
auto pContext = pDeviceGLImpl->GetImmediateContext(0);
415+
RefCntAutoPtr<DeviceContextGLImpl> pContext = pDeviceGLImpl->GetImmediateContext(0);
416416
VERIFY(pContext, "Immediate context has been released");
417-
auto& CtxState = pContext->GetContextState();
417+
GLContextState& CtxState = pContext->GetContextState();
418418

419419
*ppView = NEW_RC_OBJ(BuffViewAllocator, "BufferViewGLImpl instance", BufferViewGLImpl, bIsDefaultView ? this : nullptr)(pDeviceGLImpl, CtxState, ViewDesc, this, bIsDefaultView);
420420

@@ -423,7 +423,7 @@ void BufferGLImpl::CreateViewInternal(const BufferViewDesc& OrigViewDesc, IBuffe
423423
}
424424
catch (const std::runtime_error&)
425425
{
426-
const auto* ViewTypeName = GetBufferViewTypeLiteralName(OrigViewDesc.ViewType);
426+
const char* ViewTypeName = GetBufferViewTypeLiteralName(OrigViewDesc.ViewType);
427427
LOG_ERROR("Failed to create view '", (OrigViewDesc.Name ? OrigViewDesc.Name : ""), "' (", ViewTypeName, ") for buffer '", (m_Desc.Name ? m_Desc.Name : ""), "'");
428428
}
429429
}

Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp

Lines changed: 4 additions & 4 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");
@@ -55,7 +55,7 @@ BufferViewGLImpl::BufferViewGLImpl(IReferenceCounters* pRefCounters,
5555
m_GLTexBuffer{false}
5656
// clang-format on
5757
{
58-
const auto& BuffDesc = pBuffer->GetDesc();
58+
const BufferDesc& BuffDesc = pBuffer->GetDesc();
5959
if ((ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE || ViewDesc.ViewType == BUFFER_VIEW_UNORDERED_ACCESS) &&
6060
(BuffDesc.Mode == BUFFER_MODE_FORMATTED || BuffDesc.Mode == BUFFER_MODE_RAW))
6161
{
@@ -71,8 +71,8 @@ BufferViewGLImpl::BufferViewGLImpl(IReferenceCounters* pRefCounters,
7171
m_GLTexBuffer.Create();
7272
CtxState.BindTexture(-1, GL_TEXTURE_BUFFER, m_GLTexBuffer);
7373

74-
const auto& BuffFmt = ViewDesc.Format;
75-
GLenum GLFormat = 0;
74+
const BufferFormat& BuffFmt = ViewDesc.Format;
75+
GLenum GLFormat = 0;
7676
if (BuffDesc.Mode == BUFFER_MODE_FORMATTED || BuffFmt.ValueType != VT_UNDEFINED)
7777
{
7878
GLFormat = TypeToGLTexFormat(BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized);

Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp

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
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -64,7 +64,7 @@ Uint64 FenceGLImpl::GetCompletedValue()
6464
{
6565
auto& val_fence = m_PendingFences.front();
6666

67-
auto res =
67+
GLenum res =
6868
glClientWaitSync(val_fence.second,
6969
0, // Can be SYNC_FLUSH_COMMANDS_BIT
7070
0 // Timeout in nanoseconds
@@ -91,7 +91,7 @@ void FenceGLImpl::HostWait(Uint64 Value, bool FlushCommands)
9191
if (val_fence.first > Value)
9292
break;
9393

94-
auto res = glClientWaitSync(val_fence.second, FlushCommands ? GL_SYNC_FLUSH_COMMANDS_BIT : 0, std::numeric_limits<GLuint64>::max());
94+
GLenum res = glClientWaitSync(val_fence.second, FlushCommands ? GL_SYNC_FLUSH_COMMANDS_BIT : 0, std::numeric_limits<GLuint64>::max());
9595
VERIFY_EXPR(res == GL_ALREADY_SIGNALED || res == GL_CONDITION_SATISFIED);
9696
(void)res;
9797

Graphics/GraphicsEngineOpenGL/src/FramebufferGLImpl.cpp

Lines changed: 14 additions & 14 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
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -86,47 +86,47 @@ FramebufferGLImpl::FramebufferGLImpl(IReferenceCounters* pRefCounters,
8686
GLContextState& CtxState) :
8787
TFramebufferBase{pRefCounters, pDevice, Desc}
8888
{
89-
const auto& RPDesc = m_Desc.pRenderPass->GetDesc();
89+
const RenderPassDesc& RPDesc = m_Desc.pRenderPass->GetDesc();
9090
m_SubpassFramebuffers.reserve(RPDesc.SubpassCount);
9191
for (Uint32 subpass = 0; subpass < RPDesc.SubpassCount; ++subpass)
9292
{
93-
const auto& SubpassDesc = RPDesc.pSubpasses[subpass];
93+
const SubpassDesc& SPDesc = RPDesc.pSubpasses[subpass];
9494

9595
TextureViewGLImpl* ppRTVs[MAX_RENDER_TARGETS] = {};
9696
TextureViewGLImpl* pDSV = nullptr;
9797

98-
for (Uint32 rt = 0; rt < SubpassDesc.RenderTargetAttachmentCount; ++rt)
98+
for (Uint32 rt = 0; rt < SPDesc.RenderTargetAttachmentCount; ++rt)
9999
{
100-
const auto& RTAttachmentRef = SubpassDesc.pRenderTargetAttachments[rt];
100+
const AttachmentReference& RTAttachmentRef = SPDesc.pRenderTargetAttachments[rt];
101101
if (RTAttachmentRef.AttachmentIndex != ATTACHMENT_UNUSED)
102102
{
103103
ppRTVs[rt] = ClassPtrCast<TextureViewGLImpl>(m_Desc.ppAttachments[RTAttachmentRef.AttachmentIndex]);
104104
}
105105
}
106106

107-
if (SubpassDesc.pDepthStencilAttachment != nullptr && SubpassDesc.pDepthStencilAttachment->AttachmentIndex != ATTACHMENT_UNUSED)
107+
if (SPDesc.pDepthStencilAttachment != nullptr && SPDesc.pDepthStencilAttachment->AttachmentIndex != ATTACHMENT_UNUSED)
108108
{
109-
pDSV = ClassPtrCast<TextureViewGLImpl>(m_Desc.ppAttachments[SubpassDesc.pDepthStencilAttachment->AttachmentIndex]);
109+
pDSV = ClassPtrCast<TextureViewGLImpl>(m_Desc.ppAttachments[SPDesc.pDepthStencilAttachment->AttachmentIndex]);
110110
}
111-
auto RenderTargetFBO = UseDefaultFBO(SubpassDesc.RenderTargetAttachmentCount, ppRTVs, pDSV) ?
111+
GLObjectWrappers::GLFrameBufferObj RenderTargetFBO = UseDefaultFBO(SPDesc.RenderTargetAttachmentCount, ppRTVs, pDSV) ?
112112
GLObjectWrappers::GLFrameBufferObj{false} :
113-
FBOCache::CreateFBO(CtxState, SubpassDesc.RenderTargetAttachmentCount, ppRTVs, pDSV, Desc.Width, Desc.Height);
113+
FBOCache::CreateFBO(CtxState, SPDesc.RenderTargetAttachmentCount, ppRTVs, pDSV, Desc.Width, Desc.Height);
114114

115115
GLObjectWrappers::GLFrameBufferObj ResolveFBO{false};
116-
if (SubpassDesc.pResolveAttachments != nullptr)
116+
if (SPDesc.pResolveAttachments != nullptr)
117117
{
118118
TextureViewGLImpl* ppRsvlViews[MAX_RENDER_TARGETS] = {};
119-
for (Uint32 rt = 0; rt < SubpassDesc.RenderTargetAttachmentCount; ++rt)
119+
for (Uint32 rt = 0; rt < SPDesc.RenderTargetAttachmentCount; ++rt)
120120
{
121-
const auto& RslvAttachmentRef = SubpassDesc.pResolveAttachments[rt];
121+
const AttachmentReference& RslvAttachmentRef = SPDesc.pResolveAttachments[rt];
122122
if (RslvAttachmentRef.AttachmentIndex != ATTACHMENT_UNUSED)
123123
{
124124
ppRsvlViews[rt] = ClassPtrCast<TextureViewGLImpl>(m_Desc.ppAttachments[RslvAttachmentRef.AttachmentIndex]);
125125
}
126126
}
127-
ResolveFBO = UseDefaultFBO(SubpassDesc.RenderTargetAttachmentCount, ppRsvlViews, nullptr) ?
127+
ResolveFBO = UseDefaultFBO(SPDesc.RenderTargetAttachmentCount, ppRsvlViews, nullptr) ?
128128
GLObjectWrappers::GLFrameBufferObj{false} :
129-
FBOCache::CreateFBO(CtxState, SubpassDesc.RenderTargetAttachmentCount, ppRsvlViews, nullptr, Desc.Width, Desc.Height);
129+
FBOCache::CreateFBO(CtxState, SPDesc.RenderTargetAttachmentCount, ppRsvlViews, nullptr, Desc.Width, Desc.Height);
130130
}
131131

132132
RenderTargetFBO.SetName(m_Desc.Name);

Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp

Lines changed: 4 additions & 4 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");
@@ -70,7 +70,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs,
7070
pfd.iPixelType = PFD_TYPE_RGBA;
7171
if (pSCDesc != nullptr)
7272
{
73-
auto ColorFmt = pSCDesc->ColorBufferFormat;
73+
TEXTURE_FORMAT ColorFmt = pSCDesc->ColorBufferFormat;
7474
if (ColorFmt == TEX_FORMAT_RGBA8_UNORM || ColorFmt == TEX_FORMAT_RGBA8_UNORM_SRGB ||
7575
ColorFmt == TEX_FORMAT_BGRA8_UNORM || ColorFmt == TEX_FORMAT_BGRA8_UNORM_SRGB)
7676
{
@@ -83,7 +83,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs,
8383
pfd.cColorBits = 32;
8484
}
8585

86-
auto DepthFmt = pSCDesc->DepthBufferFormat;
86+
TEXTURE_FORMAT DepthFmt = pSCDesc->DepthBufferFormat;
8787
switch (DepthFmt)
8888
{
8989
case TEX_FORMAT_UNKNOWN:
@@ -191,7 +191,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs,
191191
}
192192
else
193193
{
194-
auto CurrentCtx = wglGetCurrentContext();
194+
HGLRC CurrentCtx = wglGetCurrentContext();
195195
if (CurrentCtx == 0)
196196
{
197197
LOG_ERROR_AND_THROW("No current GL context found! Provide non-null handle to a native Window to create a GL context");

Graphics/GraphicsEngineOpenGL/src/GLProgram.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-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.
@@ -49,7 +49,7 @@ GLProgram::GLProgram(ShaderGLImpl* const* ppShaders,
4949

5050
for (Uint32 i = 0; i < NumShaders; ++i)
5151
{
52-
auto* pCurrShader = ppShaders[i];
52+
ShaderGLImpl* pCurrShader = ppShaders[i];
5353
glAttachShader(m_GLProg, pCurrShader->GetGLShaderHandle());
5454
DEV_CHECK_GL_ERROR("glAttachShader() failed");
5555
}

Graphics/GraphicsEngineOpenGL/src/GLProgramCache.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-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.
@@ -51,21 +51,21 @@ GLProgramCache::ProgramCacheKey::ProgramCacheKey(const GetProgramAttribs& Attrib
5151
ShaderUIDs.reserve(Attribs.NumShaders);
5252
for (Uint32 i = 0; i < Attribs.NumShaders; ++i)
5353
{
54-
auto ShaderUID = Attribs.ppShaders[i]->GetUniqueID();
54+
Int32 ShaderUID = Attribs.ppShaders[i]->GetUniqueID();
5555
HashCombine(Hash, ShaderUID);
5656
ShaderUIDs.push_back(ShaderUID);
5757
}
5858

5959
if (Attribs.NumSignatures != 0)
6060
{
61-
SignaturUIDs.reserve(Attribs.NumSignatures);
61+
SignatureUIDs.reserve(Attribs.NumSignatures);
6262
for (Uint32 i = 0; i < Attribs.NumSignatures; ++i)
6363
{
6464
if (PipelineResourceSignatureGLImpl* pSignature = ClassPtrCast<PipelineResourceSignatureGLImpl>(Attribs.ppSignatures[i]))
6565
{
66-
auto SignaturUID = pSignature->GetUniqueID();
67-
HashCombine(Hash, SignaturUID);
68-
SignaturUIDs.push_back(SignaturUID);
66+
Int32 SignatureUID = pSignature->GetUniqueID();
67+
HashCombine(Hash, SignatureUID);
68+
SignatureUIDs.push_back(SignatureUID);
6969
}
7070
}
7171
}
@@ -83,8 +83,8 @@ bool GLProgramCache::ProgramCacheKey::operator==(const ProgramCacheKey& Key) con
8383
return (Hash == Key.Hash &&
8484
IsSeparableProgram == Key.IsSeparableProgram &&
8585
ShaderUIDs == Key.ShaderUIDs &&
86-
SignaturUIDs == Key.SignaturUIDs &&
87-
(!SignaturUIDs.empty() || ResourceLayout == Key.ResourceLayout));
86+
SignatureUIDs == Key.SignatureUIDs &&
87+
(!SignatureUIDs.empty() || ResourceLayout == Key.ResourceLayout));
8888
// clang-format on
8989
}
9090

@@ -122,7 +122,7 @@ GLProgramCache::SharedGLProgramObjPtr GLProgramCache::GetProgram(const GetProgra
122122

123123
auto it_inserted = m_Cache.emplace(Key, NewProgram);
124124
// Check if the proram is valid
125-
if (auto Program = it_inserted.first->second.lock())
125+
if (SharedGLProgramObjPtr Program = it_inserted.first->second.lock())
126126
{
127127
return Program;
128128
}

Graphics/GraphicsEngineOpenGL/src/GLTypeConversions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ GLenum TexFormatToGLInternalTexFormat(TEXTURE_FORMAT TexFormat, Uint32 BindFlags
195195
static const FormatToGLInternalTexFormatMap FormatMap;
196196
if (TexFormat >= TEX_FORMAT_UNKNOWN && TexFormat < TEX_FORMAT_NUM_FORMATS)
197197
{
198-
auto GLFormat = FormatMap[TexFormat];
198+
GLenum GLFormat = FormatMap[TexFormat];
199199
if (BindFlags != 0)
200200
GLFormat = CorrectGLTexFormat(GLFormat, BindFlags);
201201
return GLFormat;
@@ -217,7 +217,7 @@ class InternalTexFormatToTexFormatMap
217217
{
218218
for (TEXTURE_FORMAT TexFmt = TEX_FORMAT_UNKNOWN; TexFmt < TEX_FORMAT_NUM_FORMATS; TexFmt = static_cast<TEXTURE_FORMAT>(static_cast<int>(TexFmt) + 1))
219219
{
220-
auto ComponentType = GetTextureFormatAttribs(TexFmt).ComponentType;
220+
COMPONENT_TYPE ComponentType = GetTextureFormatAttribs(TexFmt).ComponentType;
221221
if (ComponentType == COMPONENT_TYPE_UNDEFINED ||
222222
ComponentType == COMPONENT_TYPE_DEPTH_STENCIL || // Skip depth-stencil
223223
TexFmt == TEX_FORMAT_RGB10A2_TYPELESS || // and typeless formats
@@ -235,7 +235,7 @@ class InternalTexFormatToTexFormatMap
235235
continue;
236236
}
237237

238-
auto GlTexFormat = TexFormatToGLInternalTexFormat(TexFmt);
238+
GLenum GlTexFormat = TexFormatToGLInternalTexFormat(TexFmt);
239239
if (GlTexFormat != 0)
240240
{
241241
VERIFY_EXPR(m_FormatMap.find(GlTexFormat) == m_FormatMap.end());
@@ -745,7 +745,7 @@ SHADER_TYPE GLShaderBitsToShaderTypes(GLenum ShaderBits)
745745
SHADER_TYPE Result = SHADER_TYPE_UNKNOWN;
746746
while (ShaderBits != 0)
747747
{
748-
auto Type = ExtractLSB(ShaderBits);
748+
GLenum Type = ExtractLSB(ShaderBits);
749749
switch (Type)
750750
{
751751
// clang-format off
@@ -766,7 +766,7 @@ WAVE_FEATURE GLSubgroupFeatureBitsToWaveFeatures(GLenum FeatureBits)
766766
WAVE_FEATURE Result = WAVE_FEATURE_UNKNOWN;
767767
while (FeatureBits != 0)
768768
{
769-
auto Feature = ExtractLSB(FeatureBits);
769+
GLenum Feature = ExtractLSB(FeatureBits);
770770
switch (Feature)
771771
{
772772
// clang-format off

0 commit comments

Comments
 (0)