From 3c98bc5eca726a1fbe0e3a73613e94fc41d05c92 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sun, 8 Jun 2025 15:54:10 +0800 Subject: [PATCH] [Improvement] (ProgramState): Remove useless programObj.attribBindings. --- MG/MG_GL/State/Program/ProgramState.cpp | 8 +++----- MG/MG_GL/State/Program/ProgramState.h | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/MG/MG_GL/State/Program/ProgramState.cpp b/MG/MG_GL/State/Program/ProgramState.cpp index fed6fb58..2acb3158 100644 --- a/MG/MG_GL/State/Program/ProgramState.cpp +++ b/MG/MG_GL/State/Program/ProgramState.cpp @@ -118,10 +118,8 @@ GLenum ProgramState::FinalizeProgramPipeline(GLuint program) { MG_Util::Debug::LogE("MG_State: Program: FinalizeProgramPipeline error: %s", prog.infoLog.c_str()); return GL_INVALID_OPERATION; } - - for (auto& [name, index] : prog.attribBindings) { - prog.attribLocations[name] = index; - } + + // TODO: Support explicitly assign attrib locations in the shaders. prog.linked = {UncertainBool::Unknown, UncertainBool::True}; prog.linkStatus = GL_TRUE; @@ -159,7 +157,7 @@ GLenum ProgramState::DefineProgramAttributeBinding(GLuint program, GLuint index, return GL_INVALID_VALUE; } - programs_[program].attribBindings[name] = index; + programs_[program].attribLocations[name] = index; MG_Util::Debug::LogD("MG_State: Program: DefineProgramAttributeBinding success: %s -> %u", name, index); return GL_NO_ERROR; } diff --git a/MG/MG_GL/State/Program/ProgramState.h b/MG/MG_GL/State/Program/ProgramState.h index 62eb0371..5e1fd5b9 100644 --- a/MG/MG_GL/State/Program/ProgramState.h +++ b/MG/MG_GL/State/Program/ProgramState.h @@ -42,7 +42,6 @@ struct ProgramObject { bool dirty; GLint linkStatus; std::string infoLog; - MG_Global::unordered_map attribBindings; MG_Global::unordered_map attribLocations; MG_Global::unordered_map uniformLocations; MG_Global::unordered_map uniformValues;