From 03c0c2e8aa5e5f1b430c4b3faa1f9ad92b1b71eb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Jan 2002 16:06:35 +0000 Subject: [PATCH] Removed api_compat stuff, there's a better way. Fixed FogCoord / SecondaryColor mix-ups in api_arrayelt.c --- src/mesa/main/api_arrayelt.c | 108 ++++++++++++++++++++++++++--------- src/mesa/main/api_loopback.c | 18 +++--- 2 files changed, 90 insertions(+), 36 deletions(-) diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index f5b3695bfd9..98be1699eaf 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1,10 +1,10 @@ -/* $Id: api_arrayelt.c,v 1.5 2001/12/28 06:28:10 gareth Exp $ */ +/* $Id: api_arrayelt.c,v 1.6 2002/01/14 16:06:35 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -172,38 +172,90 @@ static void (*normalfuncs[8])( const void * ) = { (array_func)glNormal3dv, }; -static void (*fogcoordfuncs[8])( const void * ); -static void (*secondarycolorfuncs[8])( const void * ); -GLboolean _ae_create_context( GLcontext *ctx ) +/* Wrapper functions in case glSecondaryColor*EXT doesn't exist */ +static void SecondaryColor3bvEXT(const GLbyte *c) +{ + _glapi_Dispatch->SecondaryColor3bvEXT(c); +} + +static void SecondaryColor3ubvEXT(const GLubyte *c) +{ + _glapi_Dispatch->SecondaryColor3ubvEXT(c); +} + +static void SecondaryColor3svEXT(const GLshort *c) +{ + _glapi_Dispatch->SecondaryColor3svEXT(c); +} + +static void SecondaryColor3usvEXT(const GLushort *c) +{ + _glapi_Dispatch->SecondaryColor3usvEXT(c); +} + +static void SecondaryColor3ivEXT(const GLint *c) +{ + _glapi_Dispatch->SecondaryColor3ivEXT(c); +} + +static void SecondaryColor3uivEXT(const GLuint *c) +{ + _glapi_Dispatch->SecondaryColor3uivEXT(c); +} + +static void SecondaryColor3fvEXT(const GLfloat *c) +{ + _glapi_Dispatch->SecondaryColor3fvEXT(c); +} + +static void SecondaryColor3dvEXT(const GLdouble *c) { - static int firsttime = 1; + _glapi_Dispatch->SecondaryColor3dvEXT(c); +} +static void (*secondarycolorfuncs[8])( const void * ) = { + (array_func) SecondaryColor3bvEXT, + (array_func) SecondaryColor3ubvEXT, + (array_func) SecondaryColor3svEXT, + (array_func) SecondaryColor3usvEXT, + (array_func) SecondaryColor3ivEXT, + (array_func) SecondaryColor3uivEXT, + (array_func) SecondaryColor3fvEXT, + (array_func) SecondaryColor3dvEXT, +}; + + +/* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */ +static void FogCoordfvEXT(const GLfloat *f) +{ + _glapi_Dispatch->FogCoordfvEXT(f); +} + +static void FogCoorddvEXT(const GLdouble *f) +{ + _glapi_Dispatch->FogCoorddvEXT(f); +} + +static void (*fogcoordfuncs[8])( const void * ) = { + 0, + 0, + 0, + 0, + 0, + 0, + (array_func) FogCoordfvEXT, + (array_func) FogCoorddvEXT +}; + + + +GLboolean _ae_create_context( GLcontext *ctx ) +{ ctx->aelt_context = MALLOC( sizeof(AEcontext) ); if (!ctx->aelt_context) return GL_FALSE; - - if (firsttime) - { - firsttime = 0; - - /* Don't really want to use api_compat.h for this, but the - * rational for using _glapi_get_proc_address is the same. - */ - fogcoordfuncs[0] = (array_func) _glapi_get_proc_address("glSecondaryColor3bvEXT"); - fogcoordfuncs[1] = (array_func) _glapi_get_proc_address("glSecondaryColor3ubvEXT"); - fogcoordfuncs[2] = (array_func) _glapi_get_proc_address("glSecondaryColor3svEXT"); - fogcoordfuncs[3] = (array_func) _glapi_get_proc_address("glSecondaryColor3usvEXT"); - fogcoordfuncs[4] = (array_func) _glapi_get_proc_address("glSecondaryColor3ivEXT"); - fogcoordfuncs[5] = (array_func) _glapi_get_proc_address("glSecondaryColor3uivEXT"); - fogcoordfuncs[6] = (array_func) _glapi_get_proc_address("glSecondaryColor3fvEXT"); - fogcoordfuncs[7] = (array_func) _glapi_get_proc_address("glSecondaryColor3dvEXT"); - - secondarycolorfuncs[6] = (array_func) _glapi_get_proc_address("glFogCoordfvEXT"); - secondarycolorfuncs[7] = (array_func) _glapi_get_proc_address("glFogCoorddvEXT"); - } - AE_CONTEXT(ctx)->NewState = ~0; return GL_TRUE; } diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 51c83189f02..6838f4f7c16 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1,10 +1,10 @@ -/* $Id: api_loopback.c,v 1.14 2001/12/21 15:48:23 keithw Exp $ */ +/* $Id: api_loopback.c,v 1.15 2002/01/14 16:06:35 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -29,10 +29,10 @@ #include "glheader.h" +#include "glapi.h" #include "glapitable.h" #include "macros.h" #include "colormac.h" -#include "api_compat.h" #include "api_loopback.h" /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc @@ -64,12 +64,12 @@ #define MATERIALFV(a,b,c) glMaterialfv(a,b,c) #define RECTF(a,b,c,d) glRectf(a,b,c,d) -#define ATTRIB(index, x, y, z, w) _compat_VertexAttrib4fNV(index, x, y, z, w) +#define ATTRIB(index, x, y, z, w) _glapi_Dispatch->VertexAttrib4fNV(index, x, y, z, w) -#define FOGCOORDF(x) _compat_FogCoordfEXT(x) -#define SECONDARYCOLORUB(a,b,c) _compat_SecondaryColor3ubEXT(a,b,c) -#define SECONDARYCOLORF(a,b,c) _compat_SecondaryColor3fEXT(a,b,c) +#define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x) +#define SECONDARYCOLORUB(a,b,c) _glapi_Dispatch->SecondaryColor3ubEXT(a,b,c) +#define SECONDARYCOLORF(a,b,c) _glapi_Dispatch->SecondaryColor3fEXT(a,b,c) static void @@ -1633,6 +1633,7 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) } + void _mesa_loopback_prefer_float( struct _glapi_table *dest, GLboolean prefer_float_colors ) @@ -1870,4 +1871,5 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest, dest->VertexAttribs4fvNV = loopback_VertexAttribs4fvNV; dest->VertexAttribs4dvNV = loopback_VertexAttribs4dvNV; dest->VertexAttribs4ubvNV = loopback_VertexAttribs4ubvNV; + } -- 2.30.2