mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[Fix] (MG_Impl): report INVALID_OPERATION for shader names in program APIs
Program entry points answered GL_INVALID_VALUE whenever the name did not resolve to a program, including names that exist but belong to a shader object. Programs and shaders share one name space, so the spec (and KHR-GL33.get_uniform_tests.get_uniform) requires GL_INVALID_OPERATION for the shader-name case and GL_INVALID_VALUE only for names GL never handed out, matching the interface-query helper's existing behavior.
This commit is contained in:
@@ -49,10 +49,18 @@ namespace MobileGL::MG_Impl::GLImpl {
|
|||||||
|
|
||||||
static bool CheckProgramNameValidity(GLuint program) {
|
static bool CheckProgramNameValidity(GLuint program) {
|
||||||
if (!MG_State::pGLContext->ValidateProgramName(program)) {
|
if (!MG_State::pGLContext->ValidateProgramName(program)) {
|
||||||
|
// Programs and shaders share one name space: a name that exists but
|
||||||
|
// belongs to a shader is INVALID_OPERATION, a name GL never handed
|
||||||
|
// out is INVALID_VALUE (GL 3.3 core 2.11.x).
|
||||||
|
const ErrorCode error = MG_State::pGLContext->ValidateShaderName(program)
|
||||||
|
? ErrorCode::InvalidOperation
|
||||||
|
: ErrorCode::InvalidValue;
|
||||||
MG_State::pGLContext->RecordError(
|
MG_State::pGLContext->RecordError(
|
||||||
ErrorCode::InvalidValue,
|
error,
|
||||||
MakeUnique<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
|
MakeUnique<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
|
||||||
std::to_string(program) + " is not a valid name."));
|
std::to_string(program) +
|
||||||
|
(error == ErrorCode::InvalidOperation ? " is not a program object."
|
||||||
|
: " is not a valid name.")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user