[Feat] (MG_State/Program): glGetUniformLocation

This commit is contained in:
2025-08-13 23:32:33 +08:00
parent 5422dcf164
commit aa2aefac28
3 changed files with 10 additions and 3 deletions
@@ -15,6 +15,10 @@ namespace MobileGL {
void MarkAsDeleted();
Vector<SharedPtr<ShaderObject>>& GetAttachedShaders();
const String& GetInfoLog() const { return m_infoLog; }
Int GetUniformLocation(const String& name) {
const auto it = m_uniforms.find(name);
return (it == m_uniforms.end()) ? -1 : it->second;
}
private:
void PreLink();
void PostLink();
@@ -67,7 +67,7 @@ namespace MobileGL {
const String& GetShaderSource() const { return m_source; }
SharedPtr<glslang::TShader> GetCompiledShader() const { return m_shader; }
const String& GetInfoLog() const { return m_infoLog; }
const UnorderedMap<String, Uint> GetUniformLocations() const { return m_uniforms; }
const UnorderedMap<String, Uint>& GetUniformLocations() const { return m_uniforms; }
private:
bool DoReflection();
const Uint m_id = 0;