From: Adam Jackson Date: Sun, 24 Oct 2004 02:05:40 +0000 (+0000) Subject: Bug #1682: Mesa core code that gets linked into DRI drivers should never call X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=94987beb2c9e87d9c55db5cb7c089dc77f78df94;p=mesa.git Bug #1682: Mesa core code that gets linked into DRI drivers should never call through the GL API directly, but should instead use the GL_CALL macro. --- diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index a127fe04ada..626c92eca25 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -64,79 +64,274 @@ typedef struct { */ #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) +static void GLAPIENTRY Color3bv(const GLbyte *v) +{ + GL_CALL(Color3bv)(v); +} + +static void GLAPIENTRY Color3ubv(const GLubyte *v) +{ + GL_CALL(Color3ubv)(v); +} + +static void GLAPIENTRY Color3sv(const GLshort *v) +{ + GL_CALL(Color3sv)(v); +} + +static void GLAPIENTRY Color3usv(const GLushort *v) +{ + GL_CALL(Color3usv)(v); +} + +static void GLAPIENTRY Color3iv(const GLint *v) +{ + GL_CALL(Color3iv)(v); +} + +static void GLAPIENTRY Color3uiv(const GLuint *v) +{ + GL_CALL(Color3uiv)(v); +} + +static void GLAPIENTRY Color3fv(const GLfloat *v) +{ + GL_CALL(Color3fv)(v); +} + +static void GLAPIENTRY Color3dv(const GLdouble *v) +{ + GL_CALL(Color3dv)(v); +} + +static void GLAPIENTRY Color4bv(const GLbyte *v) +{ + GL_CALL(Color4bv)(v); +} + +static void GLAPIENTRY Color4ubv(const GLubyte *v) +{ + GL_CALL(Color4ubv)(v); +} + +static void GLAPIENTRY Color4sv(const GLshort *v) +{ + GL_CALL(Color4sv)(v); +} -static array_func ColorFuncs[2][8] = { - { (array_func)glColor3bv, - (array_func)glColor3ubv, - (array_func)glColor3sv, - (array_func)glColor3usv, - (array_func)glColor3iv, - (array_func)glColor3uiv, - (array_func)glColor3fv, - (array_func)glColor3dv }, - - { (array_func)glColor4bv, - (array_func)glColor4ubv, - (array_func)glColor4sv, - (array_func)glColor4usv, - (array_func)glColor4iv, - (array_func)glColor4uiv, - (array_func)glColor4fv, - (array_func)glColor4dv } +static void GLAPIENTRY Color4usv(const GLushort *v) +{ + GL_CALL(Color4usv)(v); +} + +static void GLAPIENTRY Color4iv(const GLint *v) +{ + GL_CALL(Color4iv)(v); +} + +static void GLAPIENTRY Color4uiv(const GLuint *v) +{ + GL_CALL(Color4uiv)(v); +} + +static void GLAPIENTRY Color4fv(const GLfloat *v) +{ + GL_CALL(Color4fv)(v); +} + +static void GLAPIENTRY Color4dv(const GLdouble *v) +{ + GL_CALL(Color4dv)(v); +} + +static const array_func ColorFuncs[2][8] = { + { + (array_func) Color3bv, + (array_func) Color3ubv, + (array_func) Color3sv, + (array_func) Color3usv, + (array_func) Color3iv, + (array_func) Color3uiv, + (array_func) Color3fv, + (array_func) Color3dv, + }, + { + (array_func) Color4bv, + (array_func) Color4ubv, + (array_func) Color4sv, + (array_func) Color4usv, + (array_func) Color4iv, + (array_func) Color4uiv, + (array_func) Color4fv, + (array_func) Color4dv, + }, }; -static array_func VertexFuncs[3][8] = { - { 0, - 0, - (array_func)glVertex2sv, - 0, - (array_func)glVertex2iv, - 0, - (array_func)glVertex2fv, - (array_func)glVertex2dv }, - - { 0, - 0, - (array_func)glVertex3sv, - 0, - (array_func)glVertex3iv, - 0, - (array_func)glVertex3fv, - (array_func)glVertex3dv }, - - { 0, - 0, - (array_func)glVertex4sv, - 0, - (array_func)glVertex4iv, - 0, - (array_func)glVertex4fv, - (array_func)glVertex4dv } +static void GLAPIENTRY Vertex2sv(const GLshort *v) +{ + GL_CALL(Vertex2sv)(v); +} + +static void GLAPIENTRY Vertex2iv(const GLint *v) +{ + GL_CALL(Vertex2iv)(v); +} + +static void GLAPIENTRY Vertex2fv(const GLfloat *v) +{ + GL_CALL(Vertex2fv)(v); +} + +static void GLAPIENTRY Vertex2dv(const GLdouble *v) +{ + GL_CALL(Vertex2dv)(v); +} + +static void GLAPIENTRY Vertex3sv(const GLshort *v) +{ + GL_CALL(Vertex3sv)(v); +} + +static void GLAPIENTRY Vertex3iv(const GLint *v) +{ + GL_CALL(Vertex3iv)(v); +} + +static void GLAPIENTRY Vertex3fv(const GLfloat *v) +{ + GL_CALL(Vertex3fv)(v); +} + +static void GLAPIENTRY Vertex3dv(const GLdouble *v) +{ + GL_CALL(Vertex3dv)(v); +} + +static void GLAPIENTRY Vertex4sv(const GLshort *v) +{ + GL_CALL(Vertex4sv)(v); +} + +static void GLAPIENTRY Vertex4iv(const GLint *v) +{ + GL_CALL(Vertex4iv)(v); +} + +static void GLAPIENTRY Vertex4fv(const GLfloat *v) +{ + GL_CALL(Vertex4fv)(v); +} + +static void GLAPIENTRY Vertex4dv(const GLdouble *v) +{ + GL_CALL(Vertex4dv)(v); +} + +static const array_func VertexFuncs[3][8] = { + { + 0, + 0, + (array_func) Vertex2sv, + 0, + (array_func) Vertex2iv, + 0, + (array_func) Vertex2fv, + (array_func) Vertex2dv, + }, + { + 0, + 0, + (array_func) Vertex3sv, + 0, + (array_func) Vertex3iv, + 0, + (array_func) Vertex3fv, + (array_func) Vertex3dv, + }, + { + 0, + 0, + (array_func) Vertex4sv, + 0, + (array_func) Vertex4iv, + 0, + (array_func) Vertex4fv, + (array_func) Vertex4dv, + }, }; -static array_func IndexFuncs[8] = { +static void GLAPIENTRY Indexubv(const GLubyte *c) +{ + GL_CALL(Indexubv)(c); +} + +static void GLAPIENTRY Indexsv(const GLshort *c) +{ + GL_CALL(Indexsv)(c); +} + +static void GLAPIENTRY Indexiv(const GLint *c) +{ + GL_CALL(Indexiv)(c); +} + +static void GLAPIENTRY Indexfv(const GLfloat *c) +{ + GL_CALL(Indexfv)(c); +} + +static void GLAPIENTRY Indexdv(const GLdouble *c) +{ + GL_CALL(Indexdv)(c); +} + +static const array_func IndexFuncs[8] = { 0, - (array_func)glIndexubv, - (array_func)glIndexsv, + (array_func) Indexubv, + (array_func) Indexsv, 0, - (array_func)glIndexiv, + (array_func) Indexiv, 0, - (array_func)glIndexfv, - (array_func)glIndexdv + (array_func) Indexfv, + (array_func) Indexdv, }; -static array_func NormalFuncs[8] = { - (array_func)glNormal3bv, +static void GLAPIENTRY Normal3bv(const GLbyte *v) +{ + GL_CALL(Normal3bv)(v); +} + +static void GLAPIENTRY Normal3sv(const GLshort *v) +{ + GL_CALL(Normal3sv)(v); +} + +static void GLAPIENTRY Normal3iv(const GLint *v) +{ + GL_CALL(Normal3iv)(v); +} + +static void GLAPIENTRY Normal3fv(const GLfloat *v) +{ + GL_CALL(Normal3fv)(v); +} + +static void GLAPIENTRY Normal3dv(const GLdouble *v) +{ + GL_CALL(Normal3dv)(v); +} + +static const array_func NormalFuncs[8] = { + (array_func) Normal3bv, 0, - (array_func)glNormal3sv, + (array_func) Normal3sv, 0, - (array_func)glNormal3iv, + (array_func) Normal3iv, 0, - (array_func)glNormal3fv, - (array_func)glNormal3dv, + (array_func) Normal3fv, + (array_func) Normal3dv, }; - /* Wrapper functions in case glSecondaryColor*EXT doesn't exist */ static void GLAPIENTRY SecondaryColor3bvEXT(const GLbyte *c) { @@ -178,7 +373,7 @@ static void GLAPIENTRY SecondaryColor3dvEXT(const GLdouble *c) GL_CALL(SecondaryColor3dvEXT)(c); } -static array_func SecondaryColorFuncs[8] = { +static const array_func SecondaryColorFuncs[8] = { (array_func) SecondaryColor3bvEXT, (array_func) SecondaryColor3ubvEXT, (array_func) SecondaryColor3svEXT, @@ -201,7 +396,7 @@ static void GLAPIENTRY FogCoorddvEXT(const GLdouble *f) GL_CALL(FogCoorddvEXT)(f); } -static array_func FogCoordFuncs[8] = { +static const array_func FogCoordFuncs[8] = { 0, 0, 0, @@ -212,7 +407,6 @@ static array_func FogCoordFuncs[8] = { (array_func) FogCoorddvEXT }; - /**********************************************************************/ /* GL_BYTE attributes */ @@ -549,7 +743,7 @@ static void GLAPIENTRY VertexAttrib4dv(GLuint index, const GLdouble *v) /* * Array [size][type] of VertexAttrib functions */ -static attrib_func AttribFuncs[2][4][8] = { +static const attrib_func AttribFuncs[2][4][8] = { { /* non-normalized */ { @@ -646,6 +840,11 @@ static attrib_func AttribFuncs[2][4][8] = { } }; +static void GLAPIENTRY EdgeFlagv(const GLboolean *flag) +{ + GL_CALL(EdgeFlagv)(flag); +} + /**********************************************************************/ @@ -693,7 +892,7 @@ static void _ae_update_state( GLcontext *ctx ) } if (ctx->Array.EdgeFlag.Enabled) { aa->array = &ctx->Array.EdgeFlag; - aa->func = (array_func) glEdgeFlagv; + aa->func = (array_func) EdgeFlagv; aa++; } if (ctx->Array.Normal.Enabled) { diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index ef2dada7101..9f4b9119a7c 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -7694,7 +7694,7 @@ static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list ) Node *n; GLboolean done; - if (!glIsList(list)) { + if (!GL_CALL(IsList)(list)) { _mesa_printf("%u is not a display list ID\n", list); return; } diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 0215f67c442..a1be2b535ed 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3744,7 +3744,7 @@ static int set_reg8 (GLcontext *ctx, grammar id, const byte *name, byte value) static int extension_is_supported (const GLubyte *ext) { - const GLubyte *extensions = glGetString (GL_EXTENSIONS); + const GLubyte *extensions = GL_CALL(GetString)(GL_EXTENSIONS); const GLubyte *end = extensions + _mesa_strlen ((const char *) extensions); const GLint ext_len = _mesa_strlen ((const char *) ext); diff --git a/src/mesa/tnl/t_save_loopback.c b/src/mesa/tnl/t_save_loopback.c index 18ecc3514fa..2e752c809a0 100644 --- a/src/mesa/tnl/t_save_loopback.c +++ b/src/mesa/tnl/t_save_loopback.c @@ -196,7 +196,7 @@ static void loopback_prim( GLcontext *ctx, GLuint k; if (prim->mode & PRIM_BEGIN) { - glBegin( prim->mode & PRIM_MODE_MASK ); + GL_CALL(Begin)( prim->mode & PRIM_MODE_MASK ); } else { assert(i == 0); @@ -221,7 +221,7 @@ static void loopback_prim( GLcontext *ctx, } if (prim->mode & PRIM_END) { - glEnd(); + GL_CALL(End)(); } else { assert (i == list->prim_count-1); diff --git a/src/mesa/tnl/t_vtx_eval.c b/src/mesa/tnl/t_vtx_eval.c index ea9da13fe4e..5a24c70d21f 100644 --- a/src/mesa/tnl/t_vtx_eval.c +++ b/src/mesa/tnl/t_vtx_eval.c @@ -165,9 +165,9 @@ void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u) map->Order); if (tnl->vtx.eval.map1[0].sz == 4) - glVertex4fv( vertex ); + GL_CALL(Vertex4fv)( vertex ); else - glVertex3fv( vertex ); + GL_CALL(Vertex3fv)( vertex ); } } @@ -244,9 +244,9 @@ void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ) } if (tnl->vtx.attrsz[0] == 4) - glVertex4fv( vertex ); + GL_CALL(Vertex4fv)( vertex ); else - glVertex3fv( vertex ); + GL_CALL(Vertex3fv)( vertex ); } }