From b5022ad03584f119b27c143b53e7ed80e8c12ffb Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 25 Oct 2010 22:05:20 +0800 Subject: [PATCH] glapi: Do not use glapidispatch.h. glapidispatch.h exists so that core mesa (libmesa.a) can be built for DRI drivers or for non-DRI drivers as a compile time decision (whether IN_DRI_DRIVER is defined). It is of no use to glapi. This commit also drops the use of glapidispatch.h in glx and libgl-xlib as they are considered extensions to glapi when it comes to defining public GL entries. --- src/gallium/targets/libgl-xlib/xlib.c | 5 +-- src/glx/indirect.c | 63 ++++++++++++--------------- src/glx/single2.c | 4 +- src/glx/singlepix.c | 5 +-- src/mapi/glapi/gen/glX_proto_send.py | 3 +- src/mapi/glapi/glapi_dispatch.c | 9 ++-- src/mesa/drivers/x11/glxapi.c | 5 +-- 7 files changed, 40 insertions(+), 54 deletions(-) diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 2f8cd2d404a..6f05714f9e0 100644 --- a/src/gallium/targets/libgl-xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -195,7 +195,6 @@ extern void (*linker_foo(const unsigned char *procName))() #include "GL/gl.h" #include "glapi/glapi.h" #include "glapi/glapitable.h" -#include "glapi/glapidispatch.h" #if defined(USE_MGL_NAMESPACE) #define NAME(func) mgl##func @@ -204,10 +203,10 @@ extern void (*linker_foo(const unsigned char *procName))() #endif #define DISPATCH(FUNC, ARGS, MESSAGE) \ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); + GET_DISPATCH()->FUNC ARGS #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + return GET_DISPATCH()->FUNC ARGS /* skip normal ones */ #define _GLAPI_SKIP_NORMAL_ENTRY_POINTS diff --git a/src/glx/indirect.c b/src/glx/indirect.c index 2b09c1c3b5d..1b93a8cc8d5 100644 --- a/src/glx/indirect.c +++ b/src/glx/indirect.c @@ -30,7 +30,6 @@ #include "indirect.h" #include "glxclient.h" #include "indirect_size.h" -#include "glapidispatch.h" #include "glapi.h" #include "glthread.h" #include @@ -42,19 +41,19 @@ #define __GLX_PAD(n) (((n) + 3) & ~3) -# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define FASTCALL __attribute__((fastcall)) -# else -# define FASTCALL -# endif -# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) -# define NOINLINE __attribute__((noinline)) -# else -# define NOINLINE -# endif +#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) +#define FASTCALL __attribute__((fastcall)) +#else +#define FASTCALL +#endif +#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +#define NOINLINE __attribute__((noinline)) +#else +#define NOINLINE +#endif #ifndef __GNUC__ -# define __builtin_expect(x, y) x +#define __builtin_expect(x, y) x #endif /* If the size and opcode values are known at compile-time, this will, on @@ -5200,7 +5199,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); + GET_DISPATCH()->DeleteTextures(n, textures); } else #endif { @@ -5271,7 +5270,7 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GenTextures(GET_DISPATCH(), (n, textures)); + GET_DISPATCH()->GenTextures(n, textures); } else #endif { @@ -5336,7 +5335,7 @@ glIsTextureEXT(GLuint texture) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - return CALL_IsTexture(GET_DISPATCH(), (texture)); + return GET_DISPATCH()->IsTexture(texture); } else #endif { @@ -5652,7 +5651,7 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); + GET_DISPATCH()->GetColorTable(target, format, type, table); } else #endif { @@ -5728,8 +5727,7 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetColorTableParameterfv(GET_DISPATCH(), - (target, pname, params)); + GET_DISPATCH()->GetColorTableParameterfv(target, pname, params); } else #endif { @@ -5801,8 +5799,7 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetColorTableParameteriv(GET_DISPATCH(), - (target, pname, params)); + GET_DISPATCH()->GetColorTableParameteriv(target, pname, params); } else #endif { @@ -6127,8 +6124,7 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetConvolutionFilter(GET_DISPATCH(), - (target, format, type, image)); + GET_DISPATCH()->GetConvolutionFilter(target, format, type, image); } else #endif { @@ -6205,8 +6201,7 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetConvolutionParameterfv(GET_DISPATCH(), - (target, pname, params)); + GET_DISPATCH()->GetConvolutionParameterfv(target, pname, params); } else #endif { @@ -6278,8 +6273,7 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetConvolutionParameteriv(GET_DISPATCH(), - (target, pname, params)); + GET_DISPATCH()->GetConvolutionParameteriv(target, pname, params); } else #endif { @@ -6358,8 +6352,7 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetHistogram(GET_DISPATCH(), - (target, reset, format, type, values)); + GET_DISPATCH()->GetHistogram(target, reset, format, type, values); } else #endif { @@ -6435,7 +6428,7 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); + GET_DISPATCH()->GetHistogramParameterfv(target, pname, params); } else #endif { @@ -6506,7 +6499,7 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); + GET_DISPATCH()->GetHistogramParameteriv(target, pname, params); } else #endif { @@ -6581,7 +6574,7 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); + GET_DISPATCH()->GetMinmax(target, reset, format, type, values); } else #endif { @@ -6655,7 +6648,7 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); + GET_DISPATCH()->GetMinmaxParameterfv(target, pname, params); } else #endif { @@ -6723,7 +6716,7 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); + GET_DISPATCH()->GetMinmaxParameteriv(target, pname, params); } else #endif { @@ -10664,5 +10657,5 @@ __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, } -# undef FASTCALL -# undef NOINLINE +#undef FASTCALL +#undef NOINLINE diff --git a/src/glx/single2.c b/src/glx/single2.c index 318d18e5554..66281fa9c99 100644 --- a/src/glx/single2.c +++ b/src/glx/single2.c @@ -36,7 +36,6 @@ #include "indirect.h" #include "indirect_vertex_array.h" #include "glapitable.h" -#include "glapidispatch.h" #include "glapi.h" #ifdef USE_XCB #include @@ -944,8 +943,7 @@ glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, struct glx_context *const gc = __glXGetCurrentContext(); if (gc->isDirect) { - return CALL_AreTexturesResident(GET_DISPATCH(), - (n, textures, residences)); + return GET_DISPATCH()->AreTexturesResident(n, textures, residences); } else { struct glx_context *const gc = __glXGetCurrentContext(); diff --git a/src/glx/singlepix.c b/src/glx/singlepix.c index b61f26b2f3b..3fe2d4639ae 100644 --- a/src/glx/singlepix.c +++ b/src/glx/singlepix.c @@ -31,7 +31,6 @@ #include "packsingle.h" #include "indirect.h" #include "glapitable.h" -#include "glapidispatch.h" #include "glapi.h" #include "glthread.h" #include "glapioffsets.h" @@ -121,8 +120,8 @@ void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format, #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->isDirect) { - CALL_GetSeparableFilter(GET_DISPATCH(), - (target, format, type, row, column, span)); + GET_DISPATCH()->GetSeparableFilter(target, format, type, + row, column, span); return; } else diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index bd41c9e667a..4f8baf35d11 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -166,7 +166,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto): print '#include "indirect.h"' print '#include "glxclient.h"' print '#include "indirect_size.h"' - print '#include "glapidispatch.h"' print '#include "glapi.h"' print '#include "glthread.h"' print '#include ' @@ -375,7 +374,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; print '' print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' print ' if (gc->isDirect) {' - print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string()) + print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string()) print ' } else' print '#endif' print ' {' diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 7421a36d35a..989f4a3fc30 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -39,7 +39,6 @@ #include "glapi/glapi_priv.h" #include "glapi/glapitable.h" -#include "glapi/glapidispatch.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) @@ -63,19 +62,19 @@ #define F stdout #define DISPATCH(FUNC, ARGS, MESSAGE) \ fprintf MESSAGE; \ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); + GET_DISPATCH()->FUNC ARGS #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ fprintf MESSAGE; \ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + return GET_DISPATCH()->FUNC ARGS #else #define DISPATCH(FUNC, ARGS, MESSAGE) \ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); + GET_DISPATCH()->FUNC ARGS #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + return GET_DISPATCH()->FUNC ARGS #endif /* logging */ diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 8c3f2730f3d..255a37bf295 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -58,7 +58,6 @@ struct display_dispatch { #ifdef GLX_INDIRECT_RENDERING #include "glapi/glapitable.h" -#include "glapi/glapidispatch.h" #define KEYWORD1 PUBLIC @@ -69,10 +68,10 @@ struct display_dispatch { #endif #define DISPATCH(FUNC, ARGS, MESSAGE) \ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); + GET_DISPATCH()->FUNC ARGS #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + return GET_DISPATCH()->FUNC ARGS /* skip normal ones */ #define _GLAPI_SKIP_NORMAL_ENTRY_POINTS -- 2.30.2