[Feat] (MG_State/Program): GetAttachedShaders

This commit is contained in:
2025-08-11 23:07:15 +08:00
parent 21a46ee151
commit 408b62a495
5 changed files with 29 additions and 4 deletions
+17 -1
View File
@@ -140,7 +140,23 @@ namespace MobileGL {
}
void GetAttachedShaders_State(GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders) {
THROW_UNIMPL_EXCEPTION;
if (maxCount < 0) {
MG_State::pGLContext->RecordError(
ErrorCode::InvalidValue,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
"`maxCount` is less than 0."));
return;
}
auto programObject = TryToGetProgramObject(program);
if (!programObject)
return;
const auto& s = programObject->GetAttachedShaders();
GLsizei c = std::min((GLsizei)s.size(), maxCount);
if (count)
*count = c;
for (GLsizei i = 0; i < c; ++i) {
shaders[i] = s[i]->GetId();
}
}
GLint GetAttribLocation_State(GLuint program, const GLchar* name) {