[gl_stub] Make some gen functions generate indices

This makes gl_stub usable with valgrind (otherwise, the returned indices
are uninitialized).
This commit is contained in:
Bill Currie 2023-03-05 16:46:06 +09:00
parent 9193a92a81
commit e2640d51a7
2 changed files with 28 additions and 0 deletions

View file

@ -1,3 +1,5 @@
#include <string.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
@ -230,16 +232,19 @@ norm_glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderb
void void
norm_glGenBuffers (GLsizei n, GLuint* buffers) norm_glGenBuffers (GLsizei n, GLuint* buffers)
{ {
memset (buffers, 0, n * sizeof (GLuint));
} }
void void
norm_glGenFramebuffers (GLsizei n, GLuint* framebuffers) norm_glGenFramebuffers (GLsizei n, GLuint* framebuffers)
{ {
memset (framebuffers, 0, n * sizeof (GLuint));
} }
void void
norm_glGenRenderbuffers (GLsizei n, GLuint* renderbuffers) norm_glGenRenderbuffers (GLsizei n, GLuint* renderbuffers)
{ {
memset (renderbuffers, 0, n * sizeof (GLuint));
} }
void void
@ -281,11 +286,15 @@ norm_glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GL
void void
norm_glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) norm_glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
{ {
if (bufsize > 0) {
*infolog = 0;
}
} }
void void
norm_glGetProgramiv (GLuint program, GLenum pname, GLint* params) norm_glGetProgramiv (GLuint program, GLenum pname, GLint* params)
{ {
*params = 0;
} }
void void
@ -296,6 +305,9 @@ norm_glGetRenderbufferParameteriv (GLuint shader, GLenum pname, GLint* params)
void void
norm_glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) norm_glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
{ {
if (bufsize > 0) {
*infolog = 0;
}
} }
void void
@ -311,6 +323,7 @@ norm_glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar*
void void
norm_glGetShaderiv (GLuint shader, GLenum pname, GLint* params) norm_glGetShaderiv (GLuint shader, GLenum pname, GLint* params)
{ {
*params = 0;
} }
int int
@ -1111,6 +1124,7 @@ norm_glGenLists (GLsizei range)
void void
norm_glGenTextures (GLsizei n, GLuint * textures) norm_glGenTextures (GLsizei n, GLuint * textures)
{ {
memset (textures, 0, n * sizeof (GLuint));
} }
void void

View file

@ -1,3 +1,5 @@
#include <string.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
@ -260,18 +262,21 @@ void
trace_glGenBuffers (GLsizei n, GLuint* buffers) trace_glGenBuffers (GLsizei n, GLuint* buffers)
{ {
TRACE; TRACE;
memset (buffers, 0, n * sizeof (GLuint));
} }
void void
trace_glGenFramebuffers (GLsizei n, GLuint* framebuffers) trace_glGenFramebuffers (GLsizei n, GLuint* framebuffers)
{ {
TRACE; TRACE;
memset (framebuffers, 0, n * sizeof (GLuint));
} }
void void
trace_glGenRenderbuffers (GLsizei n, GLuint* renderbuffers) trace_glGenRenderbuffers (GLsizei n, GLuint* renderbuffers)
{ {
TRACE; TRACE;
memset (renderbuffers, 0, n * sizeof (GLuint));
} }
void void
@ -321,12 +326,16 @@ void
trace_glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) trace_glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
{ {
TRACE; TRACE;
if (bufsize > 0) {
*infolog = 0;
}
} }
void void
trace_glGetProgramiv (GLuint program, GLenum pname, GLint* params) trace_glGetProgramiv (GLuint program, GLenum pname, GLint* params)
{ {
TRACE; TRACE;
*params = 0;
} }
void void
@ -339,6 +348,9 @@ void
trace_glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) trace_glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
{ {
TRACE; TRACE;
if (bufsize > 0) {
*infolog = 0;
}
} }
void void
@ -357,6 +369,7 @@ void
trace_glGetShaderiv (GLuint shader, GLenum pname, GLint* params) trace_glGetShaderiv (GLuint shader, GLenum pname, GLint* params)
{ {
TRACE; TRACE;
*params = 0;
} }
int int
@ -1312,6 +1325,7 @@ void
trace_glGenTextures (GLsizei n, GLuint * textures) trace_glGenTextures (GLsizei n, GLuint * textures)
{ {
TRACE; TRACE;
memset (textures, 0, n * sizeof (GLuint));
} }
void void