[Chore] (MG_State/ProgramObject): rename attrib to vertex in for clarity

This commit is contained in:
2025-11-13 10:50:37 +08:00
parent d3ea83992c
commit b04481e6da
5 changed files with 14 additions and 14 deletions
@@ -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) {
@@ -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
@@ -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<SharedPtr<ShaderObject>>& GetAttachedShaders();
const String& GetInfoLog() const { return m_infoLog; }
@@ -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;
}
@@ -17,14 +17,14 @@ namespace MobileGL {
class TMglGlslIoResolver: public glslang::TDefaultGlslIoResolver {
public:
using ExplicitVarSlotMap = UnorderedMap<String, Uint>;
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;
};
}