From 6059045c59b9aca6232f0e2580582f5673e0e74a Mon Sep 17 00:00:00 2001 From: cristian64 Date: Sat, 18 Apr 2026 10:23:55 +0100 Subject: Core: Address `-Wrange-loop-construct` warning. The warning can be seen since 1f72403ec7ac026ff when GCC 13.3.0 is used: ```counterexample [1540/1898] Building CXX object Source/Core/VideoCommon/CMakeFiles/videocommon.dir/TextureCacheBase.cpp.o /w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp: In member function 'void TextureCacheBase::ApplyMaterialToCacheEntry(const VideoCommon::MaterialResource&, TCacheEntry*)': /w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp:3136:19: warning: loop variable 'texture' creates a copy from type 'const VideoCommon::MaterialResource::TextureLikeReference' [-Wrange-loop-construct] 3136 | for (const auto texture : material_data->GetTextures()) | ^~~~~~~ /w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp:3136:19: note: use reference type to prevent copying 3136 | for (const auto texture : material_data->GetTextures()) | ^~~~~~~ | & ``` --- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 6fc13c5fba..952e4dee67 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -3133,7 +3133,7 @@ void TextureCacheBase::ApplyMaterialToCacheEntry(const VideoCommon::MaterialReso g_gfx->SetTexture(0, entry->texture.get()); g_gfx->SetSamplerState(0, RenderState::GetPointSamplerState()); - for (const auto texture : material_data->GetTextures()) + for (const auto& texture : material_data->GetTextures()) { g_gfx->SetTexture(texture.sampler_index, texture.texture); g_gfx->SetSamplerState(texture.sampler_index, texture.sampler); -- cgit v1.2.3