From b04481e6da3940d5799dbd678f969e111c48e3e0 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 13 Nov 2025 10:50:37 +0800 Subject: [PATCH] [Chore] (MG_State/ProgramObject): rename `attrib` to `vertex in` for clarity --- MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp | 2 +- .../MG_State/GLState/ProgramState/ProgramObject.cpp | 8 ++++---- .../MG_State/GLState/ProgramState/ProgramObject.h | 2 +- .../ShaderTranspiler/glslang/TMglGlslIoResolver.cpp | 4 ++-- .../ShaderTranspiler/glslang/TMglGlslIoResolver.h | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp b/MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp index afb209fd..9e25e62c 100644 --- a/MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp +++ b/MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp @@ -100,7 +100,7 @@ namespace MobileGL { if (!programObject) return; MGLOG_D("%s: loc %02d = \"%s\"", __func__, index, name); - programObject->SetExplicitAttribLocation(index, name); + programObject->SetExplicitVertexInLocation(index, name); } void CompileShader_State(GLuint shader) { diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp index 5f8ff4a7..0b035aa0 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp @@ -290,7 +290,7 @@ namespace MobileGL { // if (location < 0) continue; // if (location >= (int)m_attribs.size()) { // if (location >= maxAttribs) { - // MGLOG_W("ProgramObject %u: SetExplicitAttribLocation: requested location %d >= " + // MGLOG_W("ProgramObject %u: SetExplicitVertexInLocation: requested location %d >= " // "GL_MAX_VERTEX_ATTRIBS (%d). Ignored for attribute '%s'.", // m_externalIndex, location, maxAttribs, name.c_str()); // continue; @@ -465,11 +465,11 @@ namespace MobileGL { // will probably be useful when multi-threaded compilation } - void ProgramObject::SetExplicitAttribLocation(Uint index, const char* name) { - MGLOG_D("ProgramObject %u: SetExplicitAttribLocation called name='%s' index=%u", m_externalIndex, name, + void ProgramObject::SetExplicitVertexInLocation(Uint index, const char* name) { + MGLOG_D("ProgramObject %u: SetExplicitVertexInLocation called name='%s' index=%u", m_externalIndex, name, index); m_explicitAttribLocations[name] = index; - MGLOG_D("ProgramObject %u: SetExplicitAttribLocation - stored explicit location for '%s' -> %u", + MGLOG_D("ProgramObject %u: SetExplicitVertexInLocation - stored explicit location for '%s' -> %u", m_externalIndex, name, index); } } // namespace GLState diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h index 446d3db4..0d8474e1 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h @@ -17,7 +17,7 @@ namespace MobileGL { void Link(); void MarkAsDeleted(); - void SetExplicitAttribLocation(Uint index, const char* name); + void SetExplicitVertexInLocation(Uint index, const char* name); Vector>& GetAttachedShaders(); const String& GetInfoLog() const { return m_infoLog; } diff --git a/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.cpp b/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.cpp index 22fe187e..b32051f3 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.cpp +++ b/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.cpp @@ -9,8 +9,8 @@ namespace MobileGL { const glslang::TType& type = ent.symbol->getType(); const glslang::TString& name = ent.symbol->getAccessName(); if (currentStage == EShLangVertex && type.getQualifier().isPipeInput()) { - auto it = m_explicitAttribLocations.find(name.c_str()); - if (it != m_explicitAttribLocations.end()) { + auto it = m_explicitVertexIns.find(name.c_str()); + if (it != m_explicitVertexIns.end()) { auto& writableType = ent.symbol->getWritableType(); writableType.getQualifier().layoutLocation = it->second; } diff --git a/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.h b/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.h index 77f34baf..6642acf1 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.h +++ b/MobileGL/MG_Util/ShaderTranspiler/glslang/TMglGlslIoResolver.h @@ -17,14 +17,14 @@ namespace MobileGL { class TMglGlslIoResolver: public glslang::TDefaultGlslIoResolver { public: using ExplicitVarSlotMap = UnorderedMap; - TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& attribLocations): - TDefaultGlslIoResolver(intermediate), m_explicitAttribLocations(attribLocations) {} - TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage, const ExplicitVarSlotMap& attribLocations): - TDefaultGlslIoResolver(*program.getIntermediate(stage)), - m_explicitAttribLocations(attribLocations) {} + TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts): + TDefaultGlslIoResolver(intermediate), m_explicitVertexIns(vertexIns), m_explicitFragOuts(fragOuts) {} + TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts): + TMglGlslIoResolver(*program.getIntermediate(stage), vertexIns, fragOuts) {} void reserverStorageSlot(glslang::TVarEntryInfo& ent, TInfoSink& infoSink) override; protected: - const ExplicitVarSlotMap& m_explicitAttribLocations; + const ExplicitVarSlotMap& m_explicitVertexIns; + const ExplicitVarSlotMap& m_explicitFragOuts; }; }