mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Fix] (MG_Impl): silently ignore program and shader name zero on delete
glDeleteProgram and glDeleteShader are the two entry points in the program/shader name space where 0 is not "a name GL never handed out" but an explicit no-op: "if program is zero, it is silently ignored" (GL 4.6 core 7.3, and 7.1 for shaders). Both went through the shared name validator instead and recorded GL_INVALID_VALUE. Only tests that never got as far as creating a program noticed, because they still run their cleanup path: the five KHR-GL40.texture_gather.*-cube-array cases bail out of Init with "GL_ARB_texture_cube_map_array not supported", then Cleanup deletes its zero-initialised handles and the leftover error fails the case after the fact - the downstream-error-misattribution shape. Every array-taking delete already skipped 0.
This commit is contained in:
@@ -325,11 +325,16 @@ namespace MobileGL::MG_Impl::GLImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeleteProgram_State(GLuint program) {
|
void DeleteProgram_State(GLuint program) {
|
||||||
|
// "If program is zero, it is silently ignored" (GL 4.6 core 7.3) - unlike every
|
||||||
|
// other program entry point, where 0 is a name GL never handed out.
|
||||||
|
if (program == 0) return;
|
||||||
if (!CheckProgramNameValidity(program)) return;
|
if (!CheckProgramNameValidity(program)) return;
|
||||||
MG_State::pGLContext->MarkProgramForDeletion(program);
|
MG_State::pGLContext->MarkProgramForDeletion(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteShader_State(GLuint shader) {
|
void DeleteShader_State(GLuint shader) {
|
||||||
|
// Same silent-zero rule as glDeleteProgram (GL 4.6 core 7.1).
|
||||||
|
if (shader == 0) return;
|
||||||
if (!CheckShaderNameValidity(shader)) return;
|
if (!CheckShaderNameValidity(shader)) return;
|
||||||
MG_State::pGLContext->MarkShaderForDeletion(shader);
|
MG_State::pGLContext->MarkShaderForDeletion(shader);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user