Skip to content

Commit 8175e80

Browse files
FBOCache: don't use auto where unnecessary
1 parent fdda503 commit 8175e80

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp

Lines changed: 19 additions & 19 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");
@@ -94,7 +94,7 @@ FBOCache::~FBOCache()
9494
#ifdef DILIGENT_DEBUG
9595
for (const auto& fbo_it : m_Cache)
9696
{
97-
const auto& Key = fbo_it.first;
97+
const FBOCacheKey& Key = fbo_it.first;
9898
VERIFY(Key.NumRenderTargets == 0 && Key.DSId == 0, "Only framebuffers without attachments can be left in the cache");
9999
}
100100
#endif
@@ -105,7 +105,7 @@ void FBOCache::OnReleaseTexture(ITexture* pTexture)
105105
{
106106
Threading::SpinLockGuard CacheGuard{m_CacheLock};
107107

108-
auto* pTexGL = ClassPtrCast<TextureBaseGL>(pTexture);
108+
TextureBaseGL* pTexGL = ClassPtrCast<TextureBaseGL>(pTexture);
109109
// Find all FBOs that this texture used in
110110
auto EqualRange = m_TexIdToKey.equal_range(pTexGL->GetUniqueID());
111111
for (auto It = EqualRange.first; It != EqualRange.second; ++It)
@@ -137,25 +137,25 @@ GLObjectWrappers::GLFrameBufferObj FBOCache::CreateFBO(GLContextState& Contex
137137
// Initialize the FBO
138138
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
139139
{
140-
if (auto* pRTView = ppRTVs[rt])
140+
if (TextureViewGLImpl* pRTView = ppRTVs[rt])
141141
{
142-
const auto& RTVDesc = pRTView->GetDesc();
143-
auto* pColorTexGL = pRTView->GetTexture<TextureBaseGL>();
142+
const TextureViewDesc& RTVDesc = pRTView->GetDesc();
143+
TextureBaseGL* pColorTexGL = pRTView->GetTexture<TextureBaseGL>();
144144
pColorTexGL->AttachToFramebuffer(RTVDesc, GL_COLOR_ATTACHMENT0 + rt, TextureBaseGL::FRAMEBUFFER_TARGET_FLAG_READ_DRAW);
145145
}
146146
}
147147

148148
if (pDSV != nullptr)
149149
{
150-
const auto& DSVDesc = pDSV->GetDesc();
151-
auto* pDepthTexGL = pDSV->GetTexture<TextureBaseGL>();
152-
GLenum AttachmentPoint = 0;
150+
const TextureViewDesc& DSVDesc = pDSV->GetDesc();
151+
TextureBaseGL* pDepthTexGL = pDSV->GetTexture<TextureBaseGL>();
152+
GLenum AttachmentPoint = 0;
153153
if (DSVDesc.Format == TEX_FORMAT_D32_FLOAT ||
154154
DSVDesc.Format == TEX_FORMAT_D16_UNORM)
155155
{
156156
#ifdef DILIGENT_DEBUG
157157
{
158-
const auto GLTexFmt = pDepthTexGL->GetGLTexFormat();
158+
const GLenum GLTexFmt = pDepthTexGL->GetGLTexFormat();
159159
VERIFY(GLTexFmt == GL_DEPTH_COMPONENT32F || GLTexFmt == GL_DEPTH_COMPONENT16,
160160
"Inappropriate internal texture format (", GLTexFmt,
161161
") for depth attachment. GL_DEPTH_COMPONENT32F or GL_DEPTH_COMPONENT16 is expected");
@@ -168,7 +168,7 @@ GLObjectWrappers::GLFrameBufferObj FBOCache::CreateFBO(GLContextState& Contex
168168
{
169169
#ifdef DILIGENT_DEBUG
170170
{
171-
const auto GLTexFmt = pDepthTexGL->GetGLTexFormat();
171+
const GLenum GLTexFmt = pDepthTexGL->GetGLTexFormat();
172172
VERIFY(GLTexFmt == GL_DEPTH24_STENCIL8 || GLTexFmt == GL_DEPTH32F_STENCIL8,
173173
"Inappropriate internal texture format (", GLTexFmt,
174174
") for depth-stencil attachment. GL_DEPTH24_STENCIL8 or GL_DEPTH32F_STENCIL8 is expected");
@@ -269,11 +269,11 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu
269269
Key.NumRenderTargets = NumRenderTargets;
270270
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
271271
{
272-
auto* pRTView = ppRTVs[rt];
272+
TextureViewGLImpl* pRTView = ppRTVs[rt];
273273
if (pRTView == nullptr)
274274
continue;
275275

276-
auto* pColorTexGL = pRTView->GetTexture<TextureBaseGL>();
276+
TextureBaseGL* pColorTexGL = pRTView->GetTexture<TextureBaseGL>();
277277
pColorTexGL->TextureMemoryBarrier(
278278
MEMORY_BARRIER_FRAMEBUFFER, // Reads and writes via framebuffer object attachments after the
279279
// barrier will reflect data written by shaders prior to the barrier.
@@ -287,7 +287,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu
287287

288288
if (pDSV)
289289
{
290-
auto* pDepthTexGL = pDSV->GetTexture<TextureBaseGL>();
290+
TextureBaseGL* pDepthTexGL = pDSV->GetTexture<TextureBaseGL>();
291291
pDepthTexGL->TextureMemoryBarrier(MEMORY_BARRIER_FRAMEBUFFER, ContextState);
292292
Key.DSId = pDepthTexGL->GetUniqueID();
293293
Key.DSVDesc = pDSV->GetDesc();
@@ -301,7 +301,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu
301301
if (fbo_it == m_Cache.end())
302302
{
303303
// Create a new FBO
304-
auto NewFBO = CreateFBO(ContextState, NumRenderTargets, ppRTVs, pDSV);
304+
GLObjectWrappers::GLFrameBufferObj NewFBO = CreateFBO(ContextState, NumRenderTargets, ppRTVs, pDSV);
305305

306306
auto it_inserted = m_Cache.emplace(Key, std::move(NewFBO));
307307
// New FBO must be actually inserted
@@ -333,7 +333,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Width, Uint32
333333
if (fbo_it == m_Cache.end())
334334
{
335335
// Create a new FBO
336-
auto NewFBO = CreateFBO(ContextState, 0, nullptr, nullptr, Width, Height);
336+
GLObjectWrappers::GLFrameBufferObj NewFBO = CreateFBO(ContextState, 0, nullptr, nullptr, Width, Height);
337337

338338
auto it_inserted = m_Cache.emplace(Key, std::move(NewFBO));
339339
// New FBO must be actually inserted
@@ -345,7 +345,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Width, Uint32
345345

346346
inline GLenum GetFramebufferAttachmentPoint(TEXTURE_FORMAT Format)
347347
{
348-
const auto& FmtAttribs = GetTextureFormatAttribs(Format);
348+
const TextureFormatAttribs& FmtAttribs = GetTextureFormatAttribs(Format);
349349
switch (FmtAttribs.ComponentType)
350350
{
351351
case COMPONENT_TYPE_DEPTH:
@@ -362,13 +362,13 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(TextureBaseGL*
362362
Uint32 MipLevel,
363363
TextureBaseGL::FRAMEBUFFER_TARGET_FLAGS Targets)
364364
{
365-
const auto& TexDesc = pTex->GetDesc();
365+
const TextureDesc& TexDesc = pTex->GetDesc();
366366

367367
FBOCacheKey Key;
368368
Key.NumRenderTargets = 1;
369369
Key.RTIds[0] = pTex->GetUniqueID();
370370

371-
auto& RTV0{Key.RTVDescs[0]};
371+
TextureViewDesc& RTV0{Key.RTVDescs[0]};
372372
RTV0.Format = TexDesc.Format;
373373
RTV0.TextureDim = TexDesc.Type;
374374
RTV0.ViewType = (Targets & TextureBaseGL::FRAMEBUFFER_TARGET_FLAG_DRAW) ?

0 commit comments

Comments
 (0)