mesa: fix glShaderSource() error handling
Section 7.1 (SHADER OBJECTS) of the OpenGL 4.6 spec says: "An INVALID_VALUE error is generated if count is negative." However a count of 0 is not an error. Previously it would cause a GL_OUT_OF_MEMORY error. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10477>
This commit is contained in:
committed by
Marge Bot
parent
58f843a193
commit
60fa555e61
@@ -2050,7 +2050,7 @@ shader_source(struct gl_context *ctx, GLuint shaderObj, GLsizei count,
|
||||
if (!sh)
|
||||
return;
|
||||
|
||||
if (string == NULL) {
|
||||
if (string == NULL || count < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
|
||||
return;
|
||||
}
|
||||
@@ -2058,6 +2058,10 @@ shader_source(struct gl_context *ctx, GLuint shaderObj, GLsizei count,
|
||||
sh = _mesa_lookup_shader(ctx, shaderObj);
|
||||
}
|
||||
|
||||
/* Return silently the spec doesn't define this as an error */
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* This array holds offsets of where the appropriate string ends, thus the
|
||||
* last element will be set to the total length of the source code.
|
||||
|
||||
Reference in New Issue
Block a user