From 34da36e1cf5d7ce4fcb6a087b4ff7bf6682da0cb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 20 May 2022 16:27:01 +0900 Subject: [PATCH] [gl_stub] Add a bunch of new stubs Gets gl_stub working with recent changes to QF. --- tools/gl_stub/gl_stub.c | 46 +++++++++++++++++++++++++++++++++++++++ tools/gl_stub/gls_norm.c | 42 ++++++++++++++++++++++++++++++----- tools/gl_stub/gls_trace.c | 43 ++++++++++++++++++++++++++++++------ 3 files changed, 118 insertions(+), 13 deletions(-) diff --git a/tools/gl_stub/gl_stub.c b/tools/gl_stub/gl_stub.c index 87ff057c3..97ccfd191 100644 --- a/tools/gl_stub/gl_stub.c +++ b/tools/gl_stub/gl_stub.c @@ -15,6 +15,7 @@ typedef XID GLXDrawable; typedef struct __GLXcontextRec *GLXContext; +typedef struct __GLXFBConfigRec *GLXFBConfig; #define TRACE do { \ puts (__FUNCTION__);\ @@ -149,3 +150,48 @@ glXGetConfig (Display *dpy, XVisualInfo *visual, int attrib, int *value ) TRACE; return 0; } + +GLXFBConfig * +glXChooseFBConfig (Display *dpy, int screen, int *attribList, int *count) +{ + if (trace) + TRACE; + GLXFBConfig *cfg = calloc (1, sizeof (GLXFBConfig)); + *cfg = (GLXFBConfig) (intptr_t) screen; + return cfg; +} + +XVisualInfo * +glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config) +{ + XVisualInfo template; + int num_visuals; + int template_mask; + int screen; + + if (trace) + TRACE; + + screen = (intptr_t) config; + template_mask = 0; + template.visualid = + XVisualIDFromVisual (XDefaultVisual (dpy, screen)); + template_mask = VisualIDMask; + return XGetVisualInfo (dpy, template_mask, &template, &num_visuals); +} + +int +glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value) +{ + if (trace) + TRACE; + return 0; +} + +GLXContext +glXCreateContextAttribsARB (Display *dpy, GLXFBConfig cfg, GLXContext ctx, Bool direct, const int *attribs) +{ + if (trace) + TRACE; + return (GLXContext)1; +} diff --git a/tools/gl_stub/gls_norm.c b/tools/gl_stub/gls_norm.c index 3fe4c4c67..0a0b55d55 100644 --- a/tools/gl_stub/gls_norm.c +++ b/tools/gl_stub/gls_norm.c @@ -227,11 +227,6 @@ norm_glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderb { } -void -norm_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ -} - void norm_glGenBuffers (GLsizei n, GLuint* buffers) { @@ -1196,7 +1191,7 @@ norm_glGetIntegerv (GLenum pname, GLint * params) { switch (pname) { case GL_MAX_TEXTURE_SIZE: - *params = 512; + *params = 2048; break; case GL_UNPACK_ALIGNMENT: case GL_PACK_ALIGNMENT: @@ -2466,3 +2461,38 @@ void norm_glPNTrianglesiATI (GLint x, GLint y) { } + +void +norm_glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ +} + +void +norm_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ +} + +void +norm_glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer) +{ +} + +void +norm_glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level) +{ +} + +void +norm_glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) +{ +} + +void +norm_glCreateVertexArrays (GLsizei n, GLuint *arrays) +{ +} + +void +norm_glBindVertexArray (GLuint array) +{ +} diff --git a/tools/gl_stub/gls_trace.c b/tools/gl_stub/gls_trace.c index c34f69db9..bdc361249 100644 --- a/tools/gl_stub/gls_trace.c +++ b/tools/gl_stub/gls_trace.c @@ -256,12 +256,6 @@ trace_glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum render TRACE; } -void -trace_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - TRACE; -} - void trace_glGenBuffers (GLsizei n, GLuint* buffers) { @@ -1413,7 +1407,7 @@ trace_glGetIntegerv (GLenum pname, GLint * params) TRACE; switch (pname) { case GL_MAX_TEXTURE_SIZE: - *params = 512; + *params = 2048; break; case GL_UNPACK_ALIGNMENT: case GL_PACK_ALIGNMENT: @@ -2926,3 +2920,38 @@ trace_glPNTrianglesiATI (GLint x, GLint y) { TRACE; } + +void +trace_glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ +} + +void +trace_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ +} + +void +trace_glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer) +{ +} + +void +trace_glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level) +{ +} + +void +trace_glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) +{ +} + +void +trace_glCreateVertexArrays (GLsizei n, GLuint *arrays) +{ +} + +void +trace_glBindVertexArray (GLuint array) +{ +}