[Fix] (MG_State/GL_Program): wrong guard condition in Uniformv_State

This commit is contained in:
2025-10-27 11:20:23 +08:00
parent 5e5d0f3dbe
commit 034aeb9b12
2 changed files with 4 additions and 2 deletions
@@ -473,7 +473,7 @@ namespace MobileGL {
return;
}
if (location >= programObject->GetUniformCount() || location < -1) {
if (location > programObject->GetMaxUniformLocation() || location < -1) {
MG_State::pGLContext->RecordError(
ErrorCode::InvalidOperation,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
@@ -25,7 +25,9 @@ namespace MobileGL {
Uint GetMaxUniformLocation() const { return m_maxUniformLocation; }
Int GetUniformLocation(const String& name) {
const auto it = m_uniformLocations.find(name);
return (it == m_uniformLocations.end()) ? -1 : (Int)it->second;
if (it == m_uniformLocations.end())
return -1;
return (Int)it->second;
}
GLenum GetUniformType(Uint index) const { return m_uniformTypes[index]; }