[Fix] (MG_State/GLState): ignore inactive frag data bindings [skip ci]

This commit is contained in:
2026-07-02 12:51:51 +08:00
parent 3c643d943a
commit e4957e089a
@@ -585,9 +585,16 @@ namespace MobileGL::MG_State::GLState {
} }
Int ProgramObject::GetFragmentDataLocation(const char* name) { Int ProgramObject::GetFragmentDataLocation(const char* name) {
// TODO: should retrieve "post-mortem" location from glslang instead if (!m_program || !name) return -1;
auto it = m_explicitFragDataLocation.find(name);
if (it == m_explicitFragDataLocation.end()) return -1; const auto explicitLocation = m_explicitFragDataLocation.find(name);
return (Int)it->second; const Int outputCount = m_program->getNumPipeOutputs();
for (Int index = 0; index < outputCount; ++index) {
const auto& output = m_program->getPipeOutput(index);
if (output.name != name) continue;
if (explicitLocation != m_explicitFragDataLocation.end()) return static_cast<Int>(explicitLocation->second);
return static_cast<Int>(output.layoutLocation());
}
return -1;
} }
} // namespace MobileGL::MG_State::GLState } // namespace MobileGL::MG_State::GLState