[Fix] (MG_State/Program): use vector to save uniforms instead

This commit is contained in:
2025-08-13 16:41:46 +08:00
parent d1942bc57d
commit bfb62872c9
3 changed files with 17 additions and 7 deletions
@@ -67,7 +67,12 @@ namespace MobileGL {
root->traverse(&traverser);
auto& symbols = traverser.GetCollectedSymbols();
for (const auto& symbol : symbols) {
m_uniforms[symbol->getName().c_str()] = symbol->getQualifier().layoutLocation;
auto layoutLoc = symbol->getQualifier().layoutLocation;
if (layoutLoc >= m_uniforms.size()) {
m_uniforms.reserve(std::bit_ceil(layoutLoc));
m_uniforms.resize(layoutLoc + 1);
}
m_uniforms[layoutLoc] = symbol->getName().c_str();
}
return true;
@@ -73,7 +73,7 @@ namespace MobileGL {
const ShaderStage m_stage;
String m_source;
SharedPtr<glslang::TShader> m_shader;
UnorderedMap<String, Int> m_uniforms;
Vector<String> m_uniforms;
String m_infoLog;
Bool m_deleteStatus = false;