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>
This commit is contained in:
committed by
Marge Bot
parent
69b98dfec3
commit
d21c8e1bed
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user