mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_State/GLState): ignore inactive frag data bindings [skip ci]
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user