From c52e28cc7a119a12a14f146b761c3750223f5256 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 8 May 2025 20:36:03 +0800 Subject: [PATCH] [Fix] (TextureState): fix a horrible performance bug --- MG/MG_GL/State/Texture/TextureState.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MG/MG_GL/State/Texture/TextureState.cpp b/MG/MG_GL/State/Texture/TextureState.cpp index aae378ef..ba7fe964 100644 --- a/MG/MG_GL/State/Texture/TextureState.cpp +++ b/MG/MG_GL/State/Texture/TextureState.cpp @@ -963,7 +963,7 @@ GLenum TextureState::CheckUpdatingTextureRegion2DValidity_(GLenum target, GLint return GL_INVALID_OPERATION; } - auto tex = textures[boundTex]; + const auto& tex = textures[boundTex]; if (tex.IsImmutable()) { MG_Util::Debug::LogE("MG_State: Texture: CheckUpdatingTextureRegion2DValidity_ texture is immutable"); @@ -1002,7 +1002,7 @@ GLenum TextureState::CheckUpdatingTextureRegion2DValidity_(GLenum target, GLint return GL_INVALID_OPERATION; } - TextureParams::MipmapLevel& mip = mipIt->second; + const auto& mip = mipIt->second; if (xoffset + width > mip.width || yoffset + height > mip.height) { MG_Util::Debug::LogE("MG_State: Texture: CheckUpdatingTextureRegion2DValidity_ region out of bounds: " "x=%d+%d > %d or y=%d+%d > %d",