From 91c219d9063bf7d3a181ee0b289c68b4a68f3db6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 11 Mar 2005 20:55:03 +0000 Subject: [PATCH] Add support for ARB_draw_buffers and ARB_occlusion_query. The GLX protocol for these extensions (as well as ARB_vertex_program and ARB_matrix_palette) was just approved by the ARB on 8-Mar-2005. Now the only extension missing for 1.5 support is ARB_vertex_buffer_object. The opcodes for ARB_matrix_palette were also added to gl_API.xml. Since this extension isn't supported by Mesa, no code is generated for it. Some tabs were also converted to spaces in the comment for GetCompressedTexImageARB. --- src/glx/x11/glxextensions.c | 4 +- src/glx/x11/glxextensions.h | 2 + src/glx/x11/indirect.c | 154 ++++++++++++++++++++++++++++++++++++ src/glx/x11/indirect.h | 9 +++ src/glx/x11/indirect_init.c | 15 ++++ src/mesa/glapi/gl_API.xml | 72 ++++++++++------- 6 files changed, 226 insertions(+), 30 deletions(-) diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c index 166dd18c041..56ba5c9b47e 100644 --- a/src/glx/x11/glxextensions.c +++ b/src/glx/x11/glxextensions.c @@ -112,12 +112,13 @@ static const struct extension_info known_glx_extensions[] = { static const struct extension_info known_gl_extensions[] = { { GL(ARB_depth_texture), VER(1,4), Y, N, N, N }, + { GL(ARB_draw_buffers), VER(0,0), Y, N, N, N }, { GL(ARB_fragment_program), VER(0,0), Y, N, N, N }, { GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N }, { GL(ARB_imaging), VER(0,0), Y, N, N, N }, { GL(ARB_multisample), VER(1,3), Y, N, N, N }, { GL(ARB_multitexture), VER(1,3), Y, N, N, N }, - { GL(ARB_occlusion_query), VER(1,5), N, N, N, N }, + { GL(ARB_occlusion_query), VER(1,5), Y, N, N, N }, { GL(ARB_point_parameters), VER(1,4), Y, N, N, N }, { GL(ARB_point_sprite), VER(0,0), Y, N, N, N }, { GL(ARB_shadow), VER(1,4), Y, N, N, N }, @@ -184,6 +185,7 @@ static const struct extension_info known_gl_extensions[] = { { GL(3DFX_texture_compression_FXT1), VER(0,0), Y, N, N, N }, { GL(APPLE_packed_pixels), VER(1,2), Y, N, N, N }, { GL(APPLE_ycbcr_422), VER(0,0), Y, N, N, N }, + { GL(ATI_draw_buffers), VER(0,0), Y, N, N, N }, { GL(ATI_text_fragment_shader), VER(0,0), Y, N, N, N }, { GL(ATI_texture_env_combine3), VER(0,0), Y, N, N, N }, { GL(ATI_texture_float), VER(0,0), Y, N, N, N }, diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h index e374161168a..fd19bd23351 100644 --- a/src/glx/x11/glxextensions.h +++ b/src/glx/x11/glxextensions.h @@ -74,6 +74,7 @@ enum { enum { GL_ARB_depth_texture_bit = 0, + GL_ARB_draw_buffers_bit, GL_ARB_fragment_program_bit, GL_ARB_fragment_program_shadow_bit, GL_ARB_imaging_bit, @@ -212,6 +213,7 @@ enum { */ GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit, + GL_ATI_draw_buffers_bit = GL_ARB_draw_buffers_bit, GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit, GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit, GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit, diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index c654c939395..4d564c12d54 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -5451,6 +5451,35 @@ __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert) if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } } +#define X_GLrop_DrawBuffersARB 233 +void +__indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 8 + __GLX_PAD((n * 4)); + if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) { + if (cmdlen <= gc->maxSmallRenderCommandSize) { + if ( (gc->pc + cmdlen) > gc->bufEnd ) { + (void) __glXFlushRenderBuffer(gc, gc->pc); + } + emit_header(gc->pc, X_GLrop_DrawBuffersARB, cmdlen); + (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4); + (void) memcpy((void *)(gc->pc + 8), (void *)(bufs), (n * 4)); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } + } + else { + const GLint op = X_GLrop_DrawBuffersARB; + const GLuint cmdlenLarge = cmdlen + 4; + GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc); + (void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4); + (void) memcpy((void *)(pc + 4), (void *)(&op), 4); + (void) memcpy((void *)(pc + 8), (void *)(&n), 4); + __glXSendLargeCommand(gc, pc, 12, bufs, (n * 4)); + } + } +} + #define X_GLvop_AreTexturesResidentEXT 11 GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences) @@ -7145,6 +7174,131 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte return; } +#define X_GLsop_GenQueriesARB 162 +void +__indirect_glGenQueriesARB(GLsizei n, GLuint * ids) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + const GLuint cmdlen = 4; + if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GenQueriesARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&n), 4); + (void) __glXReadReply(dpy, 4, ids, GL_FALSE); + UnlockDisplay(dpy); SyncHandle(); + } + return; +} + +#define X_GLsop_DeleteQueriesARB 161 +void +__indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); + if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_DeleteQueriesARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&n), 4); + (void) memcpy((void *)(pc + 4), (void *)(ids), (n * 4)); + UnlockDisplay(dpy); SyncHandle(); + } + return; +} + +#define X_GLsop_IsQueryARB 163 +GLboolean +__indirect_glIsQueryARB(GLuint id) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + GLboolean retval = (GLboolean) 0; + const GLuint cmdlen = 4; + if (__builtin_expect(dpy != NULL, 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_IsQueryARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&id), 4); + retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE); + UnlockDisplay(dpy); SyncHandle(); + } + return retval; +} + +#define X_GLrop_BeginQueryARB 231 +void +__indirect_glBeginQueryARB(GLenum target, GLuint id) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 12; + emit_header(gc->pc, X_GLrop_BeginQueryARB, cmdlen); + (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4); + (void) memcpy((void *)(gc->pc + 8), (void *)(&id), 4); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } +} + +#define X_GLrop_EndQueryARB 232 +void +__indirect_glEndQueryARB(GLenum target) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 8; + emit_header(gc->pc, X_GLrop_EndQueryARB, cmdlen); + (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } +} + +#define X_GLsop_GetQueryivARB 164 +void +__indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + const GLuint cmdlen = 8; + if (__builtin_expect(dpy != NULL, 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GetQueryivARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&target), 4); + (void) memcpy((void *)(pc + 4), (void *)(&pname), 4); + (void) __glXReadReply(dpy, 4, params, GL_FALSE); + UnlockDisplay(dpy); SyncHandle(); + } + return; +} + +#define X_GLsop_GetQueryObjectivARB 165 +void +__indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + const GLuint cmdlen = 8; + if (__builtin_expect(dpy != NULL, 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectivARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&id), 4); + (void) memcpy((void *)(pc + 4), (void *)(&pname), 4); + (void) __glXReadReply(dpy, 4, params, GL_FALSE); + UnlockDisplay(dpy); SyncHandle(); + } + return; +} + +#define X_GLsop_GetQueryObjectuivARB 166 +void +__indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params) +{ + __GLXcontext * const gc = __glXGetCurrentContext(); + Display * const dpy = gc->currentDpy; + const GLuint cmdlen = 8; + if (__builtin_expect(dpy != NULL, 1)) { + GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectuivARB, cmdlen); + (void) memcpy((void *)(pc + 0), (void *)(&id), 4); + (void) memcpy((void *)(pc + 4), (void *)(&pname), 4); + (void) __glXReadReply(dpy, 4, params, GL_FALSE); + UnlockDisplay(dpy); SyncHandle(); + } + return; +} + #define X_GLvop_GetVertexAttribdvNV 1301 void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params) diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h index 51228465d41..b704ba846ce 100644 --- a/src/glx/x11/indirect.h +++ b/src/glx/x11/indirect.h @@ -482,6 +482,7 @@ extern HIDDEN void __indirect_glLoadTransposeMatrixdARB(const GLdouble * m); extern HIDDEN void __indirect_glMultTransposeMatrixfARB(const GLfloat * m); extern HIDDEN void __indirect_glMultTransposeMatrixdARB(const GLdouble * m); extern HIDDEN void __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert); +extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs); extern HIDDEN GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences); extern HIDDEN void __indirect_glGenTexturesEXT(GLsizei n, GLuint * textures); extern HIDDEN GLboolean __indirect_glIsTextureEXT(GLuint texture); @@ -643,6 +644,14 @@ extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei le extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); +extern HIDDEN void __indirect_glGenQueriesARB(GLsizei n, GLuint * ids); +extern HIDDEN void __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids); +extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id); +extern HIDDEN void __indirect_glBeginQueryARB(GLenum target, GLuint id); +extern HIDDEN void __indirect_glEndQueryARB(GLenum target); +extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params); +extern HIDDEN void __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params); +extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params); extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params); extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params); extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params); diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c index 5e2fc0437e7..70e9dab15f1 100644 --- a/src/glx/x11/indirect_init.c +++ b/src/glx/x11/indirect_init.c @@ -503,6 +503,10 @@ __GLapi * __glXNewIndirectAPI( void ) glAPI->SampleCoverageARB = __indirect_glSampleCoverageARB; + /* GL_ARB_draw_buffers */ + + glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB; + /* GL_EXT_texture_object */ glAPI->AreTexturesResidentEXT = __indirect_glAreTexturesResidentEXT; @@ -721,6 +725,17 @@ __GLapi * __glXNewIndirectAPI( void ) glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV; glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV; + /* GL_ARB_occlusion_query */ + + glAPI->GenQueriesARB = __indirect_glGenQueriesARB; + glAPI->DeleteQueriesARB = __indirect_glDeleteQueriesARB; + glAPI->IsQueryARB = __indirect_glIsQueryARB; + glAPI->BeginQueryARB = __indirect_glBeginQueryARB; + glAPI->EndQueryARB = __indirect_glEndQueryARB; + glAPI->GetQueryivARB = __indirect_glGetQueryivARB; + glAPI->GetQueryObjectivARB = __indirect_glGetQueryObjectivARB; + glAPI->GetQueryObjectuivARB = __indirect_glGetQueryObjectuivARB; + /* GL_NV_vertex_program */ glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV; diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 919803a070e..e13815cc10e 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -4979,11 +4979,11 @@ glx: - + @@ -5130,21 +5130,25 @@ glx: + - - + + + - - + + + - - + + + @@ -6022,60 +6026,70 @@ glx: - - - - + + + + + + + + + + + + + + - + - - - + + + - + - + - + - - + + - - + + - - + + @@ -6467,7 +6481,7 @@ glx: - + -- 2.30.2