mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
bufferobj: init the return value for GetParam functions
It's helping buggy applications that may use the returned
value without checking for an error first.
For instance, viewperf20/maya uses a sequence like this:
glGenBuffers(n = 1, buffers = &3458)
...
glGetNamedBufferParameteriv(3458, GL_BUFFER_SIZE, &p)
Since 3458 isn't associated to an object yet, _mesa_lookup_bufferobj_err
will return NULL, leaving 'p' with its original value.
It seems to randomly trigger an exit from the benchmark,
presumably because the content in 'p' is random (for instance
-1879044180).
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36190>
(cherry picked from commit d21c8e1bed)
This commit is contained in:
parent
53d5655bc1
commit
b5cfca7348
2 changed files with 11 additions and 1 deletions
|
|
@ -4394,7 +4394,7 @@
|
|||
"description": "bufferobj: init the return value for GetParam functions",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -3162,6 +3162,8 @@ _mesa_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
|
|||
struct gl_buffer_object *bufObj;
|
||||
GLint64 parameter;
|
||||
|
||||
*params = 0;
|
||||
|
||||
bufObj = get_buffer(ctx, "glGetBufferParameteriv", target,
|
||||
GL_INVALID_OPERATION);
|
||||
if (!bufObj)
|
||||
|
|
@ -3181,6 +3183,8 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
|
|||
struct gl_buffer_object *bufObj;
|
||||
GLint64 parameter;
|
||||
|
||||
*params = 0;
|
||||
|
||||
bufObj = get_buffer(ctx, "glGetBufferParameteri64v", target,
|
||||
GL_INVALID_OPERATION);
|
||||
if (!bufObj)
|
||||
|
|
@ -3200,6 +3204,8 @@ _mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
|
|||
struct gl_buffer_object *bufObj;
|
||||
GLint64 parameter;
|
||||
|
||||
*params = 0;
|
||||
|
||||
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
|
||||
"glGetNamedBufferParameteriv");
|
||||
if (!bufObj)
|
||||
|
|
@ -3219,6 +3225,8 @@ _mesa_GetNamedBufferParameterivEXT(GLuint buffer, GLenum pname, GLint *params)
|
|||
struct gl_buffer_object *bufObj;
|
||||
GLint64 parameter;
|
||||
|
||||
*params = 0;
|
||||
|
||||
if (!buffer) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glGetNamedBufferParameterivEXT: buffer=0");
|
||||
|
|
@ -3245,6 +3253,8 @@ _mesa_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname,
|
|||
struct gl_buffer_object *bufObj;
|
||||
GLint64 parameter;
|
||||
|
||||
*params = 0;
|
||||
|
||||
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
|
||||
"glGetNamedBufferParameteri64v");
|
||||
if (!bufObj)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue