diff options
287 files changed, 24780 insertions, 20712 deletions
diff --git a/src/glu/sgi/include/gluos.h b/src/glu/sgi/include/gluos.h index dd0bd79b0de..bba06375ca6 100644 --- a/src/glu/sgi/include/gluos.h +++ b/src/glu/sgi/include/gluos.h @@ -1,18 +1,38 @@ /* ** gluos.h - operating system dependencies for GLU ** -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.5 2003/02/12 16:04:07 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.5.4.1 2003/11/21 15:49:25 keithw Exp $ */ #ifdef __VMS -#ifdef __cplusplus +#ifdef __cplusplus #pragma message disable nocordel #pragma message disable codeunreachable #pragma message disable codcauunr #endif #endif -#ifdef _WIN32 -#include <stdlib.h> /* For _MAX_PATH definition */ +#ifdef __WATCOMC__ +/* Disable *lots* of warnings to get a clean build. I can't be bothered fixing the + * code at the moment, as it is pretty ugly. + */ +#pragma warning 7 10 +#pragma warning 13 10 +#pragma warning 14 10 +#pragma warning 367 10 +#pragma warning 379 10 +#pragma warning 726 10 +#pragma warning 836 10 +#endif + +#ifdef BUILD_FOR_SNAP + +#include <stdlib.h> +#include <stdio.h> +#include <malloc.h> + +#elif defined(_WIN32) + +#include <stdlib.h> /* For _MAX_PATH definition */ #include <stdio.h> #include <malloc.h> diff --git a/src/glu/sgi/libnurbs/interface/bezierEval.cc b/src/glu/sgi/libnurbs/interface/bezierEval.cc index a1bbbf52a78..d1014829b8e 100644 --- a/src/glu/sgi/libnurbs/interface/bezierEval.cc +++ b/src/glu/sgi/libnurbs/interface/bezierEval.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.14.1 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2.14.1 2003/11/21 15:49:25 keithw Exp $ */ #include <stdlib.h> @@ -43,6 +43,10 @@ #include <math.h> #include "bezierEval.h" +#ifdef __WATCOMC__ +#pragma warning 14 10 +#endif + #define TOLERANCE 0.0001 #ifndef MAX_ORDER @@ -88,7 +92,7 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride } } - + /*order = degree +1 >=1. */ @@ -109,7 +113,7 @@ void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int st buf[r][i][j] = (1-uprime)*buf[r-1][i][j] + uprime*buf[r-1][i+1][j]; } } - + for(j=0; j<dimension; j++) retpoint[j] = buf[order-1][0][j]; } @@ -135,10 +139,10 @@ void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int str } ctlptr += stride; } - + bezierCurveEval(u0, u1, order-1, (float*) buf, MAX_DIMENSION, dimension, u, retDer); } - + void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]) { int i,k,r; @@ -179,12 +183,12 @@ void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, fl bezierCurveEvalDerGen(vder, v0, v1, vorder, ctlpoints+ustride*i, vstride, dimension, v, newPoints[i]); } - + bezierCurveEvalDerGen(uder, u0, u1, uorder, (float *) newPoints, MAX_DIMENSION, dimension, u, ret); } -/*division by w is performed*/ +/*division by w is performed*/ void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]) { bezierSurfEvalDerGen(0, 0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, ret); @@ -192,7 +196,7 @@ void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vord ret[0] /= ret[3]; ret[1] /= ret[3]; ret[2] /= ret[3]; - } + } } void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[]) @@ -202,7 +206,7 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in assert(dimension>=3 && dimension <=4); bezierSurfEvalDerGen(1,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialU); bezierSurfEvalDerGen(0,1, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialV); - + if(dimension == 3){/*inhomogeneous*/ crossProduct(partialU, partialV, retNormal); @@ -215,11 +219,11 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in float newPartialU[MAX_DIMENSION]; float newPartialV[MAX_DIMENSION]; int i; - bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val); + bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val); for(i=0; i<=2; i++){ newPartialU[i] = partialU[i] * val[3] - val[i] * partialU[3]; - newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3]; + newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3]; } crossProduct(newPartialU, newPartialV, retNormal); normalize(retNormal); @@ -231,7 +235,7 @@ static void normalize(float vec[3]) { float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - if(size < TOLERANCE) + if(size < TOLERANCE) { #ifdef DEBUG fprintf(stderr, "Warning: in oglBSpline.c normal is 0\n"); @@ -244,7 +248,7 @@ static void normalize(float vec[3]) vec[2] = vec[2]/size; } } - + static void crossProduct(float x[3], float y[3], float ret[3]) { diff --git a/src/glu/sgi/libnurbs/interface/glcurveval.h b/src/glu/sgi/libnurbs/interface/glcurveval.h index 445dd368270..171c825ec48 100644 --- a/src/glu/sgi/libnurbs/interface/glcurveval.h +++ b/src/glu/sgi/libnurbs/interface/glcurveval.h @@ -35,8 +35,8 @@ /* * glcurveval.h * - * $Date: 2003/04/30 15:20:37 $ $Revision: 1.5 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.5 2003/04/30 15:20:37 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.5.2.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.5.2.1 2003/11/21 15:49:25 keithw Exp $ */ #ifndef __gluglcurveval_h_ @@ -72,7 +72,7 @@ typedef struct curveEvalMachine{ class OpenGLCurveEvaluator : public BasicCurveEvaluator { public: OpenGLCurveEvaluator(void); - ~OpenGLCurveEvaluator(void); + virtual ~OpenGLCurveEvaluator(void); void range1f(long, REAL *, REAL *); void domain1f(REAL, REAL); void addMap(CurveMap *); diff --git a/src/glu/sgi/libnurbs/interface/glrenderer.cc b/src/glu/sgi/libnurbs/interface/glrenderer.cc index 15bea9c212e..ba6de70c035 100644 --- a/src/glu/sgi/libnurbs/interface/glrenderer.cc +++ b/src/glu/sgi/libnurbs/interface/glrenderer.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ +** $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "gluos.h" @@ -99,7 +99,7 @@ GLUnurbs::GLUnurbs() //default autoloadmode is true autoloadmode = 1; - //default callbackFlag is 0 + //default callbackFlag is 0 callbackFlag = 0; errorCallback = NULL; @@ -127,8 +127,8 @@ GLUnurbs::errorHandler(int i) postError( gluError ); } -void -GLUnurbs::loadGLMatrices(void) +void +GLUnurbs::loadGLMatrices(void) { GLfloat vmat[4][4]; GLint viewport[4]; @@ -140,20 +140,20 @@ GLUnurbs::loadGLMatrices(void) } void -GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], +GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4]) { GLfloat vmat[4][4]; - multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, + multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, (const GLfloat (*)[4]) projMatrix); loadCullingMatrix((GLfloat (*)[4]) vmat); loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport); } /*-------------------------------------------------------------------------- - * grabGLMatrix + * grabGLMatrix *-------------------------------------------------------------------------- */ @@ -164,8 +164,8 @@ GLUnurbs::grabGLMatrix(GLfloat vmat[4][4]) ::glGetFloatv((GLenum) GL_MODELVIEW_MATRIX, (GLfloat *) &(m1[0][0])); ::glGetFloatv((GLenum) GL_PROJECTION_MATRIX, (GLfloat *) &(m2[0][0])); - multmatrix4d((GLfloat (*)[4]) vmat, - (GLfloat (*)[4]) m1, (GLfloat (*)[4]) m2); + multmatrix4d((GLfloat (*)[4]) vmat, + (const GLfloat (*)[4]) m1, (const GLfloat (*)[4]) m2); } //for object space tesselation: view independent @@ -180,27 +180,27 @@ GLUnurbs::setSamplingMatrixIdentity( void ) }; const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); const long cstride = 1; - - setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); } void -GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], +GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], const GLint viewport[4]) { /* rescale the mapping to correspond to pixels in x/y */ REAL xsize = 0.5 * (REAL) (viewport[2]); REAL ysize = 0.5 * (REAL) (viewport[3]); - + INREAL smat[4][4]; smat[0][0] = vmat[0][0] * xsize; smat[1][0] = vmat[1][0] * xsize; @@ -225,13 +225,13 @@ GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); const long cstride = 1; - setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); } @@ -263,14 +263,14 @@ GLUnurbs::loadCullingMatrix(GLfloat vmat[4][4]) const long rstride = sizeof(cmat[0]) / sizeof(cmat[0][0]); const long cstride = 1; - setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); //added for curves by zl - setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); } diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.cc b/src/glu/sgi/libnurbs/interface/glsurfeval.cc index 3f6ff87942e..679b13de4fd 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.cc +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.cc @@ -35,8 +35,8 @@ /* * glsurfeval.c++ * - * $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2 2001/07/16 15:46:42 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $ */ /* Polynomial Evaluator Interface */ @@ -58,14 +58,14 @@ /*#define NO_EVALUATION*/ //#define USE_LOD //for LOD test, have to turn on USE_LOD in insurfeval.c++ too - + /*for statistics*/ //#define STATISTICS #ifdef STATISTICS static int STAT_num_of_triangles=0; static int STAT_num_of_eval_vertices=0; static int STAT_num_of_quad_strips=0; -#endif +#endif /*for output triangles*/ /*#define OUTPUT_TRIANGLES*/ @@ -74,16 +74,16 @@ static int STAT_num_of_quad_strips=0; /*#define FOR_CHRIS*/ #ifdef FOR_CHRIS extern "C" { void evalUStripExt(int n_upper, REAL v_upper, REAL* upper_val, - int n_lower, REAL v_lower, REAL* lower_val);} + int n_lower, REAL v_lower, REAL* lower_val);} extern "C" { void evalVStripExt(int n_left, REAL u_left, REAL* left_val, - int n_right, REAL u_right, REAL* right_val); + int n_right, REAL u_right, REAL* right_val); } #endif /**************begin for LOD_eval_list***********/ -void OpenGLSurfaceEvaluator::LOD_eval_list(int level) +void OpenGLSurfaceEvaluator::LOD_eval_list(int level) { if(level == 0) LOD_eval_level = 1; @@ -98,8 +98,8 @@ void OpenGLSurfaceEvaluator::LOD_eval_list(int level) } -OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() -{ +OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() +{ int i; for (i=0; i<VERTEX_CACHE_SIZE; i++) { @@ -120,7 +120,7 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() global_uorder_BV = 0; global_vorder_BV = 0; global_baseData = NULL; - + global_bpm = NULL; output_triangles = 0; //don't output triangles by default @@ -161,8 +161,8 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() #endif } -OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator() -{ +OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator() +{ for (int ii= 0; ii< VERTEX_CACHE_SIZE; ii++) { delete vertexCache[ii]; vertexCache[ii]= 0; @@ -197,11 +197,11 @@ void OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, REAL v1) { #ifdef USE_INTERNAL_EVAL - inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv, + inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv, (REAL) v0, (REAL) v1); #else - if(output_triangles) + if(output_triangles) { global_grid_u0 = u0; global_grid_u1 = u1; @@ -211,7 +211,7 @@ OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, R global_grid_nv = nv; } else - glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv, + glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv, (GLdouble) v0, (GLdouble) v1); #endif @@ -225,7 +225,7 @@ OpenGLSurfaceEvaluator::polymode(long style) switch(style) { default: case N_MESHFILL: - + glPolygonMode((GLenum) GL_FRONT_AND_BACK, (GLenum) GL_FILL); break; case N_MESHLINE: @@ -361,11 +361,11 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i /* *the algorithm works by scanning from left to right. *leftMostV: the left most of the remaining verteces (on both upper and lower). - * it could an element of upperVerts or lowerVerts. - *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line - *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line + * it could an element of upperVerts or lowerVerts. + *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line + *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line */ - + /*initialize i,j,and leftMostV */ if(upper_val[0] <= lower_val[0]) @@ -385,140 +385,140 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i leftMostV[1] = v_lower; } - + /*the main loop. - *the invariance is that: - *at the beginning of each loop, the meaning of i,j,and leftMostV are + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and leftMostV are *maintained */ while(1) { if(i >= n_upper) /*case1: no more in upper*/ - { - if(j<n_lower-1) /*at least two vertices in lower*/ - { - bgntfan(); + { + if(j<n_lower-1) /*at least two vertices in lower*/ + { + bgntfan(); coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); -// glVertex3fv(leftMostXYZ); +// glVertex3fv(leftMostXYZ); - while(j<n_lower){ + while(j<n_lower){ coord2f(lower_val[j], v_lower); // glNormal3fv(lowerNormal[j]); // glVertex3fv(lowerXYZ[j]); j++; - } - endtfan(); - } - break; /*exit the main loop*/ - } + } + endtfan(); + } + break; /*exit the main loop*/ + } else if(j>= n_lower) /*case2: no more in lower*/ - { - if(i<n_upper-1) /*at least two vertices in upper*/ - { - bgntfan(); + { + if(i<n_upper-1) /*at least two vertices in upper*/ + { + bgntfan(); coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - - for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/ + + for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/ { coord2f(upper_val[k], v_upper); // glNormal3fv(upperNormal[k]); // glVertex3fv(upperXYZ[k]); } - endtfan(); - } - break; /*exit the main loop*/ - } + endtfan(); + } + break; /*exit the main loop*/ + } else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/ - { - if(upper_val[i] <= lower_val[j]) - { + { + if(upper_val[i] <= lower_val[j]) + { bgntfan(); coord2f(lower_val[j], v_lower); // glNormal3fv(lowerNormal[j]); // glVertex3fv(lowerXYZ[j]); - /*find the last k>=i such that - *upperverts[k][0] <= lowerverts[j][0] - */ - k=i; + /*find the last k>=i such that + *upperverts[k][0] <= lowerverts[j][0] + */ + k=i; - while(k<n_upper) - { - if(upper_val[k] > lower_val[j]) - break; - k++; + while(k<n_upper) + { + if(upper_val[k] > lower_val[j]) + break; + k++; - } - k--; + } + k--; - for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ - { + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { coord2f(upper_val[l], v_upper); // glNormal3fv(upperNormal[l]); // glVertex3fv(upperXYZ[l]); - } + } coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - endtfan(); + endtfan(); - /*update i and leftMostV for next loop - */ - i = k+1; + /*update i and leftMostV for next loop + */ + i = k+1; leftMostV[0] = upper_val[k]; leftMostV[1] = v_upper; // leftMostNormal = upperNormal[k]; // leftMostXYZ = upperXYZ[k]; - } - else /*upperVerts[i][0] > lowerVerts[j][0]*/ - { + } + else /*upperVerts[i][0] > lowerVerts[j][0]*/ + { bgntfan(); coord2f(upper_val[i], v_upper); // glNormal3fv(upperNormal[i]); // glVertex3fv(upperXYZ[i]); - + coord2f(leftMostV[0], leftMostV[1]); -// glNormal3fv(leftMostNormal); +// glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - - - /*find the last k>=j such that - *lowerverts[k][0] < upperverts[i][0] - */ - k=j; - while(k< n_lower) - { - if(lower_val[k] >= upper_val[i]) - break; + + + /*find the last k>=j such that + *lowerverts[k][0] < upperverts[i][0] + */ + k=j; + while(k< n_lower) + { + if(lower_val[k] >= upper_val[i]) + break; coord2f(lower_val[k], v_lower); // glNormal3fv(lowerNormal[k]); // glVertex3fv(lowerXYZ[k]); - k++; - } - endtfan(); + k++; + } + endtfan(); - /*update j and leftMostV for next loop - */ - j=k; + /*update j and leftMostV for next loop + */ + j=k; leftMostV[0] = lower_val[j-1]; leftMostV[1] = v_lower; // leftMostNormal = lowerNormal[j-1]; // leftMostXYZ = lowerXYZ[j-1]; - } - } + } + } } - //clean up + //clean up // free(upperXYZ); // free(lowerXYZ); // free(upperNormal); @@ -526,7 +526,7 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i #endif } - + void OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val) @@ -548,11 +548,11 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int /* *the algorithm works by scanning from bot to top. *botMostV: the bot most of the remaining verteces (on both left and right). - * it could an element of leftVerts or rightVerts. - *i: leftVerts[i] is the first vertex to the top of botMostV on left line + * it could an element of leftVerts or rightVerts. + *i: leftVerts[i] is the first vertex to the top of botMostV on left line *j: rightVerts[j] is the first vertex to the top of botMostV on rightline */ - + /*initialize i,j,and botMostV */ if(left_val[0] <= right_val[0]) @@ -573,142 +573,142 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int } /*the main loop. - *the invariance is that: - *at the beginning of each loop, the meaning of i,j,and botMostV are + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and botMostV are *maintained */ while(1) { if(i >= n_left) /*case1: no more in left*/ - { - if(j<n_right-1) /*at least two vertices in right*/ - { - bgntfan(); + { + if(j<n_right-1) /*at least two vertices in right*/ + { + bgntfan(); coord2f(botMostV[0], botMostV[1]); - while(j<n_right){ + while(j<n_right){ coord2f(u_right, right_val[j]); // glNormal3fv(rightNormal[j]); // glVertex3fv(rightXYZ[j]); j++; - } - endtfan(); - } - break; /*exit the main loop*/ - } + } + endtfan(); + } + break; /*exit the main loop*/ + } else if(j>= n_right) /*case2: no more in right*/ - { - if(i<n_left-1) /*at least two vertices in left*/ - { - bgntfan(); - coord2f(botMostV[0], botMostV[1]); + { + if(i<n_left-1) /*at least two vertices in left*/ + { + bgntfan(); + coord2f(botMostV[0], botMostV[1]); // glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - - for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/ + + for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/ { coord2f(u_left, left_val[k]); // glNormal3fv(leftNormal[k]); // glVertex3fv(leftXYZ[k]); } - endtfan(); - } - break; /*exit the main loop*/ - } + endtfan(); + } + break; /*exit the main loop*/ + } else /* case3: neither is empty, plus the botMostV, there is at least one triangle to output*/ - { - if(left_val[i] <= right_val[j]) - { + { + if(left_val[i] <= right_val[j]) + { bgntfan(); coord2f(u_right, right_val[j]); // glNormal3fv(rightNormal[j]); // glVertex3fv(rightXYZ[j]); - /*find the last k>=i such that - *leftverts[k][0] <= rightverts[j][0] - */ - k=i; + /*find the last k>=i such that + *leftverts[k][0] <= rightverts[j][0] + */ + k=i; - while(k<n_left) - { - if(left_val[k] > right_val[j]) - break; - k++; + while(k<n_left) + { + if(left_val[k] > right_val[j]) + break; + k++; - } - k--; + } + k--; - for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ - { + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { coord2f(u_left, left_val[l]); // glNormal3fv(leftNormal[l]); // glVertex3fv(leftXYZ[l]); - } + } coord2f(botMostV[0], botMostV[1]); // glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - endtfan(); + endtfan(); - /*update i and botMostV for next loop - */ - i = k+1; + /*update i and botMostV for next loop + */ + i = k+1; botMostV[0] = u_left; botMostV[1] = left_val[k]; // botMostNormal = leftNormal[k]; // botMostXYZ = leftXYZ[k]; - } - else /*left_val[i] > right_val[j])*/ - { + } + else /*left_val[i] > right_val[j])*/ + { bgntfan(); coord2f(u_left, left_val[i]); // glNormal3fv(leftNormal[i]); // glVertex3fv(leftXYZ[i]); - + coord2f(botMostV[0], botMostV[1]); -// glNormal3fv(botMostNormal); +// glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - - - /*find the last k>=j such that - *rightverts[k][0] < leftverts[i][0] - */ - k=j; - while(k< n_right) - { - if(right_val[k] >= left_val[i]) - break; + + + /*find the last k>=j such that + *rightverts[k][0] < leftverts[i][0] + */ + k=j; + while(k< n_right) + { + if(right_val[k] >= left_val[i]) + break; coord2f(u_right, right_val[k]); // glNormal3fv(rightNormal[k]); // glVertex3fv(rightXYZ[k]); - k++; - } - endtfan(); + k++; + } + endtfan(); - /*update j and botMostV for next loop - */ - j=k; + /*update j and botMostV for next loop + */ + j=k; botMostV[0] = u_right; botMostV[1] = right_val[j-1]; // botMostNormal = rightNormal[j-1]; // botMostXYZ = rightXYZ[j-1]; - } - } + } + } } - //clean up + //clean up // free(leftXYZ); // free(leftNormal); // free(rightXYZ); // free(rightNormal); #endif } - + void OpenGLSurfaceEvaluator::bgnqstrip(void) @@ -742,25 +742,25 @@ OpenGLSurfaceEvaluator::bgnmap2f(long) { if(output_triangles) { - /*deallocate the space which may has been + /*deallocate the space which may has been *allocated by global_bpm previously */ if(global_bpm != NULL) { bezierPatchMeshListDelete(global_bpm); global_bpm = NULL; } - + /* auto_normal_flag = 1; //always output normal in callback mode. - //we could have used the following code, - //but Inspector doesn't have gl context - //before it calls tessellator. - //this way is temporary. + //we could have used the following code, + //but Inspector doesn't have gl context + //before it calls tessellator. + //this way is temporary. */ //NEWCALLBACK //if one of the two normal callback functions are set, - //then set + //then set if(normalCallBackN != NULL || normalCallBackData != NULL) auto_normal_flag = 1; @@ -777,19 +777,19 @@ OpenGLSurfaceEvaluator::bgnmap2f(long) if(glIsEnabled(GL_AUTO_NORMAL) == GL_TRUE) auto_normal_flag = 1; else if (callback_auto_normal == 1) - auto_normal_flag = 1; + auto_normal_flag = 1; else auto_normal_flag = 0; */ //NEWCALLBACK: no need to worry about gl states when gling clalback } - else + else { glPushAttrib((GLbitfield) GL_EVAL_BIT); - + /*to avoid side effect, we restor the opengl state for GL_POLYGON_MODE - */ + */ glGetIntegerv(GL_POLYGON_MODE, gl_polygon_mode); } @@ -806,17 +806,17 @@ OpenGLSurfaceEvaluator::endmap2f(void) if(output_triangles) { //bezierPatchMeshListDelDeg(global_bpm); - + // bezierPatchMeshListEval(global_bpm); //surfcount++; //printf("surfcount=%i\n", surfcount); //if(surfcount == 8) exit(0); - + inBPMListEvalEM(global_bpm); - - - + + + /* global_bpm = bezierPatchMeshListReverse(global_bpm); { @@ -837,7 +837,7 @@ OpenGLSurfaceEvaluator::endmap2f(void) //bezierPatchMeshListPrint(global_bpm); //bezierPatchMeshListDraw(global_bpm); -// printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm)); +// printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm)); #ifdef USE_LOD #else @@ -873,20 +873,20 @@ glPopAttrib(); void OpenGLSurfaceEvaluator::map2f( long _type, - REAL _ulower, /* u lower domain coord */ + REAL _ulower, /* u lower domain coord */ REAL _uupper, /* u upper domain coord */ long _ustride, /* interpoint distance */ long _uorder, /* parametric order */ - REAL _vlower, /* v lower domain coord */ - REAL _vupper, /* v upper domain coord */ + REAL _vlower, /* v lower domain coord */ + REAL _vupper, /* v upper domain coord */ long _vstride, /* interpoint distance */ long _vorder, /* parametric order */ - REAL *pts) /* control points */ + REAL *pts) /* control points */ { #ifdef USE_INTERNAL_EVAL - inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, - (int) _ustride, (int) _uorder, (REAL) _vlower, - (REAL) _vupper, (int) _vstride, (int) _vorder, + inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, + (int) _ustride, (int) _uorder, (REAL) _vlower, + (REAL) _vupper, (int) _vstride, (int) _vorder, (REAL *) pts); #else @@ -897,7 +897,7 @@ OpenGLSurfaceEvaluator::map2f( if(global_bpm == NULL) global_bpm = bezierPatchMeshMake2(10,10); if( - (global_bpm->bpatch == NULL && + (global_bpm->bpatch == NULL && (_type == GL_MAP2_VERTEX_3 || _type == GL_MAP2_VERTEX_4)) || (global_bpm->bpatch_normal == NULL && @@ -922,7 +922,7 @@ OpenGLSurfaceEvaluator::map2f( global_bpm = bezierPatchMeshListInsert(global_bpm, temp); /* - global_bpm = bezierPatchMeshListInsert(global_bpm, + global_bpm = bezierPatchMeshListInsert(global_bpm, bezierPatchMeshMake( (int) _type, _ulower, _uupper,(int) _ustride, (int) _uorder, _vlower, _vupper, (int) _vstride, (int) _vorder, pts, 10, 10)); */ @@ -930,12 +930,12 @@ OpenGLSurfaceEvaluator::map2f( } else /*not output triangles*/ { - glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, - (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, - (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, + glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, + (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, + (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, (const GLfloat *) pts); } - + #endif } @@ -976,18 +976,18 @@ if(output_triangles) if(global_grid_nu == 0 || global_grid_nv == 0) return; /*no points need to be output*/ du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; - dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; - + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + if(global_grid_nu >= global_grid_nv){ for(i=umin; i<umax; i++){ REAL u1 = (i==global_grid_nu)? global_grid_u1:(global_grid_u0 + i*du); REAL u2 = ((i+1) == global_grid_nu)? global_grid_u1: (global_grid_u0+(i+1)*du); - + bgnqstrip(); for(j=vmax; j>=vmin; j--){ REAL v1 = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv); - + coord2f(u1, v1); coord2f(u2, v1); } @@ -999,10 +999,10 @@ if(output_triangles) for(i=vmin; i<vmax; i++){ REAL v1 = (i==global_grid_nv)? global_grid_v1:(global_grid_v0 + i*dv); REAL v2 = ((i+1) == global_grid_nv)? global_grid_v1: (global_grid_v0+(i+1)*dv); - + bgnqstrip(); for(j=umax; j>=umin; j--){ - REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); + REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); coord2f(u1, v2); coord2f(u1, v1); } @@ -1016,15 +1016,15 @@ else switch(style) { default: case N_MESHFILL: - glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; case N_MESHLINE: - glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; case N_MESHPOINT: - glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; } @@ -1171,7 +1171,7 @@ return; if (vcount == 2) { vertexCache[0]->invoke(this); vertexCache[1]->invoke(this); - coord2f(u,v); + coord2f(u,v); } else { vcount++; diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.h b/src/glu/sgi/libnurbs/interface/glsurfeval.h index 8f95e2e48ec..9eab22c834e 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.h +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.h @@ -35,8 +35,8 @@ /* * glsurfeval.h * - * $Date: 2001/08/07 17:34:11 $ $Revision: 1.4 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.4 2001/08/07 17:34:11 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.4.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.4.16.1 2003/11/21 15:49:25 keithw Exp $ */ #ifndef __gluglsurfeval_h_ @@ -106,7 +106,7 @@ private: class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator { public: OpenGLSurfaceEvaluator(); - ~OpenGLSurfaceEvaluator( void ); + virtual ~OpenGLSurfaceEvaluator( void ); void polymode( long style ); void range2f( long, REAL *, REAL * ); void domain2f( REAL, REAL, REAL, REAL ); diff --git a/src/glu/sgi/libnurbs/internals/arc.cc b/src/glu/sgi/libnurbs/internals/arc.cc index 845f05fab92..c4d47a76be7 100644 --- a/src/glu/sgi/libnurbs/internals/arc.cc +++ b/src/glu/sgi/libnurbs/internals/arc.cc @@ -35,8 +35,8 @@ /* * arc.c++ * - * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.12.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.2.12.1 2003/11/21 15:49:25 keithw Exp $ */ #include <stdio.h> @@ -50,11 +50,11 @@ #include "simplemath.h" /* local preprocessor definitions */ -#define ZERO 0.00001/*0.000001*/ +#define ZERO 0.00001/*0.000001*/ -const int Arc::bezier_tag = (1<<13); -const int Arc::arc_tag = (1<<3); -const int Arc::tail_tag = (1<<6); +const int Arc::bezier_tag = (1<<13); +const int Arc::arc_tag = (1<<3); +const int Arc::tail_tag = (1<<6); /*-------------------------------------------------------------------------- * makeSide - attach a pwl arc to an arc and mark it as a border arc @@ -72,7 +72,7 @@ Arc::makeSide( PwlArc *pwl, arc_side side ) clearbezier(); setside( side ); } - + /*-------------------------------------------------------------------------- * numpts - count number of points on arc loop @@ -100,7 +100,7 @@ void Arc::markverts( void ) { Arc_ptr jarc = this; - + do { TrimVertex *p = jarc->pwlArc->pts; for( int i=0; i<jarc->pwlArc->npts; i++ ) @@ -125,22 +125,22 @@ Arc::getextrema( Arc_ptr extrema[4] ) botpt = toppt = this->tail()[1]; for( Arc_ptr jarc = this->next; jarc != this; jarc = jarc->next ) { - if ( jarc->tail()[0] < leftpt || + if ( jarc->tail()[0] < leftpt || (jarc->tail()[0] <= leftpt && jarc->rhead()[0]<=leftpt)) { leftpt = jarc->pwlArc->pts->param[0]; extrema[1] = jarc; } - if ( jarc->tail()[0] > rightpt || + if ( jarc->tail()[0] > rightpt || (jarc->tail()[0] >= rightpt && jarc->rhead()[0] >= rightpt)) { rightpt = jarc->pwlArc->pts->param[0]; extrema[3] = jarc; } - if ( jarc->tail()[1] < botpt || - (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) { + if ( jarc->tail()[1] < botpt || + (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) { botpt = jarc->pwlArc->pts->param[1]; extrema[2] = jarc; } - if ( jarc->tail()[1] > toppt || + if ( jarc->tail()[1] > toppt || (jarc->tail()[1] >= toppt && jarc->rhead()[1] >= toppt)) { toppt = jarc->pwlArc->pts->param[1]; extrema[0] = jarc; @@ -160,7 +160,7 @@ Arc::show() #ifndef NDEBUG dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts ); for( int i = 0; i < pwlArc->npts; i++ ) { - dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0], + dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0], pwlArc->pts[i].param[1] ); } #endif @@ -176,13 +176,6 @@ Arc::print( void ) { Arc_ptr jarc = this; - if( ! this ) { -#ifndef NDEBUG - dprintf( "\n\nEMPTY TRIM\n\n" ); -#endif - return; - } - #ifndef NDEBUG dprintf( "BGNTRIM\n" ); #endif @@ -217,10 +210,10 @@ Arc::isDisconnected( void ) #endif return 1; } else { - /* average two points together */ - p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5; - p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5; - return 0; + /* average two points together */ + p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5; + p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5; + return 0; } } @@ -251,29 +244,29 @@ Arc::check( void ) do { assert( (jarc->pwlArc != 0) || (jarc->bezierArc != 0) ); - if (jarc->prev == 0 || jarc->next == 0) { + if (jarc->prev == 0 || jarc->next == 0) { #ifndef NDEBUG dprintf( "checkjarc:null next/prev pointer\n"); jarc->print( ); #endif return 0; - } + } - if (jarc->next->prev != jarc) { + if (jarc->next->prev != jarc) { #ifndef NDEBUG dprintf( "checkjarc: pointer linkage screwed up\n"); jarc->print( ); #endif return 0; - } + } - if( jarc->pwlArc ) { + if( jarc->pwlArc ) { #ifndef NDEBUG assert( jarc->pwlArc->npts >= 1 ); assert( jarc->pwlArc->npts < 100000 ); /* for( int i=0; i < jarc->pwlArc->npts-1; i++ ) - assert( neq_vert( jarc->pwlArc->pts[i].param, + assert( neq_vert( jarc->pwlArc->pts[i].param, jarc->pwlArc->pts[i+1].param) ); */ #endif @@ -287,7 +280,7 @@ Arc::check( void ) return 0; } if( jarc->tail()[0] != jarc->prev->rhead()[0] ) { - + #ifndef NDEBUG dprintf( "checkjarc: geometric linkage screwed up 2\n"); jarc->prev->show(); @@ -316,13 +309,13 @@ Arc::check( void ) } if( jarc->isbezier() ) { assert( jarc->pwlArc->npts == 2 ); - assert( (jarc->pwlArc->pts[0].param[0] == \ - jarc->pwlArc->pts[1].param[0]) ||\ - (jarc->pwlArc->pts[0].param[1] == \ - jarc->pwlArc->pts[1].param[1]) ); + assert( (jarc->pwlArc->pts[0].param[0] == \ + jarc->pwlArc->pts[1].param[0]) ||\ + (jarc->pwlArc->pts[0].param[1] == \ + jarc->pwlArc->pts[1].param[1]) ); } } - jarc = jarc->next; + jarc = jarc->next; } while (jarc != this); return 1; } @@ -347,9 +340,9 @@ Arc::append( Arc_ptr jarc ) if( jarc != 0 ) { next = jarc->next; prev = jarc; - next->prev = prev->next = this; + next->prev = prev->next = this; } else { - next = prev = this; + next = prev = this; } return this; } diff --git a/src/glu/sgi/libnurbs/internals/arctess.cc b/src/glu/sgi/libnurbs/internals/arctess.cc index b3222a88d76..2678a28e9dd 100644 --- a/src/glu/sgi/libnurbs/internals/arctess.cc +++ b/src/glu/sgi/libnurbs/internals/arctess.cc @@ -35,8 +35,8 @@ /* * arctessellator.c++ * - * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.12.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.2.12.1 2003/11/21 15:49:25 keithw Exp $ */ #include "glimports.h" @@ -59,7 +59,7 @@ */ ArcTessellator::ArcTessellator( TrimVertexPool& t, Pool& p ) - : trimvertexpool(t), pwlarcpool(p) + : pwlarcpool(p), trimvertexpool(t) { } diff --git a/src/glu/sgi/libnurbs/internals/basiccrveval.cc b/src/glu/sgi/libnurbs/internals/basiccrveval.cc index 0d3d5aa8d38..85207739faf 100644 --- a/src/glu/sgi/libnurbs/internals/basiccrveval.cc +++ b/src/glu/sgi/libnurbs/internals/basiccrveval.cc @@ -35,15 +35,15 @@ /* * basiccrveval.c++ * - * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "mystdio.h" #include "types.h" #include "basiccrveval.h" -void +void BasicCurveEvaluator::domain1f( REAL, REAL ) { #ifndef NDEBUG @@ -51,15 +51,15 @@ BasicCurveEvaluator::domain1f( REAL, REAL ) #endif } -void -BasicCurveEvaluator::range1f( long type, REAL *, REAL * ) +void +BasicCurveEvaluator::range1f( long , REAL *, REAL * ) { #ifndef NDEBUG dprintf( "range1f\n" ); #endif } -void +void BasicCurveEvaluator::enable( long ) { #ifndef NDEBUG @@ -67,7 +67,7 @@ BasicCurveEvaluator::enable( long ) #endif } -void +void BasicCurveEvaluator::disable( long ) { #ifndef NDEBUG @@ -75,7 +75,7 @@ BasicCurveEvaluator::disable( long ) #endif } -void +void BasicCurveEvaluator::bgnmap1f( long ) { #ifndef NDEBUG @@ -83,7 +83,7 @@ BasicCurveEvaluator::bgnmap1f( long ) #endif } -void +void BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * ) { #ifndef NDEBUG @@ -91,7 +91,7 @@ BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * ) #endif } -void +void BasicCurveEvaluator::mapgrid1f( long, REAL, REAL ) { #ifndef NDEBUG @@ -99,7 +99,7 @@ BasicCurveEvaluator::mapgrid1f( long, REAL, REAL ) #endif } -void +void BasicCurveEvaluator::mapmesh1f( long, long, long ) { #ifndef NDEBUG @@ -107,7 +107,7 @@ BasicCurveEvaluator::mapmesh1f( long, long, long ) #endif } -void +void BasicCurveEvaluator::evalcoord1f( long, REAL ) { #ifndef NDEBUG @@ -115,7 +115,7 @@ BasicCurveEvaluator::evalcoord1f( long, REAL ) #endif } -void +void BasicCurveEvaluator::endmap1f( void ) { #ifndef NDEBUG @@ -123,7 +123,7 @@ BasicCurveEvaluator::endmap1f( void ) #endif } -void +void BasicCurveEvaluator::bgnline( void ) { #ifndef NDEBUG @@ -131,7 +131,7 @@ BasicCurveEvaluator::bgnline( void ) #endif } -void +void BasicCurveEvaluator::endline( void ) { #ifndef NDEBUG diff --git a/src/glu/sgi/libnurbs/internals/basicsurfeval.cc b/src/glu/sgi/libnurbs/internals/basicsurfeval.cc index 0ade6fa8f7d..41aa84f91dc 100644 --- a/src/glu/sgi/libnurbs/internals/basicsurfeval.cc +++ b/src/glu/sgi/libnurbs/internals/basicsurfeval.cc @@ -35,15 +35,19 @@ /* * basicsurfaceevaluator.c++ * - * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "mystdio.h" #include "types.h" #include "basicsurfeval.h" -void +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + +void BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL ) { #ifndef NDEBUG @@ -51,7 +55,7 @@ BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::polymode( long ) { #ifndef NDEBUG @@ -63,12 +67,12 @@ void BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to ) { #ifndef NDEBUG - dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", + dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", type, from[0], from[1], to[0], to[1] ); #endif } -void +void BasicSurfaceEvaluator::enable( long ) { #ifndef NDEBUG @@ -76,7 +80,7 @@ BasicSurfaceEvaluator::enable( long ) #endif } -void +void BasicSurfaceEvaluator::disable( long ) { #ifndef NDEBUG @@ -84,7 +88,7 @@ BasicSurfaceEvaluator::disable( long ) #endif } -void +void BasicSurfaceEvaluator::bgnmap2f( long ) { #ifndef NDEBUG @@ -92,7 +96,7 @@ BasicSurfaceEvaluator::bgnmap2f( long ) #endif } -void +void BasicSurfaceEvaluator::endmap2f( void ) { #ifndef NDEBUG @@ -100,8 +104,8 @@ BasicSurfaceEvaluator::endmap2f( void ) #endif } -void -BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, +void +BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, REAL, REAL, long, long, REAL * ) { @@ -110,7 +114,7 @@ BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, #endif } -void +void BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL ) { #ifndef NDEBUG @@ -118,7 +122,7 @@ BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long ) { #ifndef NDEBUG @@ -126,7 +130,7 @@ BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long ) #endif } -void +void BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL ) { #ifndef NDEBUG @@ -134,7 +138,7 @@ BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::evalpoint2i( long, long ) { #ifndef NDEBUG @@ -142,7 +146,7 @@ BasicSurfaceEvaluator::evalpoint2i( long, long ) #endif } -void +void BasicSurfaceEvaluator::bgnline( void ) { #ifndef NDEBUG @@ -150,7 +154,7 @@ BasicSurfaceEvaluator::bgnline( void ) #endif } -void +void BasicSurfaceEvaluator::endline( void ) { #ifndef NDEBUG @@ -158,7 +162,7 @@ BasicSurfaceEvaluator::endline( void ) #endif } -void +void BasicSurfaceEvaluator::bgnclosedline( void ) { #ifndef NDEBUG @@ -166,7 +170,7 @@ BasicSurfaceEvaluator::bgnclosedline( void ) #endif } -void +void BasicSurfaceEvaluator::endclosedline( void ) { #ifndef NDEBUG @@ -174,7 +178,7 @@ BasicSurfaceEvaluator::endclosedline( void ) #endif } -void +void BasicSurfaceEvaluator::bgntfan( void ) { #ifndef NDEBUG @@ -182,13 +186,13 @@ BasicSurfaceEvaluator::bgntfan( void ) #endif } -void +void BasicSurfaceEvaluator::endtfan( void ) { } -void +void BasicSurfaceEvaluator::bgntmesh( void ) { #ifndef NDEBUG @@ -196,7 +200,7 @@ BasicSurfaceEvaluator::bgntmesh( void ) #endif } -void +void BasicSurfaceEvaluator::swaptmesh( void ) { #ifndef NDEBUG @@ -204,7 +208,7 @@ BasicSurfaceEvaluator::swaptmesh( void ) #endif } -void +void BasicSurfaceEvaluator::endtmesh( void ) { #ifndef NDEBUG @@ -212,7 +216,7 @@ BasicSurfaceEvaluator::endtmesh( void ) #endif } -void +void BasicSurfaceEvaluator::bgnqstrip( void ) { #ifndef NDEBUG @@ -220,7 +224,7 @@ BasicSurfaceEvaluator::bgnqstrip( void ) #endif } -void +void BasicSurfaceEvaluator::endqstrip( void ) { #ifndef NDEBUG diff --git a/src/glu/sgi/libnurbs/internals/coveandtiler.cc b/src/glu/sgi/libnurbs/internals/coveandtiler.cc index 61ca3b8f70f..60ed5298705 100644 --- a/src/glu/sgi/libnurbs/internals/coveandtiler.cc +++ b/src/glu/sgi/libnurbs/internals/coveandtiler.cc @@ -35,8 +35,8 @@ /* * coveandtiler.c++ * - * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "glimports.h" @@ -52,7 +52,7 @@ const int CoveAndTiler::MAXSTRIPSIZE = 1000; CoveAndTiler::CoveAndTiler( Backend& b ) - : backend( b ) + : backend( b ) { } CoveAndTiler::~CoveAndTiler( void ) @@ -76,19 +76,19 @@ CoveAndTiler::output( GridTrimVertex& g ) backend.tmeshvert( &g ); } -void +void CoveAndTiler::coveAndTile( void ) { long ustart = (top.ustart >= bot.ustart) ? top.ustart : bot.ustart; - long uend = (top.uend <= bot.uend) ? top.uend : bot.uend; + long uend = (top.uend <= bot.uend) ? top.uend : bot.uend; if( ustart <= uend ) { tile( bot.vindex, ustart, uend ); - if( top.ustart >= bot.ustart ) + if( top.ustart >= bot.ustart ) coveUpperLeft(); - else + else coveLowerLeft(); - - if( top.uend <= bot.uend ) + + if( top.uend <= bot.uend ) coveUpperRight(); else coveLowerRight(); @@ -126,7 +126,7 @@ CoveAndTiler::coveAndTile( void ) } else { tllv.set( bot.ustart-1, top.vindex ); } - coveLowerLeftNoGrid( tl ); + coveLowerLeftNoGrid( tl ); } TrimVertex brv, trv, *br, *tr; @@ -158,7 +158,7 @@ CoveAndTiler::coveAndTile( void ) br = rl; brrv.set( rl ); if( rf->param[0] < uarray.uarray[bot.uend+1] ) { - assert( rf->param[0] >= uarray.uarray[bot.uend] ); + assert( rf->param[0] >= uarray.uarray[bot.uend] ); trrv.set( rf ); } else { trrv.set( bot.uend+1, top.vindex ); @@ -179,7 +179,7 @@ CoveAndTiler::coveAndTile( void ) } } -void +void CoveAndTiler::tile( long vindex, long ustart, long uend ) { long numsteps = uend - ustart; @@ -195,7 +195,7 @@ CoveAndTiler::tile( long vindex, long ustart, long uend ) } } -void +void CoveAndTiler::coveUpperRight( void ) { GridVertex tgv( top.uend, top.vindex ); @@ -207,7 +207,7 @@ CoveAndTiler::coveUpperRight( void ) output( tgv ); backend.swaptmesh(); output( gv ); - coveUR(); + coveUR(); backend.endtmesh(); } @@ -215,15 +215,15 @@ void CoveAndTiler::coveUpperRightNoGrid( TrimVertex* br ) { backend.bgntmesh( "coveUpperRight" ); - output( right.first() ); + output( right.first() ); output( right.next() ); backend.swaptmesh(); output( br ); - coveUR(); + coveUR(); backend.endtmesh(); } -void +void CoveAndTiler::coveUR( ) { GridVertex gv( top.uend, bot.vindex ); @@ -238,7 +238,7 @@ CoveAndTiler::coveUR( ) backend.swaptmesh(); } } else while( 1 ) { - if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { output( vert ); backend.swaptmesh(); vert = right.next(); @@ -250,7 +250,7 @@ CoveAndTiler::coveUR( ) for( ; vert; vert = right.next() ) { output( vert ); backend.swaptmesh(); - } + } break; } } @@ -269,7 +269,7 @@ CoveAndTiler::coveUpperLeft( void ) output( left.next() ); output( gv ); backend.swaptmesh(); - coveUL(); + coveUL(); backend.endtmesh(); } @@ -277,15 +277,15 @@ void CoveAndTiler::coveUpperLeftNoGrid( TrimVertex* bl ) { backend.bgntmesh( "coveUpperLeftNoGrid" ); - output( left.first() ); + output( left.first() ); output( left.next() ); output( bl ); backend.swaptmesh(); - coveUL(); + coveUL(); backend.endtmesh(); } -void +void CoveAndTiler::coveUL() { GridVertex gv( top.ustart, bot.vindex ); @@ -318,7 +318,7 @@ CoveAndTiler::coveUL() } } -void +void CoveAndTiler::coveLowerLeft( void ) { GridVertex bgv( bot.ustart, bot.vindex ); @@ -330,7 +330,7 @@ CoveAndTiler::coveLowerLeft( void ) output( bgv ); backend.swaptmesh(); output( gv ); - coveLL(); + coveLL(); backend.endtmesh(); } @@ -338,15 +338,15 @@ void CoveAndTiler::coveLowerLeftNoGrid( TrimVertex* tl ) { backend.bgntmesh( "coveLowerLeft" ); - output( left.last() ); + output( left.last() ); output( left.prev() ); backend.swaptmesh(); output( tl ); - coveLL( ); + coveLL( ); backend.endtmesh(); } -void +void CoveAndTiler::coveLL() { GridVertex gv( bot.ustart, top.vindex ); @@ -360,7 +360,7 @@ CoveAndTiler::coveLL() backend.swaptmesh(); } } else while( 1 ) { - if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){ + if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){ output( vert ); backend.swaptmesh(); vert = left.prev(); @@ -369,29 +369,29 @@ CoveAndTiler::coveLL() backend.swaptmesh(); output( gv ); if( gv.prevu() == top.ustart ) { - for( ; vert; vert = left.prev() ) { + for( ; vert; vert = left.prev() ) { output( vert ); backend.swaptmesh(); - } - break; + } + break; } } } } -void +void CoveAndTiler::coveLowerRight( void ) { GridVertex bgv( bot.uend, bot.vindex ); GridVertex gv( bot.uend, top.vindex ); right.last(); - backend.bgntmesh( "coveLowerRight" ); + backend.bgntmesh( "coveLowerRight" ); output( bgv ); output( right.prev() ); output( gv ); backend.swaptmesh(); - coveLR(); + coveLR(); backend.endtmesh( ); } @@ -399,15 +399,15 @@ void CoveAndTiler::coveLowerRightNoGrid( TrimVertex* tr ) { backend.bgntmesh( "coveLowerRIght" ); - output( right.last() ); + output( right.last() ); output( right.prev() ); output( tr ); backend.swaptmesh(); - coveLR(); + coveLR(); backend.endtmesh(); } -void +void CoveAndTiler::coveLR( ) { GridVertex gv( bot.uend, top.vindex ); @@ -421,7 +421,7 @@ CoveAndTiler::coveLR( ) output( vert ); } } else while( 1 ) { - if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { backend.swaptmesh(); output( vert ); vert = right.prev(); @@ -430,11 +430,11 @@ CoveAndTiler::coveLR( ) output( gv ); backend.swaptmesh(); if( gv.nextu() == top.uend ) { - for( ; vert; vert = right.prev() ) { + for( ; vert; vert = right.prev() ) { backend.swaptmesh(); output( vert ); - } - break; + } + break; } } } diff --git a/src/glu/sgi/libnurbs/internals/knotvector.cc b/src/glu/sgi/libnurbs/internals/knotvector.cc index b48efbd4bfa..eb7b456bc92 100644 --- a/src/glu/sgi/libnurbs/internals/knotvector.cc +++ b/src/glu/sgi/libnurbs/internals/knotvector.cc @@ -35,8 +35,8 @@ /* * knotvector.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "glimports.h" @@ -45,17 +45,20 @@ #include "knotvector.h" #include "defines.h" +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knotlist ) { - knotcount = _knotcount; - stride = _stride; - order = _order; + knotcount = _knotcount; + stride = _stride; + order = _order; knotlist = new Knot[_knotcount]; assert( knotlist != 0 ); for( int i = 0; i != _knotcount; i++ ) - knotlist[i] = (Knot) _knotlist[i]; + knotlist[i] = (Knot) _knotlist[i]; } Knotvector::Knotvector( void ) @@ -70,7 +73,7 @@ Knotvector::~Knotvector( void ) int Knotvector::validate( void ) { - /* kindex is used as an array index so subtract one first, + /* kindex is used as an array index so subtract one first, * this propagates throughout the code so study carefully */ long kindex = knotcount-1; @@ -85,7 +88,7 @@ int Knotvector::validate( void ) } if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) { - // valid knot range is empty + // valid knot range is empty return( 3 ); } @@ -94,33 +97,33 @@ int Knotvector::validate( void ) // decreasing knot sequence return( 4 ); } - + /* check for valid multiplicity */ /* kindex is currently the index of the last knot. * In the next loop it is decremented to ignore the last knot - * and the loop stops when kindex is 2 so as to ignore the first - * knot as well. These knots are not used in computing - * knot multiplicities. + * and the loop stops when kindex is 2 so as to ignore the first + * knot as well. These knots are not used in computing + * knot multiplicities. */ long multi = 1; for( ; kindex >= 1; kindex-- ) { if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) { - multi++; + multi++; continue; - } + } if ( multi > order ) { - // knot multiplicity greater than order of spline + // knot multiplicity greater than order of spline return( 5 ); - } + } multi = 1; } if ( multi > order ) { - // knot multiplicity greater than order of spline + // knot multiplicity greater than order of spline return( 5 ); - } + } return 0; } @@ -128,7 +131,7 @@ int Knotvector::validate( void ) void Knotvector::show( char *msg ) { #ifndef NDEBUG - dprintf( "%s\n", msg ); + dprintf( "%s\n", msg ); dprintf( "order = %ld, count = %ld\n", order, knotcount ); for( int i=0; i<knotcount; i++ ) diff --git a/src/glu/sgi/libnurbs/internals/mymath.h b/src/glu/sgi/libnurbs/internals/mymath.h index 70138321152..8ad25db622e 100644 --- a/src/glu/sgi/libnurbs/internals/mymath.h +++ b/src/glu/sgi/libnurbs/internals/mymath.h @@ -35,8 +35,8 @@ /* * mymath.h * - * $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.2 2001/08/13 16:52:18 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $ */ #ifndef __glumymath_h_ @@ -46,7 +46,7 @@ #define sqrtf gl_fsqrt #endif -#if GLBUILD | STANDALONE +#if defined(GLBUILD) || defined(STANDALONE) #define M_SQRT2 1.41421356237309504880 #define ceilf myceilf #define floorf myfloorf diff --git a/src/glu/sgi/libnurbs/internals/mysetjmp.h b/src/glu/sgi/libnurbs/internals/mysetjmp.h index 16f9f74cf64..468f45ab7d2 100644 --- a/src/glu/sgi/libnurbs/internals/mysetjmp.h +++ b/src/glu/sgi/libnurbs/internals/mysetjmp.h @@ -35,8 +35,8 @@ /* * mysetjmp.h * - * $Date: 2001/03/22 11:38:36 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mysetjmp.h,v 1.2 2001/03/22 11:38:36 joukj Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mysetjmp.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $ */ #ifndef __glumysetjmp_h_ @@ -55,7 +55,7 @@ extern "C" int mysetjmp( JumpBuffer * ); #define longjmp gl_longjmp #endif -#if LIBRARYBUILD | GLBUILD +#if defined(LIBRARYBUILD) || defined(GLBUILD) #include <setjmp.h> #include <stdlib.h> diff --git a/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc b/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc index e6b3a8a2a06..69829890b39 100644 --- a/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc +++ b/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc @@ -35,8 +35,8 @@ /* * nurbsinterfac.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "glimports.h" @@ -66,9 +66,9 @@ } NurbsTessellator::NurbsTessellator( BasicCurveEvaluator &c, BasicSurfaceEvaluator& e) - : subdivider( renderhints, backend ), + : maplist( backend ), backend( c, e ), - maplist( backend ), + subdivider( renderhints, backend ), o_pwlcurvePool( sizeof( O_pwlcurve ), 32, "o_pwlcurvePool" ), o_nurbscurvePool( sizeof( O_nurbscurve ), 32, "o_nurbscurvePool"), o_curvePool( sizeof( O_curve ), 32, "o_curvePool" ), diff --git a/src/glu/sgi/libnurbs/internals/nurbstess.h b/src/glu/sgi/libnurbs/internals/nurbstess.h index 33e60d65f97..93016c69a39 100644 --- a/src/glu/sgi/libnurbs/internals/nurbstess.h +++ b/src/glu/sgi/libnurbs/internals/nurbstess.h @@ -35,8 +35,8 @@ /* * nurbstess.h * - * $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.2 2001/08/07 17:34:11 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.2.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.2.16.1 2003/11/21 15:49:25 keithw Exp $ */ #ifndef __glunurbstess_h_ @@ -60,7 +60,7 @@ class NurbsTessellator { public: NurbsTessellator( BasicCurveEvaluator &c, BasicSurfaceEvaluator &e ); - ~NurbsTessellator( void ); + virtual ~NurbsTessellator( void ); void getnurbsproperty( long, INREAL * ); void getnurbsproperty( long, long, INREAL * ); diff --git a/src/glu/sgi/libnurbs/internals/subdivider.cc b/src/glu/sgi/libnurbs/internals/subdivider.cc index e85acacf8b4..00ac6870bee 100644 --- a/src/glu/sgi/libnurbs/internals/subdivider.cc +++ b/src/glu/sgi/libnurbs/internals/subdivider.cc @@ -35,8 +35,8 @@ /* * subdivider.cxx * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2003/11/21 15:49:25 $ $Revision: 1.1.16.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.cc,v 1.1.16.1 2003/11/21 15:49:25 keithw Exp $ */ #include "glimports.h" @@ -112,13 +112,13 @@ Subdivider::makePatchBoundary( const REAL *from, const REAL *to ) */ Subdivider::Subdivider( Renderhints& r, Backend& b ) - : arcpool( sizeof( Arc), 1, "arcpool" ), + : slicer( b ), + arctessellator( trimvertexpool, pwlarcpool ), + arcpool( sizeof( Arc), 1, "arcpool" ), bezierarcpool( sizeof( BezierArc ), 1, "Bezarcpool" ), pwlarcpool( sizeof( PwlArc ), 1, "Pwlarcpool" ), renderhints( r ), - arctessellator( trimvertexpool, pwlarcpool ), - backend( b ), - slicer( b ) + backend( b ) { } diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc index 81e01049154..44b88e49dee 100644 --- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc +++ b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.14.1 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2.14.1 2003/11/21 15:49:26 keithw Exp $ */ #include <stdlib.h> @@ -47,6 +47,10 @@ #include "directedLine.h" #include "polyDBG.h" +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + //we must return the newLine directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) { @@ -61,10 +65,10 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) delete end->sline; delete begin; delete end; - + return ret; } - + directedLine* newLine; sampledLine* sline = new sampledLine(begin->head(), end->tail()); newLine = new directedLine(INCREASING, sline); @@ -85,9 +89,9 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) void directedLine::deleteSingleLine(directedLine* dline) { - //make sure that dline->prev->tail is the same as + //make sure that dline->prev->tail is the same as //dline->next->head. This is for numerical erros. - //for example, if we delete a line which is almost degeneate + //for example, if we delete a line which is almost degeneate //within (epsilon), then we want to make that the polygon after deletion //is still a valid polygon @@ -107,18 +111,18 @@ static Int myequal(Real a[2], Real b[2]) if(a[0]==b[0] && a[1] == b[1]) return 1; else - return 0; + return 0; */ - + if(fabs(a[0]-b[0]) < 0.00001 && fabs(a[1]-b[1]) < 0.00001) return 1; else return 0; - + } - + directedLine* directedLine::deleteDegenerateLines() { //if there is only one edge or two edges, don't do anything @@ -136,7 +140,7 @@ directedLine* directedLine::deleteDegenerateLines() head()[1] != tail()[1]) */ first = this; - else + else { for(temp = this->next; temp != this; temp = temp->next) { @@ -149,7 +153,7 @@ directedLine* directedLine::deleteDegenerateLines() first = temp; break; } - + } } @@ -164,17 +168,17 @@ directedLine* directedLine::deleteDegenerateLines() for(temp =first->next; temp != first; temp = tempNext) { tempNext = temp->getNext(); -/* +/* if(temp->head()[0] == temp->tail()[0] && temp->head()[1] == temp->tail()[1]) -*/ +*/ if(myequal(temp->head(), temp->tail())) deleteSingleLine(temp); - } + } return first; } - + directedLine* directedLine::deleteDegenerateLinesAllPolygons() { directedLine* temp; @@ -188,7 +192,7 @@ directedLine* directedLine::deleteDegenerateLinesAllPolygons() if(ret == NULL) { ret = retEnd = temp->deleteDegenerateLines(); - + } else { @@ -277,7 +281,7 @@ void directedLine::deletePolygonList() temp->deleteSinglePolygon(); } } - + /*a loop by itself*/ directedLine::directedLine(short dir, sampledLine* sl) @@ -289,7 +293,7 @@ directedLine::directedLine(short dir, sampledLine* sl) nextPolygon = NULL; // prevPolygon = NULL; rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ - + rootLink = NULL; } @@ -305,7 +309,7 @@ directedLine::directedLine() next = this; prev = this; nextPolygon = NULL; - rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ + rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ rootLink = NULL; } @@ -344,7 +348,7 @@ Int directedLine::numEdges() Int ret=0; directedLine* temp; if(next == this) return 1; - + ret = 1; for(temp = next; temp != this; temp = temp->next) ret++; @@ -373,7 +377,7 @@ short directedLine::isPolygon() /*check this edge*/ if(! isConnected()) return 0; - + /*check all other edges*/ for(temp=next; temp != this; temp = temp->next){ if(!isConnected()) return 0; @@ -381,14 +385,14 @@ short directedLine::isPolygon() return 1; } -/*check if the head of this edge is connected to +/*check if the head of this edge is connected to *the tail of the prev */ short directedLine::isConnected() { if( (head()[0] == prev->tail()[0]) && (head()[1] == prev->tail()[1])) return 1; - else + else return 0; } @@ -410,9 +414,9 @@ Int compV2InX(Real A[2], Real B[2]) /*compare two vertices NOT lines! *A vertex is the head of a directed line. - *(x_1, y_1) <= (x_2, y_2) if + *(x_1, y_1) <= (x_2, y_2) if *either y_1 < y_2 - *or y_1 == y_2 && x_1 < x_2. + *or y_1 == y_2 && x_1 < x_2. *return -1 if this->head() <= nl->head(), *return 1 otherwise */ @@ -425,9 +429,9 @@ Int directedLine::compInY(directedLine* nl) /*compare two vertices NOT lines! *A vertex is the head of a directed line. - *(x_1, y_1) <= (x_2, y_2) if + *(x_1, y_1) <= (x_2, y_2) if *either x_1 < x_2 - *or x_1 == x_2 && y_1 < y_2. + *or x_1 == x_2 && y_1 < y_2. *return -1 if this->head() <= nl->head(), *return 1 otherwise */ @@ -467,8 +471,8 @@ void directedLine::printSingle() { if(direction == INCREASING) printf("direction is INCREASING\n"); - else - printf("direction is DECREASING\n"); + else + printf("direction is DECREASING\n"); printf("head=%f,%f)\n", head()[0], head()[1]); sline->print(); } @@ -515,7 +519,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p) for(temp=this; temp != p; temp = temp->nextPolygon) { - if(temp == NULL) + if(temp == NULL) { fprintf(stderr, "in cutoffPolygon, not found\n"); exit(1); @@ -531,7 +535,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p) else { prev_polygon->nextPolygon = p->nextPolygon; return this; - } + } } Int directedLine::numPolygons() @@ -539,9 +543,9 @@ Int directedLine::numPolygons() if(nextPolygon == NULL) return 1; else return 1+nextPolygon->numPolygons(); } - -/*let array[index ...] denote + +/*let array[index ...] denote *all the edges in this polygon *return the next available index of array. */ @@ -555,8 +559,8 @@ Int directedLine::toArraySinglePolygon(directedLine** array, Int index) } return index; } - -/*the space is allocated. The caller is responsible for + +/*the space is allocated. The caller is responsible for *deallocate the space. *total_num_edges is set to be the total number of edges of all polygons */ @@ -602,14 +606,14 @@ Real directedLine::polyArea() /*******************split or combine polygons begin********************/ /*conect a diagonal of a single simple polygon or two simple polygons. *If the two vertices v1 (head) and v2 (head) are in the same simple polygon, - *then we actually split the simple polygon into two polygons. + *then we actually split the simple polygon into two polygons. *If instead two vertices velong to two difference polygons, *then we combine the two polygons into one polygon. - *It is upto the caller to decide whether this is a split or a + *It is upto the caller to decide whether this is a split or a *combination. * *Case Split: - *split a single simple polygon into two simple polygons by + *split a single simple polygon into two simple polygons by *connecting a diagonal (two vertices). *v1, v2: the two vertices are the head() of the two directedLines. * this routine generates one new sampledLine which is returned in @@ -625,11 +629,11 @@ Real directedLine::polyArea() *the returned polygon is returned in ret_p1. */ /*ARGSUSED*/ -void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, - directedLine** ret_p1, +void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, + directedLine** ret_p1, directedLine** ret_p2, sampledLine** generatedLine, - directedLine* polygonList ) + directedLine* polygonList ) { sampledLine *nsline = new sampledLine(2); @@ -637,7 +641,7 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, nsline->setPoint(0, v1->head()); nsline->setPoint(1, v2->head()); - + /*the increasing line is from v1 head to v2 head*/ @@ -651,12 +655,12 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, directedLine* v1Prev = v1->prev; directedLine* v2Prev = v2->prev; - v1 ->prev = newLineDec; + v1 ->prev = newLineDec; v2Prev ->next = newLineDec; newLineDec->next = v1; newLineDec->prev = v2Prev; - v2 ->prev = newLineInc; + v2 ->prev = newLineInc; v1Prev ->next = newLineInc; newLineInc->next = v2; newLineInc->prev = v1Prev; @@ -668,19 +672,19 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, //see the function connectDiangle /*ARGSUSED*/ -void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, - directedLine** ret_p1, +void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, + directedLine** ret_p1, directedLine** ret_p2, - directedLine* polygonList ) + directedLine* polygonList ) { sampledLine *nsline = new sampledLine(2); - sampledLine *nsline2 = new sampledLine(2); + sampledLine *nsline2 = new sampledLine(2); nsline->setPoint(0, v1->head()); nsline->setPoint(1, v2->head()); nsline2->setPoint(0, v1->head()); nsline2->setPoint(1, v2->head()); - + /*the increasing line is from v1 head to v2 head*/ directedLine* newLineInc = new directedLine(INCREASING, nsline); @@ -689,12 +693,12 @@ void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, directedLine* v1Prev = v1->prev; directedLine* v2Prev = v2->prev; - v1 ->prev = newLineDec; + v1 ->prev = newLineDec; v2Prev ->next = newLineDec; newLineDec->next = v1; newLineDec->prev = v2Prev; - v2 ->prev = newLineInc; + v2 ->prev = newLineInc; v1Prev ->next = newLineInc; newLineInc->next = v2; newLineInc->prev = v1Prev; @@ -793,7 +797,7 @@ directedLine* readAllPolygons(char* filename) Int nPolygons; fscanf(fp, "%i", &nPolygons); directedLine *ret = NULL; - + for(i=0; i<nPolygons; i++) { Int nEdges; @@ -810,7 +814,7 @@ directedLine* readAllPolygons(char* filename) sampledLine *sLine = new sampledLine(2, vert); directedLine *thisPoly = new directedLine(INCREASING, sLine); thisPoly->rootLinkSet(NULL); - + directedLine *dLine; for(j=2; j<nEdges; j++) { @@ -830,7 +834,7 @@ dLine->rootLinkSet(thisPoly); dLine = new directedLine(INCREASING, sLine); dLine->rootLinkSet(thisPoly); thisPoly->insert(dLine); - + ret = thisPoly->insertPolygon(ret); } fclose(fp); diff --git a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc index e4a65c2eb3c..ffff1d008a3 100644 --- a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc +++ b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.14.1 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2.14.1 2003/11/21 15:49:26 keithw Exp $ */ #include <stdlib.h> @@ -43,6 +43,11 @@ #include "zlassert.h" #include "polyDBG.h" +#ifdef __WATCOMC__ +#pragma warning 14 10 +#pragma warning 391 10 +#pragma warning 726 10 +#endif static Real area(Real A[2], Real B[2], Real C[2]) { @@ -71,7 +76,7 @@ Int DBG_is_U_monotone(directedLine* poly) { Int n_changes = 0; Int prev_sign; - Int cur_sign; + Int cur_sign; directedLine* temp; cur_sign = compV2InX(poly->tail(), poly->head()); @@ -119,7 +124,7 @@ Int DBG_is_U_direction(directedLine* poly) if(temp->head()[0] == temp->tail()[0]) V_count += temp->get_npoints(); else if(temp->head()[1] == temp->tail()[1]) - U_count += temp->get_npoints(); + U_count += temp->get_npoints(); */ } @@ -142,7 +147,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l1->tail()[1] - l1->head()[1])*(l2->tail()[1]-l2->head()[1]) >=0) return 0; //not intersect else - return 1; + return 1; } //else we use the normal code } @@ -154,8 +159,8 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l2->tail()[1] - l2->head()[1])*(l1->tail()[1]-l1->head()[1]) >=0) return 0; //not intersect else - return 1; - } + return 1; + } //else we use the normal code } else //the two edges are not connected @@ -165,11 +170,11 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l1->tail()[0] == l2->tail()[0] && l1->tail()[1] == l2->tail()[1])) return 1; - + } - - if( + + if( ( area(l1->head(), l1->tail(), l2->head()) * @@ -184,7 +189,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) ) ) return 1; - else + else return 0; } @@ -207,7 +212,7 @@ Int DBG_edgesIntersectGen(Real A[2], Real B[2], Real C[2], Real D[2]) else return 0; } - + /*determien whether (A,B) interesect chain[start] to [end] */ Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B[2]) @@ -216,13 +221,13 @@ Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B for(i=start; i<=end-2; i++) if(DBG_edgesIntersectGen(chain->getVertex(i), chain->getVertex(i+1), A, B)) return 1; - + return 0; } /*determine whether a polygon intersect itself or not *return 1 is it does, - * 0 otherwise + * 0 otherwise */ Int DBG_polygonSelfIntersect(directedLine* poly) { @@ -235,7 +240,7 @@ Int DBG_polygonSelfIntersect(directedLine* poly) { return 1; } - + } for(temp1=poly->getNext(); temp1 != poly; temp1 = temp1->getNext()) @@ -261,7 +266,7 @@ Int DBG_edgeIntersectPoly(directedLine* edge, directedLine* poly) return 1; return 0; } - + /*check whether two polygons intersect */ Int DBG_polygonsIntersect(directedLine* p1, directedLine* p2) @@ -291,7 +296,7 @@ Int DBG_polygonListIntersect(directedLine* pList) if(DBG_polygonsIntersect(temp, temp2)) return 1; } - + return 0; } @@ -303,16 +308,16 @@ Int DBG_isCounterclockwise(directedLine* poly) /*ray: v0 with direction (dx,dy). *edge: v1-v2. - * the extra point v10[2] is given for the information at + * the extra point v10[2] is given for the information at *v1. Basically this edge is connectd to edge - * v10-v1. If v1 is on the ray, + * v10-v1. If v1 is on the ray, * then we need v10 to determine whether this ray intersects - * the edge or not (that is, return 1 or return 0). + * the edge or not (that is, return 1 or return 0). * If v1 is on the ray, then if v2 and v10 are on the same side of the ray, * we return 0, otherwise return 1. *For v2, if v2 is on the ray, we always return 0. *Notice that v1 and v2 are not symmetric. So the edge is directed!!! - * The purpose for this convention is such that: a point is inside a polygon + * The purpose for this convention is such that: a point is inside a polygon * if and only if it intersets with odd number of edges. */ Int DBG_rayIntersectEdge(Real v0[2], Real dx, Real dy, Real v10[2], Real v1[2], Real v2[2]) @@ -330,17 +335,17 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] ) /*if the ray is parallel to the edge, return 0: not intersect*/ - if(denom == 0.0) + if(denom == 0.0) return 0; /*if v0 is on the edge, return 0: not intersect*/ - if(nomRay == 0.0) + if(nomRay == 0.0) return 0; - + /*if v1 is on the positive ray, and the neighbor of v1 crosses the ray *return 1: intersect */ - if(nomEdge == 0) + if(nomEdge == 0) { /*v1 is on the positive or negative ray*/ /* @@ -351,7 +356,7 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] ) { if(area(v0, v1, v10) * area(v0, v1, v2) >0) return 0; - else + else return 1; } else /*v1 on negative ray*/ @@ -378,10 +383,10 @@ Int DBG_rayIntersectPoly(Real v0[2], Real dx, Real dy, directedLine* poly) Int count=0; if(DBG_rayIntersectEdge(v0, dx, dy, poly->getPrev()->head(), poly->head(), poly->tail())) count++; - + for(temp=poly->getNext(); temp != poly; temp = temp->getNext()) if(DBG_rayIntersectEdge(v0, dx, dy, temp->getPrev()->head(), temp->head(), temp->tail())) - count++; + count++; /*printf("ray intersect poly: count=%i\n", count);*/ return count; } @@ -398,8 +403,8 @@ poly->printList(); == (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 ) ); if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1) - return 1; - else + return 1; + else return 0; } @@ -410,8 +415,8 @@ Int DBG_enclosingPolygons(directedLine* poly, directedLine* list) { directedLine* temp; Int count=0; -/* -printf("%i\n", DBG_pointInsidePoly(poly->head(), +/* +printf("%i\n", DBG_pointInsidePoly(poly->head(), list->getNextPolygon() ->getNextPolygon() ->getNextPolygon() @@ -423,15 +428,15 @@ printf("%i\n", DBG_pointInsidePoly(poly->head(), { if(poly != temp) if(DBG_pointInsidePoly(poly->head(), temp)) - count++; -/* printf("count=%i\n", count);*/ + count++; +/* printf("count=%i\n", count);*/ } return count; } void DBG_reverse(directedLine* poly) { - if(poly->getDirection() == INCREASING) + if(poly->getDirection() == INCREASING) poly->putDirection(DECREASING); else poly->putDirection(INCREASING); @@ -443,7 +448,7 @@ void DBG_reverse(directedLine* poly) directedLine* temp; for(temp=oldNext; temp!=poly; temp = oldNext) { - if(temp->getDirection() == INCREASING) + if(temp->getDirection() == INCREASING) temp->putDirection(DECREASING); else temp->putDirection(INCREASING); @@ -512,7 +517,7 @@ Int DBG_check(directedLine *polyList) correctDir = 0; /*clockwise*/ Int actualDir = DBG_isCounterclockwise(temp); - + if(correctDir != actualDir) { fprintf(stderr, "DBG_check: polygon with incorrect orientations. reversed\n"); @@ -526,7 +531,7 @@ Int DBG_check(directedLine *polyList) /**************handle self intersections*****************/ //determine whether e interects [begin, end] or not -static directedLine* DBG_edgeIntersectChainD(directedLine *e, +static directedLine* DBG_edgeIntersectChainD(directedLine *e, directedLine *begin, directedLine *end) { directedLine *temp; @@ -537,10 +542,10 @@ static directedLine* DBG_edgeIntersectChainD(directedLine *e, } if(DBG_edgesIntersect(e, end)) return end; - return NULL; + return NULL; } -//given a polygon, cut the edges off and finally obtain a +//given a polygon, cut the edges off and finally obtain a //a polygon without intersections. The cut-off edges are //dealloated. The new polygon is returned. directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) @@ -563,7 +568,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) Int n=5; buf[0] = interc->tail()[0]; buf[1] = interc->tail()[1]; - + for(i=1; i<n; i++) { Real r = ((Real)i) / ((Real) n); @@ -591,7 +596,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) { cutOccur = 1; begin->deleteSingleLine(next); - + if(begin != end) { if(DBG_polygonSelfIntersect(begin)) @@ -615,7 +620,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) return begin; } -//given a polygon, cut the edges off and finally obtain a +//given a polygon, cut the edges off and finally obtain a //a polygon without intersections. The cut-off edges are //dealloated. The new polygon is returned. static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) @@ -642,7 +647,7 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) crt=crt->deleteChain(crt, crt->getNext()); } else - { + { //now we know crt and crt->getNext do not intersect begin = crt; end = crt->getNext(); @@ -651,8 +656,8 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) for(temp=end->getNext(); temp!=begin; temp= temp->getNext()) { //printf("temp=(%f,%f)\n", temp->head()[0], temp->head()[1]); - directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end); - if(intersect != NULL) + directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end); + if(intersect != NULL) { crt = crt->deleteChain(intersect, temp); find=1; @@ -686,7 +691,7 @@ directedLine* DBG_cutIntersectionAllPoly(directedLine* list) if(left != NULL) ret=left->insertPolygon(ret); } - return ret; + return ret; } sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList) @@ -709,7 +714,7 @@ sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList) DBG_collectSampledLinesPoly(temp, tempHead, tempTail); cTail->insert(tempHead); cTail = tempTail; - } + } return cHead; } @@ -721,7 +726,7 @@ void DBG_collectSampledLinesPoly(directedLine *polygon, sampledLine*& retHead, retTail = NULL; if(polygon == NULL) return; - + retHead = retTail = polygon->getSampledLine(); for(temp = polygon->getNext(); temp != polygon; temp=temp->getNext()) { diff --git a/src/glu/sgi/libtess/geom.h b/src/glu/sgi/libtess/geom.h index 14969d48781..c9c0c2acbf2 100644 --- a/src/glu/sgi/libtess/geom.h +++ b/src/glu/sgi/libtess/geom.h @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -35,8 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/geom.h,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.1.16.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/geom.h,v 1.1.16.1 2003/11/21 15:49:26 keithw Exp $ */ #ifndef __geom_h_ @@ -58,8 +58,8 @@ ((u)->s == (v)->s && (u)->t <= (v)->t)) #endif -#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w) -#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w) +#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w) +#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w) /* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ @@ -69,11 +69,12 @@ #define TransSign(u,v,w) __gl_transSign(u,v,w) -#define EdgeGoesLeft(e) VertLeq( (e)->Dst, (e)->Org ) +#define EdgeGoesLeft(e) VertLeq( (e)->Dst, (e)->Org ) #define EdgeGoesRight(e) VertLeq( (e)->Org, (e)->Dst ) +#undef ABS #define ABS(x) ((x) < 0 ? -(x) : (x)) -#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t)) +#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t)) #define VertCCW(u,v,w) __gl_vertCCW(u,v,w) diff --git a/src/glu/sgi/libtess/normal.c b/src/glu/sgi/libtess/normal.c index 618cfd9ccf4..94e110ec2af 100644 --- a/src/glu/sgi/libtess/normal.c +++ b/src/glu/sgi/libtess/normal.c @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -35,8 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2002/11/01 23:45:31 $ $Revision: 1.2 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/normal.c,v 1.2 2002/11/01 23:45:31 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.2.12.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/normal.c,v 1.2.12.1 2003/11/21 15:49:26 keithw Exp $ */ #include "gluos.h" @@ -64,6 +64,7 @@ static void Normalize( GLdouble v[3] ) } #endif +#undef ABS #define ABS(x) ((x) < 0 ? -(x) : (x)) static int LongAxis( GLdouble v[3] ) @@ -138,7 +139,7 @@ static void ComputeNormal( GLUtesselator *tess, GLdouble norm[3] ) norm[LongAxis(d1)] = 1; } } - + static void CheckOrientation( GLUtesselator *tess ) { @@ -176,7 +177,7 @@ extern int RandomSweep; #define S_UNIT_X (RandomSweep ? (2*drand48()-1) : 1.0) #define S_UNIT_Y (RandomSweep ? (2*drand48()-1) : 0.0) #else -#if defined(SLANTED_SWEEP) +#if defined(SLANTED_SWEEP) /* The "feature merging" is not intended to be complete. There are * special cases where edges are nearly parallel to the sweep line * which are not implemented. The algorithm should still behave @@ -242,7 +243,7 @@ void __gl_projectPolygon( GLUtesselator *tess ) sUnit[i] = 0; sUnit[(i+1)%3] = S_UNIT_X; sUnit[(i+2)%3] = S_UNIT_Y; - + tUnit[i] = 0; tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; diff --git a/src/glu/sgi/libtess/sweep.c b/src/glu/sgi/libtess/sweep.c index f28fad4e506..755d4c9507a 100644 --- a/src/glu/sgi/libtess/sweep.c +++ b/src/glu/sgi/libtess/sweep.c @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -35,8 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2002/11/07 14:17:05 $ $Revision: 1.5 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.5 2002/11/07 14:17:05 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.5.12.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.5.12.1 2003/11/21 15:49:26 keithw Exp $ */ #include "gluos.h" @@ -92,6 +92,8 @@ extern void DebugEvent( GLUtesselator *tess ); * when it is necessary.) */ +#undef MAX +#undef MIN #define MAX(x,y) ((x) >= (y) ? (x) : (y)) #define MIN(x,y) ((x) <= (y) ? (x) : (y)) @@ -99,7 +101,7 @@ extern void DebugEvent( GLUtesselator *tess ); * winding of the new edge. */ #define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \ - eDst->Sym->winding += eSrc->Sym->winding) + eDst->Sym->winding += eSrc->Sym->winding) static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ); static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ); @@ -175,7 +177,7 @@ static int FixUpperEdge( ActiveRegion *reg, GLUhalfEdge *newEdge ) reg->eUp = newEdge; newEdge->activeRegion = reg; - return 1; + return 1; } static ActiveRegion *TopLeftRegion( ActiveRegion *reg ) @@ -225,7 +227,7 @@ static ActiveRegion *AddRegionBelow( GLUtesselator *tess, if (regNew == NULL) longjmp(tess->env,1); regNew->eUp = eNewUp; - /* __gl_dictListInsertBefore */ + /* __gl_dictListInsertBefore */ regNew->nodeUp = dictInsertBefore( tess->dict, regAbove->nodeUp, regNew ); if (regNew->nodeUp == NULL) longjmp(tess->env,1); regNew->fixUpperEdge = FALSE; @@ -292,7 +294,7 @@ static GLUhalfEdge *FinishLeftRegions( GLUtesselator *tess, * active region to the face, since at this point each face will belong * to at most one region (this was not necessarily true until this point * in the sweep). The walk stops at the region above regLast; if regLast - * is NULL we walk as far as possible. At the same time we relink the + * is NULL we walk as far as possible. At the same time we relink the * mesh if necessary, so that the ordering of edges around vOrg is the * same as in the dictionary. */ @@ -449,11 +451,11 @@ static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1, data[0] = e1->Org->data; data[1] = e2->Org->data; CallCombine( tess, e1->Org, data, weights, FALSE ); - if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1); } static void VertexWeights( GLUvertex *isect, GLUvertex *org, GLUvertex *dst, - GLfloat *weights ) + GLfloat *weights ) /* * Find some weights which describe how the intersection vertex is * a linear combination of "org" and "dest". Each of the two edges @@ -596,7 +598,7 @@ static int CheckForLeftSplice( GLUtesselator *tess, ActiveRegion *regUp ) /* eUp->Dst is below eLo, so splice eUp->Dst into eLo */ regUp->dirty = regLo->dirty = TRUE; e = __gl_meshSplitEdge( eLo ); - if (e == NULL) longjmp(tess->env,1); + if (e == NULL) longjmp(tess->env,1); if ( !__gl_meshSplice( eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1); e->Rface->inside = regUp->inside; } @@ -682,7 +684,7 @@ static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp ) return FALSE; } - if( (! VertEq( dstUp, tess->event ) + if( (! VertEq( dstUp, tess->event ) && EdgeSign( dstUp, tess->event, &isect ) >= 0) || (! VertEq( dstLo, tess->event ) && EdgeSign( dstLo, tess->event, &isect ) <= 0 )) @@ -705,7 +707,7 @@ static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp ) if( dstUp == tess->event ) { /* Splice dstUp into eLo, and process the new region(s) */ if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); - if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1); regLo = regUp; regUp = TopRightRegion( regUp ); e = RegionBelow(regUp)->eUp->Rprev; @@ -813,7 +815,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ) if( eUp->Org != eLo->Org ) { if( eUp->Dst != eLo->Dst && ! regUp->fixUpperEdge && ! regLo->fixUpperEdge - && (eUp->Dst == tess->event || eLo->Dst == tess->event) ) + && (eUp->Dst == tess->event || eLo->Dst == tess->event) ) { /* When all else fails in CheckForIntersect(), it uses tess->event * as the intersection location. To make this possible, it requires @@ -822,7 +824,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ) * case it might splice one of these edges into tess->event, and * violate the invariant that fixable edges are the only right-going * edge from their associated vertex). - */ + */ if( CheckForIntersect( tess, regUp )) { /* WalkDirtyRegions() was called recursively; we're done */ return; @@ -846,7 +848,7 @@ static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ) static void ConnectRightVertex( GLUtesselator *tess, ActiveRegion *regUp, - GLUhalfEdge *eBottomLeft ) + GLUhalfEdge *eBottomLeft ) /* * Purpose: connect a "right" vertex vEvent (one where all edges go left) * to the unprocessed portion of the mesh. Since there are no right-going @@ -959,7 +961,7 @@ static void ConnectLeftDegenerate( GLUtesselator *tess, SpliceMergeVertices( tess, e, vEvent->anEdge ); return; } - + if( ! VertEq( e->Dst, vEvent )) { /* General case -- splice vEvent into edge e which passes through it */ if (__gl_meshSplitEdge( e->Sym ) == NULL) longjmp(tess->env,1); @@ -969,7 +971,7 @@ static void ConnectLeftDegenerate( GLUtesselator *tess, regUp->fixUpperEdge = FALSE; } if ( !__gl_meshSplice( vEvent->anEdge, e ) ) longjmp(tess->env,1); - SweepEvent( tess, vEvent ); /* recurse */ + SweepEvent( tess, vEvent ); /* recurse */ return; } @@ -1075,9 +1077,9 @@ static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ) ActiveRegion *regUp, *reg; GLUhalfEdge *e, *eTopLeft, *eBottomLeft; - tess->event = vEvent; /* for access in EdgeLeq() */ + tess->event = vEvent; /* for access in EdgeLeq() */ DebugEvent( tess ); - + /* Check if this vertex is the right endpoint of an edge that is * already in the dictionary. In this case we don't need to waste * time searching for the location to insert new edges. @@ -1143,7 +1145,7 @@ static void AddSentinel( GLUtesselator *tess, GLdouble t ) e->Org->t = t; e->Dst->s = -SENTINEL_COORD; e->Dst->t = t; - tess->event = e->Dst; /* initialize it */ + tess->event = e->Dst; /* initialize it */ reg->eUp = e; reg->windingNumber = 0; @@ -1193,7 +1195,7 @@ static void DoneEdgeDict( GLUtesselator *tess ) DeleteRegion( tess, reg ); /* __gl_meshDelete( reg->eUp );*/ } - dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */ + dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */ } @@ -1209,10 +1211,10 @@ static void RemoveDegenerateEdges( GLUtesselator *tess ) for( e = eHead->next; e != eHead; e = eNext ) { eNext = e->next; eLnext = e->Lnext; - + if( VertEq( e->Org, e->Dst ) && e->Lnext->Lnext != e ) { /* Zero-length edge, contour has at least 3 edges */ - + SpliceMergeVertices( tess, eLnext, e ); /* deletes e->Org */ if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); /* e is a self-loop */ e = eLnext; @@ -1220,7 +1222,7 @@ static void RemoveDegenerateEdges( GLUtesselator *tess ) } if( eLnext->Lnext == e ) { /* Degenerate contour (one or two edges) */ - + if( eLnext != e ) { if( eLnext == eNext || eLnext == eNext->Sym ) { eNext = eNext->next; } if ( !__gl_meshDelete( eLnext ) ) longjmp(tess->env,1); @@ -1327,7 +1329,7 @@ int __gl_computeInterior( GLUtesselator *tess ) for( ;; ) { vNext = (GLUvertex *)pqMinimum( tess->pq ); /* __gl_pqSortMinimum */ if( vNext == NULL || ! VertEq( vNext, v )) break; - + /* Merge together all vertices at exactly the same location. * This is more efficient than processing them one at a time, * simplifies the code (see ConnectLeftDegenerate), and is also @@ -1349,7 +1351,7 @@ int __gl_computeInterior( GLUtesselator *tess ) } /* Set tess->event for debugging purposes */ - /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ tess->event = ((ActiveRegion *) dictKey( dictMin( tess->dict )))->eUp->Org; DebugEvent( tess ); DoneEdgeDict( tess ); diff --git a/src/glu/sgi/libtess/tess.c b/src/glu/sgi/libtess/tess.c index 0793106334f..1b0b10a9cb7 100644 --- a/src/glu/sgi/libtess/tess.c +++ b/src/glu/sgi/libtess/tess.c @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -35,8 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2002/11/01 23:45:31 $ $Revision: 1.3 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.3 2002/11/01 23:45:31 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.3.12.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.3.12.1 2003/11/21 15:49:26 keithw Exp $ */ #include "gluos.h" @@ -63,13 +63,13 @@ /*ARGSUSED*/ static void GLAPIENTRY noEnd( void ) {} /*ARGSUSED*/ static void GLAPIENTRY noError( GLenum errnum ) {} /*ARGSUSED*/ static void GLAPIENTRY noCombine( GLdouble coords[3], void *data[4], - GLfloat weight[4], void **dataOut ) {} + GLfloat weight[4], void **dataOut ) {} /*ARGSUSED*/ static void GLAPIENTRY noMesh( GLUmesh *mesh ) {} /*ARGSUSED*/ void GLAPIENTRY __gl_noBeginData( GLenum type, void *polygonData ) {} -/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, +/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData ) {} /*ARGSUSED*/ void GLAPIENTRY __gl_noVertexData( void *data, void *polygonData ) {} @@ -85,9 +85,10 @@ /* Half-edges are allocated in pairs (see mesh.c) */ typedef struct { GLUhalfEdge e, eSym; } EdgePair; +#undef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ - MAX(sizeof(GLUvertex),sizeof(GLUface)))) + MAX(sizeof(GLUvertex),sizeof(GLUface)))) GLUtesselator * GLAPIENTRY @@ -170,7 +171,7 @@ static void GotoState( GLUtesselator *tess, enum TessState newState ) gluTessBeginContour( tess ); break; default: - ; + ; } } else { switch( tess->state ) { @@ -184,7 +185,7 @@ static void GotoState( GLUtesselator *tess, enum TessState newState ) MakeDormant( tess ); break; default: - ; + ; } } } @@ -246,7 +247,7 @@ gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) /* tolerance should be in range [0..1] */ assert(0.0 <= tess->relTolerance && tess->relTolerance <= 1.0); *value= tess->relTolerance; - break; + break; case GLU_TESS_WINDING_RULE: assert(tess->windingRule == GLU_TESS_WINDING_ODD || tess->windingRule == GLU_TESS_WINDING_NONZERO || @@ -295,7 +296,7 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) return; case GLU_TESS_EDGE_FLAG_DATA: tess->callEdgeFlagData= (fn == NULL) ? - &__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn; + &__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn; /* If the client wants boundary edges to be flagged, * we render everything as separate triangles (no strips or fans). */ @@ -313,8 +314,8 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPIENTRY *)(void)) fn; return; case GLU_TESS_END_DATA: - tess->callEndData = (fn == NULL) ? &__gl_noEndData : - (void (GLAPIENTRY *)(void *)) fn; + tess->callEndData = (fn == NULL) ? &__gl_noEndData : + (void (GLAPIENTRY *)(void *)) fn; return; case GLU_TESS_ERROR: tess->callError = (fn == NULL) ? &noError : (void (GLAPIENTRY *)(GLenum)) fn; @@ -329,9 +330,9 @@ gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) return; case GLU_TESS_COMBINE_DATA: tess->callCombineData = (fn == NULL) ? &__gl_noCombineData : - (void (GLAPIENTRY *)(GLdouble [3], - void *[4], - GLfloat [4], + (void (GLAPIENTRY *)(GLdouble [3], + void *[4], + GLfloat [4], void **, void *)) fn; return; @@ -368,7 +369,7 @@ static int AddVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) e->Org->coords[0] = coords[0]; e->Org->coords[1] = coords[1]; e->Org->coords[2] = coords[2]; - + /* The winding of an edge says how the winding number changes as we * cross from the edge''s right face to its left face. We add the * vertices in such an order that a CCW contour will add +1 to @@ -503,7 +504,7 @@ gluTessEndPolygon( GLUtesselator *tess ) { GLUmesh *mesh; - if (setjmp(tess->env) != 0) { + if (setjmp(tess->env) != 0) { /* come back here if out of memory */ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); return; @@ -521,7 +522,7 @@ gluTessEndPolygon( GLUtesselator *tess ) * an explicit mesh either. */ if( __gl_renderCache( tess )) { - tess->polygonData= NULL; + tess->polygonData= NULL; return; } } @@ -554,15 +555,15 @@ gluTessEndPolygon( GLUtesselator *tess ) if( tess->boundaryOnly ) { rc = __gl_meshSetWindingNumber( mesh, 1, TRUE ); } else { - rc = __gl_meshTessellateInterior( mesh ); + rc = __gl_meshTessellateInterior( mesh ); } if (rc == 0) longjmp(tess->env,1); /* could've used a label */ __gl_meshCheckMesh( mesh ); if( tess->callBegin != &noBegin || tess->callEnd != &noEnd - || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag - || tess->callBeginData != &__gl_noBeginData + || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag + || tess->callBeginData != &__gl_noBeginData || tess->callEndData != &__gl_noEndData || tess->callVertexData != &__gl_noVertexData || tess->callEdgeFlagData != &__gl_noEdgeFlagData ) diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 5b275fa50d1..c8c78a4e11e 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,8 +31,8 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2002/11/01 23:45:31 $ $Revision: 1.3 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/mipmap.c,v 1.3 2002/11/01 23:45:31 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.3.12.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/mipmap.c,v 1.3.12.1 2003/11/21 15:49:26 keithw Exp $ */ #include "gluos.h" @@ -55,11 +55,11 @@ typedef union { float f; } Type_Widget; -/* Pixel storage modes */ +/* Pixel storage modes */ typedef struct { GLint pack_alignment; - GLint pack_row_length; - GLint pack_skip_rows; + GLint pack_row_length; + GLint pack_skip_rows; GLint pack_skip_pixels; GLint pack_lsb_first; GLint pack_swap_bytes; @@ -76,20 +76,20 @@ typedef struct { GLint unpack_image_height; } PixelStorageModes; -static int gluBuild1DMipmapLevelsCore(GLenum, GLint, +static int gluBuild1DMipmapLevelsCore(GLenum, GLint, GLsizei, GLsizei, - GLenum, GLenum, GLint, GLint, GLint, + GLenum, GLenum, GLint, GLint, GLint, const void *); -static int gluBuild2DMipmapLevelsCore(GLenum, GLint, - GLsizei, GLsizei, - GLsizei, GLsizei, - GLenum, GLenum, GLint, GLint, GLint, +static int gluBuild2DMipmapLevelsCore(GLenum, GLint, + GLsizei, GLsizei, + GLsizei, GLsizei, + GLenum, GLenum, GLint, GLint, GLint, const void *); -static int gluBuild3DMipmapLevelsCore(GLenum, GLint, +static int gluBuild3DMipmapLevelsCore(GLenum, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLsizei, GLsizei, - GLenum, GLenum, GLint, GLint, GLint, + GLenum, GLenum, GLint, GLint, GLint, const void *); /* @@ -100,58 +100,58 @@ static GLint elements_per_group(GLenum format, GLenum type); static GLint is_index(GLenum format); static GLint image_size(GLint width, GLint height, GLenum format, GLenum type); static void fill_image(const PixelStorageModes *, - GLint width, GLint height, GLenum format, - GLenum type, GLboolean index_format, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, const void *userdata, GLushort *newimage); static void empty_image(const PixelStorageModes *, - GLint width, GLint height, GLenum format, - GLenum type, GLboolean index_format, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, const GLushort *oldimage, void *userdata); -static void scale_internal(GLint components, GLint widthin, GLint heightin, - const GLushort *datain, - GLint widthout, GLint heightout, +static void scale_internal(GLint components, GLint widthin, GLint heightin, + const GLushort *datain, + GLint widthout, GLint heightout, GLushort *dataout); -static void scale_internal_ubyte(GLint components, GLint widthin, - GLint heightin, const GLubyte *datain, - GLint widthout, GLint heightout, +static void scale_internal_ubyte(GLint components, GLint widthin, + GLint heightin, const GLubyte *datain, + GLint widthout, GLint heightout, GLubyte *dataout, GLint element_size, GLint ysize, GLint group_size); static void scale_internal_byte(GLint components, GLint widthin, - GLint heightin, const GLbyte *datain, - GLint widthout, GLint heightout, - GLbyte *dataout, GLint element_size, - GLint ysize, GLint group_size); + GLint heightin, const GLbyte *datain, + GLint widthout, GLint heightout, + GLbyte *dataout, GLint element_size, + GLint ysize, GLint group_size); static void scale_internal_ushort(GLint components, GLint widthin, - GLint heightin, const GLushort *datain, - GLint widthout, GLint heightout, - GLushort *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes); + GLint heightin, const GLushort *datain, + GLint widthout, GLint heightout, + GLushort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); static void scale_internal_short(GLint components, GLint widthin, - GLint heightin, const GLshort *datain, - GLint widthout, GLint heightout, - GLshort *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes); + GLint heightin, const GLshort *datain, + GLint widthout, GLint heightout, + GLshort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); static void scale_internal_uint(GLint components, GLint widthin, - GLint heightin, const GLuint *datain, - GLint widthout, GLint heightout, - GLuint *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes); + GLint heightin, const GLuint *datain, + GLint widthout, GLint heightout, + GLuint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); static void scale_internal_int(GLint components, GLint widthin, - GLint heightin, const GLint *datain, - GLint widthout, GLint heightout, - GLint *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes); + GLint heightin, const GLint *datain, + GLint widthout, GLint heightout, + GLint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); static void scale_internal_float(GLint components, GLint widthin, - GLint heightin, const GLfloat *datain, - GLint widthout, GLint heightout, - GLfloat *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes); + GLint heightin, const GLfloat *datain, + GLint widthout, GLint heightout, + GLfloat *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); static int checkMipmapArgs(GLenum, GLenum, GLenum); static GLboolean legalFormat(GLenum); @@ -231,27 +231,27 @@ static void halve1DimagePackedPixel(int, static void halve1Dimage_ubyte(GLint, GLuint, GLuint,const GLubyte *, GLubyte *, GLint, GLint, GLint); -static void halve1Dimage_byte(GLint, GLuint, GLuint,const GLbyte *, GLbyte *, +static void halve1Dimage_byte(GLint, GLuint, GLuint,const GLbyte *, GLbyte *, GLint, GLint, GLint); static void halve1Dimage_ushort(GLint, GLuint, GLuint, const GLushort *, GLushort *, GLint, GLint, GLint, GLint); -static void halve1Dimage_short(GLint, GLuint, GLuint,const GLshort *, GLshort *, +static void halve1Dimage_short(GLint, GLuint, GLuint,const GLshort *, GLshort *, GLint, GLint, GLint, GLint); -static void halve1Dimage_uint(GLint, GLuint, GLuint, const GLuint *, GLuint *, +static void halve1Dimage_uint(GLint, GLuint, GLuint, const GLuint *, GLuint *, GLint, GLint, GLint, GLint); -static void halve1Dimage_int(GLint, GLuint, GLuint, const GLint *, GLint *, +static void halve1Dimage_int(GLint, GLuint, GLuint, const GLint *, GLint *, GLint, GLint, GLint, GLint); -static void halve1Dimage_float(GLint, GLuint, GLuint, const GLfloat *, GLfloat *, +static void halve1Dimage_float(GLint, GLuint, GLuint, const GLfloat *, GLfloat *, GLint, GLint, GLint, GLint); static GLint imageSize3D(GLint, GLint, GLint, GLenum,GLenum); -static void fillImage3D(const PixelStorageModes *, GLint, GLint, GLint,GLenum, +static void fillImage3D(const PixelStorageModes *, GLint, GLint, GLint,GLenum, GLenum, GLboolean, const void *, GLushort *); static void emptyImage3D(const PixelStorageModes *, - GLint, GLint, GLint, GLenum, - GLenum, GLboolean, + GLint, GLint, GLint, GLenum, + GLenum, GLboolean, const GLushort *, void *); -static void scaleInternal3D(GLint, GLint, GLint, GLint, const GLushort *, +static void scaleInternal3D(GLint, GLint, GLint, GLint, const GLushort *, GLint, GLint, GLint, GLushort *); static void retrieveStoreModes(PixelStorageModes *psm) @@ -312,8 +312,8 @@ static int computeLog(GLuint value) } } -/* -** Compute the nearest power of 2 number. This algorithm is a little +/* +** Compute the nearest power of 2 number. This algorithm is a little ** strange, but it works quite well. */ static int nearestPower(GLuint value) @@ -341,10 +341,10 @@ static int nearestPower(GLuint value) #define __GLU_SWAP_4_BYTES(s)\ (GLuint)(((GLuint)((const GLubyte*)(s))[3])<<24 | \ - ((GLuint)((const GLubyte*)(s))[2])<<16 | \ - ((GLuint)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0]) + ((GLuint)((const GLubyte*)(s))[2])<<16 | \ + ((GLuint)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0]) -static void halveImage(GLint components, GLuint width, GLuint height, +static void halveImage(GLint components, GLuint width, GLuint height, const GLushort *datain, GLushort *dataout) { int i, j, k; @@ -363,7 +363,7 @@ static void halveImage(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (t[0] + t[components] + t[delta] + + s[0] = (t[0] + t[components] + t[delta] + t[delta+components] + 2) / 4; s++; t++; } @@ -373,7 +373,7 @@ static void halveImage(GLint components, GLuint width, GLuint height, } } -static void halveImage_ubyte(GLint components, GLuint width, GLuint height, +static void halveImage_ubyte(GLint components, GLuint width, GLuint height, const GLubyte *datain, GLubyte *dataout, GLint element_size, GLint ysize, GLint group_size) { @@ -399,11 +399,11 @@ static void halveImage_ubyte(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (*(const GLubyte*)t + + s[0] = (*(const GLubyte*)t + *(const GLubyte*)(t+group_size) + - *(const GLubyte*)(t+ysize) + - *(const GLubyte*)(t+ysize+group_size) + 2) / 4; - s++; t += element_size; + *(const GLubyte*)(t+ysize) + + *(const GLubyte*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; } t += group_size; } @@ -412,9 +412,9 @@ static void halveImage_ubyte(GLint components, GLuint width, GLuint height, } /* */ -static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, - const GLubyte *dataIn, GLubyte *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, + const GLubyte *dataIn, GLubyte *dataOut, + GLint element_size, GLint ysize, GLint group_size) { GLint halfWidth= width / 2; @@ -437,19 +437,19 @@ static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, *(const GLubyte*)(src+group_size)) / 2; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -460,7 +460,7 @@ static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -471,7 +471,7 @@ static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, [components * element_size * halfWidth * halfHeight]); } /* halve1Dimage_ubyte() */ -static void halveImage_byte(GLint components, GLuint width, GLuint height, +static void halveImage_byte(GLint components, GLuint width, GLuint height, const GLbyte *datain, GLbyte *dataout, GLint element_size, GLint ysize, GLint group_size) @@ -498,11 +498,11 @@ static void halveImage_byte(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (*(const GLbyte*)t + + s[0] = (*(const GLbyte*)t + *(const GLbyte*)(t+group_size) + - *(const GLbyte*)(t+ysize) + - *(const GLbyte*)(t+ysize+group_size) + 2) / 4; - s++; t += element_size; + *(const GLbyte*)(t+ysize) + + *(const GLbyte*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; } t += group_size; } @@ -510,8 +510,8 @@ static void halveImage_byte(GLint components, GLuint width, GLuint height, } } -static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, - const GLbyte *dataIn, GLbyte *dataOut, +static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, + const GLbyte *dataIn, GLbyte *dataOut, GLint element_size,GLint ysize, GLint group_size) { GLint halfWidth= width / 2; @@ -533,19 +533,19 @@ static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, *dest= (*(const GLbyte*)src + *(const GLbyte*)(src+group_size)) / 2; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -556,7 +556,7 @@ static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -568,8 +568,8 @@ static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, [components * element_size * halfWidth * halfHeight]); } /* halve1Dimage_byte() */ -static void halveImage_ushort(GLint components, GLuint width, GLuint height, - const GLushort *datain, GLushort *dataout, +static void halveImage_ushort(GLint components, GLuint width, GLuint height, + const GLushort *datain, GLushort *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { @@ -596,9 +596,9 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (*(const GLushort*)t + - *(const GLushort*)(t+group_size) + - *(const GLushort*)(t+ysize) + + s[0] = (*(const GLushort*)t + + *(const GLushort*)(t+group_size) + + *(const GLushort*)(t+ysize) + *(const GLushort*)(t+ysize+group_size) + 2) / 4; s++; t += element_size; } @@ -608,23 +608,23 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, } else for (i = 0; i < newheight; i++) { - for (j = 0; j < newwidth; j++) { - for (k = 0; k < components; k++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { s[0] = (__GLU_SWAP_2_BYTES(t) + __GLU_SWAP_2_BYTES(t+group_size) + __GLU_SWAP_2_BYTES(t+ysize) + __GLU_SWAP_2_BYTES(t+ysize+group_size)+ 2)/4; - s++; t += element_size; + s++; t += element_size; } t += group_size; - } - t += ysize; + } + t += ysize; } } -static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, - const GLushort *dataIn, GLushort *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, + const GLushort *dataIn, GLushort *dataOut, + GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { GLint halfWidth= width / 2; @@ -656,19 +656,19 @@ static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, *dest= (ushort[0] + ushort[1]) / 2; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -689,7 +689,7 @@ static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -703,7 +703,7 @@ static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, } /* halve1Dimage_ushort() */ -static void halveImage_short(GLint components, GLuint width, GLuint height, +static void halveImage_short(GLint components, GLuint width, GLuint height, const GLshort *datain, GLshort *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) @@ -731,9 +731,9 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (*(const GLshort*)t + - *(const GLshort*)(t+group_size) + - *(const GLshort*)(t+ysize) + + s[0] = (*(const GLshort*)t + + *(const GLshort*)(t+group_size) + + *(const GLshort*)(t+ysize) + *(const GLshort*)(t+ysize+group_size) + 2) / 4; s++; t += element_size; } @@ -743,30 +743,30 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, } else for (i = 0; i < newheight; i++) { - for (j = 0; j < newwidth; j++) { - for (k = 0; k < components; k++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { GLushort b; GLint buf; - b = __GLU_SWAP_2_BYTES(t); + b = __GLU_SWAP_2_BYTES(t); buf = *(const GLshort*)&b; - b = __GLU_SWAP_2_BYTES(t+group_size); + b = __GLU_SWAP_2_BYTES(t+group_size); buf += *(const GLshort*)&b; - b = __GLU_SWAP_2_BYTES(t+ysize); + b = __GLU_SWAP_2_BYTES(t+ysize); buf += *(const GLshort*)&b; - b = __GLU_SWAP_2_BYTES(t+ysize+group_size); + b = __GLU_SWAP_2_BYTES(t+ysize+group_size); buf += *(const GLshort*)&b; s[0] = (GLshort)((buf+2)/4); - s++; t += element_size; + s++; t += element_size; } t += group_size; - } - t += ysize; + } + t += ysize; } } -static void halve1Dimage_short(GLint components, GLuint width, GLuint height, - const GLshort *dataIn, GLshort *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_short(GLint components, GLuint width, GLuint height, + const GLshort *dataIn, GLshort *dataOut, + GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { GLint halfWidth= width / 2; @@ -798,19 +798,19 @@ static void halve1Dimage_short(GLint components, GLuint width, GLuint height, *dest= (sshort[0] + sshort[1]) / 2; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -831,7 +831,7 @@ static void halve1Dimage_short(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -845,8 +845,8 @@ static void halve1Dimage_short(GLint components, GLuint width, GLuint height, } /* halve1Dimage_short() */ -static void halveImage_uint(GLint components, GLuint width, GLuint height, - const GLuint *datain, GLuint *dataout, +static void halveImage_uint(GLint components, GLuint width, GLuint height, + const GLuint *datain, GLuint *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { @@ -869,15 +869,15 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, t = (const char *)datain; /* Piece o' cake! */ - if (!myswap_bytes) + if (!myswap_bytes) for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - /* need to cast to double to hold large unsigned ints */ - s[0] = ((double)*(const GLuint*)t + - (double)*(const GLuint*)(t+group_size) + - (double)*(const GLuint*)(t+ysize) + - (double)*(const GLuint*)(t+ysize+group_size))/4 + 0.5; + /* need to cast to double to hold large unsigned ints */ + s[0] = ((double)*(const GLuint*)t + + (double)*(const GLuint*)(t+group_size) + + (double)*(const GLuint*)(t+ysize) + + (double)*(const GLuint*)(t+ysize+group_size))/4 + 0.5; s++; t += element_size; } @@ -887,28 +887,28 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, } else for (i = 0; i < newheight; i++) { - for (j = 0; j < newwidth; j++) { - for (k = 0; k < components; k++) { - /* need to cast to double to hold large unsigned ints */ + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + /* need to cast to double to hold large unsigned ints */ GLdouble buf; - buf = (GLdouble)__GLU_SWAP_4_BYTES(t) + - (GLdouble)__GLU_SWAP_4_BYTES(t+group_size) + - (GLdouble)__GLU_SWAP_4_BYTES(t+ysize) + - (GLdouble)__GLU_SWAP_4_BYTES(t+ysize+group_size); - s[0] = (GLuint)(buf/4 + 0.5); + buf = (GLdouble)__GLU_SWAP_4_BYTES(t) + + (GLdouble)__GLU_SWAP_4_BYTES(t+group_size) + + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize) + + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize+group_size); + s[0] = (GLuint)(buf/4 + 0.5); s++; t += element_size; } t += group_size; - } - t += ysize; + } + t += ysize; } } /* */ -static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, - const GLuint *dataIn, GLuint *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, + const GLuint *dataIn, GLuint *dataOut, + GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { GLint halfWidth= width / 2; @@ -937,22 +937,22 @@ static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, uint[0]= *(const GLuint*)src; uint[1]= *(const GLuint*)(src+group_size); } - *dest= ((double)uint[0]+(double)uint[1])/2.0; + *dest= ((double)uint[0]+(double)uint[1])/2.0; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -973,7 +973,7 @@ static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -986,8 +986,8 @@ static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, } /* halve1Dimage_uint() */ -static void halveImage_int(GLint components, GLuint width, GLuint height, - const GLint *datain, GLint *dataout, GLint element_size, +static void halveImage_int(GLint components, GLuint width, GLuint height, + const GLint *datain, GLint *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { int i, j, k; @@ -1009,13 +1009,13 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, t = (const char *)datain; /* Piece o' cake! */ - if (!myswap_bytes) + if (!myswap_bytes) for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = ((float)*(const GLint*)t + - (float)*(const GLint*)(t+group_size) + - (float)*(const GLint*)(t+ysize) + + s[0] = ((float)*(const GLint*)t + + (float)*(const GLint*)(t+group_size) + + (float)*(const GLint*)(t+ysize) + (float)*(const GLint*)(t+ysize+group_size))/4 + 0.5; s++; t += element_size; } @@ -1023,34 +1023,34 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, } t += ysize; } - else + else for (i = 0; i < newheight; i++) { - for (j = 0; j < newwidth; j++) { - for (k = 0; k < components; k++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { GLuint b; - GLfloat buf; - b = __GLU_SWAP_4_BYTES(t); - buf = *(GLint*)&b; - b = __GLU_SWAP_4_BYTES(t+group_size); - buf += *(GLint*)&b; - b = __GLU_SWAP_4_BYTES(t+ysize); - buf += *(GLint*)&b; - b = __GLU_SWAP_4_BYTES(t+ysize+group_size); - buf += *(GLint*)&b; - s[0] = (GLint)(buf/4 + 0.5); - - s++; t += element_size; + GLfloat buf; + b = __GLU_SWAP_4_BYTES(t); + buf = *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+group_size); + buf += *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize); + buf += *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize+group_size); + buf += *(GLint*)&b; + s[0] = (GLint)(buf/4 + 0.5); + + s++; t += element_size; } t += group_size; - } - t += ysize; + } + t += ysize; } } /* */ -static void halve1Dimage_int(GLint components, GLuint width, GLuint height, - const GLint *dataIn, GLint *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_int(GLint components, GLuint width, GLuint height, + const GLint *dataIn, GLint *dataOut, + GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { GLint halfWidth= width / 2; @@ -1082,19 +1082,19 @@ static void halve1Dimage_int(GLint components, GLuint width, GLuint height, *dest= ((float)uint[0]+(float)uint[1])/2.0; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -1115,7 +1115,7 @@ static void halve1Dimage_int(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; } @@ -1129,8 +1129,8 @@ static void halve1Dimage_int(GLint components, GLuint width, GLuint height, } /* halve1Dimage_int() */ -static void halveImage_float(GLint components, GLuint width, GLuint height, - const GLfloat *datain, GLfloat *dataout, +static void halveImage_float(GLint components, GLuint width, GLuint height, + const GLfloat *datain, GLfloat *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { @@ -1157,9 +1157,9 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, for (i = 0; i < newheight; i++) { for (j = 0; j < newwidth; j++) { for (k = 0; k < components; k++) { - s[0] = (*(const GLfloat*)t + - *(const GLfloat*)(t+group_size) + - *(const GLfloat*)(t+ysize) + + s[0] = (*(const GLfloat*)t + + *(const GLfloat*)(t+group_size) + + *(const GLfloat*)(t+ysize) + *(const GLfloat*)(t+ysize+group_size)) / 4; s++; t += element_size; } @@ -1167,38 +1167,38 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, } t += ysize; } - else + else for (i = 0; i < newheight; i++) { - for (j = 0; j < newwidth; j++) { - for (k = 0; k < components; k++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { GLuint b; - b = __GLU_SWAP_4_BYTES(t); - s[0] = *(GLfloat*)&b; - b = __GLU_SWAP_4_BYTES(t+group_size); - s[0] += *(GLfloat*)&b; - b = __GLU_SWAP_4_BYTES(t+ysize); - s[0] += *(GLfloat*)&b; - b = __GLU_SWAP_4_BYTES(t+ysize+group_size); - s[0] += *(GLfloat*)&b; + b = __GLU_SWAP_4_BYTES(t); + s[0] = *(GLfloat*)&b; + b = __GLU_SWAP_4_BYTES(t+group_size); + s[0] += *(GLfloat*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize); + s[0] += *(GLfloat*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize+group_size); + s[0] += *(GLfloat*)&b; s[0] /= 4; - s++; t += element_size; + s++; t += element_size; } t += group_size; - } - t += ysize; + } + t += ysize; } } /* */ -static void halve1Dimage_float(GLint components, GLuint width, GLuint height, - const GLfloat *dataIn, GLfloat *dataOut, - GLint element_size, GLint ysize, +static void halve1Dimage_float(GLint components, GLuint width, GLuint height, + const GLfloat *dataIn, GLfloat *dataOut, + GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) { GLint halfWidth= width / 2; GLint halfHeight= height / 2; const char *src= (const char *) dataIn; - GLfloat *dest= dataOut; + GLfloat *dest= dataOut; int jj; assert(width == 1 || height == 1); /* must be 1D */ @@ -1224,19 +1224,19 @@ static void halve1Dimage_float(GLint components, GLuint width, GLuint height, *dest= (sfloat[0] + sfloat[1]) / 2.0; src+= element_size; - dest++; - } + dest++; + } src+= group_size; /* skip to next 2 */ } { - int padBytes= ysize - (width*group_size); + int padBytes= ysize - (width*group_size); src+= padBytes; /* for assertion only */ } } else if (width == 1) { /* 1 column */ int padBytes= ysize - (width * group_size); assert(height != 1); /* widthxheight can't be 1x1 */ - halfWidth= 1; + halfWidth= 1; /* one vertical column with possible pad bytes per row */ /* average two at a time */ @@ -1257,7 +1257,7 @@ static void halve1Dimage_float(GLint components, GLuint width, GLuint height, src+= element_size; dest++; - } + } src+= padBytes; /* add pad bytes, if any, to get to end to row */ src+= ysize; /* skip to odd row */ } @@ -1268,9 +1268,9 @@ static void halve1Dimage_float(GLint components, GLuint width, GLuint height, [components * element_size * halfWidth * halfHeight]); } /* halve1Dimage_float() */ -static void scale_internal(GLint components, GLint widthin, GLint heightin, - const GLushort *datain, - GLint widthout, GLint heightout, +static void scale_internal(GLint components, GLint widthin, GLint heightin, + const GLushort *datain, + GLint widthout, GLint heightout, GLushort *dataout) { float x, lowx, highx, convx, halfconvx; @@ -1364,9 +1364,9 @@ static void scale_internal(GLint components, GLint widthin, GLint heightin, } } -static void scale_internal_ubyte(GLint components, GLint widthin, - GLint heightin, const GLubyte *datain, - GLint widthout, GLint heightout, +static void scale_internal_ubyte(GLint components, GLint widthin, + GLint heightin, const GLubyte *datain, + GLint widthout, GLint heightout, GLubyte *dataout, GLint element_size, GLint ysize, GLint group_size) { @@ -1391,8 +1391,8 @@ static void scale_internal_ubyte(GLint components, GLint widthin, const char *left, *right; if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_ubyte(components, widthin, heightin, - (const GLubyte *)datain, (GLubyte *)dataout, + halveImage_ubyte(components, widthin, heightin, + (const GLubyte *)datain, (GLubyte *)dataout, element_size, ysize, group_size); return; } @@ -1402,7 +1402,7 @@ static void scale_internal_ubyte(GLint components, GLint widthin, convy_float = convy - convy_int; convx_int = floor(convx); convx_float = convx - convx_int; - + area = convx * convy; lowy_int = 0; @@ -1430,58 +1430,58 @@ static void scale_internal_ubyte(GLint components, GLint widthin, if((highy_int>lowy_int) && (highx_int>lowx_int)) { y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; + temp = (const char *)datain + xindex + lowy_int * ysize; percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { totals[k] += (GLubyte)(*(temp_index)) * percent; - } + } left = temp; - for(l = lowx_int+1; l < highx_int; l++) { + for(l = lowx_int+1; l < highx_int; l++) { temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * y_percent; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; } - } + } temp += group_size; right = temp; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } - /* calculate the value for pixels in the last row */ + /* calculate the value for pixels in the last row */ y_percent = highy_float; percent = y_percent * (1-lowx_float); temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * y_percent; - } - } - temp += group_size; + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } - /* calculate the value for pixels in the 1st and last column */ + /* calculate the value for pixels in the 1st and last column */ for(m = lowy_int+1; m < highy_int; m++) { left += ysize; right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - totals[k] += (GLubyte)(*(left))*(1-lowx_float) + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + totals[k] += (GLubyte)(*(left))*(1-lowx_float) +(GLubyte)(*(right))*highx_float; } } @@ -1489,68 +1489,68 @@ static void scale_internal_ubyte(GLint components, GLint widthin, x_percent = highx_float - lowx_float; percent = (1-lowy_float)*x_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } for(m = lowy_int+1; m < highy_int; m++) { temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * x_percent; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * x_percent; } } percent = x_percent * highy_float; temp += ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } } else if (highx_int > lowx_int) { y_percent = highy_float - lowy_float; percent = (1-lowx_float)*y_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * y_percent; + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; } } temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; + totals[k] += (GLubyte)(*(temp_index)) * percent; } } else { percent = (highy_float-lowy_float)*(highx_float-lowx_float); temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)) * percent; - } + totals[k] += (GLubyte)(*(temp_index)) * percent; + } } - /* this is for the pixels in the body */ + /* this is for the pixels in the body */ temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; for (m = lowy_int+1; m < highy_int; m++) { temp = temp0; for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLubyte)(*(temp_index)); - } - temp += group_size; - } - temp0 += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)); + } + temp += group_size; + } + temp0 += ysize; } outindex = (j + (i * widthout)) * components; @@ -1561,7 +1561,7 @@ static void scale_internal_ubyte(GLint components, GLint widthin, lowx_int = highx_int; lowx_float = highx_float; highx_int += convx_int; - highx_float += convx_float; + highx_float += convx_float; if(highx_float > 1) { highx_float -= 1.0; highx_int++; @@ -1578,9 +1578,9 @@ static void scale_internal_ubyte(GLint components, GLint widthin, } } -static void scale_internal_byte(GLint components, GLint widthin, - GLint heightin, const GLbyte *datain, - GLint widthout, GLint heightout, +static void scale_internal_byte(GLint components, GLint widthin, + GLint heightin, const GLbyte *datain, + GLint widthout, GLint heightout, GLbyte *dataout, GLint element_size, GLint ysize, GLint group_size) { @@ -1605,8 +1605,8 @@ static void scale_internal_byte(GLint components, GLint widthin, const char *left, *right; if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_byte(components, widthin, heightin, - (const GLbyte *)datain, (GLbyte *)dataout, + halveImage_byte(components, widthin, heightin, + (const GLbyte *)datain, (GLbyte *)dataout, element_size, ysize, group_size); return; } @@ -1616,7 +1616,7 @@ static void scale_internal_byte(GLint components, GLint widthin, convy_float = convy - convy_int; convx_int = floor(convx); convx_float = convx - convx_int; - + area = convx * convy; lowy_int = 0; @@ -1639,63 +1639,63 @@ static void scale_internal_byte(GLint components, GLint widthin, */ totals[0] = totals[1] = totals[2] = totals[3] = 0.0; - /* calculate the value for pixels in the 1st row */ + /* calculate the value for pixels in the 1st row */ xindex = lowx_int*group_size; if((highy_int>lowy_int) && (highx_int>lowx_int)) { y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; + temp = (const char *)datain + xindex + lowy_int * ysize; percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { totals[k] += (GLbyte)(*(temp_index)) * percent; - } + } left = temp; - for(l = lowx_int+1; l < highx_int; l++) { + for(l = lowx_int+1; l < highx_int; l++) { temp += group_size; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * y_percent; + totals[k] += (GLbyte)(*(temp_index)) * y_percent; } - } + } temp += group_size; right = temp; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } - /* calculate the value for pixels in the last row */ + /* calculate the value for pixels in the last row */ y_percent = highy_float; percent = y_percent * (1-lowx_float); temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * y_percent; - } - } - temp += group_size; + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } - /* calculate the value for pixels in the 1st and last column */ + /* calculate the value for pixels in the 1st and last column */ for(m = lowy_int+1; m < highy_int; m++) { left += ysize; right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - totals[k] += (GLbyte)(*(left))*(1-lowx_float) + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + totals[k] += (GLbyte)(*(left))*(1-lowx_float) +(GLbyte)(*(right))*highx_float; } } @@ -1703,68 +1703,68 @@ static void scale_internal_byte(GLint components, GLint widthin, x_percent = highx_float - lowx_float; percent = (1-lowy_float)*x_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } for(m = lowy_int+1; m < highy_int; m++) { temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * x_percent; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * x_percent; } } percent = x_percent * highy_float; temp += ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } } else if (highx_int > lowx_int) { y_percent = highy_float - lowy_float; percent = (1-lowx_float)*y_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * y_percent; + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * y_percent; } } temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; + totals[k] += (GLbyte)(*(temp_index)) * percent; } } else { percent = (highy_float-lowy_float)*(highx_float-lowx_float); temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)) * percent; - } + totals[k] += (GLbyte)(*(temp_index)) * percent; + } } - /* this is for the pixels in the body */ - temp0 = (const char *)datain + xindex + group_size + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; for (m = lowy_int+1; m < highy_int; m++) { temp = temp0; for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - totals[k] += (GLbyte)(*(temp_index)); - } - temp += group_size; - } - temp0 += ysize; + totals[k] += (GLbyte)(*(temp_index)); + } + temp += group_size; + } + temp0 += ysize; } outindex = (j + (i * widthout)) * components; @@ -1775,7 +1775,7 @@ static void scale_internal_byte(GLint components, GLint widthin, lowx_int = highx_int; lowx_float = highx_float; highx_int += convx_int; - highx_float += convx_float; + highx_float += convx_float; if(highx_float > 1) { highx_float -= 1.0; highx_int++; @@ -1792,9 +1792,9 @@ static void scale_internal_byte(GLint components, GLint widthin, } } -static void scale_internal_ushort(GLint components, GLint widthin, - GLint heightin, const GLushort *datain, - GLint widthout, GLint heightout, +static void scale_internal_ushort(GLint components, GLint widthin, + GLint heightin, const GLushort *datain, + GLint widthout, GLint heightout, GLushort *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) @@ -1820,8 +1820,8 @@ static void scale_internal_ushort(GLint components, GLint widthin, const char *left, *right; if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_ushort(components, widthin, heightin, - (const GLushort *)datain, (GLushort *)dataout, + halveImage_ushort(components, widthin, heightin, + (const GLushort *)datain, (GLushort *)dataout, element_size, ysize, group_size, myswap_bytes); return; } @@ -1831,7 +1831,7 @@ static void scale_internal_ushort(GLint components, GLint widthin, convy_float = convy - convy_int; convx_int = floor(convx); convx_float = convx - convx_int; - + area = convx * convy; lowy_int = 0; @@ -1858,171 +1858,171 @@ static void scale_internal_ushort(GLint components, GLint widthin, if((highy_int>lowy_int) && (highx_int>lowx_int)) { y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; + temp = (const char *)datain + xindex + lowy_int * ysize; percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { if (myswap_bytes) { totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; } else { - totals[k] += *(const GLushort*)temp_index * percent; + totals[k] += *(const GLushort*)temp_index * percent; } - } + } left = temp; - for(l = lowx_int+1; l < highx_int; l++) { + for(l = lowx_int+1; l < highx_int; l++) { temp += group_size; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } - } - } + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } + } temp += group_size; right = temp; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } - - /* calculate the value for pixels in the last row */ + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ y_percent = highy_float; percent = y_percent * (1-lowx_float); temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; + temp += group_size; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } - } - } - temp += group_size; + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } + } + temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } /* calculate the value for pixels in the 1st and last column */ for(m = lowy_int+1; m < highy_int; m++) { left += ysize; right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + - __GLU_SWAP_2_BYTES(right) * highx_float; - } else { - totals[k] += *(const GLushort*)left * (1-lowx_float) - + *(const GLushort*)right * highx_float; - } + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_2_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLushort*)left * (1-lowx_float) + + *(const GLushort*)right * highx_float; + } } } } else if (highy_int > lowy_int) { x_percent = highx_float - lowx_float; percent = (1-lowy_float)*x_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } for(m = lowy_int+1; m < highy_int; m++) { temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * x_percent; - } else { - totals[k] += *(const GLushort*)temp_index * x_percent; - } + } else { + totals[k] += *(const GLushort*)temp_index * x_percent; + } } } percent = x_percent * highy_float; temp += ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } } else if (highx_int > lowx_int) { y_percent = highy_float - lowy_float; percent = (1-lowx_float)*y_percent; temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } } } temp += group_size; percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } } } else { percent = (highy_float-lowy_float)*(highx_float-lowx_float); temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } } /* this is for the pixels in the body */ @@ -2031,17 +2031,17 @@ static void scale_internal_ushort(GLint components, GLint widthin, for (m = lowy_int+1; m < highy_int; m++) { temp = temp0; for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index); - } else { - totals[k] += *(const GLushort*)temp_index; - } - } - temp += group_size; - } - temp0 += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index); + } else { + totals[k] += *(const GLushort*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; } outindex = (j + (i * widthout)) * components; @@ -2052,7 +2052,7 @@ static void scale_internal_ushort(GLint components, GLint widthin, lowx_int = highx_int; lowx_float = highx_float; highx_int += convx_int; - highx_float += convx_float; + highx_float += convx_float; if(highx_float > 1) { highx_float -= 1.0; highx_int++; @@ -2070,11 +2070,11 @@ static void scale_internal_ushort(GLint components, GLint widthin, } static void scale_internal_short(GLint components, GLint widthin, - GLint heightin, const GLshort *datain, - GLint widthout, GLint heightout, - GLshort *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes) + GLint heightin, const GLshort *datain, + GLint widthout, GLint heightout, + GLshort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) { float convx; float convy; @@ -2099,10 +2099,10 @@ static void scale_internal_short(GLint components, GLint widthin, GLushort swapbuf; /* unsigned buffer */ if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_short(components, widthin, heightin, - (const GLshort *)datain, (GLshort *)dataout, - element_size, ysize, group_size, myswap_bytes); - return; + halveImage_short(components, widthin, heightin, + (const GLshort *)datain, (GLshort *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; } convy = (float) heightin/heightout; convx = (float) widthin/widthout; @@ -2119,253 +2119,253 @@ static void scale_internal_short(GLint components, GLint widthin, highy_float = convy_float; for (i = 0; i < heightout; i++) { - lowx_int = 0; - lowx_float = 0; - highx_int = convx_int; - highx_float = convx_float; - - for (j = 0; j < widthout; j++) { - /* - ** Ok, now apply box filter to box that goes from (lowx, lowy) - ** to (highx, highy) on input data into this pixel on output - ** data. - */ - totals[0] = totals[1] = totals[2] = totals[3] = 0.0; - - /* calculate the value for pixels in the 1st row */ - xindex = lowx_int*group_size; - if((highy_int>lowy_int) && (highx_int>lowx_int)) { - - y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; - percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - left = temp; - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLshort*)temp_index * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - - /* calculate the value for pixels in the last row */ - y_percent = highy_float; - percent = y_percent * (1-lowx_float); - temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLshort*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - - /* calculate the value for pixels in the 1st and last column */ - for(m = lowy_int+1; m < highy_int; m++) { - left += ysize; - right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(left); - totals[k] += *(const GLshort*)&swapbuf * (1-lowx_float); + totals[k] += *(const GLshort*)&swapbuf * (1-lowx_float); swapbuf = __GLU_SWAP_2_BYTES(right); totals[k] += *(const GLshort*)&swapbuf * highx_float; - } else { - totals[k] += *(const GLshort*)left * (1-lowx_float) - + *(const GLshort*)right * highx_float; - } - } - } - } else if (highy_int > lowy_int) { - x_percent = highx_float - lowx_float; - percent = (1-lowy_float)*x_percent; - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + } else { + totals[k] += *(const GLshort*)left * (1-lowx_float) + + *(const GLshort*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - for(m = lowy_int+1; m < highy_int; m++) { - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * x_percent; - } else { - totals[k] += *(const GLshort*)temp_index * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * x_percent; + } else { + totals[k] += *(const GLshort*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - } else if (highx_int > lowx_int) { - y_percent = highy_float - lowy_float; - percent = (1-lowx_float)*y_percent; - - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLshort*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - } else { - percent = (highy_float-lowy_float)*(highx_float-lowx_float); - temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf * percent; - } else { - totals[k] += *(const GLshort*)temp_index * percent; - } - } - } - - /* this is for the pixels in the body */ - temp0 = (const char *)datain + xindex + group_size + + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; - for (m = lowy_int+1; m < highy_int; m++) { - temp = temp0; - for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_2_BYTES(temp_index); - totals[k] += *(const GLshort*)&swapbuf; - } else { - totals[k] += *(const GLshort*)temp_index; - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = (j + (i * widthout)) * components; - for (k = 0; k < components; k++) { - dataout[outindex + k] = totals[k]/area; - /*printf("totals[%d] = %f\n", k, totals[k]);*/ - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if(highx_float > 1) { - highx_float -= 1.0; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if(highy_float > 1) { - highy_float -= 1.0; - highy_int++; - } + totals[k] += *(const GLshort*)&swapbuf; + } else { + totals[k] += *(const GLshort*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } } } static void scale_internal_uint(GLint components, GLint widthin, - GLint heightin, const GLuint *datain, - GLint widthout, GLint heightout, - GLuint *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes) + GLint heightin, const GLuint *datain, + GLint widthout, GLint heightout, + GLuint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) { float convx; float convy; @@ -2388,10 +2388,10 @@ static void scale_internal_uint(GLint components, GLint widthin, const char *left, *right; if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_uint(components, widthin, heightin, - (const GLuint *)datain, (GLuint *)dataout, - element_size, ysize, group_size, myswap_bytes); - return; + halveImage_uint(components, widthin, heightin, + (const GLuint *)datain, (GLuint *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; } convy = (float) heightin/heightout; convx = (float) widthin/widthout; @@ -2408,248 +2408,248 @@ static void scale_internal_uint(GLint components, GLint widthin, highy_float = convy_float; for (i = 0; i < heightout; i++) { - lowx_int = 0; - lowx_float = 0; - highx_int = convx_int; - highx_float = convx_float; - - for (j = 0; j < widthout; j++) { - /* - ** Ok, now apply box filter to box that goes from (lowx, lowy) - ** to (highx, highy) on input data into this pixel on output - ** data. - */ - totals[0] = totals[1] = totals[2] = totals[3] = 0.0; - - /* calculate the value for pixels in the 1st row */ - xindex = lowx_int*group_size; - if((highy_int>lowy_int) && (highx_int>lowx_int)) { - - y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; - percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - left = temp; - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_4_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLuint*)temp_index * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - - /* calculate the value for pixels in the last row */ - y_percent = highy_float; - percent = y_percent * (1-lowx_float); - temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_4_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLuint*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - - /* calculate the value for pixels in the 1st and last column */ - for(m = lowy_int+1; m < highy_int; m++) { - left += ysize; - right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_4_BYTES(left) * (1-lowx_float) - + __GLU_SWAP_4_BYTES(right) * highx_float; - } else { - totals[k] += *(const GLuint*)left * (1-lowx_float) - + *(const GLuint*)right * highx_float; - } - } - } - } else if (highy_int > lowy_int) { - x_percent = highx_float - lowx_float; - percent = (1-lowy_float)*x_percent; - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - for(m = lowy_int+1; m < highy_int; m++) { - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_4_BYTES(temp_index) * x_percent; - } else { - totals[k] += *(const GLuint*)temp_index * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - } else if (highx_int > lowx_int) { - y_percent = highy_float - lowy_float; - percent = (1-lowx_float)*y_percent; - - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_4_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLuint*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - } else { - percent = (highy_float-lowy_float)*(highx_float-lowx_float); - temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLuint*)temp_index * percent; - } - } - } - - /* this is for the pixels in the body */ - temp0 = (const char *)datain + xindex + group_size + + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_4_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLuint*)left * (1-lowx_float) + + *(const GLuint*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * x_percent; + } else { + totals[k] += *(const GLuint*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; - for (m = lowy_int+1; m < highy_int; m++) { - temp = temp0; - for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_4_BYTES(temp_index); - } else { - totals[k] += *(const GLuint*)temp_index; - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = (j + (i * widthout)) * components; - for (k = 0; k < components; k++) { - /* clamp at UINT_MAX */ - float value= totals[k]/area; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index); + } else { + totals[k] += *(const GLuint*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + /* clamp at UINT_MAX */ + float value= totals[k]/area; if (value >= (float) UINT_MAX) { /* need '=' */ dataout[outindex + k] = UINT_MAX; } - else dataout[outindex + k] = value; + else dataout[outindex + k] = value; } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if(highx_float > 1) { - highx_float -= 1.0; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if(highy_float > 1) { - highy_float -= 1.0; - highy_int++; - } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } } } static void scale_internal_int(GLint components, GLint widthin, - GLint heightin, const GLint *datain, - GLint widthout, GLint heightout, - GLint *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes) + GLint heightin, const GLint *datain, + GLint widthout, GLint heightout, + GLint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) { float convx; float convy; @@ -2674,10 +2674,10 @@ static void scale_internal_int(GLint components, GLint widthin, GLuint swapbuf; /* unsigned buffer */ if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_int(components, widthin, heightin, - (const GLint *)datain, (GLint *)dataout, - element_size, ysize, group_size, myswap_bytes); - return; + halveImage_int(components, widthin, heightin, + (const GLint *)datain, (GLint *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; } convy = (float) heightin/heightout; convx = (float) widthin/widthout; @@ -2694,255 +2694,255 @@ static void scale_internal_int(GLint components, GLint widthin, highy_float = convy_float; for (i = 0; i < heightout; i++) { - lowx_int = 0; - lowx_float = 0; - highx_int = convx_int; - highx_float = convx_float; - - for (j = 0; j < widthout; j++) { - /* - ** Ok, now apply box filter to box that goes from (lowx, lowy) - ** to (highx, highy) on input data into this pixel on output - ** data. - */ - totals[0] = totals[1] = totals[2] = totals[3] = 0.0; - - /* calculate the value for pixels in the 1st row */ - xindex = lowx_int*group_size; - if((highy_int>lowy_int) && (highx_int>lowx_int)) { - - y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; - percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(left); + totals[k] += *(const GLint*)&swapbuf * (1-lowx_float); + swapbuf = __GLU_SWAP_4_BYTES(right); + totals[k] += *(const GLint*)&swapbuf * highx_float; + } else { + totals[k] += *(const GLint*)left * (1-lowx_float) + + *(const GLint*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - left = temp; - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLint*)temp_index * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - - /* calculate the value for pixels in the last row */ - y_percent = highy_float; - percent = y_percent * (1-lowx_float); - temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLint*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - - /* calculate the value for pixels in the 1st and last column */ - for(m = lowy_int+1; m < highy_int; m++) { - left += ysize; - right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(left); - totals[k] += *(const GLint*)&swapbuf * (1-lowx_float); - swapbuf = __GLU_SWAP_4_BYTES(right); - totals[k] += *(const GLint*)&swapbuf * highx_float; - } else { - totals[k] += *(const GLint*)left * (1-lowx_float) - + *(const GLint*)right * highx_float; - } - } - } - } else if (highy_int > lowy_int) { - x_percent = highx_float - lowx_float; - percent = (1-lowy_float)*x_percent; - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - for(m = lowy_int+1; m < highy_int; m++) { - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * x_percent; - } else { - totals[k] += *(const GLint*)temp_index * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - } else if (highx_int > lowx_int) { - y_percent = highy_float - lowy_float; - percent = (1-lowx_float)*y_percent; - - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLint*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - } else { - percent = (highy_float-lowy_float)*(highx_float-lowx_float); - temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf * percent; - } else { - totals[k] += *(const GLint*)temp_index * percent; - } - } - } - - /* this is for the pixels in the body */ - temp0 = (const char *)datain + xindex + group_size + + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * x_percent; + } else { + totals[k] += *(const GLint*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; - for (m = lowy_int+1; m < highy_int; m++) { - temp = temp0; - for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLint*)&swapbuf; - } else { - totals[k] += *(const GLint*)temp_index; - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = (j + (i * widthout)) * components; - for (k = 0; k < components; k++) { - dataout[outindex + k] = totals[k]/area; - /*printf("totals[%d] = %f\n", k, totals[k]);*/ - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if(highx_float > 1) { - highx_float -= 1.0; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if(highy_float > 1) { - highy_float -= 1.0; - highy_int++; - } + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf; + } else { + totals[k] += *(const GLint*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } } } static void scale_internal_float(GLint components, GLint widthin, - GLint heightin, const GLfloat *datain, - GLint widthout, GLint heightout, - GLfloat *dataout, GLint element_size, - GLint ysize, GLint group_size, - GLint myswap_bytes) + GLint heightin, const GLfloat *datain, + GLint widthout, GLint heightout, + GLfloat *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) { float convx; float convy; @@ -2967,10 +2967,10 @@ static void scale_internal_float(GLint components, GLint widthin, GLuint swapbuf; /* unsigned buffer */ if (widthin == widthout*2 && heightin == heightout*2) { - halveImage_float(components, widthin, heightin, - (const GLfloat *)datain, (GLfloat *)dataout, - element_size, ysize, group_size, myswap_bytes); - return; + halveImage_float(components, widthin, heightin, + (const GLfloat *)datain, (GLfloat *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; } convy = (float) heightin/heightout; convx = (float) widthin/widthout; @@ -2987,244 +2987,244 @@ static void scale_internal_float(GLint components, GLint widthin, highy_float = convy_float; for (i = 0; i < heightout; i++) { - lowx_int = 0; - lowx_float = 0; - highx_int = convx_int; - highx_float = convx_float; - - for (j = 0; j < widthout; j++) { - /* - ** Ok, now apply box filter to box that goes from (lowx, lowy) - ** to (highx, highy) on input data into this pixel on output - ** data. - */ - totals[0] = totals[1] = totals[2] = totals[3] = 0.0; - - /* calculate the value for pixels in the 1st row */ - xindex = lowx_int*group_size; - if((highy_int>lowy_int) && (highx_int>lowx_int)) { - - y_percent = 1-lowy_float; - temp = (const char *)datain + xindex + lowy_int * ysize; - percent = y_percent * (1-lowx_float); - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - left = temp; - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLfloat*)temp_index * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - - /* calculate the value for pixels in the last row */ - y_percent = highy_float; - percent = y_percent * (1-lowx_float); - temp = (const char *)datain + xindex + highy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - for(l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLfloat*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - - /* calculate the value for pixels in the 1st and last column */ - for(m = lowy_int+1; m < highy_int; m++) { - left += ysize; - right += ysize; - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(left); - totals[k] += *(const GLfloat*)&swapbuf * (1-lowx_float); - swapbuf = __GLU_SWAP_4_BYTES(right); - totals[k] += *(const GLfloat*)&swapbuf * highx_float; - } else { - totals[k] += *(const GLfloat*)left * (1-lowx_float) - + *(const GLfloat*)right * highx_float; - } - } - } - } else if (highy_int > lowy_int) { - x_percent = highx_float - lowx_float; - percent = (1-lowy_float)*x_percent; - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * (1-lowx_float); + swapbuf = __GLU_SWAP_4_BYTES(right); + totals[k] += *(const GLfloat*)&swapbuf * highx_float; + } else { + totals[k] += *(const GLfloat*)left * (1-lowx_float) + + *(const GLfloat*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - for(m = lowy_int+1; m < highy_int; m++) { - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * x_percent; - } else { - totals[k] += *(const GLfloat*)temp_index * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * x_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - } else if (highx_int > lowx_int) { - y_percent = highy_float - lowy_float; - percent = (1-lowx_float)*y_percent; - - temp = (const char *)datain + xindex + lowy_int*ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - for (l = lowx_int+1; l < highx_int; l++) { - temp += group_size; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * y_percent; - } else { - totals[k] += *(const GLfloat*)temp_index * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - } else { - percent = (highy_float-lowy_float)*(highx_float-lowx_float); - temp = (const char *)datain + xindex + lowy_int * ysize; - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf * percent; - } else { - totals[k] += *(const GLfloat*)temp_index * percent; - } - } - } - - /* this is for the pixels in the body */ - temp0 = (const char *)datain + xindex + group_size + + totals[k] += *(const GLfloat*)&swapbuf * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + (lowy_int+1)*ysize; - for (m = lowy_int+1; m < highy_int; m++) { - temp = temp0; - for(l = lowx_int+1; l < highx_int; l++) { - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { swapbuf = __GLU_SWAP_4_BYTES(temp_index); - totals[k] += *(const GLfloat*)&swapbuf; - } else { - totals[k] += *(const GLfloat*)temp_index; - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = (j + (i * widthout)) * components; - for (k = 0; k < components; k++) { - dataout[outindex + k] = totals[k]/area; - /*printf("totals[%d] = %f\n", k, totals[k]);*/ - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if(highx_float > 1) { - highx_float -= 1.0; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if(highy_float > 1) { - highy_float -= 1.0; - highy_int++; - } + totals[k] += *(const GLfloat*)&swapbuf; + } else { + totals[k] += *(const GLfloat*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } } } @@ -3238,7 +3238,7 @@ static int checkMipmapArgs(GLenum internalFormat, GLenum format, GLenum type) } if (!isLegalFormatForPackedPixelType(format, type)) { - return GLU_INVALID_OPERATION; + return GLU_INVALID_OPERATION; } return 0; @@ -3279,7 +3279,7 @@ static GLboolean legalType(GLenum type) case GL_UNSIGNED_INT: case GL_FLOAT: case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: @@ -3290,7 +3290,7 @@ static GLboolean legalType(GLenum type) case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return GL_TRUE; + return GL_TRUE; default: return GL_FALSE; } @@ -3325,14 +3325,14 @@ static GLboolean isLegalFormatForPackedPixelType(GLenum format, GLenum type) if (!isTypePackedPixel(type)) { return GL_TRUE; } - + /* 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB */ - if ((type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV|| + if ((type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV|| type == GL_UNSIGNED_SHORT_5_6_5|| type == GL_UNSIGNED_SHORT_5_6_5_REV) && format != GL_RGB) return GL_FALSE; - - /* 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & + + /* 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & * 10_10_10_2/2_10_10_10_REV are only compatible with RGBA, BGRA & ABGR_EXT. */ if ((type == GL_UNSIGNED_SHORT_4_4_4_4 || @@ -3343,7 +3343,7 @@ static GLboolean isLegalFormatForPackedPixelType(GLenum format, GLenum type) type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) && - (format != GL_RGBA && + (format != GL_RGBA && format != GL_BGRA)) { return GL_FALSE; } @@ -3351,7 +3351,7 @@ static GLboolean isLegalFormatForPackedPixelType(GLenum format, GLenum type) return GL_TRUE; } /* isLegalFormatForPackedPixelType() */ -static GLboolean isLegalLevels(GLint userLevel,GLint baseLevel,GLint maxLevel, +static GLboolean isLegalLevels(GLint userLevel,GLint baseLevel,GLint maxLevel, GLint totalLevels) { if (baseLevel < 0 || baseLevel < userLevel || maxLevel < baseLevel || @@ -3362,31 +3362,31 @@ static GLboolean isLegalLevels(GLint userLevel,GLint baseLevel,GLint maxLevel, /* Given user requested texture size, determine if it fits. If it * doesn't then halve both sides and make the determination again - * until it does fit (for IR only). + * until it does fit (for IR only). * Note that proxy textures are not implemented in RE* even though - * they advertise the texture extension. + * they advertise the texture extension. * Note that proxy textures are implemented but not according to spec in * IMPACT*. */ -static void closestFit(GLenum target, GLint width, GLint height, - GLint internalFormat, GLenum format, GLenum type, +static void closestFit(GLenum target, GLint width, GLint height, + GLint internalFormat, GLenum format, GLenum type, GLint *newWidth, GLint *newHeight) { /* Use proxy textures if OpenGL version is >= 1.1 */ if ( (strtod((const char *)glGetString(GL_VERSION),NULL) >= 1.1) ) { GLint widthPowerOf2= nearestPower(width); - GLint heightPowerOf2= nearestPower(height); + GLint heightPowerOf2= nearestPower(height); GLint proxyWidth; do { /* compute level 1 width & height, clamping each at 1 */ GLint widthAtLevelOne= (widthPowerOf2 > 1) ? - widthPowerOf2 >> 1 : - widthPowerOf2; + widthPowerOf2 >> 1 : + widthPowerOf2; GLint heightAtLevelOne= (heightPowerOf2 > 1) ? - heightPowerOf2 >> 1 : - heightPowerOf2; + heightPowerOf2 >> 1 : + heightPowerOf2; GLenum proxyTarget; assert(widthAtLevelOne > 0); assert(heightAtLevelOne > 0); @@ -3398,19 +3398,19 @@ static void closestFit(GLenum target, GLint width, GLint height, widthAtLevelOne,heightAtLevelOne,0,format,type,NULL); } else #if defined(GL_ARB_texture_cube_map) - if ((target == GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) || - (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) || - (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) || - (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) || - (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) || - (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { - proxyTarget = GL_PROXY_TEXTURE_CUBE_MAP_ARB; - glTexImage2D(proxyTarget, 1, /* must be non-zero */ - internalFormat, - widthAtLevelOne,heightAtLevelOne,0,format,type,NULL); - } else + if ((target == GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) || + (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) || + (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + proxyTarget = GL_PROXY_TEXTURE_CUBE_MAP_ARB; + glTexImage2D(proxyTarget, 1, /* must be non-zero */ + internalFormat, + widthAtLevelOne,heightAtLevelOne,0,format,type,NULL); + } else #endif /* GL_ARB_texture_cube_map */ - { + { assert(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D); proxyTarget = GL_PROXY_TEXTURE_1D; glTexImage1D(proxyTarget, 1, /* must be non-zero */ @@ -3424,13 +3424,13 @@ static void closestFit(GLenum target, GLint width, GLint height, * break out. This should never happen. But things * happen. The disadvantage with this if-statement is * that we will never be aware of when this happens - * since it will silently branch out. + * since it will silently branch out. */ goto noProxyTextures; } widthPowerOf2= widthAtLevelOne; heightPowerOf2= heightAtLevelOne; - } + } /* else it does fit */ } while (proxyWidth == 0); /* loop must terminate! */ @@ -3456,8 +3456,8 @@ noProxyTextures: } /* closestFit() */ GLint GLAPIENTRY -gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, - GLenum typein, const void *datain, +gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, + GLenum typein, const void *datain, GLsizei widthout, GLsizei heightout, GLenum typeout, void *dataout) { @@ -3482,7 +3482,7 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, return GLU_INVALID_OPERATION; } beforeImage = - malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT)); + malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT)); afterImage = malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { @@ -3493,9 +3493,9 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, fill_image(&psm,widthin, heightin, format, typein, is_index(format), datain, beforeImage); components = elements_per_group(format, 0); - scale_internal(components, widthin, heightin, beforeImage, + scale_internal(components, widthin, heightin, beforeImage, widthout, heightout, afterImage); - empty_image(&psm,widthout, heightout, format, typeout, + empty_image(&psm,widthout, heightout, format, typeout, is_index(format), afterImage, dataout); free((GLbyte *) beforeImage); free((GLbyte *) afterImage); @@ -3506,7 +3506,7 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, GLsizei width, GLsizei widthPowerOf2, - GLenum format, GLenum type, + GLenum format, GLenum type, GLint userLevel, GLint baseLevel,GLint maxLevel, const void *data) { @@ -3532,7 +3532,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, retrieveStoreModes(&psm); newImage = (GLushort *) - malloc(image_size(width, 1, format, GL_UNSIGNED_SHORT)); + malloc(image_size(width, 1, format, GL_UNSIGNED_SHORT)); newImage_width = width; if (newImage == NULL) { return GLU_OUT_OF_MEMORY; @@ -3553,7 +3553,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, if (newImage_width == newwidth) { /* Use newImage for this level */ if (baseLevel <= level && level <= maxLevel) { - glTexImage1D(target, level, internalFormat, newImage_width, + glTexImage1D(target, level, internalFormat, newImage_width, 0, format, GL_UNSIGNED_SHORT, (void *) newImage); } } else { @@ -3569,10 +3569,10 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, return GLU_OUT_OF_MEMORY; } } - scale_internal(cmpts, newImage_width, 1, newImage, + scale_internal(cmpts, newImage_width, 1, newImage, newwidth, 1, otherImage); /* Swap newImage and otherImage */ - imageTemp = otherImage; + imageTemp = otherImage; otherImage = newImage; newImage = imageTemp; @@ -3598,9 +3598,9 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, } GLint GLAPIENTRY -gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, +gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, - GLenum format, GLenum type, + GLenum format, GLenum type, GLint userLevel, GLint baseLevel, GLint maxLevel, const void *data) { @@ -3616,19 +3616,19 @@ gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, levels = computeLog(width); levels+= userLevel; - if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) return GLU_INVALID_VALUE; - return gluBuild1DMipmapLevelsCore(target, internalFormat, + return gluBuild1DMipmapLevelsCore(target, internalFormat, width, - width,format, type, + width,format, type, userLevel, baseLevel, maxLevel, data); } /* gluBuild1DMipmapLevels() */ GLint GLAPIENTRY gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, - GLenum format, GLenum type, + GLenum format, GLenum type, const void *data) { GLint widthPowerOf2; @@ -3653,7 +3653,7 @@ gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, GLint width, GLint height, GLenum format, - GLenum type, const void *data) + GLenum type, const void *data) { GLint newwidth, newheight; GLint level, levels; @@ -3684,15 +3684,15 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, otherImage = NULL; newImage = (GLushort *) - malloc(image_size(width, height, format, GL_UNSIGNED_SHORT)); + malloc(image_size(width, height, format, GL_UNSIGNED_SHORT)); newImage_width = width; newImage_height = height; if (newImage == NULL) { - return GLU_OUT_OF_MEMORY; + return GLU_OUT_OF_MEMORY; } fill_image(&psm,width, height, format, type, is_index(format), - data, newImage); + data, newImage); cmpts = elements_per_group(format,type); glPixelStorei(GL_UNPACK_ALIGNMENT, 2); @@ -3705,39 +3705,39 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); for (level = 0; level <= levels; level++) { - if (newImage_width == newwidth && newImage_height == newheight) { /* Use newImage for this level */ - glTexImage2D(target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL_UNSIGNED_SHORT, - (void *) newImage); - } else { - if (otherImage == NULL) { - memreq = - image_size(newwidth, newheight, format, GL_UNSIGNED_SHORT); - otherImage = (GLushort *) malloc(memreq); - if (otherImage == NULL) { - glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); - glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); - glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); - glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); - return GLU_OUT_OF_MEMORY; - } - } - scale_internal(cmpts, newImage_width, newImage_height, newImage, - newwidth, newheight, otherImage); - /* Swap newImage and otherImage */ - imageTemp = otherImage; - otherImage = newImage; - newImage = imageTemp; - - newImage_width = newwidth; - newImage_height = newheight; - glTexImage2D(target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL_UNSIGNED_SHORT, - (void *) newImage); - } - if (newwidth > 1) newwidth /= 2; - if (newheight > 1) newheight /= 2; + if (newImage_width == newwidth && newImage_height == newheight) { /* Use newImage for this level */ + glTexImage2D(target, level, internalFormat, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_SHORT, + (void *) newImage); + } else { + if (otherImage == NULL) { + memreq = + image_size(newwidth, newheight, format, GL_UNSIGNED_SHORT); + otherImage = (GLushort *) malloc(memreq); + if (otherImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + } + scale_internal(cmpts, newImage_width, newImage_height, newImage, + newwidth, newheight, otherImage); + /* Swap newImage and otherImage */ + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth; + newImage_height = newheight; + glTexImage2D(target, level, internalFormat, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_SHORT, + (void *) newImage); + } + if (newwidth > 1) newwidth /= 2; + if (newheight > 1) newheight /= 2; } glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); @@ -3747,7 +3747,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, free((GLbyte *) newImage); if (otherImage) { - free((GLbyte *) otherImage); + free((GLbyte *) otherImage); } return 0; } @@ -3756,12 +3756,12 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, #define __GLU_INIT_SWAP_IMAGE void *tmpImage #define __GLU_SWAP_IMAGE(a,b) tmpImage = a; a = b; b = tmpImage; -static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, - GLsizei width, GLsizei height, - GLsizei widthPowerOf2, - GLsizei heightPowerOf2, - GLenum format, GLenum type, - GLint userLevel, +static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei widthPowerOf2, + GLsizei heightPowerOf2, + GLenum format, GLenum type, + GLint userLevel, GLint baseLevel,GLint maxLevel, const void *data) { @@ -3782,7 +3782,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, if(type == GL_BITMAP) { return bitmapBuild2DMipmaps(target, internalFormat, width, height, - format, type, data); + format, type, data); } srcImage = dstImage = NULL; @@ -3813,7 +3813,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, if (padding) { rowsize += psm.unpack_alignment - padding; } - usersImage = (const GLubyte *) data + psm.unpack_skip_rows * rowsize + + usersImage = (const GLubyte *) data + psm.unpack_skip_rows * rowsize + psm.unpack_skip_pixels * group_size; glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); @@ -3825,8 +3825,8 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, /* already power-of-two square */ if (width == newwidth && height == newheight) { /* Use usersImage for level userLevel */ - if (baseLevel <= level && level <= maxLevel) { - glTexImage2D(target, level, internalFormat, width, + if (baseLevel <= level && level <= maxLevel) { + glTexImage2D(target, level, internalFormat, width, height, 0, format, type, usersImage); } @@ -3846,7 +3846,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, if (nextWidth < 1) nextWidth= 1; if (nextHeight < 1) nextHeight= 1; memreq = image_size(nextWidth, nextHeight, format, type); - } + } switch(type) { case GL_UNSIGNED_BYTE: @@ -3870,23 +3870,23 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_FLOAT: dstImage = (GLfloat *)malloc(memreq); break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: dstImage = (GLubyte *)malloc(memreq); break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: dstImage = (GLushort *)malloc(memreq); - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - dstImage = (GLuint *)malloc(memreq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memreq); break; default: return GLU_INVALID_ENUM; @@ -3903,12 +3903,12 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, switch(type) { case GL_UNSIGNED_BYTE: halveImage_ubyte(cmpts, width, height, - (const GLubyte *)usersImage, (GLubyte *)dstImage, + (const GLubyte *)usersImage, (GLubyte *)dstImage, element_size, rowsize, group_size); break; case GL_BYTE: halveImage_byte(cmpts, width, height, - (const GLbyte *)usersImage, (GLbyte *)dstImage, + (const GLbyte *)usersImage, (GLbyte *)dstImage, element_size, rowsize, group_size); break; case GL_UNSIGNED_SHORT: @@ -3918,17 +3918,17 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, break; case GL_SHORT: halveImage_short(cmpts, width, height, - (const GLshort *)usersImage, (GLshort *)dstImage, + (const GLshort *)usersImage, (GLshort *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; case GL_UNSIGNED_INT: halveImage_uint(cmpts, width, height, - (const GLuint *)usersImage, (GLuint *)dstImage, + (const GLuint *)usersImage, (GLuint *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; case GL_INT: halveImage_int(cmpts, width, height, - (const GLint *)usersImage, (GLint *)dstImage, + (const GLint *)usersImage, (GLint *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; case GL_FLOAT: @@ -3936,69 +3936,69 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, (const GLfloat *)usersImage, (GLfloat *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; - case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_3_3_2: assert(format == GL_RGB); halveImagePackedPixel(3,extract332,shove332, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: assert(format == GL_RGB); halveImagePackedPixel(3,extract233rev,shove233rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5: halveImagePackedPixel(3,extract565,shove565, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: halveImagePackedPixel(3,extract565rev,shove565rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_SHORT_4_4_4_4: + break; + case GL_UNSIGNED_SHORT_4_4_4_4: halveImagePackedPixel(4,extract4444,shove4444, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: halveImagePackedPixel(4,extract4444rev,shove4444rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_SHORT_5_5_5_1: + break; + case GL_UNSIGNED_SHORT_5_5_5_1: halveImagePackedPixel(4,extract5551,shove5551, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: halveImagePackedPixel(4,extract1555rev,shove1555rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_INT_8_8_8_8: + break; + case GL_UNSIGNED_INT_8_8_8_8: halveImagePackedPixel(4,extract8888,shove8888, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_INT_8_8_8_8_REV: + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: halveImagePackedPixel(4,extract8888rev,shove8888rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_INT_10_10_10_2: + break; + case GL_UNSIGNED_INT_10_10_10_2: halveImagePackedPixel(4,extract1010102,shove1010102, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - case GL_UNSIGNED_INT_2_10_10_10_REV: + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: halveImagePackedPixel(4,extract2101010rev,shove2101010rev, width,height,usersImage,dstImage, element_size,rowsize,myswap_bytes); - break; - default: + break; + default: assert(0); break; } @@ -4006,7 +4006,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, newheight = height/2; /* clamp to 1 */ if (newwidth < 1) newwidth= 1; - if (newheight < 1) newheight= 1; + if (newheight < 1) newheight= 1; myswap_bytes = 0; rowsize = newwidth * group_size; @@ -4035,22 +4035,22 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_FLOAT: dstImage = (GLfloat *)malloc(memreq); break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: dstImage = (GLubyte *)malloc(memreq); break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: dstImage = (GLushort *)malloc(memreq); break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: dstImage = (GLuint *)malloc(memreq); break; default: @@ -4069,30 +4069,30 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, } else { /* user's image is *not* nice power-of-2 sized square */ memreq = image_size(newwidth, newheight, format, type); switch(type) { - case GL_UNSIGNED_BYTE: - dstImage = (GLubyte *)malloc(memreq); - break; - case GL_BYTE: - dstImage = (GLbyte *)malloc(memreq); - break; - case GL_UNSIGNED_SHORT: - dstImage = (GLushort *)malloc(memreq); - break; - case GL_SHORT: - dstImage = (GLshort *)malloc(memreq); - break; - case GL_UNSIGNED_INT: - dstImage = (GLuint *)malloc(memreq); - break; - case GL_INT: - dstImage = (GLint *)malloc(memreq); - break; - case GL_FLOAT: - dstImage = (GLfloat *)malloc(memreq); - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - dstImage = (GLubyte *)malloc(memreq); + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memreq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memreq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memreq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memreq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memreq); break; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: @@ -4108,9 +4108,9 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_UNSIGNED_INT_2_10_10_10_REV: dstImage = (GLuint *)malloc(memreq); break; - default: - return GLU_INVALID_ENUM; - } + default: + return GLU_INVALID_ENUM; + } if (dstImage == NULL) { glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); @@ -4130,7 +4130,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, break; case GL_BYTE: scale_internal_byte(cmpts, width, height, - (const GLbyte *)usersImage, newwidth, newheight, + (const GLbyte *)usersImage, newwidth, newheight, (GLbyte *)dstImage, element_size, rowsize, group_size); break; @@ -4154,89 +4154,89 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, break; case GL_INT: scale_internal_int(cmpts, width, height, - (const GLint *)usersImage, newwidth, newheight, + (const GLint *)usersImage, newwidth, newheight, (GLint *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; case GL_FLOAT: scale_internal_float(cmpts, width, height, - (const GLfloat *)usersImage, newwidth, newheight, + (const GLfloat *)usersImage, newwidth, newheight, (GLfloat *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; - case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_3_3_2: scaleInternalPackedPixel(3,extract332,shove332, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: scaleInternalPackedPixel(3,extract233rev,shove233rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5: scaleInternalPackedPixel(3,extract565,shove565, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5_REV: scaleInternalPackedPixel(3,extract565rev,shove565rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4: scaleInternalPackedPixel(4,extract4444,shove4444, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: scaleInternalPackedPixel(4,extract4444rev,shove4444rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_5_5_5_1: scaleInternalPackedPixel(4,extract5551,shove5551, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: scaleInternalPackedPixel(4,extract1555rev,shove1555rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8: scaleInternalPackedPixel(4,extract8888,shove8888, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_8_8_8_8_REV: scaleInternalPackedPixel(4,extract8888rev,shove8888rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_10_10_10_2: scaleInternalPackedPixel(4,extract1010102,shove1010102, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_2_10_10_10_REV: scaleInternalPackedPixel(4,extract2101010rev,shove2101010rev, width, height,usersImage, newwidth,newheight,(void *)dstImage, element_size,rowsize,myswap_bytes); break; - default: + default: assert(0); break; } @@ -4246,14 +4246,14 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, __GLU_SWAP_IMAGE(srcImage,dstImage); if(levels != 0) { /* use as little memory as possible */ - { + { int nextWidth= newwidth/2; int nextHeight= newheight/2; if (nextWidth < 1) nextWidth= 1; - if (nextHeight < 1) nextHeight= 1; + if (nextHeight < 1) nextHeight= 1; memreq = image_size(nextWidth, nextHeight, format, type); - } + } switch(type) { case GL_UNSIGNED_BYTE: @@ -4277,12 +4277,12 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_FLOAT: dstImage = (GLfloat *)malloc(memreq); break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: dstImage = (GLubyte *)malloc(memreq); break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: @@ -4308,12 +4308,12 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, } } /* level userLevel is in srcImage; nothing saved yet */ - level = userLevel; + level = userLevel; } glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); if (baseLevel <= level && level <= maxLevel) { - glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, format, type, (void *)srcImage); } @@ -4355,96 +4355,96 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, (GLfloat *)srcImage, (GLfloat *)dstImage, element_size, rowsize, group_size, myswap_bytes); break; - case GL_UNSIGNED_BYTE_3_3_2: - halveImagePackedPixel(3,extract332,shove332, + case GL_UNSIGNED_BYTE_3_3_2: + halveImagePackedPixel(3,extract332,shove332, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_BYTE_2_3_3_REV: - halveImagePackedPixel(3,extract233rev,shove233rev, + case GL_UNSIGNED_BYTE_2_3_3_REV: + halveImagePackedPixel(3,extract233rev,shove233rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; case GL_UNSIGNED_SHORT_5_6_5: - halveImagePackedPixel(3,extract565,shove565, + halveImagePackedPixel(3,extract565,shove565, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); - break; + break; case GL_UNSIGNED_SHORT_5_6_5_REV: - halveImagePackedPixel(3,extract565rev,shove565rev, + halveImagePackedPixel(3,extract565rev,shove565rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); - break; - case GL_UNSIGNED_SHORT_4_4_4_4: - halveImagePackedPixel(4,extract4444,shove4444, + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + halveImagePackedPixel(4,extract4444,shove4444, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - halveImagePackedPixel(4,extract4444rev,shove4444rev, + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + halveImagePackedPixel(4,extract4444rev,shove4444rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_SHORT_5_5_5_1: - halveImagePackedPixel(4,extract5551,shove5551, + case GL_UNSIGNED_SHORT_5_5_5_1: + halveImagePackedPixel(4,extract5551,shove5551, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - halveImagePackedPixel(4,extract1555rev,shove1555rev, + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + halveImagePackedPixel(4,extract1555rev,shove1555rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_INT_8_8_8_8: - halveImagePackedPixel(4,extract8888,shove8888, + case GL_UNSIGNED_INT_8_8_8_8: + halveImagePackedPixel(4,extract8888,shove8888, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_INT_8_8_8_8_REV: - halveImagePackedPixel(4,extract8888rev,shove8888rev, + case GL_UNSIGNED_INT_8_8_8_8_REV: + halveImagePackedPixel(4,extract8888rev,shove8888rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_INT_10_10_10_2: - halveImagePackedPixel(4,extract1010102,shove1010102, + case GL_UNSIGNED_INT_10_10_10_2: + halveImagePackedPixel(4,extract1010102,shove1010102, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - case GL_UNSIGNED_INT_2_10_10_10_REV: - halveImagePackedPixel(4,extract2101010rev,shove2101010rev, + case GL_UNSIGNED_INT_2_10_10_10_REV: + halveImagePackedPixel(4,extract2101010rev,shove2101010rev, newwidth,newheight, srcImage,dstImage,element_size,rowsize, myswap_bytes); break; - default: - assert(0); + default: + assert(0); break; } __GLU_SWAP_IMAGE(srcImage,dstImage); - if (newwidth > 1) { newwidth /= 2; rowsize /= 2;} - if (newheight > 1) newheight /= 2; + if (newwidth > 1) { newwidth /= 2; rowsize /= 2;} + if (newheight > 1) newheight /= 2; { /* compute amount to pad per row, if any */ - int rowPad= rowsize % psm.unpack_alignment; + int rowPad= rowsize % psm.unpack_alignment; /* should row be padded? */ if (rowPad == 0) { /* nope, row should not be padded */ /* call tex image with srcImage untouched since it's not padded */ if (baseLevel <= level && level <= maxLevel) { - glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, format, type, (void *) srcImage); } } @@ -4469,7 +4469,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, for (ii= 0, dstTrav= (unsigned char *) newMipmapImage, srcTrav= (unsigned char *) srcImage; - ii< newheight; + ii< newheight; ii++, dstTrav+= newRowLength, /* make sure the correct distance... */ srcTrav+= rowsize) { /* ...is skipped */ @@ -4477,14 +4477,14 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, /* note that the pad bytes are not visited and will contain * garbage, which is ok. */ - } + } - /* ...and use this new image for mipmapping instead */ + /* ...and use this new image for mipmapping instead */ if (baseLevel <= level && level <= maxLevel) { - glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, format, type, newMipmapImage); } - free(newMipmapImage); /* don't forget to free it! */ + free(newMipmapImage); /* don't forget to free it! */ } /* else */ } } /* for level */ @@ -4502,9 +4502,9 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, } /* gluBuild2DMipmapLevelsCore() */ GLint GLAPIENTRY -gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, +gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, GLint userLevel, GLint baseLevel, GLint maxLevel, const void *data) { @@ -4522,21 +4522,21 @@ gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, if (level > levels) levels=level; levels+= userLevel; - if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) return GLU_INVALID_VALUE; - return gluBuild2DMipmapLevelsCore(target, internalFormat, + return gluBuild2DMipmapLevelsCore(target, internalFormat, width, height, width, height, - format, type, + format, type, userLevel, baseLevel, maxLevel, data); } /* gluBuild2DMipmapLevels() */ GLint GLAPIENTRY -gluBuild2DMipmaps(GLenum target, GLint internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, +gluBuild2DMipmaps(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const void *data) { GLint widthPowerOf2, heightPowerOf2; @@ -4563,16 +4563,17 @@ gluBuild2DMipmaps(GLenum target, GLint internalFormat, 0,0,levels,data); } /* gluBuild2DMipmaps() */ +#if 0 /* ** This routine is for the limited case in which -** type == GL_UNSIGNED_BYTE && format != index && +** type == GL_UNSIGNED_BYTE && format != index && ** unpack_alignment = 1 && unpack_swap_bytes == false ** ** so all of the work data can be kept as ubytes instead of shorts. */ static int fastBuild2DMipmaps(const PixelStorageModes *psm, - GLenum target, GLint components, GLint width, - GLint height, GLenum format, + GLenum target, GLint components, GLint width, + GLint height, GLenum format, GLenum type, void *data) { GLint newwidth, newheight; @@ -4620,8 +4621,8 @@ static int fastBuild2DMipmaps(const PixelStorageModes *psm, GLubyte *iter2; GLint i, j; - newImage = (GLubyte *) - malloc(image_size(width, height, format, GL_UNSIGNED_BYTE)); + newImage = (GLubyte *) + malloc(image_size(width, height, format, GL_UNSIGNED_BYTE)); newImage_width = width; newImage_height = height; if (newImage == NULL) { @@ -4638,7 +4639,7 @@ static int fastBuild2DMipmaps(const PixelStorageModes *psm, } rowsize = groups_per_line * cmpts; elements_per_line = width * cmpts; - start = (const GLubyte *) data + psm->unpack_skip_rows * rowsize + + start = (const GLubyte *) data + psm->unpack_skip_rows * rowsize + psm->unpack_skip_pixels * cmpts; iter2 = newImage; @@ -4663,12 +4664,12 @@ static int fastBuild2DMipmaps(const PixelStorageModes *psm, for (level = 0; level <= levels; level++) { if (newImage_width == newwidth && newImage_height == newheight) { /* Use newImage for this level */ - glTexImage2D(target, level, components, newImage_width, - newImage_height, 0, format, GL_UNSIGNED_BYTE, + glTexImage2D(target, level, components, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_BYTE, (void *) newImage); } else { if (otherImage == NULL) { - memreq = + memreq = image_size(newwidth, newheight, format, GL_UNSIGNED_BYTE); otherImage = (GLubyte *) malloc(memreq); if (otherImage == NULL) { @@ -4681,18 +4682,18 @@ static int fastBuild2DMipmaps(const PixelStorageModes *psm, } } /* - scale_internal_ubyte(cmpts, newImage_width, newImage_height, + scale_internal_ubyte(cmpts, newImage_width, newImage_height, newImage, newwidth, newheight, otherImage); */ /* Swap newImage and otherImage */ - imageTemp = otherImage; + imageTemp = otherImage; otherImage = newImage; newImage = imageTemp; newImage_width = newwidth; newImage_height = newheight; - glTexImage2D(target, level, components, newImage_width, - newImage_height, 0, format, GL_UNSIGNED_BYTE, + glTexImage2D(target, level, components, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_BYTE, (void *) newImage); } if (newwidth > 1) newwidth /= 2; @@ -4712,18 +4713,19 @@ static int fastBuild2DMipmaps(const PixelStorageModes *psm, } return 0; } +#endif /* * Utility Routines */ -static GLint elements_per_group(GLenum format, GLenum type) +static GLint elements_per_group(GLenum format, GLenum type) { /* * Return the number of elements per group of a specified format */ /* If the type is packedpixels then answer is 1 (ignore format) */ - if (type == GL_UNSIGNED_BYTE_3_3_2 || + if (type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV || type == GL_UNSIGNED_SHORT_5_6_5 || type == GL_UNSIGNED_SHORT_5_6_5_REV || @@ -4735,7 +4737,7 @@ static GLint elements_per_group(GLenum format, GLenum type) type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) { - return 1; + return 1; } /* Types are not packed pixels, so get elements per group */ @@ -4753,7 +4755,7 @@ static GLint elements_per_group(GLenum format, GLenum type) } } -static GLfloat bytes_per_element(GLenum type) +static GLfloat bytes_per_element(GLenum type) { /* * Return the number of bytes per element, based on the element type @@ -4776,7 +4778,7 @@ static GLfloat bytes_per_element(GLenum type) case GL_FLOAT: return(sizeof(GLfloat)); case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: return(sizeof(GLubyte)); case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: @@ -4795,7 +4797,7 @@ static GLfloat bytes_per_element(GLenum type) } } -static GLint is_index(GLenum format) +static GLint is_index(GLenum format) { return format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX; } @@ -4804,7 +4806,7 @@ static GLint is_index(GLenum format) ** Compute memory required for internal packed array of data of given type ** and format. */ -static GLint image_size(GLint width, GLint height, GLenum format, GLenum type) +static GLint image_size(GLint width, GLint height, GLenum format, GLenum type) { int bytes_per_row; int components; @@ -4825,8 +4827,8 @@ assert(height > 0); ** The internal format used is an array of unsigned shorts. */ static void fill_image(const PixelStorageModes *psm, - GLint width, GLint height, GLenum format, - GLenum type, GLboolean index_format, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, const void *userdata, GLushort *newimage) { GLint components; @@ -4860,7 +4862,7 @@ static void fill_image(const PixelStorageModes *psm, if (padding) { rowsize += psm->unpack_alignment - padding; } - start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + + start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + (psm->unpack_skip_pixels * components / 8); elements_per_line = width * components; iter2 = newimage; @@ -4902,7 +4904,7 @@ static void fill_image(const PixelStorageModes *psm, if (padding) { rowsize += psm->unpack_alignment - padding; } - start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + + start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + psm->unpack_skip_pixels * group_size; elements_per_line = width * components; @@ -4920,7 +4922,7 @@ static void fill_image(const PixelStorageModes *psm, *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: extract233rev(0,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); @@ -4941,37 +4943,37 @@ static void fill_image(const PixelStorageModes *psm, *iter2++ = (*((const GLbyte *) iter)) * 516; } break; - case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5: extract565(myswap_bytes,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5_REV: extract565rev(myswap_bytes,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4: extract4444(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: extract4444rev(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_5_5_5_1: extract5551(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: extract1555rev(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); @@ -4997,19 +4999,19 @@ static void fill_image(const PixelStorageModes *psm, *iter2++ = widget.us[0]; } break; - case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8: extract8888(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_8_8_8_8_REV: extract8888rev(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_10_10_10_2: extract1010102(myswap_bytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); @@ -5063,7 +5065,7 @@ static void fill_image(const PixelStorageModes *psm, /* want 'iter' pointing at start, not within, row for assertion * purposes */ - iter= start; + iter= start; #endif } /* for i */ @@ -5076,7 +5078,7 @@ static void fill_image(const PixelStorageModes *psm, elements_per_group(format,0)]); } assert( iter == &((const GLubyte *)userdata)[rowsize*height + - psm->unpack_skip_rows * rowsize + + psm->unpack_skip_rows * rowsize + psm->unpack_skip_pixels * group_size] ); } /* else */ @@ -5088,8 +5090,8 @@ static void fill_image(const PixelStorageModes *psm, ** empty_image() because it is the opposite of fill_image(). */ static void empty_image(const PixelStorageModes *psm, - GLint width, GLint height, GLenum format, - GLenum type, GLboolean index_format, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, const GLushort *oldimage, void *userdata) { GLint components; @@ -5123,7 +5125,7 @@ static void empty_image(const PixelStorageModes *psm, if (padding) { rowsize += psm->pack_alignment - padding; } - start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + + start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + (psm->pack_skip_pixels * components / 8); elements_per_line = width * components; iter2 = oldimage; @@ -5165,7 +5167,7 @@ static void empty_image(const PixelStorageModes *psm, start += rowsize; } } else { - float shoveComponents[4]; + float shoveComponents[4]; element_size = bytes_per_element(type); group_size = element_size * components; @@ -5176,7 +5178,7 @@ static void empty_image(const PixelStorageModes *psm, if (padding) { rowsize += psm->pack_alignment - padding; } - start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + + start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + psm->pack_skip_pixels * group_size; elements_per_line = width * components; @@ -5187,18 +5189,18 @@ static void empty_image(const PixelStorageModes *psm, Type_Widget widget; switch(type) { - case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_3_3_2: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove332(shoveComponents,0,(void *)iter); break; case GL_UNSIGNED_BYTE_2_3_3_REV: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove233rev(shoveComponents,0,(void *)iter); - break; + break; case GL_UNSIGNED_BYTE: if (index_format) { *iter = *iter2++; @@ -5213,10 +5215,10 @@ static void empty_image(const PixelStorageModes *psm, *((GLbyte *) iter) = *iter2++ >> 9; } break; - case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove565(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5226,10 +5228,10 @@ static void empty_image(const PixelStorageModes *psm, *(GLushort *)iter = widget.us[0]; } break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5_REV: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove565rev(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5239,10 +5241,10 @@ static void empty_image(const PixelStorageModes *psm, *(GLushort *)iter = widget.us[0]; } break; - case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove4444(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5251,10 +5253,10 @@ static void empty_image(const PixelStorageModes *psm, *(GLushort *)iter = widget.us[0]; } break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove4444rev(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5266,7 +5268,7 @@ static void empty_image(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_5_5_5_1: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove5551(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5278,7 +5280,7 @@ static void empty_image(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_1_5_5_5_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove1555rev(shoveComponents,0,(void *)&widget.us[0]); if (myswap_bytes) { iter[0] = widget.ub[1]; @@ -5306,10 +5308,10 @@ static void empty_image(const PixelStorageModes *psm, iter[1] = widget.ub[1]; } break; - case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove8888(shoveComponents,0,(void *)&widget.ui); if (myswap_bytes) { iter[3] = widget.ub[0]; @@ -5317,14 +5319,14 @@ static void empty_image(const PixelStorageModes *psm, iter[1] = widget.ub[2]; iter[0] = widget.ub[3]; } else { - *(GLuint *)iter= widget.ui; + *(GLuint *)iter= widget.ui; } break; - case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_8_8_8_8_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove8888rev(shoveComponents,0,(void *)&widget.ui); if (myswap_bytes) { iter[3] = widget.ub[0]; @@ -5332,13 +5334,13 @@ static void empty_image(const PixelStorageModes *psm, iter[1] = widget.ub[2]; iter[0] = widget.ub[3]; } else { - *(GLuint *)iter= widget.ui; + *(GLuint *)iter= widget.ui; } break; - case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_10_10_10_2: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove1010102(shoveComponents,0,(void *)&widget.ui); if (myswap_bytes) { iter[3] = widget.ub[0]; @@ -5346,13 +5348,13 @@ static void empty_image(const PixelStorageModes *psm, iter[1] = widget.ub[2]; iter[0] = widget.ub[3]; } else { - *(GLuint *)iter= widget.ui; + *(GLuint *)iter= widget.ui; } break; case GL_UNSIGNED_INT_2_10_10_10_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove2101010rev(shoveComponents,0,(void *)&widget.ui); if (myswap_bytes) { iter[3] = widget.ub[0]; @@ -5360,7 +5362,7 @@ static void empty_image(const PixelStorageModes *psm, iter[1] = widget.ub[2]; iter[0] = widget.ub[3]; } else { - *(GLuint *)iter= widget.ui; + *(GLuint *)iter= widget.ui; } break; case GL_INT: @@ -5405,7 +5407,7 @@ static void empty_image(const PixelStorageModes *psm, /* want 'iter' pointing at start, not within, row for assertion * purposes */ - iter= start; + iter= start; #endif } /* for i */ @@ -5418,16 +5420,16 @@ static void empty_image(const PixelStorageModes *psm, elements_per_group(format,0)]); } assert( iter == &((GLubyte *)userdata)[rowsize*height + - psm->pack_skip_rows * rowsize + + psm->pack_skip_rows * rowsize + psm->pack_skip_pixels * group_size] ); } /* else */ } /* empty_image() */ /*-------------------------------------------------------------------------- - * Decimation of packed pixel types + * Decimation of packed pixel types *-------------------------------------------------------------------------- - */ + */ static void extract332(int isSwap, const void *packedPixel, GLfloat extractComponents[]) { @@ -5441,11 +5443,11 @@ static void extract332(int isSwap, extractComponents[0]= (float)((ubyte & 0xe0) >> 5) / 7.0; extractComponents[1]= (float)((ubyte & 0x1c) >> 2) / 7.0; /* 7 = 2^3-1 */ - extractComponents[2]= (float)((ubyte & 0x03) ) / 3.0; /* 3 = 2^2-1 */ + extractComponents[2]= (float)((ubyte & 0x03) ) / 3.0; /* 3 = 2^2-1 */ } /* extract332() */ -static void shove332(const GLfloat shoveComponents[], - int index, void *packedPixel) +static void shove332(const GLfloat shoveComponents[], + int index, void *packedPixel) { /* 11100000 == 0xe0 */ /* 00011100 == 0x1c */ @@ -5456,12 +5458,12 @@ static void shove332(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLubyte *)packedPixel)[index] = + ((GLubyte *)packedPixel)[index] = ((GLubyte)((shoveComponents[0] * 7)+0.5) << 5) & 0xe0; - ((GLubyte *)packedPixel)[index] |= + ((GLubyte *)packedPixel)[index] |= ((GLubyte)((shoveComponents[1] * 7)+0.5) << 2) & 0x1c; ((GLubyte *)packedPixel)[index] |= - ((GLubyte)((shoveComponents[2] * 3)+0.5) ) & 0x03; + ((GLubyte)((shoveComponents[2] * 3)+0.5) ) & 0x03; } /* shove332() */ static void extract233rev(int isSwap, @@ -5472,7 +5474,7 @@ static void extract233rev(int isSwap, isSwap= isSwap; /* turn off warnings */ /* 0000,0111 == 0x07 */ - /* 0011,1000 == 0x38 */ + /* 0011,1000 == 0x38 */ /* 1100,0000 == 0xC0 */ extractComponents[0]= (float)((ubyte & 0x07) ) / 7.0; @@ -5480,11 +5482,11 @@ static void extract233rev(int isSwap, extractComponents[2]= (float)((ubyte & 0xC0) >> 6) / 3.0; } /* extract233rev() */ -static void shove233rev(const GLfloat shoveComponents[], - int index, void *packedPixel) +static void shove233rev(const GLfloat shoveComponents[], + int index, void *packedPixel) { /* 0000,0111 == 0x07 */ - /* 0011,1000 == 0x38 */ + /* 0011,1000 == 0x38 */ /* 1100,0000 == 0xC0 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); @@ -5492,18 +5494,18 @@ static void shove233rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLubyte *)packedPixel)[index] = + ((GLubyte *)packedPixel)[index] = ((GLubyte)((shoveComponents[0] * 7.0)+0.5) ) & 0x07; - ((GLubyte *)packedPixel)[index]|= + ((GLubyte *)packedPixel)[index]|= ((GLubyte)((shoveComponents[1] * 7.0)+0.5) << 3) & 0x38; - ((GLubyte *)packedPixel)[index]|= + ((GLubyte *)packedPixel)[index]|= ((GLubyte)((shoveComponents[2] * 3.0)+0.5) << 6) & 0xC0; } /* shove233rev() */ static void extract565(int isSwap, const void *packedPixel, GLfloat extractComponents[]) { - GLushort ushort= *(const GLushort *)packedPixel; + GLushort ushort= *(const GLushort *)packedPixel; if (isSwap) { ushort= __GLU_SWAP_2_BYTES(packedPixel); @@ -5533,18 +5535,18 @@ static void shove565(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 31)+0.5) << 11) & 0xf800; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 63)+0.5) << 5) & 0x07e0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 31)+0.5) ) & 0x001f; } /* shove565() */ static void extract565rev(int isSwap, const void *packedPixel, GLfloat extractComponents[]) { - GLushort ushort= *(const GLushort *)packedPixel; + GLushort ushort= *(const GLushort *)packedPixel; if (isSwap) { ushort= __GLU_SWAP_2_BYTES(packedPixel); @@ -5557,7 +5559,7 @@ static void extract565rev(int isSwap, /* 00000111,11100000 == 0x07e0 */ /* 11111000,00000000 == 0xf800 */ - extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; + extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; extractComponents[1]= (float)((ushort & 0x07E0) >> 5) / 63.0; extractComponents[2]= (float)((ushort & 0xF800) >> 11) / 31.0; } /* extract565rev() */ @@ -5574,15 +5576,15 @@ static void shove565rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 31.0)+0.5) ) & 0x001F; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 63.0)+0.5) << 5) & 0x07E0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 31.0)+0.5) << 11) & 0xF800; } /* shove565rev() */ -static void extract4444(int isSwap,const void *packedPixel, +static void extract4444(int isSwap,const void *packedPixel, GLfloat extractComponents[]) { GLushort ushort; @@ -5594,15 +5596,15 @@ static void extract4444(int isSwap,const void *packedPixel, ushort= *(const GLushort *)packedPixel; } - /* 11110000,00000000 == 0xf000 */ - /* 00001111,00000000 == 0x0f00 */ - /* 00000000,11110000 == 0x00f0 */ - /* 00000000,00001111 == 0x000f */ + /* 11110000,00000000 == 0xf000 */ + /* 00001111,00000000 == 0x0f00 */ + /* 00000000,11110000 == 0x00f0 */ + /* 00000000,00001111 == 0x000f */ extractComponents[0]= (float)((ushort & 0xf000) >> 12) / 15.0;/* 15=2^4-1 */ extractComponents[1]= (float)((ushort & 0x0f00) >> 8) / 15.0; extractComponents[2]= (float)((ushort & 0x00f0) >> 4) / 15.0; - extractComponents[3]= (float)((ushort & 0x000f) ) / 15.0; + extractComponents[3]= (float)((ushort & 0x000f) ) / 15.0; } /* extract4444() */ static void shove4444(const GLfloat shoveComponents[], @@ -5614,17 +5616,17 @@ static void shove4444(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 15)+0.5) << 12) & 0xf000; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 15)+0.5) << 8) & 0x0f00; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 15)+0.5) << 4) & 0x00f0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[3] * 15)+0.5) ) & 0x000f; } /* shove4444() */ -static void extract4444rev(int isSwap,const void *packedPixel, +static void extract4444rev(int isSwap,const void *packedPixel, GLfloat extractComponents[]) { GLushort ushort; @@ -5636,13 +5638,13 @@ static void extract4444rev(int isSwap,const void *packedPixel, ushort= *(const GLushort *)packedPixel; } - /* 00000000,00001111 == 0x000f */ - /* 00000000,11110000 == 0x00f0 */ - /* 00001111,00000000 == 0x0f00 */ - /* 11110000,00000000 == 0xf000 */ + /* 00000000,00001111 == 0x000f */ + /* 00000000,11110000 == 0x00f0 */ + /* 00001111,00000000 == 0x0f00 */ + /* 11110000,00000000 == 0xf000 */ /* 15 = 2^4-1 */ - extractComponents[0]= (float)((ushort & 0x000F) ) / 15.0; + extractComponents[0]= (float)((ushort & 0x000F) ) / 15.0; extractComponents[1]= (float)((ushort & 0x00F0) >> 4) / 15.0; extractComponents[2]= (float)((ushort & 0x0F00) >> 8) / 15.0; extractComponents[3]= (float)((ushort & 0xF000) >> 12) / 15.0; @@ -5651,10 +5653,10 @@ static void extract4444rev(int isSwap,const void *packedPixel, static void shove4444rev(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 00000000,00001111 == 0x000f */ - /* 00000000,11110000 == 0x00f0 */ - /* 00001111,00000000 == 0x0f00 */ - /* 11110000,00000000 == 0xf000 */ + /* 00000000,00001111 == 0x000f */ + /* 00000000,11110000 == 0x00f0 */ + /* 00001111,00000000 == 0x0f00 */ + /* 11110000,00000000 == 0xf000 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5662,17 +5664,17 @@ static void shove4444rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 15)+0.5) ) & 0x000F; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 15)+0.5) << 4) & 0x00F0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 15)+0.5) << 8) & 0x0F00; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[3] * 15)+0.5) << 12) & 0xF000; } /* shove4444rev() */ -static void extract5551(int isSwap,const void *packedPixel, +static void extract5551(int isSwap,const void *packedPixel, GLfloat extractComponents[]) { GLushort ushort; @@ -5684,10 +5686,10 @@ static void extract5551(int isSwap,const void *packedPixel, ushort= *(const GLushort *)packedPixel; } - /* 11111000,00000000 == 0xf800 */ - /* 00000111,11000000 == 0x07c0 */ - /* 00000000,00111110 == 0x003e */ - /* 00000000,00000001 == 0x0001 */ + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11000000 == 0x07c0 */ + /* 00000000,00111110 == 0x003e */ + /* 00000000,00000001 == 0x0001 */ extractComponents[0]=(float)((ushort & 0xf800) >> 11) / 31.0;/* 31 = 2^5-1*/ extractComponents[1]=(float)((ushort & 0x07c0) >> 6) / 31.0; @@ -5698,10 +5700,10 @@ static void extract5551(int isSwap,const void *packedPixel, static void shove5551(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 11111000,00000000 == 0xf800 */ - /* 00000111,11000000 == 0x07c0 */ - /* 00000000,00111110 == 0x003e */ - /* 00000000,00000001 == 0x0001 */ + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11000000 == 0x07c0 */ + /* 00000000,00111110 == 0x003e */ + /* 00000000,00000001 == 0x0001 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5709,17 +5711,17 @@ static void shove5551(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 31)+0.5) << 11) & 0xf800; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 31)+0.5) << 6) & 0x07c0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 31)+0.5) << 1) & 0x003e; - ((GLushort *)packedPixel)[index]|= - ((GLushort)((shoveComponents[3])+0.5) ) & 0x0001; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3])+0.5) ) & 0x0001; } /* shove5551() */ -static void extract1555rev(int isSwap,const void *packedPixel, +static void extract1555rev(int isSwap,const void *packedPixel, GLfloat extractComponents[]) { GLushort ushort; @@ -5731,13 +5733,13 @@ static void extract1555rev(int isSwap,const void *packedPixel, ushort= *(const GLushort *)packedPixel; } - /* 00000000,00011111 == 0x001F */ - /* 00000011,11100000 == 0x03E0 */ - /* 01111100,00000000 == 0x7C00 */ - /* 10000000,00000000 == 0x8000 */ + /* 00000000,00011111 == 0x001F */ + /* 00000011,11100000 == 0x03E0 */ + /* 01111100,00000000 == 0x7C00 */ + /* 10000000,00000000 == 0x8000 */ /* 31 = 2^5-1 */ - extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; + extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; extractComponents[1]= (float)((ushort & 0x03E0) >> 5) / 31.0; extractComponents[2]= (float)((ushort & 0x7C00) >> 10) / 31.0; extractComponents[3]= (float)((ushort & 0x8000) >> 15); @@ -5746,10 +5748,10 @@ static void extract1555rev(int isSwap,const void *packedPixel, static void shove1555rev(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 00000000,00011111 == 0x001F */ - /* 00000011,11100000 == 0x03E0 */ - /* 01111100,00000000 == 0x7C00 */ - /* 10000000,00000000 == 0x8000 */ + /* 00000000,00011111 == 0x001F */ + /* 00000011,11100000 == 0x03E0 */ + /* 01111100,00000000 == 0x7C00 */ + /* 10000000,00000000 == 0x8000 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5757,15 +5759,15 @@ static void shove1555rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLushort *)packedPixel)[index] = + ((GLushort *)packedPixel)[index] = ((GLushort)((shoveComponents[0] * 31)+0.5) ) & 0x001F; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[1] * 31)+0.5) << 5) & 0x03E0; - ((GLushort *)packedPixel)[index]|= + ((GLushort *)packedPixel)[index]|= ((GLushort)((shoveComponents[2] * 31)+0.5) << 10) & 0x7C00; - ((GLushort *)packedPixel)[index]|= - ((GLushort)((shoveComponents[3])+0.5) << 15) & 0x8000; -} /* shove1555rev() */ + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3])+0.5) << 15) & 0x8000; +} /* shove1555rev() */ static void extract8888(int isSwap, const void *packedPixel, GLfloat extractComponents[]) @@ -5779,25 +5781,25 @@ static void extract8888(int isSwap, uint= *(const GLuint *)packedPixel; } - /* 11111111,00000000,00000000,00000000 == 0xff000000 */ - /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ - /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ - /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ /* 255 = 2^8-1 */ extractComponents[0]= (float)((uint & 0xff000000) >> 24) / 255.0; extractComponents[1]= (float)((uint & 0x00ff0000) >> 16) / 255.0; extractComponents[2]= (float)((uint & 0x0000ff00) >> 8) / 255.0; - extractComponents[3]= (float)((uint & 0x000000ff) ) / 255.0; + extractComponents[3]= (float)((uint & 0x000000ff) ) / 255.0; } /* extract8888() */ static void shove8888(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 11111111,00000000,00000000,00000000 == 0xff000000 */ - /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ - /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ - /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5805,14 +5807,14 @@ static void shove8888(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLuint *)packedPixel)[index] = + ((GLuint *)packedPixel)[index] = ((GLuint)((shoveComponents[0] * 255)+0.5) << 24) & 0xff000000; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[1] * 255)+0.5) << 16) & 0x00ff0000; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[2] * 255)+0.5) << 8) & 0x0000ff00; - ((GLuint *)packedPixel)[index]|= - ((GLuint)((shoveComponents[3] * 255)+0.5) ) & 0x000000ff; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 255)+0.5) ) & 0x000000ff; } /* shove8888() */ static void extract8888rev(int isSwap, @@ -5827,13 +5829,13 @@ static void extract8888rev(int isSwap, uint= *(const GLuint *)packedPixel; } - /* 00000000,00000000,00000000,11111111 == 0x000000ff */ - /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ - /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ - /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ /* 255 = 2^8-1 */ - extractComponents[0]= (float)((uint & 0x000000FF) ) / 255.0; + extractComponents[0]= (float)((uint & 0x000000FF) ) / 255.0; extractComponents[1]= (float)((uint & 0x0000FF00) >> 8) / 255.0; extractComponents[2]= (float)((uint & 0x00FF0000) >> 16) / 255.0; extractComponents[3]= (float)((uint & 0xFF000000) >> 24) / 255.0; @@ -5842,10 +5844,10 @@ static void extract8888rev(int isSwap, static void shove8888rev(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 00000000,00000000,00000000,11111111 == 0x000000ff */ - /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ - /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ - /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5853,13 +5855,13 @@ static void shove8888rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLuint *)packedPixel)[index] = - ((GLuint)((shoveComponents[0] * 255)+0.5) ) & 0x000000FF; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index] = + ((GLuint)((shoveComponents[0] * 255)+0.5) ) & 0x000000FF; + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[1] * 255)+0.5) << 8) & 0x0000FF00; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[2] * 255)+0.5) << 16) & 0x00FF0000; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[3] * 255)+0.5) << 24) & 0xFF000000; } /* shove8888rev() */ @@ -5875,25 +5877,25 @@ static void extract1010102(int isSwap, uint= *(const GLuint *)packedPixel; } - /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ - /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ - /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ - /* 00000000,00000000,00000000,00000011 == 0x00000003 */ + /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ + /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ + /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ + /* 00000000,00000000,00000000,00000011 == 0x00000003 */ /* 1023 = 2^10-1 */ - extractComponents[0]= (float)((uint & 0xffc00000) >> 22) / 1023.0; + extractComponents[0]= (float)((uint & 0xffc00000) >> 22) / 1023.0; extractComponents[1]= (float)((uint & 0x003ff000) >> 12) / 1023.0; extractComponents[2]= (float)((uint & 0x00000ffc) >> 2) / 1023.0; - extractComponents[3]= (float)((uint & 0x00000003) ) / 3.0; + extractComponents[3]= (float)((uint & 0x00000003) ) / 3.0; } /* extract1010102() */ static void shove1010102(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ - /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ - /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ - /* 00000000,00000000,00000000,00000011 == 0x00000003 */ + /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ + /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ + /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ + /* 00000000,00000000,00000000,00000011 == 0x00000003 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5901,15 +5903,15 @@ static void shove1010102(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLuint *)packedPixel)[index] = + ((GLuint *)packedPixel)[index] = ((GLuint)((shoveComponents[0] * 1023)+0.5) << 22) & 0xffc00000; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[1] * 1023)+0.5) << 12) & 0x003ff000; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[2] * 1023)+0.5) << 2) & 0x00000ffc; - ((GLuint *)packedPixel)[index]|= - ((GLuint)((shoveComponents[3] * 3)+0.5) ) & 0x00000003; -} /* shove1010102() */ + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 3)+0.5) ) & 0x00000003; +} /* shove1010102() */ static void extract2101010rev(int isSwap, const void *packedPixel, @@ -5924,26 +5926,26 @@ static void extract2101010rev(int isSwap, uint= *(const GLuint *)packedPixel; } - /* 00000000,00000000,00000011,11111111 == 0x000003FF */ - /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ - /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ - /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ + /* 00000000,00000000,00000011,11111111 == 0x000003FF */ + /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ + /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ + /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ /* 1023 = 2^10-1 */ - extractComponents[0]= (float)((uint & 0x000003FF) ) / 1023.0; + extractComponents[0]= (float)((uint & 0x000003FF) ) / 1023.0; extractComponents[1]= (float)((uint & 0x000FFC00) >> 10) / 1023.0; extractComponents[2]= (float)((uint & 0x3FF00000) >> 20) / 1023.0; - extractComponents[3]= (float)((uint & 0xC0000000) >> 30) / 3.0; + extractComponents[3]= (float)((uint & 0xC0000000) >> 30) / 3.0; /* 3 = 2^2-1 */ } /* extract2101010rev() */ static void shove2101010rev(const GLfloat shoveComponents[], int index,void *packedPixel) { - /* 00000000,00000000,00000011,11111111 == 0x000003FF */ - /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ - /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ - /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ + /* 00000000,00000000,00000011,11111111 == 0x000003FF */ + /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ + /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ + /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); @@ -5951,14 +5953,14 @@ static void shove2101010rev(const GLfloat shoveComponents[], assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); /* due to limited precision, need to round before shoving */ - ((GLuint *)packedPixel)[index] = + ((GLuint *)packedPixel)[index] = ((GLuint)((shoveComponents[0] * 1023)+0.5) ) & 0x000003FF; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[1] * 1023)+0.5) << 10) & 0x000FFC00; - ((GLuint *)packedPixel)[index]|= + ((GLuint *)packedPixel)[index]|= ((GLuint)((shoveComponents[2] * 1023)+0.5) << 20) & 0x3FF00000; - ((GLuint *)packedPixel)[index]|= - ((GLuint)((shoveComponents[3] * 3)+0.5) << 30) & 0xC0000000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 3)+0.5) << 30) & 0xC0000000; } /* shove2101010rev() */ static void scaleInternalPackedPixel(int components, @@ -5966,7 +5968,7 @@ static void scaleInternalPackedPixel(int components, (int, const void *,GLfloat []), void (*shovePackedPixel) (const GLfloat [], int, void *), - GLint widthIn,GLint heightIn, + GLint widthIn,GLint heightIn, const void *dataIn, GLint widthOut,GLint heightOut, void *dataOut, @@ -6007,7 +6009,7 @@ static void scaleInternalPackedPixel(int components, convy_float = convy - convy_int; convx_int = floor(convx); convx_float = convx - convx_int; - + area = convx * convy; lowy_int = 0; @@ -6034,118 +6036,118 @@ static void scaleInternalPackedPixel(int components, if((highy_int>lowy_int) && (highx_int>lowx_int)) { y_percent = 1-lowy_float; - temp = (const char *)dataIn + xindex + lowy_int * rowSizeInBytes; + temp = (const char *)dataIn + xindex + lowy_int * rowSizeInBytes; percent = y_percent * (1-lowx_float); #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { if (myswap_bytes) { totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; } else { - totals[k] += *(const GLushort*)temp_index * percent; + totals[k] += *(const GLushort*)temp_index * percent; } - } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif left = temp; - for(l = lowx_int+1; l < highx_int; l++) { + for(l = lowx_int+1; l < highx_int; l++) { temp += pixelSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * y_percent; - } + } #endif - } + } temp += pixelSizeInBytes; right = temp; percent = y_percent * highx_float; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif /* calculate the value for pixels in the last row */ - + y_percent = highy_float; percent = y_percent * (1-lowx_float); temp = (const char *)dataIn + xindex + highy_int * rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif for(l = lowx_int+1; l < highx_int; l++) { - temp += pixelSizeInBytes; + temp += pixelSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } - } + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * y_percent; - } + } #endif - } - temp += pixelSizeInBytes; + } + temp += pixelSizeInBytes; percent = y_percent * highx_float; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif /* calculate the value for pixels in the 1st and last column */ @@ -6153,23 +6155,23 @@ static void scaleInternalPackedPixel(int components, left += rowSizeInBytes; right += rowSizeInBytes; #if 0 - for (k = 0; k < components; - k++, left += element_size, right += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + - __GLU_SWAP_2_BYTES(right) * highx_float; - } else { - totals[k] += *(const GLushort*)left * (1-lowx_float) - + *(const GLushort*)right * highx_float; - } + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_2_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLushort*)left * (1-lowx_float) + + *(const GLushort*)right * highx_float; + } } #else (*extractPackedPixel)(isSwap,left,extractTotals); (*extractPackedPixel)(isSwap,right,extractMoreTotals); for (k = 0; k < components; k++) { totals[k]+= (extractTotals[k]*(1-lowx_float) + - extractMoreTotals[k]*highx_float); + extractMoreTotals[k]*highx_float); } #endif } @@ -6178,128 +6180,128 @@ static void scaleInternalPackedPixel(int components, percent = (1-lowy_float)*x_percent; temp = (const char *)dataIn + xindex + lowy_int*rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif for(m = lowy_int+1; m < highy_int; m++) { temp += rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * x_percent; - } else { - totals[k] += *(const GLushort*)temp_index * x_percent; - } + } else { + totals[k] += *(const GLushort*)temp_index * x_percent; + } } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * x_percent; - } + } #endif } percent = x_percent * highy_float; temp += rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif } else if (highx_int > lowx_int) { y_percent = highy_float - lowy_float; percent = (1-lowx_float)*y_percent; temp = (const char *)dataIn + xindex + lowy_int*rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif for (l = lowx_int+1; l < highx_int; l++) { - temp += pixelSizeInBytes; + temp += pixelSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += - __GLU_SWAP_2_BYTES(temp_index) * y_percent; - } else { - totals[k] += *(const GLushort*)temp_index * y_percent; - } + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * y_percent; - } + } #endif } temp += pixelSizeInBytes; percent = y_percent * highx_float; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif } else { percent = (highy_float-lowy_float)*(highx_float-lowx_float); temp = (const char *)dataIn + xindex + lowy_int * rowSizeInBytes; #if 0 - for (k = 0, temp_index = temp; k < components; + for (k = 0, temp_index = temp; k < components; k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; - } else { - totals[k] += *(const GLushort*)temp_index * percent; - } - } + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k] * percent; - } + } #endif } @@ -6309,23 +6311,23 @@ static void scaleInternalPackedPixel(int components, temp = temp0; for(l = lowx_int+1; l < highx_int; l++) { #if 0 - for (k = 0, temp_index = temp; k < components; - k++, temp_index += element_size) { - if (myswap_bytes) { - totals[k] += __GLU_SWAP_2_BYTES(temp_index); - } else { - totals[k] += *(const GLushort*)temp_index; - } - } + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index); + } else { + totals[k] += *(const GLushort*)temp_index; + } + } #else (*extractPackedPixel)(isSwap,temp,extractTotals); for (k = 0; k < components; k++) { totals[k]+= extractTotals[k]; - } + } #endif - temp += pixelSizeInBytes; - } - temp0 += rowSizeInBytes; + temp += pixelSizeInBytes; + } + temp0 += rowSizeInBytes; } outindex = (j + (i * widthOut)); /* * (components == 1) */ @@ -6336,14 +6338,14 @@ static void scaleInternalPackedPixel(int components, } #else for (k = 0; k < components; k++) { - shoveTotals[k]= totals[k]/area; + shoveTotals[k]= totals[k]/area; } (*shovePackedPixel)(shoveTotals,outindex,(void *)dataOut); #endif lowx_int = highx_int; lowx_float = highx_float; highx_int += convx_int; - highx_float += convx_float; + highx_float += convx_float; if(highx_float > 1) { highx_float -= 1.0; highx_int++; @@ -6362,17 +6364,17 @@ static void scaleInternalPackedPixel(int components, assert(outindex == (widthOut*heightOut - 1)); } /* scaleInternalPackedPixel() */ -/* rowSizeInBytes is at least the width (in bytes) due to padding on - * inputs; not always equal. Output NEVER has row padding. +/* rowSizeInBytes is at least the width (in bytes) due to padding on + * inputs; not always equal. Output NEVER has row padding. */ static void halveImagePackedPixel(int components, void (*extractPackedPixel) (int, const void *,GLfloat []), void (*shovePackedPixel) (const GLfloat [],int, void *), - GLint width, GLint height, + GLint width, GLint height, const void *dataIn, void *dataOut, - GLint pixelSizeInBytes, + GLint pixelSizeInBytes, GLint rowSizeInBytes, GLint isSwap) { /* handle case where there is only 1 column/row */ @@ -6409,13 +6411,13 @@ static void halveImagePackedPixel(int components, (*extractPackedPixel)(isSwap, (src+rowSizeInBytes+pixelSizeInBytes), &extractTotals[3][0]); - for (cc = 0; cc < components; cc++) { + for (cc = 0; cc < components; cc++) { int kk; /* grab 4 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]; * totals[RED]/= 4.0; */ for (kk = 0; kk < BOX4; kk++) { @@ -6434,13 +6436,13 @@ static void halveImagePackedPixel(int components, /* src is at beginning of a row here, but it's the second row of * the square block of 4 pixels that we just worked on so we - * need to go one more row. - * i.e., - * OO... - * here -->OO... - * but want -->OO... - * OO... - * ... + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... */ src+= rowSizeInBytes; } @@ -6456,9 +6458,9 @@ static void halve1DimagePackedPixel(int components, (int, const void *,GLfloat []), void (*shovePackedPixel) (const GLfloat [],int, void *), - GLint width, GLint height, + GLint width, GLint height, const void *dataIn, void *dataOut, - GLint pixelSizeInBytes, + GLint pixelSizeInBytes, GLint rowSizeInBytes, GLint isSwap) { int halfWidth= width / 2; @@ -6487,8 +6489,8 @@ static void halve1DimagePackedPixel(int components, (*extractPackedPixel)(isSwap,src, &extractTotals[0][0]); (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes), - &extractTotals[1][0]); - for (cc = 0; cc < components; cc++) { + &extractTotals[1][0]); + for (cc = 0; cc < components; cc++) { int kk; /* grab 2 pixels to average */ @@ -6509,7 +6511,7 @@ static void halve1DimagePackedPixel(int components, } { - int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); + int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); src+= padBytes; /* for assertion only */ } assert(src == &((const char *)dataIn)[rowSizeInBytes]); @@ -6533,8 +6535,8 @@ static void halve1DimagePackedPixel(int components, (*extractPackedPixel)(isSwap,src, &extractTotals[0][0]); (*extractPackedPixel)(isSwap,(src+rowSizeInBytes), - &extractTotals[1][0]); - for (cc = 0; cc < components; cc++) { + &extractTotals[1][0]); + for (cc = 0; cc < components; cc++) { int kk; /* grab 2 pixels to average */ @@ -6568,13 +6570,13 @@ static void halve1DimagePackedPixel(int components, * Or is it might be supported as an extension. * Contributed by Gerk Huisma <[email protected]>. */ - + typedef GLAPI void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level, - GLenum internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels ); + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); static TexImage3Dproc pTexImage3D; @@ -6586,30 +6588,30 @@ static TexImage3Dproc pTexImage3D; #endif static void gluTexImage3D( GLenum target, GLint level, - GLenum internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels ) + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) { if (!pTexImage3D) { #ifdef WIN32 pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3D"); - if (!pTexImage3D) - pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT"); + if (!pTexImage3D) + pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT"); #else void *libHandle = dlopen("libgl.so", RTLD_LAZY); pTexImage3D = TexImage3Dproc) dlsym(libHandle, "glTexImage3D" ); - if (!pTexImage3D) - pTexImage3D = (TexImage3Dproc) dlsym(libHandle,"glTexImage3DEXT"); + if (!pTexImage3D) + pTexImage3D = (TexImage3Dproc) dlsym(libHandle,"glTexImage3DEXT"); dlclose(libHandle); #endif } /* Now call glTexImage3D */ - if (pTexImage3D) - pTexImage3D(target, level, internalFormat, width, height, - depth, border, format, type, pixels); + if (pTexImage3D) + pTexImage3D(target, level, internalFormat, width, height, + depth, border, format, type, pixels); } #else @@ -6620,10 +6622,10 @@ static void gluTexImage3D( GLenum target, GLint level, #endif static GLint imageSize3D(GLint width, GLint height, GLint depth, - GLenum format, GLenum type) + GLenum format, GLenum type) { int components= elements_per_group(format,type); - int bytes_per_row= bytes_per_element(type) * width; + int bytes_per_row= bytes_per_element(type) * width; assert(width > 0 && height > 0 && depth > 0); assert(type != GL_BITMAP); @@ -6631,9 +6633,9 @@ assert(type != GL_BITMAP); return bytes_per_row * height * depth * components; } /* imageSize3D() */ -static void fillImage3D(const PixelStorageModes *psm, - GLint width, GLint height, GLint depth, GLenum format, - GLenum type, GLboolean indexFormat, +static void fillImage3D(const PixelStorageModes *psm, + GLint width, GLint height, GLint depth, GLenum format, + GLenum type, GLboolean indexFormat, const void *userImage, GLushort *newImage) { int myswapBytes; @@ -6646,10 +6648,10 @@ static void fillImage3D(const PixelStorageModes *psm, int elementsPerLine; int rowsPerImage; int imageSize; - const GLubyte *start, *rowStart, *iter; + const GLubyte *start, *rowStart, *iter; GLushort *iter2; - int ww, hh, dd, k; - + int ww, hh, dd, k; + myswapBytes= psm->unpack_swap_bytes; components= elements_per_group(format,type); if (psm->unpack_row_length > 0) { @@ -6663,8 +6665,8 @@ static void fillImage3D(const PixelStorageModes *psm, if (elementSize == 1) myswapBytes= 0; /* 3dstuff begin */ - if (psm->unpack_image_height > 0) { - rowsPerImage= psm->unpack_image_height; + if (psm->unpack_image_height > 0) { + rowsPerImage= psm->unpack_image_height; } else { rowsPerImage= height; @@ -6679,10 +6681,10 @@ static void fillImage3D(const PixelStorageModes *psm, imageSize= rowsPerImage * rowSize; /* 3dstuff */ - start= (const GLubyte *)userImage + psm->unpack_skip_rows * rowSize + - psm->unpack_skip_pixels * groupSize + - /*3dstuff*/ - psm->unpack_skip_images * imageSize; + start= (const GLubyte *)userImage + psm->unpack_skip_rows * rowSize + + psm->unpack_skip_pixels * groupSize + + /*3dstuff*/ + psm->unpack_skip_images * imageSize; elementsPerLine = width * components; iter2= newImage; @@ -6718,37 +6720,37 @@ static void fillImage3D(const PixelStorageModes *psm, *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_2_3_3_REV: extract233rev(0,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5: extract565(myswapBytes,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5_REV: extract565rev(myswapBytes,iter,extractComponents); for (k = 0; k < 3; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4: extract4444(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: extract4444rev(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_5_5_5_1: extract5551(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); @@ -6780,19 +6782,19 @@ static void fillImage3D(const PixelStorageModes *psm, *iter2++ = widget.us[0]; } break; - case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8: extract8888(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_8_8_8_8_REV: extract8888rev(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); } break; - case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_10_10_10_2: extract1010102(myswapBytes,iter,extractComponents); for (k = 0; k < 4; k++) { *iter2++ = (GLushort)(extractComponents[k]*65535); @@ -6838,8 +6840,8 @@ static void fillImage3D(const PixelStorageModes *psm, } } break; - default: - assert(0); + default: + assert(0); } iter+= elementSize; @@ -6861,13 +6863,13 @@ static void fillImage3D(const PixelStorageModes *psm, elements_per_group(format,0)]); } assert( iter == &((const GLubyte *)userImage)[rowSize*height*depth + - psm->unpack_skip_rows * rowSize + + psm->unpack_skip_rows * rowSize + psm->unpack_skip_pixels * groupSize + /*3dstuff*/ psm->unpack_skip_images * imageSize] ); } /* fillImage3D () */ -static void scaleInternal3D(GLint components, +static void scaleInternal3D(GLint components, GLint widthIn, GLint heightIn, GLint depthIn, const GLushort *dataIn, GLint widthOut, GLint heightOut, GLint depthOut, @@ -6876,7 +6878,7 @@ static void scaleInternal3D(GLint components, float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float z, lowz, highz, convz, halfconvz; - float xpercent,ypercent,zpercent; + float xpercent,ypercent,zpercent; float percent; /* Max components in a format is 4, so... */ float totals[4]; @@ -6890,7 +6892,7 @@ static void scaleInternal3D(GLint components, halfconvx = convx/2; halfconvy = convy/2; halfconvz = convz/2; - for (d = 0; d < depthOut; d++) { + for (d = 0; d < depthOut; d++) { z = convz * (d+0.5); if (depthIn > depthOut) { highz = z + halfconvz; @@ -6960,11 +6962,11 @@ static void scaleInternal3D(GLint components, percent = xpercent * ypercent * zpercent; volume += percent; - temp = (xindex + (yindex*widthIn) + + temp = (xindex + (yindex*widthIn) + (zindex*widthIn*heightIn)) * components; for (k = 0; k < components; k++) { - assert(0 <= (temp+k) && - (temp+k) < + assert(0 <= (temp+k) && + (temp+k) < (widthIn*heightIn*depthIn*components)); totals[k] += dataIn[temp + k] * percent; } @@ -6981,13 +6983,13 @@ static void scaleInternal3D(GLint components, z = zint; } /* while z */ - temp = (j + (i * widthOut) + + temp = (j + (i * widthOut) + (d*widthOut*heightOut)) * components; for (k = 0; k < components; k++) { - /* totals[] should be rounded in the case of enlarging an + /* totals[] should be rounded in the case of enlarging an * RGB ramp when the type is 332 or 4444 */ - assert(0 <= (temp+k) && + assert(0 <= (temp+k) && (temp+k) < (widthOut*heightOut*depthOut*components)); dataOut[temp + k] = (totals[k]+0.5)/volume; } @@ -7027,7 +7029,7 @@ static void emptyImage3D(const PixelStorageModes *psm, elementSize= bytes_per_element(type); groupSize= elementSize * components; if (elementSize == 1) myswapBytes= 0; - + /* 3dstuff begin */ if (psm->pack_image_height > 0) { rowsPerImage= psm->pack_image_height; @@ -7036,24 +7038,24 @@ static void emptyImage3D(const PixelStorageModes *psm, rowsPerImage= height; } - /* 3dstuff end */ + /* 3dstuff end */ rowSize = groupsPerLine * groupSize; padding = rowSize % psm->pack_alignment; if (padding) { rowSize+= psm->pack_alignment - padding; } - + imageSize= rowsPerImage * rowSize; /* 3dstuff */ start = (GLubyte *)userImage + psm->pack_skip_rows * rowSize + - psm->pack_skip_pixels * groupSize + - /*3dstuff*/ - psm->pack_skip_images * imageSize; + psm->pack_skip_pixels * groupSize + + /*3dstuff*/ + psm->pack_skip_images * imageSize; elementsPerLine= width * components; iter2 = oldImage; - for (dd= 0; dd < depth; dd++) { + for (dd= 0; dd < depth; dd++) { rowStart= start; for (ii= 0; ii< height; ii++) { @@ -7078,22 +7080,22 @@ static void emptyImage3D(const PixelStorageModes *psm, *((GLbyte *) iter) = *iter2++ >> 9; } break; - case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_3_3_2: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove332(shoveComponents,0,(void *)iter); break; case GL_UNSIGNED_BYTE_2_3_3_REV: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove233rev(shoveComponents,0,(void *)iter); - break; - case GL_UNSIGNED_SHORT_5_6_5: + break; + case GL_UNSIGNED_SHORT_5_6_5: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove565(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7103,10 +7105,10 @@ static void emptyImage3D(const PixelStorageModes *psm, *(GLushort *)iter = widget.us[0]; } break; - case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_5_6_5_REV: for (k = 0; k < 3; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove565rev(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7119,7 +7121,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_4_4_4_4: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove4444(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7131,7 +7133,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_4_4_4_4_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove4444rev(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7143,7 +7145,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_5_5_5_1: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove5551(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7155,7 +7157,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_SHORT_1_5_5_5_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove1555rev(shoveComponents,0,(void *)&widget.us[0]); if (myswapBytes) { iter[0] = widget.ub[1]; @@ -7186,7 +7188,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_INT_8_8_8_8: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove8888(shoveComponents,0,(void *)&widget.ui); if (myswapBytes) { iter[3] = widget.ub[0]; @@ -7200,7 +7202,7 @@ static void emptyImage3D(const PixelStorageModes *psm, case GL_UNSIGNED_INT_8_8_8_8_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove8888rev(shoveComponents,0,(void *)&widget.ui); if (myswapBytes) { iter[3] = widget.ub[0]; @@ -7211,10 +7213,10 @@ static void emptyImage3D(const PixelStorageModes *psm, *(GLuint *)iter= widget.ui; } break; - case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_10_10_10_2: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove1010102(shoveComponents,0,(void *)&widget.ui); if (myswapBytes) { iter[3] = widget.ub[0]; @@ -7225,10 +7227,10 @@ static void emptyImage3D(const PixelStorageModes *psm, *(GLuint *)iter= widget.ui; } break; - case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_2_10_10_10_REV: for (k = 0; k < 4; k++) { shoveComponents[k]= *iter2++ / 65535.0; - } + } shove2101010rev(shoveComponents,0,(void *)&widget.ui); if (myswapBytes) { iter[3] = widget.ub[0]; @@ -7295,16 +7297,16 @@ static void emptyImage3D(const PixelStorageModes *psm, elements_per_group(format,0)]); } assert( iter == &((GLubyte *)userImage)[rowSize*height*depth + - psm->unpack_skip_rows * rowSize + + psm->unpack_skip_rows * rowSize + psm->unpack_skip_pixels * groupSize + /*3dstuff*/ psm->unpack_skip_images * imageSize] ); } /* emptyImage3D() */ -static -int gluScaleImage3D(GLenum format, +static +int gluScaleImage3D(GLenum format, GLint widthIn, GLint heightIn, GLint depthIn, - GLenum typeIn, const void *dataIn, + GLenum typeIn, const void *dataIn, GLint widthOut, GLint heightOut, GLint depthOut, GLenum typeOut, void *dataOut) { @@ -7312,16 +7314,16 @@ int gluScaleImage3D(GLenum format, GLushort *beforeImage, *afterImage; PixelStorageModes psm; - if (widthIn == 0 || heightIn == 0 || depthIn == 0 || + if (widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0) { return 0; } - if (widthIn < 0 || heightIn < 0 || depthIn < 0 || + if (widthIn < 0 || heightIn < 0 || depthIn < 0 || widthOut < 0 || heightOut < 0 || depthOut < 0) { return GLU_INVALID_VALUE; } - + if (!legalFormat(format) || !legalType(typeIn) || !legalType(typeOut) || typeIn == GL_BITMAP || typeOut == GL_BITMAP) { return GLU_INVALID_ENUM; @@ -7334,12 +7336,12 @@ int gluScaleImage3D(GLenum format, } beforeImage = malloc(imageSize3D(widthIn, heightIn, depthIn, format, - GL_UNSIGNED_SHORT)); - afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, + GL_UNSIGNED_SHORT)); + afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { return GLU_OUT_OF_MEMORY; - } + } retrieveStoreModes3D(&psm); fillImage3D(&psm,widthIn,heightIn,depthIn,format,typeIn, is_index(format), @@ -7357,11 +7359,11 @@ int gluScaleImage3D(GLenum format, static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, - GLint internalFormat, GLenum format, GLenum type, + GLint internalFormat, GLenum format, GLenum type, GLint *newWidth, GLint *newHeight, GLint *newDepth) { GLint widthPowerOf2= nearestPower(width); - GLint heightPowerOf2= nearestPower(height); + GLint heightPowerOf2= nearestPower(height); GLint depthPowerOf2= nearestPower(depth); GLint proxyWidth; @@ -7369,15 +7371,15 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, /* compute level 1 width & height & depth, clamping each at 1 */ GLint widthAtLevelOne= (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : - widthPowerOf2; + widthPowerOf2; GLint heightAtLevelOne= (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : - heightPowerOf2; + heightPowerOf2; GLint depthAtLevelOne= (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : - depthPowerOf2; + depthPowerOf2; GLenum proxyTarget; - assert(widthAtLevelOne > 0); + assert(widthAtLevelOne > 0); assert(heightAtLevelOne > 0); assert(depthAtLevelOne > 0); @@ -7400,7 +7402,7 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, widthPowerOf2= widthAtLevelOne; heightPowerOf2= heightAtLevelOne; depthPowerOf2= depthAtLevelOne; - } + } /* else it does fit */ } while (proxyWidth == 0); /* loop must terminate! */ @@ -7419,8 +7421,8 @@ static void halveImagePackedPixelSlice(int components, (const GLfloat [],int, void *), GLint width, GLint height, GLint depth, const void *dataIn, void *dataOut, - GLint pixelSizeInBytes, - GLint rowSizeInBytes, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, GLint imageSizeInBytes, GLint isSwap) { @@ -7458,7 +7460,7 @@ static void halveImagePackedPixelSlice(int components, } totals[cc]/= (float)BOX2; } /* for cc */ - + (*shovePackedPixel)(totals,outIndex,dataOut); outIndex++; /* skip over to next group of 2 */ @@ -7471,7 +7473,7 @@ static void halveImagePackedPixelSlice(int components, for (ii= 0; ii< halfDepth; ii++) { for (jj= 0; jj< halfWidth; jj++) { float totals[4]; - float extractTotals[BOX4][4]; + float extractTotals[BOX4][4]; int cc; (*extractPackedPixel)(isSwap,src, @@ -7484,12 +7486,12 @@ static void halveImagePackedPixelSlice(int components, (src+imageSizeInBytes+pixelSizeInBytes), &extractTotals[3][0]); for (cc = 0; cc < components; cc++) { - int kk; + int kk; /* grab 4 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]; * totals[RED]/= 4.0; */ for (kk = 0; kk < BOX4; kk++) { @@ -7531,7 +7533,7 @@ static void halveImagePackedPixelSlice(int components, /* grab 4 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]; * totals[RED]/= 4.0; */ for (kk = 0; kk < BOX4; kk++) { @@ -7546,7 +7548,7 @@ static void halveImagePackedPixelSlice(int components, /* skip over to next vertical square of 4 */ src+= imageSizeInBytes + imageSizeInBytes; } - } + } /* assert() */ } @@ -7559,8 +7561,8 @@ static void halveImagePackedPixel3D(int components, (const GLfloat [],int, void *), GLint width, GLint height, GLint depth, const void *dataIn, void *dataOut, - GLint pixelSizeInBytes, - GLint rowSizeInBytes, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, GLint imageSizeInBytes, GLint isSwap) { @@ -7573,13 +7575,13 @@ static void halveImagePackedPixel3D(int components, return; } /* a horizontal or vertical slice viewed from top */ - else if (width == 1 || height == 1) { + else if (width == 1 || height == 1) { assert(1 <= depth); halveImagePackedPixelSlice(components, extractPackedPixel,shovePackedPixel, width, height, depth, dataIn, dataOut, - pixelSizeInBytes, rowSizeInBytes, + pixelSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap); return; } @@ -7588,7 +7590,7 @@ static void halveImagePackedPixel3D(int components, int halfWidth= width / 2; int halfHeight= height / 2; - int halfDepth= depth / 2; + int halfDepth= depth / 2; const char *src= (const char *) dataIn; int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); int outIndex= 0; @@ -7597,7 +7599,7 @@ static void halveImagePackedPixel3D(int components, for (ii= 0; ii< halfHeight; ii++) { for (jj= 0; jj< halfWidth; jj++) { #define BOX8 8 - float totals[4]; /* 4 is maximum components */ + float totals[4]; /* 4 is maximum components */ float extractTotals[BOX8][4]; /* 4 is maximum components */ int cc; @@ -7620,15 +7622,15 @@ static void halveImagePackedPixel3D(int components, (*extractPackedPixel)(isSwap, (src+rowSizeInBytes+pixelSizeInBytes+imageSizeInBytes), &extractTotals[7][0]); - for (cc = 0; cc < components; cc++) { + for (cc = 0; cc < components; cc++) { int kk; /* grab 8 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]+ - * extractTotals[4][RED]+extractTotals[5][RED]+ - * extractTotals[6][RED]+extractTotals[7][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]+ + * extractTotals[4][RED]+extractTotals[5][RED]+ + * extractTotals[6][RED]+extractTotals[7][RED]; * totals[RED]/= 8.0; */ for (kk = 0; kk < BOX8; kk++) { @@ -7647,18 +7649,18 @@ static void halveImagePackedPixel3D(int components, /* src is at beginning of a row here, but it's the second row of * the square block of 4 pixels that we just worked on so we - * need to go one more row. - * i.e., - * OO... - * here -->OO... - * but want -->OO... - * OO... - * ... + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... */ src+= rowSizeInBytes; } - src+= imageSizeInBytes; + src+= imageSizeInBytes; } /* for dd */ /* both pointers must reach one byte after the end */ @@ -7668,14 +7670,14 @@ static void halveImagePackedPixel3D(int components, } /* halveImagePackedPixel3D() */ -static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, - GLsizei width, - GLsizei height, +static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, + GLsizei width, + GLsizei height, GLsizei depth, - GLsizei widthPowerOf2, - GLsizei heightPowerOf2, + GLsizei widthPowerOf2, + GLsizei heightPowerOf2, GLsizei depthPowerOf2, - GLenum format, GLenum type, + GLenum format, GLenum type, GLint userLevel, GLint baseLevel,GLint maxLevel, const void *data) @@ -7724,8 +7726,8 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, if (elementSize == 1) myswapBytes = 0; /* 3dstuff begin */ - if (psm.unpack_image_height > 0) { - rowsPerImage= psm.unpack_image_height; + if (psm.unpack_image_height > 0) { + rowsPerImage= psm.unpack_image_height; } else { rowsPerImage= height; @@ -7740,10 +7742,10 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, imageSize= rowsPerImage * rowSize; /* 3dstuff */ - usersImage = (const GLubyte *)data + psm.unpack_skip_rows * rowSize + + usersImage = (const GLubyte *)data + psm.unpack_skip_rows * rowSize + psm.unpack_skip_pixels * groupSize + /* 3dstuff */ - psm.unpack_skip_images * imageSize; + psm.unpack_skip_images * imageSize; glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); @@ -7756,7 +7758,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, if (width == newWidth && height == newHeight && depth == newDepth) { /* Use usersImage for level userLevel */ if (baseLevel <= level && level <= maxLevel) { - gluTexImage3D(target, level, internalFormat, width, + gluTexImage3D(target, level, internalFormat, width, height, depth, 0, format, type, usersImage); } @@ -7778,7 +7780,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, /* clamp to 1 */ if (nextWidth < 1) nextWidth= 1; if (nextHeight < 1) nextHeight= 1; - if (nextDepth < 1) nextDepth= 1; + if (nextDepth < 1) nextDepth= 1; memReq = imageSize3D(nextWidth, nextHeight, nextDepth, format, type); } switch(type) { @@ -7803,8 +7805,8 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_FLOAT: dstImage = (GLfloat *)malloc(memReq); break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: dstImage = (GLubyte *)malloc(memReq); break; case GL_UNSIGNED_SHORT_5_6_5: @@ -7819,7 +7821,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - dstImage = (GLuint *)malloc(memReq); + dstImage = (GLuint *)malloc(memReq); break; default: return GLU_INVALID_ENUM; /* assertion */ @@ -7873,7 +7875,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } break; case GL_SHORT: - if (depth > 1) { + if (depth > 1) { halveImage3D(cmpts,extractSshort,shoveSshort, width,height,depth, usersImage,dstImage,elementSize,groupSize,rowSize, @@ -7885,7 +7887,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } break; case GL_UNSIGNED_INT: - if (depth > 1) { + if (depth > 1) { halveImage3D(cmpts,extractUint,shoveUint, width,height,depth, usersImage,dstImage,elementSize,groupSize,rowSize, @@ -7897,7 +7899,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } break; case GL_INT: - if (depth > 1) { + if (depth > 1) { halveImage3D(cmpts,extractSint,shoveSint, width,height,depth, usersImage,dstImage,elementSize,groupSize,rowSize, @@ -7920,7 +7922,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, elementSize,rowSize,groupSize,myswapBytes); } break; - case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_3_3_2: assert(format == GL_RGB); halveImagePackedPixel3D(3,extract332,shove332, width,height,depth,usersImage,dstImage, @@ -7946,42 +7948,42 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, halveImagePackedPixel3D(4,extract4444,shove4444, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: halveImagePackedPixel3D(4,extract4444rev,shove4444rev, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_SHORT_5_5_5_1: halveImagePackedPixel3D(4,extract5551,shove5551, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: halveImagePackedPixel3D(4,extract1555rev,shove1555rev, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_INT_8_8_8_8: halveImagePackedPixel3D(4,extract8888,shove8888, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_INT_8_8_8_8_REV: halveImagePackedPixel3D(4,extract8888rev,shove8888rev, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_INT_10_10_10_2: halveImagePackedPixel3D(4,extract1010102,shove1010102, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; case GL_UNSIGNED_INT_2_10_10_10_REV: halveImagePackedPixel3D(4,extract2101010rev,shove2101010rev, width,height,depth,usersImage,dstImage, elementSize,rowSize,imageSize,myswapBytes); - break; + break; default: assert(0); break; @@ -7991,7 +7993,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, newDepth = depth/2; /* clamp to 1 */ if (newWidth < 1) newWidth= 1; - if (newHeight < 1) newHeight= 1; + if (newHeight < 1) newHeight= 1; if (newDepth < 1) newDepth= 1; myswapBytes = 0; @@ -8054,7 +8056,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, return GLU_OUT_OF_MEMORY; } /* level userLevel+1 is in srcImage; level userLevel already saved */ - level = userLevel+1; + level = userLevel+1; } else {/* user's image is *not* nice power-of-2 sized square */ memReq = imageSize3D(newWidth, newHeight, newDepth, format, type); switch(type) { @@ -8098,7 +8100,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, dstImage = (GLuint *)malloc(memReq); break; default: - return GLU_INVALID_ENUM; /* assertion */ + return GLU_INVALID_ENUM; /* assertion */ } if (dstImage == NULL) { @@ -8129,8 +8131,8 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, int nextHeight= newHeight/2; int nextDepth= newDepth/2; if (nextWidth < 1) nextWidth= 1; - if (nextHeight < 1) nextHeight= 1; - if (nextDepth < 1) nextDepth= 1; + if (nextHeight < 1) nextHeight= 1; + if (nextDepth < 1) nextDepth= 1; memReq = imageSize3D(nextWidth, nextHeight, nextDepth, format, type); } @@ -8189,7 +8191,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } } /* level userLevel is in srcImage; nothing saved yet */ - level = userLevel; + level = userLevel; } glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); @@ -8225,7 +8227,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } break; case GL_UNSIGNED_SHORT: - if (newDepth > 1) { + if (newDepth > 1) { halveImage3D(cmpts,extractUshort,shoveUshort, newWidth,newHeight,newDepth, srcImage,dstImage,elementSize,groupSize,rowSize, @@ -8320,13 +8322,13 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, srcImage,dstImage,elementSize,rowSize, imageSize,myswapBytes); break; - case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_5_5_5_1: halveImagePackedPixel3D(4,extract5551,shove5551, newWidth,newHeight,newDepth, srcImage,dstImage,elementSize,rowSize, imageSize,myswapBytes); break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: halveImagePackedPixel3D(4,extract1555rev,shove1555rev, newWidth,newHeight,newDepth, srcImage,dstImage,elementSize,rowSize, @@ -8390,9 +8392,9 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, } /* gluBuild3DMipmapLevelsCore() */ GLint GLAPIENTRY -gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, +gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLenum type, + GLenum format, GLenum type, GLint userLevel, GLint baseLevel, GLint maxLevel, const void *data) { @@ -8416,19 +8418,19 @@ gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, if (level > levels) levels=level; levels+= userLevel; - if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) return GLU_INVALID_VALUE; - return gluBuild3DMipmapLevelsCore(target, internalFormat, + return gluBuild3DMipmapLevelsCore(target, internalFormat, width, height, depth, width, height, depth, - format, type, + format, type, userLevel, baseLevel, maxLevel, data); } /* gluBuild3DMipmapLevels() */ GLint GLAPIENTRY -gluBuild3DMipmaps(GLenum target, GLint internalFormat, +gluBuild3DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data) { @@ -8455,9 +8457,9 @@ gluBuild3DMipmaps(GLenum target, GLint internalFormat, level = computeLog(depthPowerOf2); if (level > levels) levels=level; - return gluBuild3DMipmapLevelsCore(target, internalFormat, + return gluBuild3DMipmapLevelsCore(target, internalFormat, width, height, depth, - widthPowerOf2, heightPowerOf2, + widthPowerOf2, heightPowerOf2, depthPowerOf2, format, type, 0, 0, levels, data); @@ -8504,7 +8506,7 @@ static GLdouble extractUshort(int isSwap, const void *uitem) ushort= *(const GLushort *)uitem; } - assert(ushort <= 65535); + assert(ushort <= 65535); return (GLdouble)ushort; } /* extractUshort() */ @@ -8527,7 +8529,7 @@ static GLdouble extractSshort(int isSwap, const void *sitem) sshort= *(const GLshort *)sitem; } - assert(sshort <= 32767); + assert(sshort <= 32767); return (GLdouble)sshort; } /* extractSshort() */ @@ -8550,14 +8552,14 @@ static GLdouble extractUint(int isSwap, const void *uitem) uint= *(const GLuint *)uitem; } - assert(uint <= 0xffffffff); + assert(uint <= 0xffffffff); return (GLdouble)uint; } /* extractUint() */ static void shoveUint(GLdouble value, int index, void *data) { - assert(0.0 <= value && value <= (GLdouble) UINT_MAX); + assert(0.0 <= value && value <= (GLdouble) UINT_MAX); ((GLuint *)data)[index]= (GLuint)value; } /* shoveUint() */ @@ -8573,14 +8575,14 @@ static GLdouble extractSint(int isSwap, const void *sitem) sint= *(const GLint *)sitem; } - assert(sint <= 0x7fffffff); + assert(sint <= 0x7fffffff); return (GLdouble)sint; } /* extractSint() */ static void shoveSint(GLdouble value, int index, void *data) { - assert(0.0 <= value && value <= (GLdouble) INT_MAX); + assert(0.0 <= value && value <= (GLdouble) INT_MAX); ((GLint *)data)[index]= (GLint)value; } /* shoveSint() */ @@ -8596,7 +8598,7 @@ static GLdouble extractFloat(int isSwap, const void *item) ffloat= *(const GLfloat *)item; } - assert(ffloat <= 1.0); + assert(ffloat <= 1.0); return (GLdouble)ffloat; } /* extractFloat() */ @@ -8614,8 +8616,8 @@ static void halveImageSlice(int components, GLint width, GLint height, GLint depth, const void *dataIn, void *dataOut, GLint elementSizeInBytes, - GLint groupSizeInBytes, - GLint rowSizeInBytes, + GLint groupSizeInBytes, + GLint rowSizeInBytes, GLint imageSizeInBytes, GLint isSwap) { @@ -8678,7 +8680,7 @@ static void halveImageSlice(int components, for (cc = 0; cc < components; cc++) { int kk; double totals[4]; - double extractTotals[BOX4][4]; + double extractTotals[BOX4][4]; extractTotals[0][cc]=(*extract)(isSwap,src); extractTotals[1][cc]=(*extract)(isSwap, @@ -8691,7 +8693,7 @@ static void halveImageSlice(int components, /* grab 4 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]; * totals[RED]/= 4.0; */ for (kk = 0; kk < BOX4; kk++) { @@ -8703,7 +8705,7 @@ static void halveImageSlice(int components, outIndex++; src+= elementSizeInBytes; - } /* for cc */ + } /* for cc */ /* skip over to next horizontal square of 4 */ src+= groupSizeInBytes; @@ -8715,7 +8717,7 @@ static void halveImageSlice(int components, assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); assert(outIndex == halfWidth * halfDepth * components); - } + } else if (width == 1) { /* vertical slice viewed from top */ /* printf("vertical slice\n"); */ assert(height != 1); @@ -8740,7 +8742,7 @@ static void halveImageSlice(int components, /* grab 4 pixels to average */ totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]; * totals[RED]/= 4.0; */ for (kk = 0; kk < BOX4; kk++) { @@ -8760,7 +8762,7 @@ static void halveImageSlice(int components, } /* for jj */ src+= imageSizeInBytes; - } /* for ii */ + } /* for ii */ assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); assert(outIndex == halfHeight * halfDepth * components); @@ -8774,19 +8776,19 @@ static void halveImage3D(int components, GLint width, GLint height, GLint depth, const void *dataIn, void *dataOut, GLint elementSizeInBytes, - GLint groupSizeInBytes, - GLint rowSizeInBytes, + GLint groupSizeInBytes, + GLint rowSizeInBytes, GLint imageSizeInBytes, GLint isSwap) { - assert(depth > 1); + assert(depth > 1); /* a horizontal/vertical/one-column slice viewed from top */ - if (width == 1 || height == 1) { + if (width == 1 || height == 1) { assert(1 <= depth); - halveImageSlice(components,extract,shove, width, height, depth, - dataIn, dataOut, elementSizeInBytes, groupSizeInBytes, + halveImageSlice(components,extract,shove, width, height, depth, + dataIn, dataOut, elementSizeInBytes, groupSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap); return; } @@ -8795,7 +8797,7 @@ static void halveImage3D(int components, int halfWidth= width / 2; int halfHeight= height / 2; - int halfDepth= depth / 2; + int halfDepth= depth / 2; const char *src= (const char *) dataIn; int padBytes= rowSizeInBytes - (width*groupSizeInBytes); int outIndex= 0; @@ -8832,9 +8834,9 @@ static void halveImage3D(int components, totals[cc]= 0.0; /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ - * extractTotals[2][RED]+extractTotals[3][RED]+ - * extractTotals[4][RED]+extractTotals[5][RED]+ - * extractTotals[6][RED]+extractTotals[7][RED]; + * extractTotals[2][RED]+extractTotals[3][RED]+ + * extractTotals[4][RED]+extractTotals[5][RED]+ + * extractTotals[6][RED]+extractTotals[7][RED]; * totals[RED]/= 8.0; */ for (kk = 0; kk < BOX8; kk++) { @@ -8857,18 +8859,18 @@ static void halveImage3D(int components, /* src is at beginning of a row here, but it's the second row of * the square block of 4 pixels that we just worked on so we - * need to go one more row. - * i.e., - * OO... - * here -->OO... - * but want -->OO... - * OO... - * ... + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... */ src+= rowSizeInBytes; } /* for ii */ - src+= imageSizeInBytes; + src+= imageSizeInBytes; } /* for dd */ /* both pointers must reach one byte after the end */ diff --git a/src/glu/sgi/libutil/quad.c b/src/glu/sgi/libutil/quad.c index 57e3f2636fb..cfcf2137475 100644 --- a/src/glu/sgi/libutil/quad.c +++ b/src/glu/sgi/libutil/quad.c @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -31,8 +31,8 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2002/11/01 23:45:31 $ $Revision: 1.3 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.3 2002/11/01 23:45:31 brianp Exp $ +** $Date: 2003/11/21 15:49:26 $ $Revision: 1.3.12.1 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.3.12.1 2003/11/21 15:49:26 keithw Exp $ */ #include "gluos.h" @@ -46,10 +46,11 @@ /* Make it not a power of two to avoid cache thrashing on the chip */ #define CACHE_SIZE 240 -#define PI 3.14159265358979323846 +#undef PI +#define PI 3.14159265358979323846 struct GLUquadric { - GLint normals; + GLint normals; GLboolean textureCoords; GLint orientation; GLint drawStyle; @@ -70,7 +71,7 @@ gluNewQuadric(void) newstate->textureCoords = GL_FALSE; newstate->orientation = GLU_OUTSIDE; newstate->drawStyle = GLU_FILL; - newstate->errorCallback = NULL; + newstate->errorCallback = NULL; return newstate; } @@ -153,7 +154,7 @@ gluQuadricDrawStyle(GLUquadric *qobj, GLenum drawStyle) } void GLAPIENTRY -gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, +gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks) { GLint i,j; @@ -219,7 +220,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, sinCache2[i] = -xyNormalRatio * SIN(angle); cosCache2[i] = -xyNormalRatio * COS(angle); } - } + } sinCache[i] = SIN(angle); cosCache[i] = COS(angle); } @@ -235,7 +236,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, cosCache3[i] = -xyNormalRatio * COS(angle); } } - } + } sinCache[slices] = sinCache[0]; cosCache[slices] = cosCache[0]; @@ -252,8 +253,8 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, case GLU_FILL: /* Note: ** An argument could be made for using a TRIANGLE_FAN for the end - ** of the cylinder of either radii is 0.0 (a cone). However, a - ** TRIANGLE_FAN would not work in smooth shading mode (the common + ** of the cylinder of either radii is 0.0 (a cone). However, a + ** TRIANGLE_FAN would not work in smooth shading mode (the common ** case) because the normal for the apex is different for every ** triangle (and TRIANGLE_FAN doesn't let me respecify that normal). ** Now, my choice is GL_TRIANGLES, or leave the GL_QUAD_STRIP and @@ -285,26 +286,26 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], zLow); if (qobj->textureCoords) { glTexCoord2f(1 - (float) i / slices, (float) (j+1) / stacks); } - glVertex3f(radiusHigh * sinCache[i], + glVertex3f(radiusHigh * sinCache[i], radiusHigh * cosCache[i], zHigh); } else { if (qobj->textureCoords) { glTexCoord2f(1 - (float) i / slices, (float) (j+1) / stacks); } - glVertex3f(radiusHigh * sinCache[i], + glVertex3f(radiusHigh * sinCache[i], radiusHigh * cosCache[i], zHigh); if (qobj->textureCoords) { glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], zLow); } } @@ -333,7 +334,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sintemp, + glVertex3f(radiusLow * sintemp, radiusLow * costemp, zLow); } } @@ -361,7 +362,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], zLow); } glEnd(); @@ -389,7 +390,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], zLow); } glEnd(); @@ -415,7 +416,7 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, glTexCoord2f(1 - (float) i / slices, (float) j / stacks); } - glVertex3f(radiusLow * sintemp, + glVertex3f(radiusLow * sintemp, radiusLow * costemp, zLow); } glEnd(); @@ -427,14 +428,14 @@ gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, } void GLAPIENTRY -gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, +gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops) { gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0); } void GLAPIENTRY -gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, +gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops, GLdouble startAngle, GLdouble sweepAngle) { @@ -511,7 +512,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(0.5, 0.5); } glVertex3f(0.0, 0.0, 0.0); - radiusLow = outerRadius - + radiusLow = outerRadius - deltaRadius * ((float) (loops-1) / loops); if (qobj->textureCoords) { texLow = radiusLow / outerRadius / 2; @@ -523,7 +524,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); } } else { @@ -532,7 +533,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); } } @@ -555,28 +556,28 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); if (qobj->textureCoords) { glTexCoord2f(texHigh * sinCache[i] + 0.5, texHigh * cosCache[i] + 0.5); } - glVertex3f(radiusHigh * sinCache[i], + glVertex3f(radiusHigh * sinCache[i], radiusHigh * cosCache[i], 0.0); } else { if (qobj->textureCoords) { glTexCoord2f(texHigh * sinCache[i] + 0.5, texHigh * cosCache[i] + 0.5); } - glVertex3f(radiusHigh * sinCache[i], + glVertex3f(radiusHigh * sinCache[i], radiusHigh * cosCache[i], 0.0); if (qobj->textureCoords) { glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); } } @@ -629,7 +630,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); } glEnd(); @@ -684,7 +685,7 @@ gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, glTexCoord2f(texLow * sinCache[i] + 0.5, texLow * cosCache[i] + 0.5); } - glVertex3f(radiusLow * sinCache[i], + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0); } glEnd(); @@ -788,7 +789,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) cosCache3b[j] = -COS(angle); } } - } + } sinCache1a[slices] = sinCache1a[0]; cosCache1a[slices] = cosCache1a[0]; @@ -969,7 +970,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) } break; default: - break; + break; } glBegin(GL_QUAD_STRIP); @@ -1046,7 +1047,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) costemp2 = cosCache2b[j]; break; default: - break; + break; } for (i = 0; i < slices; i++) { switch(qobj->normals) { @@ -1067,7 +1068,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) glTexCoord2f(1 - (float) i / slices, 1 - (float) j / stacks); } - glVertex3f(sintemp1 * sinCache1a[i], + glVertex3f(sintemp1 * sinCache1a[i], sintemp1 * cosCache1a[i], costemp1); } } @@ -1109,7 +1110,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) glTexCoord2f(1 - (float) i / slices, 1 - (float) j / stacks); } - glVertex3f(sintemp1 * sinCache1a[i], + glVertex3f(sintemp1 * sinCache1a[i], sintemp1 * cosCache1a[i], costemp1); } glEnd(); @@ -1149,7 +1150,7 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) glTexCoord2f(1 - (float) i / slices, 1 - (float) j / stacks); } - glVertex3f(sintemp1 * sinCache1b[j], + glVertex3f(sintemp1 * sinCache1b[j], costemp1 * sinCache1b[j], cosCache1b[j]); } glEnd(); diff --git a/src/glut/dos/PC_HW/pc_hw.h b/src/glut/dos/PC_HW/pc_hw.h index 26bb8ba17df..bd2293eb29d 100644 --- a/src/glut/dos/PC_HW/pc_hw.h +++ b/src/glut/dos/PC_HW/pc_hw.h @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.3 for DOS/DJGPP + * PC/HW routine collection v1.4 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : [email protected] @@ -19,6 +19,8 @@ #define FALSE 0 #define TRUE !FALSE +#define SQR(x) ((x) * (x)) + #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) #define MID(x,y,z) MAX((x), MIN((y), (z))) @@ -201,6 +203,8 @@ int pc_keyshifts (void); * timer */ int pc_install_int (PFUNC func, void *parm, unsigned int freq); +int pc_remove_int (int fid); +int pc_adjust_int (int fid, unsigned int freq); void pc_remove_timer (void); /* diff --git a/src/glut/dos/PC_HW/pc_timer.c b/src/glut/dos/PC_HW/pc_timer.c index bf39bd0a4c0..f11917db1aa 100644 --- a/src/glut/dos/PC_HW/pc_timer.c +++ b/src/glut/dos/PC_HW/pc_timer.c @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v1.3 for DOS/DJGPP + * PC/HW routine collection v1.4 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : [email protected] @@ -8,6 +8,7 @@ #include <pc.h> +#include <string.h> #include "pc_hw.h" @@ -17,6 +18,8 @@ #define PIT_FREQ 0x1234DD +#define ADJUST(timer, basefreq) timer.counter = PIT_FREQ * timer.freq / SQR(basefreq) + #define unvolatile(__v, __t) __extension__ ({union { volatile __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;}) static int timer_installed; @@ -29,15 +32,24 @@ typedef struct { static TIMER timer_main, timer_func[MAX_TIMERS]; + + +/* Desc: main timer callback + * + * In : - + * Out : 0 to bypass BIOS, 1 to chain to BIOS + * + * Note: - + */ static int timer () { int i; - for (i=0;i<MAX_TIMERS;i++) { + for (i = 0; i < MAX_TIMERS; i++) { TIMER *t = &timer_func[i]; if (t->func) { t->clock_ticks += t->counter; - if (t->clock_ticks>=timer_main.counter) { + if (t->clock_ticks >= timer_main.counter) { t->clock_ticks -= timer_main.counter; t->func(unvolatile(t->parm, void *)); } @@ -45,7 +57,7 @@ static int timer () } timer_main.clock_ticks += timer_main.counter; - if (timer_main.clock_ticks>=0x10000) { + if (timer_main.clock_ticks >= 0x10000) { timer_main.clock_ticks -= 0x10000; return 1; } else { @@ -54,6 +66,15 @@ static int timer () } } ENDOFUNC(timer) + + +/* Desc: uninstall timer engine + * + * In : - + * Out : - + * + * Note: - + */ void pc_remove_timer (void) { if (timer_installed) { @@ -70,11 +91,22 @@ void pc_remove_timer (void) } } + + +/* Desc: install timer engine + * + * In : - + * Out : 0 for success + * + * Note: initial frequency is 18.2 Hz + */ static int install_timer (void) { - if (timer_installed||pc_install_irq(TIMER_IRQ, timer)) { + if (timer_installed || pc_install_irq(TIMER_IRQ, timer)) { return -1; } else { + memset(timer_func, 0, sizeof(timer_func)); + LOCKDATA(timer_func); LOCKDATA(timer_main); LOCKFUNC(timer); @@ -94,65 +126,198 @@ static int install_timer (void) } } -static TIMER *find_slot (PFUNC func) + + +/* Desc: install timerfunc + * + * In : callback function, opaque pointer to be passed to callee, freq (Hz) + * Out : timerfunc id (0 .. MAX_TIMERS-1) + * + * Note: returns -1 if error + */ +int pc_install_int (PFUNC func, void *parm, unsigned int freq) { int i; + TIMER *t = NULL; - for (i=0;i<MAX_TIMERS;i++) { - if (timer_func[i].func==func) { - return &timer_func[i]; - } + /* ensure the timer engine is set up */ + if (!timer_installed) { + if (install_timer()) { + return -1; + } } - for (i=0;i<MAX_TIMERS;i++) { + + /* find an empty slot */ + for (i = 0; i < MAX_TIMERS; i++) { if (!timer_func[i].func) { - return &timer_func[i]; + t = &timer_func[i]; + break; } } + if (t == NULL) { + return -1; + } + + DISABLE(); + + t->func = func; + t->parm = parm; + t->freq = freq; + t->clock_ticks = 0; + + /* update main timer / sons to match highest frequency */ + if (freq > timer_main.freq) { + unsigned int new_counter = PIT_FREQ / freq; + + for (i = 0; i < MAX_TIMERS; i++) { + if (timer_func[i].func) { + ADJUST(timer_func[i], freq); + } + } - return NULL; + outportb(0x43, 0x34); + outportb(0x40, (unsigned char)new_counter); + outportb(0x40, (unsigned char)(new_counter>>8)); + timer_main.clock_ticks = 0; + timer_main.counter = new_counter; + timer_main.freq = freq; + } else { + /* t == &timer_func[i] */ + ADJUST(timer_func[i], timer_main.freq); + } + + ENABLE(); + + return t - timer_func; } -int pc_install_int (PFUNC func, void *parm, unsigned int freq) + + +/* Desc: remove timerfunc + * + * In : timerfunc id + * Out : 0 if success + * + * Note: tries to relax the main timer whenever possible + */ +int pc_remove_int (int fid) { int i; - TIMER *t; + unsigned int freq = 0; + /* are we installed? */ if (!timer_installed) { - if (install_timer()) { - return -1; - } + return -1; } - if ((t=find_slot(func))!=NULL) { + /* sanity check */ + if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) { + return -1; + } + timer_func[fid].func = NULL; + + /* scan for maximum frequency */ + for (i = 0; i < MAX_TIMERS; i++) { + TIMER *t = &timer_func[i]; + if (t->func) { + if (freq < t->freq) { + freq = t->freq; + } + } + } + + /* if there are no callbacks left, cleanup */ + if (!freq) { + pc_remove_timer(); + return 0; + } + + /* if we just lowered the maximum frequency, try to relax the timer engine */ + if (freq < timer_main.freq) { unsigned int new_counter = PIT_FREQ / freq; DISABLE(); - t->func = func; - t->parm = parm; - t->freq = freq; - t->clock_ticks = 0; - - if (new_counter < timer_main.counter) { - for (i=0;i<MAX_TIMERS;i++) { - if (timer_func[i].func) { - timer_func[i].counter = new_counter * timer_func[i].freq / freq; - } - } - outportb(0x43, 0x34); - outportb(0x40, (unsigned char)new_counter); - outportb(0x40, (unsigned char)(new_counter>>8)); - timer_main.clock_ticks = 0; - timer_main.counter = new_counter; - timer_main.freq = freq; - } else { - t->counter = PIT_FREQ * freq / (timer_main.freq * timer_main.freq); + for (i = 0; i < MAX_TIMERS; i++) { + if (timer_func[i].func) { + ADJUST(timer_func[i], freq); + } } - ENABLE(); + outportb(0x43, 0x34); + outportb(0x40, (unsigned char)new_counter); + outportb(0x40, (unsigned char)(new_counter>>8)); + timer_main.clock_ticks = 0; + timer_main.counter = new_counter; + timer_main.freq = freq; - return 0; + ENABLE(); } - return -1; + return 0; +} + + + +/* Desc: adjust timerfunc + * + * In : timerfunc id, new frequency (Hz) + * Out : 0 if success + * + * Note: might change the main timer frequency + */ +int pc_adjust_int (int fid, unsigned int freq) +{ + int i; + + /* are we installed? */ + if (!timer_installed) { + return -1; + } + + /* sanity check */ + if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) { + return -1; + } + timer_func[fid].freq = freq; + + /* scan for maximum frequency */ + freq = 0; + for (i = 0; i < MAX_TIMERS; i++) { + TIMER *t = &timer_func[i]; + if (t->func) { + if (freq < t->freq) { + freq = t->freq; + } + } + } + + /* update main timer / sons to match highest frequency */ + DISABLE(); + + /* using '>' is correct still (and avoids updating + * the HW timer too often), but doesn't relax the timer! + */ + if (freq != timer_main.freq) { + unsigned int new_counter = PIT_FREQ / freq; + + for (i = 0; i < MAX_TIMERS; i++) { + if (timer_func[i].func) { + ADJUST(timer_func[i], freq); + } + } + + outportb(0x43, 0x34); + outportb(0x40, (unsigned char)new_counter); + outportb(0x40, (unsigned char)(new_counter>>8)); + timer_main.clock_ticks = 0; + timer_main.counter = new_counter; + timer_main.freq = freq; + } else { + ADJUST(timer_func[fid], timer_main.freq); + } + + ENABLE(); + + return 0; } diff --git a/src/glut/dos/state.c b/src/glut/dos/state.c index e9d854cd4e1..b2455696102 100644 --- a/src/glut/dos/state.c +++ b/src/glut/dos/state.c @@ -27,6 +27,8 @@ */ +#include <stdio.h> + #include "glutint.h" @@ -140,3 +142,78 @@ int APIENTRY glutGetModifiers (void) return mod; } + + + +/* GAME MODE + * Hack alert: incomplete... what is GameMode, anyway? + */ +GLint g_game; +static GLboolean game_possible; +static GLboolean game_active; +static GLuint game_width; +static GLuint game_height; +static GLuint game_bpp; +static GLuint game_refresh; + + + +void APIENTRY glutGameModeString (const char *string) +{ + if (sscanf(string, "%ux%u:%u@%u", &game_width, &game_height, &game_bpp, &game_refresh) == 4) { + game_possible = GL_TRUE; + } +} + + + +int APIENTRY glutGameModeGet (GLenum mode) +{ + switch (mode) { + case GLUT_GAME_MODE_ACTIVE: + return game_active; + case GLUT_GAME_MODE_POSSIBLE: + return game_possible && !g_curwin; + case GLUT_GAME_MODE_WIDTH: + return game_active ? (int)game_width : -1; + case GLUT_GAME_MODE_HEIGHT: + return game_active ? (int)game_height : -1; + case GLUT_GAME_MODE_PIXEL_DEPTH: + return game_active ? (int)game_bpp : -1; + case GLUT_GAME_MODE_REFRESH_RATE: + return game_active ? (int)game_refresh : -1; + default: + return -1; + } +} + + + +int APIENTRY glutEnterGameMode (void) +{ + if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) { + g_bpp = game_bpp; + g_refresh = game_refresh; + + glutInitWindowSize(game_width, game_height); + + if ((g_game = glutCreateWindow("<game>")) > 0) { + game_active = GL_TRUE; + } + + return g_game; + } else { + return 0; + } +} + + + +void GLUTAPIENTRY glutLeaveGameMode (void) +{ + if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE)) { + game_active = GL_FALSE; + + glutDestroyWindow(g_game); + } +} diff --git a/src/glut/ggi/ggiglut.c b/src/glut/ggi/ggiglut.c index 140f576002a..9c5ad0c7bf5 100644 --- a/src/glut/ggi/ggiglut.c +++ b/src/glut/ggi/ggiglut.c @@ -55,7 +55,7 @@ char *__glutProgramName = "GGI"; static ggi_visual_t __glut_vis; -static GGIMesaContext __glut_ctx; +static ggi_mesa_context_t __glut_ctx; //static int __glut_width = WIDTH; //static int __glut_height = HEIGHT; diff --git a/src/glx/mini/dispatch.c b/src/glx/mini/dispatch.c index 264cd4cba82..40ef83cabaf 100644 --- a/src/glx/mini/dispatch.c +++ b/src/glx/mini/dispatch.c @@ -36,6 +36,7 @@ */ #include <GL/gl.h> +#include "glheader.h" #include "glapi.h" #include "glapitable.h" diff --git a/src/glx/mini/dri_util.h b/src/glx/mini/dri_util.h index b653b3c4316..7c0a640e555 100644 --- a/src/glx/mini/dri_util.h +++ b/src/glx/mini/dri_util.h @@ -488,6 +488,12 @@ struct __DRIscreenPrivateRec { * the drawable that was bound. Otherwise, this is NULL. */ __DRIdrawablePrivate *fullscreen; + + + /** + * \brief Screen number for when multiple screens are supported + */ + int myNum; }; extern void diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c index 25c7b963624..74e0ccc7b39 100644 --- a/src/glx/mini/miniglx.c +++ b/src/glx/mini/miniglx.c @@ -31,7 +31,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $Id: miniglx.c,v 1.1 2003/08/22 20:11:43 brianp Exp $ */ +/* $Id: miniglx.c,v 1.1.2.1 2003/11/21 15:49:27 keithw Exp $ */ /** * \mainpage Mini GLX @@ -732,7 +732,7 @@ static int get_chipset_from_busid( Display *dpy ) nr = sscanf(buf, "%04x\t%04x%04x", &encode, &vendor, &device); - bus = encode >> 16; + bus = encode >> 8; dev = (encode & 0xFF) >> 3; fn = encode & 0x7; diff --git a/src/mesa/Makefile.OSMesa16 b/src/mesa/Makefile.OSMesa16 new file mode 100644 index 00000000000..f451685a1a2 --- /dev/null +++ b/src/mesa/Makefile.OSMesa16 @@ -0,0 +1,300 @@ + +# Mesa 3-D graphics library +# Version: 5.1 +# Copyright (C) 1995-2003 Brian Paul + +# Makefile for building Mesa for 16/32-bit/channel rendering with the OSMesa +# driver. + + +##### MACROS ##### + +TOP = ../.. + +GL_MAJOR = 1 +GL_MINOR = 4 +GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) + +GL_LIB_NAME = "GL" # may be overridden in Make-config +OSMESA_LIB_NAME = "OSMesa16" # may be overridden in Make-config + +VPATH = RCS + +LIBDIR = $(TOP)/lib + + +### Lists of source files + +MAIN_SOURCES = \ + main/api_arrayelt.c \ + main/api_loopback.c \ + main/api_noop.c \ + main/api_validate.c \ + main/accum.c \ + main/arbprogram.c \ + main/arbfragparse.c \ + main/arbvertparse.c \ + main/attrib.c \ + main/blend.c \ + main/bufferobj.c \ + main/buffers.c \ + main/clip.c \ + main/colortab.c \ + main/context.c \ + main/convolve.c \ + main/debug.c \ + main/depth.c \ + main/dispatch.c \ + main/dlist.c \ + main/drawpix.c \ + main/enable.c \ + main/enums.c \ + main/eval.c \ + main/extensions.c \ + main/feedback.c \ + main/fog.c \ + main/get.c \ + main/hash.c \ + main/hint.c \ + main/histogram.c \ + main/image.c \ + main/imports.c \ + main/light.c \ + main/lines.c \ + main/matrix.c \ + main/nvprogram.c \ + main/nvfragparse.c \ + main/nvvertexec.c \ + main/nvvertparse.c \ + main/occlude.c \ + main/pixel.c \ + main/points.c \ + main/polygon.c \ + main/program.c \ + main/rastpos.c \ + main/state.c \ + main/stencil.c \ + main/texcompress.c \ + main/texformat.c \ + main/teximage.c \ + main/texobj.c \ + main/texstate.c \ + main/texstore.c \ + main/texutil.c \ + main/varray.c \ + main/vtxfmt.c + +GLAPI_SOURCES = \ + glapi/glapi.c \ + glapi/glthread.c + +MATH_SOURCES = \ + math/m_debug_clip.c \ + math/m_debug_norm.c \ + math/m_debug_xform.c \ + math/m_eval.c \ + math/m_matrix.c \ + math/m_translate.c \ + math/m_vector.c \ + math/m_xform.c + +ARRAY_CACHE_SOURCES = \ + array_cache/ac_context.c \ + array_cache/ac_import.c + +SWRAST_SOURCES = \ + swrast/s_aaline.c \ + swrast/s_aatriangle.c \ + swrast/s_accum.c \ + swrast/s_alpha.c \ + swrast/s_alphabuf.c \ + swrast/s_bitmap.c \ + swrast/s_blend.c \ + swrast/s_buffers.c \ + swrast/s_copypix.c \ + swrast/s_context.c \ + swrast/s_depth.c \ + swrast/s_drawpix.c \ + swrast/s_feedback.c \ + swrast/s_fog.c \ + swrast/s_imaging.c \ + swrast/s_lines.c \ + swrast/s_logic.c \ + swrast/s_masking.c \ + swrast/s_nvfragprog.c \ + swrast/s_pixeltex.c \ + swrast/s_points.c \ + swrast/s_readpix.c \ + swrast/s_span.c \ + swrast/s_stencil.c \ + swrast/s_texture.c \ + swrast/s_texstore.c \ + swrast/s_triangle.c \ + swrast/s_zoom.c + +SWRAST_SETUP_SOURCES = \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c + +TNL_SOURCES = \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_eval_api.c \ + tnl/t_imm_alloc.c \ + tnl/t_imm_api.c \ + tnl/t_imm_debug.c \ + tnl/t_imm_dlist.c \ + tnl/t_imm_elt.c \ + tnl/t_imm_eval.c \ + tnl/t_imm_exec.c \ + tnl/t_imm_fixup.c \ + tnl/t_pipeline.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vb_program.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c + +ASM_C_SOURCES = \ + x86/x86.c \ + x86/common_x86.c \ + x86/3dnow.c \ + x86/sse.c \ + sparc/sparc.c + +X86_SOURCES = \ + x86/common_x86_asm.S \ + x86/glapi_x86.S \ + x86/x86_xform2.S \ + x86/x86_xform3.S \ + x86/x86_xform4.S \ + x86/x86_cliptest.S \ + x86/mmx_blend.S \ + x86/3dnow_xform1.S \ + x86/3dnow_xform2.S \ + x86/3dnow_xform3.S \ + x86/3dnow_xform4.S \ + x86/3dnow_normal.S \ + x86/sse_xform1.S \ + x86/sse_xform2.S \ + x86/sse_xform3.S \ + x86/sse_xform4.S \ + x86/sse_normal.S + +SPARC_SOURCES = \ + sparc/clip.S \ + sparc/glapi_sparc.S \ + sparc/norm.S \ + sparc/xform.S + +### Groups of files + +CORE_SOURCES = \ + $(MAIN_SOURCES) \ + $(GLAPI_SOURCES) \ + $(MATH_SOURCES) \ + $(ARRAY_CACHE_SOURCES) \ + $(SWRAST_SOURCES) \ + $(SWRAST_SETUP_SOURCES) \ + $(TNL_SOURCES) \ + $(ASM_C_SOURCES) + +# This will probably get set to $(X86_SOURCES) in Make-config: +ASM_SOURCES = + +OSMESA_DRIVER_SOURCES = \ + drivers/osmesa/osmesa.c + +### Object files + +CORE_OBJECTS = $(CORE_SOURCES:.c=.o) + +ASM_OBJECTS = $(ASM_SOURCES:.S=.o) + +OSMESA_OBJECTS = $(OSMESA_DRIVER_SOURCES:.c=.o) + +OBJECTS = \ + $(CORE_OBJECTS) \ + $(ASM_OBJECTS) \ + $(OSMESA_OBJECTS) + + +### Include directories + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/mesa/glapi \ + -I$(TOP)/src/mesa/math \ + -I$(TOP)/src/mesa/transform \ + -I$(TOP)/src/mesa/swrast \ + -I$(TOP)/src/mesa/swrast_setup + +##### RULES ##### + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + + +x86/matypes.h: main/mtypes.h tnl/t_context.h x86/gen_matypes.c + $(CC) $(INCLUDE_DIRS) $(CFLAGS) x86/gen_matypes.c -o x86/gen_matypes + ./x86/gen_matypes > x86/matypes.h + rm -f x86/gen_matypes x86/*.o + +x86/common_x86_asm.o: x86/matypes.h + + + +##### TARGETS ##### + +default: + @echo "Specify a target configuration" + + +targets: $(LIBDIR)/$(OSMESA16_LIB) + +# Make the 16-bit/channel OSMesa library +$(LIBDIR)/$(OSMESA16_LIB): $(OBJECTS) + $(TOP)/bin/mklib $(MAKELIB_FLAGS) -o $(OSMESA_LIB_NAME) -major $(GL_MAJOR) \ + -minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \ + $(GL_LIB_DEPS) $(OBJECTS) + + + + +# +# Run 'make dep' to update the dependencies if you change what's included +# by any source file. +# +dep: $(CORE_SOURCES) $(OSMESA_DRIVER_SOURCES) $(ASM_SOURCES) + makedepend -fdepend -Y $(INCLUDE_DIRS) -DGGI -DSVGA -DFX \ + $(CORE_SOURCES) $(OSMESA_DRIVER_SOURCES) \ + $(ASM_SOURCES) + +dep: $(CORE_SOURCES) + makedepend -fdepend -Y -I../include $(CORE_SOURCES) + +tags: + etags `find . -name \*.[ch]` `find ../include` + + +# Remove .o and backup files +clean: + -rm *.a + -rm -f */*.o */*~ */*.o */*~ + -rm -f drivers/*/*.o + + +include $(TOP)/Make-config + +include depend diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11 index e62907b5523..c1706da5580 100644 --- a/src/mesa/Makefile.X11 +++ b/src/mesa/Makefile.X11 @@ -25,6 +25,7 @@ MAIN_SOURCES = \ main/api_noop.c \ main/api_validate.c \ main/accum.c \ + main/arbparse.c \ main/arbprogram.c \ main/arbfragparse.c \ main/arbvertparse.c \ @@ -207,7 +208,8 @@ GLIDE_DRIVER_SOURCES = \ drivers/glide/fxtexman.c \ drivers/glide/fxtris.c \ drivers/glide/fxvb.c \ - drivers/glide/fxglidew.c + drivers/glide/fxglidew.c \ + drivers/glide/fxg.c SVGA_DRIVER_SOURCES = \ drivers/svga/svgamesa.c \ @@ -234,11 +236,13 @@ CORE_SOURCES = \ # This will probably get set to $(X86_SOURCES) in Make-config: ASM_SOURCES = +ifndef SOLO # This should get set in Make-config someday: DRIVER_SOURCES = \ $(X11_DRIVER_SOURCES) \ $(GLIDE_DRIVER_SOURCES) \ $(SVGA_DRIVER_SOURCES) +endif ### Object files @@ -302,7 +306,7 @@ targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB) $(LIBMESA) $(LIBDIR)/$(GL_LIB): $(OBJECTS) $(TOP)/bin/mklib -o $(GL_LIB_NAME) -major $(GL_MAJOR) \ -minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \ - $(GL_LIB_DEPS) $(OBJECTS) + $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) # Make the OSMesa library @@ -311,7 +315,7 @@ $(LIBDIR)/$(OSMESA_LIB): $(OSMESA_OBJECTS) $(TOP)/bin/mklib -o $(OSMESA_LIB_NAME) -major $(MESA_MAJOR) \ -minor $(MESA_MINOR) -patch $(GL_TINY) -L$(LIBDIR) \ -l$(GL_LIB_NAME) -install $(LIBDIR) \ - $(OSMESA_OBJECTS) ; \ + $(MKLIB_OPTIONS) $(OSMESA_OBJECTS) ; \ fi @@ -346,9 +350,9 @@ tags: # Remove .o and backup files clean: - -rm *.a + -rm -f *.a -rm -f */*.o */*~ */*.o */*~ - -rm -f drivers/*/*.o + -rm -f drivers/*/*.o drivers/*/*/*.o include $(TOP)/Make-config diff --git a/src/mesa/Makefile.mgw b/src/mesa/Makefile.mgw index 0834908ec14..33ea665d29c 100644 --- a/src/mesa/Makefile.mgw +++ b/src/mesa/Makefile.mgw @@ -335,10 +335,10 @@ x86/gen_matypes.exe: x86/gen_matypes.c $(CC) -o $@ $(CFLAGS) -s $< # [dBorca] Hack alert: -# use standard API, to work around Win32 @x names -# also glapi_x86.S is protected against __WIN32__ -main/dispatch.o: main/dispatch.c - $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< +# glapi_x86.S needs some adjustments +# in order to generate correct entrypoints +x86/glapi_x86.o: x86/glapi_x86.S + $(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $< clean: -$(call UNLINK,array_cache/*.o) diff --git a/src/mesa/Makefile.wfx b/src/mesa/Makefile.wfx new file mode 100644 index 00000000000..4a95afe644e --- /dev/null +++ b/src/mesa/Makefile.wfx @@ -0,0 +1,435 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 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"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Win32/FX core makefile for Mesa +# +# Copyright (c) 2003 - Hiroshi Morii +# Email : [email protected] +# URL : http://www.3dfxzone.it/koolsmoky + +# Debug build : nmake -f Makefile.fx.win32 DEBUG=1 +# Optimized build : nmake -f Makefile.fx.win32 +# Remove objects : nmake -f Makefile.fx.win32 clean +# Remove files in bin, lib : nmake -f Makefile.fx.win32 clobber +# Remove all generated files : nmake -f Makefile.fx.win32 realclean + +.SUFFIXES: .S +################################## +# general +################################## +BUILDROOT = ..\.. + +!if "$(GLIDE3SDK)"=="" +GLIDE3SDK = $(BUILDROOT)\glide3 +!endif + +!if "$(GLIDE3SDK)"=="" +!error GLIDE3SDK undefined! Need to specify Glide3x SDK path! +!endif + +GLIDE3LIB = $(GLIDE3SDK)\lib\glide3x.lib +TEXUS2LIB = #$(GLIDE3SDK)\lib\texus2.lib +LIBDIR = $(BUILDROOT)\lib +GL_DLL = OpenGL32.dll + +HAVE_X86 = 1 +HAVE_MMX = 1 +HAVE_SSE = +HAVE_3DNOW = 1 + +################################## +# build flags +################################## +FLAGS = -DH3 -DFX_GLIDE_NAPALM=1 -DH4=1 -DFX_GLIDE_H5_CSIM=1 -DGLIDE3=1 -DGLIDE3_ALPHA=1 -DBUILD_GL32 -DFX #-DGLX_DIRECT_RENDERING + +!if "$(USE_IEEE)"=="1" +FLAGS = $(FLAGS) -D__i386__ +!endif + +!if "$(HAVE_MMX)"=="1" +FLAGS = $(FLAGS) -DUSE_MMX_ASM +!endif +!if "$(HAVE_SSE)"=="1" +FLAGS = $(FLAGS) -DUSE_SSE_ASM +!endif +!if "$(HAVE_3DNOW)"=="1" +FLAGS = $(FLAGS) -DUSE_3DNOW_ASM +!endif +!if "$(HAVE_X86)"=="1" +FLAGS = $(FLAGS) -DUSE_X86_ASM +!endif + +!if "$(DEBUG)" == "1" +FLAGS = $(FLAGS) -DMESA_DEBUG -DFX_DEBUG +!endif + +################################## +# compiler setup +################################## +CC = cl +LINK = link +AR = lib +AS = nasm + +CFLAGS = -nologo -G6 -c -D__MSC__ -D_MSC_VER=1200 -D_WIN32 -DWIN32 -DSTRICT -W3 #-WX -D__WIN32__ +LFLAGS = -nologo /DLL /OPT:WIN98 /MACHINE:IX86 /NODEFAULTLIB #/SUBSYSTEM:WINDOWS,4.00 +ARFLAGS = -nologo +ASFLAGS = -O2 -fwin32 + +!if "$(DEBUG)"== "1" +CFLAGS = $(CFLAGS) -Od -MDd -DDEBUG=1 -D_DEBUG -D_MT -Zi #-D_DLL conflicts with BUILD_GL32 +LFLAGS = $(LFLAGS) -debugtype:both /DEBUG +ARFLAGS = $(ARFLAGS) -debugtype:both +ASFLAGS = $(ASFLAGS) -g -DDEBUG=1 +!else +CFLAGS = $(CFLAGS) -Ox -MD -D_MT +!endif + +################################# +# OS commands +################################# +RM = @del +MV = mv + +################################# +# sources +################################# +MAIN_SOURCES = \ + main\api_arrayelt.c \ + main\api_loopback.c \ + main\api_noop.c \ + main\api_validate.c \ + main\accum.c \ + main\arbprogram.c \ + main\arbfragparse.c \ + main\arbvertparse.c \ + main\attrib.c \ + main\blend.c \ + main\bufferobj.c \ + main\buffers.c \ + main\clip.c \ + main\colortab.c \ + main\context.c \ + main\convolve.c \ + main\debug.c \ + main\depth.c \ + main\dispatch.c \ + main\dlist.c \ + main\drawpix.c \ + main\enable.c \ + main\enums.c \ + main\eval.c \ + main\extensions.c \ + main\feedback.c \ + main\fog.c \ + main\get.c \ + main\hash.c \ + main\hint.c \ + main\histogram.c \ + main\image.c \ + main\imports.c \ + main\light.c \ + main\lines.c \ + main\matrix.c \ + main\nvprogram.c \ + main\nvfragparse.c \ + main\nvvertexec.c \ + main\nvvertparse.c \ + main\occlude.c \ + main\pixel.c \ + main\points.c \ + main\polygon.c \ + main\program.c \ + main\rastpos.c \ + main\state.c \ + main\stencil.c \ + main\texcompress.c \ + main\texformat.c \ + main\teximage.c \ + main\texobj.c \ + main\texstate.c \ + main\texstore.c \ + main\texutil.c \ + main\varray.c \ + main\vtxfmt.c + +GLAPI_SOURCES = \ + glapi\glapi.c \ + glapi\glthread.c + +MATH_SOURCES = \ + math\m_debug_clip.c \ + math\m_debug_norm.c \ + math\m_debug_xform.c \ + math\m_eval.c \ + math\m_matrix.c \ + math\m_translate.c \ + math\m_vector.c \ + math\m_xform.c + +ARRAY_CACHE_SOURCES = \ + array_cache\ac_context.c \ + array_cache\ac_import.c + +SWRAST_SOURCES = \ + swrast\s_aaline.c \ + swrast\s_aatriangle.c \ + swrast\s_accum.c \ + swrast\s_alpha.c \ + swrast\s_alphabuf.c \ + swrast\s_bitmap.c \ + swrast\s_blend.c \ + swrast\s_buffers.c \ + swrast\s_copypix.c \ + swrast\s_context.c \ + swrast\s_depth.c \ + swrast\s_drawpix.c \ + swrast\s_feedback.c \ + swrast\s_fog.c \ + swrast\s_imaging.c \ + swrast\s_lines.c \ + swrast\s_logic.c \ + swrast\s_masking.c \ + swrast\s_nvfragprog.c \ + swrast\s_pixeltex.c \ + swrast\s_points.c \ + swrast\s_readpix.c \ + swrast\s_span.c \ + swrast\s_stencil.c \ + swrast\s_texture.c \ + swrast\s_texstore.c \ + swrast\s_triangle.c \ + swrast\s_zoom.c + +SWRAST_SETUP_SOURCES = \ + swrast_setup\ss_context.c \ + swrast_setup\ss_triangle.c \ + swrast_setup\ss_vb.c + +TNL_SOURCES = \ + tnl\t_array_api.c \ + tnl\t_array_import.c \ + tnl\t_context.c \ + tnl\t_eval_api.c \ + tnl\t_imm_alloc.c \ + tnl\t_imm_api.c \ + tnl\t_imm_debug.c \ + tnl\t_imm_dlist.c \ + tnl\t_imm_elt.c \ + tnl\t_imm_eval.c \ + tnl\t_imm_exec.c \ + tnl\t_imm_fixup.c \ + tnl\t_pipeline.c \ + tnl\t_vb_fog.c \ + tnl\t_vb_light.c \ + tnl\t_vb_normals.c \ + tnl\t_vb_points.c \ + tnl\t_vb_program.c \ + tnl\t_vb_render.c \ + tnl\t_vb_texgen.c \ + tnl\t_vb_texmat.c \ + tnl\t_vb_vertex.c + +DRIVER_SOURCES = \ + drivers\glide\fxapi.c \ + drivers\glide\fxdd.c \ + drivers\glide\fxddspan.c \ + drivers\glide\fxddtex.c \ + drivers\glide\fxsetup.c \ + drivers\glide\fxtexman.c \ + drivers\glide\fxtris.c \ + drivers\glide\fxvb.c \ + drivers\glide\fxglidew.c \ + drivers\glide\fxwgl.c \ + drivers\glide\fxg.c + +X86_SOURCES = \ + x86\x86.c \ + x86\glapi_x86.S \ + x86\common_x86.c \ + x86\common_x86_asm.S \ + x86\x86_xform2.S \ + x86\x86_xform3.S \ + x86\x86_xform4.S \ + x86\x86_cliptest.S + +MMX_SOURCES = \ + x86\mmx_blend.S + +SSE_SOURCES = \ + x86\sse.c \ + x86\sse_xform2.S \ + x86\sse_xform3.S \ + x86\sse_xform4.S \ + x86\sse_normal.S + +K3D_SOURCES = \ + x86\3dnow.c \ + x86\3dnow_xform2.S \ + x86\3dnow_xform3.S \ + x86\3dnow_xform4.S \ + x86\3dnow_normal.S + +!if "$(HAVE_MMX)"=="1" +X86_SOURCES = $(X86_SOURCES) $(MMX_SOURCES) +HAVE_X86 = 1 +!endif +!if "$(HAVE_SSE)"=="1" +X86_SOURCES = $(X86_SOURCES) $(SSE_SOURCES) +HAVE_X86 = 1 +!endif +!if "$(HAVE_3DNOW)"=="1" +X86_SOURCES = $(X86_SOURCES) $(K3D_SOURCES) +HAVE_X86 = 1 +!endif +!if "$(HAVE_X86)"=="1" +!else +X86_SOURCES = +!endif + +EXPORTS = drivers\glide\fxopengl.def + +MAIN_OBJS = $(MAIN_SOURCES:.c=.obj) +GLAPI_OBJS = $(GLAPI_SOURCES:.c=.obj) +MATH_OBJS = $(MATH_SOURCES:.c=.obj) +ARRAY_CACHE_OBJS = $(ARRAY_CACHE_SOURCES:.c=.obj) +SWRAST_OBJS = $(SWRAST_SOURCES:.c=.obj) +SWRAST_SETUP_OBJS = $(SWRAST_SETUP_SOURCES:.c=.obj) +TNL_OBJS = $(TNL_SOURCES:.c=.obj) +DRIVER_OBJS = $(DRIVER_SOURCES:.c=.obj) +X86_OBJS = $(X86_SOURCES:.c=.obj) +X86_OBJS = $(X86_OBJS:.S=.obj) + +RES = drivers\glide\fx.res + +CORE_LIBS = \ + $(LIBDIR)\main.lib \ + $(LIBDIR)\glapi.lib \ + $(LIBDIR)\math.lib \ + $(LIBDIR)\array_cache.lib \ + $(LIBDIR)\swrast.lib \ + $(LIBDIR)\swarst_setup.lib \ + $(LIBDIR)\tnl.lib + +!if "$(X86_SOURCES)"!="" +X86_LIB = $(LIBDIR)\x86.lib +!else +X86_LIB = +!endif + +INCS = -I$(BUILDROOT)\include \ + -I. \ + -I.\drivers\glide \ + -I.\main \ + -I.\glapi \ + -I$(GLIDE3SDK)\include + +DEP_LIB = user32.lib gdi32.lib kernel32.lib + +!if "$(DEBUG)" == "1" +STD_LIB = MSVCRTD.lib +!else +STD_LIB = MSVCRT.lib +!endif + +################################# +# build rules +################################# +default:: all + +all: $(X86_LIB) $(CORE_LIBS) $(LIBDIR)\$(GL_DLL) + +$(LIBDIR)\$(GL_DLL): $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(RES) + $(LINK) -out:$@ -def:$(EXPORTS) $(LFLAGS) $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(DEP_LIB) $(STD_LIB) $(TEXUS2LIB) $(GLIDE3LIB) $(RES) + +$(LIBDIR)\main.lib: $(MAIN_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(MAIN_OBJS) + +$(LIBDIR)\glapi.lib: $(GLAPI_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(GLAPI_OBJS) + +$(LIBDIR)\math.lib: $(MATH_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(MATH_OBJS) + +$(LIBDIR)\array_cache.lib: $(ARRAY_CACHE_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(ARRAY_CACHE_OBJS) + +$(LIBDIR)\swrast.lib: $(SWRAST_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(SWRAST_OBJS) + +$(LIBDIR)\swarst_setup.lib: $(SWRAST_SETUP_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(SWRAST_SETUP_OBJS) + +$(LIBDIR)\tnl.lib: $(TNL_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(TNL_OBJS) + +x86\matypes.h: x86\gen_matypes.exe + x86\gen_matypes.exe > $@ + +x86\gen_matypes.exe: x86\gen_matypes.obj + $(LINK) -out:$@ -nologo x86\gen_matypes.obj + +$(LIBDIR)\x86.lib: x86\matypes.h $(X86_OBJS) + $(AR) -out:$@ $(ARFLAGS) $(X86_OBJS) + +.c.obj: + $(CC) $(CFLAGS) $(FLAGS) $(INCS) $< /Fo$*.obj + +.S.obj: + $(CC) $(CFLAGS) $(FLAGS) $(INCS) $< -D__WIN32__ -DNASM_ASSEMBLER -EP > $*.i + $(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj + $(RM) $*.i + +.rc.res: + $(RC) -Fo$@ $(INCS) $(FLAGS) -D__WIN32__ $< + +# [dBorca] Hack alert: +# glapi_x86.S needs some adjustments +# in order to generate correct entrypoints +x86\glapi_x86.obj: x86\glapi_x86.S + $(CC) $(CFLAGS) $(FLAGS) $(INCS) x86\glapi_x86.S -DSTDCALL_API -DNASM_ASSEMBLER -EP > $*.i + $(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj + $(RM) $*.i + +################################# +# cleanup rules +################################# +realclean: clean clobber + +clean:: + $(RM) array_cache\*.obj + $(RM) glapi\*.obj + $(RM) main\*.obj + $(RM) math\*.obj + $(RM) swrast\*.obj + $(RM) swrast_setup\*.obj + $(RM) tnl\*.obj + $(RM) x86\*.obj + $(RM) drivers\glide\*.obj + $(RM) drivers\glide\*.res + $(RM) $(LIBDIR)\*.pdb + $(RM) *.pdb + +clobber:: + $(RM) $(LIBDIR)\*.lib + $(RM) $(LIBDIR)\*.exp + $(RM) $(LIBDIR)\*.dll diff --git a/src/mesa/array_cache/ac_context.c b/src/mesa/array_cache/ac_context.c index 8bf84d4876e..ebf3a3dc47b 100644 --- a/src/mesa/array_cache/ac_context.c +++ b/src/mesa/array_cache/ac_context.c @@ -336,28 +336,28 @@ void _ac_DestroyContext( GLcontext *ctx ) * not an offset into a buffer object. */ if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj) - FREE( ac->Cache.Vertex.Ptr ); + FREE( (void *) ac->Cache.Vertex.Ptr ); if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj) - FREE( ac->Cache.Normal.Ptr ); + FREE( (void *) ac->Cache.Normal.Ptr ); if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj) - FREE( ac->Cache.Color.Ptr ); + FREE( (void *) ac->Cache.Color.Ptr ); if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj) - FREE( ac->Cache.SecondaryColor.Ptr ); + FREE( (void *) ac->Cache.SecondaryColor.Ptr ); if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj) - FREE( ac->Cache.EdgeFlag.Ptr ); + FREE( (void *) ac->Cache.EdgeFlag.Ptr ); if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj) - FREE( ac->Cache.Index.Ptr ); + FREE( (void *) ac->Cache.Index.Ptr ); if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj) - FREE( ac->Cache.FogCoord.Ptr ); + FREE( (void *) ac->Cache.FogCoord.Ptr ); for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj) - FREE( ac->Cache.TexCoord[i].Ptr ); + FREE( (void *) ac->Cache.TexCoord[i].Ptr ); } for (i = 0; i < VERT_ATTRIB_MAX; i++) { if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj) - FREE( ac->Cache.Attrib[i].Ptr ); + FREE( (void *) ac->Cache.Attrib[i].Ptr ); } if (ac->Elts) diff --git a/src/mesa/drivers/dos/blit.S b/src/mesa/drivers/dos/blit.S index f5888c7e395..1f1c77bd563 100644 --- a/src/mesa/drivers/dos/blit.S +++ b/src/mesa/drivers/dos/blit.S @@ -23,7 +23,7 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa + * DOS/DJGPP device driver v1.4 for Mesa * * Copyright (C) 2002 - Borca Daniel * Email : [email protected] @@ -31,7 +31,10 @@ */ - .file "blit.S" +#include "x86/assyntax.h" + + + FILE("blit.S") /* * extern unsigned int vesa_gran_mask, vesa_gran_shift; @@ -41,8 +44,15 @@ * extern int vl_current_stride, vl_current_height; * extern int vl_current_offset, vl_current_delta; */ +EXTERN _vesa_gran_mask, _vesa_gran_shift +EXTERN _vl_video_selector + +EXTERN _vl_current_draw_buffer +EXTERN _vl_current_stride, _vl_current_height +EXTERN _vl_current_offset, _vl_current_delta - .text + SEG_TEXT + USE32 /* Desc: VESA bank switching routine (BIOS) * @@ -51,15 +61,15 @@ * * Note: thrashes EAX */ - .p2align 5,,31 + ALIGNTEXT32 _vesa_swbankBIOS: - movw $0x4f05, %ax - int $0x10 - ret + MOV_W (CONST(0x4f05), AX) + INT (CONST(0x10)) + RET - .p2align 2,,3 - .global _vesa_swbank -_vesa_swbank: .long _vesa_swbankBIOS + ALIGNTEXT8 + GLOBL _vesa_swbank +_vesa_swbank: D_LONG _vesa_swbankBIOS /* Desc: void vesa_b_dump_virtual (void); * @@ -68,60 +78,60 @@ _vesa_swbank: .long _vesa_swbankBIOS * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _vesa_b_dump_virtual + ALIGNTEXT32 + GLOBL _vesa_b_dump_virtual _vesa_b_dump_virtual: - cld - pushl %es - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %es - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - movl _vl_current_delta, %ebx - shrl $2, %ecx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - pushl %eax - pushl %ebx - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - popl %ebx - popl %eax - subl %ebp, %edi - .balign 4 - 2: - movsl - decl %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - popl %es - ret + CLD + PUSH_SR (ES) + PUSH_L (EBX) + PUSH_L (ESI) + PUSH_L (EDI) + PUSH_L (EBP) + MOV_SR (CONTENT(_vl_video_selector), ES) + MOV_L (CONTENT(_vl_current_draw_buffer), ESI) + MOV_L (CONTENT(_vl_current_offset), EDI) + MOV_L (CONTENT(_vesa_gran_shift), ECX) + MOV_L (CONTENT(_vesa_gran_mask), EBP) + MOV_L (EDI, EDX) + XOR_L (EBX, EBX) + AND_L (EBP, EDI) + SHR_L (CL, EDX) + INC_L (EBP) + CALL (VARINDIRECT(_vesa_swbank)) + MOV_L (CONTENT(_vl_current_stride), ECX) + MOV_L (CONTENT(_vl_current_height), EAX) + MOV_L (CONTENT(_vl_current_delta), EBX) + SHR_L (CONST(2), ECX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + CMP_L (EBP, EDI) + jb TLBL(2) + PUSH_L (EAX) + PUSH_L (EBX) + INC_L (EDX) + XOR_L (EBX, EBX) + CALL (VARINDIRECT(_vesa_swbank)) + POP_L (EBX) + POP_L (EAX) + SUB_L (EBP, EDI) + ALIGNTEXT4 + TLBL(2): + MOVS_L + DEC_L (ECX) + jnz TLBL(1) + POP_L (ECX) + ADD_L (EBX, EDI) + DEC_L (EAX) + jnz TLBL(0) + POP_L (EBP) + POP_L (EDI) + POP_L (ESI) + POP_L (EBX) + POP_SR (ES) + RET /* Desc: void vesa_l_dump_virtual (void); * @@ -130,32 +140,32 @@ _vesa_b_dump_virtual: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _vesa_l_dump_virtual + ALIGNTEXT32 + GLOBL _vesa_l_dump_virtual _vesa_l_dump_virtual: - cld - pushl %es - pushl %esi - pushl %edi - movl _vl_video_selector, %es - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %eax - shrl $2, %ecx - .balign 4 - 0: - pushl %ecx - rep; movsl - popl %ecx - addl %eax, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %es - ret + CLD + PUSH_SR (ES) + PUSH_L (ESI) + PUSH_L (EDI) + MOV_SR (CONTENT(_vl_video_selector), ES) + MOV_L (CONTENT(_vl_current_draw_buffer), ESI) + MOV_L (CONTENT(_vl_current_offset), EDI) + MOV_L (CONTENT(_vl_current_stride), ECX) + MOV_L (CONTENT(_vl_current_height), EDX) + MOV_L (CONTENT(_vl_current_delta), EAX) + SHR_L (CONST(2), ECX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + REP MOVS_L + POP_L (ECX) + ADD_L (EAX, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EDI) + POP_L (ESI) + POP_SR (ES) + RET /* Desc: void vesa_l_dump_virtual_mmx (void); * @@ -164,36 +174,37 @@ _vesa_l_dump_virtual: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _vesa_l_dump_virtual_mmx + ALIGNTEXT32 + GLOBL _vesa_l_dump_virtual_mmx _vesa_l_dump_virtual_mmx: #ifdef USE_MMX_ASM - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %eax - shrl $3, %ecx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - movq (%esi), %mm0 - addl $8, %esi - movq %mm0, %fs:(%edi) - addl $8, %edi - decl %ecx - jnz 1b - popl %ecx - addl %eax, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - emms + PUSH_L (ESI) + PUSH_L (EDI) + MOV_SR (CONTENT(_vl_video_selector), FS) + MOV_L (CONTENT(_vl_current_draw_buffer), ESI) + MOV_L (CONTENT(_vl_current_offset), EDI) + MOV_L (CONTENT(_vl_current_stride), ECX) + MOV_L (CONTENT(_vl_current_height), EDX) + MOV_L (CONTENT(_vl_current_delta), EAX) + SHR_L (CONST(3), ECX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + MOVQ (REGIND(ESI), MM0) + ADD_L (CONST(8), ESI) + SEGFS + MOVQ (MM0, REGIND(EDI)) + ADD_L (CONST(8), EDI) + DEC_L (ECX) + jnz TLBL(1) + POP_L (ECX) + ADD_L (EAX, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EDI) + POP_L (ESI) + EMMS #endif - ret + RET diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index bfebb91396e..a5d052b39db 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 5.0.1 + * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -34,6 +34,7 @@ #include "glheader.h" #include "context.h" #ifndef FX +#include "bufferobj.h" #include "extensions.h" #include "macros.h" #include "matrix.h" @@ -1108,11 +1109,22 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all, +/* + * This function is called to specify which buffer to read and write + * for software rasterization (swrast) fallbacks. This doesn't necessarily + * correspond to glDrawBuffer() or glReadBuffer() calls. + */ static void set_buffer (GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit) { /* * XXX todo - examine bufferBit and set read/write pointers */ + /* Normally, we would have + * ctx->Driver.ReadBuffer == set_read_buffer + * ctx->Driver.DrawBuffer == set_draw_buffer + * and make sure set_draw_buffer calls _swrast_DrawBuffer, + * which in turn will call this routine via dd->SetBuffer. + */ } @@ -1137,13 +1149,10 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name) switch (name) { case GL_RENDERER: return (const GLubyte *)"Mesa DJGPP" - #ifdef FX - " (FX)" - #endif #ifdef MATROX " (MGA)" #endif - "\0port (c) Borca Daniel aug-2003"; + "\0port (c) Borca Daniel oct-2003"; default: return NULL; } @@ -1311,7 +1320,7 @@ static void dmesa_init_pointers (GLcontext *ctx) static void dmesa_update_state (GLcontext *ctx, GLuint new_state) { - /* Propogate statechange information to swrast and swrast_setup + /* Propagate statechange information to swrast and swrast_setup * modules. The DMesa driver has no internal GL-dependent state. */ _swrast_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/dos/mga/m_ttemp.h b/src/mesa/drivers/dos/mga/m_ttemp.h index 90d9de35642..e4c65f834b9 100644 --- a/src/mesa/drivers/dos/mga/m_ttemp.h +++ b/src/mesa/drivers/dos/mga/m_ttemp.h @@ -23,7 +23,7 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa -- MGA2064W triangle template + * DOS/DJGPP device driver v1.4 for Mesa -- MGA2064W triangle template * * Copyright (c) 2003 - Borca Daniel * Email : [email protected] @@ -83,7 +83,9 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v #endif #if defined(INTERP_Z) || defined(INTERP_RGB) +#if !LONG_LONG double one_area; +#endif #ifndef INTERP_RGB int red = v3->color[0]; int green = v3->color[1]; @@ -147,7 +149,9 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v /* draw lower triangle */ #if defined(INTERP_Z) || defined(INTERP_RGB) +#if !LONG_LONG one_area = (double)(1<<15) / (double)area; +#endif mga_fifo(1); #else mga_fifo(2); @@ -163,8 +167,13 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v /* compute d?/dx and d?/dy derivatives */ eMaj_dz = z3 - z1; eBot_dz = z2 - z1; +#if !LONG_LONG dzdx = (eMaj_dz * eBot_dy - eMaj_dy * eBot_dz) * one_area; dzdy = (eMaj_dx * eBot_dz - eMaj_dz * eBot_dx) * one_area; +#else + dzdx = ((long long)(eMaj_dz * eBot_dy - eMaj_dy * eBot_dz)<<15) / area; + dzdy = ((long long)(eMaj_dx * eBot_dz - eMaj_dz * eBot_dx)<<15) / area; +#endif #ifndef INTERP_RGB mga_fifo(11); @@ -196,12 +205,21 @@ void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v eBot_db = v2->color[2] - v1->color[2]; /* compute color increments */ +#if !LONG_LONG drdx = (eMaj_dr * eBot_dy - eMaj_dy * eBot_dr) * one_area; drdy = (eMaj_dx * eBot_dr - eMaj_dr * eBot_dx) * one_area; dgdx = (eMaj_dg * eBot_dy - eMaj_dy * eBot_dg) * one_area; dgdy = (eMaj_dx * eBot_dg - eMaj_dg * eBot_dx) * one_area; dbdx = (eMaj_db * eBot_dy - eMaj_dy * eBot_db) * one_area; dbdy = (eMaj_dx * eBot_db - eMaj_db * eBot_dx) * one_area; +#else + drdx = ((long long)(eMaj_dr * eBot_dy - eMaj_dy * eBot_dr)<<15) / area; + drdy = ((long long)(eMaj_dx * eBot_dr - eMaj_dr * eBot_dx)<<15) / area; + dgdx = ((long long)(eMaj_dg * eBot_dy - eMaj_dy * eBot_dg)<<15) / area; + dgdy = ((long long)(eMaj_dx * eBot_dg - eMaj_dg * eBot_dx)<<15) / area; + dbdx = ((long long)(eMaj_db * eBot_dy - eMaj_dy * eBot_db)<<15) / area; + dbdy = ((long long)(eMaj_dx * eBot_db - eMaj_db * eBot_dx)<<15) / area; +#endif mga_fifo(6); mga_outl(M_DR6, drdx); diff --git a/src/mesa/drivers/dos/mga/m_ttemp2.h b/src/mesa/drivers/dos/mga/m_ttemp2.h deleted file mode 100644 index 13ca87d348a..00000000000 --- a/src/mesa/drivers/dos/mga/m_ttemp2.h +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 5.0 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * DOS/DJGPP device driver v1.3 for Mesa -- MGA2064W triangle template - * - * Copyright (c) 2003 - Borca Daniel - * Email : [email protected] - * Web : http://www.geocities.com/dborca - */ - - -/* - * Triangle Rasterizer Template - * - * This file is #include'd to generate custom triangle rasterizers. - * - * The following macros may be defined to indicate what auxillary information - * must be interplated across the triangle: - * INTERP_Z - if defined, interpolate Z values - * INTERP_RGB - if defined, interpolate RGB values - * - * TAG - function name - * CULL - enable culling for: 0=no, 1=back, -1=front - * - * SETUP_CODE - to be executed once per triangle (usually HW init) - * - * For flatshaded primitives, the provoking vertex is the final one. - * This code was designed for the origin to be in the upper-left corner. - * - * Inspired by triangle rasterizer code written by Brian Paul. - */ - - - -#define TRI_SWAP(a, b) \ -do { \ - const MGAvertex *tmp = a; \ - a = b; \ - b = tmp; \ -} while (0) - -void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3) -{ - int area; - int x1, y1, x2, y2, x3, y3; - int eMaj_dx, eMaj_dy, eBot_dx, eBot_dy, eTop_dx, eTop_dy; -#ifdef INTERP_RGB -#define FIFO_CNT_RGB 3 - int eMaj_dr, eBot_dr, eMaj_dg, eBot_dg, eMaj_db, eBot_db; - int drdx, drdy, dgdx, dgdy, dbdx, dbdy; -#else -#define FIFO_CNT_RGB 0 -#endif -#ifdef INTERP_Z -#define FIFO_CNT_Z 1 - int dzdx, dzdy; - int eMaj_dz, eBot_dz; - int z1, z2, z3; -#else -#define FIFO_CNT_Z 0 -#endif - -#if defined(INTERP_Z) || defined(INTERP_RGB) -#ifndef INTERP_RGB - int red = v3->color[0]; - int green = v3->color[1]; - int blue = v3->color[2]; -#endif -#else - unsigned long color = mga_mixrgb_full(v3->color); -#endif - - int sgn = 0; - - /* sort along the vertical axis */ - if (v2->win[1] < v1->win[1]) { - TRI_SWAP(v1, v2); -#ifdef CULL - cull = -cull; -#endif - } - - if (v3->win[1] < v1->win[1]) { - TRI_SWAP(v1, v3); - TRI_SWAP(v2, v3); - } else if (v3->win[1] < v2->win[1]) { - TRI_SWAP(v2, v3); -#ifdef CULL - cull = -cull; -#endif - } - - x1 = v1->win[0]; - y1 = v1->win[1]; - x2 = v2->win[0]; - y2 = v2->win[1]; - x3 = v3->win[0]; - y3 = v3->win[1]; - - /* compute deltas for each edge */ - eMaj_dx = x3 - x1; - eMaj_dy = y3 - y1; - eBot_dx = x2 - x1; - eBot_dy = y2 - y1; - eTop_dx = x3 - x2; - eTop_dy = y3 - y2; - - /* compute area */ - if ((area = eMaj_dx * eBot_dy - eBot_dx * eMaj_dy) == 0) { - return; - } -#ifdef CULL - if ((area * cull) > 0) { - return; - } -#endif - - mga_select(); - - /* set engine state */ -#ifdef SETUP_CODE - SETUP_CODE -#endif - - /* draw lower triangle */ -#if defined(INTERP_Z) || defined(INTERP_RGB) - mga_fifo(1); -#else - mga_fifo(2); - mga_outl(M_FCOL, color); -#endif - mga_outl(M_YDST, y1); - -#ifdef INTERP_Z - z1 = v1->win[2]; - z2 = v2->win[2]; - z3 = v3->win[2]; - - /* compute d?/dx and d?/dy derivatives */ - eMaj_dz = z3 - z1; - eBot_dz = z2 - z1; - dzdx = ((long long)(eMaj_dz * eBot_dy - eMaj_dy * eBot_dz)<<15) / area; - dzdy = ((long long)(eMaj_dx * eBot_dz - eMaj_dz * eBot_dx)<<15) / area; - -#ifndef INTERP_RGB - mga_fifo(11); - mga_outl(M_DR2, dzdx); - mga_outl(M_DR3, dzdy); - mga_outl(M_DR4, red<<15); - mga_outl(M_DR6, 0); - mga_outl(M_DR7, 0); - mga_outl(M_DR8, green<<15); - mga_outl(M_DR10, 0); - mga_outl(M_DR11, 0); - mga_outl(M_DR12, blue<<15); - mga_outl(M_DR14, 0); - mga_outl(M_DR15, 0); -#else - mga_fifo(2); - mga_outl(M_DR2, dzdx); - mga_outl(M_DR3, dzdy); -#endif -#endif - -#ifdef INTERP_RGB - /* compute color deltas */ - eMaj_dr = v3->color[0] - v1->color[0]; - eBot_dr = v2->color[0] - v1->color[0]; - eMaj_dg = v3->color[1] - v1->color[1]; - eBot_dg = v2->color[1] - v1->color[1]; - eMaj_db = v3->color[2] - v1->color[2]; - eBot_db = v2->color[2] - v1->color[2]; - - /* compute color increments */ - drdx = ((long long)(eMaj_dr * eBot_dy - eMaj_dy * eBot_dr)<<15) / area; - drdy = ((long long)(eMaj_dx * eBot_dr - eMaj_dr * eBot_dx)<<15) / area; - dgdx = ((long long)(eMaj_dg * eBot_dy - eMaj_dy * eBot_dg)<<15) / area; - dgdy = ((long long)(eMaj_dx * eBot_dg - eMaj_dg * eBot_dx)<<15) / area; - dbdx = ((long long)(eMaj_db * eBot_dy - eMaj_dy * eBot_db)<<15) / area; - dbdy = ((long long)(eMaj_dx * eBot_db - eMaj_db * eBot_dx)<<15) / area; - - mga_fifo(6); - mga_outl(M_DR6, drdx); - mga_outl(M_DR7, drdy); - mga_outl(M_DR10, dgdx); - mga_outl(M_DR11, dgdy); - mga_outl(M_DR14, dbdx); - mga_outl(M_DR15, dbdy); -#endif - - if (area > 0) { /* major edge on the right */ - if (eBot_dy) { /* have lower triangle */ - mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); - - mga_outl(M_AR0, eBot_dy); - if (x2 < x1) { - mga_outl(M_AR1, eBot_dx + eBot_dy - 1); - mga_outl(M_AR2, eBot_dx); - sgn |= M_SDXL; - } else { - mga_outl(M_AR1, -eBot_dx); - mga_outl(M_AR2, -eBot_dx); - } - - mga_outl(M_AR6, eMaj_dy); - if (x3 < x1) { - mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); - mga_outl(M_AR5, eMaj_dx); - sgn |= M_SDXR; - } else { - mga_outl(M_AR4, -eMaj_dx); - mga_outl(M_AR5, -eMaj_dx); - } - - mga_outl(M_FXBNDRY, (x1<<16) | x1); -#ifdef INTERP_Z - mga_outl(M_DR0, z1<<15); -#endif -#ifdef INTERP_RGB - mga_outl(M_DR4, v1->color[0]<<15); - mga_outl(M_DR8, v1->color[1]<<15); - mga_outl(M_DR12, v1->color[2]<<15); -#endif - mga_outl(M_SGN, sgn); - mga_outl(M_LEN | M_EXEC, eBot_dy); - } else { /* no lower triangle */ - mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); - - mga_outl(M_AR6, eMaj_dy); - if (x3 < x1) { - mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); - mga_outl(M_AR5, eMaj_dx); - sgn |= M_SDXR; - } else { - mga_outl(M_AR4, -eMaj_dx); - mga_outl(M_AR5, -eMaj_dx); - } - - mga_outl(M_FXBNDRY, (x1<<16) | x2); -#ifdef INTERP_Z - mga_outl(M_DR0, z2<<15); -#endif -#ifdef INTERP_RGB - mga_outl(M_DR4, v2->color[0]<<15); - mga_outl(M_DR8, v2->color[1]<<15); - mga_outl(M_DR12, v2->color[2]<<15); -#endif - } - - /* draw upper triangle */ - if (eTop_dy) { - mga_fifo(5); - mga_outl(M_AR0, eTop_dy); - if (x3 < x2) { - mga_outl(M_AR1, eTop_dx + eTop_dy - 1); - mga_outl(M_AR2, eTop_dx); - sgn |= M_SDXL; - } else { - mga_outl(M_AR1, -eTop_dx); - mga_outl(M_AR2, -eTop_dx); - sgn &= ~M_SDXL; - } - mga_outl(M_SGN, sgn); - mga_outl(M_LEN | M_EXEC, eTop_dy); - } - } else { /* major edge on the left */ - if (eBot_dy) { /* have lower triangle */ - mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); - - mga_outl(M_AR0, eMaj_dy); - if (x3 < x1) { - mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); - mga_outl(M_AR2, eMaj_dx); - sgn |= M_SDXL; - } else { - mga_outl(M_AR1, -eMaj_dx); - mga_outl(M_AR2, -eMaj_dx); - } - - mga_outl(M_AR6, eBot_dy); - if (x2 < x1) { - mga_outl(M_AR4, eBot_dx + eBot_dy - 1); - mga_outl(M_AR5, eBot_dx); - sgn |= M_SDXR; - } else { - mga_outl(M_AR4, -eBot_dx); - mga_outl(M_AR5, -eBot_dx); - } - - mga_outl(M_FXBNDRY, (x1<<16) | x1); -#ifdef INTERP_Z - mga_outl(M_DR0, z1<<15); -#endif -#ifdef INTERP_RGB - mga_outl(M_DR4, v1->color[0]<<15); - mga_outl(M_DR8, v1->color[1]<<15); - mga_outl(M_DR12, v1->color[2]<<15); -#endif - mga_outl(M_SGN, sgn); - mga_outl(M_LEN | M_EXEC, eBot_dy); - } else { /* no lower triangle */ - mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); - - mga_outl(M_AR0, eMaj_dy); - if (x3 < x1) { - mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); - mga_outl(M_AR2, eMaj_dx); - sgn |= M_SDXL; - } else { - mga_outl(M_AR1, -eMaj_dx); - mga_outl(M_AR2, -eMaj_dx); - } - - mga_outl(M_FXBNDRY, (x2<<16) | x1); -#ifdef INTERP_Z - mga_outl(M_DR0, z1<<15); -#endif -#ifdef INTERP_RGB - mga_outl(M_DR4, v1->color[0]<<15); - mga_outl(M_DR8, v1->color[1]<<15); - mga_outl(M_DR12, v1->color[2]<<15); -#endif - } - - /* draw upper triangle */ - if (eTop_dy) { - mga_fifo(5); - mga_outl(M_AR6, eTop_dy); - if (x3 < x2) { - mga_outl(M_AR4, eTop_dx + eTop_dy - 1); - mga_outl(M_AR5, eTop_dx); - sgn |= M_SDXR; - } else { - mga_outl(M_AR4, -eTop_dx); - mga_outl(M_AR5, -eTop_dx); - sgn &= ~M_SDXR; - } - mga_outl(M_SGN, sgn); - mga_outl(M_LEN | M_EXEC, eTop_dy); - } - } -} - -#undef FIFO_CNT_RGB -#undef FIFO_CNT_Z - -#undef TRI_SWAP - -#undef SETUP_CODE -#undef INTERP_RGB -#undef INTERP_Z -#undef CULL -#undef TAG diff --git a/src/mesa/drivers/dos/virtual.S b/src/mesa/drivers/dos/virtual.S index c5cc1fe86f8..677f07a6263 100644 --- a/src/mesa/drivers/dos/virtual.S +++ b/src/mesa/drivers/dos/virtual.S @@ -23,7 +23,7 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa + * DOS/DJGPP device driver v1.4 for Mesa * * Copyright (C) 2002 - Borca Daniel * Email : [email protected] @@ -31,14 +31,20 @@ */ - .file "virtual.S" +#include "x86/assyntax.h" + + + FILE("virtual.S") /* * extern void *vl_current_draw_buffer; * extern int vl_current_width, vl_current_bytes; */ +EXTERN _vl_current_draw_buffer +EXTERN _vl_current_width, _vl_current_bytes - .text + SEG_TEXT + USE32 /* Desc: void v_clear8 (int color); * @@ -47,14 +53,14 @@ * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear8 + ALIGNTEXT32 + GLOBL _v_clear8 _v_clear8: - movl 4(%esp), %eax - movb %al, %ah - pushw %ax - pushw %ax - popl %eax + MOV_L (REGOFF(4, ESP), EAX) + MOV_B (AL, AH) + PUSH_W (AX) + PUSH_W (AX) + POP_L (EAX) jmp _v_clear_common /* Desc: void v_clear16 (int color); @@ -64,13 +70,13 @@ _v_clear8: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear16 + ALIGNTEXT32 + GLOBL _v_clear16 _v_clear16: - movl 4(%esp), %eax - pushw %ax - pushw %ax - popl %eax + MOV_L (REGOFF(4, ESP), EAX) + PUSH_W (AX) + PUSH_W (AX) + POP_L (EAX) jmp _v_clear_common /* Desc: void v_clear32 (int color); @@ -80,22 +86,22 @@ _v_clear16: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear32 + ALIGNTEXT32 + GLOBL _v_clear32 _v_clear32: - movl 4(%esp), %eax - .balign 4 + MOV_L (REGOFF(4, ESP), EAX) + ALIGNTEXT4 _v_clear_common: - movl _vl_current_bytes, %ecx - movl _vl_current_draw_buffer, %edx - shrl $2, %ecx - .balign 4 - 0: - movl %eax, (%edx) - addl $4, %edx - decl %ecx - jnz 0b - ret + MOV_L (CONTENT(_vl_current_bytes), ECX) + MOV_L (CONTENT(_vl_current_draw_buffer), EDX) + SHR_L (CONST(2), ECX) + ALIGNTEXT4 + TLBL(0): + MOV_L (EAX, REGIND(EDX)) + ADD_L (CONST(4), EDX) + DEC_L (ECX) + jnz TLBL(0) + RET /* Desc: void v_clear8_mmx (int color); * @@ -104,13 +110,13 @@ _v_clear_common: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear8_mmx + ALIGNTEXT32 + GLOBL _v_clear8_mmx _v_clear8_mmx: #ifdef USE_MMX_ASM - movd 4(%esp), %mm0 - punpcklbw %mm0, %mm0 - punpcklwd %mm0, %mm0 + MOVD (REGOFF(4, ESP), MM0) + PUNPCKLBW (MM0, MM0) + PUNPCKLWD (MM0, MM0) jmp _v_clear_common_mmx #endif @@ -121,12 +127,12 @@ _v_clear8_mmx: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear16_mmx + ALIGNTEXT32 + GLOBL _v_clear16_mmx _v_clear16_mmx: #ifdef USE_MMX_ASM - movd 4(%esp), %mm0 - punpcklwd %mm0, %mm0 + MOVD (REGOFF(4, ESP), MM0) + PUNPCKLWD (MM0, MM0) jmp _v_clear_common_mmx #endif @@ -137,26 +143,26 @@ _v_clear16_mmx: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear32_mmx + ALIGNTEXT32 + GLOBL _v_clear32_mmx _v_clear32_mmx: #ifdef USE_MMX_ASM - movd 4(%esp), %mm0 - .balign 4 + MOVD (REGOFF(4, ESP), MM0) + ALIGNTEXT4 _v_clear_common_mmx: - punpckldq %mm0, %mm0 - movl _vl_current_bytes, %ecx - movl _vl_current_draw_buffer, %edx - shrl $3, %ecx - .balign 4 - 0: - movq %mm0, (%edx) - addl $8, %edx - decl %ecx - jnz 0b - emms + PUNPCKLDQ (MM0, MM0) + MOV_L (CONTENT(_vl_current_bytes), ECX) + MOV_L (CONTENT(_vl_current_draw_buffer), EDX) + SHR_L (CONST(3), ECX) + ALIGNTEXT4 + TLBL(0): + MOVQ (MM0, REGIND(EDX)) + ADD_L (CONST(8), EDX) + DEC_L (ECX) + jnz TLBL(0) + EMMS #endif - ret + RET /* Desc: void v_clear24 (int color); * @@ -165,26 +171,26 @@ _v_clear_common_mmx: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear24 + ALIGNTEXT32 + GLOBL _v_clear24 _v_clear24: - movl $0xaaaaaaab, %eax - mull _vl_current_bytes - movl 4(%esp), %eax - movl %edx, %ecx - pushl %ebx - movl _vl_current_draw_buffer, %edx - shrl %ecx - movb 10(%esp), %bl - .balign 4 - 0: - movw %ax, (%edx) - movb %bl, 2(%edx) - addl $3, %edx - decl %ecx - jnz 0b - popl %ebx - ret + MOV_L (CONST(0xaaaaaaab), EAX) + MUL_L (CONTENT(_vl_current_bytes)) + MOV_L (REGOFF(4, ESP), EAX) + MOV_L (EDX, ECX) + PUSH_L (EBX) + MOV_L (CONTENT(_vl_current_draw_buffer), EDX) + SHR_L (CONST(1), ECX) + MOV_B (REGOFF(10,ESP), BL) + ALIGNTEXT4 + TLBL(0): + MOV_W (AX, REGIND(EDX)) + MOV_B (BL, REGOFF(2,EDX)) + ADD_L (CONST(3), EDX) + DEC_L (ECX) + jnz TLBL(0) + POP_L (EBX) + RET /* Desc: void v_clear24_mmx (int color); * @@ -193,47 +199,47 @@ _v_clear24: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_clear24_mmx + ALIGNTEXT32 + GLOBL _v_clear24_mmx _v_clear24_mmx: #ifdef USE_MMX_ASM - movl 4(%esp), %eax - movl %eax, %edx - movl %eax, %ecx - shll $16, %edx - rorl $8, %ecx - movw %cx, %dx - rorl $16, %ecx - movb %dh, %cl - shll $8, %eax - movb %ch, %al - rorl $8, %eax + MOV_L (REGOFF(4, ESP), EAX) + MOV_L (EAX, EDX) + MOV_L (EAX, ECX) + SHL_L (CONST(16), EDX) + ROR_L (CONST(8), ECX) + MOV_W (CX, DX) + ROR_L (CONST(16), ECX) + MOV_B (DH, CL) + SHL_L (CONST(8), EAX) + MOV_B (CH, AL) + ROR_L (CONST(8), EAX) - pushl %edx - pushl %eax - movq (%esp), %mm0 - pushl %ecx - movq (%esp), %mm1 - pushl %edx - movq (%esp), %mm2 + PUSH_L (EDX) + PUSH_L (EAX) + MOVQ (REGIND(ESP), MM0) + PUSH_L (ECX) + MOVQ (REGIND(ESP), MM1) + PUSH_L (EDX) + MOVQ (REGIND(ESP), MM2) - movl $0xaaaaaaab, %eax - mull _vl_current_bytes - movl %edx, %ecx - movl _vl_current_draw_buffer, %edx - shrl $4, %ecx - .balign 4 - 0: - movq %mm0, (%edx) - movq %mm1, 8(%edx) - movq %mm2, 16(%edx) - addl $24, %edx - decl %ecx - jnz 0b - emms - addl $16, %esp + MOV_L (CONST(0xaaaaaaab), EAX) + MUL_L (CONTENT(_vl_current_bytes)) + MOV_L (EDX, ECX) + MOV_L (CONTENT(_vl_current_draw_buffer), EDX) + SHR_L (CONST(4), ECX) + ALIGNTEXT4 + TLBL(0): + MOVQ (MM0, REGIND(EDX)) + MOVQ (MM1, REGOFF(8,EDX)) + MOVQ (MM2, REGOFF(16,EDX)) + ADD_L (CONST(24), EDX) + DEC_L (ECX) + jnz TLBL(0) + EMMS + ADD_L (CONST(16), ESP) #endif - ret + RET /* Desc: void v_rect8 (int color); * @@ -242,51 +248,51 @@ _v_clear24_mmx: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_rect8 + ALIGNTEXT32 + GLOBL _v_rect8 _v_rect8: - cld - pushl %esi - pushl %edi - movl 28(%esp), %eax - movl _vl_current_width, %esi - movl 16(%esp), %edi - movb %al, %ah - movl 20(%esp), %ecx - imull %esi, %edi - movl 24(%esp), %edx - subl %ecx, %esi - addl 12(%esp), %edi - pushw %ax - pushw %ax - pushl %ds - popl %es - addl _vl_current_draw_buffer, %edi - popl %eax - pushl %ebx - movl %ecx, %ebx - andl $3, %ebx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - shrl $2, %ecx - rep; stosl - testl %ebx, %ebx - jz 2f - movl %ebx, %ecx - rep; stosb - .balign 4 - 2: - popl %ecx - addl %esi, %edi - decl %edx - jnz 0b - popl %ebx - popl %edi - popl %esi - ret + CLD + PUSH_L (ESI) + PUSH_L (EDI) + MOV_L (REGOFF(28, ESP), EAX) + MOV_L (CONTENT(_vl_current_width), ESI) + MOV_L (REGOFF(16, ESP), EDI) + MOV_B (AL, AH) + MOV_L (REGOFF(20, ESP), ECX) + IMUL_L (ESI, EDI) + MOV_L (REGOFF(24, ESP), EDX) + SUB_L (ECX, ESI) + ADD_L (REGOFF(12, ESP), EDI) + PUSH_W (AX) + PUSH_W (AX) + PUSH_SR (DS) + POP_SR (ES) + ADD_L (CONTENT(_vl_current_draw_buffer), EDI) + POP_L (EAX) + PUSH_L (EBX) + MOV_L (ECX, EBX) + AND_L (CONST(3), EBX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + SHR_L (CONST(2), ECX) + REP STOS_L + TEST_L (EBX, EBX) + jz TLBL(2) + MOV_L (EBX, ECX) + REP STOS_B + ALIGNTEXT4 + TLBL(2): + POP_L (ECX) + ADD_L (ESI, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EBX) + POP_L (EDI) + POP_L (ESI) + RET /* Desc: void v_rect16 (int color); * @@ -295,46 +301,46 @@ _v_rect8: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_rect16 + ALIGNTEXT32 + GLOBL _v_rect16 _v_rect16: - cld - pushl %esi - pushl %edi - movl 28(%esp), %eax - movl _vl_current_width, %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - imull %esi, %edi - movl 24(%esp), %edx - subl %ecx, %esi - addl 12(%esp), %edi - pushw %ax - shll %esi - pushw %ax - shll %edi - pushl %ds - popl %es - addl _vl_current_draw_buffer, %edi - popl %eax - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - shrl %ecx - rep; stosl - jnc 2f - stosw - .balign 4 - 2: - popl %ecx - addl %esi, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - ret + CLD + PUSH_L (ESI) + PUSH_L (EDI) + MOV_L (REGOFF(28, ESP), EAX) + MOV_L (CONTENT(_vl_current_width), ESI) + MOV_L (REGOFF(16, ESP), EDI) + MOV_L (REGOFF(20, ESP), ECX) + IMUL_L (ESI, EDI) + MOV_L (REGOFF(24, ESP), EDX) + SUB_L (ECX, ESI) + ADD_L (REGOFF(12, ESP), EDI) + PUSH_W (AX) + SHL_L (CONST(1), ESI) + PUSH_W (AX) + SHL_L (CONST(1), EDI) + PUSH_SR (DS) + POP_SR (ES) + ADD_L (CONTENT(_vl_current_draw_buffer), EDI) + POP_L (EAX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + SHR_L (CONST(1), ECX) + REP STOS_L + jnc TLBL(2) + STOS_W + ALIGNTEXT4 + TLBL(2): + POP_L (ECX) + ADD_L (ESI, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EDI) + POP_L (ESI) + RET /* Desc: void v_rect24 (int color); * @@ -343,43 +349,43 @@ _v_rect16: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_rect24 + ALIGNTEXT32 + GLOBL _v_rect24 _v_rect24: - pushl %esi - pushl %edi - movl 28(%esp), %eax - movl _vl_current_width, %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - imull %esi, %edi - movl 24(%esp), %edx - subl %ecx, %esi - addl 12(%esp), %edi - leal (%esi, %esi, 2), %esi - pushl %ebx - leal (%edi, %edi, 2), %edi - movl %eax, %ebx - addl _vl_current_draw_buffer, %edi - shrl $16, %ebx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - movw %ax, (%edi) - movb %bl, 2(%edi) - addl $3, %edi - decl %ecx - jnz 1b - popl %ecx - addl %esi, %edi - decl %edx - jnz 0b - popl %ebx - popl %edi - popl %esi - ret + PUSH_L (ESI) + PUSH_L (EDI) + MOV_L (REGOFF(28, ESP), EAX) + MOV_L (CONTENT(_vl_current_width), ESI) + MOV_L (REGOFF(16, ESP), EDI) + MOV_L (REGOFF(20, ESP), ECX) + IMUL_L (ESI, EDI) + MOV_L (REGOFF(24, ESP), EDX) + SUB_L (ECX, ESI) + ADD_L (REGOFF(12, ESP), EDI) + LEA_L (REGBIS(ESI, ESI, 2), ESI) + PUSH_L (EBX) + LEA_L (REGBIS(EDI, EDI, 2), EDI) + MOV_L (EAX, EBX) + ADD_L (CONTENT(_vl_current_draw_buffer), EDI) + SHR_L (CONST(16), EBX) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + MOV_W (AX, REGIND(EDI)) + MOV_B (BL, REGOFF(2,EDI)) + ADD_L (CONST(3), EDI) + DEC_L (ECX) + jnz TLBL(1) + POP_L (ECX) + ADD_L (ESI, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EBX) + POP_L (EDI) + POP_L (ESI) + RET /* Desc: void v_rect32 (int color); * @@ -388,38 +394,38 @@ _v_rect24: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_rect32 + ALIGNTEXT32 + GLOBL _v_rect32 _v_rect32: - pushl %esi - pushl %edi - movl _vl_current_width, %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - imull %esi, %edi - movl 24(%esp), %edx - subl %ecx, %esi - addl 12(%esp), %edi - shll $2, %esi - shll $2, %edi - movl 28(%esp), %eax - addl _vl_current_draw_buffer, %edi - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - movl %eax, (%edi) - addl $4, %edi - decl %ecx - jnz 1b - popl %ecx - addl %esi, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - ret + PUSH_L (ESI) + PUSH_L (EDI) + MOV_L (CONTENT(_vl_current_width), ESI) + MOV_L (REGOFF(16, ESP), EDI) + MOV_L (REGOFF(20, ESP), ECX) + IMUL_L (ESI, EDI) + MOV_L (REGOFF(24, ESP), EDX) + SUB_L (ECX, ESI) + ADD_L (REGOFF(12, ESP), EDI) + SHL_L (CONST(2), ESI) + SHL_L (CONST(2), EDI) + MOV_L (REGOFF(28, ESP), EAX) + ADD_L (CONTENT(_vl_current_draw_buffer), EDI) + ALIGNTEXT4 + TLBL(0): + PUSH_L (ECX) + ALIGNTEXT4 + TLBL(1): + MOV_L (EAX, REGIND(EDI)) + ADD_L (CONST(4), EDI) + DEC_L (ECX) + jnz TLBL(1) + POP_L (ECX) + ADD_L (ESI, EDI) + DEC_L (EDX) + jnz TLBL(0) + POP_L (EDI) + POP_L (ESI) + RET /* Desc: void v_putpixel8 (unsigned int offset, int color); * @@ -428,14 +434,14 @@ _v_rect32: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_putpixel8 + ALIGNTEXT32 + GLOBL _v_putpixel8 _v_putpixel8: - movl 8(%esp), %ecx - movl 4(%esp), %edx - movl _vl_current_draw_buffer, %eax - movb %cl, (%eax,%edx) - ret + MOV_L (REGOFF(8, ESP), ECX) + MOV_L (REGOFF(4, ESP), EDX) + MOV_L (CONTENT(_vl_current_draw_buffer), EAX) + MOV_B (CL, REGBI(EAX,EDX)) + RET /* Desc: void v_putpixel16 (unsigned int offset, int color); * @@ -444,14 +450,14 @@ _v_putpixel8: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_putpixel16 + ALIGNTEXT32 + GLOBL _v_putpixel16 _v_putpixel16: - movl 8(%esp), %ecx - movl 4(%esp), %edx - movl _vl_current_draw_buffer, %eax - movw %cx, (%eax,%edx,2) - ret + MOV_L (REGOFF(8, ESP), ECX) + MOV_L (REGOFF(4, ESP), EDX) + MOV_L (CONTENT(_vl_current_draw_buffer), EAX) + MOV_W (CX, REGBIS(EAX,EDX,2)) + RET /* Desc: void v_putpixel24 (unsigned int offset, int color); * @@ -460,17 +466,17 @@ _v_putpixel16: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_putpixel24 + ALIGNTEXT32 + GLOBL _v_putpixel24 _v_putpixel24: - movl 4(%esp), %eax - movl 8(%esp), %edx - movl _vl_current_draw_buffer, %ecx - leal (%eax,%eax,2), %eax - movw %dx, (%ecx,%eax) - shrl $16, %edx - movb %dl, 2(%ecx,%eax) - ret + MOV_L (REGOFF(4, ESP), EAX) + MOV_L (REGOFF(8, ESP), EDX) + MOV_L (CONTENT(_vl_current_draw_buffer), ECX) + LEA_L (REGBIS(EAX,EAX,2), EAX) + MOV_W (DX, REGBI(ECX,EAX)) + SHR_L (CONST(16), EDX) + MOV_B (DL, REGBID(ECX,EAX,2)) + RET /* Desc: void v_putpixel32 (unsigned int offset, int color); * @@ -479,11 +485,11 @@ _v_putpixel24: * * Note: uses current draw buffer */ - .p2align 5,,31 - .global _v_putpixel32 + ALIGNTEXT32 + GLOBL _v_putpixel32 _v_putpixel32: - movl 8(%esp), %ecx - movl 4(%esp), %edx - movl _vl_current_draw_buffer, %eax - movl %ecx, (%eax,%edx,4) - ret + MOV_L (REGOFF(8, ESP), ECX) + MOV_L (REGOFF(4, ESP), EDX) + MOV_L (CONTENT(_vl_current_draw_buffer), EAX) + MOV_L (ECX, REGBIS(EAX,EDX,4)) + RET diff --git a/src/mesa/drivers/dri/common/hwlog.c b/src/mesa/drivers/dri/common/hwlog.c deleted file mode 100644 index ff6e7d92119..00000000000 --- a/src/mesa/drivers/dri/common/hwlog.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * GLX Hardware Device Driver common code - * - * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Wittawat Yamwong <[email protected]> - */ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.c,v 1.3 2001/08/18 02:51:03 dawes Exp $ */ - -#include "hwlog.h" -hwlog_t hwlog = { 0,0,0, "[???] "}; - - -/* Should be shared, but is this a good place for it? - */ -#include <sys/time.h> -#include <stdarg.h> - - -int usec( void ) -{ - struct timeval tv; - struct timezone tz; - - gettimeofday( &tv, &tz ); - - return (tv.tv_sec & 2047) * 1000000 + tv.tv_usec; -} - - -#ifdef HW_LOG_ENABLED -int hwOpenLog(const char *filename, char *prefix) -{ - hwCloseLog(); - hwSetLogLevel(0); - hwlog.prefix=prefix; - if (!filename) - return -1; - if ((hwlog.file = fopen(filename,"w")) == NULL) - return -1; - return 0; -} - -void hwCloseLog() -{ - if (hwlog.file) { - fclose(hwlog.file); - hwlog.file = NULL; - } -} - -int hwIsLogReady() -{ - return (hwlog.file != NULL); -} - -void hwSetLogLevel(int level) -{ - hwlog.level = level; -} - -int hwGetLogLevel() -{ - return hwlog.level; -} - -void hwLog(int level, const char *format, ...) -{ - va_list ap; - va_start(ap,format); - hwLogv(level,format,ap); - va_end(ap); -} - -void hwLogv(int l, const char *format, va_list ap) -{ - if (hwlog.file && (l <= hwlog.level)) { - vfprintf(hwlog.file,format,ap); - fflush(hwlog.file); - } -} - -void hwMsg(int l, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - - if (l <= hwlog.level) { - if (hwIsLogReady()) { - int t = usec(); - - hwLog(l, "%6i:", t - hwlog.timeTemp); - hwlog.timeTemp = t; - hwLogv(l, format, ap); - } else { - fprintf(stderr, hwlog.prefix); - vfprintf(stderr, format, ap); - } - } - - va_end(ap); -} - -#else /* ifdef HW_LOG_ENABLED */ - -int hwlogdummy() -{ - return 0; -} - -#endif - -void hwError(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - - fprintf(stderr, hwlog.prefix); - vfprintf(stderr, format, ap); - hwLogv(0, format, ap); - - va_end(ap); -} diff --git a/src/mesa/drivers/dri/common/hwlog.h b/src/mesa/drivers/dri/common/hwlog.h deleted file mode 100644 index 6c5a185552b..00000000000 --- a/src/mesa/drivers/dri/common/hwlog.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * GLX Hardware Device Driver common code - * - * Based on the original MGA G200 driver (c) 1999 Wittawat Yamwong - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - * Wittawat Yamwong <[email protected]> - */ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.h,v 1.5 2001/10/31 23:22:57 tsi Exp $ */ - -/* Usage: - * - use mgaError for error messages. Always write to X error and log file. - * - use mgaMsg for debugging. Can be disabled by undefining MGA_LOG_ENABLED. - */ - -#ifndef HWLOG_INC -#define HWLOG_INC - - -#include <stdarg.h> -#include <stdio.h> - -#define DBG_LEVEL_BASE 1 -#define DBG_LEVEL_VERBOSE 10 -#define DBG_LEVEL_ENTEREXIT 20 - -typedef struct -{ - FILE *file; - int level; - unsigned int timeTemp; - char *prefix; -} hwlog_t; - -extern hwlog_t hwlog; - - -#ifdef HW_LOG_ENABLED - -/* open and close log file. */ -int hwOpenLog(const char *filename, char *prefix); -void hwCloseLog(void); - -/* return 1 if log file is succesfully opened */ -int hwIsLogReady(void); - -/* set current log level to 'level'. Messages with level less than or equal - the current log level will be written to the log file. */ -void hwSetLogLevel(int level); -int hwGetLogLevel(void); - -/* hwLog and hwLogv write a message to the log file. */ -/* do not call these directly, use hwMsg() instead */ -void hwLog(int level, const char *format, ...); -void hwLogv(int level, const char *format, va_list ap); - -int usec( void ); - -/* hwMsg writes a message to the log file or to the standard X error file. */ -void hwMsg(int level, const char *format, ...); - - -#else - - -static __inline__ int hwOpenLog(const char *f, char *prefix) { hwlog.prefix=prefix; return -1; } -#define hwIsLogReady() (0) -#define hwGetLogLevel() (-1) -#define hwLogLevel(n) (0) -#define hwLog() -#define hwMsg() - -#define hwCloseLog() -#define hwSetLogLevel(x) -#define hwLogv(l,f,a) - - -#endif - -void hwError(const char *format, ...); - - -#endif diff --git a/src/mesa/drivers/dri/common/mm.c b/src/mesa/drivers/dri/common/mm.c index b3be95471d5..6572ccd9914 100644 --- a/src/mesa/drivers/dri/common/mm.c +++ b/src/mesa/drivers/dri/common/mm.c @@ -27,14 +27,13 @@ #include <stdio.h> #include "mm.h" -#include "hwlog.h" void mmDumpMemInfo( memHeap_t *heap ) { TMemBlock *p; - fprintf(stderr, "Memory heap %p:\n", heap); + fprintf(stderr, "Memory heap %p:\n", (void *)heap); if (heap == 0) { fprintf(stderr, " heap == 0\n"); } else { diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index a8878b694d6..4ed05219db9 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1,6 +1,6 @@ /* * Copyright 2000-2001 VA Linux Systems, Inc. - * (c) Copyright IBM Corporation 2002 + * (C) Copyright IBM Corporation 2002, 2003 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -46,6 +46,7 @@ #include "texmem.h" #include "simple_list.h" #include "imports.h" +#include "macros.h" #include <assert.h> @@ -156,22 +157,22 @@ static void printLocalLRU( driTexHeap * heap, const char *callername ) continue; if (!t->tObj) { fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n", - t, + (void *)t, t->memBlock->ofs / sz, t->memBlock->ofs, t->memBlock->size ); } else { fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n", - t, + (void *)t, t->memBlock->ofs, t->memBlock->size ); } } foreach ( t, heap->swapped_objects ) { if (!t->tObj) { - fprintf( stderr, "Swapped Placeholder (%p)\n", t ); + fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t ); } else { - fprintf( stderr, "Swapped Texture (%p)\n", t ); + fprintf( stderr, "Swapped Texture (%p)\n", (void *)t ); } } @@ -190,7 +191,7 @@ static void printGlobalLRU( driTexHeap * heap, const char *callername ) int i, j; fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n", - __FUNCTION__, callername, heap->heapId, list ); + __FUNCTION__, callername, heap->heapId, (void *)list ); for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) { fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n", @@ -323,9 +324,9 @@ void driDestroyTextureObject( driTextureObject * t ) if ( 0 ) { fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n", __FILE__, __LINE__, - t, - (t != NULL) ? t->tObj : NULL, - (t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL ); + (void *)t, + (void *)((t != NULL) ? t->tObj : NULL), + (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL )); } if ( t != NULL ) { @@ -355,7 +356,7 @@ void driDestroyTextureObject( driTextureObject * t ) } if ( 0 ) { - fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, t ); + fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t ); } } @@ -645,7 +646,7 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size, if ( 0 ) fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n", __FUNCTION__, - heap_id, context, size, alignmentShift, nr_regions ); + heap_id, (void *)context, size, alignmentShift, nr_regions ); heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) ); if ( heap != NULL ) { @@ -688,7 +689,7 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size, if ( 0 ) - fprintf( stderr, "%s returning %p\n", __FUNCTION__, heap ); + fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap ); return heap; } @@ -894,7 +895,7 @@ get_max_size( unsigned nr_heaps, /** * Given the amount of texture memory, the number of texture units, and the * maximum size of a texel, calculate the maximum texture size the driver can - * adverteise. + * advertise. * * \param heaps Texture heaps for this card * \param nr_heap Number of texture heaps @@ -1097,7 +1098,7 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps, if ( !check_in_heap( t, heap ) ) { fprintf( stderr, "%s memory block for texture object @ %p not " "found in heap #%d\n", - __FUNCTION__, t, i ); + __FUNCTION__, (void *)t, i ); return GL_FALSE; } @@ -1105,7 +1106,7 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps, if ( t->totalSize > t->memBlock->size ) { fprintf( stderr, "%s: Memory block for texture object @ %p is " "only %u bytes, but %u are required\n", - __FUNCTION__, t, t->totalSize, t->memBlock->size ); + __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size ); return GL_FALSE; } @@ -1159,15 +1160,76 @@ driValidateTextureHeaps( driTexHeap * const * texture_heaps, foreach ( t, swapped ) { if ( t->memBlock != NULL ) { fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n", - __FUNCTION__, t, t->memBlock ); + __FUNCTION__, (void *)t, (void *)t->memBlock ); return GL_FALSE; } i++; } #if 0 - fprintf( stderr, "%s: swapped texture count = %u\n", i ); + fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i ); #endif return GL_TRUE; } + + + + +/****************************************************************************/ +/** + * Compute which mipmap levels that really need to be sent to the hardware. + * This depends on the base image size, GL_TEXTURE_MIN_LOD, + * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. + */ + +void +driCalculateTextureFirstLastLevel( driTextureObject * t ) +{ + struct gl_texture_object * const tObj = t->tObj; + const struct gl_texture_image * const baseImage = + tObj->Image[tObj->BaseLevel]; + + /* These must be signed values. MinLod and MaxLod can be negative numbers, + * and having firstLevel and lastLevel as signed prevents the need for + * extra sign checks. + */ + int firstLevel; + int lastLevel; + + /* Yes, this looks overly complicated, but it's all needed. + */ + + switch (tObj->Target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP: + if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. + */ + + firstLevel = lastLevel = tObj->BaseLevel; + } + else { + firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); + firstLevel = MAX2(firstLevel, tObj->BaseLevel); + lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + lastLevel = MAX2(lastLevel, t->tObj->BaseLevel); + lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = MIN2(lastLevel, t->tObj->MaxLevel); + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + } + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_4D_SGIS: + firstLevel = lastLevel = 0; + break; + default: + return; + } + + /* save these values */ + t->firstLevel = firstLevel; + t->lastLevel = lastLevel; +} diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 7199704612a..9afbb0c865b 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -290,4 +290,6 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, unsigned nr_heaps, const driTextureObject * swapped ); +extern void driCalculateTextureFirstLastLevel( driTextureObject * t ); + #endif /* DRI_TEXMEM_H */ diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index e91dd65260c..d20f743bc9a 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -33,6 +33,7 @@ #include "macros.h" #include "dd.h" #include "vblank.h" +#include "xmlpool.h" /****************************************************************************/ @@ -127,7 +128,7 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { /* FIXME: This doesn't seem like the right thing to return here. */ -#ifndef _SOLO +#ifndef _SOLO return GLX_BAD_CONTEXT; #else return -1; @@ -163,9 +164,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, /* FIXME: This doesn't seem like the right thing to return here. */ #ifndef _SOLO - return GLX_BAD_CONTEXT; + return GLX_BAD_CONTEXT; #else - return -1; + return -1; #endif } } @@ -183,20 +184,35 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, /****************************************************************************/ /** * Gets a set of default vertical-blank-wait flags based on the internal GLX - * API version and several environment variables. + * API version and several configuration options. */ -GLuint driGetDefaultVBlankFlags( void ) +GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) { GLuint flags = 0; - + int vblank_mode; flags |= (driCompareGLXAPIVersion( 20030317 ) >= 0) ? VBLANK_FLAG_INTERVAL : 0; - flags |= (getenv("LIBGL_SYNC_REFRESH") != NULL) - ? VBLANK_FLAG_SYNC : 0; - flags |= (getenv("LIBGL_THROTTLE_REFRESH") != NULL) - ? VBLANK_FLAG_THROTTLE : 0; + + if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) ) + vblank_mode = driQueryOptioni( optionCache, "vblank_mode" ); + else + vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; + + switch (vblank_mode) { + case DRI_CONF_VBLANK_NEVER: + flags = 0; + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_0: + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_1: + flags |= VBLANK_FLAG_THROTTLE; + break; + case DRI_CONF_VBLANK_ALWAYS_SYNC: + flags |= VBLANK_FLAG_SYNC; + break; + } return flags; } @@ -204,6 +220,22 @@ GLuint driGetDefaultVBlankFlags( void ) /****************************************************************************/ /** + * Sets the default swap interval when the drawable is first bound to a + * direct rendering context. + */ + +void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags ) +{ +#ifndef _SOLO + if ( priv->pdraw->swap_interval == (unsigned)-1 ) { + priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0; + } +#endif +} + + +/****************************************************************************/ +/** * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to * wrap the error message logging. The error message should only be logged * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is @@ -265,7 +297,10 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, *missed_deadline = GL_FALSE; - if ( (flags & VBLANK_FLAG_NO_IRQ) != 0 ) { + if ( (flags & (VBLANK_FLAG_INTERVAL | + VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) == 0 || + (flags & VBLANK_FLAG_NO_IRQ) != 0 ) { return 0; } @@ -293,11 +328,14 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, vbl.request.type = DRM_VBLANK_ABSOLUTE; if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) { -#ifndef _SOLO +#ifndef _SOLO interval = priv->pdraw->swap_interval; #else interval = 0; -#endif +#endif + /* this must have been initialized when the drawable was first bound + * to a direct rendering context. */ + assert ( interval != (unsigned)-1 ); } else if ( (flags & VBLANK_FLAG_THROTTLE) != 0 ) { interval = 1; diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index 3dab4ead3c2..d460d7a84ad 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -32,6 +32,7 @@ #include "context.h" #include "dri_util.h" +#include "xmlconfig.h" #define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting */ @@ -45,7 +46,8 @@ extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); extern int driWaitForMSC32( __DRIdrawablePrivate *priv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); -extern GLuint driGetDefaultVBlankFlags( void ); +extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); +extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags ); extern int driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline ); diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c new file mode 100644 index 00000000000..a6d4c8ab941 --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -0,0 +1,862 @@ +/* + * XML DRI client-side driver configuration + * Copyright (C) 2003 Felix Kuehling + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +/** + * \file xmlconfig.c + * \brief Driver-independent client-side part of the XML configuration + * \author Felix Kuehling + */ + +#include "glheader.h" + +#include <string.h> +#include <assert.h> +#include <expat.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include "imports.h" +#include "dri_util.h" +#include "xmlconfig.h" + +/* + * OS dependent ways of getting the name of the running program + */ +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include <sys/param.h> +#endif + +#undef GET_PROGRAM_NAME + +#if defined(__GNU_LIBRARY__) || defined(__GLIBC__) +# define GET_PROGRAM_NAME() program_invocation_short_name +#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2) +# include <osreldate.h> +# if (__FreeBSD_version >= 440000) +# include <stdlib.h> +# define GET_PROGRAM_NAME() getprogname() +# endif +#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) +# include <stdlib.h> +# define GET_PROGRAM_NAME() getprogname() +#endif + +#if !defined(GET_PROGRAM_NAME) +# if defined(OpenBSD) || defined(NetBSD) +/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. It's + * used as a last resort, if there is no documented facility available. */ +static const char *__getProgramName () { + extern const char *__progname; + return progname; +} +# define GET_PROGRAM_NAME() __getProgramName() +# else +# define GET_PROGRAM_NAME() "" +# warning "Per application configuration won't with your OS version work." +# endif +#endif + +/** \brief Find an option in an option cache with the name as key */ +static GLuint findOption (const driOptionCache *cache, const char *name) { + GLuint len = strlen (name); + GLuint size = 1 << cache->tableSize, mask = size - 1; + GLuint hash = 0; + GLuint i, shift; + + /* compute a hash from the variable length name */ + for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31) + hash += (GLuint)name[i] << shift; + hash *= hash; + hash = (hash >> (16-cache->tableSize/2)) & mask; + + /* this is just the starting point of the linear search for the option */ + for (i = 0; i < size; ++i, hash = (hash+1) & mask) { + /* if we hit an empty entry then the option is not defined (yet) */ + if (cache->info[hash].name == 0) + break; + else if (!strcmp (name, cache->info[hash].name)) + break; + } + /* this assertion fails if the hash table is full */ + assert (i < size); + + return hash; +} + +/** \brief Count the real number of options in an option cache */ +static GLuint countOptions (const driOptionCache *cache) { + GLuint size = 1 << cache->tableSize; + GLuint i, count = 0; + for (i = 0; i < size; ++i) + if (cache->info[i].name) + count++; + return count; +} + +/** \brief Like strdup but using MALLOC and with error checking. */ +#define XSTRDUP(dest,source) do { \ + GLuint len = strlen (source); \ + if (!(dest = MALLOC (len+1))) { \ + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \ + abort(); \ + } \ + memcpy (dest, source, len+1); \ +} while (0) + +static int compare (const void *a, const void *b) { + return strcmp (*(char *const*)a, *(char *const*)b); +} +/** \brief Binary search in a string array. */ +static GLuint bsearchStr (const XML_Char *name, + const XML_Char *elems[], GLuint count) { + const XML_Char **found; + found = bsearch (&name, elems, count, sizeof (XML_Char *), compare); + if (found) + return found - elems; + else + return count; +} + +/** \brief Parse a value of a given type. */ +static GLboolean parseValue (driOptionValue *v, driOptionType type, + const XML_Char *string) { + const XML_Char *tail; + /* skip leading white-space */ + string += strspn (string, " \f\n\r\t\v"); + switch (type) { + case DRI_BOOL: + if (!strcmp (string, "false")) { + v->_bool = GL_FALSE; + tail = string + 5; + } else if (!strcmp (string, "true")) { + v->_bool = GL_TRUE; + tail = string + 4; + } + else + return GL_FALSE; + break; + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + v->_int = strtol (string, (char **)&tail, 0); + break; + case DRI_FLOAT: + v->_float = strtod (string, (char **)&tail); + break; + } + + if (tail == string) + return GL_FALSE; /* empty string (or containing only white-space) */ + /* skip trailing white space */ + if (*tail) + tail += strspn (tail, " \f\n\r\t\v"); + if (*tail) + return GL_FALSE; /* something left over that is not part of value */ + + return GL_TRUE; +} + +/** \brief Parse a list of ranges of type info->type. */ +static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) { + XML_Char *cp, *range; + GLuint nRanges, i; + driOptionRange *ranges; + + XSTRDUP (cp, string); + /* pass 1: determine the number of ranges (number of commas + 1) */ + range = cp; + for (nRanges = 1; *range; ++range) + if (*range == ',') + ++nRanges; + + if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) { + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); + abort(); + } + + /* pass 2: parse all ranges into preallocated array */ + range = cp; + for (i = 0; i < nRanges; ++i) { + XML_Char *end, *sep; + assert (range); + end = strchr (range, ','); + if (end) + *end = '\0'; + sep = strchr (range, ':'); + if (sep) { /* non-empty interval */ + *sep = '\0'; + if (!parseValue (&ranges[i].start, info->type, range) || + !parseValue (&ranges[i].end, info->type, sep+1)) + break; + if (info->type == DRI_INT && + ranges[i].start._int > ranges[i].end._int) + break; + if (info->type == DRI_FLOAT && + ranges[i].start._float > ranges[i].end._float) + break; + } else { /* empty interval */ + if (!parseValue (&ranges[i].start, info->type, range)) + break; + ranges[i].end = ranges[i].start; + } + if (end) + range = end+1; + else + range = NULL; + } + FREE (cp); + if (i < nRanges) { + FREE (ranges); + return GL_FALSE; + } else + assert (range == NULL); + + info->nRanges = nRanges; + info->ranges = ranges; + return GL_TRUE; +} + +/** \brief Check if a value is in one of info->ranges. */ +static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) { + GLuint i; + assert (info->type != DRI_BOOL); /* should be caught by the parser */ + if (info->nRanges == 0) + return GL_TRUE; + switch (info->type) { + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + for (i = 0; i < info->nRanges; ++i) + if (v->_int >= info->ranges[i].start._int && + v->_int <= info->ranges[i].end._int) + return GL_TRUE; + break; + case DRI_FLOAT: + for (i = 0; i < info->nRanges; ++i) + if (v->_float >= info->ranges[i].start._float && + v->_float <= info->ranges[i].end._float) + return GL_TRUE; + break; + default: + assert (0); /* should never happen */ + } + return GL_FALSE; +} + +/** \brief Output a warning message. */ +#define XML_WARNING1(msg) do {\ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_WARNING(msg,args...) do { \ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output an error message. */ +#define XML_ERROR1(msg) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_ERROR(msg,args...) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output a fatal error message and abort. */ +#define XML_FATAL1(msg) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser)); \ + abort();\ +} while (0) +#define XML_FATAL(msg,args...) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + XML_GetCurrentLineNumber(data->parser), \ + XML_GetCurrentColumnNumber(data->parser), \ + args); \ + abort();\ +} while (0) + +/** \brief Parser context for __driConfigOptions. */ +struct OptInfoData { + const char *name; + XML_Parser parser; + driOptionCache *cache; + GLboolean inDriInfo; + GLboolean inSection; + GLboolean inDesc; + GLboolean inOption; + GLboolean inEnum; + int curOption; +}; + +/** \brief Elements in __driConfigOptions. */ +enum OptInfoElem { + OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT +}; +static const XML_Char *OptInfoElems[] = { + "description", "driinfo", "enum", "option", "section" +}; + +/** \brief Parse attributes of an enum element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *value = NULL, *text = NULL; + driOptionValue v; + GLuint opt = data->curOption; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "value")) value = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal enum attribute: %s.", attr[i]); + } + if (!value) XML_FATAL1 ("value attribute missing in enum."); + if (!text) XML_FATAL1 ("text attribute missing in enum."); + if (!parseValue (&v, data->cache->info[opt].type, value)) + XML_FATAL ("illegal enum value: %s.", value); + if (!checkValue (&v, &data->cache->info[opt])) + XML_FATAL ("enum value out of valid range: %s.", value); +} + +/** \brief Parse attributes of a description element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *lang = NULL, *text = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "lang")) lang = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal description attribute: %s.", attr[i]); + } + if (!lang) XML_FATAL1 ("lang attribute missing in description."); + if (!text) XML_FATAL1 ("text attribute missing in description."); +} + +/** \brief Parse attributes of an option element. */ +static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) { + enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT}; + static const XML_Char *optAttr[] = {"default", "name", "type", "valid"}; + const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL}; + const char *defaultVal; + driOptionCache *cache = data->cache; + GLuint opt, i; + for (i = 0; attr[i]; i += 2) { + GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT); + if (attrName >= OA_COUNT) + XML_FATAL ("illegal option attribute: %s", attr[i]); + attrVal[attrName] = attr[i+1]; + } + if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option."); + if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option."); + if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option."); + + opt = findOption (cache, attrVal[OA_NAME]); + if (cache->info[opt].name) + XML_FATAL ("option %s redefined.", attrVal[OA_NAME]); + data->curOption = opt; + + XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]); + + if (!strcmp (attrVal[OA_TYPE], "bool")) + cache->info[opt].type = DRI_BOOL; + else if (!strcmp (attrVal[OA_TYPE], "enum")) + cache->info[opt].type = DRI_ENUM; + else if (!strcmp (attrVal[OA_TYPE], "int")) + cache->info[opt].type = DRI_INT; + else if (!strcmp (attrVal[OA_TYPE], "float")) + cache->info[opt].type = DRI_FLOAT; + else + XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]); + + defaultVal = getenv (cache->info[opt].name); + if (defaultVal != NULL) { + /* don't use XML_WARNING, we want the user to see this! */ + fprintf (stderr, + "ATTENTION: default value of option %s overridden by environment.\n", + cache->info[opt].name); + } else + defaultVal = attrVal[OA_DEFAULT]; + if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal)) + XML_FATAL ("illegal default value: %s.", defaultVal); + + if (attrVal[OA_VALID]) { + if (cache->info[opt].type == DRI_BOOL) + XML_FATAL1 ("boolean option with valid attribute."); + if (!parseRanges (&cache->info[opt], attrVal[OA_VALID])) + XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]); + if (!checkValue (&cache->values[opt], &cache->info[opt])) + XML_FATAL ("default value out of valid range '%s': %s.", + attrVal[OA_VALID], defaultVal); + } else if (cache->info[opt].type == DRI_ENUM) { + XML_FATAL1 ("valid attribute missing in option (mandatory for enums)."); + } else { + cache->info[opt].nRanges = 0; + cache->info[opt].ranges = NULL; + } +} + +/** \brief Handler for start element events. */ +static void optInfoStartElem (void *userData, const XML_Char *name, + const XML_Char **attr) { + struct OptInfoData *data = (struct OptInfoData *)userData; + enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT); + switch (elem) { + case OI_DRIINFO: + if (data->inDriInfo) + XML_FATAL1 ("nested <driinfo> elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on <driinfo> element."); + data->inDriInfo = GL_TRUE; + break; + case OI_SECTION: + if (!data->inDriInfo) + XML_FATAL1 ("<section> must be inside <driinfo>."); + if (data->inSection) + XML_FATAL1 ("nested <section> elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on <section> element."); + data->inSection = GL_TRUE; + break; + case OI_DESCRIPTION: + if (!data->inSection && !data->inOption) + XML_FATAL1 ("<description> must be inside <description> or <option."); + if (data->inDesc) + XML_FATAL1 ("nested <description> elements."); + data->inDesc = GL_TRUE; + parseDescAttr (data, attr); + break; + case OI_OPTION: + if (!data->inSection) + XML_FATAL1 ("<option> must be inside <section>."); + if (data->inDesc) + XML_FATAL1 ("<option> nested in <description> element."); + if (data->inOption) + XML_FATAL1 ("nested <option> elements."); + data->inOption = GL_TRUE; + parseOptInfoAttr (data, attr); + break; + case OI_ENUM: + if (!(data->inOption && data->inDesc)) + XML_FATAL1 ("<enum> must be inside <option> and <description>."); + if (data->inEnum) + XML_FATAL1 ("nested <enum> elements."); + data->inEnum = GL_TRUE; + parseEnumAttr (data, attr); + break; + default: + XML_FATAL ("unknown element: %s.", name); + } +} + +/** \brief Handler for end element events. */ +static void optInfoEndElem (void *userData, const XML_Char *name) { + struct OptInfoData *data = (struct OptInfoData *)userData; + enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT); + switch (elem) { + case OI_DRIINFO: + data->inDriInfo = GL_FALSE; + break; + case OI_SECTION: + data->inSection = GL_FALSE; + break; + case OI_DESCRIPTION: + data->inDesc = GL_FALSE; + break; + case OI_OPTION: + data->inOption = GL_FALSE; + break; + case OI_ENUM: + data->inEnum = GL_FALSE; + break; + default: + assert (0); /* should have been caught by StartElem */ + } +} + +void driParseOptionInfo (driOptionCache *info) { + XML_Parser p; + int status; + struct OptInfoData userData; + struct OptInfoData *data = &userData; + GLuint nOptions; + + /* determine hash table size and allocate memory */ + GLuint size, log2size; + for (size = 1, log2size = 0; size < __driNConfigOptions*3/2; + size <<= 1, ++log2size); + info->tableSize = log2size; + info->info = CALLOC (size * sizeof (driOptionInfo)); + info->values = CALLOC (size * sizeof (driOptionInfo)); + if (info->info == NULL || info->values == NULL) { + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); + abort(); + } + + p = XML_ParserCreate ("UTF-8"); /* always UTF-8 */ + XML_SetElementHandler (p, optInfoStartElem, optInfoEndElem); + XML_SetUserData (p, data); + + userData.name = "__driConfigOptions"; + userData.parser = p; + userData.cache = info; + userData.inDriInfo = GL_FALSE; + userData.inSection = GL_FALSE; + userData.inDesc = GL_FALSE; + userData.inOption = GL_FALSE; + userData.inEnum = GL_FALSE; + userData.curOption = -1; + + status = XML_Parse (p, __driConfigOptions, strlen (__driConfigOptions), 1); + if (!status) + XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p))); + + XML_ParserFree (p); + + /* Check if the actual number of options matches __driNConfigOptions. + * A mismatch is not fatal (a hash table overflow would be) but we + * want the driver developer's attention anyway. */ + nOptions = countOptions (info); + if (nOptions != __driNConfigOptions) { + fprintf (stderr, + "Error: __driNConfigOptions (%u) does not match the actual number of options in\n" + " __driConfigOptions (%u).\n", + __driNConfigOptions, nOptions); + } +} + +/** \brief Parser context for configuration files. */ +struct OptConfData { + const char *name; + XML_Parser parser; + driOptionCache *cache; + GLint screenNum; + const char *driverName, *execName; + GLuint ignoringDevice; + GLuint ignoringApp; + GLuint inDriConf; + GLuint inDevice; + GLuint inApp; + GLuint inOption; +}; + +/** \brief Elements in configuration files. */ +enum OptConfElem { + OC_APPLICATION = 0, OC_DEVICE, OC_DRICONF, OC_OPTION, OC_COUNT +}; +static const XML_Char *OptConfElems[] = { + "application", "device", "driconf", "option" +}; + +/** \brief Parse attributes of a device element. */ +static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *driver = NULL, *screen = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "driver")) driver = attr[i+1]; + else if (!strcmp (attr[i], "screen")) screen = attr[i+1]; + else XML_WARNING("unkown device attribute: %s.", attr[i]); + } + if (driver && strcmp (driver, data->driverName)) + data->ignoringDevice = data->inDevice; + else if (screen) { + driOptionValue screenNum; + if (!parseValue (&screenNum, DRI_INT, screen)) + XML_WARNING("illegal screen number: %s.", screen); + else if (screenNum._int != data->screenNum) + data->ignoringDevice = data->inDevice; + } +} + +/** \brief Parse attributes of an application element. */ +static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *name = NULL, *exec = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "name")) name = attr[i+1]; + else if (!strcmp (attr[i], "executable")) exec = attr[i+1]; + else XML_WARNING("unkown application attribute: %s.", attr[i]); + } + if (exec && strcmp (exec, data->execName)) + data->ignoringApp = data->inApp; +} + +/** \brief Parse attributes of an option element. */ +static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *name = NULL, *value = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "name")) name = attr[i+1]; + else if (!strcmp (attr[i], "value")) value = attr[i+1]; + else XML_WARNING("unkown option attribute: %s.", attr[i]); + } + if (!name) XML_WARNING1 ("name attribute missing in option."); + if (!value) XML_WARNING1 ("value attribute missing in option."); + if (name && value) { + driOptionCache *cache = data->cache; + GLuint opt = findOption (cache, name); + if (cache->info[opt].name == NULL) + XML_WARNING ("undefined option: %s.", name); + else if (getenv (cache->info[opt].name)) + /* don't use XML_WARNING, we want the user to see this! */ + fprintf (stderr, "ATTENTION: option value of option %s ignored.\n", + cache->info[opt].name); + else if (!parseValue (&cache->values[opt], cache->info[opt].type, value)) + XML_WARNING ("illegal option value: %s.", value); + } +} + +/** \brief Handler for start element events. */ +static void optConfStartElem (void *userData, const XML_Char *name, + const XML_Char **attr) { + struct OptConfData *data = (struct OptConfData *)userData; + enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT); + switch (elem) { + case OC_DRICONF: + if (data->inDriConf) + XML_WARNING1 ("nested <driconf> elements."); + if (attr[0]) + XML_WARNING1 ("attributes specified on <driconf> element."); + data->inDriConf++; + break; + case OC_DEVICE: + if (!data->inDriConf) + XML_WARNING1 ("<device> should be inside <driconf>."); + if (data->inDevice) + XML_WARNING1 ("nested <device> elements."); + data->inDevice++; + if (!data->ignoringDevice && !data->ignoringApp) + parseDeviceAttr (data, attr); + break; + case OC_APPLICATION: + if (!data->inDevice) + XML_WARNING1 ("<application> should be inside <device>."); + if (data->inApp) + XML_WARNING1 ("nested <application> elements."); + data->inApp++; + if (!data->ignoringDevice && !data->ignoringApp) + parseAppAttr (data, attr); + break; + case OC_OPTION: + if (!data->inApp) + XML_WARNING1 ("<option> should be inside <application>."); + if (data->inOption) + XML_WARNING1 ("nested <option> elements."); + data->inOption++; + if (!data->ignoringDevice && !data->ignoringApp) + parseOptConfAttr (data, attr); + break; + default: + XML_WARNING ("unknown element: %s.", name); + } +} + +/** \brief Handler for end element events. */ +static void optConfEndElem (void *userData, const XML_Char *name) { + struct OptConfData *data = (struct OptConfData *)userData; + enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT); + switch (elem) { + case OC_DRICONF: + data->inDriConf--; + break; + case OC_DEVICE: + if (data->inDevice-- == data->ignoringDevice) + data->ignoringDevice = 0; + break; + case OC_APPLICATION: + if (data->inApp-- == data->ignoringApp) + data->ignoringApp = 0; + break; + case OC_OPTION: + data->inOption--; + break; + default: + /* unknown element, warning was produced on start tag */; + } +} + +/** \brief Initialize an option cache based on info */ +static void initOptionCache (driOptionCache *cache, driOptionCache *info) { + cache->info = info->info; + cache->tableSize = info->tableSize; + cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue)); + if (cache->values == NULL) { + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); + abort(); + } + memcpy (cache->values, info->values, + (1<<info->tableSize) * sizeof (driOptionValue)); +} + +/** \brief Parse the named configuration file */ +static void parseOneConfigFile (XML_Parser p) { +#define BUF_SIZE 0x1000 + struct OptConfData *data = (struct OptConfData *)XML_GetUserData (p); + int status; + int fd; + + if ((fd = open (data->name, O_RDONLY)) == -1) { + __driUtilMessage ("Can't open configuration file %s: %s.", + data->name, strerror (errno)); + return; + } + + while (1) { + int bytesRead; + void *buffer = XML_GetBuffer (p, BUF_SIZE); + if (!buffer) { + __driUtilMessage ("Can't allocate parser buffer."); + break; + } + bytesRead = read (fd, buffer, BUF_SIZE); + if (bytesRead == -1) { + __driUtilMessage ("Error reading from configuration file %s: %s.", + data->name, strerror (errno)); + break; + } + status = XML_ParseBuffer (p, bytesRead, bytesRead == 0); + if (!status) { + XML_ERROR ("%s.", XML_ErrorString(XML_GetErrorCode(p))); + break; + } + if (bytesRead == 0) + break; + } + + close (fd); +#undef BUF_SIZE +} + +void driParseConfigFiles (driOptionCache *cache, driOptionCache *info, + GLint screenNum, const char *driverName) { + char *filenames[2] = {"/etc/drirc", NULL}; + char *home; + GLuint i; + struct OptConfData userData; + + initOptionCache (cache, info); + + userData.cache = cache; + userData.screenNum = screenNum; + userData.driverName = driverName; +#ifndef _SOLO + userData.execName = GET_PROGRAM_NAME(); +#else + userData.execName = "Solo"; +#endif + + if ((home = getenv ("HOME"))) { + GLuint len = strlen (home); + filenames[1] = MALLOC (len + 7+1); + if (filenames[1] == NULL) + __driUtilMessage ("Can't allocate memory for %s/.drirc.", home); + else { + memcpy (filenames[1], home, len); + memcpy (filenames[1] + len, "/.drirc", 7+1); + } + } + + for (i = 0; i < 2; ++i) { + XML_Parser p; + if (filenames[i] == NULL) + continue; + + p = XML_ParserCreate (NULL); /* use encoding specified by file */ + XML_SetElementHandler (p, optConfStartElem, optConfEndElem); + XML_SetUserData (p, &userData); + userData.parser = p; + userData.name = filenames[i]; + userData.ignoringDevice = 0; + userData.ignoringApp = 0; + userData.inDriConf = 0; + userData.inDevice = 0; + userData.inApp = 0; + userData.inOption = 0; + + parseOneConfigFile (p); + XML_ParserFree (p); + } + + if (filenames[1]) + FREE (filenames[1]); +} + +void driDestroyOptionInfo (driOptionCache *info) { + driDestroyOptionCache (info); + if (info->info) { + GLuint i, size = 1 << info->tableSize; + for (i = 0; i < size; ++i) { + if (info->info[i].name) { + FREE (info->info[i].name); + if (info->info[i].ranges) + FREE (info->info[i].ranges); + } + } + FREE (info->info); + } +} + +void driDestroyOptionCache (driOptionCache *cache) { + if (cache->values) + FREE (cache->values); +} + +GLboolean driCheckOption (const driOptionCache *cache, const char *name, + driOptionType type) { + GLuint i = findOption (cache, name); + return cache->info[i].name != NULL && cache->info[i].type == type; +} + +GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) { + GLuint i = findOption (cache, name); + /* make sure the option is defined and has the correct type */ + assert (cache->info[i].name != NULL); + assert (cache->info[i].type == DRI_BOOL); + return cache->values[i]._bool; +} + +GLint driQueryOptioni (const driOptionCache *cache, const char *name) { + GLuint i = findOption (cache, name); + /* make sure the option is defined and has the correct type */ + assert (cache->info[i].name != NULL); + assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM); + return cache->values[i]._int; +} + +GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) { + GLuint i = findOption (cache, name); + /* make sure the option is defined and has the correct type */ + assert (cache->info[i].name != NULL); + assert (cache->info[i].type == DRI_FLOAT); + return cache->values[i]._float; +} diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h new file mode 100644 index 00000000000..710e328e015 --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -0,0 +1,125 @@ +/* + * XML DRI client-side driver configuration + * Copyright (C) 2003 Felix Kuehling + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +/** + * \file xmlconfig.h + * \brief Driver-independent client-side part of the XML configuration + * \author Felix Kuehling + */ + +#ifndef __XMLCONFIG_H +#define __XMLCONFIG_H + +/** \brief Option data types */ +typedef enum driOptionType { + DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT +} driOptionType; + +/** \brief Option value */ +typedef union driOptionValue { + GLboolean _bool; /**< \brief Boolean */ + GLint _int; /**< \brief Integer or Enum */ + GLfloat _float; /**< \brief Floating-point */ +} driOptionValue; + +/** \brief Single range of valid values + * + * For empty ranges (a single value) start == end */ +typedef struct driOptionRange { + driOptionValue start; /**< \brief Start */ + driOptionValue end; /**< \brief End */ +} driOptionRange; + +/** \brief Information about an option */ +typedef struct driOptionInfo { + char *name; /**< \brief Name */ + driOptionType type; /**< \brief Type */ + driOptionRange *ranges; /**< \brief Array of ranges */ + GLuint nRanges; /**< \brief Number of ranges */ +} driOptionInfo; + +/** \brief Option cache + * + * \li One in <driver>Screen caching option info and the default values + * \li One in each <driver>Context with the actual values for that context */ +typedef struct driOptionCache { + driOptionInfo *info; + /**< \brief Array of option infos + * + * Points to the same array in the screen and all contexts */ + driOptionValue *values; + /**< \brief Array of option values + * + * \li Default values in screen + * \li Actual values in contexts + */ + GLuint tableSize; + /**< \brief Size of the arrays + * + * Depending on the hash function this may differ from __driNConfigOptions. + * In the current implementation it's not actually a size but log2(size). + * The value is the same in the screen and all contexts. */ +} driOptionCache; + +/** \brief XML document describing available options + * + * This must be defined in a driver-specific soure file. xmlpool.h + * defines helper macros and common options. */ +extern const char __driConfigOptions[]; +/** \brief The number of options supported by a driver + * + * This is used to choose an appropriate hash table size. So any value + * larger than the actual number of options will work. */ +extern const GLuint __driNConfigOptions; + +/** \brief Parse XML option info from __driConfigOptions + * + * To be called in <driver>CreateScreen */ +void driParseOptionInfo (driOptionCache *info); +/** \brief Initialize option cache from info and parse configuration files + * + * To be called in <driver>CreateContext. screenNum and driverName select + * device sections. */ +void driParseConfigFiles (driOptionCache *cache, driOptionCache *info, + GLint screenNum, const char *driverName); +/** \brief Destroy option info + * + * To be called in <driver>DestroyScreen */ +void driDestroyOptionInfo (driOptionCache *info); +/** \brief Destroy option cache + * + * To be called in <driver>DestroyContext */ +void driDestroyOptionCache (driOptionCache *cache); + +/** \brief Check if there exists a certain option */ +GLboolean driCheckOption (const driOptionCache *cache, const char *name, + driOptionType type); + +/** \brief Query a boolean option value */ +GLboolean driQueryOptionb (const driOptionCache *cache, const char *name); +/** \brief Query an integer option value */ +GLint driQueryOptioni (const driOptionCache *cache, const char *name); +/** \brief Query a floating-point option value */ +GLfloat driQueryOptionf (const driOptionCache *cache, const char *name); + +#endif diff --git a/src/mesa/drivers/dri/common/xmlpool.h b/src/mesa/drivers/dri/common/xmlpool.h new file mode 100644 index 00000000000..c1553734782 --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlpool.h @@ -0,0 +1,203 @@ +/* -*- mode:C; coding: mult-utf-8-unix -*- + * + * !!! Important: This file is encoded in UTF-8 !!! + * + * Note (Emacs): You need Mule. In Debian the package is called + * mule-ucs. + * + * Note (Emacs): You may have to enable multibyte characters in the + * Mule customization group or by setting + * default-enable-multibyte-characters to t in your .emacs: + */ +/* + * XML DRI client-side driver configuration + * Copyright (C) 2003 Felix Kuehling + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +/** + * \file xmlpool.h + * \brief Pool of common options + * \author Felix Kuehling + * + * This file defines macros that can be used to construct driConfigOptions + * in the drivers. + */ + +#ifndef __XMLPOOL_H +#define __XMLPOOL_H + +/* + * generic macros + */ + +/** \brief Begin __driConfigOptions */ +#define DRI_CONF_BEGIN \ +"<driinfo>\n" + +/** \brief End __driConfigOptions */ +#define DRI_CONF_END \ +"</driinfo>\n" + +/** \brief Begin a section of related options */ +#define DRI_CONF_SECTION_BEGIN \ +"<section>\n" + +/** \brief End a section of related options */ +#define DRI_CONF_SECTION_END \ +"</section>\n" + +/** \brief Begin an option definition */ +#define DRI_CONF_OPT_BEGIN(name,type,def) \ +"<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n" + +/** \brief Begin an option definition with restrictions on valid values */ +#define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \ +"<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n" + +/** \brief End an option description */ +#define DRI_CONF_OPT_END \ +"</option>\n" + +/** \brief A verbal description in a specified language (empty version) */ +#define DRI_CONF_DESC(lang,text) \ +"<description lang=\""#lang"\" text=\""text"\"/>\n" + +/** \brief A verbal description in a specified language */ +#define DRI_CONF_DESC_BEGIN(lang,text) \ +"<description lang=\""#lang"\" text=\""text"\">\n" + +/** \brief End a description */ +#define DRI_CONF_DESC_END \ +"</description>\n" + +/** \brief A verbal description of an enum value */ +#define DRI_CONF_ENUM(value,text) \ +"<enum value=\""#value"\" text=\""text"\"/>\n" + +/* + * predefined option sections and options with multi-lingual descriptions + */ + +/** \brief Debugging options */ +#define DRI_CONF_SECTION_DEBUG \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,"Debugging") \ + DRI_CONF_DESC(de,"Fehlersuche") + +#define DRI_CONF_NO_RAST(def) \ +DRI_CONF_OPT_BEGIN(no_rast,bool,def) \ + DRI_CONF_DESC(en,"Disable 3D acceleration") \ + DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \ +DRI_CONF_OPT_END + +#define DRI_CONF_PERFORMANCE_BOXES(def) \ +DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \ + DRI_CONF_DESC(en,"Show performance boxes") \ + DRI_CONF_DESC(de,"Zeige Performanceboxen") \ +DRI_CONF_OPT_END + +#define DRI_CONF_DEBUG_DMA(def) \ +DRI_CONF_OPT_BEGIN(debug_dma,bool,def) \ + DRI_CONF_DESC(en,"Debug DMA buffers") \ + DRI_CONF_DESC(de,"DMA Puffer debuggen") \ +DRI_CONF_OPT_END + + +/** \brief Texture-related options */ +#define DRI_CONF_SECTION_QUALITY \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,"Image Quality") \ + DRI_CONF_DESC(de,"Bildqualität") + +#define DRI_CONF_PREFERRED_BPT(def,valid) \ +DRI_CONF_OPT_BEGIN_V(preferred_bpt,enum,def,valid) \ + DRI_CONF_DESC_BEGIN(en,"Preferred texture color depth") \ + DRI_CONF_ENUM(0,"Same as frame buffer") \ + DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(de,"Bevorzugte Textur Farbtiefe") \ + DRI_CONF_ENUM(0,"So wie der Framebuffer") \ + DRI_CONF_DESC_END \ +DRI_CONF_OPT_END + +/** \brief Performance-related options */ +#define DRI_CONF_SECTION_PERFORMANCE \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,"Performance") \ + DRI_CONF_DESC(de,"Leistung") + +#define DRI_CONF_TCL_SW 0 +#define DRI_CONF_TCL_PIPELINED 1 +#define DRI_CONF_TCL_VTXFMT 2 +#define DRI_CONF_TCL_CODEGEN 3 +#define DRI_CONF_TCL_MODE(def) \ +DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \ + DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \ + DRI_CONF_ENUM(0,"Software") \ + DRI_CONF_ENUM(1,"TCL stage in MESA pipeline") \ + DRI_CONF_ENUM(2,"Bypass MESA's pipeline") \ + DRI_CONF_ENUM(3,"Bypass MESA's pipeline with state-based code generation") \ + DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(de,"TCL Modus (Transformation, Clipping, Licht)") \ + DRI_CONF_ENUM(0,"Software") \ + DRI_CONF_ENUM(1,"TCL Stufe in MESA Pipeline") \ + DRI_CONF_ENUM(2,"Umgehe MESA's Pipeline") \ + DRI_CONF_ENUM(3,"Umgehe MESA's Pipeline mit zustandsbasierter Codegenerierung") \ + DRI_CONF_DESC_END \ +DRI_CONF_OPT_END + +#define DRI_CONF_FTHROTTLE_BUSY 0 +#define DRI_CONF_FTHROTTLE_USLEEPS 1 +#define DRI_CONF_FTHROTTLE_IRQS 2 +#define DRI_CONF_FTHROTTLE_MODE(def) \ +DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \ + DRI_CONF_DESC_BEGIN(en,"Frame throttling") \ + DRI_CONF_ENUM(0,"Busy waiting") \ + DRI_CONF_ENUM(1,"Usleeps") \ + DRI_CONF_ENUM(2,"Software interrupts") \ + DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(de,"Framethrottling") \ + DRI_CONF_ENUM(0,"Aktives Warten") \ + DRI_CONF_ENUM(1,"Usleeps") \ + DRI_CONF_ENUM(2,"Sortware Interrutps") \ + DRI_CONF_DESC_END \ +DRI_CONF_OPT_END + +#define DRI_CONF_VBLANK_NEVER 0 +#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 +#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 +#define DRI_CONF_VBLANK_ALWAYS_SYNC 3 +#define DRI_CONF_VBLANK_MODE(def) \ +DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \ + DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \ + DRI_CONF_ENUM(0,"Never, FPS rulez!") \ + DRI_CONF_ENUM(1,"Application preference, default interval 0") \ + DRI_CONF_ENUM(2,"Application preference, default interval 1") \ + DRI_CONF_ENUM(3,"Application preference, always synchronize with refresh") \ + DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(de,"Synchronisation mit dem vertikalen Bildaufbau (swap intervals)") \ + DRI_CONF_ENUM(0,"Niemals, immer die maximale Framerate") \ + DRI_CONF_ENUM(1,"Anwendung entscheidet, Standardinterval 0") \ + DRI_CONF_ENUM(2,"Anwendung entscheidet, Standardinterval 1") \ + DRI_CONF_ENUM(3,"Anwendung entscheidet, immer mit Bildaufbau synchronisieren") \ + DRI_CONF_DESC_END \ +DRI_CONF_OPT_END + +#endif diff --git a/src/mesa/drivers/dri/fb/Makefile.X11 b/src/mesa/drivers/dri/fb/Makefile.X11 index 4a3c7a3fd79..356c1bb3453 100644 --- a/src/mesa/drivers/dri/fb/Makefile.X11 +++ b/src/mesa/drivers/dri/fb/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.2 2003/08/23 04:58:24 jonsmirl Exp $ +# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -57,6 +57,10 @@ fb_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/fb_dri.so && \ install fb_dri.so $(TOP)/lib/fb_dri.so +$(TOP)/lib/fb_dri.so: fb_dri.so + rm -f $(TOP)/lib/fb_dri.so && \ + install fb_dri.so $(TOP)/lib/fb_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 794e3d1fc8c..59c068beb89 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -1,4 +1,4 @@ -/* $Id: fb_dri.c,v 1.2 2003/10/08 01:53:30 kendallb Exp $ */ +/* $Id: fb_dri.c,v 1.1.2.1 2003/11/21 15:49:29 keithw Exp $ */ /* * Mesa 3-D graphics library diff --git a/src/mesa/drivers/dri/gamma/Makefile.X11 b/src/mesa/drivers/dri/gamma/Makefile.X11 new file mode 100644 index 00000000000..4a7c9168ee0 --- /dev/null +++ b/src/mesa/drivers/dri/gamma/Makefile.X11 @@ -0,0 +1,123 @@ +# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $ + +# Mesa 3-D graphics library +# Version: 5.0 +# Copyright (C) 1995-2002 Brian Paul + +TOP = ../../../../.. + +default: linux-solo + +SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver +MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini + +DEFINES += \ + -D_HAVE_SWRAST=1 \ + -D_HAVE_SWTNL=1 \ + -D_HAVE_SANITY=1 \ + -D_HAVE_CODEGEN=1 \ + -D_HAVE_LIGHTING=1 \ + -D_HAVE_TEXGEN=1 \ + -D_HAVE_USERCLIP=1 \ + -DGLX_DIRECT_RENDERING + +# Not yet +# MINIGLX_SOURCES = server/gamma_dri.c + +DRIVER_SOURCES = \ + gamma_context.c \ + gamma_dd.c \ + gamma_inithw.c \ + gamma_lock.c \ + gamma_render.c \ + gamma_screen.c \ + gamma_span.c \ + gamma_state.c \ + gamma_tex.c \ + gamma_texmem.c \ + gamma_texstate.c \ + gamma_tris.c \ + gamma_vb.c \ + gamma_xmesa.c \ + ../common/mm.c \ + ../common/utils.c \ + ../common/texmem.c \ + ../common/vblank.c + +INCLUDES = $(MINIGLX_INCLUDES) \ + $(SHARED_INCLUDES) + + +C_SOURCES = $(DRIVER_SOURCES) \ + $(MINIGLX_SOURCES) + +MESA_MODULES = $(TOP)/src/mesa/mesa.a + + +ifeq ($(WINDOW_SYSTEM),dri) +WINOBJ=$(MESABUILDDIR)/dri/dri.a +WINLIB= +else +WINOBJ= +WINLIB=-L$(MESA)/src/glx/mini +endif + +ASM_SOURCES = +OBJECTS = $(C_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) + +### Include directories + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/mesa/glapi \ + -I$(TOP)/src/mesa/math \ + -I$(TOP)/src/mesa/transform \ + -I$(TOP)/src/mesa/swrast \ + -I$(TOP)/src/mesa/swrast_setup + + +##### RULES ##### + +.c.o: + $(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + + +##### TARGETS ##### + +targets: depend gamma_dri.so + +gamma_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 + rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS) + rm -f $(TOP)/lib/gamma_dri.so && \ + install gamma_dri.so $(TOP)/lib/gamma_dri.so + +$(TOP)/lib/gamma_dri.so: gamma_dri.so + rm -f $(TOP)/lib/gamma_dri.so && \ + install gamma_dri.so $(TOP)/lib/gamma_dri.so + +# Run 'make -f Makefile.X11 dep' to update the dependencies if you change +# what's included by any source file. +depend: $(C_SOURCES) $(ASM_SOURCES) + makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \ + $(C_SOURCES) $(ASM_SOURCES) + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find ../include` + + +# Remove .o and backup files +clean: + -rm -f *.o */*.o *~ *.o *~ *.so server/*.o + + +include $(TOP)/Make-config + +include depend diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c index 67bcf019d0c..c0a298cb859 100644 --- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c +++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c @@ -66,7 +66,7 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv) gmesa->glCtx->DriverCtx = NULL; _mesa_destroy_context(gmesa->glCtx); - Xfree(gmesa); + FREE(gmesa); driContextPriv->driverPrivate = NULL; } } diff --git a/src/mesa/drivers/dri/i810/Makefile.X11 b/src/mesa/drivers/dri/i810/Makefile.X11 index 461da451e15..95bcfa535cb 100644 --- a/src/mesa/drivers/dri/i810/Makefile.X11 +++ b/src/mesa/drivers/dri/i810/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.1 2003/09/30 10:54:15 alanh Exp $ +# $Id: Makefile.X11,v 1.1.2.1 2003/11/21 15:49:29 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -94,6 +94,10 @@ i810_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/i810_dri.so && \ install i810_dri.so $(TOP)/lib/i810_dri.so +$(TOP)/lib/i810_dri.so: i810_dri.so + rm -f $(TOP)/lib/i810_dri.so && \ + install i810_dri.so $(TOP)/lib/i810_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 9e457f42cd9..53f1251fa9d 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -34,6 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glheader.h" +#include "imports.h" #include "context.h" #include "matrix.h" #include "simple_list.h" @@ -68,12 +69,12 @@ static drmBufMapPtr i810_create_empty_buffers(void) { drmBufMapPtr retval; - retval = (drmBufMapPtr)MALLOC(sizeof(drmBufMap)); + retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32); if(retval == NULL) return NULL; memset(retval, 0, sizeof(drmBufMap)); - retval->list = (drmBufPtr)MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR); + retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32); if(retval->list == NULL) { - Xfree(retval); + ALIGN_FREE(retval); return NULL; } memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); @@ -143,7 +144,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810Screen->bufs = i810_create_empty_buffers(); if (i810Screen->bufs == NULL) { __driUtilMessage("i810InitDriver: i810_create_empty_buffers() failed"); - Xfree(i810Screen); + FREE(i810Screen); return GL_FALSE; } @@ -154,7 +155,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810Screen->back.handle, i810Screen->back.size, (drmAddress *)&i810Screen->back.map) != 0) { - Xfree(i810Screen); + FREE(i810Screen); sPriv->private = NULL; __driUtilMessage("i810InitDriver: drmMap failed"); return GL_FALSE; @@ -167,7 +168,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810Screen->depth.handle, i810Screen->depth.size, (drmAddress *)&i810Screen->depth.map) != 0) { - Xfree(i810Screen); + FREE(i810Screen); drmUnmap(i810Screen->back.map, i810Screen->back.size); sPriv->private = NULL; __driUtilMessage("i810InitDriver: drmMap (2) failed"); @@ -181,7 +182,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810Screen->tex.handle, i810Screen->tex.size, (drmAddress *)&i810Screen->tex.map) != 0) { - Xfree(i810Screen); + FREE(i810Screen); drmUnmap(i810Screen->back.map, i810Screen->back.size); drmUnmap(i810Screen->depth.map, i810Screen->depth.size); sPriv->private = NULL; @@ -205,7 +206,7 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv) drmUnmap(i810Screen->depth.map, i810Screen->depth.size); drmUnmap(i810Screen->tex.map, i810Screen->tex.size); - Xfree(i810Screen); + FREE(i810Screen); sPriv->private = NULL; } diff --git a/src/mesa/drivers/dri/i830/Makefile.X11 b/src/mesa/drivers/dri/i830/Makefile.X11 index 622e5281cf5..d27432dbe65 100644 --- a/src/mesa/drivers/dri/i830/Makefile.X11 +++ b/src/mesa/drivers/dri/i830/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.2 2003/09/30 11:05:46 alanh Exp $ +# $Id: Makefile.X11,v 1.2.2.1 2003/11/21 15:49:29 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -95,6 +95,10 @@ i830_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/i830_dri.so && \ install i830_dri.so $(TOP)/lib/i830_dri.so +$(TOP)/lib/i830_dri.so: i830_dri.so + rm -f $(TOP)/lib/i830_dri.so && \ + install i830_dri.so $(TOP)/lib/i830_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index cd3c74c5841..b0117210f52 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -57,7 +57,7 @@ static int i830_malloc_proxy_buf(drmBufMapPtr buffers) drmBufPtr buf; int i; - buffer = MALLOC(I830_DMA_BUF_SZ); + buffer = ALIGN_MALLOC(I830_DMA_BUF_SZ, 32); if(buffer == NULL) return -1; for(i = 0; i < I830_DMA_BUF_NR; i++) { buf = &(buffers->list[i]); @@ -71,12 +71,12 @@ static drmBufMapPtr i830_create_empty_buffers(void) { drmBufMapPtr retval; - retval = (drmBufMapPtr)MALLOC(sizeof(drmBufMap)); + retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32); if(retval == NULL) return NULL; memset(retval, 0, sizeof(drmBufMap)); - retval->list = (drmBufPtr)MALLOC(sizeof(drmBuf) * I830_DMA_BUF_NR); + retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I830_DMA_BUF_NR, 32); if(retval->list == NULL) { - Xfree(retval); + FREE(retval); return NULL; } @@ -182,7 +182,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) if(i830Screen->bufs == NULL) { fprintf(stderr,"\nERROR: Failed to create empty buffers in %s \n", __FUNCTION__); - Xfree(i830Screen); + FREE(i830Screen); return GL_FALSE; } @@ -203,7 +203,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i830Screen->back.map) != 0) { fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n", __LINE__, __FUNCTION__, __FILE__); - Xfree(i830Screen); + FREE(i830Screen); sPriv->private = NULL; return GL_FALSE; } @@ -217,7 +217,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i830Screen->depth.map) != 0) { fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n", __LINE__, __FUNCTION__, __FILE__); - Xfree(i830Screen); + FREE(i830Screen); drmUnmap(i830Screen->back.map, i830Screen->back.size); sPriv->private = NULL; return GL_FALSE; @@ -232,7 +232,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i830Screen->tex.map) != 0) { fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n", __LINE__, __FUNCTION__, __FILE__); - Xfree(i830Screen); + FREE(i830Screen); drmUnmap(i830Screen->back.map, i830Screen->back.size); drmUnmap(i830Screen->depth.map, i830Screen->depth.size); sPriv->private = NULL; @@ -288,7 +288,7 @@ static void i830DestroyScreen(__DRIscreenPrivate *sPriv) drmUnmap(i830Screen->back.map, i830Screen->back.size); drmUnmap(i830Screen->depth.map, i830Screen->depth.size); drmUnmap(i830Screen->tex.map, i830Screen->tex.size); - Xfree(i830Screen); + FREE(i830Screen); sPriv->private = NULL; } diff --git a/src/mesa/drivers/dri/mga/Makefile.X11 b/src/mesa/drivers/dri/mga/Makefile.X11 index 4f20c7a8331..ceaa6746422 100644 --- a/src/mesa/drivers/dri/mga/Makefile.X11 +++ b/src/mesa/drivers/dri/mga/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.3 2003/08/24 04:44:23 jonsmirl Exp $ +# $Id: Makefile.X11,v 1.3.2.1 2003/11/21 15:49:29 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -31,7 +31,8 @@ DRIVER_SOURCES = mgadd.c \ ../common/mm.c \ ../common/utils.c \ ../common/texmem.c \ - ../common/vblank.c + ../common/vblank.c \ + ../common/xmlconfig.c FULL_DRIVER_SOURCES = \ mgapixel.c \ @@ -39,6 +40,7 @@ FULL_DRIVER_SOURCES = \ mgatex.c \ mgatexmem.c \ mga_texstate.c \ + mga_texcombine.c \ mgavb.c \ mga_xmesa.c @@ -99,6 +101,10 @@ mga_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/mga_dri.so && \ install mga_dri.so $(TOP)/lib/mga_dri.so +$(TOP)/lib/mga_dri.so: mga_dri.so + rm -f $(TOP)/lib/mga_dri.so && \ + install mga_dri.so $(TOP)/lib/mga_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/mga/mga_texcombine.c b/src/mesa/drivers/dri/mga/mga_texcombine.c new file mode 100644 index 00000000000..f0664e37cfa --- /dev/null +++ b/src/mesa/drivers/dri/mga/mga_texcombine.c @@ -0,0 +1,647 @@ +/* + * Copyright (c) 2003 Ville Syrjala + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Ville Syrjala <[email protected]> + */ + +#include "glheader.h" + +#include "mgacontext.h" +#include "mgatex.h" +#include "mgaregs.h" + +/* + * GL_ARB_texture_env_combine + * GL_EXT_texture_env_combine + * GL_ARB_texture_env_crossbar + * GL_ATI_texture_env_combine3 + */ + +#define ARG_DISABLE 0xffffffff +#define MGA_ARG1 0 +#define MGA_ARG2 1 +#define MGA_ALPHA 2 + +GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ) +{ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); + const int source = mmesa->tmu_source[unit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source]; + GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit); + GLuint numColorArgs = 0, numAlphaArgs = 0; + GLuint arg1[3], arg2[3], alpha[3]; + int args[3]; + int i; + + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + numColorArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + numColorArgs = 2; + break; + case GL_INTERPOLATE: + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + numColorArgs = 3; + break; + default: + return GL_FALSE; + } + + switch (texUnit->CombineModeA) { + case GL_REPLACE: + numAlphaArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + numAlphaArgs = 2; + break; + default: + return GL_FALSE; + } + + /* Start fresh :) */ + *reg = 0; + + /* COLOR */ + for (i = 0; i < 3; i++) { + arg1[i] = 0; + arg2[i] = 0; + alpha[i] = 0; + } + + for (i = 0;i < numColorArgs; i++) { + switch (texUnit->CombineSourceRGB[i]) { + case GL_TEXTURE: + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + alpha[i] |= TD0_color_alpha_currtex; + break; + case GL_TEXTURE0: + if (source == 0) { + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + alpha[i] |= TD0_color_alpha_currtex; + } else { + if (ctx->Texture._EnabledUnits != 0x03) { + /* disable texturing */ + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= DC_opcod_trap; + mmesa->hw.alpha_sel = AC_alphasel_diffused; + /* return GL_TRUE since we don't need a fallback */ + return GL_TRUE; + } + arg1[i] |= ARG_DISABLE; + arg2[i] |= ARG_DISABLE; + alpha[i] |= TD0_color_alpha_prevtex; + } + break; + case GL_TEXTURE1: + if (source == 0) { + if (ctx->Texture._EnabledUnits != 0x03) { + /* disable texturing */ + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= DC_opcod_trap; + mmesa->hw.alpha_sel = AC_alphasel_diffused; + /* return GL_TRUE since we don't need a fallback */ + return GL_TRUE; + } + arg1[i] |= ARG_DISABLE; + /* G400 specs (TDUALSTAGE0) */ + arg2[i] |= TD0_color_arg2_prevstage; + alpha[i] |= TD0_color_alpha_prevstage; + } else { + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + alpha[i] |= TD0_color_alpha_currtex; + } + break; + case GL_CONSTANT: + arg1[i] |= ARG_DISABLE; + arg2[i] |= TD0_color_arg2_fcol; + alpha[i] |= TD0_color_alpha_fcol; + break; + case GL_PRIMARY_COLOR: + arg1[i] |= ARG_DISABLE; + /* G400 specs (TDUALSTAGE1) */ + if (unit == 0 || (mmesa->setup.tdualstage0 & + ((TD0_color_sel_mul & TD0_color_sel_add) | + (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) { + arg2[i] |= TD0_color_arg2_diffuse; + alpha[i] |= TD0_color_alpha_diffuse; + } else { + arg2[i] |= ARG_DISABLE; + alpha[i] |= ARG_DISABLE; + } + break; + case GL_PREVIOUS: + arg1[i] |= ARG_DISABLE; + if (unit == 0) { + arg2[i] |= TD0_color_arg2_diffuse; + alpha[i] |= TD0_color_alpha_diffuse; + } else { + arg2[i] |= TD0_color_arg2_prevstage; + alpha[i] |= TD0_color_alpha_prevstage; + } + break; + default: + return GL_FALSE; + } + + switch (texUnit->CombineOperandRGB[i]) { + case GL_SRC_COLOR: + arg1[i] |= 0; + arg2[i] |= 0; + alpha[i] |= ARG_DISABLE; + break; + case GL_ONE_MINUS_SRC_COLOR: + arg1[i] |= TD0_color_arg1_inv_enable; + arg2[i] |= TD0_color_arg2_inv_enable; + alpha[i] |= ARG_DISABLE; + break; + case GL_SRC_ALPHA: + arg1[i] |= TD0_color_arg1_replicatealpha_enable; + arg2[i] |= TD0_color_arg2_replicatealpha_enable; + alpha[i] |= 0; + break; + case GL_ONE_MINUS_SRC_ALPHA: + arg1[i] |= (TD0_color_arg1_replicatealpha_enable | + TD0_color_arg1_inv_enable); + arg2[i] |= (TD0_color_arg2_replicatealpha_enable | + TD0_color_arg2_inv_enable); + alpha[i] |= (TD0_color_alpha1inv_enable | + TD0_color_alpha2inv_enable); + break; + } + } + + switch (texUnit->CombineModeRGB) { + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + /* Special handling for ATI_texture_env_combine3. + * If Arg1 == Arg0 or Arg1 == Arg2 we can use arg1 or arg2 as input for + * both multiplier and adder. + */ + /* Arg1 == arg1 */ + if (arg1[1] == arg1[0]) { + if ((arg1[1] | arg2[2]) != ARG_DISABLE) { + *reg |= arg1[1] | arg2[2]; + args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ARG2; + break; + } else + if ((arg1[1] | alpha[2]) != ARG_DISABLE) { + *reg |= arg1[1] | alpha[2]; + args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ALPHA; + break; + } + } + if (arg1[1] == arg1[2]) { + if ((arg1[1] | arg2[0]) != ARG_DISABLE) { + *reg |= arg1[1] | arg2[0]; + args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ARG1; + break; + } else + if ((arg1[1] | alpha[0]) != ARG_DISABLE) { + *reg |= arg1[1] | alpha[0]; + args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG1; + break; + } + } + /* fallthrough */ + case GL_MODULATE_SUBTRACT_ATI: + /* Arg1 == arg2 */ + if (arg2[1] == arg2[0]) { + if ((arg2[1] | arg1[2]) != ARG_DISABLE) { + *reg |= arg2[1] | arg1[2]; + args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ARG1; + break; + } else + if ((arg2[1] | alpha[2]) != ARG_DISABLE) { + *reg |= arg2[1] | alpha[2]; + args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ALPHA; + break; + } + } + if (arg2[1] == arg2[2]) { + if ((arg2[1] | arg1[0]) != ARG_DISABLE) { + *reg |= arg2[1] | arg1[0]; + args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ARG2; + break; + } else + if ((arg2[1] | alpha[0]) != ARG_DISABLE) { + *reg |= arg2[1] | alpha[0]; + args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG2; + break; + } + } + /* fallthrough */ + default: + /* Find working combo of arg1, arg2 and alpha. + * + * Keep the Arg0 != alpha cases first since there's + * no way to get alpha out by itself (GL_REPLACE). + * + * Keep the Arg2 == alpha cases first because only alpha has the + * capabilities to function as Arg2 (GL_INTERPOLATE). Also good for + * GL_ADD, GL_ADD_SIGNED, GL_SUBTRACT since we can't get alpha to the + * adder. + * + * Keep the Arg1 == alpha cases last for GL_MODULATE_ADD_ATI, + * GL_MODULATE_SIGNED_ADD_ATI. Again because we can't get alpha to the + * adder. + * + * GL_MODULATE_SUBTRACT_ATI needs special treatment since it requires + * that Arg1 == arg2. This requirement clashes with those of other modes. + */ + if ((arg1[0] | arg2[1] | alpha[2]) != ARG_DISABLE) { + *reg |= arg1[0] | arg2[1] | alpha[2]; + args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ALPHA; + } else + if ((arg1[1] | arg2[0] | alpha[2]) != ARG_DISABLE && + texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) { + *reg |= arg1[1] | arg2[0] | alpha[2]; + args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ALPHA; + } else + if ((arg1[1] | arg2[2] | alpha[0]) != ARG_DISABLE && + texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) { + *reg |= arg1[1] | arg2[2] | alpha[0]; + args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG2; + } else + if ((arg1[2] | arg2[1] | alpha[0]) != ARG_DISABLE) { + *reg |= arg1[2] | arg2[1] | alpha[0]; + args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG1; + } else + if ((arg1[0] | arg2[2] | alpha[1]) != ARG_DISABLE) { + *reg |= arg1[0] | arg2[2] | alpha[1]; + args[0] = MGA_ARG1; args[1] = MGA_ALPHA; args[2] = MGA_ARG2; + } else + if ((arg1[2] | arg2[0] | alpha[1]) != ARG_DISABLE) { + *reg |= arg1[2] | arg2[0] | alpha[1]; + args[0] = MGA_ARG2; args[1] = MGA_ALPHA; args[2] = MGA_ARG1; + } else { + /* nothing suitable */ + return GL_FALSE; + } + } + + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + if (texUnit->CombineScaleShiftRGB) { + return GL_FALSE; + } + + if (args[0] == MGA_ARG1) { + *reg |= TD0_color_sel_arg1; + } else if (args[0] == MGA_ARG2) { + *reg |= TD0_color_sel_arg2; + } else if (args[0] == MGA_ALPHA) { + /* Can't get alpha out by itself */ + return GL_FALSE; + } + break; + case GL_MODULATE: + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_modbright_2x; + } else if (texUnit->CombineScaleShiftRGB == 2) { + *reg |= TD0_color_modbright_4x; + } + + *reg |= TD0_color_sel_mul; + + if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) { + if (args[0] == MGA_ARG1 || args[1] == MGA_ARG1) { + *reg |= TD0_color_arg2mul_alpha2; + } else if (args[0] == MGA_ARG2 || args[1] == MGA_ARG2) { + *reg |= TD0_color_arg1mul_alpha1; + } + } + break; + case GL_ADD_SIGNED: + *reg |= TD0_color_addbias_enable; + /* fallthrough */ + case GL_ADD: + if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA){ + /* Can't get alpha to the adder */ + return GL_FALSE; + } + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_add2x_enable; + } else if (texUnit->CombineScaleShiftRGB == 2) { + return GL_FALSE; + } + + *reg |= (TD0_color_add_add | + TD0_color_sel_add); + break; + case GL_INTERPOLATE: + if (args[2] != MGA_ALPHA) { + /* Only alpha can function as Arg2 */ + return GL_FALSE; + } + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_add2x_enable; + } else if (texUnit->CombineScaleShiftRGB == 2) { + return GL_FALSE; + } + + *reg |= (TD0_color_arg1mul_alpha1 | + TD0_color_blend_enable | + TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout | + TD0_color_add_add | + TD0_color_sel_add); + + /* Have to do this with xor since GL_ONE_MINUS_SRC_ALPHA may have + * already touched this bit. + */ + *reg ^= TD0_color_alpha1inv_enable; + + if (args[0] == MGA_ARG2) { + /* Swap arguments */ + *reg ^= (TD0_color_arg1mul_alpha1 | + TD0_color_arg2mul_alpha2 | + TD0_color_alpha1inv_enable | + TD0_color_alpha2inv_enable); + } + + if (ctx->Texture._EnabledUnits != 0x03) { + /* Linear blending mode needs dualtex enabled */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + mmesa->dualtex_env = GL_TRUE; + } + break; + case GL_SUBTRACT: + if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) { + /* Can't get alpha to the adder */ + return GL_FALSE; + } + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_add2x_enable; + } else if (texUnit->CombineScaleShiftRGB == 2) { + return GL_FALSE; + } + + *reg |= (TD0_color_add_sub | + TD0_color_sel_add); + + if (args[0] == MGA_ARG2) { + /* Swap arguments */ + *reg ^= (TD0_color_arg1_inv_enable | + TD0_color_arg2_inv_enable); + } + break; + case GL_MODULATE_SIGNED_ADD_ATI: + *reg |= TD0_color_addbias_enable; + /* fallthrough */ + case GL_MODULATE_ADD_ATI: + if (args[1] == MGA_ALPHA) { + /* Can't get alpha to the adder */ + return GL_FALSE; + } + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_add2x_enable; + } else if (texUnit->CombineScaleShiftRGB == 2) { + return GL_FALSE; + } + + *reg |= (TD0_color_add_add | + TD0_color_sel_add); + + if (args[1] == args[0] || args[1] == args[2]) { + *reg |= TD0_color_arg1add_mulout; + if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) + *reg |= TD0_color_arg1mul_alpha1; + + if (args[1] == MGA_ARG1) { + /* Swap adder arguments */ + *reg ^= (TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout); + if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) { + /* Swap multiplier arguments */ + *reg ^= (TD0_color_arg1mul_alpha1 | + TD0_color_arg2mul_alpha2); + } + } + } else { + *reg |= (TD0_color_arg2mul_alpha2 | + TD0_color_arg1add_mulout); + + if (args[1] == MGA_ARG1) { + /* Swap arguments */ + *reg ^= (TD0_color_arg1mul_alpha1 | + TD0_color_arg2mul_alpha2 | + TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout); + } + } + break; + case GL_MODULATE_SUBTRACT_ATI: + if (args[1] != MGA_ARG2) { + /* Can't swap arguments */ + return GL_FALSE; + } + if (texUnit->CombineScaleShiftRGB == 1) { + *reg |= TD0_color_add2x_enable; + } else if (texUnit->CombineScaleShiftRGB == 2) { + return GL_FALSE; + } + + *reg |= (TD0_color_add_sub | + TD0_color_sel_add); + + if (args[1] == args[0] || args[1] == args[2]) { + *reg |= TD0_color_arg1add_mulout; + if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) + *reg |= TD0_color_arg1mul_alpha1; + } else { + *reg |= (TD0_color_arg2mul_alpha2 | + TD0_color_arg1add_mulout); + } + break; + } + + + /* ALPHA */ + for (i = 0; i < 2; i++) { + arg1[i] = 0; + arg2[i] = 0; + } + + for (i = 0; i < numAlphaArgs; i++) { + switch (texUnit->CombineSourceA[i]) { + case GL_TEXTURE: + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + break; + case GL_TEXTURE0: + if (source == 0) { + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + } else { + if (ctx->Texture._EnabledUnits != 0x03) { + /* disable texturing */ + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= DC_opcod_trap; + mmesa->hw.alpha_sel = AC_alphasel_diffused; + /* return GL_TRUE since we don't need a fallback */ + return GL_TRUE; + } + arg1[i] |= ARG_DISABLE; + arg2[i] |= TD0_alpha_arg2_prevtex; + } + break; + case GL_TEXTURE1: + if (source == 0) { + if (ctx->Texture._EnabledUnits != 0x03) { + /* disable texturing */ + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= DC_opcod_trap; + mmesa->hw.alpha_sel = AC_alphasel_diffused; + /* return GL_TRUE since we don't need a fallback */ + return GL_TRUE; + } + arg1[i] |= ARG_DISABLE; + /* G400 specs (TDUALSTAGE0) */ + arg2[i] |= TD0_alpha_arg2_prevstage; + } else { + arg1[i] |= 0; + arg2[i] |= ARG_DISABLE; + } + break; + case GL_CONSTANT: + arg1[i] |= ARG_DISABLE; + arg2[i] |= TD0_alpha_arg2_fcol; + break; + case GL_PRIMARY_COLOR: + arg1[i] |= ARG_DISABLE; + /* G400 specs (TDUALSTAGE1) */ + if (unit == 0 || (mmesa->setup.tdualstage0 & + ((TD0_color_sel_mul & TD0_color_sel_add) | + (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) { + arg2[i] |= TD0_alpha_arg2_diffuse; + } else { + arg2[i] |= ARG_DISABLE; + } + break; + case GL_PREVIOUS: + arg1[i] |= ARG_DISABLE; + if (unit == 0) { + arg2[i] |= TD0_alpha_arg2_diffuse; + } else { + arg2[i] |= TD0_alpha_arg2_prevstage; + } + break; + default: + return GL_FALSE; + } + + switch (texUnit->CombineOperandA[i]) { + case GL_SRC_ALPHA: + arg1[i] |= 0; + arg2[i] |= 0; + break; + case GL_ONE_MINUS_SRC_ALPHA: + arg1[i] |= TD0_alpha_arg1_inv_enable; + arg2[i] |= TD0_alpha_arg2_inv_enable; + break; + } + } + + /* Find a working combo of arg1 and arg2 */ + if ((arg1[0] | arg2[1]) != ARG_DISABLE) { + *reg |= arg1[0] | arg2[1]; + args[0] = MGA_ARG1; args[1] = MGA_ARG2; + } else + if ((arg1[1] | arg2[0]) != ARG_DISABLE) { + *reg |= arg1[1] | arg2[0]; + args[0] = MGA_ARG2; args[1] = MGA_ARG1; + } else { + /* nothing suitable */ + return GL_FALSE; + } + + switch (texUnit->CombineModeA) { + case GL_REPLACE: + if (texUnit->CombineScaleShiftA) { + return GL_FALSE; + } + + if (args[0] == MGA_ARG1){ + *reg |= TD0_alpha_sel_arg1; + } else if (args[0] == MGA_ARG2) { + *reg |= TD0_alpha_sel_arg2; + } + break; + case GL_MODULATE: + if (texUnit->CombineScaleShiftA == 1) { + *reg |= TD0_alpha_modbright_2x; + } else if (texUnit->CombineScaleShiftA == 2) { + *reg |= TD0_alpha_modbright_4x; + } + + *reg |= TD0_alpha_sel_mul; + break; + case GL_ADD_SIGNED: + *reg |= TD0_alpha_addbias_enable; + /* fallthrough */ + case GL_ADD: + if (texUnit->CombineScaleShiftA == 1) { + *reg |= TD0_alpha_add2x_enable; + } else if (texUnit->CombineScaleShiftA == 2) { + return GL_FALSE; + } + + *reg |= (TD0_alpha_add_enable | + TD0_alpha_sel_add); + break; + case GL_SUBTRACT: + if (texUnit->CombineScaleShiftA == 1) { + *reg |= TD0_alpha_add2x_enable; + } else if (texUnit->CombineScaleShiftA == 2) { + return GL_FALSE; + } + + *reg |= (TD0_alpha_add_disable | + TD0_alpha_sel_add); + + if (args[0] == MGA_ARG2) { + /* Swap arguments */ + *reg ^= (TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_inv_enable); + } + break; + } + + return GL_TRUE; +} + + diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index fc1406cab9e..5f3e1b1bacc 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -52,6 +52,8 @@ static const unsigned TMC_tformat[ TMC_nr_tformat ] = [MESA_FORMAT_RGB565] = TMC_tformat_tw16 | TMC_takey_1 | TMC_tamask_0, [MESA_FORMAT_ARGB4444] = TMC_tformat_tw12 | TMC_takey_1 | TMC_tamask_0, [MESA_FORMAT_ARGB1555] = TMC_tformat_tw15 | TMC_takey_1 | TMC_tamask_0, + [MESA_FORMAT_AL88] = TMC_tformat_tw8al | TMC_takey_1 | TMC_tamask_0, + [MESA_FORMAT_I8] = TMC_tformat_tw8a | TMC_takey_1 | TMC_tamask_0, [MESA_FORMAT_CI8] = TMC_tformat_tw8 | TMC_takey_1 | TMC_tamask_0, [MESA_FORMAT_YCBCR] = TMC_tformat_tw422uyvy | TMC_takey_1 | TMC_tamask_0, [MESA_FORMAT_YCBCR_REV] = TMC_tformat_tw422 | TMC_takey_1 | TMC_tamask_0, @@ -67,7 +69,7 @@ mgaSetTexImages( mgaContextPtr mmesa, GLint totalSize; GLint width, height; GLint i; - GLint firstLevel, lastLevel, numLevels; + GLint numLevels; GLint log2Width, log2Height; GLuint txformat = 0; GLint ofs; @@ -81,6 +83,8 @@ mgaSetTexImages( mgaContextPtr mmesa, case MESA_FORMAT_RGB565: txformat = TMC_tformat_tw16; break; case MESA_FORMAT_ARGB4444: txformat = TMC_tformat_tw12; break; case MESA_FORMAT_ARGB1555: txformat = TMC_tformat_tw15; break; + case MESA_FORMAT_AL88: txformat = TMC_tformat_tw8al; break; + case MESA_FORMAT_I8: txformat = TMC_tformat_tw8a; break; case MESA_FORMAT_CI8: txformat = TMC_tformat_tw8; break; case MESA_FORMAT_YCBCR: txformat = TMC_tformat_tw422uyvy; break; case MESA_FORMAT_YCBCR_REV: txformat = TMC_tformat_tw422; break; @@ -101,39 +105,21 @@ mgaSetTexImages( mgaContextPtr mmesa, #endif /* MGA_USE_TABLE_FOR_FORMAT */ - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { - /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. - */ - - firstLevel = lastLevel = tObj->BaseLevel; - } else { - /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. - */ - - firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ - } + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - width = tObj->Image[firstLevel]->Width; - height = tObj->Image[firstLevel]->Height; + width = tObj->Image[t->base.firstLevel]->Width; + height = tObj->Image[t->base.firstLevel]->Height; - numLevels = MIN2( lastLevel - firstLevel + 1, + numLevels = MIN2( t->base.lastLevel - t->base.firstLevel + 1, MGA_IS_G200(mmesa) ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS); totalSize = 0; for ( i = 0 ; i < numLevels ; i++ ) { - const struct gl_texture_image * const texImage = tObj->Image[i+firstLevel]; + const struct gl_texture_image * const texImage = + tObj->Image[ i + t->base.firstLevel ]; if ( (texImage == NULL) || ((i != 0) @@ -149,13 +135,9 @@ mgaSetTexImages( mgaContextPtr mmesa, baseImage->TexFormat->TexelBytes) + 31) & ~31; } - numLevels = i; - lastLevel = firstLevel + numLevels - 1; - /* save these values */ - t->base.firstLevel = firstLevel; - t->base.lastLevel = lastLevel; - + numLevels = i; + t->base.lastLevel = t->base.firstLevel + numLevels - 1; t->base.totalSize = totalSize; /* setup hardware register values */ @@ -225,7 +207,7 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) t->setup.texctl2 |= TMC_decalblend_enable; break; case GL_BLEND: - FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE ); + t->texenv_fallback = GL_TRUE; break; default: break; @@ -251,29 +233,160 @@ static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] = (0), /* GL_REPLACE + * Cv = Cs + * Av = Af */ (TD0_color_sel_arg1 | TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg2 ), + TD0_alpha_sel_arg2), /* GL_MODULATE + * Cv = Cf Cs + * Av = Af */ (TD0_color_arg2_diffuse | TD0_color_sel_mul | TD0_alpha_arg2_diffuse | - TD0_alpha_sel_mul), + TD0_alpha_sel_arg2), /* GL_DECAL + * Cv = Cs + * Av = Af */ (TD0_color_sel_arg1 | TD0_alpha_arg2_diffuse | TD0_alpha_sel_arg2), - /* GL_BLEND + /* GL_BLEND (Cc=0.0) + * Cv = Cf ( 1 - Cs ) + * Av = Af + */ + (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2), + + /* GL_ADD + * Cv = Cf + Cs + * Av = Af + */ + (TD0_color_arg2_diffuse | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2), + }, + + /* Unit 1: + */ + { + /* Disable combiner stage */ (0), + + /* GL_REPLACE + * Cv = Cs + * Av = Ap + */ + (TD0_color_sel_arg1 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2), + + /* GL_MODULATE + * Cv = Cp Cs + * Av = Ap + */ + (TD0_color_arg2_prevstage | + TD0_color_sel_mul | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2), + + /* GL_DECAL + * Cv = Cs + * Av = Ap + */ + (TD0_color_sel_arg1 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2), + + /* GL_BLEND (Cc=0.0) + * Cv = Cp ( 1 - Cs ) + * Av = Ap + */ + (TD0_color_arg1_inv_enable | + TD0_color_arg2_prevstage | + TD0_color_sel_mul | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2), + + /* GL_ADD + * Cv = Cp + Cs + * Av = Ap + */ + (TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2), + }, +}; + +static const GLuint g400_color_alpha_combine[][MGA_MAX_COMBFUNC] = +{ + /* Unit 0: + */ + { + /* Disable combiner stage + */ + (0), + + /* GL_REPLACE + * Cv = Cs + * Av = As + */ + (TD0_color_sel_arg1 | + TD0_alpha_sel_arg1), + + /* GL_MODULATE + * Cv = Cf Cs + * Av = Af As + */ + (TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul), + + /* GL_DECAL + * tmp = Cf ( 1 - As ) + * Cv = tmp + Cs As + * Av = Af + */ + (TD0_color_arg2_diffuse | + TD0_color_alpha_currtex | + TD0_color_alpha1inv_enable | + TD0_color_arg1mul_alpha1 | + TD0_color_blend_enable | + TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2), + + /* GL_BLEND (Cc=0.0) + * Cv = Cf ( 1 - Cs ) + * Av = Af As + */ + (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul), /* GL_ADD + * Cv = Cf + Cs + * Av = Af As */ (TD0_color_arg2_diffuse | TD0_color_add_add | @@ -290,33 +403,53 @@ static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] = (0), /* GL_REPLACE + * Cv = Cs + * Av = As */ (TD0_color_sel_arg1 | - TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg2 ), + TD0_alpha_sel_arg1), /* GL_MODULATE + * Cv = Cp Cs + * Av = Ap As */ (TD0_color_arg2_prevstage | - TD0_color_alpha_prevstage | TD0_color_sel_mul | TD0_alpha_arg2_prevstage | TD0_alpha_sel_mul), /* GL_DECAL + * tmp = Cp ( 1 - As ) + * Cv = tmp + Cs As + * Av = Ap */ - (TD0_color_sel_arg1 | + (TD0_color_arg2_prevstage | + TD0_color_alpha_currtex | + TD0_color_alpha1inv_enable | + TD0_color_arg1mul_alpha1 | + TD0_color_blend_enable | + TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout | + TD0_color_add_add | + TD0_color_sel_add | TD0_alpha_arg2_prevstage | - TD0_alpha_sel_arg2 ), + TD0_alpha_sel_arg2), - /* GL_BLEND + /* GL_BLEND (Cc=0.0) + * Cv = Cp ( 1 - Cs ) + * Av = Ap As */ - (0), + (TD0_color_arg1_inv_enable | + TD0_color_arg2_prevstage | + TD0_color_sel_mul | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_mul), /* GL_ADD + * Cv = Cp + Cs + * Av = Ap As */ (TD0_color_arg2_prevstage | - TD0_color_alpha_prevstage | TD0_color_add_add | TD0_color_sel_add | TD0_alpha_arg2_prevstage | @@ -334,20 +467,25 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = (0), /* GL_REPLACE + * Cv = Cf + * Av = As */ - (TD0_color_sel_arg2 | - TD0_color_arg2_diffuse | - TD0_alpha_sel_arg1 ), + (TD0_color_arg2_diffuse | + TD0_color_sel_arg2 | + TD0_alpha_sel_arg1), /* GL_MODULATE - * FIXME: Is this correct? + * Cv = Cf + * Av = Af As */ (TD0_color_arg2_diffuse | - TD0_color_sel_mul | + TD0_color_sel_arg2 | TD0_alpha_arg2_diffuse | TD0_alpha_sel_mul), - /* GL_DECAL + /* GL_DECAL (undefined) + * Cv = Cf + * Av = Af */ (TD0_color_arg2_diffuse | TD0_color_sel_arg2 | @@ -355,16 +493,20 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = TD0_alpha_sel_arg2), /* GL_BLEND + * Cv = Cf + * Av = Af As */ (TD0_color_arg2_diffuse | - TD0_color_sel_mul | + TD0_color_sel_arg2 | TD0_alpha_arg2_diffuse | TD0_alpha_sel_mul), /* GL_ADD + * Cv = Cf + * Av = Af As */ (TD0_color_arg2_diffuse | - TD0_color_sel_mul | + TD0_color_sel_arg2 | TD0_alpha_arg2_diffuse | TD0_alpha_sel_mul), }, @@ -377,21 +519,25 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = (0), /* GL_REPLACE + * Cv = Cp + * Av = As */ - (TD0_color_sel_arg2 | - TD0_color_arg2_diffuse | - TD0_alpha_sel_arg1 ), + (TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_sel_arg1), /* GL_MODULATE - * FIXME: Is this correct? + * Cv = Cp + * Av = Ap As */ (TD0_color_arg2_prevstage | - TD0_color_alpha_prevstage | - TD0_color_sel_mul | + TD0_color_sel_arg2 | TD0_alpha_arg2_prevstage | TD0_alpha_sel_mul), - /* GL_DECAL + /* GL_DECAL (undefined) + * Cv = Cp + * Av = Ap */ (TD0_color_arg2_prevstage | TD0_color_sel_arg2 | @@ -399,16 +545,20 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = TD0_alpha_sel_arg2), /* GL_BLEND + * Cv = Cp + * Av = Ap As */ - (TD0_color_arg2_diffuse | - TD0_color_sel_mul | - TD0_alpha_arg2_diffuse | + (TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_arg2_prevstage | TD0_alpha_sel_mul), /* GL_ADD + * Cv = Cp + * Av = Ap As */ (TD0_color_arg2_prevstage | - TD0_color_sel_mul | + TD0_color_sel_arg2 | TD0_alpha_arg2_prevstage | TD0_alpha_sel_mul), }, @@ -421,143 +571,236 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source]; const struct gl_texture_object *tObj = texUnit->_Current; GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit); + mgaTextureObjectPtr t; GLenum format; - if ( tObj != ctx->Texture.Unit[source].Current2D || !tObj ) + if ( !tObj || + (tObj != ctx->Texture.Unit[source].Current2D && + tObj != ctx->Texture.Unit[source].CurrentRect) ) return; format = tObj->Image[tObj->BaseLevel]->Format; + t = (mgaTextureObjectPtr) tObj->DriverData; + switch (ctx->Texture.Unit[source].EnvMode) { case GL_REPLACE: - if (format == GL_RGB || format == GL_LUMINANCE) { - *reg = g400_color_combine[unit][MGA_REPLACE]; - } - else if (format == GL_ALPHA) { + if (format == GL_ALPHA) { *reg = g400_alpha_combine[unit][MGA_REPLACE]; - } - else { - *reg = (TD0_color_sel_arg1 | - TD0_alpha_sel_arg1 ); + } else if (format == GL_RGB || format == GL_LUMINANCE) { + *reg = g400_color_combine[unit][MGA_REPLACE]; + } else { + *reg = g400_color_alpha_combine[unit][MGA_REPLACE]; } break; case GL_MODULATE: - *reg = g400_color_combine[unit][MGA_MODULATE]; + if (format == GL_ALPHA) { + *reg = g400_alpha_combine[unit][MGA_MODULATE]; + } else if (format == GL_RGB || format == GL_LUMINANCE) { + *reg = g400_color_combine[unit][MGA_MODULATE]; + } else { + *reg = g400_color_alpha_combine[unit][MGA_MODULATE]; + } break; + case GL_DECAL: if (format == GL_RGB) { - *reg = g400_color_combine[unit][MGA_DECAL]; + *reg = g400_color_combine[unit][MGA_DECAL]; + } else if (format == GL_RGBA) { + *reg = g400_color_alpha_combine[unit][MGA_DECAL]; + if (ctx->Texture._EnabledUnits != 0x03) { + /* Linear blending mode needs dual texturing enabled */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + mmesa->dualtex_env = GL_TRUE; + } + } else { + /* Undefined */ + *reg = g400_alpha_combine[unit][MGA_DECAL]; } - else if ( format == GL_RGBA ) { -#if 0 + break; + + case GL_ADD: + if (format == GL_ALPHA) { + *reg = g400_alpha_combine[unit][MGA_ADD]; + } else if (format == GL_RGB || format == GL_LUMINANCE) { + *reg = g400_color_combine[unit][MGA_ADD]; + } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) { + *reg = g400_color_alpha_combine[unit][MGA_ADD]; + } else if (format == GL_INTENSITY) { + /* Cv = Cf + Cs + * Av = Af + As + */ if (unit == 0) { - /* this doesn't work */ *reg = (TD0_color_arg2_diffuse | - TD0_color_alpha_currtex | - TD0_color_alpha2inv_enable | - TD0_color_arg2mul_alpha2 | - TD0_color_arg1mul_alpha1 | - TD0_color_blend_enable | - TD0_color_arg1add_mulout | - TD0_color_arg2add_mulout | TD0_color_add_add | - TD0_color_sel_mul | + TD0_color_sel_add | TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg2 ); - } - else { + TD0_alpha_add_enable | + TD0_alpha_sel_add); + } else { *reg = (TD0_color_arg2_prevstage | - TD0_color_alpha_currtex | - TD0_color_alpha2inv_enable | - TD0_color_arg2mul_alpha2 | - TD0_color_arg1mul_alpha1 | TD0_color_add_add | TD0_color_sel_add | TD0_alpha_arg2_prevstage | - TD0_alpha_sel_arg2 ); + TD0_alpha_add_enable | + TD0_alpha_sel_add); } -#else - /* s/w fallback, pretty sure we can't do in h/w */ - FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE ); - if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) - fprintf( stderr, "FALLBACK: GL_DECAL RGBA texture, unit=%d\n", - unit ); -#endif - } - else { - *reg = g400_alpha_combine[unit][MGA_DECAL]; } break; - case GL_ADD: - if (format == GL_INTENSITY) { - if (unit == 0) { - *reg = ( TD0_color_arg2_diffuse | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_diffuse | - TD0_alpha_add_enable | - TD0_alpha_sel_add); - } - else { - *reg = ( TD0_color_arg2_prevstage | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_prevstage | - TD0_alpha_add_enable | - TD0_alpha_sel_add); - } - } - else if (format == GL_ALPHA) { - *reg = g400_alpha_combine[unit][MGA_ADD]; - } - else { - *reg = g400_color_combine[unit][MGA_ADD]; - } - break; - case GL_BLEND: if (format == GL_ALPHA) { - *reg = g400_alpha_combine[unit][MGA_BLEND]; - } - else { - FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE ); - if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) - fprintf( stderr, "FALLBACK: GL_BLEND envcolor=0x%08x\n", - mmesa->envcolor ); - - /* Do singletexture GL_BLEND with 'all ones' env-color - * by using both texture units. Multitexture gl_blend - * is a fallback. - */ - if (unit == 0) { - /* Part 1: R1 = Rf ( 1 - Rt ) - * A1 = Af At - */ - *reg = ( TD0_color_arg2_diffuse | - TD0_color_arg1_inv_enable | - TD0_color_sel_mul | - TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg1); + *reg = g400_alpha_combine[unit][MGA_BLEND]; + } else { + if (mmesa->blend_flags & MGA_BLEND_RGB_ZERO) { + if (format == GL_RGB || format == GL_LUMINANCE) { + *reg = g400_color_combine[unit][MGA_BLEND]; + } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) { + *reg = g400_color_alpha_combine[unit][MGA_BLEND]; + } else if (format == GL_INTENSITY) { + if (mmesa->blend_flags & MGA_BLEND_ALPHA_ZERO) { + /* Cv = Cf ( 1 - Cs ) + * Av = Af ( 1 - As ) + */ + if (unit == 0) { + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + } else { + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_prevstage | + TD0_color_sel_mul | + TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_mul); + } + } else if (mmesa->blend_flags & MGA_BLEND_ALPHA_ONE && + ctx->Texture._EnabledUnits != 0x03) { + /* C1 = Cf ( 1 - Cs ) + * A1 = Af ( 1 - As ) + */ + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + /* Cv = C1 + * Av = A1 + As + */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_arg2_prevstage | + TD0_alpha_add_enable | + TD0_alpha_sel_add); + mmesa->dualtex_env = GL_TRUE; + } else { + t->texenv_fallback = GL_TRUE; + } + } + } else if (mmesa->blend_flags & MGA_BLEND_RGB_ONE && + ctx->Texture._EnabledUnits != 0x03) { + if (format == GL_RGB || format == GL_LUMINANCE) { + /* C1 = Cf ( 1 - Cs ) + * A1 = Af + */ + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2); + /* Cv = C1 + Cs + * Av = A1 + */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + mmesa->dualtex_env = GL_TRUE; + } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) { + /* C1 = Cf ( 1 - Cs ) + * A1 = Af As + */ + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + /* Cv = C1 + Cs + * Av = A1 + */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + mmesa->dualtex_env = GL_TRUE; + } else if (format == GL_INTENSITY) { + if (mmesa->blend_flags & MGA_BLEND_ALPHA_ZERO) { + /* C1 = Cf ( 1 - Cs ) + * A1 = Af ( 1 - As ) + */ + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + /* Cv = C1 + Cs + * Av = A1 + */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + mmesa->dualtex_env = GL_TRUE; + } else if (mmesa->blend_flags & MGA_BLEND_ALPHA_ONE) { + /* C1 = Cf ( 1 - Cs ) + * A1 = Af ( 1 - As ) + */ + *reg = (TD0_color_arg1_inv_enable | + TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg1_inv_enable | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + /* Cv = C1 + Cs + * Av = A1 + As + */ + *(reg+1) = (TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_add_enable | + TD0_alpha_sel_add); + mmesa->dualtex_env = GL_TRUE; + } else { + t->texenv_fallback = GL_TRUE; + } + } } else { - /* Part 2: R2 = R1 + Rt - * A2 = A1 - */ - *reg = ( TD0_color_arg2_prevstage | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_prevstage | - TD0_alpha_sel_arg2); + t->texenv_fallback = GL_TRUE; } } break; + case GL_COMBINE_EXT: + if (!mgaUpdateTextureEnvCombine(ctx, unit)) + t->texenv_fallback = GL_TRUE; + break; default: break; } } - static void disable_tex( GLcontext *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -573,7 +816,7 @@ static void disable_tex( GLcontext *ctx, int unit ) mmesa->CurrentTexObj[unit] = NULL; } - if ( unit != 0 ) { + if ( unit != 0 && !mmesa->dualtex_env ) { mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0; } @@ -586,7 +829,7 @@ static void disable_tex( GLcontext *ctx, int unit ) mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit); } -static GLboolean enable_tex_2d( GLcontext *ctx, int unit ) +static GLboolean enable_tex( GLcontext *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -649,6 +892,14 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) t->setup.texctl2 |= TMC_dualtex_enable; } + t->texenv_fallback = GL_FALSE; + + /* Set this before mgaUpdateTextureEnvG400() since + * GL_ARB_texture_env_crossbar may have to disable texturing. + */ + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= DC_opcod_texture_trap; + /* FIXME: The Radeon has some cached state so that it can avoid calling * FIXME: UpdateTextureEnv in some cases. Is that possible here? */ @@ -680,13 +931,10 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) mgaUpdateTextureEnvG200( ctx, unit ); } - - mmesa->setup.dwgctl &= DC_opcod_MASK; - mmesa->setup.dwgctl |= DC_opcod_texture_trap; mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit); FALLBACK( ctx, MGA_FALLBACK_BORDER_MODE, t->border_fallback ); - return !t->border_fallback; + return !t->border_fallback && !t->texenv_fallback; } @@ -697,8 +945,9 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source]; - if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT) { - return(enable_tex_2d( ctx, unit ) && + if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT || + texUnit->_ReallyEnabled == TEXTURE_RECT_BIT ) { + return(enable_tex( ctx, unit ) && update_tex_common( ctx, unit )); } else if ( texUnit->_ReallyEnabled ) { @@ -718,6 +967,7 @@ void mgaUpdateTextureState( GLcontext *ctx ) GLboolean ok; unsigned i; + mmesa->dualtex_env = GL_FALSE; /* This works around a quirk with the MGA hardware. If only OpenGL * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used. The @@ -740,8 +990,4 @@ void mgaUpdateTextureState( GLcontext *ctx ) } FALLBACK( ctx, MGA_FALLBACK_TEXTURE, !ok ); - - /* FIXME: I believe that ChooseVertexState should be called here instead of - * FIXME: in mgaDDValidateState. - */ } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 49e8cbec696..11daf9aaf4f 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.18 2002/12/16 16:18:52 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.19 2003/03/26 20:43:49 tsi Exp $ */ /* * Copyright 2000-2001 VA Linux Systems, Inc. * All Rights Reserved. @@ -56,11 +56,23 @@ #include "utils.h" #include "vblank.h" -#include "dri_util.h" + #ifndef _SOLO #include "glxextensions.h" #endif +/* MGA configuration + */ +#include "xmlpool.h" + +const char __driConfigOptions[] = +DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END +DRI_CONF_END; +const GLuint __driNConfigOptions = 1; + #ifndef MGA_DEBUG int MGA_DEBUG = 0; #endif @@ -97,7 +109,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) &gp, sizeof(gp)); if (ret) { fprintf(stderr, "drmMgaGetParam (MGA_PARAM_IRQ_NR): %d\n", ret); - free(mgaScreen); + FREE(mgaScreen); sPriv->private = NULL; return GL_FALSE; } @@ -105,23 +117,26 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->linecomp_sane = (sPriv->ddxMajor > 1) || (sPriv->ddxMinor > 1) || ((sPriv->ddxMinor == 1) && (sPriv->ddxPatch > 0)); -#ifndef _SOLO - if ( ! mgaScreen->linecomp_sane ) { - PFNGLXDISABLEEXTENSIONPROC glx_disable_extension; +#ifndef _SOLO + if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { + PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + void * const psc = sPriv->psc->screenConfigs; - glx_disable_extension = (PFNGLXDISABLEEXTENSIONPROC) - glXGetProcAddress( "__glXDisableExtension" ); + if ( glx_enable_extension != NULL ) { + if ( mgaScreen->linecomp_sane ) { + (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + } - if ( glx_disable_extension != NULL ) { - (*glx_disable_extension)( "GLX_SGI_swap_control" ); - (*glx_disable_extension)( "GLX_SGI_video_sync" ); - (*glx_disable_extension)( "GLX_MESA_swap_control" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); } } #endif if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { - free(mgaScreen); + FREE(mgaScreen); sPriv->private = NULL; __driUtilMessage("Unrecognized chipset"); return GL_FALSE; @@ -168,7 +183,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->agp.size, (drmAddress *)&mgaScreen->agp.map) != 0) { - free(mgaScreen); + Xfree(mgaScreen); sPriv->private = NULL; __driUtilMessage("Couldn't map agp region"); return GL_FALSE; @@ -194,7 +209,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) serverInfo->agpTextureSize, (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0) { - free(mgaScreen); + FREE(mgaScreen); sPriv->private = NULL; __driUtilMessage("Couldn't map agptexture region"); return GL_FALSE; @@ -214,13 +229,16 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->bufs = drmMapBufs(sPriv->fd); if (!mgaScreen->bufs) { /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ - free(mgaScreen); + FREE(mgaScreen); sPriv->private = NULL; __driUtilMessage("Couldn't map dma buffers"); return GL_FALSE; } mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset; + /* parse information in __driConfigOptions */ + driParseOptionInfo (&mgaScreen->optionCache); + return GL_TRUE; } @@ -234,7 +252,11 @@ mgaDestroyScreen(__DRIscreenPrivate *sPriv) fprintf(stderr, "mgaDestroyScreen\n"); /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ - free(mgaScreen); + + /* free all option information */ + driDestroyOptionInfo (&mgaScreen->optionCache); + + FREE(mgaScreen); sPriv->private = NULL; } @@ -263,6 +285,10 @@ static const char * const g400_extensions[] = "GL_ARB_multitexture", "GL_ARB_texture_env_add", "GL_EXT_texture_env_add", + "GL_ARB_texture_env_combine", + "GL_EXT_texture_env_combine", + "GL_ARB_texture_env_crossbar", + "GL_ATI_texture_env_combine3", "GL_EXT_texture_edge_clamp", "GL_SGIS_texture_edge_clamp", #if defined (MESA_packed_depth_stencil) @@ -286,6 +312,7 @@ static const char * const card_extensions[] = "GL_MESA_ycbcr_texture", "GL_SGIS_generate_mipmap", "GL_SGIS_texture_lod", + "GL_NV_texture_rectangle", NULL }; @@ -353,6 +380,10 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mmesa->sarea = (void *)saPriv; mmesa->glBuffer = NULL; + /* Parse configuration files */ + driParseConfigFiles (&mmesa->optionCache, &mgaScreen->optionCache, + sPriv->myNum, "mga"); + (void) memset( mmesa->texture_heaps, 0, sizeof( mmesa->texture_heaps ) ); make_empty_list( & mmesa->swapped ); @@ -388,10 +419,10 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mmesa->nr_heaps, & ctx->Const, 4, - 11, /* max 2D texture size is 1024x1024 */ + 11, /* max 2D texture size is 2048x2048 */ 0, /* 3D textures unsupported. */ 0, /* cube textures unsupported. */ - 0, /* texture rectangles unsupported. */ + 11, /* max texture rect size is 2048x2048 */ maxlevels, GL_FALSE ); @@ -487,14 +518,15 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mmesa->vblank_flags = ((mmesa->mgaScreen->irq == 0) || !mmesa->mgaScreen->linecomp_sane) - ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(); + ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache); #ifndef _SOLO - mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( "__glXGetUST" ); - if ( mmesa->get_ust == NULL ) -#endif - { + mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); + if ( mmesa->get_ust == NULL ) { mmesa->get_ust = get_ust_nop; } +#else + mmesa->get_ust = get_ust_nop; +#endif (*mmesa->get_ust)( & mmesa->swap_ust ); @@ -541,6 +573,9 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv) } } + /* free the option cache */ + driDestroyOptionCache (&mmesa->optionCache); + FREE(mmesa); } @@ -614,6 +649,7 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; if (mmesa->driDrawable != driDrawPriv) { + driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags ); mmesa->driDrawable = driDrawPriv; mmesa->dirty = ~0; mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); @@ -695,7 +731,7 @@ static const struct __DriverAPIRec mgaAPI = { * The __driCreateScreen name is the symbol that libGL.so fetches. * Return: pointer to a __DRIscreenPrivate. */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { @@ -714,30 +750,6 @@ void *__driCreateScreen(struct DRIDriverRec *driver, #endif -#ifndef _SOLO -/* This function is called by libGL.so as soon as libGL.so is loaded. - * This is where we'd register new extension functions with the dispatcher. - */ -void -__driRegisterExtensions( void ) -{ - PFNGLXENABLEEXTENSIONPROC glx_enable_extension; - - - if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { - glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC) - glXGetProcAddress( "__glXEnableExtension" ); - - if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE ); - (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE ); - (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE ); - (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE ); - } - } -} -#endif - /** * Get information about previous buffer swaps. */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.h b/src/mesa/drivers/dri/mga/mga_xmesa.h index de349da0895..d372abe0120 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.h +++ b/src/mesa/drivers/dri/mga/mga_xmesa.h @@ -36,6 +36,7 @@ #include "mtypes.h" #include "mgaregs.h" #include "mga_common.h" +#include "xmlconfig.h" typedef struct mga_screen_private_s { @@ -78,6 +79,9 @@ typedef struct mga_screen_private_s { drmRegion primary; drmRegion buffers; unsigned int sarea_priv_offset; + + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; } mgaScreenPrivate; diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 7188f6d9552..50efe4c817f 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -38,6 +38,7 @@ #include "mga_sarea.h" #include "texmem.h" #include "macros.h" +#include "xmlconfig.h" #define MGA_SET_FIELD(reg,mask,val) reg = ((reg) & (mask)) | ((val) & ~(mask)) #define MGA_FIELD(field,val) (((val) << (field ## _SHIFT)) & ~(field ## _MASK)) @@ -79,10 +80,12 @@ typedef void (*mga_point_func)( mgaContextPtr, mgaVertex * ); -/* Reasons why the GL_BLEND fallback mightn't work: +/* GL_BLEND has some limitations */ -#define MGA_BLEND_ENV_COLOR 0x1 -#define MGA_BLEND_MULTITEX 0x2 +#define MGA_BLEND_RGB_ZERO 0x1 +#define MGA_BLEND_RGB_ONE 0x2 +#define MGA_BLEND_ALPHA_ZERO 0x4 +#define MGA_BLEND_ALPHA_ONE 0x8 struct mga_texture_object_s; struct mga_screen_private_s; @@ -149,6 +152,10 @@ typedef struct mga_texture_object_s * to fallback for GL_CLAMP_TO_BORDER. */ GLboolean border_fallback; + /* Depending on multitxturing and environment color + * GL_BLEND may have to be a software fallback. + */ + GLboolean texenv_fallback; } mgaTextureObject_t; struct mga_hw_state { @@ -202,10 +209,11 @@ struct mga_context_t { struct gl_client_array UbyteColor; struct gl_client_array UbyteSecondaryColor; - /* Support for limited GL_BLEND fallback + /* Support for GL_DECAL and GL_BLEND */ unsigned int blend_flags; unsigned int envcolor; + GLboolean dualtex_env; /* Rasterization state */ @@ -299,6 +307,10 @@ struct mga_context_t { __DRIscreenPrivate *driScreen; struct mga_screen_private_s *mgaScreen; MGASAREAPrivPtr sarea; + + /* Configuration cache + */ + driOptionCache optionCache; }; #define MGA_CONTEXT(ctx) ((mgaContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 6b50af202a8..fc53912af4c 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -26,9 +26,8 @@ * Gareth Hughes <[email protected]> */ /* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.16 2002/12/16 16:18:52 dawes Exp $ */ - -#include <sched.h> #include <errno.h> +#include <sched.h> #include "mtypes.h" #include "macros.h" diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 0d304966d7e..29815008be9 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -401,7 +401,7 @@ static void mgaDDColorMask(GLcontext *ctx, */ static int mgaStipples[16] = { - 0xffff1, /* See above note */ + 0xffff, 0xa5a5, 0x5a5a, 0xa0a0, @@ -425,9 +425,6 @@ static int mgaStipples[16] = { * * \param ctx GL rendering context to be affected * \param mask Pointer to the 32x32 stipple mask - * - * \note the fully opaque pattern (0xffff) has been disabled in order - * to work around a conformance issue. */ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) @@ -492,8 +489,7 @@ static void updateSpecularLighting( GLcontext *ctx ) mgaContextPtr mmesa = MGA_CONTEXT(ctx); unsigned int specen; - specen = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR && - ctx->Light.Enabled) ? TMC_specen_enable : 0; + specen = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TMC_specen_enable : 0; if ( specen != mmesa->hw.specen ) { mmesa->hw.specen = specen; @@ -519,14 +515,6 @@ static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, } -static void mgaDDShadeModel(GLcontext *ctx, GLenum mode) -{ - /* FIXME: This used to FLUSH_BATCH and set MGA_NEW_TEXTURE in new_state, - * FIXME: so I'm not sure what to do here now. - */ -} - - /* ============================================================= * Stencil */ @@ -671,6 +659,12 @@ static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, case GL_DECR: stencilctl |= SC_szpassop_decrsat; break; + case GL_INCR_WRAP: + stencilctl |= SC_szpassop_incr; + break; + case GL_DECR_WRAP: + stencilctl |= SC_szpassop_decr; + break; case GL_INVERT: stencilctl |= SC_szpassop_invert; break; @@ -826,8 +820,10 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) else mgaXMesaSetBackClipRects( mmesa ); +#ifndef _SOLO + sarea->req_drawable = driDrawable->draw; sarea->req_draw_buffer = mmesa->draw_buffer; - +#endif mgaUpdateClipping( mmesa->glCtx ); mgaCalcViewport( mmesa->glCtx ); @@ -888,6 +884,11 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) mgaContextPtr mmesa = MGA_CONTEXT( ctx ); switch(cap) { + case GL_LIGHTING: + case GL_COLOR_SUM_EXT: + FLUSH_BATCH( mmesa ); + updateSpecularLighting( ctx ); + break; case GL_ALPHA_TEST: FLUSH_BATCH( mmesa ); mmesa->hw.alpha_func_enable = (state) ? ~0 : 0; @@ -1034,25 +1035,24 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) } if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) { - mmesa->CurrentTexObj[0]->setup.texctl2 &= ~TMC_specen_enable; - mmesa->CurrentTexObj[0]->setup.texctl2 |= mmesa->hw.specen; - memcpy(&sarea->TexState[0], &mmesa->CurrentTexObj[0]->setup, sizeof(sarea->TexState[0])); } if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) { - mmesa->CurrentTexObj[1]->setup.texctl2 &= ~TMC_specen_enable; - mmesa->CurrentTexObj[1]->setup.texctl2 |= mmesa->hw.specen; - memcpy(&sarea->TexState[1], &mmesa->CurrentTexObj[1]->setup, sizeof(sarea->TexState[1])); } - if ( (sarea->TexState[0].texctl2 & TMC_borderen_MASK) != - (sarea->TexState[1].texctl2 & TMC_borderen_MASK) ) { + if (mmesa->dualtex_env) { + sarea->TexState[0].texctl2 |= TMC_dualtex_enable; + memcpy( &sarea->TexState[1], &sarea->TexState[0], + sizeof(sarea->TexState[0]) ); + mmesa->dirty |= MGA_UPLOAD_TEX1|MGA_UPLOAD_TEX0; + } else if ( (sarea->TexState[0].texctl2 & TMC_borderen_MASK) != + (sarea->TexState[1].texctl2 & TMC_borderen_MASK) ) { const int borderen = sarea->TexState[1].texctl2 & ~TMC_borderen_MASK; memcpy( &sarea->TexState[1], &sarea->TexState[0], @@ -1070,15 +1070,10 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) mmesa->sarea->dirty |= mmesa->dirty; mmesa->dirty &= MGA_UPLOAD_CLIPRECTS; - /* This is a bit of a hack but seems to be the best place to ensure - * that separate specular is disabled when not needed. - */ - if (ctx->Texture._EnabledUnits == 0 || - !ctx->Light.Enabled || - ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) { - sarea->TexState[0].texctl2 &= ~TMC_specen_enable; - sarea->TexState[1].texctl2 &= ~TMC_specen_enable; - } + sarea->TexState[0].texctl2 &= ~TMC_specen_enable; + sarea->TexState[1].texctl2 &= ~TMC_specen_enable; + sarea->TexState[0].texctl2 |= mmesa->hw.specen; + sarea->TexState[1].texctl2 |= mmesa->hw.specen; } @@ -1089,21 +1084,21 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) static void mgaDDValidateState( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - int new_state = mmesa->NewGLState; - FLUSH_BATCH( mmesa ); - if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) { - mgaChooseVertexState( ctx ); + if (mmesa->NewGLState & _NEW_TEXTURE) { + mgaUpdateTextureState(ctx); } - if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) { - mgaChooseRenderState( ctx ); - } + if (!mmesa->Fallback) { + if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) { + mgaChooseVertexState( ctx ); + } - if (new_state & _NEW_TEXTURE) { - mgaUpdateTextureState(ctx); + if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) { + mgaChooseRenderState( ctx ); + } } mmesa->NewGLState = 0; @@ -1186,13 +1181,14 @@ void mgaInitState( mgaContextPtr mmesa ) break; } + mmesa->hw.blend_func = AC_src_one | AC_dst_zero; mmesa->hw.zmode = DC_zmode_zlt | DC_atype_zi; mmesa->hw.stencil = (0x0ff << S_smsk_SHIFT) | (0x0ff << S_swtmsk_SHIFT); mmesa->hw.stencilctl = SC_smode_salways | SC_sfailop_keep | SC_szfailop_keep | SC_szpassop_keep; mmesa->hw.stencil_enable = 0; - mmesa->hw.cull = _CULL_NEGATIVE; - mmesa->hw.cull_dualtex = _CULL_POSITIVE; + mmesa->hw.cull = _CULL_DISABLE; + mmesa->hw.cull_dualtex = _CULL_DISABLE; mmesa->hw.specen = 0; mmesa->setup.dwgctl = (DC_opcod_trap | @@ -1227,6 +1223,10 @@ void mgaInitState( mgaContextPtr mmesa ) mmesa->setup.tdualstage1 = 0; mmesa->setup.fcol = 0; mmesa->dirty |= MGA_UPLOAD_CONTEXT; + + mmesa->envcolor = 0; + mmesa->blend_flags = MGA_BLEND_RGB_ZERO | MGA_BLEND_ALPHA_ZERO; + mmesa->dualtex_env = GL_FALSE; } @@ -1243,7 +1243,6 @@ void mgaDDInitStateFuncs( GLcontext *ctx ) ctx->Driver.DepthMask = mgaDDDepthMask; ctx->Driver.Fogfv = mgaDDFogfv; ctx->Driver.Scissor = mgaDDScissor; - ctx->Driver.ShadeModel = mgaDDShadeModel; ctx->Driver.CullFace = mgaDDCullFaceFrontFace; ctx->Driver.FrontFace = mgaDDCullFaceFrontFace; ctx->Driver.ColorMask = mgaDDColorMask; diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 82eccc81498..166bdfc22f3 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -221,7 +221,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA16: case GL_COMPRESSED_ALPHA: /* FIXME: This will report incorrect component sizes... */ - return &_mesa_texformat_argb4444; + return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444; case 1: case GL_LUMINANCE: @@ -231,7 +231,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: /* FIXME: This will report incorrect component sizes... */ - return &_mesa_texformat_rgb565; + return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565; case 2: case GL_LUMINANCE_ALPHA: @@ -243,7 +243,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: /* FIXME: This will report incorrect component sizes... */ - return &_mesa_texformat_argb4444; + return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444; case GL_INTENSITY: case GL_INTENSITY4: @@ -252,7 +252,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: /* FIXME: This will report incorrect component sizes... */ - return &_mesa_texformat_argb4444; + return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444; case GL_YCBCR_MESA: if (MGA_IS_G400(mmesa) && @@ -309,6 +309,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj ) | TF_uvoffset_OGL); t->border_fallback = GL_FALSE; + t->texenv_fallback = GL_FALSE; make_empty_list( & t->base ); @@ -328,31 +329,31 @@ static void mgaDDTexEnv( GLcontext *ctx, GLenum target, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; mgaContextPtr mmesa = MGA_CONTEXT(ctx); - switch( pname ) { case GL_TEXTURE_ENV_COLOR: { GLubyte c[4]; - GLuint envColor; UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor ); - envColor = mgaPackColor( mmesa->mgaScreen->cpp, c[0], c[1], c[2], c[3] ); mmesa->envcolor = PACK_COLOR_8888( c[3], c[0], c[1], c[2] ); - if (mmesa->setup.fcol != envColor) { + if (mmesa->setup.fcol != mmesa->envcolor) { FLUSH_BATCH(mmesa); - mmesa->setup.fcol = envColor; + mmesa->setup.fcol = mmesa->envcolor; mmesa->dirty |= MGA_UPLOAD_CONTEXT; - mmesa->blend_flags &= ~MGA_BLEND_ENV_COLOR; + mmesa->blend_flags = 0; + + if ((mmesa->envcolor & 0xffffff) == 0x0) { + mmesa->blend_flags |= MGA_BLEND_RGB_ZERO; + } else if ((mmesa->envcolor & 0xffffff) == 0xffffff) { + mmesa->blend_flags |= MGA_BLEND_RGB_ONE; + } - /* Actually just require all four components to be - * equal. This permits a single-pass GL_BLEND. - * - * More complex multitexture/multipass fallbacks - * for blend can be done later. - */ - if (mmesa->envcolor != 0x0 && mmesa->envcolor != 0xffffffff) - mmesa->blend_flags |= MGA_BLEND_ENV_COLOR; + if ((mmesa->envcolor >> 24) == 0x0) { + mmesa->blend_flags |= MGA_BLEND_ALPHA_ZERO; + } else if ((mmesa->envcolor >> 24) == 0xff) { + mmesa->blend_flags |= MGA_BLEND_ALPHA_ONE; + } } break; } @@ -445,8 +446,9 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target, * to do anything now */ - if ( (t == NULL) - || (target != GL_TEXTURE_2D) ) { + if ( (t == NULL) || + (target != GL_TEXTURE_2D && + target != GL_TEXTURE_RECTANGLE_NV) ) { return; } @@ -492,7 +494,8 @@ static void mgaDDBindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { - if ( target == GL_TEXTURE_2D ) { + if ( target == GL_TEXTURE_2D || + target == GL_TEXTURE_RECTANGLE_NV ) { if ( tObj->DriverData == NULL ) { mgaAllocTexObj( tObj ); } @@ -547,5 +550,7 @@ mgaDDInitTextureFuncs( GLcontext *ctx ) ctx->Driver.TexEnv = mgaDDTexEnv; ctx->Driver.TexParameter = mgaDDTexParameter; - driInitTextureObjects( ctx, & mmesa->swapped, DRI_TEXMGR_DO_TEXTURE_2D ); + driInitTextureObjects( ctx, & mmesa->swapped, + (DRI_TEXMGR_DO_TEXTURE_2D | + DRI_TEXMGR_DO_TEXTURE_RECT) ); } diff --git a/src/mesa/drivers/dri/mga/mgatex.h b/src/mesa/drivers/dri/mga/mgatex.h index 282577e9f80..94547e38862 100644 --- a/src/mesa/drivers/dri/mga/mgatex.h +++ b/src/mesa/drivers/dri/mga/mgatex.h @@ -46,4 +46,6 @@ void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ); void mgaDDInitTextureFuncs( GLcontext *ctx ); +GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ); + #endif diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index 054c7f0635d..1c193066ff3 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -676,8 +676,7 @@ static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define POINT_FALLBACK (DD_POINT_SMOOTH) #define LINE_FALLBACK (DD_LINE_SMOOTH | DD_LINE_STIPPLE) #define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_UNFILLED) -#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK| \ - DD_TRI_STIPPLE) +#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK) #define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \ DD_TRI_UNFILLED) @@ -688,7 +687,7 @@ void mgaChooseRenderState(GLcontext *ctx) GLuint flags = ctx->_TriangleCaps; GLuint index = 0; - if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) { + if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS|DD_TRI_STIPPLE)) { if (flags & ANY_RASTER_FLAGS) { if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT; if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT; @@ -713,9 +712,11 @@ void mgaChooseRenderState(GLcontext *ctx) if (flags & TRI_FALLBACK) mmesa->draw_tri = mga_fallback_tri; - if ((flags & DD_TRI_STIPPLE) && !mmesa->haveHwStipple) - mmesa->draw_tri = mga_fallback_tri; - + index |= MGA_FALLBACK_BIT; + } + + if ((flags & DD_TRI_STIPPLE) && !mmesa->haveHwStipple) { + mmesa->draw_tri = mga_fallback_tri; index |= MGA_FALLBACK_BIT; } } @@ -782,10 +783,9 @@ void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ) if (ctx->Polygon.StippleFlag && mmesa->haveHwStipple) { mmesa->dirty |= MGA_UPLOAD_CONTEXT; + mmesa->setup.dwgctl &= ~(0xf<<20); if (mmesa->raster_primitive == GL_TRIANGLES) mmesa->setup.dwgctl |= mmesa->poly_stipple; - else - mmesa->setup.dwgctl &= ~(0xf<<20); } } diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index 29b6d05340d..63de3563c45 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -24,7 +24,7 @@ * Authors: * Keith Whitwell <[email protected]> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.14 2002/10/30 12:51:36 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.15 2003/03/26 20:43:49 tsi Exp $ */ #include "mgacontext.h" #include "mgavb.h" @@ -340,6 +340,9 @@ void mgaCheckTexSizes( GLcontext *ctx ) tnl->Driver.Render.Interp = setup_tab[mmesa->SetupIndex].interp; tnl->Driver.Render.CopyPV = setup_tab[mmesa->SetupIndex].copy_pv; } + if (mmesa->Fallback) { + tnl->Driver.Render.Start(ctx); + } } } @@ -456,7 +459,7 @@ void mgaInitVB( GLcontext *ctx ) mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - mmesa->verts = ALIGN_MALLOC(size * sizeof(mgaVertex), 32); + mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * sizeof(mgaVertex), 32); { static int firsttime = 1; diff --git a/src/mesa/drivers/dri/r128/Makefile.X11 b/src/mesa/drivers/dri/r128/Makefile.X11 index 8ae146af915..2a76159cae5 100644 --- a/src/mesa/drivers/dri/r128/Makefile.X11 +++ b/src/mesa/drivers/dri/r128/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.1 2003/08/22 20:11:44 brianp Exp $ +# $Id: Makefile.X11,v 1.1.2.1 2003/11/21 15:49:30 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -36,10 +36,11 @@ DRIVER_SOURCES = \ r128_span.c \ r128_texmem.c \ r128_vb.c \ - ../common/mm.c \ - ../common/utils.c \ - ../common/texmem.c \ - ../common/vblank.c + ../common/mm.c \ + ../common/utils.c \ + ../common/texmem.c \ + ../common/vblank.c \ + ../common/xmlconfig.c INCLUDES = $(MINIGLX_INCLUDES) \ $(SHARED_INCLUDES) @@ -94,6 +95,10 @@ r128_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/r128_dri.so && \ install r128_dri.so $(TOP)/lib/r128_dri.so +$(TOP)/lib/r128_dri.so: r128_dri.so + rm -f $(TOP)/lib/r128_dri.so && \ + install r128_dri.so $(TOP)/lib/r128_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index f7f6d7141d2..e1b003a3587 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -60,6 +60,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "texmem.h" +/* R128 configuration + */ +#include "xmlpool.h" + +const char __driConfigOptions[] = +DRI_CONF_BEGIN +#if ENABLE_PERF_BOXES + DRI_CONF_SECTION_DEBUG + DRI_CONF_PERFORMANCE_BOXES(false) + DRI_CONF_SECTION_END +#endif + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END +DRI_CONF_END; +#if ENABLE_PERF_BOXES +const GLuint __driNConfigOptions = 2; +#else +const GLuint __driNConfigOptions = 1; +#endif + #ifndef R128_DEBUG int R128_DEBUG = 0; #endif @@ -127,6 +148,10 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128scrn = rmesa->r128Screen = (r128ScreenPtr)(sPriv->private); + /* Parse configuration files */ + driParseConfigFiles (&rmesa->optionCache, &r128scrn->optionCache, + r128scrn->driScreen->myNum, "r128"); + rmesa->sarea = (R128SAREAPrivPtr)((char *)sPriv->pSAREA + r128scrn->sarea_priv_offset); @@ -191,7 +216,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, ctx->Const.LineWidthGranularity = 1.0; #if ENABLE_PERF_BOXES - rmesa->boxes = (getenv( "LIBGL_PERFORMANCE_BOXES" ) != NULL); + rmesa->boxes = driQueryOptionb(&rmesa->optionCache, "performance_boxes"); #endif /* Initialize the software rasterizer and helper modules. @@ -224,10 +249,8 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128DDInitTextureFuncs( ctx ); r128DDInitState( rmesa ); - rmesa->do_irqs = (rmesa->r128Screen->irq && !getenv("R128_NO_IRQS")); - - rmesa->vblank_flags = (rmesa->do_irqs) - ? driGetDefaultVBlankFlags() : VBLANK_FLAG_NO_IRQ; + rmesa->vblank_flags = (rmesa->r128Screen->irq != 0) + ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; driContextPriv->driverPrivate = (void *)rmesa; @@ -277,6 +300,9 @@ void r128DestroyContext( __DRIcontextPrivate *driContextPriv ) } } + /* free the option cache */ + driDestroyOptionCache (&rmesa->optionCache); + FREE( rmesa ); } @@ -305,6 +331,7 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv, newR128Ctx->dirty = R128_UPLOAD_ALL; } + driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags ); newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current2( newR128Ctx->glCtx, diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 9c93012eb0f..453ccb6f537 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -178,10 +178,6 @@ struct r128_context { */ GLuint doPageFlip; - /* Busy waiting - */ - GLuint do_irqs; - /* Drawable, cliprect and scissor information */ GLint drawOffset, drawPitch; @@ -222,6 +218,10 @@ struct r128_context { */ GLuint vbl_seq; GLuint vblank_flags; + + /* Configuration cache + */ + driOptionCache optionCache; }; #define R128_CONTEXT(ctx) ((r128ContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index c5843473e12..2f1e3ad8f9a 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -31,7 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Gareth Hughes <[email protected]> * */ -#include <errno.h> +#include <errno.h> #include "r128_context.h" #include "r128_state.h" diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 8a8fc252177..8eee8bbe068 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.8 2002/12/16 16:18:53 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.9 2003/03/26 20:43:49 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -55,7 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PCI_CHIP_RAGE128LE 0x4C45 #define PCI_CHIP_RAGE128LF 0x4C46 -#define PCI_CHIP_RAGE128PD 0x5044 #define PCI_CHIP_RAGE128PF 0x5046 #define PCI_CHIP_RAGE128PR 0x5052 #define PCI_CHIP_RAGE128RE 0x5245 @@ -80,6 +79,9 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) ); if ( !r128Screen ) return NULL; + /* parse information in __driConfigOptions */ + driParseOptionInfo (&r128Screen->optionCache); + /* This is first since which regions we map depends on whether or * not we are using a PCI card. */ @@ -140,7 +142,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RAGE128RL: r128Screen->chipset = R128_CARD_TYPE_R128; break; - case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PF: r128Screen->chipset = R128_CARD_TYPE_R128_PRO; break; @@ -183,7 +184,23 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) } r128Screen->driScreen = sPriv; +#ifndef _SOLO + if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { + PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + void * const psc = sPriv->psc->screenConfigs; + + if ( glx_enable_extension != NULL ) { + if ( r128Screen->irq != 0 ) { + (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + } + (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + } + } +#endif return r128Screen; } @@ -204,6 +221,9 @@ r128DestroyScreen( __DRIscreenPrivate *sPriv ) drmUnmapBufs( r128Screen->buffers ); drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size ); + /* free all option information */ + driDestroyOptionInfo (&r128Screen->optionCache); + FREE( r128Screen ); sPriv->private = NULL; } @@ -290,10 +310,13 @@ r128InitDriver( __DRIscreenPrivate *sPriv ) return GL_TRUE; } - #ifndef _SOLO -/* This function is called by libGL.so as soon as libGL.so is loaded. +/** + * This function is called by libGL.so as soon as libGL.so is loaded. * This is where we register new extension functions with the dispatcher. + * + * \todo This interface has been deprecated, so we should probably remove + * this function before the next XFree86 release. */ void __driRegisterExtensions( void ) { @@ -301,7 +324,7 @@ void __driRegisterExtensions( void ) if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC) - glXGetProcAddress( "__glXEnableExtension" ); + glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" ); if ( glx_enable_extension != NULL ) { glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE ); @@ -338,7 +361,7 @@ static struct __DriverAPIRec r128API = { * The __driCreateScreen name is the symbol that libGL.so fetches. * Return: pointer to a __DRIscreenPrivate. */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 4b1a57292d9..affe9e69ef1 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -39,6 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING #include "r128_sarea.h" +#include "xmlconfig.h" typedef struct { drmHandle handle; /* Handle to the DRM region */ @@ -77,6 +78,9 @@ typedef struct { __DRIscreenPrivate *driScreen; unsigned int sarea_priv_offset; + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; + } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 85b3b68402d..110a16a8316 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -706,7 +706,7 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) break; } - /* We want to update the s/w rast state too so that r200SetBuffer() + /* We want to update the s/w rast state too so that r128DDSetBuffer() * gets called. */ _swrast_DrawBuffer(ctx, mode); diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index f6a5dfbbcf3..7bffaf46287 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texmem.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 3f4347b02e8..3c43eb45286 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texstate.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -90,17 +90,11 @@ static void r128SetTexImages( r128ContextPtr rmesa, }; /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. */ - firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + firstLevel = t->base.firstLevel; + lastLevel = t->base.lastLevel; log2Pitch = tObj->Image[firstLevel]->WidthLog2; log2Height = tObj->Image[firstLevel]->HeightLog2; diff --git a/src/mesa/drivers/dri/r128/r128_vb.c b/src/mesa/drivers/dri/r128/r128_vb.c index 48cdcd5e368..6c52975286f 100644 --- a/src/mesa/drivers/dri/r128/r128_vb.c +++ b/src/mesa/drivers/dri/r128/r128_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.15 2002/10/30 12:51:43 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.16 2003/03/26 20:43:49 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -361,6 +361,9 @@ void r128CheckTexSizes( GLcontext *ctx ) tnl->Driver.Render.Interp = setup_tab[rmesa->SetupIndex].interp; tnl->Driver.Render.CopyPV = setup_tab[rmesa->SetupIndex].copy_pv; } + if (rmesa->Fallback) { + tnl->Driver.Render.Start(ctx); + } } } @@ -489,7 +492,7 @@ void r128InitVB( GLcontext *ctx ) r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - rmesa->verts = ALIGN_MALLOC(size * 4 * 16, 32); + rmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32); { static int firsttime = 1; diff --git a/src/mesa/drivers/dri/r200/Makefile.X11 b/src/mesa/drivers/dri/r200/Makefile.X11 index 62f4b4b94c1..4d3ea1b9e03 100644 --- a/src/mesa/drivers/dri/r200/Makefile.X11 +++ b/src/mesa/drivers/dri/r200/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.4 2003/10/03 14:03:18 brianp Exp $ +# $Id: Makefile.X11,v 1.3.2.1 2003/11/21 15:49:30 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -33,6 +33,7 @@ DRIVER_SOURCES = r200_context.c \ ../common/utils.c \ ../common/texmem.c \ ../common/vblank.c \ + ../common/xmlconfig.c \ r200_cmdbuf.c \ r200_pixel.c \ r200_tex.c \ @@ -118,6 +119,10 @@ r200_dri.so: $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/r200_dri.so && \ install r200_dri.so $(TOP)/lib/r200_dri.so +$(TOP)/lib/r200_dri.so: r200_dri.so + rm -f $(TOP)/lib/r200_dri.so && \ + install r200_dri.so $(TOP)/lib/r200_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index a64b32d9160..3a4fa30bcf6 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c,v 1.1 2002/10/30 12:51:51 alanh Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index ca6ce4974ae..53aa711cc1e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -69,7 +68,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. int R200_DEBUG = (0); #endif - +/* R200 configuration + */ +#include "xmlpool.h" + + +const char __driConfigOptions[] = +DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN) + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_PREFERRED_BPT(0,"0,16,32") + DRI_CONF_SECTION_END + DRI_CONF_SECTION_DEBUG + DRI_CONF_NO_RAST(false) + DRI_CONF_SECTION_END +DRI_CONF_END; +const GLuint __driNConfigOptions = 5; /* Return the width and height of the given buffer. */ @@ -224,7 +242,7 @@ static const struct dri_debug_control debug_control[] = static int -get_ust_nop( int64_t * ust ) +get_ust_nop( uint64_t * ust ) { *ust = 1; return 0; @@ -242,6 +260,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, r200ContextPtr rmesa; GLcontext *ctx, *shareCtx; int i; + int tcl_mode, fthrottle_mode, preferred_bpt; assert(glVisual); assert(driContextPriv); @@ -273,6 +292,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->dri.fd = sPriv->fd; rmesa->dri.drmMinor = sPriv->drmMinor; + /* Parse configuration files */ + driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, + screen->driScreen->myNum, "r200"); rmesa->r200Screen = screen; rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA + screen->sarea_priv_offset); @@ -295,6 +317,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, sizeof( r200TexObj ), (destroy_texture_object_t *) r200DestroyTexObj ); } + preferred_bpt = driQueryOptioni (&rmesa->optionCache, "preferred_bpt"); + rmesa->default32BitTextures = + ( ( preferred_bpt == 0 && screen->cpp == 4 ) || preferred_bpt == 32 ); rmesa->swtcl.RenderIndex = ~0; rmesa->lost_context = 1; @@ -382,36 +407,38 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, r200InitState( rmesa ); r200InitSwtcl( ctx ); + fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode"); rmesa->iw.irq_seq = -1; rmesa->irqsEmitted = 0; rmesa->do_irqs = (rmesa->dri.drmMinor >= 6 && - !getenv("R200_NO_IRQS") && + fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && rmesa->r200Screen->irq); + rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); + if (!rmesa->do_irqs) - fprintf(stderr, - "IRQ's not enabled, falling back to busy waits: %d %d %d\n", + fprintf(stderr, + "IRQ's not enabled, falling back to %s: %d %d %d\n", + rmesa->do_usleeps ? "usleeps" : "busy waits", rmesa->dri.drmMinor, - !!getenv("R200_NO_IRQS"), + fthrottle_mode, rmesa->r200Screen->irq); + rmesa->vblank_flags = (rmesa->r200Screen->irq != 0) + ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - rmesa->do_usleeps = !getenv("R200_NO_USLEEPS"); - - rmesa->vblank_flags = (rmesa->do_irqs) - ? driGetDefaultVBlankFlags() : VBLANK_FLAG_NO_IRQ; - - rmesa->prefer_agp_client_texturing = - (getenv("R200_AGP_CLIENT_TEXTURES") != 0); - -#ifndef _SOLO - rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( "__glXGetUST" ); + rmesa->prefer_gart_client_texturing = + (getenv("R200_GART_CLIENT_TEXTURES") != 0); +#ifndef _SOLO + rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); if ( rmesa->get_ust == NULL ) { rmesa->get_ust = get_ust_nop; } - - (*rmesa->get_ust)( & rmesa->swap_ust ); +#else + rmesa->get_ust = get_ust_nop; #endif + (*rmesa->get_ust)( & rmesa->swap_ust ); + #if DO_DEBUG R200_DEBUG = driParseDebugString( getenv( "R200_DEBUG" ), @@ -420,17 +447,18 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, debug_control ); #endif - if (getenv("R200_NO_RAST")) { + tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (driQueryOptionb(&rmesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1); } - else if (getenv("R200_NO_TCL")) { + else if (tcl_mode == DRI_CONF_TCL_SW) { fprintf(stderr, "disabling TCL support\n"); TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1); } else { - if (!getenv("R200_NO_VTXFMT")) { - r200VtxfmtInit( ctx ); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) { + r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN ); } _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); } @@ -474,9 +502,11 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) r200FlushCmdBuf( rmesa, __FUNCTION__ ); } - if (!rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE) - if (!getenv("R200_NO_VTXFMT")) + if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) { + int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) r200VtxfmtDestroy( rmesa->glCtx ); + } /* free the Mesa context */ rmesa->glCtx->DriverCtx = NULL; @@ -492,7 +522,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) * texture object data. */ int i; - + /* this assert is wrong. The default textures are always on swap list assert( is_empty_list( & rmesa->swapped ) ); */ @@ -502,6 +532,9 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) } } + /* free the option cache */ + driDestroyOptionCache (&rmesa->optionCache); + FREE( rmesa ); } } @@ -550,6 +583,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv, fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx); if ( newCtx->dri.drawable != driDrawPriv ) { + driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags ); newCtx->dri.drawable = driDrawPriv; r200UpdateWindow( newCtx->glCtx ); r200UpdateViewportOffset( newCtx->glCtx ); diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 9e00d7a3585..7421db97e6c 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -532,7 +531,7 @@ struct r200_dma_buffer { drmBufPtr buf; }; -#define GET_START(rvb) (rmesa->r200Screen->agp_buffer_offset + \ +#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \ (rvb)->address - rmesa->dma.buf0_address + \ (rvb)->start) @@ -779,6 +778,7 @@ struct r200_context { unsigned nr_heaps; driTexHeap * texture_heaps[ R200_NR_TEX_HEAPS ]; driTextureObject swapped; + GLboolean default32BitTextures; /* Rasterization and vertex state: @@ -812,7 +812,7 @@ struct r200_context { /* Clientdata textures; */ - GLuint prefer_agp_client_texturing; + GLuint prefer_gart_client_texturing; /* Drawable, cliprect and scissor information */ @@ -863,6 +863,10 @@ struct r200_context { /* Mirrors of some DRI state */ struct r200_dri_mirror dri; + + /* Configuration cache + */ + driOptionCache optionCache; }; #define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 480121a094d..af7c3a0e629 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -33,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Keith Whitwell <[email protected]> */ - + #include <sched.h> #include <errno.h> @@ -773,7 +772,7 @@ void r200Finish( GLcontext *ctx ) } -/* This version of AllocateMemoryNV allocates only agp memory, and +/* This version of AllocateMemoryMESA allocates only GART memory, and * only does so after the point at which the driver has been * initialized. * @@ -782,8 +781,9 @@ void r200Finish( GLcontext *ctx ) * the kernel data structures, and the current context to get the * device fd. */ -void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, - GLfloat writefreq, GLfloat priority) +void *r200AllocateMemoryMESA(GLsizei size, + GLfloat readfreq, GLfloat writefreq, + GLfloat priority) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -795,7 +795,7 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq, writefreq, priority); - if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || rmesa->r200Screen->IsPCI ) + if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) return NULL; if (getenv("R200_NO_ALLOC")) @@ -804,7 +804,7 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, if (rmesa->dri.drmMinor < 6) return NULL; - alloc.region = RADEON_MEM_REGION_AGP; + alloc.region = RADEON_MEM_REGION_GART; alloc.alignment = 0; alloc.size = size; alloc.region_offset = ®ion_offset; @@ -819,14 +819,14 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, } { - char *region_start = (char *)rmesa->r200Screen->agpTextures.map; + char *region_start = (char *)rmesa->r200Screen->gartTextures.map; return (void *)(region_start + region_offset); } } -/* Called via glXFreeMemoryNV() */ -void r200FreeMemoryNV(GLvoid *pointer) +/* Called via glXFreeMemoryMESA() */ +void r200FreeMemoryMESA(GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -837,7 +837,7 @@ void r200FreeMemoryNV(GLvoid *pointer) if (R200_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s %p\n", __FUNCTION__, pointer); - if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || rmesa->r200Screen->IsPCI ) { + if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) { fprintf(stderr, "%s: no context\n", __FUNCTION__); return; } @@ -845,16 +845,16 @@ void r200FreeMemoryNV(GLvoid *pointer) if (rmesa->dri.drmMinor < 6) return; - region_offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; if (region_offset < 0 || - region_offset > rmesa->r200Screen->agpTextures.size) { + region_offset > rmesa->r200Screen->gartTextures.size) { fprintf(stderr, "offset %d outside range 0..%d\n", region_offset, - rmesa->r200Screen->agpTextures.size); + rmesa->r200Screen->gartTextures.size); return; } - memfree.region = RADEON_MEM_REGION_AGP; + memfree.region = RADEON_MEM_REGION_GART; memfree.region_offset = region_offset; ret = drmCommandWrite( rmesa->r200Screen->driScreen->fd, @@ -865,8 +865,8 @@ void r200FreeMemoryNV(GLvoid *pointer) fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret); } -/* Called via glXGetAGPOffsetMESA() */ -GLuint r200GetAGPOffset(const GLvoid *pointer) +/* Called via glXGetMemoryOffsetMESA() */ +GLuint r200GetMemoryOffsetMESA(const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -877,41 +877,41 @@ GLuint r200GetAGPOffset(const GLvoid *pointer) return ~0; } - if (!r200IsAgpMemory( rmesa, pointer, 0 )) + if (!r200IsGartMemory( rmesa, pointer, 0 )) return ~0; if (rmesa->dri.drmMinor < 6) return ~0; - card_offset = r200AgpOffsetFromVirtual( rmesa, pointer ); + card_offset = r200GartOffsetFromVirtual( rmesa, pointer ); - return card_offset - rmesa->r200Screen->agp_base; + return card_offset - rmesa->r200Screen->gart_base; } -GLboolean r200IsAgpMemory( r200ContextPtr rmesa, const GLvoid *pointer, +GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, GLint size ) { - int offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; int valid = (size >= 0 && offset >= 0 && - offset + size < rmesa->r200Screen->agpTextures.size); + offset + size < rmesa->r200Screen->gartTextures.size); if (R200_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "r200IsAgpMemory( %p ) : %d\n", pointer, valid ); + fprintf(stderr, "r200IsGartMemory( %p ) : %d\n", pointer, valid ); return valid; } -GLuint r200AgpOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer ) +GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer ) { - int offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; - if (offset < 0 || offset > rmesa->r200Screen->agpTextures.size) + if (offset < 0 || offset > rmesa->r200Screen->gartTextures.size) return ~0; else - return rmesa->r200Screen->agp_texture_offset + offset; + return rmesa->r200Screen->gart_texture_offset + offset; } diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 5025c1d2304..a76dbd2ad12 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -106,15 +105,15 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForVBlank( r200ContextPtr rmesa ); extern void r200InitIoctlFuncs( GLcontext *ctx ); -extern void *r200AllocateMemoryNV( GLsizei size, GLfloat readfreq, +extern void *r200AllocateMemoryMESA( GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority ); -extern void r200FreeMemoryNV( GLvoid *pointer ); -extern GLuint r200GetAGPOffset( const GLvoid *pointer ); -extern GLboolean r200IsAgpMemory( r200ContextPtr rmesa, const GLvoid *pointer, - GLint size ); +extern void r200FreeMemoryMESA( GLvoid *pointer ); +extern GLuint r200GetMemoryOffsetMESA( const GLvoid *pointer ); +extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, + GLint size ); -extern GLuint r200AgpOffsetFromVirtual( r200ContextPtr rmesa, - const GLvoid *pointer ); +extern GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, + const GLvoid *pointer ); /* ================================================================ * Helper macros: diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c index c2c5d30c582..9d6cff50ae4 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.c +++ b/src/mesa/drivers/dri/r200/r200_lock.c @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -81,6 +81,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa ) void r200GetLock( r200ContextPtr rmesa, GLuint flags ) { __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; + __DRIscreenPrivate *sPriv = rmesa->dri.screen; RADEONSAREAPrivPtr sarea = rmesa->sarea; int i; diff --git a/src/mesa/drivers/dri/r200/r200_lock.h b/src/mesa/drivers/dri/r200/r200_lock.h index 59bc1d656e1..7a4dfcf15cc 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.h +++ b/src/mesa/drivers/dri/r200/r200_lock.h @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_maos.h b/src/mesa/drivers/dri/r200/r200_maos.h index 0dfcc5c3ffb..a430497db98 100644 --- a/src/mesa/drivers/dri/r200/r200_maos.h +++ b/src/mesa/drivers/dri/r200/r200_maos.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 0263d009026..b442dce207a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -174,6 +174,28 @@ static void emit_ubyte_rgba( GLcontext *ctx, } +static void emit_vec4( GLcontext *ctx, + struct r200_dma_region *rvb, + char *data, + int stride, + int count ) +{ + int i; + int *out = (int *)(rvb->address + rvb->start); + + if (R200_DEBUG & DEBUG_VERTS) + fprintf(stderr, "%s count %d stride %d\n", + __FUNCTION__, count, stride); + + if (stride == 4) + COPY_DWORDS( out, data, count ); + else + for (i = 0; i < count; i++) { + out[0] = *(int *)data; + out++; + data += stride; + } +} static void emit_vec8( GLcontext *ctx, @@ -284,6 +306,9 @@ static void emit_vector( GLcontext *ctx, /* Emit the data */ switch (size) { + case 1: + emit_vec4( ctx, rvb, data, stride, count ); + break; case 2: emit_vec8( ctx, rvb, data, stride, count ); break; @@ -303,7 +328,7 @@ static void emit_vector( GLcontext *ctx, -/* Emit any changed arrays to new agp memory, re-emit a packet to +/* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) diff --git a/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h b/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h index a36be45b275..ce258d7988a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h +++ b/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_maos_verts.c b/src/mesa/drivers/dri/r200/r200_maos_verts.c index cd866f661f7..872bbd47f5c 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_verts.c +++ b/src/mesa/drivers/dri/r200/r200_maos_verts.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 94977efd186..29eab6cd2fb 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -160,12 +160,12 @@ r200TryReadPixels( GLcontext *ctx, if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); - /* Only accelerate reading to agp buffers. + /* Only accelerate reading to GART buffers. */ - if ( !r200IsAgpMemory(rmesa, pixels, + if ( !r200IsGartMemory(rmesa, pixels, pitch * height * rmesa->r200Screen->cpp ) ) { if (R200_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: dest not agp\n", __FUNCTION__); + fprintf(stderr, "%s: dest not GART\n", __FUNCTION__); return GL_FALSE; } @@ -217,7 +217,7 @@ r200TryReadPixels( GLcontext *ctx, int nbox = dPriv->numClipRects; int src_offset = rmesa->state.color.drawOffset; int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp; - int dst_offset = r200AgpOffsetFromVirtual( rmesa, pixels); + int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels ); int dst_pitch = pitch * rmesa->r200Screen->cpp; XF86DRIClipRectRec *box = dPriv->pClipRects; int i; @@ -297,7 +297,7 @@ static void do_draw_pix( GLcontext *ctx, int i; int blit_format; int size; - int src_offset = r200AgpOffsetFromVirtual( rmesa, pixels); + int src_offset = r200GartOffsetFromVirtual( rmesa, pixels ); int src_pitch = pitch * rmesa->r200Screen->cpp; if (R200_DEBUG & DEBUG_PIXEL) @@ -402,11 +402,11 @@ r200TryDrawPixels( GLcontext *ctx, if (planemask != ~0) return GL_FALSE; /* fix me -- should be possible */ - /* Can't do conversions on agp reads/draws. + /* Can't do conversions on GART reads/draws. */ - if ( !r200IsAgpMemory( rmesa, pixels, size ) ) { + if ( !r200IsGartMemory( rmesa, pixels, size ) ) { if (R200_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: not agp memory\n", __FUNCTION__); + fprintf(stderr, "%s: not GART memory\n", __FUNCTION__); return GL_FALSE; } @@ -426,7 +426,7 @@ r200TryDrawPixels( GLcontext *ctx, return GL_FALSE; } - if ( r200IsAgpMemory(rmesa, pixels, size) ) + if ( r200IsGartMemory(rmesa, pixels, size) ) { do_draw_pix( ctx, x, y, width, height, pitch, pixels, dest, planemask ); diff --git a/src/mesa/drivers/dri/r200/r200_pixel.h b/src/mesa/drivers/dri/r200/r200_pixel.h index 8e7aca1a16e..9282d2b147d 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.h +++ b/src/mesa/drivers/dri/r200/r200_pixel.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_reg.h b/src/mesa/drivers/dri/r200/r200_reg.h index cc0ae503279..8e9126342f1 100644 --- a/src/mesa/drivers/dri/r200/r200_reg.h +++ b/src/mesa/drivers/dri/r200/r200_reg.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -1434,11 +1434,5 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R200_CP_CMD_BITBLT_MULTI 0xC0009B00 #define R200_CP_CMD_TRANS_BITBLT 0xC0009C00 - -#define R200_AGP_TEX_OFFSET 0x02000000 - - - - #endif diff --git a/src/mesa/drivers/dri/r200/r200_sanity.c b/src/mesa/drivers/dri/r200/r200_sanity.c index 11dd36a05cc..291536d5603 100644 --- a/src/mesa/drivers/dri/r200/r200_sanity.c +++ b/src/mesa/drivers/dri/r200/r200_sanity.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_sanity.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ /************************************************************************** Copyright 2002 ATI Technologies Inc., Ontario, Canada, and @@ -32,7 +32,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <[email protected]> * */ -#include <errno.h> + +#include <errno.h> #include "glheader.h" #include "imports.h" diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index ee52d68a779..4216046d198 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.c,v 1.4 2003/05/08 09:25:35 herrb Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -43,14 +42,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_screen.h" #include "r200_context.h" #include "r200_ioctl.h" +#include "radeon_macros.h" +#include "radeon_reg.h" #include "utils.h" #include "vblank.h" - #ifndef _SOLO #include "glxextensions.h" -#endif - +#endif #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... */ @@ -108,6 +107,8 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) break; } + /* parse information in __driConfigOptions */ + driParseOptionInfo (&screen->optionCache); /* This is first since which regions we map depends on whether or * not we are using a PCI card. @@ -118,30 +119,26 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) int ret; drmRadeonGetParam gp; - gp.param = RADEON_PARAM_AGP_BUFFER_OFFSET; - gp.value = &screen->agp_buffer_offset; + gp.param = RADEON_PARAM_GART_BUFFER_OFFSET; + gp.value = &screen->gart_buffer_offset; ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (ret) { FREE( screen ); - fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_AGP_BUFFER_OFFSET): %d\n", ret); + fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret); return NULL; } - screen->agp_texture_offset = - screen->agp_buffer_offset + 2*1024*1024; - - if (sPriv->drmMinor >= 6) { - gp.param = RADEON_PARAM_AGP_BASE; - gp.value = &screen->agp_base; + gp.param = RADEON_PARAM_GART_BASE; + gp.value = &screen->gart_base; ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (ret) { FREE( screen ); - fprintf(stderr, "drmR200GetParam (RADEON_PARAM_AGP_BASE): %d\n", ret); + fprintf(stderr, "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n", ret); return NULL; } @@ -196,23 +193,27 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } - if ( !screen->IsPCI ) { - screen->agpTextures.handle = dri_priv->agpTexHandle; - screen->agpTextures.size = dri_priv->agpTexMapSize; + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { + unsigned char *RADEONMMIO = screen->mmio.map; + + screen->gartTextures.handle = dri_priv->gartTexHandle; + screen->gartTextures.size = dri_priv->gartTexMapSize; if ( drmMap( sPriv->fd, - screen->agpTextures.handle, - screen->agpTextures.size, - (drmAddressPtr)&screen->agpTextures.map ) ) { + screen->gartTextures.handle, + screen->gartTextures.size, + (drmAddressPtr)&screen->gartTextures.map ) ) { drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); FREE( screen ); - __driUtilMessage("%s: IsPCI failed\n", __FUNCTION__); + __driUtilMessage("%s: drmMAP failed for GART texture area\n", __FUNCTION__); return NULL; } - } - + screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI + ? INREG( RADEON_AIC_LO_ADDR ) + : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) ); + } screen->cpp = dri_priv->bpp / 8; screen->AGPMode = dri_priv->AGPMode; @@ -229,22 +230,46 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) screen->logTexGranularity[RADEON_CARD_HEAP] = dri_priv->log2TexGran; - if ( screen->IsPCI ) { + if ( !screen->gartTextures.map ) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; - screen->texOffset[RADEON_AGP_HEAP] = 0; - screen->texSize[RADEON_AGP_HEAP] = 0; - screen->logTexGranularity[RADEON_AGP_HEAP] = 0; + screen->texOffset[RADEON_GART_HEAP] = 0; + screen->texSize[RADEON_GART_HEAP] = 0; + screen->logTexGranularity[RADEON_GART_HEAP] = 0; } else { screen->numTexHeaps = RADEON_NR_TEX_HEAPS; - screen->texOffset[RADEON_AGP_HEAP] = - dri_priv->agpTexOffset + R200_AGP_TEX_OFFSET; - screen->texSize[RADEON_AGP_HEAP] = dri_priv->agpTexMapSize; - screen->logTexGranularity[RADEON_AGP_HEAP] = - dri_priv->log2AGPTexGran; + screen->texOffset[RADEON_GART_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_GART_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_GART_HEAP] = + dri_priv->log2GARTTexGran; } screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; +#ifndef _SOLO + if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { + PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + void * const psc = sPriv->psc->screenConfigs; + + if ( glx_enable_extension != NULL ) { + if ( screen->irq != 0 ) { + (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + } + + (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + + if ( driCompareGLXAPIVersion( 20030818 ) >= 0 ) { + sPriv->psc->allocateMemory = r200AllocateMemoryMESA; + sPriv->psc->freeMemory = r200FreeMemoryMESA; + sPriv->psc->memoryOffset = r200GetMemoryOffsetMESA; + + (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" ); + } + } + } +#endif return screen; } @@ -258,14 +283,16 @@ r200DestroyScreen( __DRIscreenPrivate *sPriv ) if (!screen) return; - if ( !screen->IsPCI ) { - drmUnmap( screen->agpTextures.map, - screen->agpTextures.size ); + if ( screen->gartTextures.map ) { + drmUnmap( screen->gartTextures.map, screen->gartTextures.size ); } drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); + /* free all option information */ + driDestroyOptionInfo (&screen->optionCache); + FREE( screen ); sPriv->private = NULL; } @@ -362,7 +389,7 @@ static struct __DriverAPIRec r200API = { * Return: pointer to a __DRIscreenPrivate. * */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { @@ -380,56 +407,31 @@ void *__driCreateScreen(struct DRIDriverRec *driver, } #endif - - #ifndef _SOLO -/* This function is called by libGL.so to allow the driver to dynamically +/** + * This function is called by libGL.so to allow the driver to dynamically * extend libGL. We can add new GLX functions and/or new GL functions. * Note that _mesa_create_context() will probably add most of the newer * OpenGL extension functions into the dispatcher. + * + * \todo This interface has been deprecated, so we should probably remove + * this function before the next XFree86 release. */ void __driRegisterExtensions( void ) { PFNGLXENABLEEXTENSIONPROC glx_enable_extension; - typedef void *(*registerFunc)(const char *funcName, void *funcAddr); - registerFunc regFunc; if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC) - glXGetProcAddress( "__glXEnableExtension" ); + glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" ); if ( glx_enable_extension != NULL ) { - glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE ); - glx_enable_extension( "GLX_SGI_video_sync", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_control", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_frame_usage", GL_FALSE ); - - - /* Get pointers to libGL's __glXRegisterGLXFunction - * and __glXRegisterGLXExtensionString, if they exist. - */ - regFunc = (registerFunc) glXGetProcAddress( "__glXRegisterGLXFunction" ); - - if (regFunc) { - /* register our GLX extensions with libGL */ - void *p; - p = regFunc("glXAllocateMemoryNV", (void *) r200AllocateMemoryNV); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - p = regFunc("glXFreeMemoryNV", (void *) r200FreeMemoryNV); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - p = regFunc("glXGetAGPOffsetMESA", (void *) r200GetAGPOffset); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - glx_enable_extension( "GLX_NV_vertex_array_range", GL_TRUE ); - glx_enable_extension( "GLX_MESA_agp_offset", GL_TRUE ); - } + (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE ); } } } diff --git a/src/mesa/drivers/dri/r200/r200_screen.h b/src/mesa/drivers/dri/r200/r200_screen.h index 1e1f125b0d5..3ed4f550282 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.h +++ b/src/mesa/drivers/dri/r200/r200_screen.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -43,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86drm.h" #include "radeon_common.h" #include "radeon_sarea.h" +#include "xmlconfig.h" typedef struct { drmHandle handle; /* Handle to the DRM region */ @@ -80,7 +80,7 @@ typedef struct { r200RegionRec mmio; r200RegionRec status; - r200RegionRec agpTextures; + r200RegionRec gartTextures; drmBufMapPtr buffers; @@ -88,11 +88,14 @@ typedef struct { __DRIscreenPrivate *driScreen; unsigned int sarea_priv_offset; - unsigned int agp_buffer_offset; /* offset in card memory space */ - unsigned int agp_texture_offset; /* offset in card memory space */ - unsigned int agp_base; + unsigned int gart_buffer_offset; /* offset in card memory space */ + unsigned int gart_texture_offset; /* offset in card memory space */ + unsigned int gart_base; GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */ + + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; } r200ScreenRec, *r200ScreenPtr; #endif diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c index b469aec429b..7e48a9d5afb 100644 --- a/src/mesa/drivers/dri/r200/r200_span.c +++ b/src/mesa/drivers/dri/r200/r200_span.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_span.h b/src/mesa/drivers/dri/r200/r200_span.h index 269ac0593fd..72911e9455c 100644 --- a/src/mesa/drivers/dri/r200/r200_span.h +++ b/src/mesa/drivers/dri/r200/r200_span.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_state.c~ b/src/mesa/drivers/dri/r200/r200_state.c~ deleted file mode 100644 index f025a88472c..00000000000 --- a/src/mesa/drivers/dri/r200/r200_state.c~ +++ /dev/null @@ -1,2168 +0,0 @@ -/* $XFree86$ */ -/************************************************************************** - -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Keith Whitwell <[email protected]> - */ - -#include "glheader.h" -#include "imports.h" -#include "api_arrayelt.h" -#include "enums.h" -#include "colormac.h" - -#include "swrast/swrast.h" -#include "array_cache/acache.h" -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" -#include "swrast_setup/swrast_setup.h" - - -#include "r200_context.h" -#include "r200_ioctl.h" -#include "r200_state.h" -#include "r200_tcl.h" -#include "r200_tex.h" -#include "r200_swtcl.h" -#include "r200_vtxfmt.h" - - -/* ============================================================= - * Alpha blending - */ - -static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC]; - GLubyte refByte; - - CLAMPED_FLOAT_TO_UBYTE(refByte, ref); - - R200_STATECHANGE( rmesa, ctx ); - - pp_misc &= ~(R200_ALPHA_TEST_OP_MASK | R200_REF_ALPHA_MASK); - pp_misc |= (refByte & R200_REF_ALPHA_MASK); - - switch ( func ) { - case GL_NEVER: - pp_misc |= R200_ALPHA_TEST_FAIL; - break; - case GL_LESS: - pp_misc |= R200_ALPHA_TEST_LESS; - break; - case GL_EQUAL: - pp_misc |= R200_ALPHA_TEST_EQUAL; - break; - case GL_LEQUAL: - pp_misc |= R200_ALPHA_TEST_LEQUAL; - break; - case GL_GREATER: - pp_misc |= R200_ALPHA_TEST_GREATER; - break; - case GL_NOTEQUAL: - pp_misc |= R200_ALPHA_TEST_NEQUAL; - break; - case GL_GEQUAL: - pp_misc |= R200_ALPHA_TEST_GEQUAL; - break; - case GL_ALWAYS: - pp_misc |= R200_ALPHA_TEST_PASS; - break; - } - - rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc; -} - -static void r200BlendEquation( GLcontext *ctx, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~R200_COMB_FCN_MASK; - - switch ( mode ) { - case GL_FUNC_ADD: - case GL_LOGIC_OP: - b |= R200_COMB_FCN_ADD_CLAMP; - break; - - case GL_FUNC_SUBTRACT: - b |= R200_COMB_FCN_SUB_CLAMP; - break; - - case GL_FUNC_REVERSE_SUBTRACT: - b |= R200_COMB_FCN_RSUB_CLAMP; - break; - - case GL_MIN: - b |= R200_COMB_FCN_MIN; - break; - - case GL_MAX: - b |= R200_COMB_FCN_MAX; - break; - - default: - break; - } - - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b; - if ( ctx->Color.ColorLogicOpEnabled ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE; - } -} - -static void r200BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & - ~(R200_SRC_BLEND_MASK | R200_DST_BLEND_MASK); - - switch ( ctx->Color.BlendSrcRGB ) { - case GL_ZERO: - b |= R200_SRC_BLEND_GL_ZERO; - break; - case GL_ONE: - b |= R200_SRC_BLEND_GL_ONE; - break; - case GL_DST_COLOR: - b |= R200_SRC_BLEND_GL_DST_COLOR; - break; - case GL_ONE_MINUS_DST_COLOR: - b |= R200_SRC_BLEND_GL_ONE_MINUS_DST_COLOR; - break; - case GL_SRC_COLOR: - b |= R200_SRC_BLEND_GL_SRC_COLOR; - break; - case GL_ONE_MINUS_SRC_COLOR: - b |= R200_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR; - break; - case GL_SRC_ALPHA: - b |= R200_SRC_BLEND_GL_SRC_ALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: - b |= R200_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA; - break; - case GL_DST_ALPHA: - b |= R200_SRC_BLEND_GL_DST_ALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: - b |= R200_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA; - break; - case GL_SRC_ALPHA_SATURATE: - b |= R200_SRC_BLEND_GL_SRC_ALPHA_SATURATE; - break; - case GL_CONSTANT_COLOR: - b |= R200_SRC_BLEND_GL_CONST_COLOR; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - b |= R200_SRC_BLEND_GL_ONE_MINUS_CONST_COLOR; - break; - case GL_CONSTANT_ALPHA: - b |= R200_SRC_BLEND_GL_CONST_ALPHA; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - b |= R200_SRC_BLEND_GL_ONE_MINUS_CONST_ALPHA; - break; - default: - break; - } - - switch ( ctx->Color.BlendDstRGB ) { - case GL_ZERO: - b |= R200_DST_BLEND_GL_ZERO; - break; - case GL_ONE: - b |= R200_DST_BLEND_GL_ONE; - break; - case GL_SRC_COLOR: - b |= R200_DST_BLEND_GL_SRC_COLOR; - break; - case GL_ONE_MINUS_SRC_COLOR: - b |= R200_DST_BLEND_GL_ONE_MINUS_SRC_COLOR; - break; - case GL_SRC_ALPHA: - b |= R200_DST_BLEND_GL_SRC_ALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: - b |= R200_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA; - break; - case GL_DST_COLOR: - b |= R200_DST_BLEND_GL_DST_COLOR; - break; - case GL_ONE_MINUS_DST_COLOR: - b |= R200_DST_BLEND_GL_ONE_MINUS_DST_COLOR; - break; - case GL_DST_ALPHA: - b |= R200_DST_BLEND_GL_DST_ALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: - b |= R200_DST_BLEND_GL_ONE_MINUS_DST_ALPHA; - break; - case GL_CONSTANT_COLOR: - b |= R200_DST_BLEND_GL_CONST_COLOR; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - b |= R200_DST_BLEND_GL_ONE_MINUS_CONST_COLOR; - break; - case GL_CONSTANT_ALPHA: - b |= R200_DST_BLEND_GL_CONST_ALPHA; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - b |= R200_DST_BLEND_GL_ONE_MINUS_CONST_ALPHA; - break; - default: - break; - } - - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b; -} - -static void r200BlendFuncSeparate( GLcontext *ctx, - GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA ) -{ - r200BlendFunc( ctx, sfactorRGB, dfactorRGB ); -} - - -/* ============================================================= - * Depth testing - */ - -static void r200DepthFunc( GLcontext *ctx, GLenum func ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_TEST_MASK; - - switch ( ctx->Depth.Func ) { - case GL_NEVER: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEVER; - break; - case GL_LESS: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LESS; - break; - case GL_EQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_EQUAL; - break; - case GL_LEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LEQUAL; - break; - case GL_GREATER: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GREATER; - break; - case GL_NOTEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEQUAL; - break; - case GL_GEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GEQUAL; - break; - case GL_ALWAYS: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_ALWAYS; - break; - } -} - - -static void r200DepthMask( GLcontext *ctx, GLboolean flag ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - R200_STATECHANGE( rmesa, ctx ); - - if ( ctx->Depth.Mask ) { - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_WRITE_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_WRITE_ENABLE; - } -} - - -/* ============================================================= - * Fog - */ - - -static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - union { int i; float f; } c, d; - GLchan col[4]; - GLuint i; - - c.i = rmesa->hw.fog.cmd[FOG_C]; - d.i = rmesa->hw.fog.cmd[FOG_D]; - - switch (pname) { - case GL_FOG_MODE: - if (!ctx->Fog.Enabled) - return; - R200_STATECHANGE(rmesa, tcl); - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK; - switch (ctx->Fog.Mode) { - case GL_LINEAR: - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_LINEAR; - if (ctx->Fog.Start == ctx->Fog.End) { - c.f = 1.0F; - d.f = 1.0F; - } - else { - c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start); - d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start); - } - break; - case GL_EXP: - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP; - c.f = 0.0; - d.f = -ctx->Fog.Density; - break; - case GL_EXP2: - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP2; - c.f = 0.0; - d.f = -(ctx->Fog.Density * ctx->Fog.Density); - break; - default: - return; - } - break; - case GL_FOG_DENSITY: - switch (ctx->Fog.Mode) { - case GL_EXP: - c.f = 0.0; - d.f = -ctx->Fog.Density; - break; - case GL_EXP2: - c.f = 0.0; - d.f = -(ctx->Fog.Density * ctx->Fog.Density); - break; - default: - break; - } - break; - case GL_FOG_START: - case GL_FOG_END: - if (ctx->Fog.Mode == GL_LINEAR) { - if (ctx->Fog.Start == ctx->Fog.End) { - c.f = 1.0F; - d.f = 1.0F; - } else { - c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start); - d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start); - } - } - break; - case GL_FOG_COLOR: - R200_STATECHANGE( rmesa, ctx ); - UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color ); - i = r200PackColor( 4, col[0], col[1], col[2], 0 ); - rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_COLOR_MASK; - rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= i; - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - /* What to do? - */ - break; - default: - return; - } - - if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) { - R200_STATECHANGE( rmesa, fog ); - rmesa->hw.fog.cmd[FOG_C] = c.i; - rmesa->hw.fog.cmd[FOG_D] = d.i; - } -} - - -/* ============================================================= - * Scissoring - */ - - -static GLboolean intersect_rect( XF86DRIClipRectPtr out, - XF86DRIClipRectPtr a, - XF86DRIClipRectPtr b ) -{ - *out = *a; - if ( b->x1 > out->x1 ) out->x1 = b->x1; - if ( b->y1 > out->y1 ) out->y1 = b->y1; - if ( b->x2 < out->x2 ) out->x2 = b->x2; - if ( b->y2 < out->y2 ) out->y2 = b->y2; - if ( out->x1 >= out->x2 ) return GL_FALSE; - if ( out->y1 >= out->y2 ) return GL_FALSE; - return GL_TRUE; -} - - -void r200RecalcScissorRects( r200ContextPtr rmesa ) -{ - XF86DRIClipRectPtr out; - int i; - - /* Grow cliprect store? - */ - if (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) { - while (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) { - rmesa->state.scissor.numAllocedClipRects += 1; /* zero case */ - rmesa->state.scissor.numAllocedClipRects *= 2; - } - - if (rmesa->state.scissor.pClipRects) - FREE(rmesa->state.scissor.pClipRects); - - rmesa->state.scissor.pClipRects = - MALLOC( rmesa->state.scissor.numAllocedClipRects * - sizeof(XF86DRIClipRectRec) ); - - if ( rmesa->state.scissor.pClipRects == NULL ) { - rmesa->state.scissor.numAllocedClipRects = 0; - return; - } - } - - out = rmesa->state.scissor.pClipRects; - rmesa->state.scissor.numClipRects = 0; - - for ( i = 0 ; i < rmesa->numClipRects ; i++ ) { - if ( intersect_rect( out, - &rmesa->pClipRects[i], - &rmesa->state.scissor.rect ) ) { - rmesa->state.scissor.numClipRects++; - out++; - } - } -} - - -static void r200UpdateScissor( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - if ( rmesa->dri.drawable ) { - __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - - int x = ctx->Scissor.X; - int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height; - int w = ctx->Scissor.X + ctx->Scissor.Width - 1; - int h = dPriv->h - ctx->Scissor.Y - 1; - - rmesa->state.scissor.rect.x1 = x + dPriv->x; - rmesa->state.scissor.rect.y1 = y + dPriv->y; - rmesa->state.scissor.rect.x2 = w + dPriv->x + 1; - rmesa->state.scissor.rect.y2 = h + dPriv->y + 1; - - r200RecalcScissorRects( rmesa ); - } -} - - -static void r200Scissor( GLcontext *ctx, - GLint x, GLint y, GLsizei w, GLsizei h ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - if ( ctx->Scissor.Enabled ) { - R200_FIREVERTICES( rmesa ); /* don't pipeline cliprect changes */ - r200UpdateScissor( ctx ); - } - -} - - -/* ============================================================= - * Culling - */ - -static void r200CullFace( GLcontext *ctx, GLenum unused ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; - GLuint t = rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL]; - - s |= R200_FFACE_SOLID | R200_BFACE_SOLID; - t &= ~(R200_CULL_FRONT | R200_CULL_BACK); - - if ( ctx->Polygon.CullFlag ) { - switch ( ctx->Polygon.CullFaceMode ) { - case GL_FRONT: - s &= ~R200_FFACE_SOLID; - t |= R200_CULL_FRONT; - break; - case GL_BACK: - s &= ~R200_BFACE_SOLID; - t |= R200_CULL_BACK; - break; - case GL_FRONT_AND_BACK: - s &= ~(R200_FFACE_SOLID | R200_BFACE_SOLID); - t |= (R200_CULL_FRONT | R200_CULL_BACK); - break; - } - } - - if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) { - R200_STATECHANGE(rmesa, set ); - rmesa->hw.set.cmd[SET_SE_CNTL] = s; - } - - if ( rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] != t ) { - R200_STATECHANGE(rmesa, tcl ); - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] = t; - } -} - -static void r200FrontFace( GLcontext *ctx, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, set ); - rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_FFACE_CULL_DIR_MASK; - - R200_STATECHANGE( rmesa, tcl ); - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW; - - switch ( mode ) { - case GL_CW: - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CW; - break; - case GL_CCW: - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CCW; - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_CULL_FRONT_IS_CCW; - break; - } -} - -/* ============================================================= - * Point state - */ -static void r200PointSize( GLcontext *ctx, GLfloat size ) -{ - if (0) fprintf(stderr, "%s: %f\n", __FUNCTION__, size ); -} - -/* ============================================================= - * Line state - */ -static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, lin ); - R200_STATECHANGE( rmesa, set ); - - /* Line width is stored in U6.4 format. - */ - rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff; - rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0); - - if ( widthf > 1.0 ) { - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE; - } else { - rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_WIDELINE_ENABLE; - } -} - -static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, lin ); - rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = - ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern)); -} - - -/* ============================================================= - * Masks - */ -static void r200ColorMask( GLcontext *ctx, - GLboolean r, GLboolean g, - GLboolean b, GLboolean a ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint mask = r200PackColor( rmesa->r200Screen->cpp, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP] ); - - GLuint flag = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~R200_PLANE_MASK_ENABLE; - - if (!(r && g && b && a)) - flag |= R200_PLANE_MASK_ENABLE; - - if ( rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] != flag ) { - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = flag; - } - - if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) { - R200_STATECHANGE( rmesa, msk ); - rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = mask; - } -} - - -/* ============================================================= - * Polygon state - */ - -static void r200PolygonOffset( GLcontext *ctx, - GLfloat factor, GLfloat units ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLfloat constant = units * rmesa->state.depth.scale; - -/* factor *= 2; */ -/* constant *= 2; */ - -/* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */ - - R200_STATECHANGE( rmesa, zbs ); - rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor; - rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant; -} - -static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint i; - drmRadeonStipple stipple; - - /* Must flip pattern upside down. - */ - for ( i = 0 ; i < 32 ; i++ ) { - rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i]; - } - - /* TODO: push this into cmd mechanism - */ - R200_FIREVERTICES( rmesa ); - LOCK_HARDWARE( rmesa ); - - /* FIXME: Use window x,y offsets into stipple RAM. - */ - stipple.mask = rmesa->state.stipple.mask; - drmCommandWrite( rmesa->dri.fd, DRM_RADEON_STIPPLE, - &stipple, sizeof(drmRadeonStipple) ); - UNLOCK_HARDWARE( rmesa ); -} - -static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; - - /* Can't generally do unfilled via tcl, but some good special - * cases work. - */ - TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag); - if (rmesa->TclFallback) { - r200ChooseRenderState( ctx ); - r200ChooseVertexState( ctx ); - } -} - - -/* ============================================================= - * Rendering attributes - * - * We really don't want to recalculate all this every time we bind a - * texture. These things shouldn't change all that often, so it makes - * sense to break them out of the core texture state update routines. - */ - -/* Examine lighting and texture state to determine if separate specular - * should be enabled. - */ -static void r200UpdateSpecular( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - CARD32 p = rmesa->hw.ctx.cmd[CTX_PP_CNTL]; - - R200_STATECHANGE( rmesa, tcl ); - R200_STATECHANGE( rmesa, vtx ); - - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_0_SHIFT); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_1_SHIFT); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_0; - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_1; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LIGHTING_ENABLE; - - p &= ~R200_SPECULAR_ENABLE; - - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_DIFFUSE_SPECULAR_COMBINE; - - - if (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) | - (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0; - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE; - p |= R200_SPECULAR_ENABLE; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= - ~R200_DIFFUSE_SPECULAR_COMBINE; - } - else if (ctx->Light.Enabled) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE; - } else if (ctx->Fog.ColorSumEnabled ) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) | - (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); - p |= R200_SPECULAR_ENABLE; - } else { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); - } - - if (ctx->Fog.Enabled) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1; - } - - if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) { - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p; - } - - /* Update vertex/render formats - */ - if (rmesa->TclFallback) { - r200ChooseRenderState( ctx ); - r200ChooseVertexState( ctx ); - } -} - - -/* ============================================================= - * Materials - */ - - -/* Update on colormaterial, material emmissive/ambient, - * lightmodel.globalambient - */ -static void update_global_ambient( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - float *fcmd = (float *)R200_DB_STATE( glt ); - - /* Need to do more if both emmissive & ambient are PREMULT: - */ - if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] & - ((3 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) | - (3 << R200_FRONT_AMBIENT_SOURCE_SHIFT))) == 0) - { - COPY_3V( &fcmd[GLT_RED], - ctx->Light.Material[0].Emission); - ACC_SCALE_3V( &fcmd[GLT_RED], - ctx->Light.Model.Ambient, - ctx->Light.Material[0].Ambient); - } - else - { - COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient ); - } - - R200_DB_STATECHANGE(rmesa, &rmesa->hw.glt); -} - -/* Update on change to - * - light[p].colors - * - light[p].enabled - * - material, - * - colormaterial enabled - * - colormaterial bitmask - */ -static void update_light_colors( GLcontext *ctx, GLuint p ) -{ - struct gl_light *l = &ctx->Light.Light[p]; - -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - - if (l->Enabled) { - r200ContextPtr rmesa = R200_CONTEXT(ctx); - float *fcmd = (float *)R200_DB_STATE( lit[p] ); - GLuint bitmask = ctx->Light.ColorMaterialBitmask; - struct gl_material *mat = &ctx->Light.Material[0]; - - COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient ); - COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse ); - COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular ); - - if (!ctx->Light.ColorMaterialEnabled) - bitmask = 0; - - if ((bitmask & FRONT_AMBIENT_BIT) == 0) - SELF_SCALE_3V( &fcmd[LIT_AMBIENT_RED], mat->Ambient ); - - if ((bitmask & FRONT_DIFFUSE_BIT) == 0) - SELF_SCALE_3V( &fcmd[LIT_DIFFUSE_RED], mat->Diffuse ); - - if ((bitmask & FRONT_SPECULAR_BIT) == 0) - SELF_SCALE_3V( &fcmd[LIT_SPECULAR_RED], mat->Specular ); - - R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] ); - } -} - -/* Also fallback for asym colormaterial mode in twoside lighting... - */ -static void check_twoside_fallback( GLcontext *ctx ) -{ - GLboolean fallback = GL_FALSE; - - if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { - if (memcmp( &ctx->Light.Material[0], - &ctx->Light.Material[1], - sizeof(struct gl_material)) != 0) - fallback = GL_TRUE; - else if (ctx->Light.ColorMaterialEnabled && - (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) != - ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1)) - fallback = GL_TRUE; - } - - TCL_FALLBACK( ctx, R200_TCL_FALLBACK_LIGHT_TWOSIDE, fallback ); -} - -static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) -{ - if (ctx->Light.ColorMaterialEnabled) { - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]; - GLuint mask = ctx->Light.ColorMaterialBitmask; - - /* Default to PREMULT: - */ - light_model_ctl1 &= ~((0xf << R200_FRONT_EMISSIVE_SOURCE_SHIFT) | - (0xf << R200_FRONT_AMBIENT_SOURCE_SHIFT) | - (0xf << R200_FRONT_DIFFUSE_SOURCE_SHIFT) | - (0xf << R200_FRONT_SPECULAR_SOURCE_SHIFT)); - - if (mask & FRONT_EMISSION_BIT) { - light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << - R200_FRONT_EMISSIVE_SOURCE_SHIFT); - } - - if (mask & FRONT_AMBIENT_BIT) { - light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << - R200_FRONT_AMBIENT_SOURCE_SHIFT); - } - - if (mask & FRONT_DIFFUSE_BIT) { - light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << - R200_FRONT_DIFFUSE_SOURCE_SHIFT); - } - - if (mask & FRONT_SPECULAR_BIT) { - light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << - R200_FRONT_SPECULAR_SOURCE_SHIFT); - } - - if (light_model_ctl1 != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]) { - GLuint p; - - R200_STATECHANGE( rmesa, tcl ); - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] = light_model_ctl1; - - for (p = 0 ; p < MAX_LIGHTS; p++) - update_light_colors( ctx, p ); - update_global_ambient( ctx ); - } - } - - check_twoside_fallback( ctx ); -} - -void r200UpdateMaterial( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLfloat *fcmd = (GLfloat *)R200_DB_STATE( mtl[0] ); - GLuint p; - GLuint mask = ~0; - - if (ctx->Light.ColorMaterialEnabled) - mask &= ~ctx->Light.ColorMaterialBitmask; - - if (R200_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s\n", __FUNCTION__); - - - if (mask & FRONT_EMISSION_BIT) { - fcmd[MTL_EMMISSIVE_RED] = ctx->Light.Material[0].Emission[0]; - fcmd[MTL_EMMISSIVE_GREEN] = ctx->Light.Material[0].Emission[1]; - fcmd[MTL_EMMISSIVE_BLUE] = ctx->Light.Material[0].Emission[2]; - fcmd[MTL_EMMISSIVE_ALPHA] = ctx->Light.Material[0].Emission[3]; - } - if (mask & FRONT_AMBIENT_BIT) { - fcmd[MTL_AMBIENT_RED] = ctx->Light.Material[0].Ambient[0]; - fcmd[MTL_AMBIENT_GREEN] = ctx->Light.Material[0].Ambient[1]; - fcmd[MTL_AMBIENT_BLUE] = ctx->Light.Material[0].Ambient[2]; - fcmd[MTL_AMBIENT_ALPHA] = ctx->Light.Material[0].Ambient[3]; - } - if (mask & FRONT_DIFFUSE_BIT) { - fcmd[MTL_DIFFUSE_RED] = ctx->Light.Material[0].Diffuse[0]; - fcmd[MTL_DIFFUSE_GREEN] = ctx->Light.Material[0].Diffuse[1]; - fcmd[MTL_DIFFUSE_BLUE] = ctx->Light.Material[0].Diffuse[2]; - fcmd[MTL_DIFFUSE_ALPHA] = ctx->Light.Material[0].Diffuse[3]; - } - if (mask & FRONT_SPECULAR_BIT) { - fcmd[MTL_SPECULAR_RED] = ctx->Light.Material[0].Specular[0]; - fcmd[MTL_SPECULAR_GREEN] = ctx->Light.Material[0].Specular[1]; - fcmd[MTL_SPECULAR_BLUE] = ctx->Light.Material[0].Specular[2]; - fcmd[MTL_SPECULAR_ALPHA] = ctx->Light.Material[0].Specular[3]; - } - if (mask & FRONT_SHININESS_BIT) { - fcmd[MTL_SHININESS] = ctx->Light.Material[0].Shininess; - } - - if (R200_DB_STATECHANGE( rmesa, &rmesa->hw.mtl[0] )) { - for (p = 0 ; p < MAX_LIGHTS; p++) - update_light_colors( ctx, p ); - - check_twoside_fallback( ctx ); - update_global_ambient( ctx ); - } - else if (R200_DEBUG & (DEBUG_PRIMS|DEBUG_STATE)) - fprintf(stderr, "%s: Elided noop material call\n", __FUNCTION__); -} - -/* _NEW_LIGHT - * _NEW_MODELVIEW - * _MESA_NEW_NEED_EYE_COORDS - * - * Uses derived state from mesa: - * _VP_inf_norm - * _h_inf_norm - * _Position - * _NormDirection - * _ModelViewInvScale - * _NeedEyeCoords - * _EyeZDir - * - * which are calculated in light.c and are correct for the current - * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW - * and _MESA_NEW_NEED_EYE_COORDS. - */ -static void update_light( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - /* Have to check these, or have an automatic shortcircuit mechanism - * to remove noop statechanges. (Or just do a better job on the - * front end). - */ - { - GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]; - - if (ctx->_NeedEyeCoords) - tmp &= ~R200_LIGHT_IN_MODELSPACE; - else - tmp |= R200_LIGHT_IN_MODELSPACE; - - if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]) - { - R200_STATECHANGE( rmesa, tcl ); - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] = tmp; - } - } - - { - GLfloat *fcmd = (GLfloat *)R200_DB_STATE( eye ); - fcmd[EYE_X] = ctx->_EyeZDir[0]; - fcmd[EYE_Y] = ctx->_EyeZDir[1]; - fcmd[EYE_Z] = - ctx->_EyeZDir[2]; - fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale; - R200_DB_STATECHANGE( rmesa, &rmesa->hw.eye ); - } - - - - if (ctx->Light.Enabled) { - GLint p; - for (p = 0 ; p < MAX_LIGHTS; p++) { - if (ctx->Light.Light[p].Enabled) { - struct gl_light *l = &ctx->Light.Light[p]; - GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] ); - - if (l->EyePosition[3] == 0.0) { - COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm ); - COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm ); - fcmd[LIT_POSITION_W] = 0; - fcmd[LIT_DIRECTION_W] = 0; - } else { - COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; - fcmd[LIT_DIRECTION_W] = 0; - } - - R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] ); - } - } - } -} - -static void r200Lightfv( GLcontext *ctx, GLenum light, - GLenum pname, const GLfloat *params ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLint p = light - GL_LIGHT0; - struct gl_light *l = &ctx->Light.Light[p]; - GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd; - - - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - update_light_colors( ctx, p ); - break; - - case GL_SPOT_DIRECTION: - /* picked up in update_light */ - break; - - case GL_POSITION: { - /* positions picked up in update_light, but can do flag here */ - GLuint flag = (p&1)? R200_LIGHT_1_IS_LOCAL : R200_LIGHT_0_IS_LOCAL; - GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2; - - R200_STATECHANGE(rmesa, tcl); - if (l->EyePosition[3] != 0.0F) - rmesa->hw.tcl.cmd[idx] |= flag; - else - rmesa->hw.tcl.cmd[idx] &= ~flag; - break; - } - - case GL_SPOT_EXPONENT: - R200_STATECHANGE(rmesa, lit[p]); - fcmd[LIT_SPOT_EXPONENT] = params[0]; - break; - - case GL_SPOT_CUTOFF: { - GLuint flag = (p&1) ? R200_LIGHT_1_IS_SPOT : R200_LIGHT_0_IS_SPOT; - GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2; - - R200_STATECHANGE(rmesa, lit[p]); - fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff; - - R200_STATECHANGE(rmesa, tcl); - if (l->SpotCutoff != 180.0F) - rmesa->hw.tcl.cmd[idx] |= flag; - else - rmesa->hw.tcl.cmd[idx] &= ~flag; - - break; - } - - case GL_CONSTANT_ATTENUATION: - R200_STATECHANGE(rmesa, lit[p]); - fcmd[LIT_ATTEN_CONST] = params[0]; - break; - case GL_LINEAR_ATTENUATION: - R200_STATECHANGE(rmesa, lit[p]); - fcmd[LIT_ATTEN_LINEAR] = params[0]; - break; - case GL_QUADRATIC_ATTENUATION: - R200_STATECHANGE(rmesa, lit[p]); - fcmd[LIT_ATTEN_QUADRATIC] = params[0]; - break; - default: - return; - } - -} - - - - -static void r200LightModelfv( GLcontext *ctx, GLenum pname, - const GLfloat *param ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: - update_global_ambient( ctx ); - break; - - case GL_LIGHT_MODEL_LOCAL_VIEWER: - R200_STATECHANGE( rmesa, tcl ); - if (ctx->Light.Model.LocalViewer) - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LOCAL_VIEWER; - else - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER; - break; - - case GL_LIGHT_MODEL_TWO_SIDE: - R200_STATECHANGE( rmesa, tcl ); - if (ctx->Light.Model.TwoSide) - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHT_TWOSIDE; - else - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LIGHT_TWOSIDE; - - check_twoside_fallback( ctx ); - - if (rmesa->TclFallback) { - r200ChooseRenderState( ctx ); - r200ChooseVertexState( ctx ); - } - break; - - case GL_LIGHT_MODEL_COLOR_CONTROL: - r200UpdateSpecular(ctx); - break; - - default: - break; - } -} - -static void r200ShadeModel( GLcontext *ctx, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; - - s &= ~(R200_DIFFUSE_SHADE_MASK | - R200_ALPHA_SHADE_MASK | - R200_SPECULAR_SHADE_MASK | - R200_FOG_SHADE_MASK); - - switch ( mode ) { - case GL_FLAT: - s |= (R200_DIFFUSE_SHADE_FLAT | - R200_ALPHA_SHADE_FLAT | - R200_SPECULAR_SHADE_FLAT | - R200_FOG_SHADE_FLAT); - break; - case GL_SMOOTH: - s |= (R200_DIFFUSE_SHADE_GOURAUD | - R200_ALPHA_SHADE_GOURAUD | - R200_SPECULAR_SHADE_GOURAUD | - R200_FOG_SHADE_GOURAUD); - break; - default: - return; - } - - if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) { - R200_STATECHANGE( rmesa, set ); - rmesa->hw.set.cmd[SET_SE_CNTL] = s; - } -} - - -/* ============================================================= - * User clip planes - */ - -static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) -{ - GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - - R200_STATECHANGE( rmesa, ucp[p] ); - rmesa->hw.ucp[p].cmd[UCP_X] = ip[0]; - rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1]; - rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2]; - rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; -} - -static void r200UpdateClipPlanes( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint p; - - for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - - R200_STATECHANGE( rmesa, ucp[p] ); - rmesa->hw.ucp[p].cmd[UCP_X] = ip[0]; - rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1]; - rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2]; - rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; - } - } -} - - -/* ============================================================= - * Stencil - */ - -static void r200StencilFunc( GLcontext *ctx, GLenum func, - GLint ref, GLuint mask ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << R200_STENCIL_REF_SHIFT) | - (ctx->Stencil.ValueMask[0] << R200_STENCIL_MASK_SHIFT)); - - R200_STATECHANGE( rmesa, ctx ); - R200_STATECHANGE( rmesa, msk ); - - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_STENCIL_TEST_MASK; - rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(R200_STENCIL_REF_MASK| - R200_STENCIL_VALUE_MASK); - - switch ( ctx->Stencil.Function[0] ) { - case GL_NEVER: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEVER; - break; - case GL_LESS: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LESS; - break; - case GL_EQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_EQUAL; - break; - case GL_LEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LEQUAL; - break; - case GL_GREATER: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GREATER; - break; - case GL_NOTEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEQUAL; - break; - case GL_GEQUAL: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GEQUAL; - break; - case GL_ALWAYS: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_ALWAYS; - break; - } - - rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask; -} - -static void r200StencilMask( GLcontext *ctx, GLuint mask ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, msk ); - rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~R200_STENCIL_WRITE_MASK; - rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= - (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT); -} - -static void r200StencilOp( GLcontext *ctx, GLenum fail, - GLenum zfail, GLenum zpass ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(R200_STENCIL_FAIL_MASK | - R200_STENCIL_ZFAIL_MASK | - R200_STENCIL_ZPASS_MASK); - - switch ( ctx->Stencil.FailFunc[0] ) { - case GL_KEEP: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_KEEP; - break; - case GL_ZERO: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_ZERO; - break; - case GL_REPLACE: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_REPLACE; - break; - case GL_INCR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC; - break; - case GL_DECR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC; - break; - case GL_INCR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC_WRAP; - break; - case GL_DECR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC_WRAP; - break; - case GL_INVERT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INVERT; - break; - } - - switch ( ctx->Stencil.ZFailFunc[0] ) { - case GL_KEEP: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_KEEP; - break; - case GL_ZERO: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_ZERO; - break; - case GL_REPLACE: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_REPLACE; - break; - case GL_INCR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC; - break; - case GL_DECR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC; - break; - case GL_INCR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC_WRAP; - break; - case GL_DECR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC_WRAP; - break; - case GL_INVERT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INVERT; - break; - } - - switch ( ctx->Stencil.ZPassFunc[0] ) { - case GL_KEEP: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_KEEP; - break; - case GL_ZERO: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_ZERO; - break; - case GL_REPLACE: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_REPLACE; - break; - case GL_INCR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC; - break; - case GL_DECR: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC; - break; - case GL_INCR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC_WRAP; - break; - case GL_DECR_WRAP_EXT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC_WRAP; - break; - case GL_INVERT: - rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INVERT; - break; - } -} - -static void r200ClearStencil( GLcontext *ctx, GLint s ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - rmesa->state.stencil.clear = - ((GLuint) ctx->Stencil.Clear | - (0xff << R200_STENCIL_MASK_SHIFT) | - (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT)); -} - - -/* ============================================================= - * Window position and viewport transformation - */ - -/* - * To correctly position primitives: - */ -#define SUBPIXEL_X 0.125 -#define SUBPIXEL_Y 0.125 - -void r200UpdateWindow( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - GLfloat xoffset = (GLfloat)dPriv->x; - GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - GLfloat sx = v[MAT_SX]; - GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X; - GLfloat sy = - v[MAT_SY]; - GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y; - GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale; - GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale; - - R200_FIREVERTICES( rmesa ); - R200_STATECHANGE( rmesa, vpt ); - - rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz; -} - - - -static void r200Viewport( GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height ) -{ - /* Don't pipeline viewport changes, conflict with window offset - * setting below. Could apply deltas to rescue pipelined viewport - * values, or keep the originals hanging around. - */ - R200_FIREVERTICES( R200_CONTEXT(ctx) ); - r200UpdateWindow( ctx ); -} - -static void r200DepthRange( GLcontext *ctx, GLclampd nearval, - GLclampd farval ) -{ - r200UpdateWindow( ctx ); -} - -void r200UpdateViewportOffset( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - GLfloat xoffset = (GLfloat)dPriv->x; - GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat ty = (- v[MAT_TY]) + yoffset; - - if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx || - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty ) - { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty; - - /* update polygon stipple x/y screen offset */ - { - GLuint stx, sty; - GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC]; - - m &= ~(R200_STIPPLE_X_OFFSET_MASK | - R200_STIPPLE_Y_OFFSET_MASK); - - /* add magic offsets, then invert */ - stx = 31 - ((rmesa->dri.drawable->x - 1) & R200_STIPPLE_COORD_MASK); - sty = 31 - ((rmesa->dri.drawable->y + rmesa->dri.drawable->h - 1) - & R200_STIPPLE_COORD_MASK); - - m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) | - (sty << R200_STIPPLE_Y_OFFSET_SHIFT)); - - if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) { - R200_STATECHANGE( rmesa, msc ); - rmesa->hw.msc.cmd[MSC_RE_MISC] = m; - } - } - } - - r200UpdateScissor( ctx ); -} - - - -/* ============================================================= - * Miscellaneous - */ - -static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLubyte color[4]; - CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]); - CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]); - CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]); - CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]); - rmesa->state.color.clear = r200PackColor( rmesa->r200Screen->cpp, - color[0], color[1], - color[2], color[3] ); -} - - -static void r200RenderMode( GLcontext *ctx, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); -} - - -static GLuint r200_rop_tab[] = { - R200_ROP_CLEAR, - R200_ROP_AND, - R200_ROP_AND_REVERSE, - R200_ROP_COPY, - R200_ROP_AND_INVERTED, - R200_ROP_NOOP, - R200_ROP_XOR, - R200_ROP_OR, - R200_ROP_NOR, - R200_ROP_EQUIV, - R200_ROP_INVERT, - R200_ROP_OR_REVERSE, - R200_ROP_COPY_INVERTED, - R200_ROP_OR_INVERTED, - R200_ROP_NAND, - R200_ROP_SET, -}; - -static void r200LogicOpCode( GLcontext *ctx, GLenum opcode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint rop = (GLuint)opcode - GL_CLEAR; - - ASSERT( rop < 16 ); - - R200_STATECHANGE( rmesa, msk ); - rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = r200_rop_tab[rop]; -} - - -void r200SetCliprects( r200ContextPtr rmesa, GLenum mode ) -{ - __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - - switch ( mode ) { - case GL_FRONT_LEFT: - rmesa->numClipRects = dPriv->numClipRects; - rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects; - break; - case GL_BACK_LEFT: - /* Can't ignore 2d windows if we are page flipping. - */ - if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) { - rmesa->numClipRects = dPriv->numClipRects; - rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects; - } - else { - rmesa->numClipRects = dPriv->numBackClipRects; - rmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pBackClipRects; - } - break; - default: - fprintf(stderr, "bad mode in r200SetCliprects\n"); - return; - } - - if (rmesa->state.scissor.enabled) - r200RecalcScissorRects( rmesa ); -} - - -static void r200DrawBuffer( GLcontext *ctx, GLenum mode ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - - if (R200_DEBUG & DEBUG_DRI) - fprintf(stderr, "%s %s\n", __FUNCTION__, - _mesa_lookup_enum_by_nr( mode )); - - R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */ - - /* - * _DrawDestMask is easier to cope with than <mode>. - */ - switch ( ctx->Color._DrawDestMask ) { - case FRONT_LEFT_BIT: - FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE ); - r200SetCliprects( rmesa, GL_FRONT_LEFT ); - break; - case BACK_LEFT_BIT: - FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE ); - r200SetCliprects( rmesa, GL_BACK_LEFT ); - break; - default: - /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ - FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE ); - return; - } - - /* We want to update the s/w rast state too so that r200SetBuffer() - * gets called. - */ - _swrast_DrawBuffer(ctx, mode); - - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset & - R200_COLOROFFSET_MASK); - rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; -} - - -static void r200ReadBuffer( GLcontext *ctx, GLenum mode ) -{ - /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ -} - -/* ============================================================= - * State enable/disable - */ - -static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint p, flag; - - if ( R200_DEBUG & DEBUG_STATE ) - fprintf( stderr, "%s( %s = %s )\n", __FUNCTION__, - _mesa_lookup_enum_by_nr( cap ), - state ? "GL_TRUE" : "GL_FALSE" ); - - switch ( cap ) { - /* Fast track this one... - */ - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - break; - - case GL_ALPHA_TEST: - R200_STATECHANGE( rmesa, ctx ); - if (state) { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ALPHA_TEST_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ALPHA_TEST_ENABLE; - } - break; - - case GL_BLEND: - R200_STATECHANGE( rmesa, ctx ); - if (state) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ALPHA_BLEND_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ALPHA_BLEND_ENABLE; - } - if ( ctx->Color.ColorLogicOpEnabled ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE; - } - break; - - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - p = cap-GL_CLIP_PLANE0; - R200_STATECHANGE( rmesa, tcl ); - if (state) { - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (R200_UCP_ENABLE_0<<p); - r200ClipPlane( ctx, cap, NULL ); - } - else { - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(R200_UCP_ENABLE_0<<p); - } - break; - - case GL_COLOR_MATERIAL: - r200ColorMaterial( ctx, 0, 0 ); - if (!state) - r200UpdateMaterial( ctx ); - break; - - case GL_CULL_FACE: - r200CullFace( ctx, 0 ); - break; - - case GL_DEPTH_TEST: - R200_STATECHANGE(rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_Z_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_Z_ENABLE; - } - break; - - case GL_DITHER: - R200_STATECHANGE(rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_DITHER_ENABLE; - } - break; - - case GL_FOG: - R200_STATECHANGE(rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_FOG_ENABLE; - r200Fogfv( ctx, GL_FOG_MODE, 0 ); - } else { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_FOG_ENABLE; - R200_STATECHANGE(rmesa, tcl); - rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK; - } - r200UpdateSpecular( ctx ); /* for PK_SPEC */ - break; - - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - R200_STATECHANGE(rmesa, tcl); - p = cap - GL_LIGHT0; - if (p&1) - flag = (R200_LIGHT_1_ENABLE | - R200_LIGHT_1_ENABLE_AMBIENT | - R200_LIGHT_1_ENABLE_SPECULAR); - else - flag = (R200_LIGHT_0_ENABLE | - R200_LIGHT_0_ENABLE_AMBIENT | - R200_LIGHT_0_ENABLE_SPECULAR); - - if (state) - rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] |= flag; - else - rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag; - - /* - */ - update_light_colors( ctx, p ); - break; - - case GL_LIGHTING: - r200UpdateSpecular(ctx); - check_twoside_fallback( ctx ); - break; - - case GL_LINE_SMOOTH: - R200_STATECHANGE( rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_LINE; - } else { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_LINE; - } - break; - - case GL_LINE_STIPPLE: - R200_STATECHANGE( rmesa, set ); - if ( state ) { - rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PATTERN_ENABLE; - } else { - rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PATTERN_ENABLE; - } - break; - - case GL_COLOR_LOGIC_OP: - R200_STATECHANGE( rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE; - } - break; - - case GL_NORMALIZE: - R200_STATECHANGE( rmesa, tcl ); - if ( state ) { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_NORMALIZE_NORMALS; - } else { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_NORMALIZE_NORMALS; - } - break; - - /* Pointsize registers on r200 don't seem to do anything. Maybe - * have to pass pointsizes as vertex parameters? In any case, - * setting pointmin == pointsizemax == 1.0, and doing nothing - * for aa is enough to satisfy conform. - */ - case GL_POINT_SMOOTH: - break; - - /* These don't really do anything, as we don't use the 3vtx - * primitives yet. - */ -#if 0 - case GL_POLYGON_OFFSET_POINT: - R200_STATECHANGE( rmesa, set ); - if ( state ) { - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_POINT; - } else { - rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_POINT; - } - break; - - case GL_POLYGON_OFFSET_LINE: - R200_STATECHANGE( rmesa, set ); - if ( state ) { - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_LINE; - } else { - rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_LINE; - } - break; -#endif - - case GL_POLYGON_OFFSET_FILL: - R200_STATECHANGE( rmesa, set ); - if ( state ) { - rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_TRI; - } else { - rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_TRI; - } - break; - - case GL_POLYGON_SMOOTH: - R200_STATECHANGE( rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_POLY; - } else { - rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_POLY; - } - break; - - case GL_POLYGON_STIPPLE: - R200_STATECHANGE(rmesa, set ); - if ( state ) { - rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_STIPPLE_ENABLE; - } else { - rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_STIPPLE_ENABLE; - } - break; - - case GL_RESCALE_NORMAL_EXT: { - GLboolean tmp = ctx->_NeedEyeCoords ? state : !state; - R200_STATECHANGE( rmesa, tcl ); - if ( tmp ) { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS; - } else { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS; - } - break; - } - - case GL_SCISSOR_TEST: - R200_FIREVERTICES( rmesa ); - rmesa->state.scissor.enabled = state; - r200UpdateScissor( ctx ); - break; - - case GL_STENCIL_TEST: - if ( rmesa->state.stencil.hwBuffer ) { - R200_STATECHANGE( rmesa, ctx ); - if ( state ) { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_STENCIL_ENABLE; - } else { - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_STENCIL_ENABLE; - } - } else { - FALLBACK( rmesa, R200_FALLBACK_STENCIL, state ); - } - break; - - case GL_TEXTURE_GEN_Q: - case GL_TEXTURE_GEN_R: - case GL_TEXTURE_GEN_S: - case GL_TEXTURE_GEN_T: - /* Picked up in r200UpdateTextureState. - */ - rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE; - break; - - case GL_COLOR_SUM_EXT: - r200UpdateSpecular ( ctx ); - break; - - default: - return; - } -} - - -void r200LightingSpaceChange( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLboolean tmp; - - if (R200_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords, - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]); - - if (ctx->_NeedEyeCoords) - tmp = ctx->Transform.RescaleNormals; - else - tmp = !ctx->Transform.RescaleNormals; - - R200_STATECHANGE( rmesa, tcl ); - if ( tmp ) { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS; - } else { - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS; - } - - if (R200_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords, - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]); -} - -/* ============================================================= - * Deferred state management - matrices, textures, other? - */ - - - - -static void upload_matrix( r200ContextPtr rmesa, GLfloat *src, int idx ) -{ - float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0; - int i; - - - for (i = 0 ; i < 4 ; i++) { - *dest++ = src[i]; - *dest++ = src[i+4]; - *dest++ = src[i+8]; - *dest++ = src[i+12]; - } - - R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] ); -} - -static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx ) -{ - float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0; - memcpy(dest, src, 16*sizeof(float)); - R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] ); -} - - -static void update_texturematrix( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT( ctx ); - GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0]; - GLuint compsel = rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]; - int unit; - - if (R200_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s before COMPSEL: %x\n", __FUNCTION__, - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]); - - rmesa->TexMatEnabled = 0; - rmesa->TexMatCompSel = 0; - - for (unit = 0 ; unit < 2; unit++) { - if (!ctx->Texture.Unit[unit]._ReallyEnabled) - continue; - - if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) { - rmesa->TexMatEnabled |= (R200_TEXGEN_TEXMAT_0_ENABLE| - R200_TEXMAT_0_ENABLE) << unit; - - rmesa->TexMatCompSel |= R200_OUTPUT_TEX_0 << unit; - - if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) { - /* Need to preconcatenate any active texgen - * obj/eyeplane matrices: - */ - _math_matrix_mul_matrix( &rmesa->tmpmat, - &rmesa->TexGenMatrix[unit], - ctx->TextureMatrixStack[unit].Top ); - upload_matrix( rmesa, rmesa->tmpmat.m, R200_MTX_TEX0+unit ); - } - else { - upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m, - R200_MTX_TEX0+unit ); - } - } - else if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) { - upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m, - R200_MTX_TEX0+unit ); - } - } - - tpc = (rmesa->TexMatEnabled | rmesa->TexGenEnabled); - if (tpc != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] || - rmesa->TexGenInputs != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1]) { - R200_STATECHANGE(rmesa, tcg); - rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] = tpc; - rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] = rmesa->TexGenInputs; - } - - compsel &= ~R200_OUTPUT_TEX_MASK; - compsel |= rmesa->TexMatCompSel | rmesa->TexGenCompSel; - if (compsel != rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]) { - R200_STATECHANGE(rmesa, vtx); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = compsel; - } -} - - - -void r200ValidateState( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint new_state = rmesa->NewGLState; - - if (new_state & _NEW_TEXTURE) { - r200UpdateTextureState( ctx ); - new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */ - } - - /* Need an event driven matrix update? - */ - if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) - upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, R200_MTX_MVP ); - - /* Need these for lighting (shouldn't upload otherwise) - */ - if (new_state & (_NEW_MODELVIEW)) { - upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, R200_MTX_MV ); - upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, R200_MTX_IMV ); - } - - /* Does this need to be triggered on eg. modelview for - * texgen-derived objplane/eyeplane matrices? - */ - if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) { - update_texturematrix( ctx ); - } - - if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) { - update_light( ctx ); - } - - /* emit all active clip planes if projection matrix changes. - */ - if (new_state & (_NEW_PROJECTION)) { - if (ctx->Transform.ClipPlanesEnabled) - r200UpdateClipPlanes( ctx ); - } - - - rmesa->NewGLState = 0; -} - - -static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) -{ - _swrast_InvalidateState( ctx, new_state ); - _swsetup_InvalidateState( ctx, new_state ); - _ac_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - _ae_invalidate_state( ctx, new_state ); - R200_CONTEXT(ctx)->NewGLState |= new_state; - r200VtxfmtInvalidate( ctx ); -} - -static void r200WrapRunPipeline( GLcontext *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - - if (0) - fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState); - - /* Validate state: - */ - if (rmesa->NewGLState) - r200ValidateState( ctx ); - - if (tnl->vb.Material) { - TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE ); - } - - /* Run the pipeline. - */ - _tnl_run_pipeline( ctx ); - - if (tnl->vb.Material) { - TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE ); - r200UpdateMaterial( ctx ); /* not needed any more? */ - } -} - - -/* Initialize the driver's state functions. - */ -void r200InitStateFuncs( GLcontext *ctx ) -{ - ctx->Driver.UpdateState = r200InvalidateState; - ctx->Driver.LightingSpaceChange = r200LightingSpaceChange; - - ctx->Driver.DrawBuffer = r200DrawBuffer; - ctx->Driver.ReadBuffer = r200ReadBuffer; - - ctx->Driver.AlphaFunc = r200AlphaFunc; - ctx->Driver.BlendEquation = r200BlendEquation; - ctx->Driver.BlendFunc = r200BlendFunc; - ctx->Driver.BlendFuncSeparate = r200BlendFuncSeparate; - ctx->Driver.ClearColor = r200ClearColor; - ctx->Driver.ClearDepth = NULL; - ctx->Driver.ClearIndex = NULL; - ctx->Driver.ClearStencil = r200ClearStencil; - ctx->Driver.ClipPlane = r200ClipPlane; - ctx->Driver.ColorMask = r200ColorMask; - ctx->Driver.CullFace = r200CullFace; - ctx->Driver.DepthFunc = r200DepthFunc; - ctx->Driver.DepthMask = r200DepthMask; - ctx->Driver.DepthRange = r200DepthRange; - ctx->Driver.Enable = r200Enable; - ctx->Driver.Fogfv = r200Fogfv; - ctx->Driver.FrontFace = r200FrontFace; - ctx->Driver.Hint = NULL; - ctx->Driver.IndexMask = NULL; - ctx->Driver.LightModelfv = r200LightModelfv; - ctx->Driver.Lightfv = r200Lightfv; - ctx->Driver.LineStipple = r200LineStipple; - ctx->Driver.LineWidth = r200LineWidth; - ctx->Driver.LogicOpcode = r200LogicOpCode; - ctx->Driver.PolygonMode = r200PolygonMode; - ctx->Driver.PolygonOffset = r200PolygonOffset; - ctx->Driver.PolygonStipple = r200PolygonStipple; - ctx->Driver.PointSize = r200PointSize; - ctx->Driver.RenderMode = r200RenderMode; - ctx->Driver.Scissor = r200Scissor; - ctx->Driver.ShadeModel = r200ShadeModel; - ctx->Driver.StencilFunc = r200StencilFunc; - ctx->Driver.StencilMask = r200StencilMask; - ctx->Driver.StencilOp = r200StencilOp; - ctx->Driver.Viewport = r200Viewport; - - /* Swrast hooks for imaging extensions: - */ - ctx->Driver.CopyColorTable = _swrast_CopyColorTable; - ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; - ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; - - TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial; - TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline; -} diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index fe2a7dc0970..118712d8410 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.h,v 1.2 2002/11/05 17:46:08 tsi Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index ba445d5012b..4c9a69f79d2 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state_init.c,v 1.4 2003/02/22 06:21:11 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -130,28 +130,15 @@ static GLboolean check_##NM( GLcontext *ctx, int idx ) \ CHECK( always, GL_TRUE ) +CHECK( never, GL_FALSE ) CHECK( tex_any, ctx->Texture._EnabledUnits ) CHECK( tex, ctx->Texture.Unit[idx]._ReallyEnabled ) CHECK( fog, ctx->Fog.Enabled ) TCL_CHECK( tcl, GL_TRUE ) -TCL_CHECK( tcl_tex_any, ctx->Texture._EnabledUnits ) TCL_CHECK( tcl_tex, ctx->Texture.Unit[idx]._ReallyEnabled ) TCL_CHECK( tcl_lighting, ctx->Light.Enabled ) -TCL_CHECK( tcl_eyespace_or_lighting, ctx->_NeedEyeCoords || ctx->Light.Enabled ) TCL_CHECK( tcl_light, ctx->Light.Enabled && ctx->Light.Light[idx].Enabled ) TCL_CHECK( tcl_ucp, (ctx->Transform.ClipPlanesEnabled & (1 << idx)) ) -/* TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled ) */ - - -static GLboolean check_tcl_eyespace_or_fog( GLcontext *ctx, int idx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - int res; - (void) idx; - res = !rmesa->TclFallback && (ctx->_NeedEyeCoords || ctx->Fog.Enabled); - fprintf(stderr, "%s: %d\n", __FUNCTION__, res); - return res; -} /* Initialize the context's hardware state. @@ -244,8 +231,15 @@ void r200InitState( r200ContextPtr rmesa ) ALLOC_STATE( tf, tex_any, TF_STATE_SIZE, "TF/tfactor", 0 ); ALLOC_STATE( tex[0], tex_any, TEX_STATE_SIZE, "TEX/tex-0", 0 ); ALLOC_STATE( tex[1], tex_any, TEX_STATE_SIZE, "TEX/tex-1", 1 ); - ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); - ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + + if (rmesa->r200Screen->drmSupportsCubeMaps) { + ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); + ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + } + else { + ALLOC_STATE( cube[0], never, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); + ALLOC_STATE( cube[1], never, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + } ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 ); ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 ); @@ -656,7 +650,7 @@ void r200InitState( r200ContextPtr rmesa ) ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION, &l->LinearAttenuation ); ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION, - &l->QuadraticAttenuation ); + &l->QuadraticAttenuation ); } ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT, diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 5a6586b5dd1..ca5c456889d 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v 1.5 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -396,7 +395,7 @@ static void flush_last_swtcl_prim( r200ContextPtr rmesa ) if (rmesa->dma.current.buf) { struct r200_dma_region *current = &rmesa->dma.current; - GLuint current_offset = (rmesa->r200Screen->agp_buffer_offset + + GLuint current_offset = (rmesa->r200Screen->gart_buffer_offset + current->buf->buf->idx * RADEON_BUFFER_SIZE + current->start); @@ -445,7 +444,7 @@ static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa, { - char *head = rmesa->dma.current.address + rmesa->dma.current.ptr; + GLubyte *head = (GLubyte *) (rmesa->dma.current.address + rmesa->dma.current.ptr); rmesa->dma.current.ptr += bytes; rmesa->swtcl.numverts += nverts; return head; @@ -589,7 +588,7 @@ do { \ \ r200EmitVertexAOS( rmesa, \ rmesa->swtcl.vertex_size, \ - (rmesa->r200Screen->agp_buffer_offset + \ + (rmesa->r200Screen->gart_buffer_offset + \ rmesa->swtcl.indexed_verts.buf->buf->idx * \ RADEON_BUFFER_SIZE + \ rmesa->swtcl.indexed_verts.start)); \ diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h index 9a36fb68fa9..f183b931c45 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.h +++ b/src/mesa/drivers/dri/r200/r200_swtcl.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 71e3d5256a9..60e281ffaf3 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.c,v 1.2 2002/12/16 16:18:55 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_tcl.h b/src/mesa/drivers/dri/r200/r200_tcl.h index a2db2e18a6e..0fdf9c22c78 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.h +++ b/src/mesa/drivers/dri/r200/r200_tcl.h @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 5f8d06ae62e..f19f877cab5 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -296,7 +296,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - const GLboolean do32bpt = ( rmesa->r200Screen->cpp == 4 ); + const GLboolean do32bpt = rmesa->default32BitTextures; switch ( internalFormat ) { case 4: @@ -495,7 +495,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target, * relaxed, but would need to store the image pitch somewhere, * as packing details might change before image is uploaded: */ - if (!r200IsAgpMemory( rmesa, pixels, srcHeight * srcRowStride ) || + if (!r200IsGartMemory( rmesa, pixels, srcHeight * srcRowStride ) || (srcRowStride & 63)) return 0; @@ -626,8 +626,8 @@ static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level, fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__); /* Normal path: copy (to cached memory) and eventually upload - * via another copy to agp memory and then a blit... Could - * eliminate one copy by going straight to (permanent) agp. + * via another copy to GART memory and then a blit... Could + * eliminate one copy by going straight to (permanent) GART. * * Note, this will call r200ChooseTextureFormat. */ @@ -729,8 +729,8 @@ static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level, fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__); /* Normal path: copy (to cached memory) and eventually upload - * via another copy to agp memory and then a blit... Could - * eliminate one copy by going straight to (permanent) agp. + * via another copy to GART memory and then a blit... Could + * eliminate one copy by going straight to (permanent) GART. * * Note, this will call r200ChooseTextureFormat. */ diff --git a/src/mesa/drivers/dri/r200/r200_tex.h b/src/mesa/drivers/dri/r200/r200_tex.h index 9013de6d795..a4301206ed8 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.h +++ b/src/mesa/drivers/dri/r200/r200_tex.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c index 34777085ac5..34db1f4421e 100644 --- a/src/mesa/drivers/dri/r200/r200_texmem.c +++ b/src/mesa/drivers/dri/r200/r200_texmem.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */ /************************************************************************** Copyright (C) Tungsten Graphics 2002. All Rights Reserved. @@ -35,6 +35,7 @@ SOFTWARE. * Gareth Hughes <[email protected]> * */ + #include <errno.h> #include "glheader.h" @@ -86,12 +87,12 @@ r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t ) */ -static void r200UploadAGPClientSubImage( r200ContextPtr rmesa, - r200TexObjPtr t, - struct gl_texture_image *texImage, - GLint hwlevel, - GLint x, GLint y, - GLint width, GLint height ) +static void r200UploadGARTClientSubImage( r200ContextPtr rmesa, + r200TexObjPtr t, + struct gl_texture_image *texImage, + GLint hwlevel, + GLint x, GLint y, + GLint width, GLint height ) { const struct gl_texture_format *texFormat = texImage->TexFormat; GLuint srcPitch, dstPitch; @@ -124,7 +125,7 @@ static void r200UploadAGPClientSubImage( r200ContextPtr rmesa, } t->image[0][hwlevel].data = texImage->Data; - srcOffset = r200AgpOffsetFromVirtual( rmesa, texImage->Data ); + srcOffset = r200GartOffsetFromVirtual( rmesa, texImage->Data ); assert( srcOffset != ~0 ); @@ -181,16 +182,16 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa, height = texImage->Height; dstPitch = t->pp_txpitch + 32; - if (rmesa->prefer_agp_client_texturing && texImage->IsClientData) { - /* In this case, could also use agp texturing. This is + if (rmesa->prefer_gart_client_texturing && texImage->IsClientData) { + /* In this case, could also use GART texturing. This is * currently disabled, but has been tested & works. */ - t->pp_txoffset = r200AgpOffsetFromVirtual( rmesa, texImage->Data ); + t->pp_txoffset = r200GartOffsetFromVirtual( rmesa, texImage->Data ); t->pp_txpitch = texImage->RowStride * texFormat->TexelBytes - 32; if (R200_DEBUG & DEBUG_TEXTURE) fprintf(stderr, - "Using agp texturing for rectangular client texture\n"); + "Using GART texturing for rectangular client texture\n"); /* Release FB memory allocated for this image: */ @@ -202,21 +203,21 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa, } } else if (texImage->IsClientData) { - /* Data already in agp memory, with usable pitch. + /* Data already in GART memory, with usable pitch. */ GLuint srcPitch; srcPitch = texImage->RowStride * texFormat->TexelBytes; r200EmitBlit( rmesa, blit_format, srcPitch, - r200AgpOffsetFromVirtual( rmesa, texImage->Data ), + r200GartOffsetFromVirtual( rmesa, texImage->Data ), dstPitch, t->bufAddr, 0, 0, 0, 0, width, height ); } else { - /* Data not in agp memory, or bad pitch. + /* Data not in GART memory, or bad pitch. */ for (done = 0; done < height ; ) { struct r200_dma_region region; @@ -344,9 +345,9 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, } else if (texImage->IsClientData) { if ( R200_DEBUG & DEBUG_TEXTURE ) - fprintf( stderr, "%s: image data is in agp client storage\n", + fprintf( stderr, "%s: image data is in GART client storage\n", __FUNCTION__); - r200UploadAGPClientSubImage( rmesa, t, texImage, hwlevel, + r200UploadGARTClientSubImage( rmesa, t, texImage, hwlevel, x, y, width, height ); return; } diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index e1dc206d927..3d82aac3234 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -106,7 +105,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; GLint curOffset; GLint i; - GLint firstLevel=0, lastLevel=0, numLevels; + GLint numLevels; GLint log2Width, log2Height, log2Depth; /* Set the hardware texture format @@ -126,66 +125,15 @@ static void r200SetTexImages( r200ContextPtr rmesa, } - /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. */ - if (R200_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, - "%s: BaseLevel %d MinLod %f MaxLod %f MaxLevel %d\n", - __FUNCTION__, - tObj->BaseLevel, tObj->MinLod, tObj->MaxLod, - tObj->MaxLevel); - - - switch (tObj->Target) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP: - firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Depth = 0; - break; - case GL_TEXTURE_3D: - firstLevel = tObj->BaseLevel; - lastLevel = tObj->BaseLevel; - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Depth = tObj->Image[firstLevel]->DepthLog2; - break; - case GL_TEXTURE_RECTANGLE_NV: - firstLevel = lastLevel = 0; - log2Width = log2Height = 1; /* ? */ - log2Depth = 0; - break; - default: - return; - } - - /* save these values */ - t->base.firstLevel = firstLevel; - t->base.lastLevel = lastLevel; - numLevels = lastLevel - firstLevel + 1; - - if (R200_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, - "%s: firstLevel %d last Level %d w,h: %d,%d log(w,h) %d,%d\n", - __FUNCTION__, firstLevel, lastLevel, - tObj->Image[firstLevel]->Width, - tObj->Image[firstLevel]->Height, - tObj->Image[firstLevel]->WidthLog2, - tObj->Image[firstLevel]->HeightLog2); + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; + log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2; + numLevels = t->base.lastLevel - t->base.firstLevel + 1; assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); @@ -199,7 +147,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, const struct gl_texture_image *texImage; GLuint size; - texImage = tObj->Image[i + firstLevel]; + texImage = tObj->Image[i + t->base.firstLevel]; if ( !texImage ) break; @@ -219,10 +167,12 @@ static void r200SetTexImages( r200ContextPtr rmesa, } assert(size > 0); - if (curOffset & 0x1f) { - /* align to 32-byte offset */ - curOffset = (curOffset + 0x1f) & ~0x1f; - } + + /* Align to 32-byte offset. It is faster to do this unconditionally + * (no branch penalty). + */ + + curOffset = (curOffset + 0x1f) & ~0x1f; t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES; t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES; @@ -305,17 +255,17 @@ static void r200SetTexImages( r200ContextPtr rmesa, (log2Height << R200_FACE_HEIGHT_4_SHIFT)); } - t->pp_txsize = (((tObj->Image[firstLevel]->Width - 1) << 0) | - ((tObj->Image[firstLevel]->Height - 1) << 16)); + t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) | + ((tObj->Image[t->base.firstLevel]->Height - 1) << 16)); /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) - t->pp_txpitch = (tObj->Image[firstLevel]->Width + 63) & ~(63); + t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63); else - t->pp_txpitch = ((tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); + t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); t->pp_txpitch -= 32; t->dirty_state = TEX_ALL; @@ -1561,6 +1511,12 @@ static GLboolean enable_tex_3d( GLcontext *ctx, int unit ) ASSERT(tObj->Target == GL_TEXTURE_3D); + /* R100 & R200 do not support mipmaps for 3D textures. + */ + if ( (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR) ) { + return GL_FALSE; + } + if ( t->base.dirty_images[0] ) { R200_FIREVERTICES( rmesa ); r200SetTexImages( rmesa, tObj ); @@ -1633,7 +1589,7 @@ static GLboolean enable_tex_rect( GLcontext *ctx, int unit ) R200_FIREVERTICES( rmesa ); r200SetTexImages( rmesa, tObj ); r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 ); - if ( !t->base.memBlock && !rmesa->prefer_agp_client_texturing ) + if ( !t->base.memBlock && !rmesa->prefer_gart_client_texturing ) return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/src/mesa/drivers/dri/r200/r200_vtxfmt.c index 824216eb350..2e742d4d04f 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c,v 1.4 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -975,7 +974,7 @@ static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags ) */ -void r200VtxfmtInit( GLcontext *ctx ) +void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLvertexformat *vfmt = &(rmesa->vb.vtxfmt); @@ -1073,7 +1072,7 @@ void r200VtxfmtInit( GLcontext *ctx ) make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB ); make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB ); - r200InitCodegen( &rmesa->vb.codegen ); + r200InitCodegen( &rmesa->vb.codegen, useCodegen ); } static void free_funcs( struct dynfn *l ) diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.h b/src/mesa/drivers/dri/r200/r200_vtxfmt.h index fde3eca4678..39f0a10e4eb 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.h +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -44,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r200VtxfmtUpdate( GLcontext *ctx ); -extern void r200VtxfmtInit( GLcontext *ctx ); +extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ); extern void r200VtxfmtInvalidate( GLcontext *ctx ); extern void r200VtxfmtDestroy( GLcontext *ctx ); extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt ); @@ -87,7 +86,7 @@ do { \ /* */ -void r200InitCodegen( struct dfn_generators *gen ); +void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen ); void r200InitX86Codegen( struct dfn_generators *gen ); void r200InitSSECodegen( struct dfn_generators *gen ); diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c index bdda60eea09..6f38fffc276 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -865,7 +864,7 @@ static struct dynfn *codegen_noop( GLcontext *ctx, const int *key ) return 0; } -void r200InitCodegen( struct dfn_generators *gen ) +void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen ) { gen->Vertex3f = codegen_noop; gen->Vertex3fv = codegen_noop; @@ -894,7 +893,7 @@ void r200InitCodegen( struct dfn_generators *gen ) gen->MultiTexCoord1fARB = codegen_noop; gen->MultiTexCoord1fvARB = codegen_noop; - if (!getenv("R200_NO_CODEGEN")) { + if (useCodegen) { #if defined(USE_X86_ASM) r200InitX86Codegen( gen ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c index 83eb3e13b78..2245bbcef1b 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c index a806eca0bb3..c4d8af85e16 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S b/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S index 4980ce1bb76..56a4144e8e7 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S +++ b/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.2 2002/11/07 18:31:59 tsi Exp $ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. @@ -32,16 +32,6 @@ x: .data .align 4 -GLOBL( _x86_Normal3fv) - movl 4(%esp), %eax /* load 'v' off stack */ - movl (%eax), %ecx /* load v[0] */ - movl 4(%eax), %edx /* load v[1] */ - movl 8(%eax), %eax /* load v[2] */ - movl %ecx, 0 /* store v[0] to current vertex */ - movl %edx, 4 /* store v[1] to current vertex */ - movl %eax, 8 /* store v[2] to current vertex */ - ret -GLOBL ( _x86_Normal3fv_end ) /* vertex 3f vertex size 4 @@ -218,19 +208,70 @@ GLOBL ( _x86_Vertex3fv ) .6: jmp *0 GLOBL ( _x86_Vertex3fv_end ) -/* - Normal 3f -*/ -GLOBL ( _x86_Normal3f ) - movl $0x12345678, %edx + +/** + * Generic handler for 2 float format data. This can be used for + * TexCoord2f and possibly other functions. + */ + +GLOBL ( _x86_Attribute2f ) + movl $0x0, %edx movl 4(%esp), %eax + movl 8(%esp), %ecx movl %eax, (%edx) - movl 8(%esp), %eax - movl %eax, 4(%edx) + movl %ecx, 4(%edx) + ret +GLOBL ( _x86_Attribute2f_end ) + + +/** + * Generic handler for 2 float vector format data. This can be used for + * TexCoord2fv and possibly other functions. + */ + +GLOBL( _x86_Attribute2fv) + movl 4(%esp), %eax /* load 'v' off stack */ + movl (%eax), %ecx /* load v[0] */ + movl 4(%eax), %eax /* load v[1] */ + movl %ecx, 0 /* store v[0] to current vertex */ + movl %eax, 4 /* store v[1] to current vertex */ + ret +GLOBL ( _x86_Attribute2fv_end ) + + +/** + * Generic handler for 3 float format data. This can be used for + * Normal3f, Color3f (when the color target is also float), or + * TexCoord3f. + */ + +GLOBL ( _x86_Attribute3f ) + movl 4(%esp), %ecx + movl 8(%esp), %edx movl 12(%esp), %eax - movl %eax, 8(%edx) + movl %ecx, 0 + movl %edx, 4 + movl %eax, 8 ret -GLOBL ( _x86_Normal3f_end ) +GLOBL ( _x86_Attribute3f_end ) + +/** + * Generic handler for 3 float vector format data. This can be used for + * Normal3f, Color3f (when the color target is also float), or + * TexCoord3f. + */ + +GLOBL( _x86_Attribute3fv) + movl 4(%esp), %eax /* load 'v' off stack */ + movl (%eax), %ecx /* load v[0] */ + movl 4(%eax), %edx /* load v[1] */ + movl 8(%eax), %eax /* load v[2] */ + movl %ecx, 0 /* store v[0] to current vertex */ + movl %edx, 4 /* store v[1] to current vertex */ + movl %eax, 8 /* store v[2] to current vertex */ + ret +GLOBL ( _x86_Attribute3fv_end ) + /* Color 4ubv_ub @@ -290,69 +331,13 @@ GLOBL( _x86_Color4ub_ub ) ret GLOBL( _x86_Color4ub_ub_end ) -/* - Color3fv_3f -*/ -GLOBL( _x86_Color3fv_3f ) - movl 4(%esp), %eax - movl $0, %edx - movl (%eax), %ecx - movl %ecx, (%edx) - movl 4(%eax), %ecx - movl %ecx, 4(%edx) - movl 8(%eax), %ecx - movl %ecx, 8(%edx) - ret -GLOBL( _x86_Color3fv_3f_end ) - -/* - Color3f_3f -*/ -GLOBL( _x86_Color3f_3f ) - movl $0x12345678, %edx - movl 4(%esp), %eax - movl %eax, (%edx) - movl 8(%esp,1), %eax - movl %eax, 4(%edx) - movl 12(%esp), %eax - movl %eax, 8(%edx) - ret -GLOBL( _x86_Color3f_3f_end ) /* - TexCoord2fv + MultiTexCoord2fv st0/st1 */ - -GLOBL( _x86_TexCoord2fv ) - movl 4(%esp), %eax - movl $0x12345678, %edx - movl (%eax), %ecx - movl 4(%eax), %eax - movl %ecx, (%edx) - movl %eax, 4(%edx) - ret - -GLOBL( _x86_TexCoord2fv_end ) -/* - TexCoord2f -*/ -GLOBL( _x86_TexCoord2f ) - movl $0x12345678, %edx +GLOBL( _x86_MultiTexCoord2fv ) movl 4(%esp), %eax movl 8(%esp), %ecx - movl %eax, (%edx) - movl %ecx, 4(%edx) - ret -GLOBL( _x86_TexCoord2f_end ) - -/* - MultiTexCoord2fvARB st0/st1 -*/ -GLOBL( _x86_MultiTexCoord2fvARB ) - - movl 4(%esp), %eax - movl 8(%esp), %ecx - sub $0x84c0, %eax and $1, %eax movl (%ecx), %edx shl $3, %eax @@ -360,15 +345,15 @@ GLOBL( _x86_MultiTexCoord2fvARB ) movl %edx, 0xdeadbeef(%eax) movl %ecx, 0xdeadbeef(%eax) ret -GLOBL( _x86_MultiTexCoord2fvARB_end ) +GLOBL( _x86_MultiTexCoord2fv_end ) + /* - MultiTexCoord2fvARB + MultiTexCoord2fv */ -GLOBL( _x86_MultiTexCoord2fvARB_2 ) +GLOBL( _x86_MultiTexCoord2fv_2 ) movl 4(%esp,1), %eax movl 8(%esp,1), %ecx - sub $0x84c0, %eax and $0x1, %eax movl 0(,%eax,4), %edx movl (%ecx), %eax @@ -376,35 +361,132 @@ GLOBL( _x86_MultiTexCoord2fvARB_2 ) movl 4(%ecx), %eax movl %eax, 4(%edx) ret - -GLOBL( _x86_MultiTexCoord2fvARB_2_end ) +GLOBL( _x86_MultiTexCoord2fv_2_end ) /* - MultiTexCoord2fARB st0/st1 + MultiTexCoord2f st0/st1 */ -GLOBL( _x86_MultiTexCoord2fARB ) +GLOBL( _x86_MultiTexCoord2f ) movl 4(%esp), %eax movl 8(%esp), %edx - sub $0x84c0, %eax movl 12(%esp), %ecx and $1, %eax shl $3, %eax movl %edx, 0xdeadbeef(%eax) movl %ecx, 0xdeadbeef(%eax) ret -GLOBL( _x86_MultiTexCoord2fARB_end ) +GLOBL( _x86_MultiTexCoord2f_end ) /* - MultiTexCoord2fARB + MultiTexCoord2f */ -GLOBL( _x86_MultiTexCoord2fARB_2 ) +GLOBL( _x86_MultiTexCoord2f_2 ) movl 4(%esp), %eax movl 8(%esp), %edx - sub $0x84c0, %eax movl 12(%esp,1), %ecx and $1,%eax movl 0(,%eax,4), %eax movl %edx, (%eax) movl %ecx, 4(%eax) ret -GLOBL( _x86_MultiTexCoord2fARB_2_end ) +GLOBL( _x86_MultiTexCoord2f_2_end ) + +/** + * This can be used as a template for either Color3fv (when the color + * target is also a 3f) or Normal3fv. + */ + +GLOBL( _sse_Attribute3fv ) + movl 4(%esp), %eax + movlps (%eax), %xmm0 + movl 8(%eax), %eax + movlps %xmm0, 0 + movl %eax, 8 + ret +GLOBL( _sse_Attribute3fv_end ) + +/** + * This can be used as a template for either Color3f (when the color + * target is also a 3f) or Normal3f. + */ + +GLOBL( _sse_Attribute3f ) + movlps 4(%esp), %xmm0 + movl 12(%esp), %eax + movlps %xmm0, 0 + movl %eax, 8 + ret +GLOBL( _sse_Attribute3f_end ) + + +/** + * Generic handler for 2 float vector format data. This can be used for + * TexCoord2fv and possibly other functions. + */ + +GLOBL( _sse_Attribute2fv ) + movl 4(%esp), %eax + movlps (%eax), %xmm0 + movlps %xmm0, 0 + ret +GLOBL( _sse_Attribute2fv_end ) + + +/** + * Generic handler for 2 float format data. This can be used for + * TexCoord2f and possibly other functions. + */ + +GLOBL( _sse_Attribute2f ) + movlps 4(%esp), %xmm0 + movlps %xmm0, 0 + ret +GLOBL( _sse_Attribute2f_end ) + +/* + MultiTexCoord2fv st0/st1 +*/ +GLOBL( _sse_MultiTexCoord2fv ) + movl 4(%esp), %eax + movl 8(%esp), %ecx + and $1, %eax + movlps (%ecx), %xmm0 + movlps %xmm0, 0xdeadbeef(,%eax,8) + ret +GLOBL( _sse_MultiTexCoord2fv_end ) + +/* + MultiTexCoord2fv +*/ +GLOBL( _sse_MultiTexCoord2fv_2 ) + movl 4(%esp), %eax + movl 8(%esp), %ecx + and $0x1, %eax + movl 0(,%eax,4), %edx + movlps (%ecx), %xmm0 + movlps %xmm0, (%edx) + ret +GLOBL( _sse_MultiTexCoord2fv_2_end ) + +/* + MultiTexCoord2f st0/st1 +*/ +GLOBL( _sse_MultiTexCoord2f ) + movl 4(%esp), %eax + and $1, %eax + movlps 8(%esp), %xmm0 + movlps %xmm0, 0xdeadbeef(,%eax,8) + ret +GLOBL( _sse_MultiTexCoord2f_end ) + +/* + MultiTexCoord2f +*/ +GLOBL( _sse_MultiTexCoord2f_2 ) + movl 4(%esp), %eax + movlps 8(%esp), %xmm0 + and $1,%eax + movl 0(,%eax,4), %eax + movlps %xmm0, (%eax) + ret +GLOBL( _sse_MultiTexCoord2f_2_end ) diff --git a/src/mesa/drivers/dri/radeon/Makefile.X11 b/src/mesa/drivers/dri/radeon/Makefile.X11 index b73abe8f51b..7660fb0d0db 100644 --- a/src/mesa/drivers/dri/radeon/Makefile.X11 +++ b/src/mesa/drivers/dri/radeon/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.1 2003/08/22 20:11:45 brianp Exp $ +# $Id: Makefile.X11,v 1.1.2.1 2003/11/21 15:49:32 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -49,7 +49,8 @@ DRIVER_SOURCES = radeon_context.c \ ../common/mm.c \ ../common/utils.c \ ../common/texmem.c \ - ../common/vblank.c + ../common/vblank.c \ + ../common/xmlconfig.c SUBSET_DRIVER_SOURCES = \ radeon_subset_bitmap.c \ @@ -132,6 +133,10 @@ $(TARGET): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/$(TARGET) && \ install $(TARGET) $(TOP)/lib/$(TARGET) +$(TOP)/lib/$(TARGET): $(TARGET) + rm -f $(TOP)/lib/$(TARGET) && \ + install $(TARGET) $(TOP)/lib/$(TARGET) + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 7ade6c3951b..02bfb23ca59 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.7 2003/02/08 21:26:45 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.9 2003/09/24 02:43:12 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -69,6 +69,25 @@ int RADEON_DEBUG = (0); #endif +/* Radeon configuration + */ +#include "xmlpool.h" + +const char __driConfigOptions[] = +DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN) + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_PREFERRED_BPT(0,"0,16,32") + DRI_CONF_SECTION_END + DRI_CONF_SECTION_DEBUG + DRI_CONF_NO_RAST(false) + DRI_CONF_SECTION_END +DRI_CONF_END; +const GLuint __driNConfigOptions = 5; /* Return the width and height of the given buffer. */ @@ -102,8 +121,7 @@ static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name ) offset = driGetRendererString( buffer, "Radeon", DRIVER_DATE, agp_mode ); - sprintf( & buffer[ offset ], "%s %sTCL", - ( rmesa->dri.drmMinor < 3 ) ? " DRM-COMPAT" : "", + sprintf( & buffer[ offset ], "%sTCL", !(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE) ? "" : "NO-" ); @@ -229,6 +247,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, radeonContextPtr rmesa; GLcontext *ctx, *shareCtx; int i; + int tcl_mode, fthrottle_mode, preferred_bpt; assert(glVisual); assert(driContextPriv); @@ -258,13 +277,11 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.fd = sPriv->fd; + rmesa->dri.drmMinor = sPriv->drmMinor; - /* If we don't have 1.3, fallback to the 1.1 interfaces. - */ - if (getenv("RADEON_COMPAT") || sPriv->drmMinor < 3 ) - rmesa->dri.drmMinor = 1; - else - rmesa->dri.drmMinor = sPriv->drmMinor; + /* Parse configuration files */ + driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, + screen->driScreen->myNum, "radeon"); rmesa->radeonScreen = screen; rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA + @@ -291,6 +308,9 @@ radeonCreateContext( const __GLcontextModes *glVisual, driSetTextureSwapCounterLocation( rmesa->texture_heaps[i], & rmesa->c_textureSwaps ); } + preferred_bpt = driQueryOptioni (&rmesa->optionCache, "preferred_bpt"); + rmesa->default32BitTextures = + ( ( preferred_bpt == 0 && screen->cpp == 4 ) || preferred_bpt == 32 ); rmesa->swtcl.RenderIndex = ~0; rmesa->lost_context = 1; @@ -338,7 +358,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, MIN2( ctx->Const.MaxArrayLockSize, RADEON_BUFFER_SIZE / RADEON_MAX_TCL_VERTSIZE ); - rmesa->boxes = (getenv("LIBGL_PERFORMANCE_BOXES") != NULL); + rmesa->boxes = 0; /* Initialize the software rasterizer and helper modules. */ @@ -395,22 +415,24 @@ radeonCreateContext( const __GLcontextModes *glVisual, _mesa_vector4f_alloc( &rmesa->tcl.ObjClean, 0, ctx->Const.MaxArrayLockSize, 32 ); + fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode"); rmesa->iw.irq_seq = -1; rmesa->irqsEmitted = 0; - rmesa->do_irqs = (rmesa->radeonScreen->irq && !getenv("RADEON_NO_IRQS")); + rmesa->do_irqs = (rmesa->radeonScreen->irq != 0 && + fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS); - rmesa->do_usleeps = !getenv("RADEON_NO_USLEEPS"); - - rmesa->vblank_flags = (rmesa->do_irqs) - ? driGetDefaultVBlankFlags() : VBLANK_FLAG_NO_IRQ; + rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); + rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0) + ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; #ifndef _SOLO - rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( "__glXGetUST" ); - if ( rmesa->get_ust == NULL ) -#endif - { + rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); + if ( rmesa->get_ust == NULL ) { rmesa->get_ust = get_ust_nop; } +#else + rmesa->get_ust = get_ust_nop; +#endif (*rmesa->get_ust)( & rmesa->swap_ust ); @@ -420,25 +442,20 @@ radeonCreateContext( const __GLcontextModes *glVisual, debug_control ); #endif - if (getenv("RADEON_NO_RAST")) { + tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (driQueryOptionb(&rmesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); FALLBACK(rmesa, RADEON_FALLBACK_DISABLE, 1); - } - else if (getenv("RADEON_TCL_FORCE_ENABLE")) { - fprintf(stderr, "Enabling TCL support... this will probably crash\n"); - fprintf(stderr, " your card if it isn't capable of TCL!\n"); - rmesa->radeonScreen->chipset |= RADEON_CHIPSET_TCL; - } else if (getenv("RADEON_TCL_FORCE_DISABLE") || - rmesa->dri.drmMinor < 3 || - !(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) { + } else if (tcl_mode == DRI_CONF_TCL_SW || + !(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) { rmesa->radeonScreen->chipset &= ~RADEON_CHIPSET_TCL; fprintf(stderr, "disabling TCL support\n"); TCL_FALLBACK(rmesa->glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1); } if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) { - if (!getenv("RADEON_NO_VTXFMT")) - radeonVtxfmtInit( ctx ); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) + radeonVtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN ); _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); } @@ -481,9 +498,11 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv ) radeonFlushCmdBuf( rmesa, __FUNCTION__ ); } - if (!rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE) - if (!getenv("RADEON_NO_VTXFMT")) + if (!(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)) { + int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) radeonVtxfmtDestroy( rmesa->glCtx ); + } /* free the Mesa context */ rmesa->glCtx->DriverCtx = NULL; @@ -502,8 +521,7 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv ) */ int i; - /* this assert is not correct, default textures are always on swap list - assert( is_empty_list( & rmesa->swapped ) ); */ + assert( is_empty_list( & rmesa->swapped ) ); for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) { driDestroyTextureHeap( rmesa->texture_heaps[ i ] ); @@ -511,6 +529,9 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv ) } } + /* free the option cache */ + driDestroyOptionCache (&rmesa->optionCache); + FREE( rmesa ); } } @@ -561,11 +582,12 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv, fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx); if ( newCtx->dri.drawable != driDrawPriv ) { + driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags ); newCtx->dri.drawable = driDrawPriv; radeonUpdateWindow( newCtx->glCtx ); radeonUpdateViewportOffset( newCtx->glCtx ); } - + _mesa_make_current2( newCtx->glCtx, (GLframebuffer *) driDrawPriv->driverPrivate, (GLframebuffer *) driReadPriv->driverPrivate ); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 113d1de5b20..b0c3c1919e1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -446,7 +446,7 @@ struct radeon_dma_buffer { drmBufPtr buf; }; -#define GET_START(rvb) (rmesa->radeonScreen->agp_buffer_offset + \ +#define GET_START(rvb) (rmesa->radeonScreen->gart_buffer_offset + \ (rvb)->address - rmesa->dma.buf0_address + \ (rvb)->start) @@ -697,6 +697,7 @@ struct radeon_context { unsigned nr_heaps; driTexHeap * texture_heaps[ RADEON_NR_TEX_HEAPS ]; driTextureObject swapped; + GLboolean default32BitTextures; /* Rasterization and vertex state: @@ -770,6 +771,10 @@ struct radeon_context { */ struct radeon_dri_mirror dri; + /* Configuration cache + */ + driOptionCache optionCache; + /* Performance counters */ diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index a388720aba1..4e1f451e70a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -34,8 +34,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Gareth Hughes <[email protected]> * Keith Whitwell <[email protected]> */ + #include <sched.h> -#include <errno.h> +#include <errno.h> #include "glheader.h" #include "imports.h" @@ -162,7 +163,6 @@ extern void radeonEmitVbufPrim( radeonContextPtr rmesa, drmRadeonCmdHeader *cmd; - assert(rmesa->dri.drmMinor >= 3); assert(!(primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); radeonEmitState( rmesa ); @@ -254,7 +254,6 @@ GLushort *radeonAllocEltsOpenEnded( radeonContextPtr rmesa, if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s %d\n", __FUNCTION__, min_nr); - assert(rmesa->dri.drmMinor >= 3); assert((primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); radeonEmitState( rmesa ); @@ -317,7 +316,6 @@ void radeonEmitVertexAOS( radeonContextPtr rmesa, rmesa->ioctl.vertex_offset = offset; #else drmRadeonCmdHeader *cmd; - assert(rmesa->dri.drmMinor >= 3); if (RADEON_DEBUG & (DEBUG_PRIMS|DEBUG_IOCTL)) fprintf(stderr, "%s: vertex_size 0x%x offset 0x%x \n", @@ -356,7 +354,6 @@ void radeonEmitAOS( radeonContextPtr rmesa, if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s\n", __FUNCTION__); - assert(rmesa->dri.drmMinor >= 3); cmd = (drmRadeonCmdHeader *)radeonAllocCmdBuf( rmesa, sz * sizeof(int), __FUNCTION__ ); @@ -531,8 +528,6 @@ void radeonFlushCmdBuf( radeonContextPtr rmesa, const char *caller ) int ret; - assert (rmesa->dri.drmMinor >= 3); - LOCK_HARDWARE( rmesa ); ret = radeonFlushCmdBufLocked( rmesa, caller ); @@ -691,9 +686,6 @@ void radeonAllocDmaRegion( radeonContextPtr rmesa, rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */ rmesa->dma.current.start = rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7; - - if ( rmesa->dri.drmMinor < 3 ) - radeonRefillCurrentDmaRegion( rmesa ); } void radeonAllocDmaRegionVerts( radeonContextPtr rmesa, @@ -719,7 +711,7 @@ static CARD32 radeonGetLastFrame (radeonContextPtr rmesa) drmRadeonGetParam gp; gp.param = RADEON_PARAM_LAST_FRAME; - gp.value = &frame; + gp.value = (int *)&frame; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); } @@ -1012,7 +1004,7 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all, drmRadeonGetParam gp; gp.param = RADEON_PARAM_LAST_CLEAR; - gp.value = &clear; + gp.value = (int *)&clear; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); } else @@ -1154,13 +1146,11 @@ void radeonFlush( GLcontext *ctx ) if (rmesa->dma.flush) rmesa->dma.flush( rmesa ); - if (rmesa->dri.drmMinor >= 3) { - if (!is_empty_list(&rmesa->hw.dirty)) - radeonEmitState( rmesa ); + if (!is_empty_list(&rmesa->hw.dirty)) + radeonEmitState( rmesa ); - if (rmesa->store.cmd_used) - radeonFlushCmdBuf( rmesa, __FUNCTION__ ); - } + if (rmesa->store.cmd_used) + radeonFlushCmdBuf( rmesa, __FUNCTION__ ); } /* Make sure all commands have been sent to the hardware and have diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index 96a4f9d1123..daf001e048a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -53,8 +53,6 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa ) { int use_back; - if (rmesa->dri.drmMinor < 3) - return; rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos.h b/src/mesa/drivers/dri/radeon/radeon_maos.h index 7e2bd643d34..8c8aa15c59f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h,v 1.1 2002/10/30 12:51:55 alanh Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index cec05a89d7e..fc55b89b030 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -409,7 +409,7 @@ static void emit_tex_vector( GLcontext *ctx, -/* Emit any changed arrays to new agp memory, re-emit a packet to +/* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index 09e8a355798..5e63e6e880f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/src/mesa/drivers/dri/radeon/radeon_sanity.c b/src/mesa/drivers/dri/radeon/radeon_sanity.c index e3b37bf3de9..3bc15bdcb47 100644 --- a/src/mesa/drivers/dri/radeon/radeon_sanity.c +++ b/src/mesa/drivers/dri/radeon/radeon_sanity.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */ /************************************************************************** Copyright 2002 ATI Technologies Inc., Ontario, Canada, and @@ -32,7 +32,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <[email protected]> * */ -#include <errno.h> +#include <errno.h> #include "glheader.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index ec8ed42d649..8f2042af13f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.6 2002/12/16 16:18:58 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.7 2003/03/26 20:43:51 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -48,7 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _SOLO #include "glxextensions.h" -#endif +#endif #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... @@ -89,32 +89,26 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } - if ( sPriv->drmMinor < 3 || - getenv("RADEON_COMPAT")) { - fprintf( stderr, "Radeon DRI driver:\n\t" - "Compatibility mode for DRM driver version %d.%d.%d\n\t" - "TCL will be disabled, expect reduced performance\n\t" - "(prefer DRM radeon.o 1.3.x or newer)\n\t", - sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); - } - + /* parse information in __driConfigOptions */ + driParseOptionInfo (&screen->optionCache); /* This is first since which regions we map depends on whether or * not we are using a PCI card. */ screen->IsPCI = dri_priv->IsPCI; - if (sPriv->drmMinor >= 3) { + { int ret; drmRadeonGetParam gp; - gp.param = RADEON_PARAM_AGP_BUFFER_OFFSET; - gp.value = &screen->agp_buffer_offset; + gp.param = RADEON_PARAM_GART_BUFFER_OFFSET; + gp.value = &screen->gart_buffer_offset; ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (ret) { - fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_AGP_BUFFER_OFFSET): %d\n", ret); + FREE( screen ); + fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret); return NULL; } @@ -166,20 +160,26 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } - if ( !screen->IsPCI ) { - screen->agpTextures.handle = dri_priv->agpTexHandle; - screen->agpTextures.size = dri_priv->agpTexMapSize; + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { + unsigned char *RADEONMMIO = screen->mmio.map; + + screen->gartTextures.handle = dri_priv->gartTexHandle; + screen->gartTextures.size = dri_priv->gartTexMapSize; if ( drmMap( sPriv->fd, - screen->agpTextures.handle, - screen->agpTextures.size, - (drmAddressPtr)&screen->agpTextures.map ) ) { + screen->gartTextures.handle, + screen->gartTextures.size, + (drmAddressPtr)&screen->gartTextures.map ) ) { drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); FREE( screen ); - __driUtilMessage("%s: IsPCI failed\n", __FUNCTION__); + __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__); return NULL; } + + screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI + ? INREG( RADEON_AIC_LO_ADDR ) + : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) ); } screen->chipset = 0; @@ -215,21 +215,36 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->logTexGranularity[RADEON_CARD_HEAP] = dri_priv->log2TexGran; - if ( screen->IsPCI - || getenv( "RADEON_AGPTEXTURING_FORCE_DISABLE" ) ) { + if ( !screen->gartTextures.map + || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; - screen->texOffset[RADEON_AGP_HEAP] = 0; - screen->texSize[RADEON_AGP_HEAP] = 0; - screen->logTexGranularity[RADEON_AGP_HEAP] = 0; + screen->texOffset[RADEON_GART_HEAP] = 0; + screen->texSize[RADEON_GART_HEAP] = 0; + screen->logTexGranularity[RADEON_GART_HEAP] = 0; } else { screen->numTexHeaps = RADEON_NR_TEX_HEAPS; - screen->texOffset[RADEON_AGP_HEAP] = - dri_priv->agpTexOffset + RADEON_AGP_TEX_OFFSET; - screen->texSize[RADEON_AGP_HEAP] = dri_priv->agpTexMapSize; - screen->logTexGranularity[RADEON_AGP_HEAP] = - dri_priv->log2AGPTexGran; + screen->texOffset[RADEON_GART_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_GART_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_GART_HEAP] = + dri_priv->log2GARTTexGran; } +#ifndef _SOLO + if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { + PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + void * const psc = sPriv->psc->screenConfigs; + + if ( glx_enable_extension != NULL ) { + if ( screen->irq != 0 ) { + (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + } + (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + } + } +#endif screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; return screen; @@ -244,14 +259,16 @@ void radeonDestroyScreen( __DRIscreenPrivate *sPriv ) if (!screen) return; - if ( !screen->IsPCI ) { - drmUnmap( screen->agpTextures.map, - screen->agpTextures.size ); + if ( screen->gartTextures.map ) { + drmUnmap( screen->gartTextures.map, screen->gartTextures.size ); } drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); + /* free all option information */ + driDestroyOptionInfo (&screen->optionCache); + FREE( screen ); sPriv->private = NULL; } @@ -350,7 +367,7 @@ static struct __DriverAPIRec radeonAPI = { * The __driCreateScreen name is the symbol that libGL.so fetches. * Return: pointer to a __DRIscreenPrivate. */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { @@ -368,10 +385,13 @@ void *__driCreateScreen(struct DRIDriverRec *driver, } #endif - #ifndef _SOLO -/* This function is called by libGL.so as soon as libGL.so is loaded. +/** + * This function is called by libGL.so as soon as libGL.so is loaded. * This is where we'd register new extension functions with the dispatcher. + * + * \todo This interface has been deprecated, so we should probably remove + * this function before the next XFree86 release. */ void __driRegisterExtensions( void ) @@ -381,19 +401,18 @@ __driRegisterExtensions( void ) if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC) - glXGetProcAddress( "__glXEnableExtension" ); + glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" ); if ( glx_enable_extension != NULL ) { - glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE ); - glx_enable_extension( "GLX_SGI_video_sync", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_control", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_frame_usage", GL_FALSE ); + (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE ); } } } #endif - /** * Get information about previous buffer swaps. */ diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 2c69d8657ae..133c3633c1b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -48,6 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_dri.h" #include "radeon_reg.h" #include "radeon_sarea.h" +#include "xmlconfig.h" typedef struct { @@ -83,7 +84,7 @@ typedef struct { radeonRegionRec mmio; radeonRegionRec status; - radeonRegionRec agpTextures; + radeonRegionRec gartTextures; drmBufMapPtr buffers; @@ -91,7 +92,11 @@ typedef struct { __DRIscreenPrivate *driScreen; unsigned int sarea_priv_offset; - unsigned int agp_buffer_offset; /* offset in card memory space */ + unsigned int gart_buffer_offset; /* offset in card memory space */ + unsigned int gart_texture_offset; /* offset in card memory space */ + + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; } radeonScreenRec, *radeonScreenPtr; extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ); diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 971ea699ea2..0b2a1089b8c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c,v 1.3 2003/02/22 06:21:11 dawes Exp $ */ /* * Copyright 2000, 2001 VA Linux Systems Inc., Fremont, California. * diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 48e57c8285a..157a863e328 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -67,7 +67,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RADEON_MAX_SETUP 0x40 static void flush_last_swtcl_prim( radeonContextPtr rmesa ); -static void flush_last_swtcl_prim_compat( radeonContextPtr rmesa ); static struct { void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); @@ -282,7 +281,6 @@ static void radeonRenderStart( GLcontext *ctx ) } if (rmesa->dma.flush != 0 && - rmesa->dma.flush != flush_last_swtcl_prim_compat && rmesa->dma.flush != flush_last_swtcl_prim) rmesa->dma.flush( rmesa ); } @@ -381,7 +379,7 @@ static void flush_last_swtcl_prim( radeonContextPtr rmesa ) if (rmesa->dma.current.buf) { struct radeon_dma_region *current = &rmesa->dma.current; - GLuint current_offset = (rmesa->radeonScreen->agp_buffer_offset + + GLuint current_offset = (rmesa->radeonScreen->gart_buffer_offset + current->buf->buf->idx * RADEON_BUFFER_SIZE + current->start); @@ -408,46 +406,6 @@ static void flush_last_swtcl_prim( radeonContextPtr rmesa ) } -static void flush_last_swtcl_prim_compat( radeonContextPtr rmesa ) -{ - struct radeon_dma_region *current = &rmesa->dma.current; - - if (RADEON_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s buf %p start %d ptr %d\n", - __FUNCTION__, - current->buf, - current->start, - current->ptr); - - assert (!(rmesa->swtcl.hw_primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); - assert (current->start + - rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == - current->ptr); - assert (current->start == 0); - - rmesa->dma.flush = 0; - - if (current->ptr && current->buf) { - assert (current->buf->refcount == 1); - - radeonCompatEmitPrimitive( rmesa, - rmesa->swtcl.vertex_format, - rmesa->swtcl.hw_primitive, - rmesa->swtcl.numverts); - - /* The buffer has been released: - */ - FREE(current->buf); - current->buf = 0; - current->start = 0; - current->ptr = current->end; - - } - - rmesa->swtcl.numverts = 0; -} - - /* Alloc space in the current dma region. */ static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa, @@ -460,22 +418,18 @@ static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa, if (!rmesa->dma.flush) { rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; - if (rmesa->dri.drmMinor == 1) - rmesa->dma.flush = flush_last_swtcl_prim_compat; - else - rmesa->dma.flush = flush_last_swtcl_prim; + rmesa->dma.flush = flush_last_swtcl_prim; } assert( vsize == rmesa->swtcl.vertex_size * 4 ); - assert( rmesa->dma.flush == flush_last_swtcl_prim || - rmesa->dma.flush == flush_last_swtcl_prim_compat); + assert( rmesa->dma.flush == flush_last_swtcl_prim ); assert (rmesa->dma.current.start + rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == rmesa->dma.current.ptr); { - char *head = rmesa->dma.current.address + rmesa->dma.current.ptr; + GLubyte *head = (GLubyte *)(rmesa->dma.current.address + rmesa->dma.current.ptr); rmesa->dma.current.ptr += bytes; rmesa->swtcl.numverts += nverts; return head; @@ -624,7 +578,7 @@ do { \ \ radeonEmitVertexAOS( rmesa, \ rmesa->swtcl.vertex_size, \ - (rmesa->radeonScreen->agp_buffer_offset + \ + (rmesa->radeonScreen->gart_buffer_offset + \ rmesa->swtcl.indexed_verts.buf->buf->idx * \ RADEON_BUFFER_SIZE + \ rmesa->swtcl.indexed_verts.start)); \ @@ -683,15 +637,6 @@ static GLboolean radeon_run_render( GLcontext *ctx, ctx->Line.StippleFlag) /* GH: THIS IS A HACK!!! */ return GL_TRUE; - if (rmesa->dri.drmMinor < 3) { - /* drm 1.1 doesn't support vertex primitives starting in the - * middle of a buffer. It doesn't support sane indexed vertices - * either. drm 1.2 fixes both of these problems, but we don't have a - * compatibility layer to that version yet. - */ - return GL_TRUE; - } - tnl->Driver.Render.Start( ctx ); if (VB->Elts) { @@ -956,7 +901,6 @@ static void radeonResetLineStipple( GLcontext *ctx ); #define RADEON_TWOSIDE_BIT 0x01 #define RADEON_UNFILLED_BIT 0x02 -#define RADEON_OFFSET_BIT 0x04 /* drmMinor == 1 */ #define RADEON_MAX_TRIFUNC 0x08 @@ -969,7 +913,7 @@ static struct { #define DO_FALLBACK 0 -#define DO_OFFSET (IND & RADEON_OFFSET_BIT) +#define DO_OFFSET 0 #define DO_UNFILLED (IND & RADEON_UNFILLED_BIT) #define DO_TWOSIDE (IND & RADEON_TWOSIDE_BIT) #define DO_FLAT 0 @@ -1055,22 +999,6 @@ static struct { #define TAG(x) x##_twoside_unfilled #include "tnl_dd/t_dd_tritmp.h" -#define IND (RADEON_OFFSET_BIT) -#define TAG(x) x##_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (RADEON_TWOSIDE_BIT|RADEON_OFFSET_BIT) -#define TAG(x) x##_twoside_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (RADEON_UNFILLED_BIT|RADEON_OFFSET_BIT) -#define TAG(x) x##_unfilled_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (RADEON_TWOSIDE_BIT|RADEON_UNFILLED_BIT|RADEON_OFFSET_BIT) -#define TAG(x) x##_twoside_unfilled_offset -#include "tnl_dd/t_dd_tritmp.h" - static void init_rast_tab( void ) { @@ -1078,10 +1006,6 @@ static void init_rast_tab( void ) init_twoside(); init_unfilled(); init_twoside_unfilled(); - init_offset(); - init_twoside_offset(); - init_unfilled_offset(); - init_twoside_unfilled_offset(); } /**********************************************************************/ @@ -1140,8 +1064,6 @@ void radeonChooseRenderState( GLcontext *ctx ) if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT; if (flags & DD_TRI_UNFILLED) index |= RADEON_UNFILLED_BIT; - if ((flags & DD_TRI_OFFSET) && - rmesa->dri.drmMinor == 1) index |= RADEON_OFFSET_BIT; if (index != rmesa->swtcl.RenderIndex) { tnl->Driver.Render.Points = rast_tab[index].points; @@ -1304,7 +1226,7 @@ void radeonInitSwtcl( GLcontext *ctx ) tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple; tnl->Driver.Render.BuildVertices = radeonBuildVertices; - rmesa->swtcl.verts = ALIGN_MALLOC( size * 16 * 4, 32 ); + rmesa->swtcl.verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 ); rmesa->swtcl.RenderIndex = ~0; rmesa->swtcl.render_primitive = GL_TRIANGLES; rmesa->swtcl.hw_primitive = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.h b/src/mesa/drivers/dri/radeon/radeon_tcl.h index 1e97d32148a..881264a2676 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h,v 1.2 2003/02/08 21:26:45 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/src/mesa/drivers/dri/radeon/radeon_texmem.c b/src/mesa/drivers/dri/radeon/radeon_texmem.c index 3adc2a951c6..284efb225ac 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texmem.c +++ b/src/mesa/drivers/dri/radeon/radeon_texmem.c @@ -35,7 +35,7 @@ SOFTWARE. * Gareth Hughes <[email protected]> * */ -#include <errno.h> +#include <errno.h> #include "glheader.h" #include "imports.h" @@ -112,8 +112,8 @@ static void radeonUploadRectSubImage( radeonContextPtr rmesa, height = texImage->Height; dstPitch = t->pp_txpitch + 32; - { /* FIXME: prefer AGP-texturing if possible */ - /* Data not in agp memory, or bad pitch. + { /* FIXME: prefer GART-texturing if possible */ + /* Data not in GART memory, or bad pitch. */ for (done = 0; done < height ; ) { struct radeon_dma_region region; diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 6dccd311800..0bece3e8b9b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -107,7 +107,7 @@ static void radeonSetTexImages( radeonContextPtr rmesa, const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; GLint curOffset; GLint i; - GLint firstLevel=0, lastLevel=0, numLevels; + GLint numLevels; GLint log2Width, log2Height, log2Depth; /* Set the hardware texture format @@ -127,40 +127,15 @@ static void radeonSetTexImages( radeonContextPtr rmesa, } - /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. */ - switch (tObj->Target) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Depth = 0; - break; - case GL_TEXTURE_RECTANGLE_NV: - firstLevel = lastLevel = 0; - log2Width = log2Height = 1; /* ? */ - log2Depth = 0; - break; - default: - return; - } - /* save these values */ - t->base.firstLevel = firstLevel; - t->base.lastLevel = lastLevel; + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; + log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2; - numLevels = lastLevel - firstLevel + 1; + numLevels = t->base.lastLevel - t->base.firstLevel + 1; assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); @@ -174,7 +149,7 @@ static void radeonSetTexImages( radeonContextPtr rmesa, const struct gl_texture_image *texImage; GLuint size; - texImage = tObj->Image[i + firstLevel]; + texImage = tObj->Image[i + t->base.firstLevel]; if ( !texImage ) break; @@ -194,10 +169,12 @@ static void radeonSetTexImages( radeonContextPtr rmesa, } assert(size > 0); - if (curOffset & 0x1f) { - /* align to 32-byte offset */ - curOffset = (curOffset + 0x1f) & ~0x1f; - } + + /* Align to 32-byte offset. It is faster to do this unconditionally + * (no branch penalty). + */ + + curOffset = (curOffset + 0x1f) & ~0x1f; t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES; t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES; @@ -237,17 +214,17 @@ static void radeonSetTexImages( radeonContextPtr rmesa, t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) | (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT)); - t->pp_txsize = (((tObj->Image[firstLevel]->Width - 1) << 0) | - ((tObj->Image[firstLevel]->Height - 1) << 16)); + t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) | + ((tObj->Image[t->base.firstLevel]->Height - 1) << 16)); /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) - t->pp_txpitch = (tObj->Image[firstLevel]->Width + 63) & ~(63); + t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63); else - t->pp_txpitch = ((tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); + t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); t->pp_txpitch -= 32; t->dirty_state = TEX_ALL; @@ -1500,7 +1477,7 @@ static GLboolean enable_tex_rect( GLcontext *ctx, int unit ) RADEON_FIREVERTICES( rmesa ); radeonSetTexImages( rmesa, tObj ); radeonUploadTexImages( rmesa, (radeonTexObjPtr) tObj->DriverData, 0 ); - if ( !t->base.memBlock /* && !rmesa->prefer_agp_client_texturing FIXME */ ) { + if ( !t->base.memBlock /* && !rmesa->prefer_gart_client_texturing FIXME */ ) { fprintf(stderr, "%s: upload failed\n", __FUNCTION__); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c index e8c4e4e221d..4e27324807f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c,v 1.5 2002/12/16 16:18:59 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -937,7 +937,7 @@ static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags ) */ -void radeonVtxfmtInit( GLcontext *ctx ) +void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) { radeonContextPtr rmesa = RADEON_CONTEXT( ctx ); GLvertexformat *vfmt = &(rmesa->vb.vtxfmt); @@ -980,6 +980,7 @@ void radeonVtxfmtInit( GLcontext *ctx ) /* Active but unsupported -- fallback if we receive these: */ vfmt->CallList = radeon_fallback_CallList; + vfmt->CallLists = radeon_fallback_CallLists; vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f; vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv; vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f; @@ -1034,7 +1035,7 @@ void radeonVtxfmtInit( GLcontext *ctx ) make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB ); make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB ); - radeonInitCodegen( &rmesa->vb.codegen ); + radeonInitCodegen( &rmesa->vb.codegen, useCodegen ); } static void free_funcs( struct dynfn *l ) diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h index 9792fcbb788..78033908238 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h @@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void radeonVtxfmtUpdate( GLcontext *ctx ); -extern void radeonVtxfmtInit( GLcontext *ctx ); +extern void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen ); extern void radeonVtxfmtInvalidate( GLcontext *ctx ); extern void radeonVtxfmtDestroy( GLcontext *ctx ); extern void radeonVtxfmtInitChoosers( GLvertexformat *vfmt ); @@ -84,7 +84,7 @@ do { \ /* */ -void radeonInitCodegen( struct dfn_generators *gen ); +void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen ); void radeonInitX86Codegen( struct dfn_generators *gen ); void radeonInitSSECodegen( struct dfn_generators *gen ); diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c index 0d5c2bc6d91..0bdb9a8bbd6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c,v 1.2 2002/12/16 16:18:59 dawes Exp $ */ /************************************************************************** Copyright 2002 ATI Technologies Inc., Ontario, Canada, and @@ -867,7 +867,7 @@ static struct dynfn *codegen_noop( GLcontext *ctx, int key ) return 0; } -void radeonInitCodegen( struct dfn_generators *gen ) +void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen ) { gen->Vertex3f = codegen_noop; gen->Vertex3fv = codegen_noop; @@ -896,7 +896,7 @@ void radeonInitCodegen( struct dfn_generators *gen ) gen->MultiTexCoord1fARB = codegen_noop; gen->MultiTexCoord1fvARB = codegen_noop; - if (!getenv("RADEON_NO_CODEGEN")) { + if (useCodegen) { #if defined(USE_X86_ASM) radeonInitX86Codegen( gen ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c index 0f2c82bd878..71e74381a5a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:58 alanh Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c index 92941ca5f80..59b0db0a5f9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c,v 1.2 2002/12/21 17:02:16 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/src/mesa/drivers/dri/radeon/server/radeon.h b/src/mesa/drivers/dri/radeon/server/radeon.h index 4606a0b71e6..808289b140f 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon.h +++ b/src/mesa/drivers/dri/radeon/server/radeon.h @@ -108,11 +108,11 @@ typedef struct { * \name AGP */ /*@{*/ - drmSize agpSize; /**< \brief AGP map size */ - drmHandle agpMemHandle; /**< \brief AGP map handle */ - unsigned long agpOffset; /**< \brief AGP offset */ - int agpMode; /**< \brief AGP mode */ - int agpFastWrite; + drmSize gartSize; /**< \brief AGP map size */ + drmHandle gartMemHandle; /**< \brief AGP map handle */ + unsigned long gartOffset; /**< \brief AGP offset */ + int gartMode; /**< \brief AGP mode */ + int gartFastWrite; /*@}*/ /** @@ -144,11 +144,11 @@ typedef struct { * \name CP AGP Texture data */ /*@{*/ - unsigned long agpTexStart; /**< \brief Offset into AGP space */ - drmHandle agpTexHandle; /**< \brief Handle from drmAddMap() */ - drmSize agpTexMapSize; /**< \brief Size of map */ - int agpTexSize; /**< \brief Size of AGP tex space (in MB) */ - int log2AGPTexGran; + unsigned long gartTexStart; /**< \brief Offset into AGP space */ + drmHandle gartTexHandle; /**< \brief Handle from drmAddMap() */ + drmSize gartTexMapSize; /**< \brief Size of map */ + int gartTexSize; /**< \brief Size of AGP tex space (in MB) */ + int log2GARTTexGran; /*@}*/ int drmMinor; /**< \brief DRM device minor number */ diff --git a/src/mesa/drivers/dri/radeon/server/radeon_common.h b/src/mesa/drivers/dri/radeon/server/radeon_common.h index 0792b5c2e0e..365ecfb9a17 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/server/radeon_common.h @@ -31,7 +31,7 @@ * Converted to common header format: * Jens Owen <[email protected]> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.6 2001/04/16 15:02:13 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h,v 1.2 2003/04/07 01:22:09 martin Exp $ * */ @@ -70,6 +70,7 @@ #define DRM_RADEON_INIT_HEAP 0x15 #define DRM_RADEON_IRQ_EMIT 0x16 #define DRM_RADEON_IRQ_WAIT 0x17 +#define DRM_RADEON_CP_RESUME 0x18 #define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39 @@ -94,7 +95,7 @@ typedef struct { unsigned long sarea_priv_offset; int is_pci; int cp_mode; - int agp_size; + int gart_size; int ring_size; int usec_timeout; @@ -109,7 +110,7 @@ typedef struct { unsigned long ring_offset; unsigned long ring_rptr_offset; unsigned long buffers_offset; - unsigned long agp_textures_offset; + unsigned long gart_textures_offset; } drmRadeonInit; typedef struct { @@ -404,22 +405,22 @@ typedef struct drm_radeon_getparam { void *value; } drmRadeonGetParam; -#define RADEON_PARAM_AGP_BUFFER_OFFSET 1 -#define RADEON_PARAM_LAST_FRAME 2 -#define RADEON_PARAM_LAST_DISPATCH 3 -#define RADEON_PARAM_LAST_CLEAR 4 -#define RADEON_PARAM_IRQ_NR 5 -#define RADEON_PARAM_AGP_BASE 6 +#define RADEON_PARAM_GART_BUFFER_OFFSET 1 +#define RADEON_PARAM_LAST_FRAME 2 +#define RADEON_PARAM_LAST_DISPATCH 3 +#define RADEON_PARAM_LAST_CLEAR 4 +#define RADEON_PARAM_IRQ_NR 5 +#define RADEON_PARAM_GART_BASE 6 -#define RADEON_MEM_REGION_AGP 1 -#define RADEON_MEM_REGION_FB 2 +#define RADEON_MEM_REGION_GART 1 +#define RADEON_MEM_REGION_FB 2 typedef struct drm_radeon_mem_alloc { int region; int alignment; int size; - int *region_offset; /* offset from start of fb or agp */ + int *region_offset; /* offset from start of fb or GART */ } drmRadeonMemAlloc; typedef struct drm_radeon_mem_free { diff --git a/src/mesa/drivers/dri/radeon/server/radeon_dri.c b/src/mesa/drivers/dri/radeon/server/radeon_dri.c index 4271aa7da23..a37561457bc 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_dri.c +++ b/src/mesa/drivers/dri/radeon/server/radeon_dri.c @@ -318,7 +318,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) int s, l; if (drmAgpAcquire(ctx->drmFD) < 0) { - fprintf(stderr, "[agp] AGP not available\n"); + fprintf(stderr, "[gart] AGP not available\n"); return 0; } @@ -334,40 +334,40 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) /* Disable fast write entirely - too many lockups. */ mode &= ~RADEON_AGP_MODE_MASK; - switch (info->agpMode) { + switch (info->gartMode) { case 4: mode |= RADEON_AGP_4X_MODE; case 2: mode |= RADEON_AGP_2X_MODE; case 1: default: mode |= RADEON_AGP_1X_MODE; } if (drmAgpEnable(ctx->drmFD, mode) < 0) { - fprintf(stderr, "[agp] AGP not enabled\n"); + fprintf(stderr, "[gart] AGP not enabled\n"); drmAgpRelease(ctx->drmFD); return 0; } - info->agpOffset = 0; + info->gartOffset = 0; - if ((ret = drmAgpAlloc(ctx->drmFD, info->agpSize*1024*1024, 0, NULL, - &info->agpMemHandle)) < 0) { - fprintf(stderr, "[agp] Out of memory (%d)\n", ret); + if ((ret = drmAgpAlloc(ctx->drmFD, info->gartSize*1024*1024, 0, NULL, + &info->gartMemHandle)) < 0) { + fprintf(stderr, "[gart] Out of memory (%d)\n", ret); drmAgpRelease(ctx->drmFD); return 0; } fprintf(stderr, - "[agp] %d kB allocated with handle 0x%08x\n", - info->agpSize*1024, (unsigned)info->agpMemHandle); + "[gart] %d kB allocated with handle 0x%08x\n", + info->gartSize*1024, (unsigned)info->gartMemHandle); if (drmAgpBind(ctx->drmFD, - info->agpMemHandle, info->agpOffset) < 0) { - fprintf(stderr, "[agp] Could not bind\n"); - drmAgpFree(ctx->drmFD, info->agpMemHandle); + info->gartMemHandle, info->gartOffset) < 0) { + fprintf(stderr, "[gart] Could not bind\n"); + drmAgpFree(ctx->drmFD, info->gartMemHandle); drmAgpRelease(ctx->drmFD); return 0; } /* Initialize the CP ring buffer data */ - info->ringStart = info->agpOffset; + info->ringStart = info->gartOffset; info->ringMapSize = info->ringSize*1024*1024 + DRM_PAGE_SIZE; info->ringReadOffset = info->ringStart + info->ringMapSize; @@ -378,51 +378,51 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) info->bufMapSize = info->bufSize*1024*1024; /* Reserve the rest for AGP textures */ - info->agpTexStart = info->bufStart + info->bufMapSize; - s = (info->agpSize*1024*1024 - info->agpTexStart); + info->gartTexStart = info->bufStart + info->bufMapSize; + s = (info->gartSize*1024*1024 - info->gartTexStart); l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS); if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; - info->agpTexMapSize = (s >> l) << l; - info->log2AGPTexGran = l; + info->gartTexMapSize = (s >> l) << l; + info->log2GARTTexGran = l; if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize, DRM_AGP, DRM_READ_ONLY, &info->ringHandle) < 0) { - fprintf(stderr, "[agp] Could not add ring mapping\n"); + fprintf(stderr, "[gart] Could not add ring mapping\n"); return 0; } - fprintf(stderr, "[agp] ring handle = 0x%08lx\n", info->ringHandle); + fprintf(stderr, "[gart] ring handle = 0x%08lx\n", info->ringHandle); if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize, DRM_AGP, DRM_READ_ONLY, &info->ringReadPtrHandle) < 0) { fprintf(stderr, - "[agp] Could not add ring read ptr mapping\n"); + "[gart] Could not add ring read ptr mapping\n"); return 0; } fprintf(stderr, - "[agp] ring read ptr handle = 0x%08lx\n", + "[gart] ring read ptr handle = 0x%08lx\n", info->ringReadPtrHandle); if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize, DRM_AGP, 0, &info->bufHandle) < 0) { fprintf(stderr, - "[agp] Could not add vertex/indirect buffers mapping\n"); + "[gart] Could not add vertex/indirect buffers mapping\n"); return 0; } fprintf(stderr, - "[agp] vertex/indirect buffers handle = 0x%08lx\n", + "[gart] vertex/indirect buffers handle = 0x%08lx\n", info->bufHandle); - if (drmAddMap(ctx->drmFD, info->agpTexStart, info->agpTexMapSize, - DRM_AGP, 0, &info->agpTexHandle) < 0) { + if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize, + DRM_AGP, 0, &info->gartTexHandle) < 0) { fprintf(stderr, - "[agp] Could not add AGP texture map mapping\n"); + "[gart] Could not add AGP texture map mapping\n"); return 0; } fprintf(stderr, - "[agp] AGP texture map handle = 0x%08lx\n", - info->agpTexHandle); + "[gart] AGP texture map handle = 0x%08lx\n", + info->gartTexHandle); /* Initialize Radeon's AGP registers */ /* Ring buffer is at AGP offset 0 */ @@ -463,7 +463,7 @@ static int RADEONDRIKernelInit( const DRIDriverContext *ctx, drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); drmInfo.is_pci = 0; drmInfo.cp_mode = RADEON_DEFAULT_CP_BM_MODE; - drmInfo.agp_size = info->agpSize*1024*1024; + drmInfo.gart_size = info->gartSize*1024*1024; drmInfo.ring_size = info->ringSize*1024*1024; drmInfo.usec_timeout = 1000; drmInfo.fb_bpp = ctx->bpp; @@ -479,7 +479,7 @@ static int RADEONDRIKernelInit( const DRIDriverContext *ctx, drmInfo.ring_offset = info->ringHandle; drmInfo.ring_rptr_offset = info->ringReadPtrHandle; drmInfo.buffers_offset = info->bufHandle; - drmInfo.agp_textures_offset = info->agpTexHandle; + drmInfo.gart_textures_offset = info->gartTexHandle; ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_INIT, &drmInfo, sizeof(drmRadeonInit)); @@ -502,19 +502,19 @@ static void RADEONDRIAgpHeapInit(const DRIDriverContext *ctx, { drmRadeonMemInitHeap drmHeap; - /* Start up the simple memory manager for agp space */ - drmHeap.region = RADEON_MEM_REGION_AGP; + /* Start up the simple memory manager for gart space */ + drmHeap.region = RADEON_MEM_REGION_GART; drmHeap.start = 0; - drmHeap.size = info->agpTexMapSize; + drmHeap.size = info->gartTexMapSize; if (drmCommandWrite(ctx->drmFD, DRM_RADEON_INIT_HEAP, &drmHeap, sizeof(drmHeap))) { fprintf(stderr, - "[drm] Failed to initialized agp heap manager\n"); + "[drm] Failed to initialized gart heap manager\n"); } else { fprintf(stderr, - "[drm] Initialized kernel agp heap manager, %d\n", - info->agpTexMapSize); + "[drm] Initialized kernel gart heap manager, %d\n", + info->gartTexMapSize); } } @@ -640,13 +640,13 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) info->frontPitch = ctx->shared.virtualWidth; fprintf(stderr, - "Using %d MB AGP aperture\n", info->agpSize); + "Using %d MB AGP aperture\n", info->gartSize); fprintf(stderr, "Using %d MB for the ring buffer\n", info->ringSize); fprintf(stderr, "Using %d MB for vertex/indirect buffers\n", info->bufSize); fprintf(stderr, - "Using %d MB for AGP textures\n", info->agpTexSize); + "Using %d MB for AGP textures\n", info->gartTexSize); /* Front, back and depth buffers - everything else texture?? */ @@ -733,7 +733,7 @@ static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) * Setups a RADEONDRIRec structure to be passed to radeon_dri.so for its * initialization. */ -static int RADEONScreenInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) +static int RADEONScreenInit( DRIDriverContext *ctx, RADEONInfoPtr info ) { RADEONDRIPtr pRADEONDRI; int err; @@ -883,7 +883,7 @@ static int RADEONScreenInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) /* Initialize IRQ */ RADEONDRIIrqInit(ctx, info); - /* Initialize kernel agp memory manager */ + /* Initialize kernel gart memory manager */ RADEONDRIAgpHeapInit(ctx, info); /* Initialize the SAREA private data structure */ @@ -919,7 +919,7 @@ static int RADEONScreenInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) pRADEONDRI->depth = ctx->bpp; /* XXX: depth */ pRADEONDRI->bpp = ctx->bpp; pRADEONDRI->IsPCI = 0; - pRADEONDRI->AGPMode = info->agpMode; + pRADEONDRI->AGPMode = info->gartMode; pRADEONDRI->frontOffset = info->frontOffset; pRADEONDRI->frontPitch = info->frontPitch; pRADEONDRI->backOffset = info->backOffset; @@ -933,10 +933,10 @@ static int RADEONScreenInit( const DRIDriverContext *ctx, RADEONInfoPtr info ) pRADEONDRI->registerSize = info->registerSize; pRADEONDRI->statusHandle = info->ringReadPtrHandle; pRADEONDRI->statusSize = info->ringReadMapSize; - pRADEONDRI->agpTexHandle = info->agpTexHandle; - pRADEONDRI->agpTexMapSize = info->agpTexMapSize; - pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran; - pRADEONDRI->agpTexOffset = info->agpTexStart; + pRADEONDRI->gartTexHandle = info->gartTexHandle; + pRADEONDRI->gartTexMapSize = info->gartTexMapSize; + pRADEONDRI->log2GARTTexGran = info->log2GARTTexGran; + pRADEONDRI->gartTexOffset = info->gartTexStart; pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); /* Don't release the lock now - let the VT switch handler do it. */ @@ -1139,10 +1139,10 @@ static int radeonInitFBDev( DRIDriverContext *ctx ) ctx->driverPrivate = (void *)info; - info->agpFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE; - info->agpMode = RADEON_DEFAULT_AGP_MODE; - info->agpSize = RADEON_DEFAULT_AGP_SIZE; - info->agpTexSize = RADEON_DEFAULT_AGP_TEX_SIZE; + info->gartFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE; + info->gartMode = RADEON_DEFAULT_AGP_MODE; + info->gartSize = RADEON_DEFAULT_AGP_SIZE; + info->gartTexSize = RADEON_DEFAULT_AGP_TEX_SIZE; info->bufSize = RADEON_DEFAULT_BUFFER_SIZE; info->ringSize = RADEON_DEFAULT_RING_SIZE; diff --git a/src/mesa/drivers/dri/radeon/server/radeon_dri.h b/src/mesa/drivers/dri/radeon/server/radeon_dri.h index fce21227cb9..fc96deb1024 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_dri.h +++ b/src/mesa/drivers/dri/radeon/server/radeon_dri.h @@ -102,10 +102,10 @@ typedef struct { * \name CP AGP Texture data */ /*@{*/ - drmHandle agpTexHandle; /**< \brief AGP texture area map handle */ - drmSize agpTexMapSize; /**< \brief AGP texture area map size */ - int log2AGPTexGran; /**< \brief AGP texture granularity in log base 2 */ - int agpTexOffset; /**< \brief AGP texture area offset in AGP space */ + drmHandle gartTexHandle; /**< \brief AGP texture area map handle */ + drmSize gartTexMapSize; /**< \brief AGP texture area map size */ + int log2GARTTexGran; /**< \brief AGP texture granularity in log base 2 */ + int gartTexOffset; /**< \brief AGP texture area offset in AGP space */ /*@}*/ unsigned int sarea_priv_offset; /**< \brief offset of the private SAREA data*/ diff --git a/src/mesa/drivers/dri/radeon/server/radeon_reg.h b/src/mesa/drivers/dri/radeon/server/radeon_reg.h index 5570a439458..4bd4d14e783 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_reg.h +++ b/src/mesa/drivers/dri/radeon/server/radeon_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.25 2003/02/07 18:08:59 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.30 2003/10/07 22:47:12 martin Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -66,6 +66,8 @@ # define RADEON_AGP_APER_SIZE_4MB (0x3f << 0) # define RADEON_AGP_APER_SIZE_MASK (0x3f << 0) #define RADEON_AGP_COMMAND 0x0f60 /* PCI */ +#define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config*/ +# define RADEON_AGP_ENABLE (1<<8) #define RADEON_AGP_PLL_CNTL 0x000b /* PLL */ #define RADEON_AGP_STATUS 0x0f5c /* PCI */ # define RADEON_AGP_1X_MODE 0x01 @@ -232,6 +234,28 @@ # define RADEON_CONSTANT_COLOR_ZERO 0x00000000 #define RADEON_CRC_CMDFIFO_ADDR 0x0740 #define RADEON_CRC_CMDFIFO_DOUT 0x0744 +#define RADEON_GRPH_BUFFER_CNTL 0x02f0 +# define RADEON_GRPH_START_REQ_MASK (0x7f) +# define RADEON_GRPH_START_REQ_SHIFT 0 +# define RADEON_GRPH_STOP_REQ_MASK (0x7f<<8) +# define RADEON_GRPH_STOP_REQ_SHIFT 8 +# define RADEON_GRPH_CRITICAL_POINT_MASK (0x7f<<16) +# define RADEON_GRPH_CRITICAL_POINT_SHIFT 16 +# define RADEON_GRPH_CRITICAL_CNTL (1<<28) +# define RADEON_GRPH_BUFFER_SIZE (1<<29) +# define RADEON_GRPH_CRITICAL_AT_SOF (1<<30) +# define RADEON_GRPH_STOP_CNTL (1<<31) +#define RADEON_GRPH2_BUFFER_CNTL 0x03f0 +# define RADEON_GRPH2_START_REQ_MASK (0x7f) +# define RADEON_GRPH2_START_REQ_SHIFT 0 +# define RADEON_GRPH2_STOP_REQ_MASK (0x7f<<8) +# define RADEON_GRPH2_STOP_REQ_SHIFT 8 +# define RADEON_GRPH2_CRITICAL_POINT_MASK (0x7f<<16) +# define RADEON_GRPH2_CRITICAL_POINT_SHIFT 16 +# define RADEON_GRPH2_CRITICAL_CNTL (1<<28) +# define RADEON_GRPH2_BUFFER_SIZE (1<<29) +# define RADEON_GRPH2_CRITICAL_AT_SOF (1<<30) +# define RADEON_GRPH2_STOP_CNTL (1<<31) #define RADEON_CRTC_CRNT_FRAME 0x0214 #define RADEON_CRTC_EXT_CNTL 0x0054 # define RADEON_CRTC_VGA_XOVERSCAN (1 << 0) @@ -272,6 +296,9 @@ # define RADEON_CRTC2_CSYNC_EN (1 << 27) # define RADEON_CRTC2_HSYNC_DIS (1 << 28) # define RADEON_CRTC2_VSYNC_DIS (1 << 29) +#define RADEON_CRTC_MORE_CNTL 0x27c +# define RADEON_CRTC_H_CUTOFF_ACTIVE_EN (1<<4) +# define RADEON_CRTC_V_CUTOFF_ACTIVE_EN (1<<5) #define RADEON_CRTC_GUI_TRIG_VLINE 0x0218 #define RADEON_CRTC_H_SYNC_STRT_WID 0x0204 # define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) @@ -356,7 +383,10 @@ #define RADEON_DAC_CNTL 0x0058 # define RADEON_DAC_RANGE_CNTL (3 << 0) +# define RADEON_DAC_RANGE_CNTL_MASK 0x03 # define RADEON_DAC_BLANKING (1 << 2) +# define RADEON_DAC_CMP_EN (1 << 3) +# define RADEON_DAC_CMP_OUTPUT (1 << 7) # define RADEON_DAC_8BIT_EN (1 << 8) # define RADEON_DAC_VGA_ADR_EN (1 << 13) # define RADEON_DAC_PDWN (1 << 15) @@ -365,6 +395,12 @@ # define RADEON_DAC2_DAC_CLK_SEL (1 << 0) # define RADEON_DAC2_DAC2_CLK_SEL (1 << 1) # define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5) +#define RADEON_DAC_EXT_CNTL 0x0280 +# define RADEON_DAC_FORCE_BLANK_OFF_EN (1 << 4) +# define RADEON_DAC_FORCE_DATA_EN (1 << 5) +# define RADEON_DAC_FORCE_DATA_SEL_MASK (3 << 6) +# define RADEON_DAC_FORCE_DATA_MASK 0x0003ff00 +# define RADEON_DAC_FORCE_DATA_SHIFT 8 #define RADEON_TV_DAC_CNTL 0x088c # define RADEON_TV_DAC_STD_MASK 0x0300 # define RADEON_TV_DAC_RDACPD (1 << 24) @@ -374,7 +410,9 @@ # define RADEON_CRT2_DISP1_SEL (1 << 5) #define RADEON_DISP_OUTPUT_CNTL 0x0d64 # define RADEON_DISP_DAC_SOURCE_MASK 0x03 +# define RADEON_DISP_DAC2_SOURCE_MASK 0x0c # define RADEON_DISP_DAC_SOURCE_CRTC2 0x01 +# define RADEON_DISP_DAC2_SOURCE_CRTC2 0x04 #define RADEON_DAC_CRC_SIG 0x02cc #define RADEON_DAC_DATA 0x03c9 /* VGA */ #define RADEON_DAC_MASK 0x03c6 /* VGA */ @@ -392,6 +430,23 @@ #define RADEON_DEVICE_ID 0x0f02 /* PCI */ #define RADEON_DISP_MISC_CNTL 0x0d00 # define RADEON_SOFT_RESET_GRPH_PP (1 << 0) +#define RADEON_DISP_MERGE_CNTL 0x0d60 +# define RADEON_DISP_ALPHA_MODE_MASK 0x03 +# define RADEON_DISP_ALPHA_MODE_KEY 0 +# define RADEON_DISP_ALPHA_MODE_PER_PIXEL 1 +# define RADEON_DISP_ALPHA_MODE_GLOBAL 2 +# define RADEON_DISP_RGB_OFFSET_EN (1<<8) +# define RADEON_DISP_GRPH_ALPHA_MASK (0xff << 16) +# define RADEON_DISP_OV0_ALPHA_MASK (0xff << 24) +# define RADEON_DISP_LIN_TRANS_BYPASS (0x01 << 9) +#define RADEON_DISP2_MERGE_CNTL 0x0d68 +# define RADEON_DISP2_RGB_OFFSET_EN (1<<8) +#define RADEON_DISP_LIN_TRANS_GRPH_A 0x0d80 +#define RADEON_DISP_LIN_TRANS_GRPH_B 0x0d84 +#define RADEON_DISP_LIN_TRANS_GRPH_C 0x0d88 +#define RADEON_DISP_LIN_TRANS_GRPH_D 0x0d8c +#define RADEON_DISP_LIN_TRANS_GRPH_E 0x0d90 +#define RADEON_DISP_LIN_TRANS_GRPH_F 0x0d98 #define RADEON_DP_BRUSH_BKGD_CLR 0x1478 #define RADEON_DP_BRUSH_FRGD_CLR 0x147c #define RADEON_DP_CNTL 0x16c0 @@ -582,7 +637,10 @@ # define RADEON_FP2_BLANK_EN (1 << 1) # define RADEON_FP2_ON (1 << 2) # define RADEON_FP2_PANEL_FORMAT (1 << 3) -# define RADEON_FP2_SEL_CRTC2 (1 << 13) +# define RADEON_FP2_SOURCE_SEL_MASK (3 << 10) +# define RADEON_FP2_SOURCE_SEL_CRTC2 (1 << 10) +# define RADEON_FP2_SRC_SEL_MASK (3 << 13) +# define RADEON_FP2_SRC_SEL_CRTC2 (1 << 13) # define RADEON_FP2_FP_POL (1 << 16) # define RADEON_FP2_LP_POL (1 << 17) # define RADEON_FP2_SCK_POL (1 << 18) @@ -590,6 +648,8 @@ # define RADEON_FP2_PAD_FLOP_EN (1 << 22) # define RADEON_FP2_CRC_EN (1 << 23) # define RADEON_FP2_CRC_READ_EN (1 << 24) +# define RADEON_FP2_DV0_EN (1 << 25) +# define RADEON_FP2_DV0_RATE_SEL_SDR (1 << 26) #define RADEON_FP_H_SYNC_STRT_WID 0x02c4 #define RADEON_FP_H2_SYNC_STRT_WID 0x03c4 #define RADEON_FP_HORZ_STRETCH 0x028c @@ -697,6 +757,10 @@ #define RADEON_MAX_LATENCY 0x0f3f /* PCI */ #define RADEON_MC_AGP_LOCATION 0x014c #define RADEON_MC_FB_LOCATION 0x0148 +#define RADEON_DISPLAY_BASE_ADDR 0x23c +#define RADEON_DISPLAY2_BASE_ADDR 0x33c +#define RADEON_OV0_BASE_ADDR 0x43c +#define RADEON_NB_TOM 0x15c #define RADEON_MCLK_CNTL 0x0012 /* PLL */ # define RADEON_FORCEON_MCLKA (1 << 16) # define RADEON_FORCEON_MCLKB (1 << 17) @@ -711,6 +775,12 @@ #define RADEON_MEM_ADDR_CONFIG 0x0148 #define RADEON_MEM_BASE 0x0f10 /* PCI */ #define RADEON_MEM_CNTL 0x0140 +# define RADEON_MEM_NUM_CHANNELS_MASK 0x01 +# define RADEON_MEM_USE_B_CH_ONLY (1<<1) +# define RV100_HALF_MODE (1<<3) +# define R300_MEM_NUM_CHANNELS_MASK 0x03 +# define R300_MEM_USE_CD_CH_ONLY (1<<2) +#define RADEON_MEM_TIMING_CNTL 0x0144 /* EXT_MEM_CNTL */ #define RADEON_MEM_INIT_LAT_TIMER 0x0154 #define RADEON_MEM_INTF_CNTL 0x014c #define RADEON_MEM_SDRAM_MODE_REG 0x0158 @@ -723,7 +793,13 @@ #define RADEON_MPLL_CNTL 0x000e /* PLL */ #define RADEON_MPP_TB_CONFIG 0x01c0 /* ? */ #define RADEON_MPP_GP_CONFIG 0x01c8 /* ? */ - +#define R300_MC_IND_INDEX 0x01f8 +# define R300_MC_IND_ADDR_MASK 0x3f +#define R300_MC_IND_DATA 0x01fc +#define R300_MC_READ_CNTL_AB 0x017c +# define R300_MEM_RBS_POSITION_A_MASK 0x03 +#define R300_MC_READ_CNTL_CD_mcind 0x24 +# define R300_MEM_RBS_POSITION_C_MASK 0x03 #define RADEON_N_VIF_COUNT 0x0248 @@ -879,7 +955,7 @@ # define RADEON_P2PLL_REF_DIV_MASK 0x03ff # define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ -# define R300_PPLL_REF_DIV_ACC_MASK (0x3ff < 18) +# define R300_PPLL_REF_DIV_ACC_MASK (0x3ff << 18) # define R300_PPLL_REF_DIV_ACC_SHIFT 18 #define RADEON_PALETTE_DATA 0x00b4 #define RADEON_PALETTE_30_DATA 0x00b8 @@ -891,6 +967,11 @@ # define RADEON_PIX2CLK_SRC_SEL_PSCANCLK 0x01 # define RADEON_PIX2CLK_SRC_SEL_BYTECLK 0x02 # define RADEON_PIX2CLK_SRC_SEL_P2PLLCLK 0x03 +# define RADEON_PIX2CLK_ALWAYS_ONb (1<<6) +# define RADEON_PIX2CLK_DAC_ALWAYS_ONb (1<<7) +# define RADEON_PIXCLK_TV_SRC_SEL (1 << 8) +# define RADEON_PIXCLK_LVDS_ALWAYS_ONb (1 << 14) +# define RADEON_PIXCLK_TMDS_ALWAYS_ONb (1 << 15) #define RADEON_PLANE_3D_MASK_C 0x1d44 #define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */ #define RADEON_PMI_CAP_ID 0x0f5c /* PCI */ @@ -1013,6 +1094,9 @@ #define RADEON_TEST_DEBUG_MUX 0x0124 #define RADEON_TEST_DEBUG_OUT 0x012c #define RADEON_TMDS_PLL_CNTL 0x02a8 +#define RADEON_TMDS_TRANSMITTER_CNTL 0x02a4 +# define RADEON_TMDS_TRANSMITTER_PLLEN 1 +# define RADEON_TMDS_TRANSMITTER_PLLRST 2 #define RADEON_TRAIL_BRES_DEC 0x1614 #define RADEON_TRAIL_BRES_ERR 0x160c #define RADEON_TRAIL_BRES_INC 0x1610 @@ -1025,6 +1109,9 @@ # define RADEON_VCLK_SRC_SEL_PSCANCLK 0x01 # define RADEON_VCLK_SRC_SEL_BYTECLK 0x02 # define RADEON_VCLK_SRC_SEL_PPLLCLK 0x03 +# define RADEON_PIXCLK_ALWAYS_ONb (1<<6) +# define RADEON_PIXCLK_DAC_ALWAYS_ONb (1<<7) + #define RADEON_VENDOR_ID 0x0f00 /* PCI */ #define RADEON_VGA_DDA_CONFIG 0x02e8 #define RADEON_VGA_DDA_ON_OFF 0x02ec @@ -1878,12 +1965,11 @@ #define RADEON_AIC_CNTL 0x01d0 # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +#define RADEON_AIC_LO_ADDR 0x01dc /* Constants */ -#define RADEON_AGP_TEX_OFFSET 0x02000000 - #define RADEON_LAST_FRAME_REG RADEON_GUI_SCRATCH_REG0 #define RADEON_LAST_CLEAR_REG RADEON_GUI_SCRATCH_REG2 @@ -2012,4 +2098,16 @@ #define RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 51 #define RADEON_SS_SHININESS 60 +#define RADEON_TV_MASTER_CNTL 0x0800 +# define RADEON_TVCLK_ALWAYS_ONb (1 << 30) +#define RADEON_TV_DAC_CNTL 0x088c +# define RADEON_TV_DAC_CMPOUT (1 << 5) +#define RADEON_TV_PRE_DAC_MUX_CNTL 0x0888 +# define RADEON_Y_RED_EN (1 << 0) +# define RADEON_C_GRN_EN (1 << 1) +# define RADEON_CMP_BLU_EN (1 << 2) +# define RADEON_RED_MX_FORCE_DAC_DATA (6 << 4) +# define RADEON_GRN_MX_FORCE_DAC_DATA (6 << 8) +# define RADEON_BLU_MX_FORCE_DAC_DATA (6 << 12) +# define RADEON_TV_FORCE_DAC_DATA_SHIFT 16 #endif diff --git a/src/mesa/drivers/dri/radeon/server/radeon_sarea.h b/src/mesa/drivers/dri/radeon/server/radeon_sarea.h index 81e4325d7a1..95db1f37ac9 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_sarea.h +++ b/src/mesa/drivers/dri/radeon/server/radeon_sarea.h @@ -1,11 +1,4 @@ -/** - * \file server/radeon_sarea.h - * \brief SAREA definition. - * - * \author Kevin E. Martin <[email protected]> - * \author Gareth Hughes <[email protected]> - */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.5 2002/10/30 12:52:14 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -34,7 +27,12 @@ * DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.4 2002/04/24 16:20:41 martin Exp $ */ +/* + * Authors: + * Kevin E. Martin <[email protected]> + * Gareth Hughes <[email protected]> + * + */ #ifndef _RADEON_SAREA_H_ #define _RADEON_SAREA_H_ @@ -94,11 +92,11 @@ /* Keep these small for testing */ #define RADEON_NR_SAREA_CLIPRECTS 12 -/* There are 2 heaps (local/AGP). Each region within a heap is a +/* There are 2 heaps (local/GART). Each region within a heap is a * minimum of 64k, and there are at most 64 of them per heap. */ #define RADEON_CARD_HEAP 0 -#define RADEON_AGP_HEAP 1 +#define RADEON_GART_HEAP 1 #define RADEON_NR_TEX_HEAPS 2 #define RADEON_NR_TEX_REGIONS 64 #define RADEON_LOG_TEX_GRANULARITY 16 @@ -115,10 +113,6 @@ #endif /* __RADEON_SAREA_DEFINES__ */ - -/** - * \brief Color register format. - */ typedef struct { unsigned int red; unsigned int green; @@ -126,15 +120,8 @@ typedef struct { unsigned int alpha; } radeon_color_regs_t; - -/** - * \brief Context registers. - */ typedef struct { - /** - * \name Context state - */ - /*@{*/ + /* Context state */ unsigned int pp_misc; unsigned int pp_fog_color; unsigned int re_solid_color; @@ -149,76 +136,44 @@ typedef struct { unsigned int re_width_height; unsigned int rb3d_colorpitch; unsigned int se_cntl; - /*@}*/ - /** - * \name Vertex format state - */ - /*@{*/ + /* Vertex format state */ unsigned int se_coord_fmt; - /*@}*/ - /** - * \name Line state - */ - /*@{*/ + /* Line state */ unsigned int re_line_pattern; unsigned int re_line_state; unsigned int se_line_width; - /*@}*/ - /** - * \name Bumpmap state - */ - /*@{*/ + /* Bumpmap state */ unsigned int pp_lum_matrix; unsigned int pp_rot_matrix_0; unsigned int pp_rot_matrix_1; - /*@}*/ - /** - * \name Mask state - */ - /*@{*/ + /* Mask state */ unsigned int rb3d_stencilrefmask; unsigned int rb3d_ropcntl; unsigned int rb3d_planemask; - /*@}*/ - /** - * \name Viewport state - */ - /*@{*/ + /* Viewport state */ unsigned int se_vport_xscale; unsigned int se_vport_xoffset; unsigned int se_vport_yscale; unsigned int se_vport_yoffset; unsigned int se_vport_zscale; unsigned int se_vport_zoffset; - /*@}*/ - /** - * \name Setup state - */ - /*@{*/ + /* Setup state */ unsigned int se_cntl_status; - /*@}*/ - /** - * \name Misc state - */ - /*@{*/ + /* Misc state */ unsigned int re_top_left; unsigned int re_misc; - /*@}*/ } radeon_context_regs_t; - -/** - * \brief Setup registers for each texture unit - */ +/* Setup registers for each texture unit */ typedef struct { unsigned int pp_txfilter; unsigned int pp_txformat; @@ -229,82 +184,48 @@ typedef struct { unsigned int pp_border_color; } radeon_texture_regs_t; -/** - * \brief Maintain an LRU of contiguous regions of texture space. - * - * If you think you own a region of texture memory, and it has an age different - * to the one you set, then you are mistaken and it has been stolen by another - * client. If global RADEONSAREAPriv::texAge hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained texture - * information of other clients - by maintaining them in the same LRU which is - * used to age their own textures, clients have an approximate LRU for the - * whole of global texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to kick out your own - * texture or someone else's - simply eject them all in LRU order. - * - * \sa RADEONSAREAPriv::texList. - */ -typedef struct { - unsigned char next; /**< \brief indices to form a circular LRU */ - unsigned char prev; /**< \brief indices to form a circular LRU */ - unsigned char in_use; /**< \brief owned by a client, or free? */ - int age; /**< \brief tracked by clients to update local LRU's */ -} radeon_tex_region_t; - - -/** - * \brief Private SAREA definition - * - * The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ typedef struct { - radeon_context_regs_t ContextState; /** \brief Context registers */ + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + radeon_context_regs_t ContextState; radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS]; - /**< \brief Texture registers */ - unsigned int dirty; - unsigned int vertsize; /**< \brief vertex size */ - unsigned int vc_format; /**< \brief vertex format */ + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; - /** - * \name Cliprects - * - * The current cliprects, or a subset thereof. - */ - /*@{*/ - XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; - /**< \brief cliprects */ - unsigned int nbox; /**< \brief number of cliprects */ - /*@}*/ - - /** - * \name Counters - * - * Counters for throttling rendering of clients. - */ - /*@{*/ - unsigned int last_frame; /**< \brief last emmited frame */ + /* The current cliprects, or a subset thereof */ + XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for throttling of rendering clients */ + unsigned int last_frame; unsigned int last_dispatch; - unsigned int last_clear; /**< \brief last emmited clear */ - /*@}*/ + unsigned int last_clear; - /** - * \name LRU - */ - /*@{*/ - /** \brief Texture regions. - * Last element is sentinal + /* Maintain an LRU of contiguous regions of texture space. If you + * think you own a region of texture memory, and it has an age + * different to the one you set, then you are mistaken and it has + * been stolen by another client. If global texAge hasn't changed, + * there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained texture + * information of other clients - by maintaining them in the same + * lru which is used to age their own textures, clients have an + * approximate lru for the whole of global texture space, and can + * make informed decisions as to which areas to kick out. There is + * no need to choose whether to kick out your own texture or someone + * else's - simply eject them all in LRU order. */ + /* Last elt is sentinal */ drmTextureRegion texList[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; - /** \brief last time texture was uploaded */ + /* last time texture was uploaded */ unsigned int texAge[RADEON_NR_TEX_HEAPS]; - /*@}*/ - int ctxOwner; /**< \brief last context to upload state */ - int pfAllowPageFlip; /**< \brief set by the 2d driver, read by the client */ - int pfCurrentPage; /**< \brief set by kernel, read by others */ - int crtc2_base; /**< \brief for pageflipping with CloneMode */ + int ctxOwner; /* last context to upload state */ + int pfAllowPageFlip; /* set by the 2d driver, read by the client */ + int pfCurrentPage; /* set by kernel, read by others */ + int crtc2_base; /* for pageflipping with CloneMode */ } RADEONSAREAPriv, *RADEONSAREAPrivPtr; #endif diff --git a/src/mesa/drivers/dri/sis/Makefile.X11 b/src/mesa/drivers/dri/sis/Makefile.X11 index 529bd637c23..186bd2025b2 100644 --- a/src/mesa/drivers/dri/sis/Makefile.X11 +++ b/src/mesa/drivers/dri/sis/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.1 2003/09/30 11:13:32 alanh Exp $ +# $Id: Makefile.X11,v 1.1.2.1 2003/11/21 15:49:33 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -98,6 +98,10 @@ sis_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $(TOP)/lib/sis_dri.so && \ install sis_dri.so $(TOP)/lib/sis_dri.so +$(TOP)/lib/sis_dri.so: sis_dri.so + rm -f $(TOP)/lib/sis_dri.so && \ + install sis_dri.so $(TOP)/lib/sis_dri.so + # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. depend: $(C_SOURCES) $(ASM_SOURCES) diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c index 8aa8d91ef13..6fb952d55c6 100644 --- a/src/mesa/drivers/ggi/display/fbdev_mode.c +++ b/src/mesa/drivers/ggi/display/fbdev_mode.c @@ -1,5 +1,4 @@ -/* $Id: fbdev_mode.c,v 1.5 2000/10/28 10:02:44 jtaylor Exp $ -****************************************************************************** +/****************************************************************************** display-fbdev-mesa diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c index a861d815a6d..0176614ffba 100644 --- a/src/mesa/drivers/ggi/display/fbdev_visual.c +++ b/src/mesa/drivers/ggi/display/fbdev_visual.c @@ -1,5 +1,4 @@ -/* $Id: fbdev_visual.c,v 1.6 2000/06/11 20:11:55 jtaylor Exp $ -****************************************************************************** +/****************************************************************************** display-fbdev-mesa: visual handling diff --git a/src/mesa/drivers/glide/fx.rc b/src/mesa/drivers/glide/fx.rc new file mode 100644 index 00000000000..5d00629b826 --- /dev/null +++ b/src/mesa/drivers/glide/fx.rc @@ -0,0 +1,39 @@ +#include <windows.h> + +#define PRODNAME "Mesa 5.1" +#define CONTACTSTR "http://www.mesa3d.org" +#define HWSTR "3dfx Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5" +#define COPYRIGHTSTR "Copyright \251 Brian E. Paul" + +#define VERSIONSTR "5.1.0.1" +#define MANVERSION 5 +#define MANREVISION 1 +#define BUILD_NUMBER 1 + +VS_VERSION_INFO VERSIONINFO + FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER + PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER + FILEFLAGSMASK 0x0030003FL + + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DRV + FILESUBTYPE VFT2_DRV_INSTALLABLE +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "FileDescription", PRODNAME + VALUE "FileVersion", VERSIONSTR + VALUE "LegalCopyright", COPYRIGHTSTR + VALUE "ProductName", PRODNAME + VALUE "Graphics Subsystem", HWSTR + VALUE "Contact", CONTACTSTR + END + END + BLOCK "VarFileInfo" + BEGIN + /* the following line should be extended for localized versions */ + VALUE "Translation", 0x409, 1252 + END +END diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 89b4a38a620..57d5034557f 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -1,5 +1,3 @@ -/* $Id: fxapi.c,v 1.38 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -216,7 +214,7 @@ fxMesaCreateBestContext(GLuint win, GLint width, GLint height, return NULL; } - return fxMesaCreateContext(win, res, GR_REFRESH_60Hz/*ZZZ: GR_REFRESH_75Hz*/, attribList); + return fxMesaCreateContext(win, res, GR_REFRESH_60Hz, attribList); } @@ -233,7 +231,7 @@ fxMesaCreateContext(GLuint win, int i; const char *str; - int numChips, sliaa, fsaa; + int sliaa, numSLI, samplesPerChip, tmuRam, fbRam; struct SstCard_St *voodoo; struct tdfx_glide *Glide; @@ -245,16 +243,11 @@ fxMesaCreateContext(GLuint win, GrPixelFormat_t pixFmt; GLboolean useBGR; - GLboolean verbose = GL_FALSE; if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s(...)\n", __FUNCTION__); } - if (getenv("MESA_FX_INFO")) { - verbose = GL_TRUE; - } - /* Okay, first process the user flags */ aux = GL_FALSE; doubleBuffer = GL_FALSE; @@ -313,7 +306,6 @@ fxMesaCreateContext(GLuint win, and disables the splash screen due to y-origin swapping. Note: We only want the former. */ voodoo = &glbHWConfig.SSTs[glbCurrentBoard]; - numChips = voodoo->numChips; fxMesa = (fxMesaContext)CALLOC_STRUCT(tfxMesaContext); if (!fxMesa) { @@ -321,49 +313,166 @@ fxMesaCreateContext(GLuint win, goto errorhandler; } + if (getenv("MESA_FX_INFO")) { + fxMesa->verbose = GL_TRUE; + } + fxMesa->type = voodoo->type; + fxMesa->HavePalExt = voodoo->HavePalExt; fxMesa->HavePixExt = voodoo->HavePixExt; fxMesa->HaveTexFmt = voodoo->HaveTexFmt; fxMesa->HaveCmbExt = voodoo->HaveCmbExt; fxMesa->HaveMirExt = voodoo->HaveMirExt; + fxMesa->HaveTexUma = voodoo->HaveTexUma; fxMesa->HaveTexus2 = voodoo->HaveTexus2; fxMesa->Glide = glbHWConfig.Glide; Glide = &fxMesa->Glide; - sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dMB FB, %dMB TM, %d TMU, %s", - grGetString(GR_RENDERER), - grGetString(GR_HARDWARE), - voodoo->fbRam, - (voodoo->tmuConfig[GR_TMU0].tmuRam + ((voodoo->nTexelfx > 1) ? voodoo->tmuConfig[GR_TMU1].tmuRam : 0)), - voodoo->nTexelfx, - (numChips > 1) ? "SLI" : "NOSLI"); - switch (fxMesa->colDepth = colDepth) { - case 15: - redBits = 5; - greenBits = 5; - blueBits = 5; - alphaBits = 1; - pixFmt = GR_PIXFMT_ARGB_1555; - break; - case 16: - redBits = 5; - greenBits = 6; - blueBits = 5; - alphaBits = depthSize ? 0 : 8; - pixFmt = GR_PIXFMT_RGB_565; + /* + * Pixel tables are used during pixel read-back + * Either initialize them for RGB or BGR order; + * However, 32bit capable cards have the right order. + * As a consequence, 32bit read-back is not swizzled! + * Also determine if we need vertex snapping. + */ + /* number of SLI units and AA Samples per chip */ + sliaa = 0; + switch (voodoo->type) { + case GR_SSTTYPE_VOODOO: + case GR_SSTTYPE_Banshee: + useBGR = GL_TRUE; + fxMesa->snapVertices = GL_TRUE; break; - case 32: - redBits = 8; - greenBits = 8; - blueBits = 8; - alphaBits = 8; - pixFmt = GR_PIXFMT_ARGB_8888; + case GR_SSTTYPE_Voodoo2: + useBGR = GL_TRUE; + fxMesa->snapVertices = GL_FALSE; break; + case GR_SSTTYPE_Voodoo4: + case GR_SSTTYPE_Voodoo5: + if ((str = Glide->grGetRegistryOrEnvironmentStringExt("SSTH3_SLI_AA_CONFIGURATION")) != NULL) { + sliaa = atoi(str); + } + case GR_SSTTYPE_Voodoo3: default: - str = "pixelFormat"; - goto errorhandler; + useBGR = GL_FALSE; + fxMesa->snapVertices = GL_FALSE; + break; + } + /* ZZZ TO DO: Add the old SLI/AA settings for Napalm. */ + switch(voodoo->numChips) { + case 4: /* 4 chips */ + switch(sliaa) { + case 8: /* 8 Sample AA */ + numSLI = 1; + samplesPerChip = 2; + break; + case 7: /* 4 Sample AA */ + numSLI = 1; + samplesPerChip = 1; + break; + case 6: /* 2 Sample AA */ + numSLI = 2; + samplesPerChip = 1; + break; + default: + numSLI = 4; + samplesPerChip = 1; + } + break; + case 2: /* 2 chips */ + switch(sliaa) { + case 4: /* 4 Sample AA */ + numSLI = 1; + samplesPerChip = 2; + break; + case 3: /* 2 Sample AA */ + numSLI = 1; + samplesPerChip = 1; + break; + default: + numSLI = 2; + samplesPerChip = 1; + } + break; + default: /* 1 chip */ + switch(sliaa) { + case 1: /* 2 Sample AA */ + numSLI = 1; + samplesPerChip = 2; + break; + default: + numSLI = 1; + samplesPerChip = 1; + } + } + + fxMesa->fsaa = samplesPerChip * voodoo->numChips / numSLI; /* 1:noFSAA, 2:2xFSAA, 4:4xFSAA, 8:8xFSAA */ + + switch (fxMesa->colDepth = colDepth) { + case 15: + redBits = 5; + greenBits = 5; + blueBits = 5; + alphaBits = 1; + switch(fxMesa->fsaa) { + case 8: + pixFmt = GR_PIXFMT_AA_8_ARGB_1555; + break; + case 4: + pixFmt = GR_PIXFMT_AA_4_ARGB_1555; + break; + case 2: + pixFmt = GR_PIXFMT_AA_2_ARGB_1555; + break; + default: + pixFmt = GR_PIXFMT_ARGB_1555; + } + break; + case 16: + redBits = 5; + greenBits = 6; + blueBits = 5; + alphaBits = depthSize ? 0 : 8; + switch(fxMesa->fsaa) { + case 8: + pixFmt = GR_PIXFMT_AA_8_RGB_565; + break; + case 4: + pixFmt = GR_PIXFMT_AA_4_RGB_565; + break; + case 2: + pixFmt = GR_PIXFMT_AA_2_RGB_565; + break; + default: + pixFmt = GR_PIXFMT_RGB_565; + } + break; + case 32: + redBits = 8; + greenBits = 8; + blueBits = 8; + alphaBits = 8; + switch(fxMesa->fsaa) { + case 8: + pixFmt = GR_PIXFMT_AA_8_ARGB_8888; + break; + case 4: + pixFmt = GR_PIXFMT_AA_4_ARGB_8888; + break; + case 2: + pixFmt = GR_PIXFMT_AA_2_ARGB_8888; + break; + default: + pixFmt = GR_PIXFMT_ARGB_8888; + } + break; + default: + str = "pixelFormat"; + goto errorhandler; } + /* ZZZ TODO: check if there is enough fbRam */ + /* Tips: * 1. we don't bother setting/checking AUX for stencil, because we'll decide * later whether we have HW stencil, based on depth buffer (thus AUX is @@ -391,7 +500,6 @@ fxMesaCreateContext(GLuint win, fxMesa->haveZBuffer = depthSize > 0; fxMesa->haveDoubleBuffer = doubleBuffer; fxMesa->haveGlobalPaletteTexture = GL_FALSE; - fxMesa->verbose = verbose; fxMesa->board = glbCurrentBoard; fxMesa->haveTwoTMUs = (voodoo->nTexelfx > 1); @@ -419,60 +527,6 @@ fxMesaCreateContext(GLuint win, fxMesa->swapInterval = 0; } - if ((str = Glide->grGetRegistryOrEnvironmentStringExt("SSTH3_SLI_AA_CONFIGURATION"))) { - sliaa = atoi(str); - } else { - sliaa = 0; - } - switch (colDepth) { - case 15: - if ((numChips == 4) && (sliaa == 8)) { - pixFmt = GR_PIXFMT_AA_8_ARGB_1555; - fsaa = 8; - } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) { - pixFmt = GR_PIXFMT_AA_4_ARGB_1555; - fsaa = 4; - } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) { - pixFmt = GR_PIXFMT_AA_2_ARGB_1555; - fsaa = 2; - } else { - fsaa = 0; - } - break; - case 16: - if ((numChips == 4) && (sliaa == 8)) { - pixFmt = GR_PIXFMT_AA_8_RGB_565; - fsaa = 8; - } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) { - pixFmt = GR_PIXFMT_AA_4_RGB_565; - fsaa = 4; - } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) { - pixFmt = GR_PIXFMT_AA_2_RGB_565; - fsaa = 2; - } else { - fsaa = 0; - } - break; - case 32: - if ((numChips == 4) && (sliaa == 8)) { - pixFmt = GR_PIXFMT_AA_8_ARGB_8888; - fsaa = 8; - } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) { - pixFmt = GR_PIXFMT_AA_4_ARGB_8888; - fsaa = 4; - } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) { - pixFmt = GR_PIXFMT_AA_2_ARGB_8888; - fsaa = 2; - } else { - fsaa = 0; - } - break; - default: /* NOTREACHED */ - str = "pixelFormat"; - goto errorhandler; - } - fxMesa->fsaa = fsaa; - BEGIN_BOARD_LOCK(); if (fxMesa->HavePixExt) { fxMesa->glideContext = Glide->grSstWinOpenExt((FxU32)win, res, ref, @@ -492,46 +546,44 @@ fxMesaCreateContext(GLuint win, goto errorhandler; } - /* - * Pixel tables are used during pixel read-back - * Either initialize them for RGB or BGR order; - * However, 32bit capable cards have the right order. - * As a consequence, 32bit read-back is not swizzled! - * Also determine if we need vertex snapping. - */ - switch (voodoo->type) { - case GR_SSTTYPE_VOODOO: - case GR_SSTTYPE_Banshee: - useBGR = GL_TRUE; - fxMesa->snapVertices = GL_TRUE; - break; - case GR_SSTTYPE_Voodoo2: - useBGR = GL_TRUE; - fxMesa->snapVertices = GL_FALSE; - break; - case GR_SSTTYPE_Voodoo3: - case GR_SSTTYPE_Voodoo4: - case GR_SSTTYPE_Voodoo5: - default: - useBGR = GL_FALSE; - fxMesa->snapVertices = GL_FALSE; - break; - } + /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */ + tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam; + fbRam = voodoo->fbRam; + BEGIN_BOARD_LOCK(); + { + FxI32 result; + grGet(GR_MEMORY_TMU, 4, &result); + tmuRam = result / (1024 * 1024); + grGet(GR_MEMORY_FB, 4, &result); + fbRam = result / (1024 * 1024); + } + END_BOARD_LOCK(); + + sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dMB FB, %dMB TM, %d TMU, %s", + grGetString(GR_RENDERER), + grGetString(GR_HARDWARE), + fbRam, + tmuRam * voodoo->nTexelfx, + voodoo->nTexelfx, + (voodoo->numChips > 1) ? "SLI" : "NOSLI"); - fxInitPixelTables(fxMesa, useBGR); + fxMesa->bgrOrder = useBGR; - fxMesa->width = FX_grSstScreenWidth(); - fxMesa->height = FX_grSstScreenHeight(); + /* screen */ + fxMesa->screen_width = FX_grSstScreenWidth(); + fxMesa->screen_height = FX_grSstScreenHeight(); + + /* window inside screen */ + fxMesa->width = fxMesa->screen_width; + fxMesa->height = fxMesa->screen_height; + /* scissor inside window */ fxMesa->clipMinX = 0; fxMesa->clipMaxX = fxMesa->width; fxMesa->clipMinY = 0; fxMesa->clipMaxY = fxMesa->height; - fxMesa->screen_width = fxMesa->width; - fxMesa->screen_height = fxMesa->height; - - if (verbose) { + if (fxMesa->verbose) { char buf[80]; strcpy(buf, grGetString(GR_VERSION)); @@ -544,7 +596,7 @@ fxMesaCreateContext(GLuint win, fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n", useBGR ? "BGR" : "RGB", fxMesa->snapVertices); - fprintf(stderr, "Voodoo screen: %dx%d.%d\n", + fprintf(stderr, "Voodoo screen: %dx%d:%d\n", fxMesa->screen_width, fxMesa->screen_height, colDepth); } diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 386fa5b120c..557c0038647 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1,9 +1,3 @@ -/* Hack alert: - * fxDDReadPixels888 does not convert 8A8R8G8B into 5R5G5B - */ - -/* $Id: fxdd.c,v 1.100.2.1 2003/11/21 13:40:21 keithw Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -55,6 +49,7 @@ #include "texstore.h" #include "teximage.h" #include "swrast/swrast.h" +#include "swrast/s_context.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" @@ -63,13 +58,6 @@ -/* These lookup table are used to extract RGB values in [0,255] from - * 16-bit pixel values. - */ -GLubyte FX_PixelToR[0x10000]; -GLubyte FX_PixelToG[0x10000]; -GLubyte FX_PixelToB[0x10000]; - /* lookup table for scaling 4 bit colors up to 8 bits */ GLuint FX_rgb_scale_4[16] = { 0, 17, 34, 51, 68, 85, 102, 119, @@ -98,35 +86,17 @@ GLuint FX_rgb_scale_6[64] = { /* - * Initialize the FX_PixelTo{RGB} arrays. - * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order. + * Disable color by masking out R, G, B, A */ -void -fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder) +static void fxDisableColor (fxMesaContext fxMesa) { - GLuint pixel; - - fxMesa->bgrOrder = bgrOrder; - for (pixel = 0; pixel <= 0xffff; pixel++) { - GLuint r, g, b; - if (bgrOrder) { - r = (pixel & 0x001F) << 3; - g = (pixel & 0x07E0) >> 3; - b = (pixel & 0xF800) >> 8; - } - else { - r = (pixel & 0xF800) >> 8; - g = (pixel & 0x07E0) >> 3; - b = (pixel & 0x001F) << 3; - } - /* fill in low-order bits with proper rounding */ - r = (GLuint)(((double)r * 255. / 0xF8) + 0.5); - g = (GLuint)(((double)g * 255. / 0xFC) + 0.5); - b = (GLuint)(((double)b * 255. / 0xF8) + 0.5); - FX_PixelToR[pixel] = r; - FX_PixelToG[pixel] = g; - FX_PixelToB[pixel] = b; - } + if (fxMesa->colDepth != 16) { + /* 32bpp mode or 15bpp mode */ + fxMesa->Glide.grColorMaskExt(FXFALSE, FXFALSE, FXFALSE, FXFALSE); + } else { + /* 16 bpp mode */ + grColorMask(FXFALSE, FXFALSE); + } } @@ -185,30 +155,42 @@ static void fxDDClear( GLcontext *ctx, const FxU32 clearD = (FxU32) (((1 << ctx->Visual.depthBits) - 1) * ctx->Depth.Clear); const FxU8 clearS = (FxU8) (ctx->Stencil.Clear & 0xff); + /* [dBorca] Hack alert: + * if we set Mesa for 32bit depth, we'll get + * clearD == 0 + * due to 32bit integer overflow! + */ + if ( TDFX_DEBUG & MESA_VERBOSE ) { fprintf( stderr, "%s( %d, %d, %d, %d )\n", __FUNCTION__, (int) x, (int) y, (int) width, (int) height ); } -/*jejeje*/ /* Need this check to respond to glScissor and clipping updates */ + /* should also take care of FX_NEW_COLOR_MASK, FX_NEW_STENCIL, depth? */ if (fxMesa->new_state & FX_NEW_SCISSOR) { - extern void fxSetupScissor(GLcontext * ctx); fxSetupScissor(ctx); + fxMesa->new_state &= ~FX_NEW_SCISSOR; } /* we can't clear accum buffers */ mask &= ~(DD_ACCUM_BIT); + /* + * As per GL spec, stencil masking should be obeyed when clearing + */ if (mask & DD_STENCIL_BIT) { if (!fxMesa->haveHwStencil || fxMesa->unitsState.stencilWriteMask != 0xff) { /* Napalm seems to have trouble with stencil write masks != 0xff */ /* do stencil clear in software */ - mask &= ~(DD_STENCIL_BIT); softwareMask |= DD_STENCIL_BIT; + mask &= ~(DD_STENCIL_BIT); } } + /* + * As per GL spec, color masking should be obeyed when clearing + */ if (ctx->Visual.greenBits != 8 && ctx->Visual.greenBits != 5) { /* can only do color masking if running in 24/32bpp on Napalm */ if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] || @@ -252,7 +234,7 @@ static void fxDDClear( GLcontext *ctx, switch (mask & ~DD_STENCIL_BIT) { case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: /* back buffer & depth */ - fxColorMask(fxMesa, GL_TRUE); /* work around Voodoo3 bug */ + /* FX_grColorMaskv_NoLock(ctx, true4); */ /* work around Voodoo3 bug */ grDepthMask(FXTRUE); grRenderBuffer(GR_BUFFER_BACKBUFFER); if (stencil_size > 0) { @@ -264,7 +246,7 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Test) { + if (!fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXFALSE); } break; @@ -276,7 +258,7 @@ static void fxDDClear( GLcontext *ctx, /* clear depth */ grDepthMask(FXTRUE); grRenderBuffer(GR_BUFFER_BACKBUFFER); - fxColorMask(fxMesa, GL_FALSE); + fxDisableColor(fxMesa); if (stencil_size > 0) fxMesa->Glide.grBufferClearExt(fxMesa->clearC, fxMesa->clearA, @@ -286,7 +268,7 @@ static void fxDDClear( GLcontext *ctx, fxMesa->clearA, clearD); /* clear front */ - fxColorMask(fxMesa, GL_TRUE); + fxSetupColorMask(ctx); grRenderBuffer(GR_BUFFER_FRONTBUFFER); if (stencil_size > 0) fxMesa->Glide.grBufferClearExt(fxMesa->clearC, @@ -296,7 +278,7 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Test) { + if (!fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXFALSE); } break; @@ -312,7 +294,7 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { + if (fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXTRUE); } break; @@ -328,7 +310,7 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { + if (fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXTRUE); } break; @@ -353,7 +335,7 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (ctx->Depth.Mask && ctx->Depth.Test) { + if (fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXTRUE); } break; @@ -380,14 +362,14 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask || !ctx->Depth.Mask) { + if (!fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXFALSE); } break; case DD_DEPTH_BIT: /* just the depth buffer */ grRenderBuffer(GR_BUFFER_BACKBUFFER); - fxColorMask(fxMesa, GL_FALSE); + fxDisableColor(fxMesa); grDepthMask(FXTRUE); if (stencil_size > 0) fxMesa->Glide.grBufferClearExt(fxMesa->clearC, @@ -397,11 +379,13 @@ static void fxDDClear( GLcontext *ctx, grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - fxColorMask(fxMesa, GL_TRUE); - if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) + fxSetupColorMask(ctx); + if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) { grRenderBuffer(GR_BUFFER_FRONTBUFFER); - if (!ctx->Depth.Test || !ctx->Depth.Mask) + } + if (!fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXFALSE); + } break; default: /* clear no color buffers or depth buffer but might clear stencil */ @@ -409,16 +393,17 @@ static void fxDDClear( GLcontext *ctx, /* XXX need this RenderBuffer call to work around Glide bug */ grRenderBuffer(GR_BUFFER_BACKBUFFER); grDepthMask(FXFALSE); - fxColorMask(fxMesa, GL_FALSE); + fxDisableColor(fxMesa); fxMesa->Glide.grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); - if (ctx->Depth.Mask && ctx->Depth.Test) { + if (fxMesa->unitsState.depthTestEnabled) { grDepthMask(FXTRUE); } - fxColorMask(fxMesa, GL_TRUE); - if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) + fxSetupColorMask(ctx); + if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) { grRenderBuffer(GR_BUFFER_FRONTBUFFER); + } } } } @@ -456,7 +441,7 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode) grRenderBuffer(fxMesa->currentFB); } else if (mode == GL_NONE) { - fxColorMask(fxMesa, GL_FALSE); + fxDisableColor(fxMesa); } else { /* we'll need a software fallback */ @@ -468,44 +453,48 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode) } - - - static void -fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte * bitmap) +fxDDDrawBitmap2 (GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) { fxMesaContext fxMesa = FX_CONTEXT(ctx); + SWcontext *swrast = SWRAST_CONTEXT(ctx); GrLfbInfo_t info; + GrLfbWriteMode_t mode; FxU16 color; const struct gl_pixelstore_attrib *finalUnpack; struct gl_pixelstore_attrib scissoredUnpack; /* check if there's any raster operations enabled which we can't handle */ - if (ctx->Color.AlphaEnabled || - ctx->Color.BlendEnabled || - ctx->Depth.Test || - ctx->Fog.Enabled || - ctx->Color.ColorLogicOpEnabled || - ctx->Stencil.Enabled || - ctx->Scissor.Enabled || - (ctx->DrawBuffer->UseSoftwareAlphaBuffers && - ctx->Color.ColorMask[ACOMP]) || - (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && - ctx->Color._DrawDestMask != BACK_LEFT_BIT)) { + if ((swrast->_RasterMask & (ALPHATEST_BIT | + /*BLEND_BIT |*/ /* blending ok, through pixpipe */ + DEPTH_BIT | /* could be done with RGB:DEPTH */ + FOG_BIT | /* could be done with RGB:DEPTH */ + LOGIC_OP_BIT | + /*CLIP_BIT |*/ /* clipping ok, below */ + STENCIL_BIT | + /*MASKING_BIT |*/ /* masking ok, test follows */ + ALPHABUF_BIT | /* nope! see 565 span kludge */ + MULTI_DRAW_BIT | + OCCLUSION_BIT | /* nope! at least not yet */ + TEXTURE_BIT | + FRAGPROG_BIT)) + || + ((swrast->_RasterMask & MASKING_BIT) /*&& (ctx->Visual.greenBits != 8)*/ && (ctx->Visual.greenBits != 5)) + ) { _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap); return; } + /* make sure the pixelpipe is configured correctly */ + fxSetupFXUnits(ctx); if (ctx->Scissor.Enabled) { /* This is a bit tricky, but by carefully adjusting the px, py, * width, height, skipPixels and skipRows values we can do * scissoring without special code in the rendering loop. - * - * KW: This code is never reached, see the test above. */ /* we'll construct a new pixelstore struct */ @@ -544,26 +533,25 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py, /* compute pixel value */ { - GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); - GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); - GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); - /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */ - if (fxMesa->bgrOrder) - color = (FxU16) - (((FxU16) 0xf8 & b) << (11 - 3)) | - (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & r) >> 3); - else - color = (FxU16) - (((FxU16) 0xf8 & r) << (11 - 3)) | - (((FxU16) 0xfc & g) << (5 - 3 + 1)) | (((FxU16) 0xf8 & b) >> 3); + GLint r = (GLint) (ctx->Current.RasterColor[RCOMP] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f); + if (fxMesa->colDepth == 15) { + color = TDFXPACKCOLOR1555(b, g, r, a); + mode = GR_LFBWRITEMODE_1555; + } else { + color = fxMesa->bgrOrder ? TDFXPACKCOLOR565(r, g, b) : TDFXPACKCOLOR565(b, g, r); + mode = GR_LFBWRITEMODE_565; + } } info.size = sizeof(info); if (!grLfbLock(GR_LFB_WRITE_ONLY, fxMesa->currentFB, - GR_LFBWRITEMODE_565, - GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - fprintf(stderr, "%s: ERROR: locking the linear frame buffer\n", __FUNCTION__); + mode, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) { + _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap); return; } @@ -632,14 +620,174 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py, grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); } +static void +fxDDDrawBitmap4 (GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GrLfbInfo_t info; + FxU32 color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if ((swrast->_RasterMask & (ALPHATEST_BIT | + /*BLEND_BIT |*/ /* blending ok, through pixpipe */ + DEPTH_BIT | /* could be done with RGB:DEPTH */ + FOG_BIT | /* could be done with RGB:DEPTH */ + LOGIC_OP_BIT | + /*CLIP_BIT |*/ /* clipping ok, below */ + STENCIL_BIT | + /*MASKING_BIT |*/ /* masking ok, we're in 32bpp */ + /*ALPHABUF_BIT |*//* alpha ok, we're in 32bpp */ + MULTI_DRAW_BIT | + OCCLUSION_BIT | /* nope! at least not yet */ + TEXTURE_BIT | + FRAGPROG_BIT)) + ) { + _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap); + return; + } + + /* make sure the pixelpipe is configured correctly */ + fxSetupFXUnits(ctx); + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return; + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[RCOMP] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f); + color = TDFXPACKCOLOR8888(b, g, r, a); + } + + info.size = sizeof(info); + if (!grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) { + _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap); + return; + } + + { + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; + /* The dest stride depends on the hardware and whether we're drawing + * to the front or back buffer. This compile-time test seems to do + * the job for now. + */ + const GLint dstStride = info.strideInBytes / 4; /* stride in GLuints */ + + GLint row; + /* compute dest address of bottom-left pixel in bitmap */ + GLuint *dst = (GLuint *) info.lfbPtr + + (winY - py) * dstStride + (winX + px); + + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, GL_BITMAP, + 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); +} + static void -fxDDReadPixels(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *packing, GLvoid * dstImage) +fxDDReadPixels565 (GLcontext * ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage) { - if (ctx->_ImageTransferState) { + if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) { _swrast_ReadPixels(ctx, x, y, width, height, format, type, packing, dstImage); return; @@ -673,20 +821,18 @@ fxDDReadPixels(GLcontext * ctx, GLint x, GLint y, GLubyte *d = dst; for (col = 0; col < halfWidth; col++) { const GLuint pixel = ((const GLuint *) src)[col]; - const GLint pixel0 = pixel & 0xffff; - const GLint pixel1 = pixel >> 16; - *d++ = FX_PixelToR[pixel0]; - *d++ = FX_PixelToG[pixel0]; - *d++ = FX_PixelToB[pixel0]; - *d++ = FX_PixelToR[pixel1]; - *d++ = FX_PixelToG[pixel1]; - *d++ = FX_PixelToB[pixel1]; + *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f]; + *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; } if (extraPixel) { GLushort pixel = src[width - 1]; - *d++ = FX_PixelToR[pixel]; - *d++ = FX_PixelToG[pixel]; - *d++ = FX_PixelToB[pixel]; + *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; } dst += dstStride; src -= srcStride; @@ -701,22 +847,20 @@ fxDDReadPixels(GLcontext * ctx, GLint x, GLint y, GLubyte *d = dst; for (col = 0; col < halfWidth; col++) { const GLuint pixel = ((const GLuint *) src)[col]; - const GLint pixel0 = pixel & 0xffff; - const GLint pixel1 = pixel >> 16; - *d++ = FX_PixelToR[pixel0]; - *d++ = FX_PixelToG[pixel0]; - *d++ = FX_PixelToB[pixel0]; + *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; *d++ = 255; - *d++ = FX_PixelToR[pixel1]; - *d++ = FX_PixelToG[pixel1]; - *d++ = FX_PixelToB[pixel1]; + *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f]; + *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; *d++ = 255; } if (extraPixel) { const GLushort pixel = src[width - 1]; - *d++ = FX_PixelToR[pixel]; - *d++ = FX_PixelToG[pixel]; - *d++ = FX_PixelToB[pixel]; + *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f]; + *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; *d++ = 255; } dst += dstStride; @@ -747,14 +891,15 @@ fxDDReadPixels(GLcontext * ctx, GLint x, GLint y, } } -static void fxDDReadPixels555 (GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *packing, - GLvoid *dstImage) +static void +fxDDReadPixels555 (GLcontext * ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage) { - if (ctx->_ImageTransferState) { + if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) { _swrast_ReadPixels(ctx, x, y, width, height, format, type, packing, dstImage); return; @@ -788,18 +933,18 @@ static void fxDDReadPixels555 (GLcontext * ctx, GLubyte *d = dst; for (col = 0; col < halfWidth; col++) { const GLuint pixel = ((const GLuint *) src)[col]; - *d++ = FX_rgb_scale_5[ pixel & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; } if (extraPixel) { GLushort pixel = src[width - 1]; - *d++ = FX_rgb_scale_5[ pixel & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; } dst += dstStride; src -= srcStride; @@ -814,20 +959,20 @@ static void fxDDReadPixels555 (GLcontext * ctx, GLubyte *d = dst; for (col = 0; col < halfWidth; col++) { const GLuint pixel = ((const GLuint *) src)[col]; - *d++ = FX_rgb_scale_5[ pixel & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; *d++ = (pixel & 0x8000) ? 255 : 0; - *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; *d++ = (pixel & 0x80000000) ? 255 : 0; } if (extraPixel) { const GLushort pixel = src[width - 1]; - *d++ = FX_rgb_scale_5[ pixel & 0x1f]; - *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; + *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; + *d++ = FX_rgb_scale_5[ pixel & 0x1f]; *d++ = (pixel & 0x8000) ? 255 : 0; } dst += dstStride; @@ -858,14 +1003,15 @@ static void fxDDReadPixels555 (GLcontext * ctx, } } -static void fxDDReadPixels888 (GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *packing, - GLvoid *dstImage) +static void +fxDDReadPixels8888 (GLcontext * ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage) { - if (ctx->_ImageTransferState) { + if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) { _swrast_ReadPixels(ctx, x, y, width, height, format, type, packing, dstImage); return; @@ -906,17 +1052,35 @@ static void fxDDReadPixels888 (GLcontext * ctx, } } else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { - /* directly memcpy 8A8R8G8B pixels into client's buffer */ - const GLint widthInBytes = width * 4; - GLint row; + /* 8A8R8G8B pixels into client's buffer */ + GLint row, col; for (row = 0; row < height; row++) { - MEMCPY(dst, src, widthInBytes); + GLubyte *d = dst; + for (col = 0; col < width; col++) { + const GLuint pixel = ((const GLuint *) src)[col]; + *d++ = pixel >> 16; + *d++ = pixel >> 8; + *d++ = pixel; + *d++ = pixel >> 24; + } dst += dstStride; src -= srcStride; } } else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { - /* convert 8A8R8G8B into 5R5G5B */ + /* convert 8A8R8G8B into 5R6G5B */ + GLint row, col; + for (row = 0; row < height; row++) { + GLushort *d = (GLushort *)dst; + for (col = 0; col < width; col++) { + const GLuint pixel = ((const GLuint *) src)[col]; + *d++ = (((pixel >> 16) & 0xf8) << 8) | + (((pixel >> 8) & 0xfc) << 3) | + ((pixel & 0xf8) >> 3); + } + dst += dstStride; + src -= srcStride; + } } else { grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); @@ -933,6 +1097,105 @@ static void fxDDReadPixels888 (GLcontext * ctx, } +/* [dBorca] Hack alert: + * not finished!!! + * revise fallback tests and fix scissor; implement new formats + * also write its siblings: 565 and 1555 + */ +void +fxDDDrawPixels8888 (GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid * pixels) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + + if (ctx->Pixel.ZoomX != 1.0F || + ctx->Pixel.ZoomY != 1.0F || + (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT| + IMAGE_MAP_COLOR_BIT)) || + ctx->Color.AlphaEnabled || + ctx->Depth.Test || + ctx->Fog.Enabled || + ctx->Scissor.Enabled || + ctx->Stencil.Enabled || + !ctx->Color.ColorMask[0] || + !ctx->Color.ColorMask[1] || + !ctx->Color.ColorMask[2] || + !ctx->Color.ColorMask[3] || + ctx->Color.ColorLogicOpEnabled || + ctx->Texture._EnabledUnits || + ctx->Depth.OcclusionTest || + fxMesa->fallback) + { + _swrast_DrawPixels( ctx, x, y, width, height, format, type, + unpack, pixels ); + return; + } + + /* lock early to make sure cliprects are right */ + BEGIN_BOARD_LOCK(); + + /* make sure the pixelpipe is configured correctly */ + fxSetupFXUnits(ctx); + + /* look for clipmasks, giveup if region obscured */ +#if 0 + if (ctx->Color.DrawBuffer == GL_FRONT) { + if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) { + END_BOARD_LOCK(fxMesa); + _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); + return; + } + } +#endif + + info.size = sizeof(info); + if (!grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) { + _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); + return; + } + + { + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; + + const GLint dstStride = info.strideInBytes / 4; /* stride in GLuints */ + GLuint *dst = (GLuint *) info.lfbPtr + (winY - y) * dstStride + (winX + x); + const GLubyte *src = (GLubyte *)_mesa_image_address(unpack, pixels, + width, height, format, + type, 0, 0, 0); + const GLint srcStride = _mesa_image_row_stride(unpack, width, format, type); + + if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { + /* directly memcpy 8A8R8G8B pixels to screen */ + const GLint widthInBytes = width * 4; + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst -= dstStride; + src += srcStride; + } + } + else { + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + END_BOARD_LOCK(); + _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); + return; + } + + } + + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + END_BOARD_LOCK(); +} + + static void fxDDFinish(GLcontext * ctx) { @@ -955,6 +1218,25 @@ fxDDGetString(GLcontext * ctx, GLenum name) switch (name) { case GL_RENDERER: return (GLubyte *)fxMesa->rendererString; +#if 0 /* hack to advertise vanilla extension names */ + case GL_EXTENSIONS: + if (ctx->Extensions.String == NULL) { + GLubyte *ext = _mesa_make_extension_string(ctx); + if (ext != NULL) { + ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256); + if (ctx->Extensions.String != NULL) { + strcpy((char *)ctx->Extensions.String, (char *)ext); +#if 0 /* put any additional extension names here */ + strcat((char *)ctx->Extensions.String, " 3DFX_set_global_palette"); +#endif + _mesa_free(ext); + } else { + ctx->Extensions.String = ext; + } + } + } + return ctx->Extensions.String; +#endif default: return NULL; } @@ -1007,6 +1289,7 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa) fxMesa->unitsState.blendDstFuncRGB = GR_BLEND_ZERO; fxMesa->unitsState.blendSrcFuncAlpha = GR_BLEND_ONE; fxMesa->unitsState.blendDstFuncAlpha = GR_BLEND_ZERO; + fxMesa->unitsState.blendEq = GR_BLEND_OP_ADD; fxMesa->unitsState.depthTestEnabled = GL_FALSE; fxMesa->unitsState.depthMask = GL_TRUE; @@ -1015,16 +1298,17 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa) fxMesa->unitsState.stencilWriteMask = 0xff; - fxColorMask(fxMesa, GL_TRUE); - if (fxMesa->haveDoubleBuffer) { - fxMesa->currentFB = GR_BUFFER_BACKBUFFER; - grRenderBuffer(GR_BUFFER_BACKBUFFER); - } - else { - fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; - grRenderBuffer(GR_BUFFER_FRONTBUFFER); + if (fxMesa->colDepth != 16) { + /* 32bpp mode or 15bpp mode */ + fxMesa->Glide.grColorMaskExt(FXTRUE, FXTRUE, FXTRUE, fxMesa->haveHwAlpha); + } else { + /* 16 bpp mode */ + grColorMask(FXTRUE, fxMesa->haveHwAlpha); } + fxMesa->currentFB = fxMesa->haveDoubleBuffer ? GR_BUFFER_BACKBUFFER : GR_BUFFER_FRONTBUFFER; + grRenderBuffer(fxMesa->currentFB); + fxMesa->state = MALLOC(FX_grGetInteger(GR_GLIDE_STATE_SIZE)); fxMesa->fogTable = (GrFog_t *) MALLOC(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) * sizeof(GrFog_t)); @@ -1040,7 +1324,9 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa) if (fxMesa->haveZBuffer) grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); - grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); + if (!fxMesa->bgrOrder) { + grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); + } fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN); /* [koolsmoky] */ @@ -1090,6 +1376,13 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa) fxDDInitExtensions(ctx); +#if 0 + /* [dBorca] Hack alert: + * do we want dither? It just looks bad... + */ + grEnable(GR_ALLOW_MIPMAP_DITHER); + grTexNccTable(GR_NCCTABLE_NCC0); /* set this once... no multipass */ +#endif grGlideGetState((GrState *) fxMesa->state); return 1; @@ -1121,11 +1414,11 @@ fxDDInitExtensions(GLcontext * ctx) { fxMesaContext fxMesa = FX_CONTEXT(ctx); - /*_mesa_add_extension(ctx, GL_TRUE, "3DFX_set_global_palette", 0);*/ _mesa_enable_extension(ctx, "GL_EXT_point_parameters"); _mesa_enable_extension(ctx, "GL_EXT_paletted_texture"); _mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias"); _mesa_enable_extension(ctx, "GL_EXT_shared_texture_palette"); + _mesa_enable_extension(ctx, "GL_EXT_blend_func_separate"); if (fxMesa->haveTwoTMUs) { _mesa_enable_extension(ctx, "GL_EXT_texture_env_add"); @@ -1136,18 +1429,44 @@ fxDDInitExtensions(GLcontext * ctx) _mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" ); } -#if 0 /* not ready yet */ - /* banshee/avenger should enable this for NCC */ - _mesa_enable_extension( ctx, "GL_ARB_texture_compression" ); -#endif - if (0/*IS_NAPALM*/) { - /* tex_compress: not ready yet */ - _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" ); - _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); - /*_mesa_enable_extension( ctx, "GL_S3_s3tc" );*/ - - /* env_combine: not ready yet */ - /*_mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );*/ + /* [dBorca] Hack alert: + * True texture compression can be done only on Napalm. + * We will advertise, however, generic texture compression + * on all Voodoo cards; the Mesa logic allows us to eventually + * fallback to uncompressed. This will fix those dumb applications + * which refuse to run w/o texture compression! We actually _can_ + * do texture compression for pre-Napalm cores, through NCC. But + * NCC poses many issues: + * 1) NCC w/o DITHER_ERR has poor quality and NCC w/ DITHER_ERR is + * damn slow! + * 2) NCC compression cannot be used with multitexturing, because + * the decompression tables are not per TMU anymore (bear in mind + * that earlier Voodoos could handle 2 NCC tables for each TMU -- + * just look for POINTCAST_PALETTE). As a last resort, we could + * fake NCC multitexturing through multipass rendering, but... + * ohwell, it's not worth the effort... + * This stand true for multitexturing palletized textures. + * 3) since NCC is not an OpenGL standard (as opposed to FXT1), we + * would need to plug deeper into the core... First, we would need to + * bind NCC to GL_COMPRESSED_RGB[A]. Then, we would need to trick + * Mesa into reporting our texture as compressed. Last, we would need + * to stash the NCC decompression table into the mipmap data and adjust + * CompressedSize accordingly! + */ + _mesa_enable_extension(ctx, "GL_ARB_texture_compression"); + + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1"); + _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + _mesa_enable_extension(ctx, "GL_S3_s3tc"); + } + + if (fxMesa->HaveCmbExt) { + _mesa_enable_extension(ctx, "GL_EXT_texture_env_combine"); + } + + if (fxMesa->HavePixExt) { + _mesa_enable_extension(ctx, "GL_EXT_blend_subtract"); } if (fxMesa->HaveMirExt) { @@ -1181,8 +1500,17 @@ fx_check_IsInHardware(GLcontext * ctx) return FX_FALLBACK_DRAW_BUFFER; } - if (ctx->Color.BlendEnabled && (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT)) { - return FX_FALLBACK_BLEND; + if (ctx->Color.BlendEnabled) { + if (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT) { + if (fxMesa->HavePixExt) { + if ((ctx->Color.BlendEquation != GL_FUNC_SUBTRACT_EXT) && + (ctx->Color.BlendEquation != GL_FUNC_REVERSE_SUBTRACT_EXT)) { + return FX_FALLBACK_BLEND; + } + } else { + return FX_FALLBACK_BLEND; + } + } } if (ctx->Color.ColorLogicOpEnabled && (ctx->Color.LogicOp != GL_COPY)) { @@ -1212,6 +1540,7 @@ fx_check_IsInHardware(GLcontext * ctx) return FX_FALLBACK_TEXTURE_1D_3D; if (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) { + if (fxMesa->type < GR_SSTTYPE_Voodoo2) if (ctx->Texture.Unit[0].EnvMode == GL_BLEND && (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT || ctx->Texture.Unit[0].EnvColor[0] != 0 || @@ -1225,6 +1554,7 @@ fx_check_IsInHardware(GLcontext * ctx) } if (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) { + if (fxMesa->type < GR_SSTTYPE_Voodoo2) if (ctx->Texture.Unit[1].EnvMode == GL_BLEND) return FX_FALLBACK_TEXTURE_ENV; if (ctx->Texture.Unit[1]._Current->Image[0]->Border > 0) @@ -1264,6 +1594,7 @@ fx_check_IsInHardware(GLcontext * ctx) return FX_FALLBACK_TEXTURE_MULTI; } + if (fxMesa->type < GR_SSTTYPE_Voodoo2) if ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) && (ctx->Texture.Unit[0].EnvMode == GL_BLEND)) { return FX_FALLBACK_TEXTURE_ENV; @@ -1314,18 +1645,21 @@ fxSetupDDPointers(GLcontext * ctx) ctx->Driver.DrawBuffer = fxDDSetDrawBuffer; ctx->Driver.GetBufferSize = fxDDBufferSize; ctx->Driver.Accum = _swrast_Accum; - ctx->Driver.Bitmap = fxDDDrawBitmap; ctx->Driver.CopyPixels = _swrast_CopyPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels; switch (fxMesa->colDepth) { case 15: ctx->Driver.ReadPixels = fxDDReadPixels555; + ctx->Driver.Bitmap = fxDDDrawBitmap2; break; case 16: - ctx->Driver.ReadPixels = fxDDReadPixels; + ctx->Driver.ReadPixels = fxDDReadPixels565; + ctx->Driver.Bitmap = fxDDDrawBitmap2; break; case 32: - ctx->Driver.ReadPixels = fxDDReadPixels888; + ctx->Driver.DrawPixels = fxDDDrawPixels8888; + ctx->Driver.ReadPixels = fxDDReadPixels8888; + ctx->Driver.Bitmap = fxDDDrawBitmap4; break; } ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; @@ -1339,11 +1673,13 @@ fxSetupDDPointers(GLcontext * ctx) ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; - ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; + ctx->Driver.CompressedTexImage2D = fxDDCompressedTexImage2D; ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; - ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + ctx->Driver.CompressedTexSubImage2D = fxDDCompressedTexSubImage2D; ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + ctx->Driver.IsCompressedFormat = fxDDIsCompressedFormat; + ctx->Driver.CompressedTextureSize = fxDDCompressedTextureSize; ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; @@ -1358,9 +1694,12 @@ fxSetupDDPointers(GLcontext * ctx) ctx->Driver.TexParameter = fxDDTexParam; ctx->Driver.BindTexture = fxDDTexBind; ctx->Driver.DeleteTexture = fxDDTexDel; + ctx->Driver.IsTextureResident = fxDDIsTextureResident; ctx->Driver.UpdateTexturePalette = fxDDTexPalette; ctx->Driver.AlphaFunc = fxDDAlphaFunc; ctx->Driver.BlendFunc = fxDDBlendFunc; + ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate; + ctx->Driver.BlendEquation = fxDDBlendEquation; ctx->Driver.DepthFunc = fxDDDepthFunc; ctx->Driver.DepthMask = fxDDDepthMask; ctx->Driver.ColorMask = fxDDColorMask; diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index 460126e86b1..158e34e08e1 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -1,12 +1,3 @@ -/* Hack alert: - * The performance hit is disastruous for SPAN functions. - * Should we use SpanRenderStart / SpanRenderFinish in `swrast.h' - * for locking / unlocking the LFB? - * Optimize and check endianess for `read_R8G8B8_pixels' - */ - -/* $Id: fxddspan.c,v 1.25 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -54,548 +45,415 @@ #include "fxglidew.h" #include "swrast/swrast.h" -#ifdef _MSC_VER -#ifdef _WIN32 -#pragma warning( disable : 4090 4022 ) -/* 4101 : "different 'const' qualifier" - * 4022 : "pointer mistmatch for actual parameter 'n' - */ -#endif -#endif - - - -#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ - FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) - +/************************************************************************/ +/***** Span functions *****/ +/************************************************************************/ -/* KW: Rearranged the args in the call to grLfbWriteRegion(). +#define DBG 0 + + +#define LOCAL_VARS \ + GLuint pitch = info.strideInBytes; \ + GLuint height = fxMesa->height; \ + char *buf = (char *)((char *)info.lfbPtr + 0 /* x, y offset */); \ + GLuint p; \ + (void) buf; (void) p; + +#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \ + _y >= miny && _y < maxy ) + +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx;\ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } + +#define Y_FLIP(_y) (height - _y - 1) + +#define HW_WRITE_LOCK() \ + fxMesaContext fxMesa = FX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_WRITE_ONLY, \ + fxMesa->currentFB, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) { + +#define HW_WRITE_UNLOCK() \ + grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->currentFB ); \ + } + +#define HW_READ_LOCK() \ + fxMesaContext fxMesa = FX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->currentFB, \ + LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) { + +#define HW_READ_UNLOCK() \ + grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->currentFB ); \ + } + +#define HW_WRITE_CLIPLOOP() \ + do { \ + int _nc = 1; /* numcliprects */ \ + /* [dBorca] Hack alert: */ \ + /* remember, we need to flip the scissor, too */ \ + /* is it better to do it inside fxDDScissor? */ \ + while (_nc--) { \ + const int minx = fxMesa->clipMinX; \ + const int maxy = Y_FLIP(fxMesa->clipMinY); \ + const int maxx = fxMesa->clipMaxX; \ + const int miny = Y_FLIP(fxMesa->clipMaxY); + +#define HW_READ_CLIPLOOP() \ + do { \ + int _nc = 1; /* numcliprects */ \ + /* [dBorca] Hack alert: */ \ + /* remember, we need to flip the scissor, too */ \ + /* is it better to do it inside fxDDScissor? */ \ + while (_nc--) { \ + const int minx = fxMesa->clipMinX; \ + const int maxy = Y_FLIP(fxMesa->clipMinY); \ + const int maxx = fxMesa->clipMaxX; \ + const int miny = Y_FLIP(fxMesa->clipMaxY); + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + + +/* 16 bit, ARGB1555 color spanline and pixel functions */ + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_1555 + +#undef BYTESPERPIXEL +#define BYTESPERPIXEL 2 + +#undef INIT_MONO_PIXEL +#define INIT_MONO_PIXEL(p, color) \ + p = TDFXPACKCOLOR1555( color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP] ) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \ + TDFXPACKCOLOR1555( r, g, b, a ) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch); \ + rgba[0] = FX_rgb_scale_5[(p >> 10) & 0x1F]; \ + rgba[1] = FX_rgb_scale_5[(p >> 5) & 0x1F]; \ + rgba[2] = FX_rgb_scale_5[ p & 0x1F]; \ + rgba[3] = (p & 0x8000) ? 255 : 0; \ + } while (0) + +#define TAG(x) tdfx##x##_ARGB1555 +#include "../dri/common/spantmp.h" + + +/* 16 bit, RGB565 color spanline and pixel functions */ +/* [dBorca] Hack alert: + * This is wrong. The alpha value is lost, even when we provide + * HW alpha (565 w/o depth buffering). To really update alpha buffer, + * we would need to do the 565 writings via 8888 colorformat and rely + * on the Voodoo to perform color scaling. In which case our 565 span + * would look nicer! But this violates FSAA rules... */ -#define LFB_WRITE_SPAN_MESA(dst_buffer, \ - dst_x, \ - dst_y, \ - src_width, \ - src_stride, \ - src_data) \ - writeRegionClipped(fxMesa, dst_buffer, \ - dst_x, \ - dst_y, \ - GR_LFB_SRC_FMT_8888, \ - src_width, \ - 1, \ - src_stride, \ - src_data) \ +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_565 -/************************************************************************/ -/***** Span functions *****/ -/************************************************************************/ +#undef BYTESPERPIXEL +#define BYTESPERPIXEL 2 +#undef INIT_MONO_PIXEL +#define INIT_MONO_PIXEL(p, color) \ + p = TDFXPACKCOLOR565( color[RCOMP], color[GCOMP], color[BCOMP] ) -static void -fxDDWriteRGBASpan(const GLcontext * ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint i; - GLint bottom = fxMesa->height - 1; +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \ + TDFXPACKCOLOR565( r, g, b ) - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p - if (mask) { - int span = 0; - - for (i = 0; i < n; i++) { - if (mask[i]) { - ++span; - } - else { - if (span > 0) { - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + i - span, - bottom - y, - /* GR_LFB_SRC_FMT_8888, */ span, /*1, */ 0, - (void *) rgba[i - span]); - span = 0; - } - } - } - - if (span > 0) - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + n - span, bottom - y, - /* GR_LFB_SRC_FMT_8888, */ span, /*1, */ 0, - (void *) rgba[n - span]); - } - else - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x, bottom - y, /* GR_LFB_SRC_FMT_8888, */ - n, /* 1, */ 0, (void *) rgba); -} +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch); \ + rgba[0] = FX_rgb_scale_5[(p >> 11) & 0x1F]; \ + rgba[1] = FX_rgb_scale_6[(p >> 5) & 0x3F]; \ + rgba[2] = FX_rgb_scale_5[ p & 0x1F]; \ + rgba[3] = 0xff; \ + } while (0) +#define TAG(x) tdfx##x##_RGB565 +#include "../dri/common/spantmp.h" -static void -fxDDWriteRGBSpan(const GLcontext * ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint i; - GLint bottom = fxMesa->height - 1; - GLubyte rgba[MAX_WIDTH][4]; - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +/* 32 bit, ARGB8888 color spanline and pixel functions */ - if (mask) { - int span = 0; - - for (i = 0; i < n; i++) { - if (mask[i]) { - rgba[span][RCOMP] = rgb[i][0]; - rgba[span][GCOMP] = rgb[i][1]; - rgba[span][BCOMP] = rgb[i][2]; - rgba[span][ACOMP] = 255; - ++span; - } - else { - if (span > 0) { - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + i - span, - bottom - y, - /*GR_LFB_SRC_FMT_8888, */ span, /* 1, */ 0, - (void *) rgba); - span = 0; - } - } - } - - if (span > 0) - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + n - span, bottom - y, - /*GR_LFB_SRC_FMT_8888, */ span, /* 1, */ 0, - (void *) rgba); - } - else { - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = rgb[i][0]; - rgba[i][GCOMP] = rgb[i][1]; - rgba[i][BCOMP] = rgb[i][2]; - rgba[i][ACOMP] = 255; - } - - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x, bottom - y, /* GR_LFB_SRC_FMT_8888, */ - n, /* 1, */ 0, (void *) rgba); - } -} +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_8888 +#undef BYTESPERPIXEL +#define BYTESPERPIXEL 4 -static void -fxDDWriteMonoRGBASpan(const GLcontext * ctx, - GLuint n, GLint x, GLint y, - const GLchan color[4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint i; - GLint bottom = fxMesa->height - 1; - GLuint data[MAX_WIDTH]; - GrColor_t gColor = FXCOLOR4(color); +#undef INIT_MONO_PIXEL +#define INIT_MONO_PIXEL(p, color) \ + p = TDFXPACKCOLOR8888( color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP] ) - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \ + TDFXPACKCOLOR8888( r, g, b, a ) - if (mask) { - int span = 0; - - for (i = 0; i < n; i++) { - if (mask[i]) { - data[span] = (GLuint) gColor; - ++span; - } - else { - if (span > 0) { - writeRegionClipped(fxMesa, fxMesa->currentFB, x + i - span, - bottom - y, GR_LFB_SRC_FMT_8888, span, 1, 0, - (void *) data); - span = 0; - } - } - } - - if (span > 0) - writeRegionClipped(fxMesa, fxMesa->currentFB, x + n - span, - bottom - y, GR_LFB_SRC_FMT_8888, span, 1, 0, - (void *) data); - } - else { - for (i = 0; i < n; i++) { - data[i] = (GLuint) gColor; - } +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p - writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom - y, - GR_LFB_SRC_FMT_8888, n, 1, 0, (void *) data); - } -} +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ + } while (0) +#define TAG(x) tdfx##x##_ARGB8888 +#include "../dri/common/spantmp.h" -#if 0 -static void -fxDDReadRGBASpan(const GLcontext * ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLushort data[MAX_WIDTH]; - GLuint i; - GLint bottom = fxMesa->height - 1; - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +/************************************************************************/ +/***** Depth functions *****/ +/************************************************************************/ - assert(n < MAX_WIDTH); +#define DBG 0 - FX_grLfbReadRegion(fxMesa->currentFB, x, bottom - y, n, 1, 0, data); +#undef HW_WRITE_LOCK +#undef HW_WRITE_UNLOCK +#undef HW_READ_LOCK +#undef HW_READ_UNLOCK - for (i = 0; i < n; i++) { - GLushort pixel = data[i]; - rgba[i][RCOMP] = FX_PixelToR[pixel]; - rgba[i][GCOMP] = FX_PixelToG[pixel]; - rgba[i][BCOMP] = FX_PixelToB[pixel]; - rgba[i][ACOMP] = 255; - } -} -#endif +#define HW_CLIPLOOP HW_WRITE_CLIPLOOP +#define LOCAL_DEPTH_VARS \ + GLuint pitch = info.strideInBytes; \ + GLuint height = fxMesa->height; \ + char *buf = (char *)((char *)info.lfbPtr + 0 /* x, y offset */); \ + (void) buf; -/* - * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects - * since OpenGL says obscured pixels have undefined values. - */ -static void -read_R5G6B5_span(const GLcontext * ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = 0; - const GLint winY = fxMesa->height - 1; - const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - const GLuint *data32 = (const GLuint *) data16; - GLuint i, j; - GLuint extraPixel = (n & 1); - n -= extraPixel; - for (i = j = 0; i < n; i += 2, j++) { - GLuint pixel = data32[j]; - GLuint pixel0 = pixel & 0xffff; - GLuint pixel1 = pixel >> 16; - rgba[i][RCOMP] = FX_PixelToR[pixel0]; - rgba[i][GCOMP] = FX_PixelToG[pixel0]; - rgba[i][BCOMP] = FX_PixelToB[pixel0]; - rgba[i][ACOMP] = 255; - rgba[i + 1][RCOMP] = FX_PixelToR[pixel1]; - rgba[i + 1][GCOMP] = FX_PixelToG[pixel1]; - rgba[i + 1][BCOMP] = FX_PixelToB[pixel1]; - rgba[i + 1][ACOMP] = 255; - } - if (extraPixel) { - GLushort pixel = data16[n]; - rgba[n][RCOMP] = FX_PixelToR[pixel]; - rgba[n][GCOMP] = FX_PixelToG[pixel]; - rgba[n][BCOMP] = FX_PixelToB[pixel]; - rgba[n][ACOMP] = 255; - } - - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(); -} +#define HW_WRITE_LOCK() \ + fxMesaContext fxMesa = FX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_WRITE_ONLY, \ + GR_BUFFER_AUXBUFFER, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) { -/* - * Read a span of 15-bit RGB pixels. Note, we don't worry about cliprects - * since OpenGL says obscured pixels have undefined values. - */ -static void read_R5G5B5_span (const GLcontext * ctx, - GLuint n, - GLint x, GLint y, - GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = 0; - const GLint winY = fxMesa->height - 1; - const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y) * srcStride + (winX + x); - const GLuint *data32 = (const GLuint *) data16; - GLuint i, j; - GLuint extraPixel = (n & 1); - n -= extraPixel; - for (i = j = 0; i < n; i += 2, j++) { - GLuint pixel = data32[j]; - rgba[i][RCOMP] = FX_rgb_scale_5[ pixel & 0x1f]; - rgba[i][GCOMP] = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; - rgba[i][BCOMP] = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; - rgba[i][ACOMP] = (pixel & 0x8000) ? 255 : 0; - rgba[i + 1][RCOMP] = FX_rgb_scale_5[(pixel >> 16) & 0x1f]; - rgba[i + 1][GCOMP] = FX_rgb_scale_5[(pixel >> 21) & 0x1f]; - rgba[i + 1][BCOMP] = FX_rgb_scale_5[(pixel >> 26) & 0x1f]; - rgba[i + 1][ACOMP] = (pixel & 0x80000000) ? 255 : 0; - } - if (extraPixel) { - GLushort pixel = data16[n]; - rgba[n][RCOMP] = FX_rgb_scale_5[ pixel & 0x1f]; - rgba[n][GCOMP] = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; - rgba[n][BCOMP] = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; - rgba[n][ACOMP] = (pixel & 0x8000) ? 255 : 0; - } - - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(); -} +#define HW_WRITE_UNLOCK() \ + grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_AUXBUFFER); \ + } -/* - * Read a span of 32-bit RGB pixels. Note, we don't worry about cliprects - * since OpenGL says obscured pixels have undefined values. - */ -static void read_R8G8B8_span (const GLcontext * ctx, - GLuint n, - GLint x, GLint y, - GLubyte rgba[][4]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - BEGIN_BOARD_LOCK(); - grLfbReadRegion(fxMesa->currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba); - END_BOARD_LOCK(); -} +#define HW_READ_LOCK() \ + fxMesaContext fxMesa = FX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_READ_ONLY, GR_BUFFER_AUXBUFFER, \ + LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) { +#define HW_READ_UNLOCK() \ + grLfbUnlock( GR_LFB_READ_ONLY, GR_BUFFER_AUXBUFFER); \ + } -/************************************************************************/ -/***** Pixel functions *****/ -/************************************************************************/ -static void -fxDDWriteRGBAPixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint i; - GLint bottom = fxMesa->height - 1; +/* 16 bit, depth spanline and pixel functions */ - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_ZA16 - for (i = 0; i < n; i++) - if (mask[i]) - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i], bottom - y[i], - 1, 1, (void *) rgba[i]); -} +#undef BYTESPERPIXEL +#define BYTESPERPIXEL 2 -static void -fxDDWriteMonoRGBAPixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLchan color[4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint i; - GLint bottom = fxMesa->height - 1; - GrColor_t gColor = FXCOLOR4(color); +#define WRITE_DEPTH( _x, _y, d ) \ + *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } +#define READ_DEPTH( d, _x, _y ) \ + d = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) - for (i = 0; i < n; i++) - if (mask[i]) - writeRegionClipped(fxMesa, fxMesa->currentFB, x[i], bottom - y[i], - GR_LFB_SRC_FMT_8888, 1, 1, 0, (void *) &gColor); -} +#define TAG(x) tdfx##x##_Z16 +#include "../dri/common/depthtmp.h" -static void -read_R5G6B5_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ - const GLint winX = 0; - const GLint winY = fxMesa->height - 1; - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y[i]) * srcStride + (winX + x[i]); - const GLushort pixel = *data16; - rgba[i][RCOMP] = FX_PixelToR[pixel]; - rgba[i][GCOMP] = FX_PixelToG[pixel]; - rgba[i][BCOMP] = FX_PixelToB[pixel]; - rgba[i][ACOMP] = 255; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(); -} +/* 24 bit, depth spanline and pixel functions (for use w/ stencil) */ +/* [dBorca] Hack alert: + * This is evil. The incoming Mesa's 24bit depth value + * is shifted left 8 bits, to obtain a full 32bit value, + * which will be thrown into the framebuffer. We rely on + * the fact that Voodoo hardware transforms a 32bit value + * into 24bit value automatically and, MOST IMPORTANT, won't + * alter the upper 8bits of the value already existing in the + * framebuffer (where stencil resides). + */ +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_Z32 -static void read_R5G5B5_pixels (const GLcontext * ctx, - GLuint n, - const GLint x[], const GLint y[], - GLubyte rgba[][4], - const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ - const GLint winX = 0; - const GLint winY = fxMesa->height - 1; - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - const GLushort *data16 = (const GLushort *) info.lfbPtr - + (winY - y[i]) * srcStride + (winX + x[i]); - const GLushort pixel = *data16; - rgba[i][RCOMP] = FX_rgb_scale_5[ pixel & 0x1f]; - rgba[i][GCOMP] = FX_rgb_scale_5[(pixel >> 5) & 0x1f]; - rgba[i][BCOMP] = FX_rgb_scale_5[(pixel >> 10) & 0x1f]; - rgba[i][ACOMP] = (pixel & 0x8000) ? 255 : 0; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(); -} +#undef BYTESPERPIXEL +#define BYTESPERPIXEL 4 +#define WRITE_DEPTH( _x, _y, d ) \ + *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d << 8 -static void -read_R8G8B8_pixels(const GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GrLfbInfo_t info; - BEGIN_BOARD_LOCK(); - if (grLfbLock(GR_LFB_READ_ONLY, - fxMesa->currentFB, - GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint srcStride = info.strideInBytes / 4; /* stride in GLuints */ - const GLint winX = 0; - const GLint winY = fxMesa->height - 1; - GLuint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - const GLuint *data32 = (const GLuint *) info.lfbPtr - + (winY - y[i]) * srcStride + (winX + x[i]); - const GLuint pixel = *data32; - *(GLuint *)&rgba[i][0] = pixel; - } - } - grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); - } - END_BOARD_LOCK(); -} +#define READ_DEPTH( d, _x, _y ) \ + d = (*(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch)) & 0xffffff + +#define TAG(x) tdfx##x##_Z24 +#include "../dri/common/depthtmp.h" +/* 32 bit, depth spanline and pixel functions (for use w/o stencil) */ +/* [dBorca] Hack alert: + * This is more evil. We make Mesa run in 32bit depth, but + * tha Voodoo HW can only handle 24bit depth. Well, exploiting + * the pixel pipeline, we can achieve 24:8 format for greater + * precision... + * If anyone tells me how to really store 32bit values into the + * depth buffer, I'll write the *_Z32 routines. Howver, bear in + * mind that means running without stencil! + */ /************************************************************************/ -/***** Depth functions *****/ +/***** Span functions (optimized) *****/ /************************************************************************/ -void -fxDDWriteDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, const GLdepth depth[], - const GLubyte mask[]) +/* + * Read a span of 15-bit RGB pixels. Note, we don't worry about cliprects + * since OpenGL says obscured pixels have undefined values. + */ +static void fxReadRGBASpan_ARGB1555 (const GLcontext * ctx, + GLuint n, + GLint x, GLint y, + GLubyte rgba[][4]) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height - 1; - - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } - - - if (mask) { - GLint i; - for (i = 0; i < n; i++) { - if (mask[i]) { - GLshort d = depth[i]; - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y, - GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); - } - } - } - else { - GLushort depth16[MAX_WIDTH]; - GLint i; - for (i = 0; i < n; i++) { - depth16[i] = depth[i]; - } - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y, - GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16); - } + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + info.size = sizeof(GrLfbInfo_t); + if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; + const GLushort *data16 = (const GLushort *)((const GLubyte *)info.lfbPtr + + (winY - y) * info.strideInBytes + + (winX + x) * 2); + const GLuint *data32 = (const GLuint *) data16; + GLuint i, j; + GLuint extraPixel = (n & 1); + n -= extraPixel; + + for (i = j = 0; i < n; i += 2, j++) { + GLuint pixel = data32[j]; + rgba[i][0] = FX_rgb_scale_5[(pixel >> 10) & 0x1F]; + rgba[i][1] = FX_rgb_scale_5[(pixel >> 5) & 0x1F]; + rgba[i][2] = FX_rgb_scale_5[ pixel & 0x1F]; + rgba[i][3] = (pixel & 0x8000) ? 255 : 0; + rgba[i+1][0] = FX_rgb_scale_5[(pixel >> 26) & 0x1F]; + rgba[i+1][1] = FX_rgb_scale_5[(pixel >> 21) & 0x1F]; + rgba[i+1][2] = FX_rgb_scale_5[(pixel >> 16) & 0x1F]; + rgba[i+1][3] = (pixel & 0x80000000) ? 255 : 0; + } + if (extraPixel) { + GLushort pixel = data16[n]; + rgba[n][0] = FX_rgb_scale_5[(pixel >> 10) & 0x1F]; + rgba[n][1] = FX_rgb_scale_5[(pixel >> 5) & 0x1F]; + rgba[n][2] = FX_rgb_scale_5[ pixel & 0x1F]; + rgba[n][3] = (pixel & 0x8000) ? 255 : 0; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } } - -void -fxDDWriteDepth32Span(GLcontext * ctx, - GLuint n, GLint x, GLint y, const GLdepth depth[], - const GLubyte mask[]) +/* + * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects + * since OpenGL says obscured pixels have undefined values. + */ +static void fxReadRGBASpan_RGB565 (const GLcontext * ctx, + GLuint n, + GLint x, GLint y, + GLubyte rgba[][4]) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height - 1; - GLint i; - - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } - + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + info.size = sizeof(GrLfbInfo_t); + if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; + const GLushort *data16 = (const GLushort *)((const GLubyte *)info.lfbPtr + + (winY - y) * info.strideInBytes + + (winX + x) * 2); + const GLuint *data32 = (const GLuint *) data16; + GLuint i, j; + GLuint extraPixel = (n & 1); + n -= extraPixel; + + for (i = j = 0; i < n; i += 2, j++) { + GLuint pixel = data32[j]; + rgba[i][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F]; + rgba[i][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F]; + rgba[i][2] = FX_rgb_scale_5[ pixel & 0x1F]; + rgba[i][3] = 255; + rgba[i+1][0] = FX_rgb_scale_5[(pixel >> 27) & 0x1F]; + rgba[i+1][1] = FX_rgb_scale_6[(pixel >> 21) & 0x3F]; + rgba[i+1][2] = FX_rgb_scale_5[(pixel >> 16) & 0x1F]; + rgba[i+1][3] = 255; + } + if (extraPixel) { + GLushort pixel = data16[n]; + rgba[n][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F]; + rgba[n][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F]; + rgba[n][2] = FX_rgb_scale_5[ pixel & 0x1F]; + rgba[n][3] = 255; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } +} - if (mask) { - for (i = 0; i < n; i++) { - if (mask[i]) { - GLuint d = depth[i] << 8; - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y, - GR_LFBWRITEMODE_Z32, 1, 1, 0, (void *) &d); - } - } - } - else { - GLuint depth32[MAX_WIDTH]; - for (i = 0; i < n; i++) { - depth32[i] = depth[i] << 8; - } - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y, - GR_LFBWRITEMODE_Z32, n, 1, 0, (void *) depth32); - } +/* + * Read a span of 32-bit RGB pixels. Note, we don't worry about cliprects + * since OpenGL says obscured pixels have undefined values. + */ +static void fxReadRGBASpan_ARGB8888 (const GLcontext * ctx, + GLuint n, + GLint x, GLint y, + GLubyte rgba[][4]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GLuint i; + grLfbReadRegion(fxMesa->currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba); + for (i = 0; i < n; i++) { + GLubyte c = rgba[i][0]; + rgba[i][0] = rgba[i][2]; + rgba[i][2] = c; + } } +/************************************************************************/ +/***** Depth functions (optimized) *****/ +/************************************************************************/ + void -fxDDReadDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, GLdepth depth[]) +fxReadDepthSpan_Z16(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLdepth depth[]) { fxMesaContext fxMesa = FX_CONTEXT(ctx); GLint bottom = fxMesa->height - 1; @@ -614,116 +472,81 @@ fxDDReadDepthSpan(GLcontext * ctx, void -fxDDReadDepth32Span(GLcontext * ctx, - GLuint n, GLint x, GLint y, GLdepth depth[]) +fxReadDepthSpan_Z24(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLdepth depth[]) { fxMesaContext fxMesa = FX_CONTEXT(ctx); GLint bottom = fxMesa->height - 1; + GLuint i; if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s(...)\n", __FUNCTION__); } grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth); + for (i = 0; i < n; i++) { + depth[i] &= 0xffffff; + } } +/************************************************************************/ +/***** Stencil functions (optimized) *****/ +/************************************************************************/ -void -fxDDWriteDepthPixels(GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth depth[], const GLubyte mask[]) +void fxWriteStencilSpan (GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLstencil stencil[], const GLubyte mask[]) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height - 1; - GLuint i; - - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } - - for (i = 0; i < n; i++) { - if (mask[i]) { - int xpos = x[i]; - int ypos = bottom - y[i]; - GLushort d = depth[i]; - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, - GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); - } - } + /* + * XXX todo + */ } - void -fxDDWriteDepth32Pixels(GLcontext * ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth depth[], const GLubyte mask[]) +fxReadStencilSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLstencil stencil[]) { fxMesaContext fxMesa = FX_CONTEXT(ctx); GLint bottom = fxMesa->height - 1; + GLuint zs32[MAX_WIDTH]; GLuint i; if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s(...)\n", __FUNCTION__); } + grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, zs32); for (i = 0; i < n; i++) { - if (mask[i]) { - int xpos = x[i]; - int ypos = bottom - y[i]; - GLuint d = depth[i] << 8; - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, - GR_LFBWRITEMODE_Z32, 1, 1, 0, (void *) &d); - } + stencil[i] = zs32[i] >> 24; } } - -void -fxDDReadDepthPixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], GLdepth depth[]) +void fxWriteStencilPixels (GLcontext *ctx, GLuint n, + const GLint x[], const GLint y[], + const GLstencil stencil[], + const GLubyte mask[]) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height - 1; - GLuint i; - - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } - - for (i = 0; i < n; i++) { - int xpos = x[i]; - int ypos = bottom - y[i]; - GLushort d; - grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d); - depth[i] = d; - } + /* + * XXX todo + */ } - -void -fxDDReadDepth32Pixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], GLdepth depth[]) +void fxReadStencilPixels (GLcontext *ctx, GLuint n, + const GLint x[], const GLint y[], + GLstencil stencil[]) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLint bottom = fxMesa->height - 1; - GLuint i; - - if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(...)\n", __FUNCTION__); - } - - for (i = 0; i < n; i++) { - int xpos = x[i]; - int ypos = bottom - y[i]; - grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &depth[i]); - } + /* + * XXX todo + */ } -/* Set the buffer used for reading */ -/* XXX support for separate read/draw buffers hasn't been tested */ +/* + * This function is called to specify which buffer to read and write + * for software rasterization (swrast) fallbacks. This doesn't necessarily + * correspond to glDrawBuffer() or glReadBuffer() calls. + */ static void fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit) { @@ -753,45 +576,73 @@ void fxSetupDDSpanPointers(GLcontext * ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); + fxMesaContext fxMesa = FX_CONTEXT(ctx); swdd->SetBuffer = fxDDSetBuffer; - swdd->WriteRGBASpan = fxDDWriteRGBASpan; - swdd->WriteRGBSpan = fxDDWriteRGBSpan; - swdd->WriteMonoRGBASpan = fxDDWriteMonoRGBASpan; - swdd->WriteRGBAPixels = fxDDWriteRGBAPixels; - swdd->WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels; - - /* swdd->ReadRGBASpan =fxDDReadRGBASpan; */ - { - fxMesaContext fxMesa = FX_CONTEXT(ctx); switch (fxMesa->colDepth) { case 15: - swdd->ReadRGBASpan = read_R5G5B5_span; - swdd->ReadRGBAPixels = read_R5G5B5_pixels; - swdd->WriteDepthSpan = fxDDWriteDepthSpan; - swdd->WriteDepthPixels = fxDDWriteDepthPixels; - swdd->ReadDepthSpan = fxDDReadDepthSpan; - swdd->ReadDepthPixels = fxDDReadDepthPixels; + swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB1555; + swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB1555; + swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB1555; + swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB1555; + swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB1555; + swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_ARGB1555; + swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB1555; + + swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z16; + swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z16; + swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z16; + swdd->ReadDepthPixels = tdfxReadDepthPixels_Z16; break; case 16: - swdd->ReadRGBASpan = read_R5G6B5_span; - swdd->ReadRGBAPixels = read_R5G6B5_pixels; - swdd->WriteDepthSpan = fxDDWriteDepthSpan; - swdd->WriteDepthPixels = fxDDWriteDepthPixels; - swdd->ReadDepthSpan = fxDDReadDepthSpan; - swdd->ReadDepthPixels = fxDDReadDepthPixels; + swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB565; + swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB565; + swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565; + swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565; + swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565; + swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_RGB565; + swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB565; + + swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z16; + swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z16; + swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z16; + swdd->ReadDepthPixels = tdfxReadDepthPixels_Z16; break; case 32: - swdd->ReadRGBASpan = read_R8G8B8_span; - swdd->ReadRGBAPixels = read_R8G8B8_pixels; - swdd->WriteDepthSpan = fxDDWriteDepth32Span; - swdd->WriteDepthPixels = fxDDWriteDepth32Pixels; - swdd->ReadDepthSpan = fxDDReadDepth32Span; - swdd->ReadDepthPixels = fxDDReadDepth32Pixels; + swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888; + swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888; + swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888; + swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888; + swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888; + swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_ARGB8888; + swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888; + + swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z24; + swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z24; + swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z24; + swdd->ReadDepthPixels = tdfxReadDepthPixels_Z24; break; } - } + + if (fxMesa->haveHwStencil) { + swdd->WriteStencilSpan = fxWriteStencilSpan; + swdd->ReadStencilSpan = fxReadStencilSpan; + swdd->WriteStencilPixels = fxWriteStencilPixels; + swdd->ReadStencilPixels = fxReadStencilPixels; + } +#if 0 + swdd->WriteCI8Span = NULL; + swdd->WriteCI32Span = NULL; + swdd->WriteMonoCISpan = NULL; + swdd->WriteCI32Pixels = NULL; + swdd->WriteMonoCIPixels = NULL; + swdd->ReadCI32Span = NULL; + swdd->ReadCI32Pixels = NULL; + + swdd->SpanRenderStart = tdfxSpanRenderStart; /* BEGIN_BOARD_LOCK */ + swdd->SpanRenderFinish = tdfxSpanRenderFinish; /* END_BOARD_LOCK */ +#endif } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 38a268922ae..da1e73d029c 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1,5 +1,3 @@ -/* $Id: fxddtex.c,v 1.48 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -41,6 +39,7 @@ #if defined(FX) #include "fxdrv.h" +#include "enums.h" #include "image.h" #include "teximage.h" #include "texformat.h" @@ -192,8 +191,10 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, tfxTexInfo *ti; if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s(%d, %x, %x, %x)\n", __FUNCTION__, - tObj->Name, (GLuint) tObj->DriverData, pname, param); + fprintf(stderr, "fxDDTexParam(%d, %x, %s, %s)\n", + tObj->Name, (GLuint) tObj->DriverData, + _mesa_lookup_enum_by_nr(pname), + _mesa_lookup_enum_by_nr(param)); } if (target != GL_TEXTURE_2D) @@ -279,6 +280,7 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, case GL_MIRRORED_REPEAT: ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT; break; + case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ case GL_CLAMP: ti->sClamp = GR_TEXTURECLAMP_CLAMP; break; @@ -296,6 +298,7 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, case GL_MIRRORED_REPEAT: ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT; break; + case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ case GL_CLAMP: ti->tClamp = GR_TEXTURECLAMP_CLAMP; break; @@ -349,13 +352,23 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj) tObj->DriverData = NULL; } +/* + * Return true if texture is resident, false otherwise. + */ +GLboolean +fxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) +{ + tfxTexInfo *ti = fxTMGetTexInfo(tObj); + return (ti && ti->isInTM); +} + /* * Convert a gl_color_table texture palette to Glide's format. */ -static void -convertPalette(FxU32 data[256], const struct gl_color_table *table) +static GrTexTable_t +convertPalette(const fxMesaContext fxMesa, FxU32 data[256], const struct gl_color_table *table) { const GLubyte *tableUB = (const GLubyte *) table->Table; GLint width = table->Size; @@ -373,7 +386,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) a = tableUB[i]; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE; case GL_LUMINANCE: for (i = 0; i < width; i++) { r = tableUB[i]; @@ -382,21 +395,22 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) a = 255; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return GR_TEXTABLE_PALETTE; case GL_ALPHA: for (i = 0; i < width; i++) { r = g = b = 255; a = tableUB[i]; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE; case GL_LUMINANCE_ALPHA: for (i = 0; i < width; i++) { r = g = b = tableUB[i * 2 + 0]; a = tableUB[i * 2 + 1]; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE; + default: case GL_RGB: for (i = 0; i < width; i++) { r = tableUB[i * 3 + 0]; @@ -405,7 +419,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) a = 255; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return GR_TEXTABLE_PALETTE; case GL_RGBA: for (i = 0; i < width; i++) { r = tableUB[i * 4 + 0]; @@ -414,7 +428,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) a = tableUB[i * 4 + 3]; data[i] = (a << 24) | (r << 16) | (g << 8) | b; } - break; + return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE; } } @@ -434,7 +448,7 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj) if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); ti = fxTMGetTexInfo(tObj); - convertPalette(ti->palette.data, &tObj->Palette); + ti->paltype = convertPalette(fxMesa, ti->palette.data, &tObj->Palette); fxTexInvalidate(ctx, tObj); } else { @@ -442,7 +456,7 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj) if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s(global)\n", __FUNCTION__); } - convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); + fxMesa->glbPalType = convertPalette(fxMesa, fxMesa->glbPalette.data, &ctx->Texture.Palette); fxMesa->new_state |= FX_NEW_TEXTURING; } } @@ -460,7 +474,7 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state) if (state) { fxMesa->haveGlobalPaletteTexture = 1; - grTexDownloadTable(GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette)); + grTexDownloadTable(fxMesa->glbPalType, &(fxMesa->glbPalette)); } else { fxMesa->haveGlobalPaletteTexture = 0; @@ -501,27 +515,20 @@ logbase2(int n) } +/* fxTexGetInfo + * w, h - source texture width and height + * lodlevel - Glide lod level token for the larger texture dimension + * ar - Glide aspect ratio token + * sscale - S scale factor used during triangle setup + * tscale - T scale factor used during triangle setup + * wscale - OpenGL -> Glide image width scale factor + * hscale - OpenGL -> Glide image height scale factor + */ int fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar, float *sscale, float *tscale, int *wscale, int *hscale) { - /* [koolsmoky] */ - static GrLOD_t lod[12] = { - GR_LOD_LOG2_1, - GR_LOD_LOG2_2, - GR_LOD_LOG2_4, - GR_LOD_LOG2_8, - GR_LOD_LOG2_16, - GR_LOD_LOG2_32, - GR_LOD_LOG2_64, - GR_LOD_LOG2_128, - GR_LOD_LOG2_256, - GR_LOD_LOG2_512, - GR_LOD_LOG2_1024, - GR_LOD_LOG2_2048 - }; - int logw, logh, ws, hs; GrLOD_t l; GrAspectRatio_t aspectratio; @@ -530,76 +537,56 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar, logw = logbase2(w); logh = logbase2(h); - switch (logw - logh) { + l = MAX2(logw, logh); + aspectratio = logw - logh; + ws = hs = 1; + + /* hardware only allows a maximum aspect ratio of 8x1, so handle + * |aspectratio| > 3 by scaling the image and using an 8x1 aspect + * ratio + */ + switch (aspectratio) { case 0: - aspectratio = GR_ASPECT_LOG2_1x1; - l = lod[logw]; - s = t = 256.0f; - ws = hs = 1; + s = 256.0f; + t = 256.0f; break; case 1: - aspectratio = GR_ASPECT_LOG2_2x1; - l = lod[logw]; s = 256.0f; t = 128.0f; - ws = 1; - hs = 1; break; case 2: - aspectratio = GR_ASPECT_LOG2_4x1; - l = lod[logw]; s = 256.0f; t = 64.0f; - ws = 1; - hs = 1; break; case 3: - aspectratio = GR_ASPECT_LOG2_8x1; - l = lod[logw]; s = 256.0f; t = 32.0f; - ws = 1; - hs = 1; break; case -1: - aspectratio = GR_ASPECT_LOG2_1x2; - l = lod[logh]; s = 128.0f; t = 256.0f; - ws = 1; - hs = 1; break; case -2: - aspectratio = GR_ASPECT_LOG2_1x4; - l = lod[logh]; s = 64.0f; t = 256.0f; - ws = 1; - hs = 1; break; case -3: - aspectratio = GR_ASPECT_LOG2_1x8; - l = lod[logh]; s = 32.0f; t = 256.0f; - ws = 1; - hs = 1; break; default: - if ((logw - logh) > 3) { - aspectratio = GR_ASPECT_LOG2_8x1; - l = lod[logw]; + if (aspectratio > 3) { s = 256.0f; t = 32.0f; ws = 1; - hs = 1 << (logw - logh - 3); - } else /*if ((logw - logh) < -3)*/ { - aspectratio = GR_ASPECT_LOG2_1x8; - l = lod[logh]; + hs = 1 << (aspectratio - 3); + aspectratio = GR_ASPECT_LOG2_8x1; + } else /*if (aspectratio < -3)*/ { s = 32.0f; t = 256.0f; - ws = 1 << (logh - logw - 3); + ws = 1 << (-aspectratio - 3); hs = 1; + aspectratio = GR_ASPECT_LOG2_1x8; } } @@ -625,125 +612,6 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar, return 1; } -/* - * Given an OpenGL internal texture format, return the corresponding - * Glide internal texture format and base texture format. - */ -void -fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint * ifmt) /* [koolsmoky] */ -{ - fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLboolean allow32bpt = fxMesa->HaveTexFmt; - - switch (glformat) { - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - if (tfmt) - (*tfmt) = GR_TEXFMT_INTENSITY_8; - if (ifmt) - (*ifmt) = GL_LUMINANCE; - break; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - if (tfmt) - (*tfmt) = GR_TEXFMT_ALPHA_INTENSITY_88; - if (ifmt) - (*ifmt) = GL_LUMINANCE_ALPHA; - break; - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - if (tfmt) - (*tfmt) = GR_TEXFMT_ALPHA_8; - if (ifmt) - (*ifmt) = GL_INTENSITY; - break; - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - if (tfmt) - (*tfmt) = GR_TEXFMT_ALPHA_8; - if (ifmt) - (*ifmt) = GL_ALPHA; - break; - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - if (tfmt) - (*tfmt) = GR_TEXFMT_RGB_565; - if (ifmt) - (*ifmt) = GL_RGB; - break; - case 3: - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - if (tfmt) - (*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_RGB_565; - if (ifmt) - (*ifmt) = GL_RGB; - break; - case GL_RGBA2: - case GL_RGBA4: - if (tfmt) - (*tfmt) = GR_TEXFMT_ARGB_4444; - if (ifmt) - (*ifmt) = GL_RGBA; - break; - case 4: - case GL_RGBA: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - if (tfmt) - (*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_ARGB_4444; - if (ifmt) - (*ifmt) = GL_RGBA; - break; - case GL_RGB5_A1: - if (tfmt) - (*tfmt) = GR_TEXFMT_ARGB_1555; - if (ifmt) - (*ifmt) = GL_RGBA; - break; - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - if (tfmt) - (*tfmt) = GR_TEXFMT_P_8; - if (ifmt) - (*ifmt) = GL_RGBA; /* XXX why is this RGBA? */ - break; - default: - fprintf(stderr, "%s: ERROR: unsupported internalFormat (0x%x)\n", - __FUNCTION__, glformat); - fxCloseHardware(); - exit(-1); - break; - } -} - static GLboolean fxIsTexSupported(GLenum target, GLint internalFormat, const struct gl_texture_image *image) @@ -820,8 +688,6 @@ fetch_alpha8(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; - i = i * mml->width / texImage->Width; - j = j * mml->height / texImage->Height; texel = ((GLubyte *) texImage->Data) + j * mml->width + i; rgba[RCOMP] = 255; @@ -841,8 +707,6 @@ fetch_index8(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; - i = i * mml->width / texImage->Width; - j = j * mml->height / texImage->Height; texel = ((GLubyte *) texImage->Data) + j * mml->width + i; *indexOut = *texel; @@ -961,6 +825,133 @@ PrintTexture(int w, int h, int c, const GLubyte * data) } +GLboolean fxDDIsCompressedFormat ( GLcontext *ctx, GLenum internalFormat ) +{ + if ((internalFormat == GL_COMPRESSED_RGB_FXT1_3DFX) || + (internalFormat == GL_COMPRESSED_RGBA_FXT1_3DFX) || + (internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT) || + (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) || + (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) || + (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) || + (internalFormat == GL_RGB_S3TC) || + (internalFormat == GL_RGB4_S3TC) || + (internalFormat == GL_RGBA_S3TC) || + (internalFormat == GL_RGBA4_S3TC)) { + return GL_TRUE; + } + +/* [dBorca] + * we are handling differently the above formats from the generic + * GL_COMPRESSED_RGB[A]. For this, we will always have to separately + * check for the ones below! + */ + +#if FX_TC_NCC || FX_TC_NAPALM + if ((internalFormat == GL_COMPRESSED_RGB) || (internalFormat == GL_COMPRESSED_RGBA)) { + return GL_TRUE; + } +#endif + + return GL_FALSE; +} + + +GLuint fxDDCompressedTextureSize (GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format) +{ + GLuint size; + int wScale, hScale; + + ASSERT(depth == 1); + + /* Determine width and height scale factors for texture. + * Remember, Glide is limited to 8:1 aspect ratios. + */ + fxTexGetInfo(width, height, + NULL, /* lod level */ + NULL, /* aspect ratio */ + NULL, NULL, /* sscale, tscale */ + &wScale, &hScale); + + width *= wScale; + height *= hScale; + + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + /* round up width to next multiple of 8, height to next multiple of 4 */ + width = (width + 7) & ~7; + height = (height + 3) & ~3; + /* 16 bytes per 8x4 tile of RGB[A] texels */ + size = width * height / 2; + /* Textures smaller than 8x4 will effectively be made into 8x4 and + * take 16 bytes. + */ + if (size < 16) + size = 16; + return size; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + /* round up width, height to next multiple of 4 */ + width = (width + 3) & ~3; + height = (height + 3) & ~3; + /* 8 bytes per 4x4 tile of RGB[A] texels */ + size = width * height / 2; + /* Textures smaller than 4x4 will effectively be made into 4x4 and + * take 8 bytes. + */ + if (size < 8) + size = 8; + return size; + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + /* round up width, height to next multiple of 4 */ + width = (width + 3) & ~3; + height = (height + 3) & ~3; + /* 16 bytes per 4x4 tile of RGBA texels */ + size = width * height; /* simple! */ + /* Textures smaller than 4x4 will effectively be made into 4x4 and + * take 16 bytes. + */ + if (size < 16) + size = 16; + return size; + case GL_COMPRESSED_RGB: +#if FX_TC_NAPALM + { + fxMesaContext fxMesa = FX_CONTEXT(ctx); + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + return fxDDCompressedTextureSize(ctx, width, height, 1, GL_COMPRESSED_RGB_FXT1_3DFX); + } + } +#endif +#if FX_TC_NCC + return (width * height * 8 >> 3) + 12 * 4; +#endif + case GL_COMPRESSED_RGBA: +#if FX_TC_NAPALM + { + fxMesaContext fxMesa = FX_CONTEXT(ctx); + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + return fxDDCompressedTextureSize(ctx, width, height, 1, GL_COMPRESSED_RGBA_FXT1_3DFX); + } + } +#endif +#if FX_TC_NCC + return (width * height * 16 >> 3) + 12 * 4; +#endif + default: + _mesa_problem(ctx, "bad texformat in fxDDCompressedTextureSize"); + return 0; + } +} + + const struct gl_texture_format * fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) @@ -968,6 +959,21 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, fxMesaContext fxMesa = FX_CONTEXT(ctx); GLboolean allow32bpt = fxMesa->HaveTexFmt; + /* [dBorca] Hack alert: + * There is something wrong with this!!! Take an example: + * 1) start HW rendering + * 2) create a texture like this: + * glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0, + * GL_RGB, GL_UNSIGNED_BYTE, floorTexture); + * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + * 3) we get here with internalFormat==3 and return either + * _mesa_texformat_rgb565 or _mesa_texformat_argb8888 + * 4) at some point, we encounter total rasterization fallback + * 5) displaying a polygon with the above textures yield garbage on areas + * where pixel is larger than a texel, because our already set texel + * function doesn't match the real _mesa_texformat_argb888 + */ + if (TDFX_DEBUG & VERBOSE_TEXTURE) { fprintf(stderr, "fxDDChooseTextureFormat(...)\n"); } @@ -1056,20 +1062,24 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, : &_mesa_texformat_argb4444; case GL_RGB5_A1: return &_mesa_texformat_argb1555; -#if 0 /* GL_EXT_texture_compression_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: return &_mesa_texformat_rgb_dxt1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return &_mesa_texformat_rgba_dxt1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: return &_mesa_texformat_rgba_dxt3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return &_mesa_texformat_rgba_dxt5; - /*case GL_COMPRESSED_RGB_FXT1_3DFX: - case GL_COMPRESSED_RGBA_FXT1_3DFX: - return blah;*/ -#endif + /* GL_3DFX_texture_compression_FXT1 */ + case GL_COMPRESSED_RGB_FXT1_3DFX: + return &_mesa_texformat_rgb_fxt1; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return &_mesa_texformat_rgba_fxt1; default: _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); return NULL; @@ -1097,11 +1107,11 @@ fxGlideFormat(GLint mesaFormat) return GR_TEXFMT_ARGB_4444; case MESA_FORMAT_ARGB1555: return GR_TEXFMT_ARGB_1555; -#if 1 /* [koolsmoky] getting ready for 32bpp textures */ case MESA_FORMAT_ARGB8888: return GR_TEXFMT_ARGB_8888; -#endif -#if 0 + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: + return GR_TEXFMT_ARGB_CMP_FXT1; case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: return GR_TEXFMT_ARGB_CMP_DXT1; @@ -1109,11 +1119,6 @@ fxGlideFormat(GLint mesaFormat) return GR_TEXFMT_ARGB_CMP_DXT3; case MESA_FORMAT_RGBA_DXT5: return GR_TEXFMT_ARGB_CMP_DXT5; - /*case MESA_FORMAT_ARGB_CMP_FXT1: - return GR_TEXFMT_ARGB_CMP_FXT1; - case MESA_FORMAT_RGB_CMP_FXT1: - return GL_COMPRESSED_RGBA_FXT1_3DFX;*/ -#endif default: _mesa_problem(NULL, "Unexpected format in fxGlideFormat"); return 0; @@ -1126,32 +1131,30 @@ fxFetchFunction(GLint mesaFormat) { switch (mesaFormat) { case MESA_FORMAT_I8: - return fetch_intensity8; + return &fetch_intensity8; case MESA_FORMAT_A8: - return fetch_alpha8; + return &fetch_alpha8; case MESA_FORMAT_L8: - return fetch_luminance8; + return &fetch_luminance8; case MESA_FORMAT_CI8: - return fetch_index8; + return &fetch_index8; case MESA_FORMAT_AL88: - return fetch_luminance8_alpha8; + return &fetch_luminance8_alpha8; case MESA_FORMAT_RGB565: - return fetch_r5g6b5; + return &fetch_r5g6b5; case MESA_FORMAT_ARGB4444: - return fetch_r4g4b4a4; + return &fetch_r4g4b4a4; case MESA_FORMAT_ARGB1555: - return fetch_r5g5b5a1; -#if 1 /* [koolsmoky] getting ready for 32bpp textures */ + return &fetch_r5g5b5a1; case MESA_FORMAT_ARGB8888: - return fetch_a8r8g8b8; -#endif -#if 0 + return &fetch_a8r8g8b8; + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: - return fetch_r4g4b4a4; -#endif + return &fetch_r4g4b4a4; default: _mesa_problem(NULL, "Unexpected format in fxFetchFunction"); return NULL; @@ -1171,6 +1174,9 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, tfxMipMapLevel *mml; GLint texelBytes; + GLvoid *_final_texImage_Data; + const struct gl_texture_format *_final_texImage_TexFormat; + if (TDFX_DEBUG & VERBOSE_TEXTURE) { fprintf(stderr, "fxDDTexImage2D: id=%d int 0x%x format 0x%x type 0x%x %dx%d\n", texObj->Name, texImage->IntFormat, format, type, @@ -1215,6 +1221,51 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, texelBytes = texImage->TexFormat->TexelBytes; /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/ + mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat); + /* dirty trick: will thrash CopyTex[Sub]Image */ +#if FX_TC_NCC || FX_TC_NAPALM + if (internalFormat == GL_COMPRESSED_RGB) { +#if FX_TC_NCC + mml->glideFormat = GR_TEXFMT_YIQ_422; +#endif +#if FX_TC_NAPALM + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + mml->glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + } +#endif + } else if (internalFormat == GL_COMPRESSED_RGBA) { +#if FX_TC_NCC + mml->glideFormat = GR_TEXFMT_AYIQ_8422; +#endif +#if FX_TC_NAPALM + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + mml->glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + } +#endif + } +#endif + + /* allocate mipmap buffer */ + assert(!texImage->Data); + if (texImage->IsCompressed) { + texImage->Data = MESA_PBUFFER_ALLOC(texImage->CompressedSize); + texelBytes = 4; + _final_texImage_TexFormat = &_mesa_texformat_argb8888; + _final_texImage_Data = MALLOC(mml->width * mml->height * 4); + if (!_final_texImage_Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + } else { + texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes); + _final_texImage_TexFormat = texImage->TexFormat; + _final_texImage_Data = texImage->Data; + } + if (!texImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + if (mml->wScale != 1 || mml->hScale != 1) { /* rescale image to overcome 1:8 aspect limitation */ GLvoid *tempImage; @@ -1225,51 +1276,57 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, } /* unpack image, apply transfer ops and store in tempImage */ _mesa_transfer_teximage(ctx, 2, texImage->Format, - texImage->TexFormat, + _final_texImage_TexFormat, tempImage, width, height, 1, 0, 0, 0, width * texelBytes, 0, /* dstImageStride */ format, type, pixels, packing); - assert(!texImage->Data); - texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes); - if (!texImage->Data) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - FREE(tempImage); - return; - } _mesa_rescale_teximage2d(texelBytes, mml->width * texelBytes, /* dst stride */ width, height, mml->width, mml->height, - tempImage /*src*/, texImage->Data /*dst*/ ); + tempImage /*src*/, _final_texImage_Data /*dst*/ ); FREE(tempImage); } else { /* no rescaling needed */ - assert(!texImage->Data); - texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes); - if (!texImage->Data) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - return; - } /* unpack image, apply transfer ops and store in texImage->Data */ _mesa_transfer_teximage(ctx, 2, texImage->Format, - texImage->TexFormat, texImage->Data, + _final_texImage_TexFormat, _final_texImage_Data, width, height, 1, 0, 0, 0, texImage->Width * texelBytes, 0, /* dstImageStride */ format, type, pixels, packing); } - mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat); + /* now compress */ + if (texImage->IsCompressed) { +#if FX_TC_NCC + if ((mml->glideFormat == GR_TEXFMT_AYIQ_8422) || + (mml->glideFormat == GR_TEXFMT_YIQ_422)) { + TxMip txMip, pxMip; + txMip.width = mml->width; + txMip.height = mml->height; + txMip.depth = 1; + txMip.data[0] = _final_texImage_Data; + pxMip.data[0] = texImage->Data; + fxMesa->Glide.txMipQuantize(&pxMip, &txMip, mml->glideFormat, TX_DITHER_ERR, TX_COMPRESSION_STATISTICAL); + fxMesa->Glide.txPalToNcc((GuNccTable *)(&(ti->palette)), pxMip.pal); + MEMCPY((char *)texImage->Data + texImage->CompressedSize - 12 * 4, &(ti->palette.data[16]), 12 * 4); + } else +#endif + fxMesa->Glide.txImgQuantize(texImage->Data, _final_texImage_Data, mml->width, mml->height, mml->glideFormat, TX_DITHER_NONE); + FREE(_final_texImage_Data); + } + ti->info.format = mml->glideFormat; texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat); /* [dBorca] * Hack alert: unsure... */ - if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM) { + if (0 && ti->validated && ti->isInTM) { /*fprintf(stderr, "reloadmipmaplevels\n"); */ fxTMReloadMipMapLevel(fxMesa, texObj, level); } @@ -1294,6 +1351,10 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, tfxMipMapLevel *mml; GLint texelBytes; + /* [dBorca] Hack alert: + * fix the goddamn texture compression here + */ + if (TDFX_DEBUG & VERBOSE_TEXTURE) { fprintf(stderr, "fxDDTexSubImage2D: id=%d\n", texObj->Name); } @@ -1363,7 +1424,180 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, /* [dBorca] * Hack alert: unsure... */ - if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM) + if (0 && ti->validated && ti->isInTM) + fxTMReloadMipMapLevel(fxMesa, texObj, level); + else + fxTexInvalidate(ctx, texObj); +} + + +void +fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxTexInfo *ti; + tfxMipMapLevel *mml; + + if (TDFX_DEBUG & VERBOSE_TEXTURE) { + fprintf(stderr, "fxDDCompressedTexImage2D: id=%d int 0x%x %dx%d\n", + texObj->Name, internalFormat, + width, height); + } + + assert(texImage->IsCompressed); + + if (!fxIsTexSupported(target, internalFormat, texImage)) { + _mesa_problem(NULL, "fx Driver: unsupported texture in fxDDCompressedTexImg()\n"); + return; + } + + if (!texObj->DriverData) { + texObj->DriverData = fxAllocTexObjData(fxMesa); + if (!texObj->DriverData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); + return; + } + } + ti = fxTMGetTexInfo(texObj); + + if (!texImage->DriverData) { + texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel)); + if (!texImage->DriverData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + } + mml = FX_MIPMAP_DATA(texImage); + + fxTexGetInfo(width, height, NULL, NULL, NULL, NULL, + &mml->wScale, &mml->hScale); + + mml->width = width * mml->wScale; + mml->height = height * mml->hScale; + + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, -1/*format*/, -1/*type*/); + assert(texImage->TexFormat); + + /* Determine the appropriate Glide texel format, + * given the user's internal texture format hint. + */ + mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat); +#if FX_TC_NCC || FX_TC_NAPALM + if (internalFormat == GL_COMPRESSED_RGB) { +#if FX_TC_NCC + mml->glideFormat = GR_TEXFMT_YIQ_422; +#endif +#if FX_TC_NAPALM + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + mml->glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + } +#endif + } else if (internalFormat == GL_COMPRESSED_RGBA) { +#if FX_TC_NCC + mml->glideFormat = GR_TEXFMT_AYIQ_8422; +#endif +#if FX_TC_NAPALM + if (fxMesa->type >= GR_SSTTYPE_Voodoo4) { + mml->glideFormat = GR_TEXFMT_ARGB_CMP_FXT1; + } +#endif + } +#endif + + /* allocate new storage for texture image, if needed */ + if (!texImage->Data) { + texImage->Data = MESA_PBUFFER_ALLOC(imageSize); + if (!texImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + } + + /* save the texture data */ + MEMCPY(texImage->Data, data, imageSize); +#if FX_TC_NCC + if ((mml->glideFormat == GR_TEXFMT_AYIQ_8422) || + (mml->glideFormat == GR_TEXFMT_YIQ_422)) { + MEMCPY(&(ti->palette.data[16]), (char *)data + imageSize - 12 * 4, 12 * 4); + } +#endif + + ti->info.format = mml->glideFormat; + texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat); + + /* [dBorca] Hack alert: + * what about different size/texel? other anomalies? SW rescaling? + */ + + /* [dBorca] + * Hack alert: unsure... + */ + if (0 && ti->validated && ti->isInTM) { + /*fprintf(stderr, "reloadmipmaplevels\n"); */ + fxTMReloadMipMapLevel(fxMesa, texObj, level); + } + else { + /*fprintf(stderr, "invalidate2\n"); */ + fxTexInvalidate(ctx, texObj); + } +} + + +void +fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxTexInfo *ti; + tfxMipMapLevel *mml; + + if (TDFX_DEBUG & VERBOSE_TEXTURE) { + fprintf(stderr, "fxDDCompressedTexSubImage2D: id=%d\n", texObj->Name); + } + + ti = fxTMGetTexInfo(texObj); + assert(ti); + mml = FX_MIPMAP_DATA(texImage); + assert(mml); + + /* + * We punt if we are not replacing the entire image. This + * is allowed by the spec. + * + * [dBorca] Hack alert: + * ohwell, we should NOT! Look into _mesa_store_compressed_texsubimage2d + * on how to calculate the sub-image. + */ + if ((xoffset != 0) && (yoffset != 0) + && (width != texImage->Width) + && (height != texImage->Height)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(CHICKEN)"); + return; + } + + /* [dBorca] Hack alert: + * what about different size/texel? other anomalies? SW rescaling? + */ + MEMCPY(texImage->Data, data, imageSize); + + /* [dBorca] + * Hack alert: unsure... + */ + if (0 && ti->validated && ti->isInTM) fxTMReloadMipMapLevel(fxMesa, texObj, level); else fxTexInvalidate(ctx, texObj); diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index b404d52fa62..c109f22f1e8 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -1,5 +1,3 @@ -/* $Id: fxdrv.h,v 1.59 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -86,6 +84,14 @@ ( (unsigned int)(c[0])) ) #endif +#define TDFXPACKCOLOR1555( r, g, b, a ) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) +#define TDFXPACKCOLOR565( r, g, b ) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) +#define TDFXPACKCOLOR8888( r, g, b, a ) \ + (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + /* fastpath flags first @@ -147,6 +153,90 @@ #define FX_UM_ALPHA_CONSTANT 0x08000000 +/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */ +struct tdfx_combine { + GrCombineFunction_t Function; /* Combine function */ + GrCombineFactor_t Factor; /* Combine scale factor */ + GrCombineLocal_t Local; /* Local combine source */ + GrCombineOther_t Other; /* Other combine source */ + FxBool Invert; /* Combine result inversion flag */ +}; + +/* for Voodoo3's grTexCombine() */ +struct tdfx_texcombine { + GrCombineFunction_t FunctionRGB; + GrCombineFactor_t FactorRGB; + GrCombineFunction_t FunctionAlpha; + GrCombineFactor_t FactorAlpha; + FxBool InvertRGB; + FxBool InvertAlpha; +}; + + +/* for Voodoo5's grColorCombineExt() */ +struct tdfx_combine_color_ext { + GrCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrCCUColor_t SourceC; + FxBool InvertC; + GrCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grAlphaCombineExt() */ +struct tdfx_combine_alpha_ext { + GrACUColor_t SourceA; + GrCombineMode_t ModeA; + GrACUColor_t SourceB; + GrCombineMode_t ModeB; + GrACUColor_t SourceC; + FxBool InvertC; + GrACUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexColorCombineExt() */ +struct tdfx_color_texenv { + GrTCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrTCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrTCCUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexAlphaCombineExt() */ +struct tdfx_alpha_texenv { + GrTACUColor_t SourceA; + GrCombineMode_t ModeA; + GrTACUColor_t SourceB; + GrCombineMode_t ModeB; + GrTACUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* Voodoo5's texture combine environment */ +struct tdfx_texcombine_ext { + struct tdfx_alpha_texenv Alpha; + struct tdfx_color_texenv Color; + GrColor_t EnvColor; +}; + + /* Memory range from startAddr to endAddr-1 */ @@ -196,6 +286,7 @@ typedef struct tfxTexInfo_t GLfloat sScale, tScale; + GrTexTable_t paltype; GuTexPalette palette; GLboolean fixedPalette; @@ -229,6 +320,7 @@ typedef struct GrAlphaBlendFnc_t blendDstFuncRGB; GrAlphaBlendFnc_t blendSrcFuncAlpha; GrAlphaBlendFnc_t blendDstFuncAlpha; + GrAlphaBlendOp_t blendEq; /* Depth test */ @@ -317,13 +409,6 @@ tfxUnitsState; _NEW_COLOR) \ -/* These lookup table are used to extract RGB values in [0,255] from - * 16-bit pixel values. - */ -extern GLubyte FX_PixelToR[0x10000]; -extern GLubyte FX_PixelToG[0x10000]; -extern GLubyte FX_PixelToB[0x10000]; - /* lookup table for scaling y bit colors up to 8 bits */ extern GLuint FX_rgb_scale_4[16]; extern GLuint FX_rgb_scale_5[32]; @@ -335,6 +420,7 @@ typedef void (*fx_point_func) (fxMesaContext, GrVertex *); struct tfxMesaContext { + GrTexTable_t glbPalType; GuTexPalette glbPalette; GLcontext *glCtx; /* the core Mesa context */ @@ -443,10 +529,12 @@ struct tfxMesaContext * from `glbHWConfig' when creating a new context... */ GrSstType type; + FxBool HavePalExt; /* PALETTE6666 */ FxBool HavePixExt; /* PIXEXT */ FxBool HaveTexFmt; /* TEXFMT */ FxBool HaveCmbExt; /* COMBINE */ FxBool HaveMirExt; /* TEXMIRROR */ + FxBool HaveTexUma; /* TEXUMA */ FxBool HaveTexus2; /* Texus 2 - FXT1 */ struct tdfx_glide Glide; char rendererString[100]; @@ -485,6 +573,10 @@ extern void fxPrintTextureData(tfxTexInfo * ti); extern const struct gl_texture_format * fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ); +extern GLboolean fxDDIsCompressedFormat (GLcontext *ctx, GLenum internalFormat); +extern GLuint fxDDCompressedTextureSize (GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format); extern void fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, @@ -492,7 +584,6 @@ extern void fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); - extern void fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -501,17 +592,33 @@ extern void fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +extern void fxDDCompressedTexImage2D(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); +extern void fxDDCompressedTexSubImage2D(GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *); extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *, GLenum, const GLfloat *); extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *); extern void fxDDTexDel(GLcontext *, struct gl_texture_object *); +extern GLboolean fxDDIsTextureResident(GLcontext *, struct gl_texture_object *); extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *); extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean); extern void fxDDEnable(GLcontext *, GLenum, GLboolean); extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat); extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum); +extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum); +extern void fxDDBlendEquation(GLcontext *, GLenum); extern void fxDDDepthMask(GLcontext *, GLboolean); extern void fxDDDepthFunc(GLcontext *, GLenum); extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask); @@ -532,6 +639,7 @@ extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint, GLint, GLint); +extern int fxTMCheckStartAddr (fxMesaContext fxMesa, GLint tmu, tfxTexInfo *ti); extern void fxTexGetFormat(GLcontext *, GLenum, GrTextureFormat_t *, GLint *); /* [koolsmoky] */ @@ -570,16 +678,19 @@ extern int fxDDInitFxMesaContext(fxMesaContext fxMesa); extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa); -void fxColorMask (fxMesaContext fxMesa, GLboolean enable); - - extern void fxSetScissorValues(GLcontext * ctx); extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, GLint where); -extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder); extern void fxCheckIsInHardware(GLcontext *ctx); +/* fxsetup: + * semi-private functions + */ +void fxSetupCull (GLcontext * ctx); +void fxSetupScissor (GLcontext * ctx); +void fxSetupColorMask (GLcontext * ctx); + /* Flags for software fallback cases */ #define FX_FALLBACK_TEXTURE_1D_3D 0x0001 #define FX_FALLBACK_DRAW_BUFFER 0x0002 @@ -595,4 +706,11 @@ extern void fxCheckIsInHardware(GLcontext *ctx); extern GLuint fx_check_IsInHardware(GLcontext *ctx); +/* run-time debugging */ +#if FX_DEBUG +extern int TDFX_DEBUG; +#else +#define TDFX_DEBUG 0 +#endif + #endif diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c index 3d00e080b17..9f241851000 100644 --- a/src/mesa/drivers/glide/fxg.c +++ b/src/mesa/drivers/glide/fxg.c @@ -31,6 +31,8 @@ */ +#ifdef FX + #include <stdio.h> #include <stdarg.h> #include <assert.h> @@ -38,17 +40,23 @@ #define DEBUG_TRAP_internal #include "fxg.h" +/* texus.h */ +FX_ENTRY void FX_CALL txImgQuantize (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither); +FX_ENTRY void FX_CALL txMipQuantize (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp); +FX_ENTRY void FX_CALL txPalToNcc (GuNccTable *ncc_table, const FxU32 *pal); +/* texus.h */ + /****************************************************************************\ * logging * \****************************************************************************/ #if DEBUG_TRAP -#define TRAP_LOG trap_printf +#define TRAP_LOG trp_printf #ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif /* __GNUC__ */ -int trap_printf (const char *format, ...) +int trp_printf (const char *format, ...) { va_list arg; int n; @@ -232,8 +240,10 @@ const char *TRP_BLEND (GrAlphaBlendFnc_t func) TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SRC_COLOR); /*TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_COLOR); ==GR_BLEND_ONE_MINUS_SRC_COLOR*/ TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_ALPHA); - TRAP_CASE_STRING(GR_BLEND_RESERVED_8); - TRAP_CASE_STRING(GR_BLEND_RESERVED_9); + TRAP_CASE_STRING(GR_BLEND_SAME_COLOR_EXT); + /*TRAP_CASE_STRING(GR_BLEND_RESERVED_8); ==GR_BLEND_SAME_COLOR_EXT*/ + TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SAME_COLOR_EXT); + /*TRAP_CASE_STRING(GR_BLEND_RESERVED_9); ==GR_BLEND_ONE_MINUS_SAME_COLOR_EXT*/ TRAP_CASE_STRING(GR_BLEND_RESERVED_A); TRAP_CASE_STRING(GR_BLEND_RESERVED_B); TRAP_CASE_STRING(GR_BLEND_RESERVED_C); @@ -731,8 +741,6 @@ const char *TRP_BLENDOP (GrAlphaBlendOp_t op) TRAP_CASE_STRING(GR_BLEND_OP_ADD); TRAP_CASE_STRING(GR_BLEND_OP_SUB); TRAP_CASE_STRING(GR_BLEND_OP_REVSUB); - TRAP_CASE_STRING(GR_BLEND_SAME_COLOR_EXT); - TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SAME_COLOR_EXT); TRAP_NODEFAULT; } } @@ -783,6 +791,25 @@ const char *TRP_TMU (GrChipID_t tmu) } } +const char *TRP_TXDITHER (FxU32 dither) +{ + switch (dither) { + TRAP_CASE_STRING(TX_DITHER_NONE); + TRAP_CASE_STRING(TX_DITHER_4x4); + TRAP_CASE_STRING(TX_DITHER_ERR); + TRAP_NODEFAULT; + } +} + +const char *TRP_TXCOMPRESS (FxU32 compress) +{ + switch (compress) { + TRAP_CASE_STRING(TX_COMPRESSION_STATISTICAL); + TRAP_CASE_STRING(TX_COMPRESSION_HEURISTIC); + TRAP_NODEFAULT; + } +} + /****************************************************************************\ @@ -799,6 +826,11 @@ void (FX_CALL *real_grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChrom void (FX_CALL *real_grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode); void (FX_CALL *real_grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode); +/* pointcast */ +void (FX_CALL *real_grTexDownloadTableExt) (GrChipID_t tmu, GrTexTable_t type, void *data); +void (FX_CALL *real_grTexDownloadTablePartialExt) (GrChipID_t tmu, GrTexTable_t type, void *data, int start, int end); +void (FX_CALL *real_grTexNCCTableExt) (GrChipID_t tmu, GrNCCTable_t table); + /* tbext */ void (FX_CALL *real_grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask); void (FX_CALL *real_grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask); @@ -1857,6 +1889,41 @@ void FX_CALL trap_grTexChromaRangeExt (GrChipID_t tmu, #undef FN_NAME } + /* pointcast */ +void FX_CALL trap_grTexDownloadTableExt (GrChipID_t tmu, + GrTexTable_t type, + void *data) +{ +#define FN_NAME "grTexDownloadTableExt" + TRAP_LOG("%s(%s, %s, %p)\n", FN_NAME, TRP_TMU(tmu), TRP_TABLE(type), data); + assert(real_grTexDownloadTableExt); + (*real_grTexDownloadTableExt)(tmu, type, data); +#undef FN_NAME +} + +void FX_CALL trap_grTexDownloadTablePartialExt (GrChipID_t tmu, + GrTexTable_t type, + void *data, + int start, + int end) +{ +#define FN_NAME "grTexDownloadTablePartialExt" + TRAP_LOG("%s(%s, %s, %p, %d, %d)\n", FN_NAME, TRP_TMU(tmu), TRP_TABLE(type), data, start, end); + assert(real_grTexDownloadTablePartialExt); + (*real_grTexDownloadTablePartialExt)(tmu, type, data, start, end); +#undef FN_NAME +} + +void FX_CALL trap_grTexNCCTableExt (GrChipID_t tmu, + GrNCCTable_t table) +{ +#define FN_NAME "grTexNCCTableExt" + TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_NCC(table)); + assert(real_grTexNCCTableExt); + (*real_grTexNCCTableExt)(tmu, table); +#undef FN_NAME +} + /* tbext */ void FX_CALL trap_grTextureBufferExt (GrChipID_t tmu, FxU32 startAddress, @@ -2087,19 +2154,87 @@ void FX_CALL trap_grTBufferWriteMaskExt (FxU32 tmask) (*real_grTBufferWriteMaskExt)(tmask); #undef FN_NAME } + +/* +** texus functions +*/ +void FX_CALL trap_txImgQuantize (char *dst, + char *src, + int w, + int h, + FxU32 format, + FxU32 dither) +{ +#define FN_NAME "txImgQuantize" + TRAP_LOG("%s(%p, %p, %d, %d, %s, %s)\n", FN_NAME, dst, src, w, h, TRP_TEXFMT(format), TRP_TXDITHER(dither)); + txImgQuantize(dst, src, w, h, format, dither); +#undef FN_NAME +} + +void FX_CALL trap_txMipQuantize (TxMip *pxMip, + TxMip *txMip, + int fmt, + FxU32 d, + FxU32 comp) +{ +#define FN_NAME "txMipQuantize" + TRAP_LOG("%s(%p, %p, %s, %s, %s)\n", FN_NAME, (void *)pxMip, (void *)txMip, TRP_TEXFMT(fmt), TRP_TXDITHER(d), TRP_TXCOMPRESS(comp)); + txMipQuantize(pxMip, txMip, fmt, d, comp); +#undef FN_NAME +} + +void FX_CALL trap_txPalToNcc (GuNccTable *ncc_table, + const FxU32 *pal) +{ +#define FN_NAME "txPalToNcc" + TRAP_LOG("%s(%p, %p)\n", FN_NAME, (void *)ncc_table, (void *)pal); + txPalToNcc(ncc_table, pal); +#undef FN_NAME +} #endif /****************************************************************************\ +* housekeeping (fake pointers) +\****************************************************************************/ +void FX_CALL fake_grTexDownloadTableExt (GrChipID_t tmu, + GrTexTable_t type, + void *data) +{ + grTexDownloadTable(type, data); +} + +void FX_CALL fake_grTexDownloadTablePartialExt (GrChipID_t tmu, + GrTexTable_t type, + void *data, + int start, + int end) +{ + grTexDownloadTablePartial(type, data, start, end); +} + +void FX_CALL fake_grTexNCCTableExt (GrChipID_t tmu, + GrNCCTable_t table) +{ + grTexNCCTable(table); +} + + + +/****************************************************************************\ * interface \****************************************************************************/ void tdfx_hook_glide (struct tdfx_glide *Glide) { #if DEBUG_TRAP -#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name +#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name +#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (real_##name == NULL) real_##name = fake_##name +#define GET_TXS_ADDR(name) Glide->name = trap_##name #else /* DEBUG_TRAP */ -#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name) +#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name) +#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (Glide->name == NULL) Glide->name = fake_##name +#define GET_TXS_ADDR(name) Glide->name = name #endif /* DEBUG_TRAP */ /* @@ -2111,6 +2246,10 @@ void tdfx_hook_glide (struct tdfx_glide *Glide) GET_EXT_ADDR(grChromaRangeExt); GET_EXT_ADDR(grTexChromaModeExt); GET_EXT_ADDR(grTexChromaRangeExt); + /* pointcast */ + GET_EXT_FAKE(grTexDownloadTableExt); + GET_EXT_FAKE(grTexDownloadTablePartialExt); + GET_EXT_FAKE(grTexNCCTableExt); /* tbext */ GET_EXT_ADDR(grTextureBufferExt); GET_EXT_ADDR(grTextureAuxBufferExt); @@ -2131,5 +2270,14 @@ void tdfx_hook_glide (struct tdfx_glide *Glide) GET_EXT_ADDR(grAlphaBlendFunctionExt); GET_EXT_ADDR(grTBufferWriteMaskExt); + /* + ** texus + */ + GET_TXS_ADDR(txImgQuantize); + GET_TXS_ADDR(txMipQuantize); + GET_TXS_ADDR(txPalToNcc); + #undef GET_EXT_ADDR } + +#endif /* FX */ diff --git a/src/mesa/drivers/glide/fxg.h b/src/mesa/drivers/glide/fxg.h index 234e52aee8c..2841bab16cb 100644 --- a/src/mesa/drivers/glide/fxg.h +++ b/src/mesa/drivers/glide/fxg.h @@ -307,6 +307,30 @@ void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, float nearZ, float far #endif /* DEBUG_TRAP_internal */ #endif /* DEBUG_TRAP */ + + +/* <texus.h> */ +#define TX_MAX_LEVEL 16 +typedef struct _TxMip { + int format; + int width; + int height; + int depth; + int size; + void *data[TX_MAX_LEVEL]; + FxU32 pal[256]; +} TxMip; +typedef void (*TxErrorCallbackFnc_t) (const char *string, FxBool fatal); +#define TX_DITHER_NONE 0x00000000 +#define TX_DITHER_4x4 0x00000001 +#define TX_DITHER_ERR 0x00000002 + +#define TX_COMPRESSION_STATISTICAL 0x00000000 +#define TX_COMPRESSION_HEURISTIC 0x00000010 +/* <texus.h> */ + + + struct tdfx_glide { /* ** glide extensions @@ -318,6 +342,11 @@ struct tdfx_glide { void (FX_CALL *grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode); void (FX_CALL *grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode); + /* pointcast */ + void (FX_CALL *grTexDownloadTableExt) (GrChipID_t tmu, GrTexTable_t type, void *data); + void (FX_CALL *grTexDownloadTablePartialExt) (GrChipID_t tmu, GrTexTable_t type, void *data, int start, int end); + void (FX_CALL *grTexNCCTableExt) (GrChipID_t tmu, GrNCCTable_t table); + /* tbext */ void (FX_CALL *grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask); void (FX_CALL *grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask); @@ -342,9 +371,9 @@ struct tdfx_glide { /* ** Texus2 functions */ - void (*txImgQuantize) (void *xxx_unknown_arguments); - void (*txImgDequantizeFXT1) (void *txMip, void *pxMip); - void (*txErrorSetCallback) (void *fnc); + void (FX_CALL *txImgQuantize) (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither); + void (FX_CALL *txMipQuantize) (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp); + void (FX_CALL *txPalToNcc) (GuNccTable *ncc_table, const FxU32 *pal); }; void tdfx_hook_glide (struct tdfx_glide *Glide); diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c index 6e89f00ed83..76df0286937 100644 --- a/src/mesa/drivers/glide/fxglidew.c +++ b/src/mesa/drivers/glide/fxglidew.c @@ -1,5 +1,3 @@ -/* $Id: fxglidew.c,v 1.22 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -196,7 +194,9 @@ FX_grSstQueryHardware(GrHwConfiguration * config) grSstSelect(i); extension = grGetString(GR_HARDWARE); - if (strstr(extension, "Voodoo Banshee")) { + if (strstr(extension, "Voodoo2")) { + config->SSTs[i].type = GR_SSTTYPE_Voodoo2; + } else if (strstr(extension, "Voodoo Banshee")) { config->SSTs[i].type = GR_SSTTYPE_Banshee; } else if (strstr(extension, "Voodoo3")) { config->SSTs[i].type = GR_SSTTYPE_Voodoo3; @@ -204,12 +204,12 @@ FX_grSstQueryHardware(GrHwConfiguration * config) config->SSTs[i].type = GR_SSTTYPE_Voodoo4; } else if (strstr(extension, "Voodoo5")) { config->SSTs[i].type = GR_SSTTYPE_Voodoo5; - } else { /* Voodoo1,2,rush */ - /* ZZZ TO DO */ + } else { /* Voodoo1,rush */ + /* ZZZ TO DO: Need to distinguish whether we have V1 or Rush. */ config->SSTs[i].type = GR_SSTTYPE_VOODOO; } - grGet(GR_MEMORY_FB, 4, &result); + grGet(GR_MEMORY_FB, 4, &result); /* ZZZ: differs after grSstWinOpen */ config->SSTs[i].fbRam = result / (1024 * 1024); grGet(GR_NUM_TMU, 4, &result); @@ -219,25 +219,25 @@ FX_grSstQueryHardware(GrHwConfiguration * config) config->SSTs[i].fbiRev = result; for (j = 0; j < config->SSTs[i].nTexelfx; j++) { - grGet(GR_MEMORY_TMU, 4, &result); + grGet(GR_MEMORY_TMU, 4, &result); /* ZZZ: differs after grSstWinOpen */ config->SSTs[i].tmuConfig[j].tmuRam = result / (1024 * 1024); grGet(GR_REVISION_TMU, 4, &result); config->SSTs[i].tmuConfig[j].tmuRev = result; } extension = grGetString(GR_EXTENSION); + config->SSTs[i].HavePalExt = (strstr(extension, " PALETTE6666 ") != NULL); config->SSTs[i].HavePixExt = (strstr(extension, " PIXEXT ") != NULL); config->SSTs[i].HaveTexFmt = (strstr(extension, " TEXFMT ") != NULL); config->SSTs[i].HaveCmbExt = (strstr(extension, " COMBINE ") != NULL); config->SSTs[i].HaveMirExt = (strstr(extension, " TEXMIRROR ") != NULL); + config->SSTs[i].HaveTexUma = (strstr(extension, " TEXUMA ") != NULL); config->SSTs[i].HaveTexus2 = GL_FALSE; - /* need to get the number of SLI units for napalm */ + /* number of Voodoo chips */ grGet(GR_NUM_FB, 4, (void *) &numFB); config->SSTs[i].numChips = numFB; - /* this can only be useful for Voodoo2: - * sliDetect = ((config->SSTs[i].type == GR_SSTTYPE_Voodoo2) && (numFB > 1)); - */ + } tdfx_hook_glide(&config->Glide); diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h index f6177e4ff58..31a8fa3b02e 100644 --- a/src/mesa/drivers/glide/fxglidew.h +++ b/src/mesa/drivers/glide/fxglidew.h @@ -1,5 +1,3 @@ -/* $Id: fxglidew.h,v 1.16 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -71,13 +69,15 @@ typedef struct { int fbRam; /* 1, 2, or 4 MB */ int fbiRev; /* Rev of Pixelfx chip */ int nTexelfx; /* How many texelFX chips are there? */ - int numChips; /* Number of Voodoo chips [koolsmoky] */ + int numChips; /* Number of Voodoo chips */ GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */ /* Glide3 extensions */ + FxBool HavePalExt; /* PALETTE6666 */ FxBool HavePixExt; /* PIXEXT */ FxBool HaveTexFmt; /* TEXFMT */ FxBool HaveCmbExt; /* COMBINE */ FxBool HaveMirExt; /* TEXMIRROR */ + FxBool HaveTexUma; /* TEXUMA */ FxBool HaveTexus2; /* Texus 2 - FXT1 */ } SSTs[MAX_NUM_SST]; /* configuration for each board */ @@ -216,12 +216,4 @@ extern FxBool FX_grSstControl(FxU32 code); -#if FX_DEBUG -extern int TDFX_DEBUG; -#else -#define TDFX_DEBUG 0 -#endif - - - #endif /* __FX_GLIDE_WARPER__ */ diff --git a/src/mesa/drivers/glide/fxopengl.def b/src/mesa/drivers/glide/fxopengl.def index 9d0d3eb5012..897905b4b40 100644 --- a/src/mesa/drivers/glide/fxopengl.def +++ b/src/mesa/drivers/glide/fxopengl.def @@ -1,3 +1,5 @@ +LIBRARY OpenGL32 +DESCRIPTION "Mesa 5.1" EXPORTS glAccum glActiveStencilFaceEXT diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 9ebc603ae7a..22c34cecaf3 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -1,5 +1,3 @@ -/* $Id: fxsetup.c,v 1.40 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -79,19 +77,13 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) else FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info); -/*jejeje*/ -ti->baseLevelInternalFormat = tObj->Image[minl]->Format; -#if 0 - fxTexGetFormat(ctx, tObj->Image[minl]->TexFormat->BaseFormat, &(ti->info.format), - &(ti->baseLevelInternalFormat)); /* [koolsmoky] */ -#endif + ti->baseLevelInternalFormat = tObj->Image[minl]->Format; switch (tObj->WrapS) { case GL_MIRRORED_REPEAT: ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT; break; - case GL_CLAMP_TO_EDGE: - /* What's this really mean compared to GL_CLAMP? */ + case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ case GL_CLAMP: ti->sClamp = GR_TEXTURECLAMP_CLAMP; break; @@ -105,8 +97,7 @@ ti->baseLevelInternalFormat = tObj->Image[minl]->Format; case GL_MIRRORED_REPEAT: ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT; break; - case GL_CLAMP_TO_EDGE: - /* What's this really mean compared to GL_CLAMP? */ + case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ case GL_CLAMP: ti->tClamp = GR_TEXTURECLAMP_CLAMP; break; @@ -301,6 +292,10 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name); } +#if 1 /* [dBorca] Good... bad... I'm the guy with the gun! */ + ti->lastTimeUsed = fxMesa->texBindNumber; +#endif + /* Make sure we're not loaded incorrectly */ if (ti->isInTM) { if (ti->LODblend) { @@ -318,13 +313,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) if (ti->LODblend) fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT); else { - /* XXX putting textures into the second memory bank when the - * first bank is full is not working at this time. - */ - if (/*[dBorca]: fixme*/0 && fxMesa->haveTwoTMUs) { - if (fxMesa->freeTexMem[FX_TMU0] > - grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, - &(ti->info))) { + if (fxMesa->haveTwoTMUs) { + if (fxTMCheckStartAddr(fxMesa, FX_TMU0, ti)) { fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0); } else { @@ -337,13 +327,23 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) } if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) { + /* broadcast */ if ((ti->info.format == GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) { if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__); } - grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette)); + grTexDownloadTable(ti->paltype, &(ti->palette)); } +#if FX_TC_NCC + if ((ti->info.format == GR_TEXFMT_AYIQ_8422) || + (ti->info.format == GR_TEXFMT_YIQ_422)) { + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: uploading NCC table\n", __FUNCTION__); + } + grTexDownloadTable(GR_TEXTABLE_NCC0, &(ti->palette)); + } +#endif grTexClampMode(GR_TMU0, ti->sClamp, ti->tClamp); grTexClampMode(GR_TMU1, ti->sClamp, ti->tClamp); @@ -363,13 +363,23 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) else tmu = ti->whichTMU; + /* pointcast */ if ((ti->info.format == GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) { if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__); } - grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette)); + fxMesa->Glide.grTexDownloadTableExt(tmu, ti->paltype, &(ti->palette)); + } +#if FX_TC_NCC + if ((ti->info.format == GR_TEXFMT_AYIQ_8422) || + (ti->info.format == GR_TEXFMT_YIQ_422)) { + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: uploading NCC table\n", __FUNCTION__); + } + fxMesa->Glide.grTexDownloadTableExt(tmu, GR_TEXTABLE_NCC0, &(ti->palette)); } +#endif /* KW: The alternative is to do the download to the other tmu. If * we get to this point, I think it means we are thrashing the @@ -390,66 +400,86 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj) static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend) { + struct tdfx_texcombine tex0, tex1; + if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend); } + tex0.InvertRGB = FXFALSE; + tex0.InvertAlpha = FXFALSE; + tex1.InvertRGB = FXFALSE; + tex1.InvertAlpha = FXFALSE; + if (LODblend) { - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, - FXFALSE, FXFALSE); - - if (fxMesa->haveTwoTMUs) - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->tmuSrc = FX_TMU_SPLIT; } else { if (tmu != FX_TMU1) { - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - if (fxMesa->haveTwoTMUs) { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - } + tex0.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex0.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex0.FactorAlpha = GR_COMBINE_FACTOR_NONE; + + tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->tmuSrc = FX_TMU0; } else { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ - - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + + /* [dBorca] Hack alert: + * don't use GR_COMBINE_FUNCTION_SCALE_OTHER + * such that Glide recognizes TMU0 in passthrough mode + */ + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; fxMesa->tmuSrc = FX_TMU1; } } + + grTexCombine(GR_TMU0, + tex0.FunctionRGB, + tex0.FactorRGB, + tex0.FunctionAlpha, + tex0.FactorAlpha, + tex0.InvertRGB, + tex0.InvertAlpha); + if (fxMesa->haveTwoTMUs) { + grTexCombine(GR_TMU1, + tex1.FunctionRGB, + tex1.FactorRGB, + tex1.FunctionAlpha, + tex1.FactorAlpha, + tex1.InvertRGB, + tex1.InvertAlpha); + } } static void fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset) { fxMesaContext fxMesa = FX_CONTEXT(ctx); + struct tdfx_combine alphaComb, colorComb; GrCombineLocal_t localc, locala; GLuint unitsmode; GLint ifmt; @@ -503,59 +533,154 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset) fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode)); + alphaComb.Local = locala; + alphaComb.Invert = FXFALSE; + colorComb.Local = localc; + colorComb.Invert = FXFALSE; + switch (ctx->Texture.Unit[textureset].EnvMode) { case GL_DECAL: - grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; - grColorCombine(GR_COMBINE_FUNCTION_BLEND, - GR_COMBINE_FACTOR_TEXTURE_ALPHA, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + colorComb.Function = GR_COMBINE_FUNCTION_BLEND; + colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; break; case GL_MODULATE: - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - - if (ifmt == GL_ALPHA) - grColorCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - else - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + + if (ifmt == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Other = GR_COMBINE_OTHER_NONE; + } else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + } break; case GL_BLEND: - if (TDFX_DEBUG & VERBOSE_DRIVER) - fprintf(stderr, "%s: GL_BLEND not yet supported\n", __FUNCTION__); + if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) { + /* Av = Af */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + } + else if (ifmt == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + alphaComb.Function = GR_COMBINE_FUNCTION_BLEND; + alphaComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA; + alphaComb.Other = GR_COMBINE_OTHER_CONSTANT; + } + else { + /* Av = Af * At */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + } + + if (ifmt == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Other = GR_COMBINE_OTHER_NONE; + } else { + /* [dBorca] Hack alert: + * only Voodoo^2 can GL_BLEND (GR_COMBINE_FACTOR_TEXTURE_RGB) + */ + if (fxMesa->type >= GR_SSTTYPE_Voodoo2) { + colorComb.Function = GR_COMBINE_FUNCTION_BLEND; + colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_RGB; + colorComb.Other = GR_COMBINE_OTHER_CONSTANT; + } else { + _mesa_problem(NULL, "can't GL_BLEND with SST1"); + return; + } + } + + grConstantColorValue( + ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[0] * 255.0f)) ) | + ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[1] * 255.0f)) << 8) | + ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[2] * 255.0f)) << 16) | + ((GLuint)((ctx->Texture.Unit[textureset].EnvColor[3] * 255.0f)) << 24)); break; case GL_REPLACE: - if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE)) - grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - else - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - - if (ifmt == GL_ALPHA) - grColorCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); - else - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE)) { + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + } else { + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + } + + if (ifmt == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Other = GR_COMBINE_OTHER_NONE; + } else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + } + break; + case GL_ADD: + if (ifmt == GL_ALPHA || + ifmt == GL_LUMINANCE_ALPHA || + ifmt == GL_RGBA) { + /* product of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + } + else if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) { + /* fragment alpha is unchanged */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + } + else { + /* sum of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + } + + if (ifmt == GL_ALPHA) { + /* rgb unchanged */ + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Other = GR_COMBINE_OTHER_NONE; + } + else { + /* sum of texel and fragment rgb */ + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + } break; default: - if (TDFX_DEBUG & VERBOSE_DRIVER) + if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__, ctx->Texture.Unit[textureset].EnvMode); - break; + } + return; } + + grAlphaCombine(alphaComb.Function, + alphaComb.Factor, + alphaComb.Local, + alphaComb.Other, + alphaComb.Invert); + grColorCombine(colorComb.Function, + colorComb.Factor, + colorComb.Local, + colorComb.Other, + colorComb.Invert); } #if 00 @@ -678,18 +803,42 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, } } + /* [dBorca] Hack alert: + * we put these in reverse order, so that if we can't + * do _REAL_ pointcast, the TMU0 table gets broadcasted + */ if (!fxMesa->haveGlobalPaletteTexture) { - /* [dBorca] - * all TMUs share the same table. - * The next test shouldn't be TMU specific... - */ + /* pointcast */ + if (ti1->info.format == GR_TEXFMT_P_8) { + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: uploading texture palette for TMU1\n", __FUNCTION__); + } + fxMesa->Glide.grTexDownloadTableExt(ti1->whichTMU, ti1->paltype, &(ti1->palette)); + } if (ti0->info.format == GR_TEXFMT_P_8) { if (TDFX_DEBUG & VERBOSE_DRIVER) { - fprintf(stderr, "%s: uploading texture palette TMU0\n", __FUNCTION__); + fprintf(stderr, "%s: uploading texture palette for TMU0\n", __FUNCTION__); } - grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti0->palette)); + fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, ti0->paltype, &(ti0->palette)); + } + } +#if FX_TC_NCC + /* pointcast */ + if ((ti1->info.format == GR_TEXFMT_AYIQ_8422) || + (ti1->info.format == GR_TEXFMT_YIQ_422)) { + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: uploading NCC0 table for TMU1\n", __FUNCTION__); } + fxMesa->Glide.grTexDownloadTableExt(ti1->whichTMU, GR_TEXTABLE_NCC0, &(ti1->palette)); } + if ((ti0->info.format == GR_TEXFMT_AYIQ_8422) || + (ti0->info.format == GR_TEXFMT_YIQ_422)) { + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: uploading NCC0 table for TMU0\n", __FUNCTION__); + } + fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, GR_TEXTABLE_NCC0, &(ti0->palette)); + } +#endif grTexSource(tmu0, ti0->tm[tmu0]->startAddr, GR_MIPMAPLEVELMASK_BOTH, &(ti0->info)); @@ -715,6 +864,8 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) { fxMesaContext fxMesa = FX_CONTEXT(ctx); + struct tdfx_combine alphaComb, colorComb; + struct tdfx_texcombine tex0, tex1; GrCombineLocal_t localc, locala; tfxTexInfo *ti0, *ti1; struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D; @@ -769,6 +920,16 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) tmu1 = 0; } fxMesa->tmuSrc = FX_TMU_BOTH; + + tex0.InvertRGB = FXFALSE; + tex0.InvertAlpha = FXFALSE; + tex1.InvertRGB = FXFALSE; + tex1.InvertAlpha = FXFALSE; + alphaComb.Local = locala; + alphaComb.Invert = FXFALSE; + colorComb.Local = localc; + colorComb.Invert = FXFALSE; + switch (envmode) { case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE): { @@ -777,120 +938,111 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA); isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA); - if (isalpha[FX_TMU1]) - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE); - else - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - if (isalpha[FX_TMU0]) - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); - else - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); - - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + if (isalpha[FX_TMU1]) { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + tex1.InvertRGB = FXTRUE; + } else { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + } + + if (isalpha[FX_TMU0]) { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + } else { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + } + + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; break; } case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */ if (tmu1 == FX_TMU1) { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE); - - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + tex1.InvertRGB = FXTRUE; + + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL; } else { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, - FXFALSE, FXFALSE); + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; } - grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; break; case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */ if (tmu1 == FX_TMU1) { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXTRUE); - - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE); - + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + tex1.InvertAlpha = FXTRUE; + + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL; } else { - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_LOCAL, - GR_COMBINE_FUNCTION_BLEND_OTHER, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + + tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; } - if (ti0->baseLevelInternalFormat == GL_RGB) - grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - else - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); - + if (ti0->baseLevelInternalFormat == GL_RGB) { + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + } else { + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + } - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; break; @@ -901,45 +1053,69 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA); isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA); - if (isalpha[FX_TMU1]) - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE); - else - grTexCombine(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); - - if (isalpha[FX_TMU0]) - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); - else - grTexCombine(GR_TMU0, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, - GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, - GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE); - - grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - - grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, - GR_COMBINE_FACTOR_LOCAL, - locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE); + if (isalpha[FX_TMU1]) { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + tex1.InvertRGB = FXTRUE; + } else { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + } + + if (isalpha[FX_TMU0]) { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; + } else { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; + } + + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; break; } default: fprintf(stderr, "%s: Unexpected dual texture mode encountered\n", __FUNCTION__); - break; + return; } + + grAlphaCombine(alphaComb.Function, + alphaComb.Factor, + alphaComb.Local, + alphaComb.Other, + alphaComb.Invert); + grColorCombine(colorComb.Function, + colorComb.Factor, + colorComb.Local, + colorComb.Other, + colorComb.Invert); + grTexCombine(GR_TMU0, + tex0.FunctionRGB, + tex0.FactorRGB, + tex0.FunctionAlpha, + tex0.FactorAlpha, + tex0.InvertRGB, + tex0.InvertAlpha); + grTexCombine(GR_TMU1, + tex1.FunctionRGB, + tex1.FactorRGB, + tex1.FunctionAlpha, + tex1.FactorAlpha, + tex1.InvertRGB, + tex1.InvertAlpha); } /************************* No Texture ***************************/ @@ -967,16 +1143,22 @@ fxSetupTextureNone_NoLock(GLcontext * ctx) localc = GR_COMBINE_LOCAL_CONSTANT; grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - locala, GR_COMBINE_OTHER_NONE, FXFALSE); + GR_COMBINE_FACTOR_NONE, + locala, + GR_COMBINE_OTHER_NONE, + FXFALSE); grColorCombine(GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - localc, GR_COMBINE_OTHER_NONE, FXFALSE); + GR_COMBINE_FACTOR_NONE, + localc, + GR_COMBINE_OTHER_NONE, + FXFALSE); fxMesa->lastUnitsMode = FX_UM_NONE; } +#include "fxsetup.h" + /************************************************************************/ /************************** Texture Mode SetUp **************************/ /************************************************************************/ @@ -990,20 +1172,38 @@ fxSetupTexture_NoLock(GLcontext * ctx) fprintf(stderr, "%s(...)\n", __FUNCTION__); } - /* Texture Combine, Color Combine and Alpha Combine. */ - if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && - ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT && - fxMesa->haveTwoTMUs) { - fxSetupTextureDoubleTMU_NoLock(ctx); - } - else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) { - fxSetupTextureSingleTMU_NoLock(ctx, 0); - } - else if (ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) { - fxSetupTextureSingleTMU_NoLock(ctx, 1); - } - else { - fxSetupTextureNone_NoLock(ctx); + if (fxMesa->HaveCmbExt) { + /* Texture Combine, Color Combine and Alpha Combine. */ + if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && + ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT && + fxMesa->haveTwoTMUs) { + fxSetupTextureDoubleTMUNapalm_NoLock(ctx); + } + else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) { + fxSetupTextureSingleTMUNapalm_NoLock(ctx, 0); + } + else if (ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) { + fxSetupTextureSingleTMUNapalm_NoLock(ctx, 1); + } + else { + fxSetupTextureNoneNapalm_NoLock(ctx); + } + } else { + /* Texture Combine, Color Combine and Alpha Combine. */ + if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && + ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT && + fxMesa->haveTwoTMUs) { + fxSetupTextureDoubleTMU_NoLock(ctx); + } + else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) { + fxSetupTextureSingleTMU_NoLock(ctx, 0); + } + else if (ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) { + fxSetupTextureSingleTMU_NoLock(ctx, 1); + } + else { + fxSetupTextureNone_NoLock(ctx); + } } } @@ -1019,117 +1219,211 @@ fxSetupTexture(GLcontext * ctx) /**************************** Blend SetUp *******************************/ /************************************************************************/ -/* XXX consider supporting GL_INGR_blend_func_separate */ void -fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor) +fxDDBlendFuncSeparate(GLcontext * ctx, GLenum sfactor, GLenum dfactor, GLenum asfactor, GLenum adfactor) { fxMesaContext fxMesa = FX_CONTEXT(ctx); tfxUnitsState *us = &fxMesa->unitsState; + GLboolean have32bpp = (fxMesa->colDepth == 32); + GLboolean haveAlpha = fxMesa->haveHwAlpha; GrAlphaBlendFnc_t sfact, dfact, asfact, adfact; - /* From the Glide documentation: - For alpha source and destination blend function factor - parameters, Voodoo Graphics supports only - GR_BLEND_ZERO and GR_BLEND_ONE. + /* [dBorca] Hack alert: + * We should condition *DST_ALPHA* modes + * by the boolean `haveAlpha' above! + * It indicates whether we really have HW alpha buffer... */ +/* +When the value A_COLOR is selected as the destination alpha blending factor, +the source pixel color is used as the destination blending factor. When the +value A_COLOR is selected as the source alpha blending factor, the destination +pixel color is used as the source blending factor. When the value A_SAMECOLOR +is selected as the destination alpha blending factor, the destination pixel +color is used as the destination blending factor. When the value A_SAMECOLOR +is selected as the source alpha blending factor, the source pixel color is +used as the source blending factor. Note also that the alpha blending +function 0xf (A_COLORBEFOREFOG/ASATURATE) is different depending upon whether +it is being used as a source or destination alpha blending function. When the +value 0xf is selected as the destination alpha blending factor, the source +color before the fog unit ("unfogged" color) is used as the destination +blending factor -- this alpha blending function is useful for multi-pass +rendering with atmospheric effects. When the value 0xf is selected as the +source alpha blending factor, the alpha-saturate anti-aliasing algorithm is +selected -- this MIN function performs polygonal anti-aliasing for polygons +which are drawn front-to-back. + +15/16 BPP alpha channel alpha blending modes + 0x0 AZERO Zero + 0x4 AONE One + +32 BPP alpha channel alpha blending modes + 0x0 AZERO Zero + 0x1 ASRC_ALPHA Source alpha + 0x3 ADST_ALPHA Destination alpha + 0x4 AONE One + 0x5 AOMSRC_ALPHA 1 - Source alpha + 0x7 AOMDST_ALPHA 1 - Destination alpha +*/ + switch (sfactor) { case GL_ZERO: - asfact = sfact = GR_BLEND_ZERO; + sfact = GR_BLEND_ZERO; break; case GL_ONE: - asfact = sfact = GR_BLEND_ONE; + sfact = GR_BLEND_ONE; break; case GL_DST_COLOR: sfact = GR_BLEND_DST_COLOR; - asfact = GR_BLEND_ONE; break; case GL_ONE_MINUS_DST_COLOR: sfact = GR_BLEND_ONE_MINUS_DST_COLOR; - asfact = GR_BLEND_ONE; break; case GL_SRC_ALPHA: sfact = GR_BLEND_SRC_ALPHA; - asfact = GR_BLEND_ONE; break; case GL_ONE_MINUS_SRC_ALPHA: sfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - asfact = GR_BLEND_ONE; break; case GL_DST_ALPHA: sfact = GR_BLEND_DST_ALPHA; - asfact = GR_BLEND_ONE; break; case GL_ONE_MINUS_DST_ALPHA: sfact = GR_BLEND_ONE_MINUS_DST_ALPHA; - asfact = GR_BLEND_ONE; break; case GL_SRC_ALPHA_SATURATE: sfact = GR_BLEND_ALPHA_SATURATE; - asfact = GR_BLEND_ONE; break; case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: /* USELESS */ - asfact = sfact = GR_BLEND_ONE; + sfact = GR_BLEND_ONE; break; default: - asfact = sfact = GR_BLEND_ONE; + sfact = GR_BLEND_ONE; break; } - if ((sfact != us->blendSrcFuncRGB) || (asfact != us->blendSrcFuncAlpha)) { - us->blendSrcFuncRGB = sfact; - us->blendSrcFuncAlpha = asfact; - fxMesa->new_state |= FX_NEW_BLEND; + switch (asfactor) { + case GL_ZERO: + asfact = GR_BLEND_ZERO; + break; + case GL_ONE: + asfact = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + asfact = GR_BLEND_ONE/*bad*/; + break; + case GL_ONE_MINUS_DST_COLOR: + asfact = GR_BLEND_ONE/*bad*/; + break; + case GL_SRC_ALPHA: + asfact = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ONE/*bad*/; + break; + case GL_ONE_MINUS_SRC_ALPHA: + asfact = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ONE/*bad*/; + break; + case GL_DST_ALPHA: + asfact = have32bpp ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*bad*/; + break; + case GL_ONE_MINUS_DST_ALPHA: + asfact = have32bpp ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ONE/*bad*/; + break; + case GL_SRC_ALPHA_SATURATE: + asfact = GR_BLEND_ONE/*bad*/; + break; + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + /* USELESS */ + asfact = GR_BLEND_ONE/*bad*/; + break; + default: + asfact = GR_BLEND_ONE/*bad*/; + break; } switch (dfactor) { case GL_ZERO: - adfact = dfact = GR_BLEND_ZERO; + dfact = GR_BLEND_ZERO; break; case GL_ONE: - adfact = dfact = GR_BLEND_ONE; + dfact = GR_BLEND_ONE; break; case GL_SRC_COLOR: dfact = GR_BLEND_SRC_COLOR; - adfact = GR_BLEND_ZERO; break; case GL_ONE_MINUS_SRC_COLOR: dfact = GR_BLEND_ONE_MINUS_SRC_COLOR; - adfact = GR_BLEND_ZERO; break; case GL_SRC_ALPHA: dfact = GR_BLEND_SRC_ALPHA; - adfact = GR_BLEND_ZERO; break; case GL_ONE_MINUS_SRC_ALPHA: dfact = GR_BLEND_ONE_MINUS_SRC_ALPHA; - adfact = GR_BLEND_ZERO; break; case GL_DST_ALPHA: /* dfact=GR_BLEND_DST_ALPHA; */ /* We can't do DST_ALPHA */ dfact = GR_BLEND_ONE; - adfact = GR_BLEND_ZERO; break; case GL_ONE_MINUS_DST_ALPHA: /* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */ /* We can't do DST_ALPHA */ dfact = GR_BLEND_ZERO; + break; + case GL_SRC_ALPHA_SATURATE: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + /* USELESS */ + dfact = GR_BLEND_ZERO; + break; + default: + dfact = GR_BLEND_ZERO; + break; + } + + switch (adfactor) { + case GL_ZERO: adfact = GR_BLEND_ZERO; break; + case GL_ONE: + adfact = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + adfact = GR_BLEND_ZERO/*bad*/; + break; + case GL_ONE_MINUS_SRC_COLOR: + adfact = GR_BLEND_ZERO/*bad*/; + break; + case GL_SRC_ALPHA: + adfact = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ZERO/*bad*/; + break; + case GL_ONE_MINUS_SRC_ALPHA: + adfact = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ZERO/*bad*/; + break; + case GL_DST_ALPHA: + adfact = have32bpp ? GR_BLEND_DST_ALPHA : GR_BLEND_ZERO/*bad*/; + break; + case GL_ONE_MINUS_DST_ALPHA: + adfact = have32bpp ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*bad*/; + break; case GL_SRC_ALPHA_SATURATE: case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: /* USELESS */ - adfact = dfact = GR_BLEND_ZERO; + adfact = GR_BLEND_ZERO/*bad*/; break; default: - adfact = dfact = GR_BLEND_ZERO; + adfact = GR_BLEND_ZERO/*bad*/; break; } + if ((sfact != us->blendSrcFuncRGB) || (asfact != us->blendSrcFuncAlpha)) { + us->blendSrcFuncRGB = sfact; + us->blendSrcFuncAlpha = asfact; + fxMesa->new_state |= FX_NEW_BLEND; + } + if ((dfact != us->blendDstFuncRGB) || (adfact != us->blendDstFuncAlpha)) { us->blendDstFuncRGB = dfact; us->blendDstFuncAlpha = adfact; @@ -1137,18 +1431,66 @@ fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor) } } +void +fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor) +{ + fxDDBlendFuncSeparate(ctx, sfactor, dfactor, sfactor, dfactor); +} + +void +fxDDBlendEquation(GLcontext * ctx, GLenum mode) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; + GrAlphaBlendOp_t q; + + switch (mode) { + case GL_FUNC_ADD_EXT: + q = GR_BLEND_OP_ADD; + break; + case GL_FUNC_SUBTRACT_EXT: + q = GR_BLEND_OP_SUB; + break; + case GL_FUNC_REVERSE_SUBTRACT_EXT: + q = GR_BLEND_OP_REVSUB; + break; + default: + return; + } + + if ((q != us->blendEq) && fxMesa->HavePixExt) { + us->blendEq = q; + fxMesa->new_state |= FX_NEW_BLEND; + } +} + static void fxSetupBlend(GLcontext * ctx) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - tfxUnitsState *us = &fxMesa->unitsState; - - if (us->blendEnabled) - grAlphaBlendFunction(us->blendSrcFuncRGB, us->blendDstFuncRGB, - us->blendSrcFuncAlpha, us->blendDstFuncAlpha); - else - grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, - GR_BLEND_ZERO); + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; + + if (fxMesa->HavePixExt) { + if (us->blendEnabled) { + fxMesa->Glide.grAlphaBlendFunctionExt(us->blendSrcFuncRGB, us->blendDstFuncRGB, + us->blendEq, + us->blendSrcFuncAlpha, us->blendDstFuncAlpha, + us->blendEq); + } else { + fxMesa->Glide.grAlphaBlendFunctionExt(GR_BLEND_ONE, GR_BLEND_ZERO, + GR_BLEND_OP_ADD, + GR_BLEND_ONE, GR_BLEND_ZERO, + GR_BLEND_OP_ADD); + } + } else { + if (us->blendEnabled) { + grAlphaBlendFunction(us->blendSrcFuncRGB, us->blendDstFuncRGB, + us->blendSrcFuncAlpha, us->blendDstFuncAlpha); + } else { + grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, + GR_BLEND_ONE, GR_BLEND_ZERO); + } + } } /************************************************************************/ @@ -1336,25 +1678,6 @@ fxSetupStencil (GLcontext * ctx) /**************************** Color Mask SetUp **************************/ /************************************************************************/ -void fxColorMask (fxMesaContext fxMesa, GLboolean enable) -{ -/* These are used in calls to FX_grColorMask() */ -static const FxBool false4[4] = { FXFALSE, FXFALSE, FXFALSE, FXFALSE }; -static const FxBool true4[4] = { FXTRUE, FXTRUE, FXTRUE, FXTRUE }; - - const FxBool *rgba = enable ? true4 : false4; - - if (fxMesa->colDepth != 16) { - /* 32bpp mode or 15bpp mode */ - fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP], - rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha); - } - else { - /* 16 bpp mode */ - grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha); - } -} - void fxDDColorMask(GLcontext * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) @@ -1367,16 +1690,24 @@ fxDDColorMask(GLcontext * ctx, (void) a; } -static void +void fxSetupColorMask(GLcontext * ctx) { fxMesaContext fxMesa = FX_CONTEXT(ctx); - if (ctx->Color.DrawBuffer == GL_NONE) { - fxColorMask(fxMesa, GL_FALSE); + if (fxMesa->colDepth != 16) { + /* 32bpp mode or 15bpp mode */ + fxMesa->Glide.grColorMaskExt(ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] && fxMesa->haveHwAlpha); } else { - fxColorMask(fxMesa, GL_TRUE); + /* 16 bpp mode */ + grColorMask(ctx->Color.ColorMask[RCOMP] | + ctx->Color.ColorMask[GCOMP] | + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] && fxMesa->haveHwAlpha); } } @@ -1453,30 +1784,34 @@ fxSetScissorValues(GLcontext * ctx) { fxMesaContext fxMesa = FX_CONTEXT(ctx); int xmin, xmax; - int ymin, ymax, check; + int ymin, ymax; if (ctx->Scissor.Enabled) { xmin = ctx->Scissor.X; xmax = ctx->Scissor.X + ctx->Scissor.Width; ymin = ctx->Scissor.Y; ymax = ctx->Scissor.Y + ctx->Scissor.Height; - check = 1; + + if (xmin < 0) + xmin = 0; + if (xmax > fxMesa->width) + xmax = fxMesa->width; + if (ymin < fxMesa->screen_height - fxMesa->height) + ymin = fxMesa->screen_height - fxMesa->height; + if (ymax > fxMesa->screen_height - 0) + ymax = fxMesa->screen_height - 0; } else { xmin = 0; ymin = 0; xmax = fxMesa->width; ymax = fxMesa->height; - check = 0; } - if (xmin < fxMesa->clipMinX) - xmin = fxMesa->clipMinX; - if (xmax > fxMesa->clipMaxX) - xmax = fxMesa->clipMaxX; - if (ymin < fxMesa->screen_height - fxMesa->clipMaxY) - ymin = fxMesa->screen_height - fxMesa->clipMaxY; - if (ymax > fxMesa->screen_height - fxMesa->clipMinY) - ymax = fxMesa->screen_height - fxMesa->clipMinY; + + fxMesa->clipMinX = xmin; + fxMesa->clipMinY = ymin; + fxMesa->clipMaxX = xmax; + fxMesa->clipMaxY = ymax; grClipWindow(xmin, ymin, xmax, ymax); } diff --git a/src/mesa/drivers/glide/fxsetup.h b/src/mesa/drivers/glide/fxsetup.h new file mode 100644 index 00000000000..9f028fb999e --- /dev/null +++ b/src/mesa/drivers/glide/fxsetup.h @@ -0,0 +1,1131 @@ +/* + * Mesa 3-D graphics library + * Version: 4.0 + * + * Copyright (C) 1999-2001 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Authors: + * David Bucciarelli + * Brian Paul + * Daryll Strauss + * Keith Whitwell + * Daniel Borca + * Hiroshi Morii + */ + +/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */ +/* [dBorca] Hack alert: + * this code belongs to fxsetup.c, but I didn't want to clutter + * the original code with Napalm specifics, in order to keep things + * clear -- especially for backward compatibility. I should have + * put it into another .c file, but I didn't want to export so many + * things... + * The point is, Napalm uses a different technique for texture env. + * SST1 Single texturing: + * setup standard grTexCombine + * fiddle with grColorCombine/grAlphaCombine + * SST1 Multi texturing: + * fiddle with grTexCombine/grColorCombine/grAlphaCombine + * Napalm Single texturing: + * setup standard grColorCombineExt/grAlphaCombineExt + * fiddle with grTexColorCombine/grTexAlphaCombine + * Napalm Multi texturing: + * setup standard grColorCombineExt/grAlphaCombineExt + * fiddle with grTexColorCombine/grTexAlphaCombine + */ + +/* + * These macros are used below when handling COMBINE_EXT. + */ +#define TEXENV_OPERAND_INVERTED(operand) \ + (((operand) == GL_ONE_MINUS_SRC_ALPHA) \ + || ((operand) == GL_ONE_MINUS_SRC_COLOR)) +#define TEXENV_OPERAND_ALPHA(operand) \ + (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA)) +#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \ + if (!TEXENV_OPERAND_ALPHA(operand)) { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_RGB; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CCOLOR; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITRGB; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedColor; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } else { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } + +#define TEXENV_SETUP_MODE_RGB(param, operand) \ + switch (operand) { \ + case GL_SRC_COLOR: \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + case GL_ONE_MINUS_SRC_COLOR: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_MODE_A(param, operand) \ + switch (operand) { \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + +static void +fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, GLboolean iterated) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[textureset]; + struct tdfx_combine_alpha_ext alphaComb; + struct tdfx_combine_color_ext colorComb; + const GLfloat *envColor = texUnit->EnvColor; + GrCombineLocal_t localc, locala; /* fragmentColor/Alpha */ + GLint ifmt; + tfxTexInfo *ti; + struct gl_texture_object *tObj = texUnit->Current2D; + + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s(...)\n", __FUNCTION__); + } + + ti = fxTMGetTexInfo(tObj); + + ifmt = ti->baseLevelInternalFormat; + + if (iterated) { + /* we don't have upstream TMU */ + locala = GR_CMBX_ITALPHA; + localc = GR_CMBX_ITRGB; + } else { + /* we have upstream TMU */ + locala = GR_CMBX_OTHER_TEXTURE_ALPHA; + localc = GR_CMBX_OTHER_TEXTURE_RGB; + } + + alphaComb.InvertD = FXFALSE; + alphaComb.Shift = 0; + alphaComb.Invert = FXFALSE; + colorComb.InvertD = FXFALSE; + colorComb.Shift = 0; + colorComb.Invert = FXFALSE; + + switch (texUnit->EnvMode) { + case GL_DECAL: + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + + colorComb.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = localc; + colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X; + colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + colorComb.InvertC = FXFALSE; + colorComb.SourceD = GR_CMBX_B; + break; + case GL_MODULATE: + if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + } else { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.InvertC = FXFALSE; + alphaComb.SourceD = GR_CMBX_ZERO; + } + + if (ifmt == GL_ALPHA) { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } else { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + colorComb.InvertC = FXFALSE; + colorComb.SourceD = GR_CMBX_ZERO; + } + break; + case GL_BLEND: + if (ifmt == GL_INTENSITY) { + alphaComb.SourceA = GR_CMBX_TMU_CALPHA; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = locala; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.InvertC = FXFALSE; + alphaComb.SourceD = GR_CMBX_ZERO; + } else { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.InvertC = FXFALSE; + alphaComb.SourceD = GR_CMBX_ZERO; + } + + if (ifmt == GL_ALPHA) { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } else { + colorComb.SourceA = GR_CMBX_TMU_CCOLOR; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = localc; + colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X; + colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + colorComb.InvertC = FXFALSE; + colorComb.SourceD = GR_CMBX_B; + } + + fxMesa->Glide.grConstantColorValueExt(tmu, + ((GLuint)((envColor[0] * 255.0f)) ) | + ((GLuint)((envColor[1] * 255.0f)) << 8) | + ((GLuint)((envColor[2] * 255.0f)) << 16) | + ((GLuint)((envColor[3] * 255.0f)) << 24)); + break; + case GL_REPLACE: + if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + } else { + alphaComb.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + } + + if (ifmt == GL_ALPHA) { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } else { + colorComb.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } + break; + case GL_ADD: + if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + } else if (ifmt == GL_INTENSITY) { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_ZERO; + alphaComb.InvertC = FXTRUE; + alphaComb.SourceD = GR_CMBX_ZERO; + } else { + alphaComb.SourceA = locala; + alphaComb.ModeA = GR_FUNC_MODE_X; + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_X; + alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + alphaComb.InvertC = FXFALSE; + alphaComb.SourceD = GR_CMBX_ZERO; + } + + if (ifmt == GL_ALPHA) { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } else { + colorComb.SourceA = localc; + colorComb.ModeA = GR_FUNC_MODE_X; + colorComb.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB; + colorComb.ModeB = GR_FUNC_MODE_X; + colorComb.SourceC = GR_CMBX_ZERO; + colorComb.InvertC = FXTRUE; + colorComb.SourceD = GR_CMBX_ZERO; + } + break; + /* COMBINE_EXT */ + case GL_COMBINE_EXT: + /* [dBorca] Hack alert: + * INCOMPLETE!!! + */ + if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) { + fprintf(stderr, "COMBINE_EXT: %s + %s\n", + _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB), + _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); + } + + alphaComb.Shift = texUnit->CombineScaleShiftA; + colorComb.Shift = texUnit->CombineScaleShiftRGB; + + switch (texUnit->CombineModeRGB) { + case GL_MODULATE: + /* Arg0 * Arg1 == (A + 0) * C + 0 */ + TEXENV_SETUP_ARG_RGB(colorComb.SourceA, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + localc, locala); + TEXENV_SETUP_MODE_RGB(colorComb.ModeA, + texUnit->CombineOperandRGB[0]); + colorComb.SourceB = GR_CMBX_ZERO; + colorComb.ModeB = GR_FUNC_MODE_ZERO; + TEXENV_SETUP_ARG_RGB(colorComb.SourceC, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + localc, locala); + colorComb.InvertC = TEXENV_OPERAND_INVERTED( + texUnit->CombineOperandRGB[1]); + colorComb.SourceD = GR_CMBX_ZERO; + break; + default: + fprintf(stderr, "COMBINE_EXT_color: %s\n", + _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB)); + } + + switch (texUnit->CombineModeA) { + case GL_MODULATE: + /* Arg0 * Arg1 == (A + 0) * C + 0 */ + TEXENV_SETUP_ARG_A(alphaComb.SourceA, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + locala); + TEXENV_SETUP_MODE_A(alphaComb.ModeA, + texUnit->CombineOperandA[0]); + alphaComb.SourceB = GR_CMBX_ZERO; + alphaComb.ModeB = GR_FUNC_MODE_ZERO; + TEXENV_SETUP_ARG_A(alphaComb.SourceC, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + locala); + alphaComb.InvertC = TEXENV_OPERAND_INVERTED( + texUnit->CombineOperandA[1]); + alphaComb.SourceD = GR_CMBX_ZERO; + break; + default: + fprintf(stderr, "COMBINE_EXT_alpha: %s\n", + _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); + } + + fxMesa->Glide.grConstantColorValueExt(tmu, + ((GLuint)((envColor[0] * 255.0f)) ) | + ((GLuint)((envColor[1] * 255.0f)) << 8) | + ((GLuint)((envColor[2] * 255.0f)) << 16) | + ((GLuint)((envColor[3] * 255.0f)) << 24)); + break; +#if 0 + { + FxU32 A_RGB, B_RGB, C_RGB, D_RGB; + FxU32 Amode_RGB, Bmode_RGB; + FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB; + FxU32 Shift_RGB; + FxU32 A_A, B_A, C_A, D_A; + FxU32 Amode_A, Bmode_A; + FxBool Cinv_A, Dinv_A, Ginv_A; + FxU32 Shift_A; + + /* + * + * In the formulas below, we write: + * o "1(x)" for the identity function applied to x, + * so 1(x) = x. + * o "0(x)" for the constant function 0, so + * 0(x) = 0 for all values of x. + * + * Calculate the color combination. + */ + Shift_RGB = texUnit->CombineScaleShiftRGB; + Shift_A = texUnit->CombineScaleShiftA; + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_FUNC_MODE_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_RGB(C_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + Cinv_RGB = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1]); + D_RGB = GR_CMBX_ZERO; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Bmode_RGB, + texUnit->CombineOperandRGB[1]); + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X; + } + else { + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + } + } + else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + } + else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { + /* + * This case is wrong. + */ + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + else { + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_RGB, + texUnit->CombineSourceRGB[2], + texUnit->CombineOperandRGB[2], + incomingAlpha); + Cinv_RGB = FXFALSE; + D_RGB = GR_CMBX_B; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the texture values + * to zero. + */ + A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X; + Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE; + break; + } + /* + * Calculate the alpha combination. + */ + switch (texUnit->CombineModeA) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ITALPHA; + Bmode_A = GR_FUNC_MODE_ZERO; + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ZERO; + Bmode_A = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + Cinv_A = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1]); + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + TEXENV_SETUP_MODE_A(Bmode_A, + texUnit->CombineOperandA[1]); + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_A = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X; + } else { + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + } + } else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_A = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X_MINUS_HALF; + } else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + } + else { + /* + * This case is wrong. + */ + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[2], + texUnit->CombineOperandA[2], + incomingAlpha); + Cinv_A = FXFALSE; + D_A = GR_CMBX_B; + Dinv_A = Ginv_A = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the alpha values + * to one. + */ + A_A = B_A = C_A = D_A = GR_CMBX_ZERO; + Amode_A = Bmode_A = GR_FUNC_MODE_X; + Cinv_A = Dinv_A = FXFALSE; + Ginv_A = FXTRUE; + break; + } + /* + * Save the parameters. + */ + env->Color.SourceA = A_RGB; + env->Color.ModeA = Amode_RGB; + env->Color.SourceB = B_RGB; + env->Color.ModeB = Bmode_RGB; + env->Color.SourceC = C_RGB; + env->Color.InvertC = Cinv_RGB; + env->Color.SourceD = D_RGB; + env->Color.InvertD = Dinv_RGB; + env->Color.Shift = Shift_RGB; + env->Color.Invert = Ginv_RGB; + env->Alpha.SourceA = A_A; + env->Alpha.ModeA = Amode_A; + env->Alpha.SourceB = B_A; + env->Alpha.ModeB = Bmode_A; + env->Alpha.SourceC = C_A; + env->Alpha.InvertC = Cinv_A; + env->Alpha.SourceD = D_A; + env->Alpha.InvertD = Dinv_A; + env->Alpha.Shift = Shift_A; + env->Alpha.Invert = Ginv_A; + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + } + break; +#endif + default: + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__, + texUnit->EnvMode); + } + return; + } + + /* On Napalm we simply put the color combine unit into passthrough mode + * and do everything we need with the texture combine units. */ + fxMesa->Glide.grColorCombineExt(GR_CMBX_TEXTURE_RGB, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + fxMesa->Glide.grAlphaCombineExt(GR_CMBX_TEXTURE_ALPHA, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + + fxMesa->Glide.grTexAlphaCombineExt(tmu, + alphaComb.SourceA, + alphaComb.ModeA, + alphaComb.SourceB, + alphaComb.ModeB, + alphaComb.SourceC, + alphaComb.InvertC, + alphaComb.SourceD, + alphaComb.InvertD, + alphaComb.Shift, + alphaComb.Invert); + fxMesa->Glide.grTexColorCombineExt(tmu, + colorComb.SourceA, + colorComb.ModeA, + colorComb.SourceB, + colorComb.ModeB, + colorComb.SourceC, + colorComb.InvertC, + colorComb.SourceD, + colorComb.InvertD, + colorComb.Shift, + colorComb.Invert); +} + + +/************************* Single Texture Set ***************************/ + +static void +fxSelectSingleTMUSrcNapalm_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend) +{ + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend); + } + + if (LODblend) { + /* [dBorca] Hack alert: + * TODO: GR_CMBX_LOD_FRAC + */ + + fxMesa->tmuSrc = FX_TMU_SPLIT; + } + else { + if (tmu != FX_TMU1) { + /* disable tex1 */ + if (fxMesa->haveTwoTMUs) { + fxMesa->Glide.grTexAlphaCombineExt(FX_TMU1, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + fxMesa->Glide.grTexColorCombineExt(FX_TMU1, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + } + + fxMesa->tmuSrc = FX_TMU0; + } + else { + grTexCombine(GR_TMU0, + GR_COMBINE_FUNCTION_BLEND, + GR_COMBINE_FACTOR_ONE, + GR_COMBINE_FUNCTION_BLEND, + GR_COMBINE_FACTOR_ONE, + FXFALSE, + FXFALSE); + /* + fxMesa->Glide.grTexAlphaCombineExt(FX_TMU0, + GR_CMBX_OTHER_TEXTURE_ALPHA, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + fxMesa->Glide.grTexColorCombineExt(FX_TMU0, + GR_CMBX_OTHER_TEXTURE_RGB, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + */ + + fxMesa->tmuSrc = FX_TMU1; + } + } +} + +static void +fxSetupTextureSingleTMUNapalm_NoLock(GLcontext * ctx, GLuint textureset) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GLuint unitsmode; + tfxTexInfo *ti; + struct gl_texture_object *tObj = ctx->Texture.Unit[textureset].Current2D; + int tmu; + + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s(%d)\n", __FUNCTION__, textureset); + } + + ti = fxTMGetTexInfo(tObj); + + fxTexValidate(ctx, tObj); + + fxSetupSingleTMU_NoLock(fxMesa, tObj); + + if (ti->whichTMU == FX_TMU_BOTH) + tmu = FX_TMU0; + else + tmu = ti->whichTMU; + if (fxMesa->tmuSrc != tmu) + fxSelectSingleTMUSrcNapalm_NoLock(fxMesa, tmu, ti->LODblend); + + if (textureset == 0 || !fxMesa->haveTwoTMUs) + unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL); + else + unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj); + +/* if(fxMesa->lastUnitsMode==unitsmode) */ +/* return; */ + + fxMesa->lastUnitsMode = unitsmode; + + fxMesa->stw_hint_state = 0; + FX_grHints_NoLock(GR_HINT_STWHINT, 0); + + if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) + fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode)); + + /* [dBorca] Hack alert: + * what if we're in split mode? (LODBlend) + */ + fxSetupTextureEnvNapalm_NoLock(ctx, textureset, tmu, GL_TRUE); +} + + +/************************* Double Texture Set ***************************/ + +static void +fxSetupTextureDoubleTMUNapalm_NoLock(GLcontext * ctx) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxTexInfo *ti0, *ti1; + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D; + GLuint unitsmode; + int tmu0 = 0, tmu1 = 1; + + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s(...)\n", __FUNCTION__); + } + + ti0 = fxTMGetTexInfo(tObj0); + fxTexValidate(ctx, tObj0); + + ti1 = fxTMGetTexInfo(tObj1); + fxTexValidate(ctx, tObj1); + + fxSetupDoubleTMU_NoLock(fxMesa, tObj0, tObj1); + + unitsmode = fxGetTexSetConfiguration(ctx, tObj0, tObj1); + +/* if(fxMesa->lastUnitsMode==unitsmode) */ +/* return; */ + + fxMesa->lastUnitsMode = unitsmode; + + fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1; + FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state); + + if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) + fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), + _mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); + + + if ((ti0->whichTMU == FX_TMU1) || (ti1->whichTMU == FX_TMU0)) { + tmu0 = 1; + tmu1 = 0; + } + fxMesa->tmuSrc = FX_TMU_BOTH; + + /* OpenGL vs Glide texture pipeline */ + /* [dBorca] Hack alert: + * TODO: revise this ASAP!!! + */ + fxSetupTextureEnvNapalm_NoLock(ctx, FX_TMU1 - tmu0, tmu0, tmu0 != 0); + fxSetupTextureEnvNapalm_NoLock(ctx, FX_TMU1 - tmu1, tmu1, tmu1 != 0); +} + +/************************* No Texture ***************************/ + +static void +fxSetupTextureNoneNapalm_NoLock(GLcontext * ctx) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + + if (TDFX_DEBUG & VERBOSE_DRIVER) { + fprintf(stderr, "%s(...)\n", __FUNCTION__); + } + + /* the combiner formula is: (A + B) * C + D + ** + ** a = tc_otherselect + ** a_mode = tc_invert_other + ** b = tc_localselect + ** b_mode = tc_invert_local + ** c = (tc_mselect, tc_mselect_7) + ** d = (tc_add_clocal, tc_add_alocal) + ** shift = tc_outshift + ** invert = tc_invert_output + */ + + fxMesa->Glide.grColorCombineExt(GR_CMBX_ITRGB, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + fxMesa->Glide.grAlphaCombineExt(GR_CMBX_ITALPHA, + GR_FUNC_MODE_X, + GR_CMBX_ZERO, + GR_FUNC_MODE_ZERO, + GR_CMBX_ZERO, + FXTRUE, + GR_CMBX_ZERO, + FXFALSE, + 0, + FXFALSE); + + fxMesa->lastUnitsMode = FX_UM_NONE; +} diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 648649c0328..90704e34793 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -1,5 +1,3 @@ -/* $Id: fxtexman.c,v 1.17 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -45,6 +43,7 @@ #include "fxdrv.h" int texSwaps = 0; +static FxU32 texBoundMask; #define FX_2MB_SPLIT 0x200000 @@ -120,30 +119,37 @@ fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end) fxCloseHardware(); exit(-1); } - result->next = NULL; } result->startAddr = start; result->endAddr = end; return result; } +#if 1 +#define fxTMDeleteRangeNode(fxMesa, range) \ + do { \ + range->next = fxMesa->tmPool; \ + fxMesa->tmPool = range; \ + } while (0); +#else static void fxTMDeleteRangeNode(fxMesaContext fxMesa, MemRange * range) { range->next = fxMesa->tmPool; fxMesa->tmPool = range; } +#endif static void fxTMUInit(fxMesaContext fxMesa, int tmu) { MemRange *tmn, *last; - FxU32 start, end, blockstart, blockend, boundary; + FxU32 start, end, blockstart, blockend, chunk; start = grTexMinAddress(tmu); end = grTexMaxAddress(tmu); - boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT; + chunk = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT; if (fxMesa->verbose) { fprintf(stderr, "Voodoo %s configuration:\n", @@ -152,7 +158,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu) (unsigned int) start); fprintf(stderr, "Voodoo Higher texture memory address (%u)\n", (unsigned int) end); - fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", boundary >> 20); + fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", chunk >> 20); } fxMesa->freeTexMem[tmu] = end - start; @@ -161,16 +167,18 @@ fxTMUInit(fxMesaContext fxMesa, int tmu) last = 0; blockstart = start; while (blockstart < end) { - if (blockstart + boundary > end) + if (blockstart + chunk > end) blockend = end; else - blockend = blockstart + boundary; + blockend = blockstart + chunk; if (fxMesa->verbose) fprintf(stderr, "Voodoo %07u-%07u\n", (unsigned int) blockstart, (unsigned int) blockend); tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend); + tmn->next = NULL; + if (last) last->next = tmn; @@ -178,7 +186,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu) fxMesa->tmFree[tmu] = tmn; last = tmn; - blockstart += boundary; + blockstart += chunk; } } @@ -189,6 +197,10 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size) int result; struct gl_texture_object *obj; + if (fxMesa->HaveTexUma) { + tmu = FX_TMU0; + } + while (1) { prev = 0; tmp = fxMesa->tmFree[tmu]; @@ -225,11 +237,37 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size) } } +int fxTMCheckStartAddr (fxMesaContext fxMesa, GLint tmu, tfxTexInfo *ti) +{ + MemRange *prev, *tmp; + int size; + struct gl_texture_object *obj; + + if (fxMesa->HaveTexUma) { + return FXTRUE; + } + + size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); + + tmp = fxMesa->tmFree[tmu]; + while (tmp) { + if (tmp->endAddr - tmp->startAddr >= size) { /* Fits here */ + return FXTRUE; + } + tmp = tmp->next; + } + + return FXFALSE; +} + static void fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range) { MemRange *tmp, *prev; - FxU32 boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? -1 : (FX_2MB_SPLIT - 1); + + if (fxMesa->HaveTexUma) { + tmu = FX_TMU0; + } if (range->startAddr == range->endAddr) { fxTMDeleteRangeNode(fxMesa, range); @@ -252,7 +290,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range) range->next = tmp; if (tmp) { if (range->endAddr == tmp->startAddr - && tmp->startAddr & boundary) { + && tmp->startAddr & texBoundMask) { /* Combine */ tmp->startAddr = range->startAddr; fxTMDeleteRangeNode(fxMesa, range); @@ -261,7 +299,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range) } if (prev) { if (prev->endAddr == range->startAddr - && range->startAddr & boundary) { + && range->startAddr & texBoundMask) { /* Combine */ prev->endAddr = range->endAddr; prev->next = range->next; @@ -312,7 +350,7 @@ fxTMFindOldestObject(fxMesaContext fxMesa, int tmu) } /* examine priority */ - if (obj->Priority < lowestPriority) { + if (tmp->Priority < lowestPriority) { lowestPriority = tmp->Priority; lowestPriorityObj = tmp; } @@ -320,8 +358,7 @@ fxTMFindOldestObject(fxMesaContext fxMesa, int tmu) tmp = tmp->Next; } - if (lowestPriority < 1.0) { - ASSERT(lowestPriorityObj); + if (lowestPriorityObj != NULL) { if (TDFX_DEBUG & VERBOSE_TEXTURE) { fprintf(stderr, "fxTMFindOldestObject: %d pri=%f\n", lowestPriorityObj->Name, lowestPriority); } @@ -521,7 +558,17 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj, } tmu = (int) ti->whichTMU; +#if 0 + /* [dBorca] + * We get here by (see Tex[Sub]Image2D), thus we are in TMU. + * Also, we just set the correct TMU above. fxTMMoveInTM will + * bail early, so don't bother... + */ fxTMMoveInTM(fxMesa, tObj, tmu); +#else + fxMesa->stats.reqTexUpload++; + fxMesa->stats.texUpload++; +#endif lodlevel = ti->info.largeLodLog2 - (level - ti->minLevel); @@ -749,10 +796,16 @@ fxTMInit(fxMesaContext fxMesa) fxMesa->texBindNumber = 0; fxMesa->tmPool = 0; + if (fxMesa->HaveTexUma) { + grEnable(GR_TEXTURE_UMA_EXT); + } + fxTMUInit(fxMesa, FX_TMU0); - if (fxMesa->haveTwoTMUs) + if (!fxMesa->HaveTexUma && fxMesa->haveTwoTMUs) fxTMUInit(fxMesa, FX_TMU1); + + texBoundMask = (fxMesa->type >= GR_SSTTYPE_Banshee) ? -1 : (FX_2MB_SPLIT - 1); } void diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c index 3c6f51a3264..08ecc6dd81b 100644 --- a/src/mesa/drivers/glide/fxtris.c +++ b/src/mesa/drivers/glide/fxtris.c @@ -1,5 +1,3 @@ -/* $Id: fxtris.c,v 1.24 2003/10/02 17:36:44 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -332,7 +330,7 @@ do { \ #define LOCAL_VARS(n) \ fxMesaContext fxMesa = FX_CONTEXT(ctx); \ GLubyte color[n][4]; \ - (void) color; + (void) color; @@ -532,6 +530,7 @@ static void init_rast_tab( void ) /* Accelerate vertex buffer rendering when renderindex == 0 and * there is no clipping. */ +#define INIT(x) fxRenderPrimitive( ctx, x ) static void fx_render_vb_points( GLcontext *ctx, GLuint start, @@ -547,7 +546,7 @@ static void fx_render_vb_points( GLcontext *ctx, fprintf(stderr, "fx_render_vb_points\n"); } - fxRenderPrimitive(ctx, GL_POINTS); + INIT(GL_POINTS); /* Adjust point coords */ for (i = start; i < count; i++) { @@ -578,7 +577,7 @@ static void fx_render_vb_line_strip( GLcontext *ctx, fprintf(stderr, "fx_render_vb_line_strip\n"); } - fxRenderPrimitive(ctx, GL_LINE_STRIP); + INIT(GL_LINE_STRIP); /* adjust line coords */ for (i = start; i < count; i++) { @@ -611,7 +610,7 @@ static void fx_render_vb_line_loop( GLcontext *ctx, fprintf(stderr, "fx_render_vb_line_loop\n"); } - fxRenderPrimitive(ctx, GL_LINE_LOOP); + INIT(GL_LINE_LOOP); if (!(flags & PRIM_BEGIN)) { j++; @@ -651,7 +650,7 @@ static void fx_render_vb_lines( GLcontext *ctx, fprintf(stderr, "fx_render_vb_lines\n"); } - fxRenderPrimitive(ctx, GL_LINES); + INIT(GL_LINES); /* adjust line coords */ for (i = start; i < count; i++) { @@ -682,7 +681,7 @@ static void fx_render_vb_triangles( GLcontext *ctx, fprintf(stderr, "fx_render_vb_triangles\n"); } - fxRenderPrimitive(ctx, GL_TRIANGLES); + INIT(GL_TRIANGLES); #if 0 /* [dBorca] @@ -718,7 +717,7 @@ static void fx_render_vb_tri_strip( GLcontext *ctx, fprintf(stderr, "fx_render_vb_tri_strip\n"); } - fxRenderPrimitive(ctx, GL_TRIANGLE_STRIP); + INIT(GL_TRIANGLE_STRIP); if (flags & PRIM_PARITY) mode = GR_TRIANGLE_STRIP_CONTINUE; @@ -743,7 +742,7 @@ static void fx_render_vb_tri_fan( GLcontext *ctx, fprintf(stderr, "fx_render_vb_tri_fan\n"); } - fxRenderPrimitive(ctx, GL_TRIANGLE_FAN); + INIT(GL_TRIANGLE_FAN); grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start, fxVB + start, sizeof(GrVertex) ); @@ -763,7 +762,7 @@ static void fx_render_vb_quads( GLcontext *ctx, fprintf(stderr, "fx_render_vb_quads\n"); } - fxRenderPrimitive(ctx, GL_QUADS); + INIT(GL_QUADS); for (i = start ; i < count-3 ; i += 4 ) { #define VERT(x) (fxVB + (x)) @@ -786,7 +785,7 @@ static void fx_render_vb_quad_strip( GLcontext *ctx, fprintf(stderr, "fx_render_vb_quad_strip\n"); } - fxRenderPrimitive(ctx, GL_QUAD_STRIP); + INIT(GL_QUAD_STRIP); count -= (count-start)&1; @@ -807,7 +806,7 @@ static void fx_render_vb_poly( GLcontext *ctx, fprintf(stderr, "fx_render_vb_poly\n"); } - fxRenderPrimitive(ctx, GL_POLYGON); + INIT(GL_POLYGON); grDrawVertexArrayContiguous( GR_POLYGON, count-start, fxVB + start, sizeof(GrVertex)); @@ -838,6 +837,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *, fx_render_vb_poly, fx_render_vb_noop, }; +#undef INIT(x) /**********************************************************************/ @@ -1026,11 +1026,24 @@ static void fxRunPipeline( GLcontext *ctx ) fprintf(stderr, "fxRunPipeline()\n"); } +#if 0 /* Recalculate fog table on projection matrix changes. This used to * be triggered by the NearFar callback. */ if (new_gl_state & _NEW_PROJECTION) fxMesa->new_state |= FX_NEW_FOG; + /* [dBorca] Hack alert: + * the above _NEW_PROJECTION is not included in the test below, + * so we may end up with fxMesa->new_state still dirty by the end + * of the routine. The fact is, we don't have NearFar callback + * anymore. We could use fxDDDepthRange instead, but it seems + * fog needs to be updated only by a fog-basis. + * Implementing fxDDDepthRange correctly is another story: + * that, together with a presumable fxDDViewport function would set + * fxMesa->SetupNewInputs |= VERT_BIT_CLIP; + * which might be useful in fxBuildVertices... + */ +#endif if (new_gl_state & (_FX_NEW_IS_IN_HARDWARE | _FX_NEW_RENDERSTATE | @@ -1097,8 +1110,6 @@ static GLenum reduced_prim[GL_POLYGON+1] = { */ static void fxRasterPrimitive( GLcontext *ctx, GLenum prim ) { - extern void fxSetupCull (GLcontext *ctx); - fxMesaContext fxMesa = FX_CONTEXT( ctx ); fxMesa->raster_primitive = prim; @@ -1176,7 +1187,7 @@ void fxCheckIsInHardware( GLcontext *ctx ) if (newfallback) { if (oldfallback == 0) { if (fxMesa->verbose) { - fprintf(stderr, "Voodoo ! begin SW 0x08%x %s\n", newfallback, getFallbackString(newfallback)); + fprintf(stderr, "Voodoo ! enter SW 0x%08x %s\n", newfallback, getFallbackString(newfallback)); } _swsetup_Wakeup( ctx ); } @@ -1197,7 +1208,7 @@ void fxCheckIsInHardware( GLcontext *ctx ) fxChooseVertexState(ctx); fxDDChooseRenderState(ctx); if (fxMesa->verbose) { - fprintf(stderr, "Voodoo ! end SW 0x08%x %s\n", oldfallback, getFallbackString(oldfallback)); + fprintf(stderr, "Voodoo ! leave SW 0x%08x %s\n", oldfallback, getFallbackString(oldfallback)); } } } diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 2923530d466..8d3647ad60e 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -1,5 +1,3 @@ -/* $Id: fxvb.c,v 1.19.2.1 2003/11/21 13:40:21 keithw Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -118,7 +116,7 @@ static void interp_extras( GLcontext *ctx, GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], out), GET_COLOR(VB->ColorPtr[1], in) ); -#if 0 /* [dBorca] leaving disabled for now */ +#if 1 /* [dBorca] GL_EXT_separate_specular_color */ if (VB->SecondaryColorPtr[1]) { INTERP_3CHAN( t, GET_COLOR(VB->SecondaryColorPtr[1], dst), @@ -143,7 +141,7 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) if (VB->ColorPtr[1]) { COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], src) ); -#if 0 /* [dBorca] leaving disabled for now */ +#if 1 /* [dBorca] GL_EXT_separate_specular_color */ if (VB->SecondaryColorPtr[1]) { COPY_CHAN4( GET_COLOR(VB->SecondaryColorPtr[1], dst), GET_COLOR(VB->SecondaryColorPtr[1], src) ); @@ -395,7 +393,7 @@ void fxFreeVB( GLcontext *ctx ) } if (fxMesa->UbyteColor.Ptr) { - ALIGN_FREE(fxMesa->UbyteColor.Ptr); + ALIGN_FREE((void *)fxMesa->UbyteColor.Ptr); fxMesa->UbyteColor.Ptr = 0; } } diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index d1a022ff5e4..7d5741cd75d 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -1,5 +1,3 @@ -/* $Id: fxvbtmp.h,v 1.13 2003/10/02 17:36:45 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.1 @@ -29,6 +27,10 @@ */ +#define VIEWPORT_X(dst,x) dst = s[0] * x + s[12] +#define VIEWPORT_Y(dst,y) dst = s[5] * y + s[13] +#define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14] + static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, void *dest ) @@ -89,9 +91,9 @@ static void TAG(emit)( GLcontext *ctx, if (IND & SETUP_XYZW) { if (mask[i] == 0) { /* unclipped */ - v->x = s[0] * proj[0][0] + s[12]; - v->y = s[5] * proj[0][1] + s[13]; - v->ooz = s[10] * proj[0][2] + s[14]; + VIEWPORT_X(v->x, proj[0][0]); + VIEWPORT_Y(v->y, proj[0][1]); + VIEWPORT_Z(v->ooz, proj[0][2]); v->oow = proj[0][3]; } else { /* clipped */ @@ -122,32 +124,24 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & SETUP_TMU0) { GLfloat w = v->oow; + v->tmuvtx[0].sow = tc0[0][0] * u0scale * w; + v->tmuvtx[0].tow = tc0[0][1] * v0scale * w; if (IND & SETUP_PTEX) { - v->tmuvtx[0].sow = tc0[0][0] * u0scale * w; - v->tmuvtx[0].tow = tc0[0][1] * v0scale * w; v->tmuvtx[0].oow = w; if (tc0_size == 4) - v->tmuvtx[0].oow = tc0[0][3] * w; - } - else { - v->tmuvtx[0].sow = tc0[0][0] * u0scale * w; - v->tmuvtx[0].tow = tc0[0][1] * v0scale * w; + v->tmuvtx[0].oow *= tc0[0][3]; } tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride); } if (IND & SETUP_TMU1) { GLfloat w = v->oow; + v->tmuvtx[1].sow = tc1[0][0] * u1scale * w; + v->tmuvtx[1].tow = tc1[0][1] * v1scale * w; if (IND & SETUP_PTEX) { - v->tmuvtx[1].sow = tc1[0][0] * u1scale * w; - v->tmuvtx[1].tow = tc1[0][1] * v1scale * w; v->tmuvtx[1].oow = w; if (tc1_size == 4) - v->tmuvtx[1].oow = tc1[0][3] * w; + v->tmuvtx[1].oow *= tc1[0][3]; } - else { - v->tmuvtx[1].sow = tc1[0][0] * u1scale * w; - v->tmuvtx[1].tow = tc1[0][1] * v1scale * w; - } tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride); } } @@ -197,9 +191,9 @@ static void TAG(interp)( GLcontext *ctx, const GLfloat wout = 1.0F / out->oow; const GLfloat win = 1.0F / in->oow; - dst->x = s[0] * dstclip[0] * oow + s[12]; - dst->y = s[5] * dstclip[1] * oow + s[13]; - dst->ooz = s[10] * dstclip[2] * oow + s[14]; + VIEWPORT_X(dst->x, dstclip[0] * oow); + VIEWPORT_Y(dst->y, dstclip[1] * oow); + VIEWPORT_Z(dst->ooz, dstclip[2] * oow); dst->oow = oow; if (IND & SETUP_SNAP) { diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index 1337585aec8..4609880f8d3 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -1,5 +1,3 @@ -/* $Id: fxwgl.c,v 1.18 2003/10/02 17:36:45 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0 @@ -59,6 +57,11 @@ extern "C" #define MAX_MESA_ATTRS 20 +#if (_MSC_VER >= 1200) +#pragma warning( push ) +#pragma warning( disable : 4273 ) +#endif + struct __extensions__ { PROC proc; @@ -71,7 +74,7 @@ struct __pixelformat__ GLint mesaAttr[MAX_MESA_ATTRS]; }; -//WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *); +WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *); struct __pixelformat__ pix[] = { /* 16bit RGB565 single buffer with depth */ @@ -166,53 +169,6 @@ struct __pixelformat__ pix[] = { FXMESA_NONE} } , -#if 1 - /* 24bit RGB888 single buffer with depth */ - { - {sizeof(PIXELFORMATDESCRIPTOR), 1, - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, - PFD_TYPE_RGBA, - 24, - 8, 0, 8, 8, 8, 16, 0, 0, - 0, 0, 0, 0, 0, - 24, - 8, - 0, - PFD_MAIN_PLANE, - 0, 0, 0, 0} - , - {FXMESA_COLORDEPTH, 32, - FXMESA_ALPHA_SIZE, 8, - FXMESA_DEPTH_SIZE, 24, - FXMESA_STENCIL_SIZE, 8, - FXMESA_ACCUM_SIZE, 0, - FXMESA_NONE} - } - , - /* 24bit RGB888 double buffer with depth */ - { - {sizeof(PIXELFORMATDESCRIPTOR), 1, - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | - PFD_DOUBLEBUFFER | PFD_SWAP_COPY, - PFD_TYPE_RGBA, - 24, - 8, 0, 8, 8, 8, 16, 0, 0, - 0, 0, 0, 0, 0, - 24, - 8, - 0, - PFD_MAIN_PLANE, - 0, 0, 0, 0} - , - {FXMESA_COLORDEPTH, 32, - FXMESA_DOUBLEBUFFER, - FXMESA_ALPHA_SIZE, 8, - FXMESA_DEPTH_SIZE, 24, - FXMESA_STENCIL_SIZE, 8, - FXMESA_ACCUM_SIZE, 0, - FXMESA_NONE} - }, -#endif /* 32bit ARGB8888 single buffer with depth */ { {sizeof(PIXELFORMATDESCRIPTOR), 1, @@ -365,7 +321,7 @@ wglCreateContext(HDC hdc) SetWindowLong(hWnd, GWL_WNDPROC, (LONG) __wglMonitor); } -#ifdef FX_DEBUG +#if FX_DEBUG freopen("MESA.LOG", "w", stderr); #endif @@ -915,7 +871,7 @@ wglDescribeLayerPlane(HDC hdc, int iPixelFormat, int iLayerPlane, GLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, - int cEntries, CONST COLORREF *pcr) + int cEntries, COLORREF *pcr) { SetLastError(0); return (FALSE); @@ -936,4 +892,8 @@ wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane, int iStart, return(FALSE); } +#if (_MSC_VER >= 1200) +#pragma warning( pop ) +#endif + #endif /* FX */ diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 4fd58f20273..67d72446b8d 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -682,16 +682,6 @@ hook_in_driver_functions( GLcontext *ctx ) ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; -#if FEATURE_ARB_vertex_buffer_object - ctx->Driver.NewBufferObject = _mesa_new_buffer_object; - ctx->Driver.DeleteBuffer = _mesa_delete_buffer_object; - ctx->Driver.BindBuffer = NULL; - ctx->Driver.BufferData = _mesa_buffer_data; - ctx->Driver.BufferSubData = _mesa_buffer_subdata; - ctx->Driver.MapBuffer = _mesa_buffer_map; - ctx->Driver.UnmapBuffer = NULL; -#endif - swdd->SetBuffer = set_buffer; /* RGB(A) span/pixel functions */ @@ -793,8 +783,9 @@ hook_in_driver_functions( GLcontext *ctx ) GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, OSMesaContext sharelist ) { + const GLint accumBits = (format == OSMESA_COLOR_INDEX) ? 0 : 16; return OSMesaCreateContextExt(format, DEFAULT_SOFTWARE_DEPTH_BITS, - 8, 16, sharelist); + 8, accumBits, sharelist); } diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 01b08e85094..f68e87fd190 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.1 2003/07/24 03:47:46 kschultz Exp $ */ +/* $Id: wmesa.c,v 1.1.2.1 2003/11/21 15:49:37 keithw Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -2247,7 +2247,14 @@ void RemoveContext(HWND hWnd) static LRESULT CALLBACK MyWndProc(HWND hwnd,UINT message,WPARAM wParam, LPARAM lParam) { - WMesaContext wc = Current->hwnd == hwnd ? Current : FindContext(hwnd); + WMesaContext wc; + + if (Current==0 || Current->hwnd != hwnd) + wc=FindContext(hwnd); + else + wc=Current; + + if( wc ) { LRESULT lret = CallWindowProc((WNDPROC)(wc->oldWndProc),hwnd,message,wParam,lParam); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index b6cb487c2e1..2ad5a156ff5 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -175,7 +175,7 @@ static int host_byte_order( void ) * Error handling. */ #ifndef XFree86Server -static int mesaXErrorFlag = 0; +static volatile int mesaXErrorFlag = 0; static int mesaHandleXError( XMesaDisplay *dpy, XErrorEvent *event ) { @@ -1775,7 +1775,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, int hw; if (v->mesa_visual.depthBits > 0) { attribs[numAttribs++] = FXMESA_DEPTH_SIZE; - attribs[numAttribs++] = 1; + attribs[numAttribs++] = v->mesa_visual.depthBits; } if (v->mesa_visual.doubleBufferMode) { attribs[numAttribs++] = FXMESA_DOUBLEBUFFER; @@ -1790,16 +1790,16 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } if (v->mesa_visual.alphaBits > 0) { attribs[numAttribs++] = FXMESA_ALPHA_SIZE; - attribs[numAttribs++] = 1; + attribs[numAttribs++] = v->mesa_visual.alphaBits; } if (1) { -#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with fxapi.c! */ attribs[numAttribs++] = FXMESA_SHARE_CONTEXT; attribs[numAttribs++] = (int) &(c->mesa); } attribs[numAttribs++] = FXMESA_NONE; - if ((hw = fxQueryHardware())==GR_SSTTYPE_VOODOO) { + /* [dBorca] need to revise this ASAP!!! */ + /*if ((hw = fxQueryHardware())==GR_SSTTYPE_VOODOO) { b->FXctx = fxMesaCreateBestContext(0, b->width, b->height, attribs); if ((v->undithered_pf!=PF_Index) && (b->backimage)) { b->FXisHackUsable = b->FXctx ? GL_TRUE : GL_FALSE; @@ -1809,7 +1809,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, b->FXwindowHack = GL_FALSE; } } - else { + else */{ if (fxEnvVar[0]=='w' || fxEnvVar[0]=='W') b->FXctx = fxMesaCreateContext(w, GR_RESOLUTION_NONE, GR_REFRESH_75Hz, attribs); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index a99c0d4b5fb..28e6154df4a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1015,16 +1015,6 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; -#if FEATURE_ARB_vertex_buffer_object - ctx->Driver.NewBufferObject = _mesa_new_buffer_object; - ctx->Driver.DeleteBuffer = _mesa_delete_buffer_object; - ctx->Driver.BindBuffer = NULL; - ctx->Driver.BufferData = _mesa_buffer_data; - ctx->Driver.BufferSubData = _mesa_buffer_subdata; - ctx->Driver.MapBuffer = _mesa_buffer_map; - ctx->Driver.UnmapBuffer = NULL; -#endif - /* Initialize the TNL driver interface: */ tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index bb014a0df39..36a610a4f98 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -40,7 +40,7 @@ #include "mtypes.h" #if defined(FX) #include "GL/fxmesa.h" -#include "FX/fxdrv.h" +#include "../glide/fxdrv.h" #endif diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index ca069e35f0d..305f71c28dd 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -6,716 +6,716 @@ struct _glapi_table { - void (*NewList)(GLuint list, GLenum mode); /* 0 */ - void (*EndList)(void); /* 1 */ - void (*CallList)(GLuint list); /* 2 */ - void (*CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */ - void (*DeleteLists)(GLuint list, GLsizei range); /* 4 */ - GLuint (*GenLists)(GLsizei range); /* 5 */ - void (*ListBase)(GLuint base); /* 6 */ - void (*Begin)(GLenum mode); /* 7 */ - void (*Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */ - void (*Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */ - void (*Color3bv)(const GLbyte * v); /* 10 */ - void (*Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */ - void (*Color3dv)(const GLdouble * v); /* 12 */ - void (*Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */ - void (*Color3fv)(const GLfloat * v); /* 14 */ - void (*Color3i)(GLint red, GLint green, GLint blue); /* 15 */ - void (*Color3iv)(const GLint * v); /* 16 */ - void (*Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */ - void (*Color3sv)(const GLshort * v); /* 18 */ - void (*Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */ - void (*Color3ubv)(const GLubyte * v); /* 20 */ - void (*Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */ - void (*Color3uiv)(const GLuint * v); /* 22 */ - void (*Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */ - void (*Color3usv)(const GLushort * v); /* 24 */ - void (*Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */ - void (*Color4bv)(const GLbyte * v); /* 26 */ - void (*Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */ - void (*Color4dv)(const GLdouble * v); /* 28 */ - void (*Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */ - void (*Color4fv)(const GLfloat * v); /* 30 */ - void (*Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */ - void (*Color4iv)(const GLint * v); /* 32 */ - void (*Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */ - void (*Color4sv)(const GLshort * v); /* 34 */ - void (*Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */ - void (*Color4ubv)(const GLubyte * v); /* 36 */ - void (*Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */ - void (*Color4uiv)(const GLuint * v); /* 38 */ - void (*Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */ - void (*Color4usv)(const GLushort * v); /* 40 */ - void (*EdgeFlag)(GLboolean flag); /* 41 */ - void (*EdgeFlagv)(const GLboolean * flag); /* 42 */ - void (*End)(void); /* 43 */ - void (*Indexd)(GLdouble c); /* 44 */ - void (*Indexdv)(const GLdouble * c); /* 45 */ - void (*Indexf)(GLfloat c); /* 46 */ - void (*Indexfv)(const GLfloat * c); /* 47 */ - void (*Indexi)(GLint c); /* 48 */ - void (*Indexiv)(const GLint * c); /* 49 */ - void (*Indexs)(GLshort c); /* 50 */ - void (*Indexsv)(const GLshort * c); /* 51 */ - void (*Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */ - void (*Normal3bv)(const GLbyte * v); /* 53 */ - void (*Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */ - void (*Normal3dv)(const GLdouble * v); /* 55 */ - void (*Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */ - void (*Normal3fv)(const GLfloat * v); /* 57 */ - void (*Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */ - void (*Normal3iv)(const GLint * v); /* 59 */ - void (*Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */ - void (*Normal3sv)(const GLshort * v); /* 61 */ - void (*RasterPos2d)(GLdouble x, GLdouble y); /* 62 */ - void (*RasterPos2dv)(const GLdouble * v); /* 63 */ - void (*RasterPos2f)(GLfloat x, GLfloat y); /* 64 */ - void (*RasterPos2fv)(const GLfloat * v); /* 65 */ - void (*RasterPos2i)(GLint x, GLint y); /* 66 */ - void (*RasterPos2iv)(const GLint * v); /* 67 */ - void (*RasterPos2s)(GLshort x, GLshort y); /* 68 */ - void (*RasterPos2sv)(const GLshort * v); /* 69 */ - void (*RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */ - void (*RasterPos3dv)(const GLdouble * v); /* 71 */ - void (*RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */ - void (*RasterPos3fv)(const GLfloat * v); /* 73 */ - void (*RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */ - void (*RasterPos3iv)(const GLint * v); /* 75 */ - void (*RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */ - void (*RasterPos3sv)(const GLshort * v); /* 77 */ - void (*RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */ - void (*RasterPos4dv)(const GLdouble * v); /* 79 */ - void (*RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */ - void (*RasterPos4fv)(const GLfloat * v); /* 81 */ - void (*RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */ - void (*RasterPos4iv)(const GLint * v); /* 83 */ - void (*RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */ - void (*RasterPos4sv)(const GLshort * v); /* 85 */ - void (*Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */ - void (*Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */ - void (*Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */ - void (*Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */ - void (*Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */ - void (*Rectiv)(const GLint * v1, const GLint * v2); /* 91 */ - void (*Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */ - void (*Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */ - void (*TexCoord1d)(GLdouble s); /* 94 */ - void (*TexCoord1dv)(const GLdouble * v); /* 95 */ - void (*TexCoord1f)(GLfloat s); /* 96 */ - void (*TexCoord1fv)(const GLfloat * v); /* 97 */ - void (*TexCoord1i)(GLint s); /* 98 */ - void (*TexCoord1iv)(const GLint * v); /* 99 */ - void (*TexCoord1s)(GLshort s); /* 100 */ - void (*TexCoord1sv)(const GLshort * v); /* 101 */ - void (*TexCoord2d)(GLdouble s, GLdouble t); /* 102 */ - void (*TexCoord2dv)(const GLdouble * v); /* 103 */ - void (*TexCoord2f)(GLfloat s, GLfloat t); /* 104 */ - void (*TexCoord2fv)(const GLfloat * v); /* 105 */ - void (*TexCoord2i)(GLint s, GLint t); /* 106 */ - void (*TexCoord2iv)(const GLint * v); /* 107 */ - void (*TexCoord2s)(GLshort s, GLshort t); /* 108 */ - void (*TexCoord2sv)(const GLshort * v); /* 109 */ - void (*TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */ - void (*TexCoord3dv)(const GLdouble * v); /* 111 */ - void (*TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */ - void (*TexCoord3fv)(const GLfloat * v); /* 113 */ - void (*TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */ - void (*TexCoord3iv)(const GLint * v); /* 115 */ - void (*TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */ - void (*TexCoord3sv)(const GLshort * v); /* 117 */ - void (*TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */ - void (*TexCoord4dv)(const GLdouble * v); /* 119 */ - void (*TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */ - void (*TexCoord4fv)(const GLfloat * v); /* 121 */ - void (*TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */ - void (*TexCoord4iv)(const GLint * v); /* 123 */ - void (*TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */ - void (*TexCoord4sv)(const GLshort * v); /* 125 */ - void (*Vertex2d)(GLdouble x, GLdouble y); /* 126 */ - void (*Vertex2dv)(const GLdouble * v); /* 127 */ - void (*Vertex2f)(GLfloat x, GLfloat y); /* 128 */ - void (*Vertex2fv)(const GLfloat * v); /* 129 */ - void (*Vertex2i)(GLint x, GLint y); /* 130 */ - void (*Vertex2iv)(const GLint * v); /* 131 */ - void (*Vertex2s)(GLshort x, GLshort y); /* 132 */ - void (*Vertex2sv)(const GLshort * v); /* 133 */ - void (*Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */ - void (*Vertex3dv)(const GLdouble * v); /* 135 */ - void (*Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */ - void (*Vertex3fv)(const GLfloat * v); /* 137 */ - void (*Vertex3i)(GLint x, GLint y, GLint z); /* 138 */ - void (*Vertex3iv)(const GLint * v); /* 139 */ - void (*Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */ - void (*Vertex3sv)(const GLshort * v); /* 141 */ - void (*Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */ - void (*Vertex4dv)(const GLdouble * v); /* 143 */ - void (*Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */ - void (*Vertex4fv)(const GLfloat * v); /* 145 */ - void (*Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */ - void (*Vertex4iv)(const GLint * v); /* 147 */ - void (*Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */ - void (*Vertex4sv)(const GLshort * v); /* 149 */ - void (*ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */ - void (*ColorMaterial)(GLenum face, GLenum mode); /* 151 */ - void (*CullFace)(GLenum mode); /* 152 */ - void (*Fogf)(GLenum pname, GLfloat param); /* 153 */ - void (*Fogfv)(GLenum pname, const GLfloat * params); /* 154 */ - void (*Fogi)(GLenum pname, GLint param); /* 155 */ - void (*Fogiv)(GLenum pname, const GLint * params); /* 156 */ - void (*FrontFace)(GLenum mode); /* 157 */ - void (*Hint)(GLenum target, GLenum mode); /* 158 */ - void (*Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */ - void (*Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */ - void (*Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */ - void (*Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */ - void (*LightModelf)(GLenum pname, GLfloat param); /* 163 */ - void (*LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */ - void (*LightModeli)(GLenum pname, GLint param); /* 165 */ - void (*LightModeliv)(GLenum pname, const GLint * params); /* 166 */ - void (*LineStipple)(GLint factor, GLushort pattern); /* 167 */ - void (*LineWidth)(GLfloat width); /* 168 */ - void (*Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */ - void (*Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */ - void (*Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */ - void (*Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */ - void (*PointSize)(GLfloat size); /* 173 */ - void (*PolygonMode)(GLenum face, GLenum mode); /* 174 */ - void (*PolygonStipple)(const GLubyte * mask); /* 175 */ - void (*Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */ - void (*ShadeModel)(GLenum mode); /* 177 */ - void (*TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */ - void (*TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */ - void (*TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */ - void (*TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */ - void (*TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */ - void (*TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */ - void (*TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */ - void (*TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */ - void (*TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */ - void (*TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */ - void (*TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */ - void (*TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */ - void (*TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */ - void (*TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */ - void (*TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */ - void (*TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */ - void (*FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */ - void (*SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */ - GLint (*RenderMode)(GLenum mode); /* 196 */ - void (*InitNames)(void); /* 197 */ - void (*LoadName)(GLuint name); /* 198 */ - void (*PassThrough)(GLfloat token); /* 199 */ - void (*PopName)(void); /* 200 */ - void (*PushName)(GLuint name); /* 201 */ - void (*DrawBuffer)(GLenum mode); /* 202 */ - void (*Clear)(GLbitfield mask); /* 203 */ - void (*ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */ - void (*ClearIndex)(GLfloat c); /* 205 */ - void (*ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */ - void (*ClearStencil)(GLint s); /* 207 */ - void (*ClearDepth)(GLclampd depth); /* 208 */ - void (*StencilMask)(GLuint mask); /* 209 */ - void (*ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */ - void (*DepthMask)(GLboolean flag); /* 211 */ - void (*IndexMask)(GLuint mask); /* 212 */ - void (*Accum)(GLenum op, GLfloat value); /* 213 */ - void (*Disable)(GLenum cap); /* 214 */ - void (*Enable)(GLenum cap); /* 215 */ - void (*Finish)(void); /* 216 */ - void (*Flush)(void); /* 217 */ - void (*PopAttrib)(void); /* 218 */ - void (*PushAttrib)(GLbitfield mask); /* 219 */ - void (*Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */ - void (*Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */ - void (*Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */ - void (*Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */ - void (*MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */ - void (*MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */ - void (*MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */ - void (*MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */ - void (*EvalCoord1d)(GLdouble u); /* 228 */ - void (*EvalCoord1dv)(const GLdouble * u); /* 229 */ - void (*EvalCoord1f)(GLfloat u); /* 230 */ - void (*EvalCoord1fv)(const GLfloat * u); /* 231 */ - void (*EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */ - void (*EvalCoord2dv)(const GLdouble * u); /* 233 */ - void (*EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */ - void (*EvalCoord2fv)(const GLfloat * u); /* 235 */ - void (*EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */ - void (*EvalPoint1)(GLint i); /* 237 */ - void (*EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */ - void (*EvalPoint2)(GLint i, GLint j); /* 239 */ - void (*AlphaFunc)(GLenum func, GLclampf ref); /* 240 */ - void (*BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */ - void (*LogicOp)(GLenum opcode); /* 242 */ - void (*StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */ - void (*StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */ - void (*DepthFunc)(GLenum func); /* 245 */ - void (*PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */ - void (*PixelTransferf)(GLenum pname, GLfloat param); /* 247 */ - void (*PixelTransferi)(GLenum pname, GLint param); /* 248 */ - void (*PixelStoref)(GLenum pname, GLfloat param); /* 249 */ - void (*PixelStorei)(GLenum pname, GLint param); /* 250 */ - void (*PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */ - void (*PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */ - void (*PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */ - void (*ReadBuffer)(GLenum mode); /* 254 */ - void (*CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */ - void (*ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */ - void (*DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */ - void (*GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */ - void (*GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */ - void (*GetDoublev)(GLenum pname, GLdouble * params); /* 260 */ - GLenum (*GetError)(void); /* 261 */ - void (*GetFloatv)(GLenum pname, GLfloat * params); /* 262 */ - void (*GetIntegerv)(GLenum pname, GLint * params); /* 263 */ - void (*GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */ - void (*GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */ - void (*GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */ - void (*GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */ - void (*GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */ - void (*GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */ - void (*GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */ - void (*GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */ - void (*GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */ - void (*GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */ - void (*GetPolygonStipple)(GLubyte * mask); /* 274 */ - const GLubyte * (*GetString)(GLenum name); /* 275 */ - void (*GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */ - void (*GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */ - void (*GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */ - void (*GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */ - void (*GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */ - void (*GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */ - void (*GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */ - void (*GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */ - void (*GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */ - void (*GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ - GLboolean (*IsEnabled)(GLenum cap); /* 286 */ - GLboolean (*IsList)(GLuint list); /* 287 */ - void (*DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ - void (*Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ - void (*LoadIdentity)(void); /* 290 */ - void (*LoadMatrixf)(const GLfloat * m); /* 291 */ - void (*LoadMatrixd)(const GLdouble * m); /* 292 */ - void (*MatrixMode)(GLenum mode); /* 293 */ - void (*MultMatrixf)(const GLfloat * m); /* 294 */ - void (*MultMatrixd)(const GLdouble * m); /* 295 */ - void (*Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */ - void (*PopMatrix)(void); /* 297 */ - void (*PushMatrix)(void); /* 298 */ - void (*Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */ - void (*Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */ - void (*Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */ - void (*Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */ - void (*Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */ - void (*Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */ - void (*Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */ - void (*ArrayElement)(GLint i); /* 306 */ - void (*BindTexture)(GLenum target, GLuint texture); /* 307 */ - void (*ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */ - void (*DisableClientState)(GLenum array); /* 309 */ - void (*DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */ - void (*DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */ - void (*EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */ - void (*EnableClientState)(GLenum array); /* 313 */ - void (*IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */ - void (*Indexub)(GLubyte c); /* 315 */ - void (*Indexubv)(const GLubyte * c); /* 316 */ - void (*InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */ - void (*NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */ - void (*PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */ - void (*TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */ - void (*VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */ - GLboolean (*AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */ - void (*CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */ - void (*CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */ - void (*CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */ - void (*CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ - void (*DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ - void (*GenTextures)(GLsizei n, GLuint * textures); /* 328 */ - void (*GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ - GLboolean (*IsTexture)(GLuint texture); /* 330 */ - void (*PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ - void (*TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ - void (*TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */ - void (*PopClientAttrib)(void); /* 334 */ - void (*PushClientAttrib)(GLbitfield mask); /* 335 */ - void (*BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */ - void (*BlendEquation)(GLenum mode); /* 337 */ - void (*DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */ - void (*ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */ - void (*ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */ - void (*ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */ - void (*CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */ - void (*GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */ - void (*GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */ - void (*GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */ - void (*ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */ - void (*CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */ - void (*ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */ - void (*ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */ - void (*ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */ - void (*ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */ - void (*ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */ - void (*ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */ - void (*CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */ - void (*CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */ - void (*GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */ - void (*GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */ - void (*GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */ - void (*GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */ - void (*SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */ - void (*GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */ - void (*GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */ - void (*GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */ - void (*GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */ - void (*GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */ - void (*GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */ - void (*Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */ - void (*Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ - void (*ResetHistogram)(GLenum target); /* 369 */ - void (*ResetMinmax)(GLenum target); /* 370 */ - void (*TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ - void (*TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ - void (*CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ - void (*ActiveTextureARB)(GLenum texture); /* 374 */ - void (*ClientActiveTextureARB)(GLenum texture); /* 375 */ - void (*MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */ - void (*MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */ - void (*MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */ - void (*MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */ - void (*MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */ - void (*MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */ - void (*MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */ - void (*MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */ - void (*MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */ - void (*MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */ - void (*MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */ - void (*MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */ - void (*MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */ - void (*MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */ - void (*MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */ - void (*MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */ - void (*MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */ - void (*MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */ - void (*MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */ - void (*MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */ - void (*MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */ - void (*MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */ - void (*MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */ - void (*MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */ - void (*MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */ - void (*MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */ - void (*MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */ - void (*MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */ - void (*MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */ - void (*MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */ - void (*MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */ - void (*MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */ - void (*LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */ - void (*LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */ - void (*MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ - void (*MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ - void (*SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ - void (*__unused413)(void); /* 413 */ - void (*PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ - void (*GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ - void (*TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ - void (*GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */ - void (*GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */ - void (*GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */ - void (*GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */ - void (*GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */ - void (*GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */ - void (*GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */ - void (*GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */ - void (*GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */ - void (*GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */ - void (*GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */ - void (*GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */ - void (*GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */ - void (*PixelTexGenSGIX)(GLenum mode); /* 430 */ - void (*PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */ - void (*PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */ - void (*PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */ - void (*PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ - void (*GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ - void (*GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ - void (*TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ - void (*TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ - GLboolean (*AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */ - void (*GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */ - GLboolean (*IsTextureEXT)(GLuint texture); /* 441 */ - void (*DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */ - void (*GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */ - void (*SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */ - void (*GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */ - void (*SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */ - void (*SamplePatternSGIS)(GLenum pattern); /* 447 */ - void (*ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */ - void (*EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */ - void (*IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */ - void (*NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */ - void (*TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */ - void (*VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */ - void (*SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */ - void (*SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */ - void (*SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */ - void (*SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */ - void (*PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */ - void (*PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */ - GLint (*GetInstrumentsSGIX)(void); /* 460 */ - void (*InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */ - GLint (*PollInstrumentsSGIX)(GLint * marker_p); /* 462 */ - void (*ReadInstrumentsSGIX)(GLint marker); /* 463 */ - void (*StartInstrumentsSGIX)(void); /* 464 */ - void (*StopInstrumentsSGIX)(GLint marker); /* 465 */ - void (*FrameZoomSGIX)(GLint factor); /* 466 */ - void (*TagSampleBufferSGIX)(void); /* 467 */ - void (*ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */ - void (*FlushRasterSGIX)(void); /* 469 */ - void (*GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */ - void (*GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */ - void (*ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */ - void (*ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */ - void (*ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */ - void (*ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */ - void (*FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */ - void (*FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */ - void (*FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */ - void (*FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */ - void (*FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */ - void (*FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */ - void (*FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */ - void (*FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */ - void (*FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */ - void (*FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */ - void (*FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */ - void (*FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */ - void (*FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */ - void (*GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */ - void (*GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */ - void (*GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */ - void (*GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */ - void (*LightEnviSGIX)(GLenum pname, GLint param); /* 493 */ - void (*VertexWeightfEXT)(GLfloat weight); /* 494 */ - void (*VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ - void (*VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ - void (*FlushVertexArrayRangeNV)(void); /* 497 */ - void (*VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ - void (*CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ - void (*CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ - void (*CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ - void (*CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */ - void (*CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */ - void (*CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */ - void (*FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */ - void (*GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */ - void (*GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */ - void (*GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */ - void (*GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */ - void (*GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */ - void (*GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */ - void (*ResizeBuffersMESA)(void); /* 512 */ - void (*WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */ - void (*WindowPos2dvMESA)(const GLdouble * v); /* 514 */ - void (*WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */ - void (*WindowPos2fvMESA)(const GLfloat * v); /* 516 */ - void (*WindowPos2iMESA)(GLint x, GLint y); /* 517 */ - void (*WindowPos2ivMESA)(const GLint * v); /* 518 */ - void (*WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */ - void (*WindowPos2svMESA)(const GLshort * v); /* 520 */ - void (*WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */ - void (*WindowPos3dvMESA)(const GLdouble * v); /* 522 */ - void (*WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */ - void (*WindowPos3fvMESA)(const GLfloat * v); /* 524 */ - void (*WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */ - void (*WindowPos3ivMESA)(const GLint * v); /* 526 */ - void (*WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */ - void (*WindowPos3svMESA)(const GLshort * v); /* 528 */ - void (*WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */ - void (*WindowPos4dvMESA)(const GLdouble * v); /* 530 */ - void (*WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */ - void (*WindowPos4fvMESA)(const GLfloat * v); /* 532 */ - void (*WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */ - void (*WindowPos4ivMESA)(const GLint * v); /* 534 */ - void (*WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */ - void (*WindowPos4svMESA)(const GLshort * v); /* 536 */ - void (*BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */ - void (*IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */ - void (*IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */ - void (*LockArraysEXT)(GLint first, GLsizei count); /* 540 */ - void (*UnlockArraysEXT)(void); /* 541 */ - void (*CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */ - void (*CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */ - void (*HintPGI)(GLenum target, GLint mode); /* 544 */ - void (*FogCoordfEXT)(GLfloat coord); /* 545 */ - void (*FogCoordfvEXT)(const GLfloat * coord); /* 546 */ - void (*FogCoorddEXT)(GLdouble coord); /* 547 */ - void (*FogCoorddvEXT)(const GLdouble * coord); /* 548 */ - void (*FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */ - void (*GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ - void (*GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ - void (*GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ - void (*TbufferMask3DFX)(GLuint mask); /* 553 */ - void (*CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ - void (*CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ - void (*CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ - void (*CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ - void (*CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ - void (*CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ - void (*GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */ - void (*SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */ - void (*SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */ - void (*SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */ - void (*SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */ - void (*SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */ - void (*SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */ - void (*SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */ - void (*SecondaryColor3ivEXT)(const GLint * v); /* 568 */ - void (*SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */ - void (*SecondaryColor3svEXT)(const GLshort * v); /* 570 */ - void (*SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */ - void (*SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */ - void (*SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */ - void (*SecondaryColor3uivEXT)(const GLuint * v); /* 574 */ - void (*SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ - void (*SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ - void (*SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ - GLboolean (*AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ - void (*BindProgramNV)(GLenum target, GLuint id); /* 579 */ - void (*DeleteProgramsNV)(GLsizei n, const GLuint * ids); /* 580 */ - void (*ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ - void (*GenProgramsNV)(GLsizei n, GLuint * ids); /* 582 */ - void (*GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ - void (*GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ - void (*GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ - void (*GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ - void (*GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ - void (*GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ - void (*GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ - void (*GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 590 */ - void (*GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 591 */ - GLboolean (*IsProgramNV)(GLuint id); /* 592 */ - void (*LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ - void (*ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ - void (*ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ - void (*ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ - void (*ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ - void (*ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ - void (*ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ - void (*RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ - void (*TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ - void (*VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ - void (*VertexAttrib1dNV)(GLuint index, GLdouble x); /* 603 */ - void (*VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 604 */ - void (*VertexAttrib1fNV)(GLuint index, GLfloat x); /* 605 */ - void (*VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 606 */ - void (*VertexAttrib1sNV)(GLuint index, GLshort x); /* 607 */ - void (*VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 608 */ - void (*VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 609 */ - void (*VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 610 */ - void (*VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 611 */ - void (*VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 612 */ - void (*VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 613 */ - void (*VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 614 */ - void (*VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ - void (*VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 616 */ - void (*VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ - void (*VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 618 */ - void (*VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ - void (*VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 620 */ - void (*VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ - void (*VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 622 */ - void (*VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ - void (*VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 624 */ - void (*VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ - void (*VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 626 */ - void (*VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ - void (*VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 628 */ - void (*VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ - void (*VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ - void (*VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ - void (*VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ - void (*VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ - void (*VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ - void (*VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ - void (*VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ - void (*VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ - void (*VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ - void (*VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ - void (*VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ - void (*VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ - void (*PointParameteriNV)(GLenum pname, GLint params); /* 642 */ - void (*PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ - void (*MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ - void (*MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ - void (*ActiveStencilFaceEXT)(GLenum face); /* 646 */ - void (*DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ - void (*GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ - GLboolean (*IsFenceNV)(GLuint fence); /* 649 */ - GLboolean (*TestFenceNV)(GLuint fence); /* 650 */ - void (*GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ - void (*FinishFenceNV)(GLuint fence); /* 652 */ - void (*SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ - void (*VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 654 */ - void (*VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 655 */ - void (*VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 656 */ - void (*VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 657 */ - void (*VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 658 */ - void (*VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 659 */ - void (*VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 660 */ - void (*VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 661 */ - void (*VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 662 */ - void (*VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 663 */ - void (*VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 664 */ - void (*EnableVertexAttribArrayARB)(GLuint index); /* 665 */ - void (*DisableVertexAttribArrayARB)(GLuint index); /* 666 */ - void (*ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 667 */ - void (*ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ - void (*ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 669 */ - void (*ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ - void (*ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 671 */ - void (*ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 672 */ - void (*ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 673 */ - void (*ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 674 */ - void (*ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 675 */ - void (*GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 676 */ - void (*GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 677 */ - void (*GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 678 */ - void (*GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 679 */ - void (*GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 680 */ - void (*GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 681 */ - void (*ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 682 */ - void (*ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 683 */ - void (*ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 684 */ - void (*ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 685 */ - void (*GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 686 */ - void (*GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 687 */ - void (*BindBufferARB)(GLenum target, GLuint buffer); /* 688 */ - void (*BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 689 */ - void (*BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 690 */ - void (*DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 691 */ - void (*GenBuffersARB)(GLsizei n, GLuint * buffer); /* 692 */ - void (*GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 693 */ - void (*GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 694 */ - void (*GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); /* 695 */ - GLboolean (*IsBufferARB)(GLuint buffer); /* 696 */ - void * (*MapBufferARB)(GLenum target, GLenum access); /* 697 */ - GLboolean (*UnmapBufferARB)(GLenum target); /* 698 */ - void (*DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 699 */ - void (*GenQueriesARB)(GLsizei n, GLuint * ids); /* 700 */ - void (*DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 701 */ - GLboolean (*IsQueryARB)(GLuint id); /* 702 */ - void (*BeginQueryARB)(GLenum target, GLuint id); /* 703 */ - void (*EndQueryARB)(GLenum target); /* 704 */ - void (*GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 705 */ - void (*GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 706 */ - void (*GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 707 */ - void (*MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 708 */ - void (*MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 709 */ + void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */ + void (GLAPIENTRYP EndList)(void); /* 1 */ + void (GLAPIENTRYP CallList)(GLuint list); /* 2 */ + void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */ + void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */ + GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */ + void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */ + void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */ + void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */ + void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */ + void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */ + void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */ + void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */ + void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */ + void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */ + void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */ + void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */ + void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */ + void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */ + void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */ + void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */ + void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */ + void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */ + void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */ + void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */ + void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */ + void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */ + void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */ + void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */ + void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */ + void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */ + void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */ + void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */ + void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */ + void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */ + void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */ + void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */ + void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */ + void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */ + void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */ + void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */ + void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */ + void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */ + void (GLAPIENTRYP End)(void); /* 43 */ + void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */ + void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */ + void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */ + void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */ + void (GLAPIENTRYP Indexi)(GLint c); /* 48 */ + void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */ + void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */ + void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */ + void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */ + void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */ + void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */ + void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */ + void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */ + void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */ + void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */ + void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */ + void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */ + void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */ + void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */ + void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */ + void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */ + void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */ + void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */ + void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */ + void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */ + void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */ + void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */ + void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */ + void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */ + void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */ + void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */ + void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */ + void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */ + void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */ + void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */ + void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */ + void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */ + void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */ + void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */ + void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */ + void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */ + void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */ + void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */ + void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */ + void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */ + void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */ + void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */ + void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */ + void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */ + void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */ + void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */ + void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */ + void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */ + void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */ + void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */ + void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */ + void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */ + void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */ + void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */ + void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */ + void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */ + void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */ + void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */ + void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */ + void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */ + void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */ + void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */ + void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */ + void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */ + void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */ + void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */ + void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */ + void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */ + void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */ + void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */ + void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */ + void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */ + void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */ + void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */ + void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */ + void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */ + void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */ + void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */ + void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */ + void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */ + void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */ + void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */ + void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */ + void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */ + void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */ + void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */ + void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */ + void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */ + void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */ + void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */ + void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */ + void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */ + void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */ + void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */ + void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */ + void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */ + void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */ + void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */ + void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */ + void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */ + void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */ + void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */ + void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */ + void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */ + void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */ + void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */ + void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */ + void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */ + void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */ + void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */ + void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */ + void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */ + void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */ + void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */ + void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */ + void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */ + void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */ + void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */ + void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */ + void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */ + void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */ + void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */ + void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */ + void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */ + void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */ + void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */ + void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */ + void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */ + void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */ + void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */ + void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */ + void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */ + void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */ + void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */ + void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */ + void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */ + void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */ + void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */ + void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */ + void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */ + void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */ + void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */ + void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */ + void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */ + void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */ + void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */ + void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */ + GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */ + void (GLAPIENTRYP InitNames)(void); /* 197 */ + void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */ + void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */ + void (GLAPIENTRYP PopName)(void); /* 200 */ + void (GLAPIENTRYP PushName)(GLuint name); /* 201 */ + void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */ + void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */ + void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */ + void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */ + void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */ + void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */ + void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */ + void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */ + void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */ + void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */ + void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */ + void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */ + void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */ + void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */ + void (GLAPIENTRYP Finish)(void); /* 216 */ + void (GLAPIENTRYP Flush)(void); /* 217 */ + void (GLAPIENTRYP PopAttrib)(void); /* 218 */ + void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */ + void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */ + void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */ + void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */ + void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */ + void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */ + void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */ + void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */ + void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */ + void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */ + void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */ + void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */ + void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */ + void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */ + void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */ + void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */ + void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */ + void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */ + void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */ + void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */ + void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */ + void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */ + void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */ + void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */ + void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */ + void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */ + void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */ + void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */ + void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */ + void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */ + void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */ + void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */ + void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */ + void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */ + void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */ + void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */ + void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */ + void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */ + void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */ + void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */ + void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */ + void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */ + GLenum (GLAPIENTRYP GetError)(void); /* 261 */ + void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */ + void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */ + void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */ + void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */ + void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */ + void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */ + void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */ + void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */ + void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */ + void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */ + void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */ + void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */ + void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */ + const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */ + void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */ + void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */ + void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */ + void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */ + void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */ + void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */ + void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */ + void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */ + void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */ + void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ + GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */ + GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */ + void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ + void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ + void (GLAPIENTRYP LoadIdentity)(void); /* 290 */ + void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */ + void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */ + void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */ + void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */ + void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */ + void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */ + void (GLAPIENTRYP PopMatrix)(void); /* 297 */ + void (GLAPIENTRYP PushMatrix)(void); /* 298 */ + void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */ + void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */ + void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */ + void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */ + void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */ + void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */ + void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */ + void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */ + void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */ + void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */ + void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */ + void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */ + void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */ + void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */ + void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */ + void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */ + void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */ + void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */ + void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */ + void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */ + void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */ + void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */ + void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */ + GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */ + void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */ + void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */ + void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */ + void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ + void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ + void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */ + void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ + GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */ + void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ + void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ + void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */ + void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */ + void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */ + void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */ + void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */ + void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */ + void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */ + void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */ + void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */ + void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */ + void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */ + void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */ + void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */ + void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */ + void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */ + void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */ + void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */ + void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */ + void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */ + void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */ + void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */ + void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */ + void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */ + void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */ + void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */ + void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */ + void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */ + void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */ + void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */ + void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */ + void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */ + void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */ + void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */ + void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */ + void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */ + void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ + void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */ + void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */ + void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ + void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ + void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ + void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */ + void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */ + void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */ + void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */ + void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */ + void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */ + void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */ + void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */ + void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */ + void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */ + void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */ + void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */ + void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */ + void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */ + void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */ + void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */ + void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */ + void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */ + void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */ + void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */ + void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */ + void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */ + void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */ + void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */ + void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */ + void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */ + void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */ + void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */ + void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */ + void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */ + void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */ + void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */ + void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */ + void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */ + void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */ + void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */ + void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ + void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ + void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ + void (GLAPIENTRYP __unused413)(void); /* 413 */ + void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ + void (GLAPIENTRYP GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ + void (GLAPIENTRYP TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ + void (GLAPIENTRYP GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */ + void (GLAPIENTRYP GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */ + void (GLAPIENTRYP GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */ + void (GLAPIENTRYP GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */ + void (GLAPIENTRYP GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */ + void (GLAPIENTRYP GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */ + void (GLAPIENTRYP GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */ + void (GLAPIENTRYP GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */ + void (GLAPIENTRYP GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */ + void (GLAPIENTRYP GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */ + void (GLAPIENTRYP GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */ + void (GLAPIENTRYP GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */ + void (GLAPIENTRYP GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 430 */ + void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */ + void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */ + void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */ + void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ + void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ + void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ + void (GLAPIENTRYP TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ + void (GLAPIENTRYP TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ + GLboolean (GLAPIENTRYP AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */ + void (GLAPIENTRYP GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */ + GLboolean (GLAPIENTRYP IsTextureEXT)(GLuint texture); /* 441 */ + void (GLAPIENTRYP DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */ + void (GLAPIENTRYP GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */ + void (GLAPIENTRYP SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */ + void (GLAPIENTRYP GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */ + void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */ + void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 447 */ + void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */ + void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */ + void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */ + void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */ + void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */ + void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */ + void (GLAPIENTRYP SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */ + void (GLAPIENTRYP SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */ + void (GLAPIENTRYP SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */ + void (GLAPIENTRYP SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */ + void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */ + void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */ + GLint (GLAPIENTRYP GetInstrumentsSGIX)(void); /* 460 */ + void (GLAPIENTRYP InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */ + GLint (GLAPIENTRYP PollInstrumentsSGIX)(GLint * marker_p); /* 462 */ + void (GLAPIENTRYP ReadInstrumentsSGIX)(GLint marker); /* 463 */ + void (GLAPIENTRYP StartInstrumentsSGIX)(void); /* 464 */ + void (GLAPIENTRYP StopInstrumentsSGIX)(GLint marker); /* 465 */ + void (GLAPIENTRYP FrameZoomSGIX)(GLint factor); /* 466 */ + void (GLAPIENTRYP TagSampleBufferSGIX)(void); /* 467 */ + void (GLAPIENTRYP ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */ + void (GLAPIENTRYP FlushRasterSGIX)(void); /* 469 */ + void (GLAPIENTRYP GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */ + void (GLAPIENTRYP GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */ + void (GLAPIENTRYP ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */ + void (GLAPIENTRYP ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */ + void (GLAPIENTRYP ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */ + void (GLAPIENTRYP ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */ + void (GLAPIENTRYP FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */ + void (GLAPIENTRYP FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */ + void (GLAPIENTRYP FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */ + void (GLAPIENTRYP FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */ + void (GLAPIENTRYP FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */ + void (GLAPIENTRYP FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */ + void (GLAPIENTRYP FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */ + void (GLAPIENTRYP FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */ + void (GLAPIENTRYP FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */ + void (GLAPIENTRYP FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */ + void (GLAPIENTRYP FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */ + void (GLAPIENTRYP FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */ + void (GLAPIENTRYP FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */ + void (GLAPIENTRYP GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */ + void (GLAPIENTRYP GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */ + void (GLAPIENTRYP GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */ + void (GLAPIENTRYP GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */ + void (GLAPIENTRYP LightEnviSGIX)(GLenum pname, GLint param); /* 493 */ + void (GLAPIENTRYP VertexWeightfEXT)(GLfloat weight); /* 494 */ + void (GLAPIENTRYP VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ + void (GLAPIENTRYP VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 497 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 512 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 514 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 516 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 517 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 518 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 520 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 522 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 524 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 526 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 528 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 530 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 532 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 534 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 536 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */ + void (GLAPIENTRYP IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */ + void (GLAPIENTRYP IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */ + void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 540 */ + void (GLAPIENTRYP UnlockArraysEXT)(void); /* 541 */ + void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */ + void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */ + void (GLAPIENTRYP HintPGI)(GLenum target, GLint mode); /* 544 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 545 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 546 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 547 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 548 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */ + void (GLAPIENTRYP GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ + void (GLAPIENTRYP GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ + void (GLAPIENTRYP GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ + void (GLAPIENTRYP TbufferMask3DFX)(GLuint mask); /* 553 */ + void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ + void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ + void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ + void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ + void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ + void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ + void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 568 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 570 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 574 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint id); /* 579 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * ids); /* 580 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * ids); /* 582 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 590 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 591 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint id); /* 592 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ + void (GLAPIENTRYP ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ + void (GLAPIENTRYP ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ + void (GLAPIENTRYP ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ + void (GLAPIENTRYP ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 603 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 604 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 605 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 606 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 607 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 608 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 609 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 610 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 611 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 612 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 613 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 614 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 616 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 618 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 620 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 622 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 624 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 626 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 628 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint params); /* 642 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 646 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 649 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 650 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 652 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ + void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 654 */ + void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 655 */ + void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 656 */ + void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 657 */ + void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 658 */ + void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 659 */ + void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 660 */ + void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 661 */ + void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 662 */ + void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 663 */ + void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 664 */ + void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 665 */ + void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 666 */ + void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 667 */ + void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ + void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 669 */ + void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ + void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 671 */ + void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 672 */ + void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 673 */ + void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 674 */ + void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 675 */ + void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 676 */ + void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 677 */ + void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 678 */ + void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 679 */ + void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 680 */ + void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 681 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 682 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 683 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 684 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 685 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 686 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 687 */ + void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 688 */ + void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 689 */ + void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 690 */ + void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 691 */ + void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 692 */ + void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 693 */ + void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 694 */ + void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); /* 695 */ + GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 696 */ + void * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 697 */ + GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 698 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 699 */ + void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 700 */ + void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 701 */ + GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 702 */ + void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 703 */ + void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 704 */ + void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 705 */ + void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 706 */ + void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 707 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 708 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 709 */ }; #endif diff --git a/src/mesa/glapi/gltable.py b/src/mesa/glapi/gltable.py index 54dacb18d2c..9fb57c86d18 100644 --- a/src/mesa/glapi/gltable.py +++ b/src/mesa/glapi/gltable.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# $Id: gltable.py,v 1.3 2001/11/18 22:42:57 brianp Exp $ +# $Id: gltable.py,v 1.3.14.1 2003/11/21 15:49:38 keithw Exp $ # Mesa 3-D graphics library # Version: 4.1 @@ -77,7 +77,7 @@ def PrintRecords(): pass prevk = int(k) (name, returnType, argList) = records[k] - print ' %s (*%s)(%s); /* %d */' % (returnType, name, argList, k) + print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (returnType, name, argList, k) #endef diff --git a/src/mesa/glapi/glx86asm.py b/src/mesa/glapi/glx86asm.py index f881abeea94..cd3123e673c 100644 --- a/src/mesa/glapi/glx86asm.py +++ b/src/mesa/glapi/glx86asm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# $Id: glx86asm.py,v 1.6 2002/06/11 01:26:58 brianp Exp $ +# $Id: glx86asm.py,v 1.6.14.1 2003/11/21 15:49:38 keithw Exp $ # Mesa 3-D graphics library # Version: 4.1 @@ -43,21 +43,24 @@ def PrintHead(): print '#include "glapioffsets.h"' print '' print '#ifndef __WIN32__' - print '' - print '#if defined(USE_MGL_NAMESPACE)' - print '#define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))' + print '' + print '#if defined(STDCALL_API)' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))' + print '#elif defined(USE_MGL_NAMESPACE)' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))' print '#else' - print '#define GL_PREFIX(n) GLNAME(CONCAT(gl,n))' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))' print '#endif' print '' print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))' print '' - print '#if defined(GNU_ASSEMBLER) && !defined(DJGPP)' + print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)' print '#define GLOBL_FN(x) GLOBL x ; .type x,@function' print '#else' print '#define GLOBL_FN(x) GLOBL x' print '#endif' print '' + print 'SEG_TEXT' print '' print 'EXTERN GLNAME(_glapi_Dispatch)' print '' @@ -83,6 +86,19 @@ def FindOffset(funcName): return -1 #enddef +# Find the size of the arguments on the stack for _stdcall name mangling +def FindStackSize(typeList): + result = 0 + for typ in typeList: + if typ == 'GLdouble' or typ == 'GLclampd': + result += 8; + else: + result += 4; + #endif + #endfor + return result +#enddef + def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset): argList = apiparser.MakeArgList(argTypeList, argNameList) if alias != '': @@ -104,18 +120,18 @@ def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset): # save this info in case we need to look up an alias later records.append((name, dispatchName, offset)) + # Find the argument stack size for _stdcall name mangling + stackSize = FindStackSize(argTypeList) + # print the assembly code print 'ALIGNTEXT16' - print "GLOBL_FN(GL_PREFIX(%s))" % (name) - print "GL_PREFIX(%s):" % (name) + print "GLOBL_FN(GL_PREFIX(%s,%s@%s))" % (name, name, stackSize) + print "GL_PREFIX(%s,%s@%s):" % (name, name, stackSize) print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)' print "\tJMP(GL_OFFSET(_gloffset_%s))" % (dispatchName) print '' - #enddef - - PrintHead() apiparser.ProcessSpecFile("APIspec", EmitFunction) PrintTail() diff --git a/src/mesa/main/Makefile.OSMesa16 b/src/mesa/main/Makefile.OSMesa16 deleted file mode 100644 index 206c4d9376e..00000000000 --- a/src/mesa/main/Makefile.OSMesa16 +++ /dev/null @@ -1,221 +0,0 @@ - -# Mesa 3-D graphics library -# Version: 5.1 -# Copyright (C) 1995-2003 Brian Paul - -# Makefile for building Mesa for 16/32-bit/channel rendering with the OSMesa -# driver. - - -##### MACROS ##### - -GL_MAJOR = 1 -GL_MINOR = 4 -GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - -VPATH = RCS - -INCDIR = ../include -LIBDIR = ../lib - - - -CORE_SOURCES = \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - accum.c \ - arbprogram.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glthread.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - nvprogram.c \ - nvfragparse.c \ - nvvertexec.c \ - nvvertparse.c \ - pixel.c \ - points.c \ - polygon.c \ - rastpos.c \ - state.c \ - stencil.c \ - texcompress.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texstate.c \ - texstore.c \ - texutil.c \ - varray.c \ - vtxfmt.c \ - X86/x86.c \ - X86/common_x86.c \ - X86/3dnow.c \ - X86/sse.c \ - math/m_debug_clip.c \ - math/m_debug_norm.c \ - math/m_debug_xform.c \ - math/m_eval.c \ - math/m_matrix.c \ - math/m_translate.c \ - math/m_vector.c \ - math/m_xform.c \ - array_cache/ac_context.c \ - array_cache/ac_import.c \ - swrast/s_aaline.c \ - swrast/s_aatriangle.c \ - swrast/s_accum.c \ - swrast/s_alpha.c \ - swrast/s_alphabuf.c \ - swrast/s_bitmap.c \ - swrast/s_blend.c \ - swrast/s_buffers.c \ - swrast/s_copypix.c \ - swrast/s_context.c \ - swrast/s_depth.c \ - swrast/s_drawpix.c \ - swrast/s_feedback.c \ - swrast/s_fog.c \ - swrast/s_imaging.c \ - swrast/s_lines.c \ - swrast/s_logic.c \ - swrast/s_masking.c \ - swrast/s_nvfragprog.c \ - swrast/s_pixeltex.c \ - swrast/s_points.c \ - swrast/s_readpix.c \ - swrast/s_span.c \ - swrast/s_stencil.c \ - swrast/s_texture.c \ - swrast/s_texstore.c \ - swrast/s_triangle.c \ - swrast/s_zoom.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - tnl/t_array_api.c \ - tnl/t_array_import.c \ - tnl/t_context.c \ - tnl/t_eval_api.c \ - tnl/t_imm_alloc.c \ - tnl/t_imm_api.c \ - tnl/t_imm_debug.c \ - tnl/t_imm_dlist.c \ - tnl/t_imm_elt.c \ - tnl/t_imm_eval.c \ - tnl/t_imm_exec.c \ - tnl/t_imm_fixup.c \ - tnl/t_pipeline.c \ - tnl/t_vb_fog.c \ - tnl/t_vb_light.c \ - tnl/t_vb_normals.c \ - tnl/t_vb_points.c \ - tnl/t_vb_program.c \ - tnl/t_vb_render.c \ - tnl/t_vb_texgen.c \ - tnl/t_vb_texmat.c \ - tnl/t_vb_vertex.c \ - OSmesa/osmesa.c - -ASM_SOURCES = - -ADDITIONAL_OBJ = - -OBJECTS = $(ASM_SOURCES:.S=.o) \ - $(CORE_SOURCES:.c=.o) \ - $(ADDITIONAL_OBJ) - - - -##### RULES ##### - -.c.o: - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ - -.S.o: - $(CC) -c -I. $(CFLAGS) $< -o $@ - - -OSmesa/osmesa.o: OSmesa/osmesa.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ - -X86/x86.o: X86/x86.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/common_x86.o: X86/common_x86.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/common_x86_asm.o: X86/common_x86_asm.S X86/matypes.h -X86/3dnow.o: X86/3dnow.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/sse.o: X86/sse.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c - $(CC) -I. -I$(INCDIR) $(CFLAGS) X86/gen_matypes.c -o X86/gen_matypes - ./X86/gen_matypes > X86/matypes.h - rm -f X86/gen_matypes X86/*.o - -# We have X86/matypes.h depend on X86/matypes.h so that if ASM_SOURCES -# is empty we don't get an invalid Makefile. -$(ASM_SOURCES) X86/matypes.h: X86/matypes.h - - -##### TARGETS ##### - -#default: -# @echo "Specify a target configuration" - -clean: - -rm -f *.o *~ */*.o */*~ *.lo *.la - -rm -rf .libs - -targets: $(LIBDIR)/$(OSMESA16_LIB) - -# Make the 16-bit/channel OSMesa library -$(LIBDIR)/$(OSMESA16_LIB): $(OBJECTS) - $(MAKELIB) $(OSMESA16_LIB) $(GL_MAJOR) $(GL_MINOR) $(GL_TINY) $(OBJECTS) - rm -f $(LIBDIR)/$(OSMESA16_LIB)* - mv $(OSMESA16_LIB)* $(LIBDIR) - - -include ../Make-config - -include depend - - - -# -# Run 'make dep' to update the dependencies if you change what's included -# by any source file. -# -dep: $(CORE_SOURCES) - makedepend -fdepend -Y -I../include $(CORE_SOURCES) - -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 deleted file mode 100644 index 1f9bd666d5d..00000000000 --- a/src/mesa/main/Makefile.X11 +++ /dev/null @@ -1,265 +0,0 @@ -# Makefile for GL library - - -##### MACROS ##### - -GL_MAJOR = 1 -GL_MINOR = 4 -GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - -GL_LIB_NAME = "GL" # may be overridden in Make-config -OSMESA_LIB_NAME = "OSMesa" # may be overridden in Make-config - -VPATH = RCS - -TOP = .. -INCDIR = $(TOP)/include -LIBDIR = $(TOP)/lib - - - -CORE_SOURCES = \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - accum.c \ - arbprogram.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glthread.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - nvprogram.c \ - nvfragparse.c \ - nvvertexec.c \ - nvvertparse.c \ - pixel.c \ - points.c \ - polygon.c \ - program.c \ - rastpos.c \ - state.c \ - stencil.c \ - texcompress.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texstate.c \ - texstore.c \ - texutil.c \ - varray.c \ - vtxfmt.c \ - X86/x86.c \ - X86/common_x86.c \ - X86/3dnow.c \ - X86/sse.c \ - math/m_debug_clip.c \ - math/m_debug_norm.c \ - math/m_debug_xform.c \ - math/m_eval.c \ - math/m_matrix.c \ - math/m_translate.c \ - math/m_vector.c \ - math/m_xform.c \ - array_cache/ac_context.c \ - array_cache/ac_import.c \ - swrast/s_aaline.c \ - swrast/s_aatriangle.c \ - swrast/s_accum.c \ - swrast/s_alpha.c \ - swrast/s_alphabuf.c \ - swrast/s_bitmap.c \ - swrast/s_blend.c \ - swrast/s_buffers.c \ - swrast/s_copypix.c \ - swrast/s_context.c \ - swrast/s_depth.c \ - swrast/s_drawpix.c \ - swrast/s_feedback.c \ - swrast/s_fog.c \ - swrast/s_imaging.c \ - swrast/s_lines.c \ - swrast/s_logic.c \ - swrast/s_masking.c \ - swrast/s_nvfragprog.c \ - swrast/s_pixeltex.c \ - swrast/s_points.c \ - swrast/s_readpix.c \ - swrast/s_span.c \ - swrast/s_stencil.c \ - swrast/s_texture.c \ - swrast/s_texstore.c \ - swrast/s_triangle.c \ - swrast/s_zoom.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - tnl/t_array_api.c \ - tnl/t_array_import.c \ - tnl/t_context.c \ - tnl/t_eval_api.c \ - tnl/t_imm_alloc.c \ - tnl/t_imm_api.c \ - tnl/t_imm_debug.c \ - tnl/t_imm_dlist.c \ - tnl/t_imm_elt.c \ - tnl/t_imm_eval.c \ - tnl/t_imm_exec.c \ - tnl/t_imm_fixup.c \ - tnl/t_pipeline.c \ - tnl/t_vb_fog.c \ - tnl/t_vb_light.c \ - tnl/t_vb_normals.c \ - tnl/t_vb_points.c \ - tnl/t_vb_program.c \ - tnl/t_vb_render.c \ - tnl/t_vb_texgen.c \ - tnl/t_vb_texmat.c \ - tnl/t_vb_vertex.c - - -DRIVER_SOURCES = \ - FX/fxapi.c \ - FX/fxdd.c \ - FX/fxddspan.c \ - FX/fxddtex.c \ - FX/fxsetup.c \ - FX/fxtexman.c \ - FX/fxtris.c \ - FX/fxvb.c \ - FX/fxglidew.c \ - X/glxapi.c \ - X/fakeglx.c \ - X/xfonts.c \ - X/xm_api.c \ - X/xm_dd.c \ - X/xm_line.c \ - X/xm_span.c \ - X/xm_tri.c \ - SVGA/svgamesa.c \ - SVGA/svgamesa8.c \ - SVGA/svgamesa15.c \ - SVGA/svgamesa16.c \ - SVGA/svgamesa24.c \ - SVGA/svgamesa32.c - - -ASM_SOURCES = - -ADDITIONAL_OBJ = - -OBJECTS = $(ASM_SOURCES:.S=.o) \ - $(CORE_SOURCES:.c=.o) \ - $(DRIVER_SOURCES:.c=.o) \ - $(ADDITIONAL_OBJ) - -CORE_OBJECTS = $(CORE_SOURCES:.c=.o) - -OSMESA_SOURCES = OSmesa/osmesa.c -OSMESA_OBJECTS = OSmesa/osmesa.o - - - -##### RULES ##### - -.c.o: - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ - -.S.o: - $(CC) -c -I. $(CFLAGS) $< -o $@ - - -X86/x86.o: X86/x86.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/common_x86.o: X86/common_x86.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/common_x86_asm.o: X86/common_x86_asm.S X86/matypes.h -X86/3dnow.o: X86/3dnow.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/sse.o: X86/sse.c - $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ -X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c - $(CC) -I. -I$(INCDIR) $(CFLAGS) X86/gen_matypes.c -o X86/gen_matypes - ./X86/gen_matypes > X86/matypes.h - rm -f X86/gen_matypes X86/*.o - -# We have X86/matypes.h depend on X86/matypes.h so that if ASM_SOURCES -# is empty we don't get an invalid Makefile. -$(ASM_SOURCES) X86/matypes.h: X86/matypes.h - - -##### TARGETS ##### - -#default: -# @echo "Specify a target configuration" - -clean: - -rm -f *.o *~ */*.o */*~ *.lo *.la - -rm -rf .libs - -targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB) - -# Make the GL library -$(LIBDIR)/$(GL_LIB): $(OBJECTS) - $(TOP)/bin/mklib -o $(GL_LIB_NAME) -major $(GL_MAJOR) \ - -minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \ - $(GL_LIB_DEPS) $(OBJECTS) - - -# Make the OSMesa library -$(LIBDIR)/$(OSMESA_LIB): $(OSMESA_OBJECTS) $(LIBDIR)/$(GL_LIB) - if [ ${OSMESA_LIB} ] ; then $(TOP)/bin/mklib -o $(OSMESA_LIB_NAME) \ - -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(GL_TINY) \ - -L$(LIBDIR) -l$(GL_LIB_NAME) -install $(LIBDIR) \ - $(OSMESA_OBJECTS) ; fi - - -# Make an optional library with _just_ core objects -libmesa: $(LIBDIR)/$(MESA_LIB) - if [ ${MESA_LIB} ] ; then $(MAKELIB) $(MESA_LIB) $(MESA_MAJOR) $(MESA_MINOR) $(GL_TINY) $(CORE_OBJECTS) ; fi - if [ ${MESA_LIB} ] ; then rm -f $(LIBDIR)/$(MESA_LIB)* ; fi - if [ ${MESA_LIB} ] ; then mv $(MESA_LIB)* $(LIBDIR) ; fi - -$(LIBDIR)/$(MESA_LIB): $(CORE_OBJECTS) - -include $(TOP)/Make-config - -include depend - - - -# -# Run 'make dep' to update the dependencies if you change what's included -# by any source file. -# -dep: $(CORE_SOURCES) $(DRIVER_SOURCES) $(OSMESA_SOURCES) - makedepend -fdepend -Y -I$(TOP)/include -DGGI -DSVGA -DFX $(CORE_SOURCES) $(DRIVER_SOURCES) $(OSMESA_SOURCES) - -tags: - etags `find . -name \*.[ch]` `find $(TOP)/include` diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 3ca7d27f83f..315bd33b61d 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 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"), @@ -32,7 +31,7 @@ #include "mtypes.h" -void +void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GLfloat tmp[4]; @@ -51,9 +50,8 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) COPY_4FV( ctx->Accum.ClearColor, tmp ); } -/* Should really be a driver-supplied function? - */ -void + +void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); @@ -68,6 +66,11 @@ _mesa_Accum( GLenum op, GLfloat value ) if (ctx->NewState) _mesa_update_state( ctx ); + if (ctx->RenderMode != GL_RENDER) { + /* no-op */ + return; + } + /* Determine region to operate upon. */ if (ctx->Scissor.Enabled) { xpos = ctx->Scissor.X; diff --git a/src/mesa/main/accum.h b/src/mesa/main/accum.h index 625d0bfd61d..ce92688a5b9 100644 --- a/src/mesa/main/accum.h +++ b/src/mesa/main/accum.h @@ -42,11 +42,11 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ); -extern void +extern void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); extern void diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 3dea1de9713..c163d668fdd 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -74,8 +74,7 @@ #define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x) #define SECONDARYCOLORF(a,b,c) _glapi_Dispatch->SecondaryColor3fEXT(a,b,c) - -static void +static void GLAPIENTRY loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) { COLORF( BYTE_TO_FLOAT(red), @@ -84,41 +83,41 @@ loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) { COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3i_f( GLint red, GLint green, GLint blue ) { COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue), 1.0); } -static void +static void GLAPIENTRY loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) { COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue), 1.0); } -static void +static void GLAPIENTRY loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) { COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) { COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) { COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), @@ -126,48 +125,48 @@ loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) } -static void +static void GLAPIENTRY loopback_Color3bv_f( const GLbyte *v ) { COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3dv_f( const GLdouble *v ) { COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3iv_f( const GLint *v ) { COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); } -static void +static void GLAPIENTRY loopback_Color3sv_f( const GLshort *v ) { COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3uiv_f( const GLuint *v ) { COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3usv_f( const GLushort *v ) { COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), 1.0 ); } -static void +static void GLAPIENTRY loopback_Color3ubv_f( const GLubyte *v ) { COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), @@ -175,7 +174,7 @@ loopback_Color3ubv_f( const GLubyte *v ) } -static void +static void GLAPIENTRY loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) { @@ -183,21 +182,21 @@ loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); } -static void +static void GLAPIENTRY loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) { COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); } -static void +static void GLAPIENTRY loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) { COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); } -static void +static void GLAPIENTRY loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, GLshort alpha ) { @@ -205,14 +204,14 @@ loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); } -static void +static void GLAPIENTRY loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) { COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); } -static void +static void GLAPIENTRY loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) { COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), @@ -227,7 +226,7 @@ loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) } -static void +static void GLAPIENTRY loopback_Color4iv_f( const GLint *v ) { COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), @@ -235,21 +234,21 @@ loopback_Color4iv_f( const GLint *v ) } -static void +static void GLAPIENTRY loopback_Color4bv_f( const GLbyte *v ) { COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); } -static void +static void GLAPIENTRY loopback_Color4dv_f( const GLdouble *v ) { COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_Color4sv_f( const GLshort *v) { COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), @@ -257,578 +256,578 @@ loopback_Color4sv_f( const GLshort *v) } -static void +static void GLAPIENTRY loopback_Color4uiv_f( const GLuint *v) { COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); } -static void +static void GLAPIENTRY loopback_Color4usv_f( const GLushort *v) { COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); } -static void +static void GLAPIENTRY loopback_Color4ubv_f( const GLubyte *v) { COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); } -static void +static void GLAPIENTRY loopback_FogCoorddEXT( GLdouble d ) { FOGCOORDF( (GLfloat) d ); } -static void +static void GLAPIENTRY loopback_FogCoorddvEXT( const GLdouble *v ) { FOGCOORDF( (GLfloat) *v ); } -static void +static void GLAPIENTRY loopback_Indexd( GLdouble c ) { INDEX( (GLfloat) c ); } -static void +static void GLAPIENTRY loopback_Indexi( GLint c ) { INDEX( (GLfloat) c ); } -static void +static void GLAPIENTRY loopback_Indexs( GLshort c ) { INDEX( (GLfloat) c ); } -static void +static void GLAPIENTRY loopback_Indexub( GLubyte c ) { INDEX( (GLfloat) c ); } -static void +static void GLAPIENTRY loopback_Indexdv( const GLdouble *c ) { INDEX( (GLfloat) *c ); } -static void +static void GLAPIENTRY loopback_Indexiv( const GLint *c ) { INDEX( (GLfloat) *c ); } -static void +static void GLAPIENTRY loopback_Indexsv( const GLshort *c ) { INDEX( (GLfloat) *c ); } -static void +static void GLAPIENTRY loopback_Indexubv( const GLubyte *c ) { INDEX( (GLfloat) *c ); } -static void +static void GLAPIENTRY loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) { NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); } -static void +static void GLAPIENTRY loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) { NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); } -static void +static void GLAPIENTRY loopback_Normal3i( GLint nx, GLint ny, GLint nz ) { NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); } -static void +static void GLAPIENTRY loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) { NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); } -static void +static void GLAPIENTRY loopback_Normal3bv( const GLbyte *v ) { NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); } -static void +static void GLAPIENTRY loopback_Normal3dv( const GLdouble *v ) { NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_Normal3iv( const GLint *v ) { NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); } -static void +static void GLAPIENTRY loopback_Normal3sv( const GLshort *v ) { NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); } -static void +static void GLAPIENTRY loopback_TexCoord1d( GLdouble s ) { TEXCOORD1((GLfloat) s); } -static void +static void GLAPIENTRY loopback_TexCoord1i( GLint s ) { TEXCOORD1((GLfloat) s); } -static void +static void GLAPIENTRY loopback_TexCoord1s( GLshort s ) { TEXCOORD1((GLfloat) s); } -static void +static void GLAPIENTRY loopback_TexCoord2d( GLdouble s, GLdouble t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } -static void +static void GLAPIENTRY loopback_TexCoord2s( GLshort s, GLshort t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } -static void +static void GLAPIENTRY loopback_TexCoord2i( GLint s, GLint t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } -static void +static void GLAPIENTRY loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } -static void +static void GLAPIENTRY loopback_TexCoord3i( GLint s, GLint t, GLint r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } -static void +static void GLAPIENTRY loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } -static void +static void GLAPIENTRY loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } -static void +static void GLAPIENTRY loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } -static void +static void GLAPIENTRY loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } -static void +static void GLAPIENTRY loopback_TexCoord1dv( const GLdouble *v ) { TEXCOORD1((GLfloat) v[0]); } -static void +static void GLAPIENTRY loopback_TexCoord1iv( const GLint *v ) { TEXCOORD1((GLfloat) v[0]); } -static void +static void GLAPIENTRY loopback_TexCoord1sv( const GLshort *v ) { TEXCOORD1((GLfloat) v[0]); } -static void +static void GLAPIENTRY loopback_TexCoord2dv( const GLdouble *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_TexCoord2iv( const GLint *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_TexCoord2sv( const GLshort *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_TexCoord3dv( const GLdouble *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_TexCoord3iv( const GLint *v ) { TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); } -static void +static void GLAPIENTRY loopback_TexCoord3sv( const GLshort *v ) { TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); } -static void +static void GLAPIENTRY loopback_TexCoord4dv( const GLdouble *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_TexCoord4iv( const GLint *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_TexCoord4sv( const GLshort *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_Vertex2d( GLdouble x, GLdouble y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } -static void +static void GLAPIENTRY loopback_Vertex2i( GLint x, GLint y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } -static void +static void GLAPIENTRY loopback_Vertex2s( GLshort x, GLshort y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } -static void +static void GLAPIENTRY loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } -static void +static void GLAPIENTRY loopback_Vertex3i( GLint x, GLint y, GLint z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } -static void +static void GLAPIENTRY loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } -static void +static void GLAPIENTRY loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } -static void +static void GLAPIENTRY loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } -static void +static void GLAPIENTRY loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } -static void +static void GLAPIENTRY loopback_Vertex2dv( const GLdouble *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_Vertex2iv( const GLint *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_Vertex2sv( const GLshort *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_Vertex3dv( const GLdouble *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_Vertex3iv( const GLint *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_Vertex3sv( const GLshort *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_Vertex4dv( const GLdouble *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_Vertex4iv( const GLint *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_Vertex4sv( const GLshort *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1iARB(GLenum target, GLint s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1sARB(GLenum target, GLshort s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } -static void +static void GLAPIENTRY loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } -static void +static void GLAPIENTRY loopback_EvalCoord2dv( const GLdouble *u ) { EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); } -static void +static void GLAPIENTRY loopback_EvalCoord2fv( const GLfloat *u ) { EVALCOORD2( u[0], u[1] ); } -static void +static void GLAPIENTRY loopback_EvalCoord2d( GLdouble u, GLdouble v ) { EVALCOORD2( (GLfloat) u, (GLfloat) v ); } -static void +static void GLAPIENTRY loopback_EvalCoord1dv( const GLdouble *u ) { EVALCOORD1( (GLfloat) *u ); } -static void +static void GLAPIENTRY loopback_EvalCoord1fv( const GLfloat *u ) { EVALCOORD1( (GLfloat) *u ); } -static void +static void GLAPIENTRY loopback_EvalCoord1d( GLdouble u ) { EVALCOORD1( (GLfloat) u ); } -static void +static void GLAPIENTRY loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) { GLfloat fparam[4]; @@ -836,14 +835,14 @@ loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) MATERIALFV( face, pname, fparam ); } -static void +static void GLAPIENTRY loopback_Materiali(GLenum face, GLenum pname, GLint param ) { GLfloat p = (GLfloat) param; MATERIALFV(face, pname, &p); } -static void +static void GLAPIENTRY loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) { GLfloat fparam[4]; @@ -873,49 +872,49 @@ loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) } -static void +static void GLAPIENTRY loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } -static void +static void GLAPIENTRY loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } -static void +static void GLAPIENTRY loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) { RECTF(v1[0], v1[1], v2[0], v2[1]); } -static void +static void GLAPIENTRY loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } -static void +static void GLAPIENTRY loopback_Rectiv(const GLint *v1, const GLint *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } -static void +static void GLAPIENTRY loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } -static void +static void GLAPIENTRY loopback_Rectsv(const GLshort *v1, const GLshort *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } -static void +static void GLAPIENTRY loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) { SECONDARYCOLORF( BYTE_TO_FLOAT(red), @@ -923,13 +922,13 @@ loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) BYTE_TO_FLOAT(blue) ); } -static void +static void GLAPIENTRY loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) { SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); } -static void +static void GLAPIENTRY loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) { SECONDARYCOLORF( INT_TO_FLOAT(red), @@ -937,7 +936,7 @@ loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) INT_TO_FLOAT(blue)); } -static void +static void GLAPIENTRY loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) { SECONDARYCOLORF(SHORT_TO_FLOAT(red), @@ -945,7 +944,7 @@ loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) SHORT_TO_FLOAT(blue)); } -static void +static void GLAPIENTRY loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) { SECONDARYCOLORF(UINT_TO_FLOAT(red), @@ -953,7 +952,7 @@ loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) UINT_TO_FLOAT(blue)); } -static void +static void GLAPIENTRY loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) { SECONDARYCOLORF(USHORT_TO_FLOAT(red), @@ -961,7 +960,7 @@ loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) USHORT_TO_FLOAT(blue)); } -static void +static void GLAPIENTRY loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) { SECONDARYCOLORF(UBYTE_TO_FLOAT(red), @@ -969,7 +968,7 @@ loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) UBYTE_TO_FLOAT(blue)); } -static void +static void GLAPIENTRY loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) { SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), @@ -977,12 +976,12 @@ loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) BYTE_TO_FLOAT(v[2])); } -static void +static void GLAPIENTRY loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) { SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } -static void +static void GLAPIENTRY loopback_SecondaryColor3ivEXT_f( const GLint *v ) { SECONDARYCOLORF(INT_TO_FLOAT(v[0]), @@ -990,7 +989,7 @@ loopback_SecondaryColor3ivEXT_f( const GLint *v ) INT_TO_FLOAT(v[2])); } -static void +static void GLAPIENTRY loopback_SecondaryColor3svEXT_f( const GLshort *v ) { SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), @@ -998,7 +997,7 @@ loopback_SecondaryColor3svEXT_f( const GLshort *v ) SHORT_TO_FLOAT(v[2])); } -static void +static void GLAPIENTRY loopback_SecondaryColor3uivEXT_f( const GLuint *v ) { SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), @@ -1006,7 +1005,7 @@ loopback_SecondaryColor3uivEXT_f( const GLuint *v ) UINT_TO_FLOAT(v[2])); } -static void +static void GLAPIENTRY loopback_SecondaryColor3usvEXT_f( const GLushort *v ) { SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), @@ -1014,7 +1013,7 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v ) USHORT_TO_FLOAT(v[2])); } -static void +static void GLAPIENTRY loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) { SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), @@ -1027,153 +1026,153 @@ loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) * GL_NV_vertex_program */ -static void +static void GLAPIENTRY loopback_VertexAttrib1sNV(GLuint index, GLshort x) { ATTRIB1(index, (GLfloat) x); } -static void +static void GLAPIENTRY loopback_VertexAttrib1fNV(GLuint index, GLfloat x) { ATTRIB1(index, x); } -static void +static void GLAPIENTRY loopback_VertexAttrib1dNV(GLuint index, GLdouble x) { ATTRIB1(index, (GLfloat) x); } -static void +static void GLAPIENTRY loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) { ATTRIB2(index, (GLfloat) x, y); } -static void +static void GLAPIENTRY loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) { ATTRIB2(index, (GLfloat) x, y); } -static void +static void GLAPIENTRY loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) { ATTRIB2(index, (GLfloat) x, (GLfloat) y); } -static void +static void GLAPIENTRY loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) { ATTRIB3(index, (GLfloat) x, y, z); } -static void +static void GLAPIENTRY loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) { ATTRIB3(index, x, y, z); } -static void +static void GLAPIENTRY loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) { ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -static void +static void GLAPIENTRY loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void +static void GLAPIENTRY loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void +static void GLAPIENTRY loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { ATTRIB4(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); } -static void +static void GLAPIENTRY loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) { ATTRIB1(index, (GLfloat) v[0]); } -static void +static void GLAPIENTRY loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v) { ATTRIB1(index, v[0]); } -static void +static void GLAPIENTRY loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) { ATTRIB1(index, (GLfloat) v[0]); } -static void +static void GLAPIENTRY loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) { ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v) { ATTRIB2(index, v[0], v[1]); } -static void +static void GLAPIENTRY loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) { ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) { ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]); } -static void +static void GLAPIENTRY loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v) { ATTRIB3(index, v[0], v[1], v[2]); } -static void +static void GLAPIENTRY loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) { ATTRIB3(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat)v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v) { ATTRIB4(index, v[0], v[1], v[2], v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) { ATTRIB4(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), @@ -1181,7 +1180,7 @@ loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) } -static void +static void GLAPIENTRY loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; @@ -1189,7 +1188,7 @@ loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) loopback_VertexAttrib1svNV(index + i, v + i); } -static void +static void GLAPIENTRY loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; @@ -1197,7 +1196,7 @@ loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) loopback_VertexAttrib1fvNV(index + i, v + i); } -static void +static void GLAPIENTRY loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; @@ -1205,7 +1204,7 @@ loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) loopback_VertexAttrib1dvNV(index + i, v + i); } -static void +static void GLAPIENTRY loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; @@ -1213,7 +1212,7 @@ loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) loopback_VertexAttrib2svNV(index + i, v + 2 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; @@ -1221,7 +1220,7 @@ loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) loopback_VertexAttrib2fvNV(index + i, v + 2 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; @@ -1229,7 +1228,7 @@ loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) loopback_VertexAttrib2dvNV(index + i, v + 2 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; @@ -1237,7 +1236,7 @@ loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) loopback_VertexAttrib3svNV(index + i, v + 3 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; @@ -1245,7 +1244,7 @@ loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) loopback_VertexAttrib3fvNV(index + i, v + 3 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; @@ -1253,7 +1252,7 @@ loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) loopback_VertexAttrib3dvNV(index + i, v + 3 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; @@ -1261,7 +1260,7 @@ loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) loopback_VertexAttrib4svNV(index + i, v + 4 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; @@ -1269,7 +1268,7 @@ loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) loopback_VertexAttrib4fvNV(index + i, v + 4 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; @@ -1277,7 +1276,7 @@ loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) loopback_VertexAttrib4dvNV(index + i, v + 4 * i); } -static void +static void GLAPIENTRY loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) { GLint i; @@ -1290,65 +1289,65 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) * GL_ARB_vertex_program */ -static void +static void GLAPIENTRY loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) { ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void +static void GLAPIENTRY loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) { ATTRIB4(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); } -static void +static void GLAPIENTRY loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) { ATTRIB4(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); } -static void +static void GLAPIENTRY loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) { ATTRIB4(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); } -static void +static void GLAPIENTRY loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) { ATTRIB4(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); } -static void +static void GLAPIENTRY loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) { ATTRIB4(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 945f68c1741..f6193aec556 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -45,7 +45,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, } if (mode > GL_POLYGON) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); return GL_FALSE; } @@ -58,14 +58,39 @@ _mesa_validate_DrawElements(GLcontext *ctx, } if (ctx->NewState) - _mesa_update_state( ctx ); + _mesa_update_state(ctx); - if (ctx->Array.Vertex.Enabled - || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) - return GL_TRUE; - else + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled + && !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; + if (ctx->Const.CheckArrayBounds) { + /* find max array index */ + GLuint max = 0; + GLint i; + if (type == GL_UNSIGNED_INT) { + for (i = 0; i < count; i++) + if (((GLuint *) indices)[i] > max) + max = ((GLuint *) indices)[i]; + } + else if (type == GL_UNSIGNED_SHORT) { + for (i = 0; i < count; i++) + if (((GLushort *) indices)[i] > max) + max = ((GLushort *) indices)[i]; + } + else { + ASSERT(type == GL_UNSIGNED_BYTE); + for (i = 0; i < count; i++) + if (((GLubyte *) indices)[i] > max) + max = ((GLubyte *) indices)[i]; + } + if (max >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + return GL_FALSE; + } + } + return GL_TRUE; } @@ -80,12 +105,12 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (count <= 0) { if (count < 0) - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" ); return GL_FALSE; } if (mode > GL_POLYGON) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); return GL_FALSE; } @@ -97,29 +122,61 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (type != GL_UNSIGNED_INT && type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)" ); return GL_FALSE; } if (ctx->NewState) - _mesa_update_state( ctx ); + _mesa_update_state(ctx); - if (ctx->Array.Vertex.Enabled - || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) - return GL_TRUE; - else + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled + && !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; -} + if (ctx->Const.CheckArrayBounds) { + /* Find max array index. + * We don't trust the user's start and end values. + */ + GLuint max = 0; + GLint i; + if (type == GL_UNSIGNED_INT) { + for (i = 0; i < count; i++) + if (((GLuint *) indices)[i] > max) + max = ((GLuint *) indices)[i]; + } + else if (type == GL_UNSIGNED_SHORT) { + for (i = 0; i < count; i++) + if (((GLushort *) indices)[i] > max) + max = ((GLushort *) indices)[i]; + } + else { + ASSERT(type == GL_UNSIGNED_BYTE); + for (i = 0; i < count; i++) + if (((GLubyte *) indices)[i] > max) + max = ((GLubyte *) indices)[i]; + } + if (max >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + return GL_FALSE; + } + } + + return GL_TRUE; +} +/** + * Called from the tnl module to error check the function parameters and + * verify that we really can draw something. + */ GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, GLenum mode, GLint start, GLsizei count) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - if (count<0) { + if (count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); return GL_FALSE; } @@ -130,11 +187,17 @@ _mesa_validate_DrawArrays(GLcontext *ctx, } if (ctx->NewState) - _mesa_update_state( ctx ); + _mesa_update_state(ctx); - if (ctx->Array.Vertex.Enabled - || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) - return GL_TRUE; - else + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled + && !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; + + if (ctx->Const.CheckArrayBounds) { + if (start + count > ctx->Array._MaxElement) + return GL_FALSE; + } + + return GL_TRUE; } diff --git a/src/mesa/main/arbfragparse.c b/src/mesa/main/arbfragparse.c index 39aa1c38306..eb7d0c24a66 100644 --- a/src/mesa/main/arbfragparse.c +++ b/src/mesa/main/arbfragparse.c @@ -22,11 +22,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#define DEBUG_FP 0 /** * \file arbfragparse.c * ARB_fragment_program parser. - * \author + * \author Karl Rasche */ #include "glheader.h" @@ -34,13 +35,189 @@ #include "imports.h" #include "macros.h" #include "mtypes.h" +#include "arbparse.h" #include "arbfragparse.h" +static void +debug_fp_inst(GLint num, struct fp_instruction *fp) +{ + GLint a; + + fprintf(stderr, "PROGRAM_OUTPUT: 0x%x\n", PROGRAM_OUTPUT); + fprintf(stderr, "PROGRAM_INPUT: 0x%x\n", PROGRAM_INPUT); + fprintf(stderr, "PROGRAM_TEMPORARY: 0x%x\n", PROGRAM_TEMPORARY); + + for (a=0; a<num; a++) { + switch (fp[a].Opcode) { + case FP_OPCODE_END: + fprintf(stderr, "FP_OPCODE_END"); break; + + case FP_OPCODE_ABS: + fprintf(stderr, "FP_OPCODE_ABS"); break; + + case FP_OPCODE_ADD: + fprintf(stderr, "FP_OPCODE_ADD"); break; + + case FP_OPCODE_CMP: + fprintf(stderr, "FP_OPCODE_CMP"); break; + + case FP_OPCODE_COS: + fprintf(stderr, "FP_OPCODE_COS"); break; + + case FP_OPCODE_DP3: + fprintf(stderr, "FP_OPCODE_DP3"); break; + + case FP_OPCODE_DP4: + fprintf(stderr, "FP_OPCODE_DP4"); break; + + case FP_OPCODE_DPH: + fprintf(stderr, "FP_OPCODE_DPH"); break; + + case FP_OPCODE_DST: + fprintf(stderr, "FP_OPCODE_DST"); break; + + case FP_OPCODE_EX2: + fprintf(stderr, "FP_OPCODE_EX2"); break; + + case FP_OPCODE_FLR: + fprintf(stderr, "FP_OPCODE_FLR"); break; + + case FP_OPCODE_FRC: + fprintf(stderr, "FP_OPCODE_FRC"); break; + + case FP_OPCODE_KIL: + fprintf(stderr, "FP_OPCODE_KIL"); break; + + case FP_OPCODE_LG2: + fprintf(stderr, "FP_OPCODE_LG2"); break; + + case FP_OPCODE_LIT: + fprintf(stderr, "FP_OPCODE_LIT"); break; + + case FP_OPCODE_LRP: + fprintf(stderr, "FP_OPCODE_LRP"); break; + + case FP_OPCODE_MAD: + fprintf(stderr, "FP_OPCODE_MAD"); break; + + case FP_OPCODE_MAX: + fprintf(stderr, "FP_OPCODE_MAX"); break; + + case FP_OPCODE_MIN: + fprintf(stderr, "FP_OPCODE_MIN"); break; + + case FP_OPCODE_MOV: + fprintf(stderr, "FP_OPCODE_MOV"); break; + + case FP_OPCODE_MUL: + fprintf(stderr, "FP_OPCODE_MUL"); break; + + case FP_OPCODE_POW: + fprintf(stderr, "FP_OPCODE_POW"); break; + + case FP_OPCODE_RCP: + fprintf(stderr, "FP_OPCODE_RCP"); break; + + case FP_OPCODE_RSQ: + fprintf(stderr, "FP_OPCODE_RSQ"); break; + + case FP_OPCODE_SCS: + fprintf(stderr, "FP_OPCODE_SCS"); break; + + case FP_OPCODE_SIN: + fprintf(stderr, "FP_OPCODE_SIN"); break; + + case FP_OPCODE_SLT: + fprintf(stderr, "FP_OPCODE_SLT"); break; + + case FP_OPCODE_SUB: + fprintf(stderr, "FP_OPCODE_SUB"); break; + + case FP_OPCODE_SWZ: + fprintf(stderr, "FP_OPCODE_SWZ"); break; + + case FP_OPCODE_TEX: + fprintf(stderr, "FP_OPCODE_TEX"); break; + + case FP_OPCODE_TXB: + fprintf(stderr, "FP_OPCODE_TXB"); break; + + case FP_OPCODE_TXP: + fprintf(stderr, "FP_OPCODE_TXP"); break; + + case FP_OPCODE_X2D: + fprintf(stderr, "FP_OPCODE_XPD"); break; + } + + fprintf(stderr, " D(0x%x:%d:%d%d%d%d) ", + fp[a].DstReg.File, fp[a].DstReg.Index, + fp[a].DstReg.WriteMask[0], fp[a].DstReg.WriteMask[1], + fp[a].DstReg.WriteMask[2], fp[a].DstReg.WriteMask[3]); + + fprintf(stderr, "S1(0x%x:%d:%d%d%d%d) ", fp[a].SrcReg[0].File, fp[a].SrcReg[0].Index, + fp[a].SrcReg[0].Swizzle[0], + fp[a].SrcReg[0].Swizzle[1], + fp[a].SrcReg[0].Swizzle[2], + fp[a].SrcReg[0].Swizzle[3]); + + fprintf(stderr, "S2(0x%x:%d:%d%d%d%d) ", fp[a].SrcReg[1].File, fp[a].SrcReg[1].Index, + fp[a].SrcReg[1].Swizzle[0], + fp[a].SrcReg[1].Swizzle[1], + fp[a].SrcReg[1].Swizzle[2], + fp[a].SrcReg[1].Swizzle[3]); + + fprintf(stderr, "S3(0x%x:%d:%d%d%d%d)", fp[a].SrcReg[2].File, fp[a].SrcReg[2].Index, + fp[a].SrcReg[2].Swizzle[0], + fp[a].SrcReg[2].Swizzle[1], + fp[a].SrcReg[2].Swizzle[2], + fp[a].SrcReg[2].Swizzle[3]); + + fprintf(stderr, "\n"); + } +} void _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target, const GLubyte * str, GLsizei len, struct fragment_program *program) { + GLuint retval; + struct arb_program ap; + + retval = _mesa_parse_arb_program(ctx, str, len, &ap); + + /* XXX: Parse error. Cleanup things and return */ + if (retval) + { + return; + } + + /* XXX: Eh.. we parsed something that wasn't a fragment program. doh! */ + if (ap.type != GL_FRAGMENT_PROGRAM_ARB) + { + return; + } + +#if DEBUG_FP + debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions); +#endif + /* copy the relvant contents of the arb_program struct into the + * fragment_program struct + */ + program->Base.NumInstructions = ap.Base.NumInstructions; + program->Base.NumTemporaries = ap.Base.NumTemporaries; + program->Base.NumParameters = ap.Base.NumParameters; + program->Base.NumAttributes = ap.Base.NumAttributes; + program->Base.NumAddressRegs = ap.Base.NumAddressRegs; + + program->Instructions = ap.FPInstructions; + program->InputsRead = ap.InputsRead; + program->OutputsWritten = ap.OutputsWritten; + for (retval=0; retval<MAX_TEXTURE_IMAGE_UNITS; retval++) + program->TexturesUsed[retval] = ap.TexturesUsed[retval]; + program->NumAluInstructions = ap.NumAluInstructions; + program->NumTexInstructions = ap.NumTexInstructions; + program->NumTexIndirections = ap.NumTexIndirections; + program->Parameters = ap.Parameters; } diff --git a/src/mesa/main/arbparse.c b/src/mesa/main/arbparse.c new file mode 100644 index 00000000000..032b5cc5035 --- /dev/null +++ b/src/mesa/main/arbparse.c @@ -0,0 +1,5718 @@ +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * Copyright (C) 1999-2003 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#define DEBUG_PARSING 0 + +/** + * \file arbparse.c + * ARB_*_program parser core + * \author Michal Krol, Karl Rasche + */ + + +#include "mtypes.h" +#include "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "program.h" +#include "nvvertprog.h" +#include "nvfragprog.h" +#include "arbparse.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* TODO: + * Fragment Program Stuff: + * ----------------------------------------------------- + * - How does negating on SWZ work?? If any of the components have a -, negate? + * - how does thing like 'foo[N]' work in src registers? + * + * - things from Michal's email + * + overflow on atoi + * + not-overflowing floats (don't use parse_integer..) + * + * + fix multiple cases in switches, that might change + * (these are things that are #defined to the same value, but occur + * only on fp or vp's, which funkifies the switch statements) + * - STATE_TEX_* STATE_CLIP_PLANE, etc and PRECISION_HINT_FASTEST/PositionInvariant + * + * - check all limits of number of various variables + * + parameters + * + modelview matrix number + * + * - test! test! test! + * + * Vertex Program Stuff: + * ----------------------------------------------------- + * - Add in cases for vp attribs + * + VERTEX_ATTRIB_MATRIXINDEX -- ?? + * + VERTEX_ATTRIB_GENERIC + * * Test for input alias error --> bleh! + * + * - ARRAY_INDEX_RELATIVE + * - grep for XXX + * + * Mesa Stuff + * ----------------------------------------------------- + * - vp_src swizzle is GLubyte, fp_src swizzle is GLuint + * - fetch state listed in program_parameters list + * + WTF should this go??? + * + currently in nvvertexec.c and s_nvfragprog.c + * + * - allow for multiple address registers (and fetch address regs properly) + * + * Cosmetic Stuff + * ----------------------------------------------------- + * - fix compiler warnings + * - remove any leftover unused grammer.c stuff (dict_ ?) + * - fix grammer.c error handling so its not static + * - #ifdef around stuff pertaining to extentions + * + * Outstanding Questions: + * ----------------------------------------------------- + * - palette matrix? do we support this extension? what is the extention? + * - When can we fetch env/local params from their own register files, and when + * to we have to fetch them into the main state register file? (think arrays) + * + * Grammar Changes: + * ----------------------------------------------------- + * - changed optional_exponent rule from: + * " exponent .or .true .emit '1' .emit 0x00;\n" + * to + * " exponent .or .true .emit '1' .emit 0x00 .emit $;\n" + * + * - XXX: need to recognize "1" as a valid float ? + */ + +typedef unsigned char byte; +typedef byte *production; + +/*----------------------------------------------------------------------- + * From here on down is the syntax checking portion + */ + +/* VERSION: 0.3 */ + +/* + INTRODUCTION + ------------ + + The task is to check the syntax of an input string. Input string is a stream of ASCII + characters terminated with null-character ('\0'). Checking it using C language is + difficult and hard to implement without bugs. It is hard to maintain and change prior + to further syntax changes. + + This is because of high redundancy of the C code. Large blocks of code are duplicated with + only small changes. Even using macros does not solve the problem, because macros cannot + erase the complexity of the code. + + The resolution is to create a new language that will be highly oriented to our task. Once + we describe particular syntax, we are done. We can then focus on the code that implements + the language. The size and complexity of it is relatively small than the code that directly + checks the syntax. + + First, we must implement our new language. Here, the language is implemented in C, but it + could also be implemented in any other language. The code is listed below. We must take + a good care that it is bug free. This is simple because the code is simple and clean. + + Next, we must describe the syntax of our new language in itself. Once created and checked + manually that it is correct, we can use it to check another scripts. + + Note that our new language loading code does not have to check the syntax. It is because we + assume that the script describing itself is correct, and other scripts can be syntactically + checked by the former script. The loading code must only do semantic checking which leads us to + simple resolving references. + + THE LANGUAGE + ------------ + + Here I will describe the syntax of the new language (further called "Synek"). It is mainly a + sequence of declarations terminated by a semicolon. The declaration consists of a symbol, + which is an identifier, and its definition. A definition is in turn a sequence of specifiers + connected with ".and" or ".or" operator. These operators cannot be mixed together in a one + definition. Specifier can be a symbol, string, character, character range or a special + keyword ".true" or ".false". + + On the very beginning of the script there is a declaration of a root symbol and is in the form: + .syntax <root_symbol>; + The <root_symbol> must be on of the symbols in declaration sequence. The syntax is correct if + the root symbol evaluates to true. A symbol evaluates to true if the definition associated with + the symbol evaluates to true. Definition evaluation depends on the operator used to connect + specifiers in the definition. If ".and" operator is used, definition evaluates to true if and + only if all the specifiers evaluate to true. If ".or" operator is used, definition evalutes to + true if any of the specifiers evaluates to true. If definition contains only one specifier, + it is evaluated as if it was connected with ".true" keyword by ".and" operator. + + If specifier is a ".true" keyword, it always evaluates to true. + + If specifier is a ".false" keyword, it always evaluates to false. Specifier evaluates to false + when it does not evaluate to true. + + Character range specifier is in the form: + '<first_character>' - '<second_character>' + If specifier is a character range, it evaluates to true if character in the stream is greater + or equal to <first_character> and less or equal to <second_character>. In that situation + the stream pointer is advanced to point to next character in the stream. All C-style escape + sequences are supported although trigraph sequences are not. The comparisions are performed + on 8-bit unsigned integers. + + Character specifier is in the form: + '<single_character>' + It evaluates to true if the following character range specifier evaluates to true: + '<single_character>' - '<single_character>' + + String specifier is in the form: + "<string>" + Let N be the number of characters in <string>. Let <string>[i] designate i-th character in + <string>. Then the string specifier evaluates to true if and only if for i in the range [0, N) + the following character specifier evaluates to true: + '<string>[i]' + If <string>[i] is a quotation mark, '<string>[i]' is replaced with '\<string>[i]'. + + Symbol specifier can be optionally preceded by a ".loop" keyword in the form: + .loop <symbol> (1) + where <symbol> is defined as follows: + <symbol> <definition>; (2) + Construction (1) is replaced by the following code: + <symbol$1> + and declaration (2) is replaced by the following: + <symbol$1> <symbol$2> .or .true; + <symbol$2> <symbol> .and <symbol$1>; + <symbol> <definition>; + + ESCAPE SEQUENCES + ---------------- + + Synek supports all escape sequences in character specifiers. The mapping table is listed below. + All occurences of the characters in the first column are replaced with the corresponding + character in the second column. + + Escape sequence Represents + ------------------------------------------------------------------------------------------------ + \a Bell (alert) + \b Backspace + \f Formfeed + \n New line + \r Carriage return + \t Horizontal tab + \v Vertical tab + \' Single quotation mark + \" Double quotation mark + \\ Backslash + \? Literal question mark + \ooo ASCII character in octal notation + \xhhh ASCII character in hexadecimal notation + ------------------------------------------------------------------------------------------------ + + RAISING ERRORS + -------------- + + Any specifier can be followed by a special construction that is executed when the specifier + evaluates to false. The construction is in the form: + .error <ERROR_TEXT> + <ERROR_TEXT> is an identifier declared earlier by error text declaration. The declaration is + in the form: + .errtext <ERROR_TEXT> "<error_desc>" + When specifier evaluates to false and this construction is present, parsing is stopped + immediately and <error_desc> is returned as a result of parsing. The error position is also + returned and it is meant as an offset from the beggining of the stream to the character that + was valid so far. Example: + + (**** syntax script ****) + + .syntax program; + .errtext MISSING_SEMICOLON "missing ';'" + program declaration .and .loop space .and ';' .error MISSING_SEMICOLON .and + .loop space .and '\0'; + declaration "declare" .and .loop space .and identifier; + space ' '; + + (**** sample code ****) + + declare foo , + + In the example above checking the sample code will result in error message "missing ';'" and + error position 12. The sample code is not correct. Note the presence of '\0' specifier to + assure that there is no code after semicolon - only spaces. + <error_desc> can optionally contain identifier surrounded by dollar signs $. In such a case, + the identifier and dollar signs are replaced by a string retrieved by invoking symbol with + the identifier name. The starting position is the error position. The lenght of the resulting + string is the position after invoking the symbol. + + PRODUCTION + ---------- + + Synek not only checks the syntax but it can also produce (emit) bytes associated with specifiers + that evaluate to true. That is, every specifier and optional error construction can be followed + by a number of emit constructions that are in the form: + .emit <parameter> + <paramater> can be a HEX number, identifier, a star * or a dollar $. HEX number is preceded by + 0x or 0X. If <parameter> is an identifier, it must be earlier declared by emit code declaration + in the form: + .emtcode <identifier> <hex_number> + + When given specifier evaluates to true, all emits associated with the specifier are output + in order they were declared. A star means that last-read character should be output instead + of constant value. Example: + + (**** syntax script ****) + + .syntax foobar; + .emtcode WORD_FOO 0x01 + .emtcode WORD_BAR 0x02 + foobar FOO .emit WORD_FOO .or BAR .emit WORD_BAR .or .true .emit 0x00; + FOO "foo" .and SPACE; + BAR "bar" .and SPACE; + SPACE ' ' .or '\0'; + + (**** sample text 1 ****) + + foo + + (**** sample text 2 ****) + + foobar + + For both samples the result will be one-element array. For first sample text it will be + value 1, for second - 0. Note that every text will be accepted because of presence of + .true as an alternative. + + Another example: + + (**** syntax script ****) + + .syntax declaration; + .emtcode VARIABLE 0x01 + declaration "declare" .and .loop space .and + identifier .emit VARIABLE .and (1) + .true .emit 0x00 .and (2) + .loop space .and ';'; + space ' ' .or '\t'; + identifier .loop id_char .emit *; (3) + id_char 'a'-'z' .or 'A'-'Z' .or '_'; + + (**** sample code ****) + + declare fubar; + + In specifier (1) symbol <identifier> is followed by .emit VARIABLE. If it evaluates to + true, VARIABLE constant and then production of the symbol is output. Specifier (2) is used + to terminate the string with null to signal when the string ends. Specifier (3) outputs + all characters that make declared identifier. The result of sample code will be the + following array: + { 1, 'f', 'u', 'b', 'a', 'r', 0 } + + If .emit is followed by dollar $, it means that current position should be output. Current + position is a 32-bit unsigned integer distance from the very beginning of the parsed string to + first character consumed by the specifier associated with the .emit instruction. Current + position is stored in the output buffer in Little-Endian convention (the lowest byte comes + first). +*/ + +/** + * This is the text describing the rules to parse the grammar + */ +#include "arbparse_syn.h" + +/** + * These should match up with the values defined in arbparse.syn.h + */ + +#define REVISION 0x03 + +/* program type */ +#define FRAGMENT_PROGRAM 0x01 +#define VERTEX_PROGRAM 0x02 + +/* program section */ +#define OPTION 0x01 +#define INSTRUCTION 0x02 +#define DECLARATION 0x03 +#define END 0x04 + +/* fragment program option flags */ +#define ARB_PRECISION_HINT_FASTEST 0x01 +#define ARB_PRECISION_HINT_NICEST 0x02 +#define ARB_FOG_EXP 0x04 +#define ARB_FOG_EXP2 0x08 +#define ARB_FOG_LINEAR 0x10 + +/* vertex program option flags */ +#define ARB_POSITION_INVARIANT 0x01 + +/* fragment program instruction class */ +#define F_ALU_INST 0x01 +#define F_TEX_INST 0x02 + +/* fragment program instruction type */ +#define F_ALU_VECTOR 0x01 +#define F_ALU_SCALAR 0x02 +#define F_ALU_BINSC 0x03 +#define F_ALU_BIN 0x04 +#define F_ALU_TRI 0x05 +#define F_ALU_SWZ 0x06 +#define F_TEX_SAMPLE 0x07 +#define F_TEX_KIL 0x08 + +/* vertex program instruction type */ +#define V_GEN_ARL 0x01 +#define V_GEN_VECTOR 0x02 +#define V_GEN_SCALAR 0x03 +#define V_GEN_BINSC 0x04 +#define V_GEN_BIN 0x05 +#define V_GEN_TRI 0x06 +#define V_GEN_SWZ 0x07 + +/* fragment program instruction code */ +#define F_ABS 0x00 +#define F_ABS_SAT 0x01 +#define F_FLR 0x02 +#define F_FLR_SAT 0x03 +#define F_FRC 0x04 +#define F_FRC_SAT 0x05 +#define F_LIT 0x06 +#define F_LIT_SAT 0x07 +#define F_MOV 0x08 +#define F_MOV_SAT 0x09 +#define F_COS 0x0A +#define F_COS_SAT 0x0B +#define F_EX2 0x0C +#define F_EX2_SAT 0x0D +#define F_LG2 0x0E +#define F_LG2_SAT 0x0F +#define F_RCP 0x10 +#define F_RCP_SAT 0x11 +#define F_RSQ 0x12 +#define F_RSQ_SAT 0x13 +#define F_SIN 0x14 +#define F_SIN_SAT 0x15 +#define F_SCS 0x16 +#define F_SCS_SAT 0x17 +#define F_POW 0x18 +#define F_POW_SAT 0x19 +#define F_ADD 0x1A +#define F_ADD_SAT 0x1B +#define F_DP3 0x1C +#define F_DP3_SAT 0x1D +#define F_DP4 0x1E +#define F_DP4_SAT 0x1F +#define F_DPH 0x20 +#define F_DPH_SAT 0x21 +#define F_DST 0x22 +#define F_DST_SAT 0x23 +#define F_MAX 0x24 +#define F_MAX_SAT 0x25 +#define F_MIN 0x26 +#define F_MIN_SAT 0x27 +#define F_MUL 0x28 +#define F_MUL_SAT 0x29 +#define F_SGE 0x2A +#define F_SGE_SAT 0x2B +#define F_SLT 0x2C +#define F_SLT_SAT 0x2D +#define F_SUB 0x2E +#define F_SUB_SAT 0x2F +#define F_XPD 0x30 +#define F_XPD_SAT 0x31 +#define F_CMP 0x32 +#define F_CMP_SAT 0x33 +#define F_LRP 0x34 +#define F_LRP_SAT 0x35 +#define F_MAD 0x36 +#define F_MAD_SAT 0x37 +#define F_SWZ 0x38 +#define F_SWZ_SAT 0x39 +#define F_TEX 0x3A +#define F_TEX_SAT 0x3B +#define F_TXB 0x3C +#define F_TXB_SAT 0x3D +#define F_TXP 0x3E +#define F_TXP_SAT 0x3F +#define F_KIL 0x40 + +/* vertex program instruction code */ +#define V_ARL 0x01 +#define V_ABS 0x02 +#define V_FLR 0x03 +#define V_FRC 0x04 +#define V_LIT 0x05 +#define V_MOV 0x06 +#define V_EX2 0x07 +#define V_EXP 0x08 +#define V_LG2 0x09 +#define V_LOG 0x0A +#define V_RCP 0x0B +#define V_RSQ 0x0C +#define V_POW 0x0D +#define V_ADD 0x0E +#define V_DP3 0x0F +#define V_DP4 0x10 +#define V_DPH 0x11 +#define V_DST 0x12 +#define V_MAX 0x13 +#define V_MIN 0x14 +#define V_MUL 0x15 +#define V_SGE 0x16 +#define V_SLT 0x17 +#define V_SUB 0x18 +#define V_XPD 0x19 +#define V_MAD 0x1A +#define V_SWZ 0x1B + +/* fragment attribute binding */ +#define FRAGMENT_ATTRIB_COLOR 0x01 +#define FRAGMENT_ATTRIB_TEXCOORD 0x02 +#define FRAGMENT_ATTRIB_FOGCOORD 0x03 +#define FRAGMENT_ATTRIB_POSITION 0x04 + +/* vertex attribute binding */ +#define VERTEX_ATTRIB_POSITION 0x01 +#define VERTEX_ATTRIB_WEIGHT 0x02 +#define VERTEX_ATTRIB_NORMAL 0x03 +#define VERTEX_ATTRIB_COLOR 0x04 +#define VERTEX_ATTRIB_FOGCOORD 0x05 +#define VERTEX_ATTRIB_TEXCOORD 0x06 +#define VERTEX_ATTRIB_MATRIXINDEX 0x07 +#define VERTEX_ATTRIB_GENERIC 0x08 + +/* fragment result binding */ +#define FRAGMENT_RESULT_COLOR 0x01 +#define FRAGMENT_RESULT_DEPTH 0x02 + +/* vertex result binding */ +#define VERTEX_RESULT_POSITION 0x01 +#define VERTEX_RESULT_COLOR 0x02 +#define VERTEX_RESULT_FOGCOORD 0x03 +#define VERTEX_RESULT_POINTSIZE 0x04 +#define VERTEX_RESULT_TEXCOORD 0x05 + +/* texture target */ +#define TEXTARGET_1D 0x01 +#define TEXTARGET_2D 0x02 +#define TEXTARGET_3D 0x03 +#define TEXTARGET_RECT 0x04 +#define TEXTARGET_CUBE 0x05 + +/* sign */ +/* +$3: removed. '+' and '-' are used instead. +*/ +/* +#define SIGN_PLUS 0x00 +#define SIGN_MINUS 0x01 +*/ + +/* face type */ +#define FACE_FRONT 0x00 +#define FACE_BACK 0x01 + +/* color type */ +#define COLOR_PRIMARY 0x00 +#define COLOR_SECONDARY 0x01 + +/* component */ +/* +$3: Added enumerants. +*/ +#define COMPONENT_X 0x00 +#define COMPONENT_Y 0x01 +#define COMPONENT_Z 0x02 +#define COMPONENT_W 0x03 +#define COMPONENT_0 0x04 +#define COMPONENT_1 0x05 + +#define ARRAY_INDEX_ABSOLUTE 0x00 +#define ARRAY_INDEX_RELATIVE 0x01 + +/* matrix name */ +#define MATRIX_MODELVIEW 0x01 +#define MATRIX_PROJECTION 0x02 +#define MATRIX_MVP 0x03 +#define MATRIX_TEXTURE 0x04 +#define MATRIX_PALETTE 0x05 +#define MATRIX_PROGRAM 0x06 + +/* matrix modifier */ +#define MATRIX_MODIFIER_IDENTITY 0x00 +#define MATRIX_MODIFIER_INVERSE 0x01 +#define MATRIX_MODIFIER_TRANSPOSE 0x02 +#define MATRIX_MODIFIER_INVTRANS 0x03 + +/* constant type */ +#define CONSTANT_SCALAR 0x01 +#define CONSTANT_VECTOR 0x02 + +/* program param type */ +#define PROGRAM_PARAM_ENV 0x01 +#define PROGRAM_PARAM_LOCAL 0x02 + +/* register type */ +#define REGISTER_ATTRIB 0x01 +#define REGISTER_PARAM 0x02 +#define REGISTER_RESULT 0x03 +#define REGISTER_ESTABLISHED_NAME 0x04 + +/* param binding */ +#define PARAM_NULL 0x00 +#define PARAM_ARRAY_ELEMENT 0x01 +#define PARAM_STATE_ELEMENT 0x02 +#define PARAM_PROGRAM_ELEMENT 0x03 +#define PARAM_PROGRAM_ELEMENTS 0x04 +#define PARAM_CONSTANT 0x05 + +/* param state property */ +#define STATE_MATERIAL_PARSER 0x01 +#define STATE_LIGHT_PARSER 0x02 +#define STATE_LIGHT_MODEL 0x03 +#define STATE_LIGHT_PROD 0x04 +#define STATE_FOG 0x05 +#define STATE_MATRIX_ROWS 0x06 +/* fragment program only */ +#define STATE_TEX_ENV 0x07 +#define STATE_DEPTH 0x08 +/* vertex program only */ +#define STATE_TEX_GEN 0x07 +#define STATE_CLIP_PLANE 0x08 +#define STATE_POINT 0x09 + +/* state material property */ +#define MATERIAL_AMBIENT 0x01 +#define MATERIAL_DIFFUSE 0x02 +#define MATERIAL_SPECULAR 0x03 +#define MATERIAL_EMISSION 0x04 +#define MATERIAL_SHININESS 0x05 + +/* state light property */ +#define LIGHT_AMBIENT 0x01 +#define LIGHT_DIFFUSE 0x02 +#define LIGHT_SPECULAR 0x03 +#define LIGHT_POSITION 0x04 +#define LIGHT_ATTENUATION 0x05 +#define LIGHT_HALF 0x06 +#define LIGHT_SPOT_DIRECTION 0x07 + +/* state light model property */ +#define LIGHT_MODEL_AMBIENT 0x01 +#define LIGHT_MODEL_SCENECOLOR 0x02 + +/* state light product property */ +#define LIGHT_PROD_AMBIENT 0x01 +#define LIGHT_PROD_DIFFUSE 0x02 +#define LIGHT_PROD_SPECULAR 0x03 + +/* state texture environment property */ +#define TEX_ENV_COLOR 0x01 + +/* state texture generation coord property */ +#define TEX_GEN_EYE 0x01 +#define TEX_GEN_OBJECT 0x02 + +/* state fog property */ +#define FOG_COLOR 0x01 +#define FOG_PARAMS 0x02 + +/* state depth property */ +#define DEPTH_RANGE 0x01 + +/* state point parameters property */ +#define POINT_SIZE 0x01 +#define POINT_ATTENUATION 0x02 + +/* declaration */ +#define ATTRIB 0x01 +#define PARAM 0x02 +#define TEMP 0x03 +#define OUTPUT 0x04 +#define ALIAS 0x05 +/* vertex program 1.0 only */ +#define ADDRESS 0x06 + +/* + memory management routines +*/ +static GLvoid *mem_alloc (GLsizei); +static GLvoid mem_free (GLvoid **); +static GLvoid *mem_realloc (GLvoid *, GLsizei, GLsizei); +static byte *str_duplicate (const byte *); + +/* + internal error messages +*/ +static const byte *OUT_OF_MEMORY = + (byte *) "internal error 1001: out of physical memory"; +static const byte *UNRESOLVED_REFERENCE = + (byte *) "internal error 1002: unresolved reference '$'"; +static const byte *INVALID_PARAMETER = + (byte *) "internal error 1003: invalid parameter"; + +static const byte *error_message = NULL; +static byte *error_param = NULL; /* this is inserted into error_message in place of $ */ +static GLint error_position = -1; + +static byte *unknown = (byte *) "???"; + +static GLvoid +clear_last_error () +{ + /* reset error message */ + error_message = NULL; + + /* free error parameter - if error_param is a "???" don't free it - it's static */ + if (error_param != unknown) + mem_free ((GLvoid **) & error_param); + else + error_param = NULL; + + /* reset error position */ + error_position = -1; +} + +static GLvoid +set_last_error (const byte * msg, byte * param, GLint pos) +{ + if (error_message != NULL) + return; + + error_message = msg; + if (param != NULL) + error_param = param; + else + error_param = unknown; + + error_position = pos; +} + +/* + memory management routines +*/ +static GLvoid * +mem_alloc (GLsizei size) +{ + GLvoid *ptr = _mesa_malloc (size); + if (ptr == NULL) + set_last_error (OUT_OF_MEMORY, NULL, -1); + return ptr; +} + +static GLvoid +mem_free (GLvoid ** ptr) +{ + _mesa_free (*ptr); + *ptr = NULL; +} + +static GLvoid * +mem_realloc (GLvoid * ptr, GLsizei old_size, GLsizei new_size) +{ + GLvoid *ptr2 = _mesa_realloc (ptr, old_size, new_size); + if (ptr2 == NULL) + set_last_error (OUT_OF_MEMORY, NULL, -1); + return ptr2; +} + +static byte * +str_duplicate (const byte * str) +{ + return (byte *) _mesa_strdup ((const char *) str); +} + +/* + emit type typedef +*/ +typedef enum emit_type_ +{ + et_byte, /* explicit number */ + et_stream, /* eaten character */ + et_position /* current position */ +} +emit_type; + +/* + emit typedef +*/ +typedef struct emit_ +{ + emit_type m_emit_type; + byte m_byte; /* et_byte */ + struct emit_ *m_next; +} +emit; + +static GLvoid +emit_create (emit ** em) +{ + *em = mem_alloc (sizeof (emit)); + if (*em) { + (**em).m_emit_type = et_byte; + (**em).m_byte = 0; + (**em).m_next = NULL; + } +} + +static GLvoid +emit_destroy (emit ** em) +{ + if (*em) { + emit_destroy (&(**em).m_next); + mem_free ((GLvoid **) em); + } +} + +static GLvoid +emit_append (emit ** em, emit ** ne) +{ + if (*em) + emit_append (&(**em).m_next, ne); + else + *em = *ne; +} + +/* + * error typedef + */ +typedef struct error_ +{ + byte *m_text; + byte *m_token_name; + struct defntn_ *m_token; +} +error; + +static GLvoid +error_create (error ** er) +{ + *er = mem_alloc (sizeof (error)); + if (*er) { + (**er).m_text = NULL; + (**er).m_token_name = NULL; + (**er).m_token = NULL; + } +} + +static GLvoid +error_destroy (error ** er) +{ + if (*er) { + mem_free ((GLvoid **) & (**er).m_text); + mem_free ((GLvoid **) & (**er).m_token_name); + mem_free ((GLvoid **) er); + } +} + +struct dict_; +static byte *error_get_token (error *, struct dict_ *, const byte *, GLuint); + +/* + * specifier type typedef +*/ +typedef enum spec_type_ +{ + st_false, + st_true, + st_byte, + st_byte_range, + st_string, + st_identifier, + st_identifier_loop, + st_debug +} spec_type; + + +/* + * specifier typedef + */ +typedef struct spec_ +{ + spec_type m_spec_type; + byte m_byte[2]; /* st_byte, st_byte_range */ + byte *m_string; /* st_string */ + struct defntn_ *m_defntn; /* st_identifier, st_identifier_loop */ + emit *m_emits; + error *m_errtext; + struct spec_ *m_next; +} spec; + + +static GLvoid +spec_create (spec ** sp) +{ + *sp = mem_alloc (sizeof (spec)); + if (*sp) { + (**sp).m_spec_type = st_false; + (**sp).m_byte[0] = '\0'; + (**sp).m_byte[1] = '\0'; + (**sp).m_string = NULL; + (**sp).m_defntn = NULL; + (**sp).m_emits = NULL; + (**sp).m_errtext = NULL; + (**sp).m_next = NULL; + } +} + +static GLvoid +spec_destroy (spec ** sp) +{ + if (*sp) { + spec_destroy (&(**sp).m_next); + emit_destroy (&(**sp).m_emits); + error_destroy (&(**sp).m_errtext); + mem_free ((GLvoid **) & (**sp).m_string); + mem_free ((GLvoid **) sp); + } +} + +static GLvoid +spec_append (spec ** sp, spec ** ns) +{ + if (*sp) + spec_append (&(**sp).m_next, ns); + else + *sp = *ns; +} + +/* + * operator typedef + */ +typedef enum oper_ +{ + op_none, + op_and, + op_or +} oper; + + +/* + * definition typedef + */ +typedef struct defntn_ +{ + oper m_oper; + spec *m_specs; + struct defntn_ *m_next; +#ifndef NDEBUG + GLint m_referenced; +#endif +} defntn; + + +static GLvoid +defntn_create (defntn ** de) +{ + *de = mem_alloc (sizeof (defntn)); + if (*de) { + (**de).m_oper = op_none; + (**de).m_specs = NULL; + (**de).m_next = NULL; +#ifndef NDEBUG + (**de).m_referenced = 0; +#endif + } +} + +static GLvoid +defntn_destroy (defntn ** de) +{ + if (*de) { + defntn_destroy (&(**de).m_next); + spec_destroy (&(**de).m_specs); + mem_free ((GLvoid **) de); + } +} + +static GLvoid +defntn_append (defntn ** de, defntn ** nd) +{ + if (*de) + defntn_append (&(**de).m_next, nd); + else + *de = *nd; +} + +/* + * dictionary typedef + */ +typedef struct dict_ +{ + defntn *m_defntns; + defntn *m_syntax; + defntn *m_string; + struct dict_ *m_next; +} dict; + + +static GLvoid +dict_create (dict ** di) +{ + *di = mem_alloc (sizeof (dict)); + if (*di) { + (**di).m_defntns = NULL; + (**di).m_syntax = NULL; + (**di).m_string = NULL; + (**di).m_next = NULL; + } +} + +static GLvoid +dict_destroy (dict ** di) +{ + if (*di) { + dict_destroy (&(**di).m_next); + defntn_destroy (&(**di).m_defntns); + mem_free ((GLvoid **) di); + } +} + +/* + * byte array typedef + */ +typedef struct barray_ +{ + byte *data; + GLuint len; +} barray; + + +static GLvoid +barray_create (barray ** ba) +{ + *ba = mem_alloc (sizeof (barray)); + if (*ba) { + (**ba).data = NULL; + (**ba).len = 0; + } +} + +static GLvoid +barray_destroy (barray ** ba) +{ + if (*ba) { + mem_free ((GLvoid **) & (**ba).data); + mem_free ((GLvoid **) ba); + } +} + +/* + * reallocates byte array to requested size, + * returns 0 on success, + * returns 1 otherwise + */ +static GLint +barray_resize (barray ** ba, GLuint nlen) +{ + byte *new_pointer; + + if (nlen == 0) { + mem_free ((void **) &(**ba).data); + (**ba).data = NULL; + (**ba).len = 0; + + return 0; + } + else { + new_pointer = + mem_realloc ((**ba).data, (**ba).len * sizeof (byte), + nlen * sizeof (byte)); + if (new_pointer) { + (**ba).data = new_pointer; + (**ba).len = nlen; + + return 0; + } + } + + return 1; +} + +/* + * adds byte array pointed by *nb to the end of array pointed by *ba, + * returns 0 on success, + * returns 1 otherwise + */ +static GLint +barray_append (barray ** ba, barray ** nb) +{ + GLuint i; + const GLuint len = (**ba).len; + + if (barray_resize (ba, (**ba).len + (**nb).len)) + return 1; + + for (i = 0; i < (**nb).len; i++) + (**ba).data[len + i] = (**nb).data[i]; + + return 0; +} + +/* + * adds emit chain pointed by em to the end of array pointed by *ba, + * returns 0 on success, + * returns 1 otherwise + */ +static GLint +barray_push (barray ** ba, emit * em, byte c, GLuint pos) +{ + emit *temp = em; + GLuint count = 0; + + while (temp) { + if (temp->m_emit_type == et_position) + count += 4; /* position is a 32-bit unsigned integer */ + else + count++; + + temp = temp->m_next; + } + + if (barray_resize (ba, (**ba).len + count)) + return 1; + + while (em) { + if (em->m_emit_type == et_byte) + (**ba).data[(**ba).len - count--] = em->m_byte; + else if (em->m_emit_type == et_stream) + (**ba).data[(**ba).len - count--] = c; + + /* This is where the position is emitted into the stream */ + else { /* em->type == et_position */ +#if 0 + (**ba).data[(**ba).len - count--] = (byte) pos, + (**ba).data[(**ba).len - count--] = (byte) (pos >> 8), + (**ba).data[(**ba).len - count--] = (byte) (pos >> 16), + (**ba).data[(**ba).len - count--] = (byte) (pos >> 24); +#else + (**ba).data[(**ba).len - count--] = (byte) pos; + (**ba).data[(**ba).len - count--] = (byte) (pos / 0x100); + (**ba).data[(**ba).len - count--] = (byte) (pos / 0x10000); + (**ba).data[(**ba).len - count--] = (byte) (pos / 0x1000000); +#endif + } + + em = em->m_next; + } + + return 0; +} + +/* + * string to string map typedef + */ +typedef struct map_str_ +{ + byte *key; + byte *data; + struct map_str_ *next; +} map_str; + + +static GLvoid +map_str_create (map_str ** ma) +{ + *ma = mem_alloc (sizeof (map_str)); + if (*ma) { + (**ma).key = NULL; + (**ma).data = NULL; + (**ma).next = NULL; + } +} + +static GLvoid +map_str_destroy (map_str ** ma) +{ + if (*ma) { + map_str_destroy (&(**ma).next); + mem_free ((GLvoid **) & (**ma).key); + mem_free ((GLvoid **) & (**ma).data); + mem_free ((GLvoid **) ma); + } +} + +static GLvoid +map_str_append (map_str ** ma, map_str ** nm) +{ + if (*ma) + map_str_append (&(**ma).next, nm); + else + *ma = *nm; +} + +/* + * searches the map for specified key, + * if the key is matched, *data is filled with data associated with the key, + * returns 0 if the key is matched, + * returns 1 otherwise + */ +static GLint +map_str_find (map_str ** ma, const byte * key, byte ** data) +{ + while (*ma) { + if (strcmp ((const char *) (**ma).key, (const char *) key) == 0) { + *data = str_duplicate ((**ma).data); + if (*data == NULL) + return 1; + + return 0; + } + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return 1; +} + +/* + * string to byte map typedef + */ +typedef struct map_byte_ +{ + byte *key; + byte data; + struct map_byte_ *next; +} map_byte; + +static GLvoid +map_byte_create (map_byte ** ma) +{ + *ma = mem_alloc (sizeof (map_byte)); + if (*ma) { + (**ma).key = NULL; + (**ma).data = 0; + (**ma).next = NULL; + } +} + +static GLvoid +map_byte_destroy (map_byte ** ma) +{ + if (*ma) { + map_byte_destroy (&(**ma).next); + mem_free ((GLvoid **) & (**ma).key); + mem_free ((GLvoid **) ma); + } +} + +static GLvoid +map_byte_append (map_byte ** ma, map_byte ** nm) +{ + if (*ma) + map_byte_append (&(**ma).next, nm); + else + *ma = *nm; +} + +/* + * searches the map for specified key, + * if the key is matched, *data is filled with data associated with the key, + * returns 0 if the is matched, + * returns 1 otherwise + */ +static GLint +map_byte_find (map_byte ** ma, const byte * key, byte * data) +{ + while (*ma) { + if (strcmp ((const char *) (**ma).key, (const char *) key) == 0) { + *data = (**ma).data; + return 0; + } + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return 1; +} + +/* + * string to defntn map typedef + */ +typedef struct map_def_ +{ + byte *key; + defntn *data; + struct map_def_ *next; +} map_def; + +static GLvoid +map_def_create (map_def ** ma) +{ + *ma = mem_alloc (sizeof (map_def)); + if (*ma) { + (**ma).key = NULL; + (**ma).data = NULL; + (**ma).next = NULL; + } +} + +static GLvoid +map_def_destroy (map_def ** ma) +{ + if (*ma) { + map_def_destroy (&(**ma).next); + mem_free ((GLvoid **) & (**ma).key); + mem_free ((GLvoid **) ma); + } +} + +static GLvoid +map_def_append (map_def ** ma, map_def ** nm) +{ + if (*ma) + map_def_append (&(**ma).next, nm); + else + *ma = *nm; +} + +/* + * searches the map for specified key, + * if the key is matched, *data is filled with data associated with the key, + * returns 0 if the is matched, + * returns 1 otherwise + */ +static GLint +map_def_find (map_def ** ma, const byte * key, defntn ** data) +{ + while (*ma) { + if (_mesa_strcmp ((const char *) (**ma).key, (const char *) key) == 0) { + *data = (**ma).data; + + return 0; + } + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return 1; +} + +/* + * returns 1 if given character is a space, + * returns 0 otherwise + */ +static GLint +is_space (byte c) +{ + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; +} + +/* + * advances text pointer by 1 if character pointed by *text is a space, + * returns 1 if a space has been eaten, + * returns 0 otherwise + */ +static GLint +eat_space (const byte ** text) +{ + if (is_space (**text)) { + (*text)++; + + return 1; + } + + return 0; +} + +/* + * returns 1 if text points to C-style comment start string "/ *", + * returns 0 otherwise + */ +static GLint +is_comment_start (const byte * text) +{ + return text[0] == '/' && text[1] == '*'; +} + +/* + * advances text pointer to first character after C-style comment block - if any, + * returns 1 if C-style comment block has been encountered and eaten, + * returns 0 otherwise + */ +static GLint +eat_comment (const byte ** text) +{ + if (is_comment_start (*text)) { + /* *text points to comment block - skip two characters to enter comment body */ + *text += 2; + /* skip any character except consecutive '*' and '/' */ + while (!((*text)[0] == '*' && (*text)[1] == '/')) + (*text)++; + /* skip those two terminating characters */ + *text += 2; + + return 1; + } + + return 0; +} + +/* + * advances text pointer to first character that is neither space nor C-style comment block + */ +static GLvoid +eat_spaces (const byte ** text) +{ + while (eat_space (text) || eat_comment (text)); +} + +/* + * resizes string pointed by *ptr to successfully add character c to the end of the string, + * returns 0 on success, + * returns 1 otherwise + */ +static GLint +string_grow (byte ** ptr, GLuint * len, byte c) +{ + /* reallocate the string in 16-length increments */ + if ((*len & 0x0F) == 0x0F || *ptr == NULL) { + byte *tmp = mem_realloc (*ptr, (*len) * sizeof (byte), + ((*len + 1 + 1 + + 0x0F) & ~0x0F) * sizeof (byte)); + if (tmp == NULL) + return 1; + + *ptr = tmp; + } + + if (c) { + /* append given character */ + (*ptr)[*len] = c; + (*len)++; + } + (*ptr)[*len] = '\0'; + + return 0; +} + +/* + * returns 1 if given character is valid identifier character a-z, A-Z, 0-9 or _ + * returns 0 otherwise + */ +static GLint +is_identifier (byte c) +{ + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == '_'; +} + +/* + * copies characters from *text to *id until non-identifier character is encountered, + * assumes that *id points to NULL object - caller is responsible for later freeing the string, + * text pointer is advanced to point past the copied identifier, + * returns 0 if identifier was successfully copied, + * returns 1 otherwise + */ +static GLint +get_identifier (const byte ** text, byte ** id) +{ + const byte *t = *text; + byte *p = NULL; + GLuint len = 0; + + if (string_grow (&p, &len, '\0')) + return 1; + + /* loop while next character in buffer is valid for identifiers */ + while (is_identifier (*t)) { + if (string_grow (&p, &len, *t++)) { + mem_free ((GLvoid **) & p); + return 1; + } + } + + *text = t; + *id = p; + + return 0; +} + +/* + * returns 1 if given character is HEX digit 0-9, A-F or a-f, + * returns 0 otherwise + */ +static GLint +is_hex (byte c) +{ + return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' + && c <= 'f'); +} + +/* + * returns value of passed character as if it was HEX digit + */ +static GLuint +hex2dec (byte c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return c - 'a' + 10; +} + +/* + * converts sequence of HEX digits pointed by *text until non-HEX digit is encountered, + * advances text pointer past the converted sequence, + * returns the converted value + */ +static GLuint +hex_convert (const byte ** text) +{ + GLuint value = 0; + + while (is_hex (**text)) { + value = value * 0x10 + hex2dec (**text); + (*text)++; + } + + return value; +} + +/* + * returns 1 if given character is OCT digit 0-7, + * returns 0 otherwise + */ +static GLint +is_oct (byte c) +{ + return c >= '0' && c <= '7'; +} + +/* + * returns value of passed character as if it was OCT digit + */ +static GLint +oct2dec (byte c) +{ + return c - '0'; +} + +static byte +get_escape_sequence (const byte ** text) +{ + GLint value = 0; + + /* skip '\' character */ + (*text)++; + + switch (*(*text)++) { + case '\'': + return '\''; + case '"': + return '\"'; + case '?': + return '\?'; + case '\\': + return '\\'; + case 'a': + return '\a'; + case 'b': + return '\b'; + case 'f': + return '\f'; + case 'n': + return '\n'; + case 'r': + return '\r'; + case 't': + return '\t'; + case 'v': + return '\v'; + case 'x': + return (byte) hex_convert (text); + } + + (*text)--; + if (is_oct (**text)) { + value = oct2dec (*(*text)++); + if (is_oct (**text)) { + value = value * 010 + oct2dec (*(*text)++); + if (is_oct (**text)) + value = value * 010 + oct2dec (*(*text)++); + } + } + + return (byte) value; +} + +/* + * copies characters from *text to *str until " or ' character is encountered, + * assumes that *str points to NULL object - caller is responsible for later freeing the string, + * assumes that *text points to " or ' character that starts the string, + * text pointer is advanced to point past the " or ' character, + * returns 0 if string was successfully copied, + * returns 1 otherwise + */ +static GLint +get_string (const byte ** text, byte ** str) +{ + const byte *t = *text; + byte *p = NULL; + GLuint len = 0; + byte term_char; + + if (string_grow (&p, &len, '\0')) + return 1; + + /* read " or ' character that starts the string */ + term_char = *t++; + /* while next character is not the terminating character */ + while (*t && *t != term_char) { + byte c; + + if (*t == '\\') + c = get_escape_sequence (&t); + else + c = *t++; + + if (string_grow (&p, &len, c)) { + mem_free ((GLvoid **) & p); + return 1; + } + } + + /* skip " or ' character that ends the string */ + t++; + + *text = t; + *str = p; + return 0; +} + +/* + * gets emit code, the syntax is: ".emtcode" " " <symbol> " " ("0x" | "0X") <hex_value> + * assumes that *text already points to <symbol>, + * returns 0 if emit code is successfully read, + * returns 1 otherwise + */ +static GLint +get_emtcode (const byte ** text, map_byte ** ma) +{ + const byte *t = *text; + map_byte *m = NULL; + + map_byte_create (&m); + if (m == NULL) + return 1; + + if (get_identifier (&t, &m->key)) { + map_byte_destroy (&m); + return 1; + } + eat_spaces (&t); + + if (*t == '\'') { + byte *c; + + if (get_string (&t, &c)) { + map_byte_destroy (&m); + return 1; + } + + m->data = (byte) c[0]; + mem_free ((GLvoid **) & c); + } + else { + /* skip HEX "0x" or "0X" prefix */ + t += 2; + m->data = (byte) hex_convert (&t); + } + + eat_spaces (&t); + + *text = t; + *ma = m; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise + */ +static GLint +get_errtext (const byte ** text, map_str ** ma) +{ + const byte *t = *text; + map_str *m = NULL; + + map_str_create (&m); + if (m == NULL) + return 1; + + if (get_identifier (&t, &m->key)) { + map_str_destroy (&m); + return 1; + } + eat_spaces (&t); + + if (get_string (&t, &m->data)) { + map_str_destroy (&m); + return 1; + } + eat_spaces (&t); + + *text = t; + *ma = m; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +get_error (const byte ** text, error ** er, map_str * maps) +{ + const byte *t = *text; + byte *temp = NULL; + + if (*t != '.') + return 0; + + t++; + if (get_identifier (&t, &temp)) + return 1; + eat_spaces (&t); + + if (_mesa_strcmp ("error", (char *) temp) != 0) { + mem_free ((GLvoid **) & temp); + return 0; + } + + mem_free ((GLvoid **) & temp); + + error_create (er); + if (*er == NULL) + return 1; + + if (*t == '\"') { + if (get_string (&t, &(**er).m_text)) { + error_destroy (er); + return 1; + } + eat_spaces (&t); + } + else { + if (get_identifier (&t, &temp)) { + error_destroy (er); + return 1; + } + eat_spaces (&t); + + if (map_str_find (&maps, temp, &(**er).m_text)) { + mem_free ((GLvoid **) & temp); + error_destroy (er); + return 1; + } + + mem_free ((GLvoid **) & temp); + } + + /* try to extract "token" from "...$token$..." */ + { + char *processed = NULL; + GLuint len = 0, i = 0; + + if (string_grow ((byte **) (&processed), &len, '\0')) { + error_destroy (er); + return 1; + } + + while (i < _mesa_strlen ((char *) ((**er).m_text))) { + /* check if the dollar sign is repeated - if so skip it */ + if ((**er).m_text[i] == '$' && (**er).m_text[i + 1] == '$') { + if (string_grow ((byte **) (&processed), &len, '$')) { + mem_free ((GLvoid **) & processed); + error_destroy (er); + return 1; + } + + i += 2; + } + else if ((**er).m_text[i] != '$') { + if (string_grow ((byte **) (&processed), &len, (**er).m_text[i])) { + mem_free ((GLvoid **) & processed); + error_destroy (er); + return 1; + } + + i++; + } + else { + if (string_grow ((byte **) (&processed), &len, '$')) { + mem_free ((GLvoid **) & processed); + error_destroy (er); + return 1; + } + + { + /* length of token being extracted */ + GLuint tlen = 0; + + if (string_grow (&(**er).m_token_name, &tlen, '\0')) { + mem_free ((GLvoid **) & processed); + error_destroy (er); + return 1; + } + + /* skip the dollar sign */ + i++; + + while ((**er).m_text[i] != '$') { + if (string_grow + (&(**er).m_token_name, &tlen, (**er).m_text[i])) { + mem_free ((GLvoid **) & processed); + error_destroy (er); + return 1; + } + + i++; + } + + /* skip the dollar sign */ + i++; + } + } + } + + mem_free ((GLvoid **) & (**er).m_text); + (**er).m_text = (byte *) processed; + } + + *text = t; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +get_emits (const byte ** text, emit ** em, map_byte * mapb) +{ + const byte *t = *text; + byte *temp = NULL; + emit *e = NULL; + + if (*t != '.') + return 0; + + t++; + if (get_identifier (&t, &temp)) + return 1; + eat_spaces (&t); + + /* .emit */ + if (_mesa_strcmp ("emit", (char *) temp) != 0) { + mem_free ((GLvoid **) & temp); + return 0; + } + + mem_free ((GLvoid **) & temp); + + emit_create (&e); + if (e == NULL) + return 1; + + /* 0xNN */ + if (*t == '0') { + t += 2; + e->m_byte = (byte) hex_convert (&t); + + e->m_emit_type = et_byte; + } + /* * */ + else if (*t == '*') { + t++; + + e->m_emit_type = et_stream; + } + /* $ */ + else if (*t == '$') { + t++; + + e->m_emit_type = et_position; + } + /* 'c' */ + else if (*t == '\'') { + if (get_string (&t, &temp)) { + emit_destroy (&e); + return 1; + } + e->m_byte = (byte) temp[0]; + + mem_free ((GLvoid **) & temp); + + e->m_emit_type = et_byte; + } + else { + if (get_identifier (&t, &temp)) { + emit_destroy (&e); + return 1; + } + + if (map_byte_find (&mapb, temp, &e->m_byte)) { + mem_free ((GLvoid **) & temp); + emit_destroy (&e); + return 1; + } + + mem_free ((GLvoid **) & temp); + + e->m_emit_type = et_byte; + } + + eat_spaces (&t); + + if (get_emits (&t, &e->m_next, mapb)) { + emit_destroy (&e); + return 1; + } + + *text = t; + *em = e; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +get_spec (const byte ** text, spec ** sp, map_str * maps, map_byte * mapb) +{ + const byte *t = *text; + spec *s = NULL; + + spec_create (&s); + if (s == NULL) + return 1; + + if (*t == '\'') { + byte *temp = NULL; + + if (get_string (&t, &temp)) { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + if (*t == '-') { + byte *temp2 = NULL; + + /* skip the '-' character */ + t++; + eat_spaces (&t); + + if (get_string (&t, &temp2)) { + mem_free ((GLvoid **) & temp); + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_byte_range; + s->m_byte[0] = *temp; + s->m_byte[1] = *temp2; + + mem_free ((GLvoid **) & temp2); + } + else { + s->m_spec_type = st_byte; + *s->m_byte = *temp; + } + + mem_free ((GLvoid **) & temp); + } + else if (*t == '"') { + if (get_string (&t, &s->m_string)) { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_string; + } + else if (*t == '.') { + byte *keyword = NULL; + + /* skip the dot */ + t++; + + if (get_identifier (&t, &keyword)) { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + /* .true */ + if (_mesa_strcmp ("true", (char *) keyword) == 0) { + s->m_spec_type = st_true; + } + /* .false */ + else if (_mesa_strcmp ("false", (char *) keyword) == 0) { + s->m_spec_type = st_false; + } + /* .debug */ + else if (_mesa_strcmp ("debug", (char *) keyword) == 0) { + s->m_spec_type = st_debug; + } + /* .loop */ + else if (_mesa_strcmp ("loop", (char *) keyword) == 0) { + if (get_identifier (&t, &s->m_string)) { + mem_free ((GLvoid **) & keyword); + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_identifier_loop; + } + + mem_free ((GLvoid **) & keyword); + } + else { + if (get_identifier (&t, &s->m_string)) { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_identifier; + } + + if (get_error (&t, &s->m_errtext, maps)) { + spec_destroy (&s); + return 1; + } + + if (get_emits (&t, &s->m_emits, mapb)) { + spec_destroy (&s); + return 1; + } + + *text = t; + *sp = s; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +get_definition (const byte ** text, defntn ** de, map_str * maps, + map_byte * mapb) +{ + const byte *t = *text; + defntn *d = NULL; + + defntn_create (&d); + if (d == NULL) + return 1; + + if (get_spec (&t, &d->m_specs, maps, mapb)) { + defntn_destroy (&d); + return 1; + } + + while (*t != ';') { + byte *op = NULL; + spec *sp = NULL; + + /* skip the dot that precedes "and" or "or" */ + t++; + + /* read "and" or "or" keyword */ + if (get_identifier (&t, &op)) { + defntn_destroy (&d); + return 1; + } + eat_spaces (&t); + + if (d->m_oper == op_none) { + /* .and */ + if (_mesa_strcmp ("and", (char *) op) == 0) + d->m_oper = op_and; + /* .or */ + else + d->m_oper = op_or; + } + + mem_free ((GLvoid **) & op); + + if (get_spec (&t, &sp, maps, mapb)) { + defntn_destroy (&d); + return 1; + } + + spec_append (&d->m_specs, &sp); + } + + /* skip the semicolon */ + t++; + eat_spaces (&t); + + *text = t; + *de = d; + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +update_dependency (map_def * mapd, byte * symbol, defntn ** def) +{ + if (map_def_find (&mapd, symbol, def)) + return 1; + +#ifndef NDEBUG + (**def).m_referenced = 1; +#endif + + return 0; +} + +/* + * returns 0 on success, + * returns 1 otherwise, + */ +static GLint +update_dependencies (dict * di, map_def * mapd, byte ** syntax_symbol, + byte ** string_symbol) +{ + defntn *de = di->m_defntns; + + if (update_dependency (mapd, *syntax_symbol, &di->m_syntax) || + (*string_symbol != NULL + && update_dependency (mapd, *string_symbol, &di->m_string))) + return 1; + + mem_free ((GLvoid **) syntax_symbol); + mem_free ((GLvoid **) string_symbol); + + while (de) { + spec *sp = de->m_specs; + + while (sp) { + if (sp->m_spec_type == st_identifier + || sp->m_spec_type == st_identifier_loop) { + if (update_dependency (mapd, sp->m_string, &sp->m_defntn)) + return 1; + + mem_free ((GLvoid **) & sp->m_string); + } + + if (sp->m_errtext && sp->m_errtext->m_token_name) { + if (update_dependency + (mapd, sp->m_errtext->m_token_name, &sp->m_errtext->m_token)) + return 1; + + mem_free ((GLvoid **) & sp->m_errtext->m_token_name); + } + + sp = sp->m_next; + } + + de = de->m_next; + } + + return 0; +} + +typedef enum match_result_ +{ + mr_not_matched, /* the examined string does not match */ + mr_matched, /* the examined string matches */ + mr_error_raised, /* mr_not_matched + error has been raised */ + mr_dont_emit, /* used by identifier loops only */ + mr_internal_error /* an internal error has occured such as out of memory */ +} match_result; + +static match_result +match (dict * di, const byte * text, GLuint * index, defntn * de, + barray ** ba, GLint filtering_string) +{ + GLuint ind = *index; + match_result status = mr_not_matched; + spec *sp = de->m_specs; + + /* for every specifier in the definition */ + while (sp) { + GLuint i, len, save_ind = ind; + barray *array = NULL; + + switch (sp->m_spec_type) { + case st_identifier: + barray_create (&array); + if (array == NULL) + return mr_internal_error; + + status = + match (di, text, &ind, sp->m_defntn, &array, filtering_string); + if (status == mr_internal_error) { + barray_destroy (&array); + return mr_internal_error; + } + break; + case st_string: + len = _mesa_strlen ((char *) (sp->m_string)); + + /* prefilter the stream */ + if (!filtering_string && di->m_string) { + barray *ba; + GLuint filter_index = 0; + match_result result; + + barray_create (&ba); + if (ba == NULL) + return mr_internal_error; + + result = + match (di, text + ind, &filter_index, di->m_string, &ba, 1); + + if (result == mr_internal_error) { + barray_destroy (&ba); + return mr_internal_error; + } + + if (result != mr_matched) { + barray_destroy (&ba); + status = mr_not_matched; + break; + } + + barray_destroy (&ba); + + if (filter_index != len + || _mesa_strncmp ((char *)sp->m_string, (char *)(text + ind), len)) { + status = mr_not_matched; + break; + } + + status = mr_matched; + ind += len; + } + else { + status = mr_matched; + for (i = 0; status == mr_matched && i < len; i++) + if (text[ind + i] != sp->m_string[i]) + status = mr_not_matched; + if (status == mr_matched) + ind += len; + } + break; + case st_byte: + status = text[ind] == *sp->m_byte ? mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_byte_range: + status = (text[ind] >= sp->m_byte[0] + && text[ind] <= + sp->m_byte[1]) ? mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_true: + status = mr_matched; + break; + case st_false: + status = mr_not_matched; + break; + case st_debug: + status = mr_matched; + break; + case st_identifier_loop: + barray_create (&array); + if (array == NULL) + return mr_internal_error; + + status = mr_dont_emit; + for (;;) { + match_result result; + + save_ind = ind; + result = + match (di, text, &ind, sp->m_defntn, &array, + filtering_string); + + if (result == mr_error_raised) { + status = result; + break; + } + else if (result == mr_matched) { + if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind) + || barray_append (ba, &array)) { + barray_destroy (&array); + return mr_internal_error; + } + barray_destroy (&array); + barray_create (&array); + if (array == NULL) + return mr_internal_error; + } + else if (result == mr_internal_error) { + barray_destroy (&array); + return mr_internal_error; + } + else + break; + } + break; + }; + + if (status == mr_error_raised) { + barray_destroy (&array); + + return mr_error_raised; + } + + if (de->m_oper == op_and && status != mr_matched + && status != mr_dont_emit) { + barray_destroy (&array); + + if (sp->m_errtext) { + set_last_error (sp->m_errtext->m_text, + error_get_token (sp->m_errtext, di, text, ind), + ind); + + return mr_error_raised; + } + + return mr_not_matched; + } + + if (status == mr_matched) { + if (sp->m_emits) + if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind)) { + barray_destroy (&array); + return mr_internal_error; + } + + if (array) + if (barray_append (ba, &array)) { + barray_destroy (&array); + return mr_internal_error; + } + } + + barray_destroy (&array); + + if (de->m_oper == op_or + && (status == mr_matched || status == mr_dont_emit)) { + *index = ind; + return mr_matched; + } + + sp = sp->m_next; + } + + if (de->m_oper == op_and + && (status == mr_matched || status == mr_dont_emit)) { + *index = ind; + return mr_matched; + } + + return mr_not_matched; +} + +static byte * +error_get_token (error * er, dict * di, const byte * text, unsigned int ind) +{ + byte *str = NULL, *result = NULL; + + if (er->m_token) { + barray *ba; + unsigned int filter_index = 0; + + barray_create (&ba); + if (ba != NULL) { + if (match (di, text + ind, &filter_index, er->m_token, &ba, 0) == + mr_matched && filter_index) { + str = mem_alloc (filter_index + 1); + if (str != NULL) { + _mesa_strncpy ((char *) str, (char *) (text + ind), + filter_index); + str[filter_index] = '\0'; + } + } + barray_destroy (&ba); + } + } + + return str; +} + +typedef struct grammar_load_state_ +{ + dict *di; + byte *syntax_symbol; + byte *string_symbol; + map_str *maps; + map_byte *mapb; + map_def *mapd; +} grammar_load_state; + + +static GLvoid +grammar_load_state_create (grammar_load_state ** gr) +{ + *gr = mem_alloc (sizeof (grammar_load_state)); + if (*gr) { + (**gr).di = NULL; + (**gr).syntax_symbol = NULL; + (**gr).string_symbol = NULL; + (**gr).maps = NULL; + (**gr).mapb = NULL; + (**gr).mapd = NULL; + } +} + +static GLvoid +grammar_load_state_destroy (grammar_load_state ** gr) +{ + if (*gr) { + dict_destroy (&(**gr).di); + mem_free ((GLvoid **) &(**gr).syntax_symbol); + mem_free ((GLvoid **) &(**gr).string_symbol); + map_str_destroy (&(**gr).maps); + map_byte_destroy (&(**gr).mapb); + map_def_destroy (&(**gr).mapd); + mem_free ((GLvoid **) gr); + } +} + +/* + * the API + */ + +/* + * loads grammar script from null-terminated ASCII text + * returns the grammar object + * returns NULL if an error occurs (call grammar_get_last_error to retrieve the error text) + */ + +static dict * +grammar_load_from_text (const byte * text) +{ + dict *d = NULL; + grammar_load_state *g = NULL; + + clear_last_error (); + + grammar_load_state_create (&g); + if (g == NULL) + return NULL; + + dict_create (&g->di); + if (g->di == NULL) { + grammar_load_state_destroy (&g); + return NULL; + } + + eat_spaces (&text); + + /* skip ".syntax" keyword */ + text += 7; + eat_spaces (&text); + + /* retrieve root symbol */ + if (get_identifier (&text, &g->syntax_symbol)) { + grammar_load_state_destroy (&g); + return NULL; + } + eat_spaces (&text); + + /* skip semicolon */ + text++; + eat_spaces (&text); + + while (*text) { + byte *symbol = NULL; + GLint is_dot = *text == '.'; + + if (is_dot) + text++; + + if (get_identifier (&text, &symbol)) { + grammar_load_state_destroy (&g); + return NULL; + } + eat_spaces (&text); + + /* .emtcode */ + if (is_dot && _mesa_strcmp ((char *) symbol, "emtcode") == 0) { + map_byte *ma = NULL; + + mem_free ((void **) &symbol); + + if (get_emtcode (&text, &ma)) { + grammar_load_state_destroy (&g); + return NULL; + } + + map_byte_append (&g->mapb, &ma); + } + /* .errtext */ + else if (is_dot && _mesa_strcmp ((char *) symbol, "errtext") == 0) { + map_str *ma = NULL; + + mem_free ((GLvoid **) &symbol); + + if (get_errtext (&text, &ma)) { + grammar_load_state_destroy (&g); + return NULL; + } + + map_str_append (&g->maps, &ma); + } + /* .string */ + else if (is_dot && _mesa_strcmp ((char *) symbol, "string") == 0) { + mem_free ((GLvoid **) (&symbol)); + + if (g->di->m_string != NULL) { + grammar_load_state_destroy (&g); + return NULL; + } + + if (get_identifier (&text, &g->string_symbol)) { + grammar_load_state_destroy (&g); + return NULL; + } + + /* skip semicolon */ + eat_spaces (&text); + text++; + eat_spaces (&text); + } + else { + defntn *de = NULL; + map_def *ma = NULL; + + if (get_definition (&text, &de, g->maps, g->mapb)) { + grammar_load_state_destroy (&g); + return NULL; + } + + defntn_append (&g->di->m_defntns, &de); + + /* if definition consist of only one specifier, give it an ".and" operator */ + if (de->m_oper == op_none) + de->m_oper = op_and; + + map_def_create (&ma); + if (ma == NULL) { + grammar_load_state_destroy (&g); + return NULL; + } + + ma->key = symbol; + ma->data = de; + map_def_append (&g->mapd, &ma); + } + } + + if (update_dependencies + (g->di, g->mapd, &g->syntax_symbol, &g->string_symbol)) { + grammar_load_state_destroy (&g); + return NULL; + } + + d = g->di; + g->di = NULL; + + grammar_load_state_destroy (&g); + + return d; +} + +/** + * checks if a null-terminated text matches given grammar + * returns 0 on error (call grammar_get_last_error to retrieve the error text) + * returns 1 on success, the prod points to newly allocated buffer with production and size + * is filled with the production size + * + * \param id - The grammar returned from grammar_load_from_text() + * \param text - The program string + * \param production - The return parameter for the binary array holding the parsed results + * \param size - The return parameter for the size of production + * + * \return 1 on sucess, 0 on parser error + */ +static GLint +grammar_check (dict * di, const byte * text, byte ** production, + GLuint *size) +{ + barray *ba = NULL; + GLuint index = 0; + + clear_last_error (); + + barray_create (&ba); + if (ba == NULL) + return 0; + + *production = NULL; + *size = 0; + + if (match (di, text, &index, di->m_syntax, &ba, 0) != mr_matched) { + barray_destroy (&ba); + return 0; + } + + *production = mem_alloc (ba->len * sizeof (byte)); + if (*production == NULL) { + barray_destroy (&ba); + return 0; + } + + memcpy (*production, ba->data, ba->len * sizeof (byte)); + *size = ba->len; + barray_destroy (&ba); + + return 1; +} + +static GLvoid +grammar_get_last_error (byte * text, int size, int *pos) +{ + GLint len = 0, dots_made = 0; + const byte *p = error_message; + + *text = '\0'; +#define APPEND_CHARACTER(x) if (dots_made == 0) {\ + if (len < size - 1) {\ + text[len++] = (x); text[len] = '\0';\ + } else {\ + int i;\ + for (i = 0; i < 3; i++)\ + if (--len >= 0)\ + text[len] = '.';\ + dots_made = 1;\ + }\ +} + + if (p) { + while (*p) { + if (*p == '$') { + const byte *r = error_param; + + while (*r) { + APPEND_CHARACTER (*r) + r++; + } + + p++; + } + else { + APPEND_CHARACTER (*p) + p++; + } + } + } + *pos = error_position; +} + +/*----------------------------------------------------------------------- + * From here on down is the semantic checking portion + * + */ + +/** + * Variable Table Handling functions + */ +typedef enum +{ + vt_none, + vt_address, + vt_attrib, + vt_param, + vt_temp, + vt_output, + vt_alias +} var_type; + + +/* + * Setting an explicit field for each of the binding properties is a bit wasteful + * of space, but it should be much more clear when reading later on.. + */ +struct var_cache +{ + byte *name; + var_type type; + GLuint address_binding; /* The index of the address register we should + * be using */ + GLuint attrib_binding; /* For type vt_attrib, see nvfragprog.h for values */ + GLuint attrib_binding_idx; /* The index into the attrib register file corresponding + * to the state in attrib_binding */ + GLuint temp_binding; /* The index of the temp register we are to use */ + GLuint output_binding; /* For type vt_output, see nvfragprog.h for values */ + GLuint output_binding_idx; /* This is the index into the result register file + * corresponding to the bound result state */ + struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry + * * that this is aliased to */ + GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, + * PROGRAM_ENV_PARAM} */ + GLuint param_binding_begin; /* This is the offset into the program_parameter_list where + * the tokens representing our bound state (or constants) + * start */ + GLuint param_binding_length; /* This is how many entries in the the program_parameter_list + * we take up with our state tokens or constants. Note that + * this is _not_ the same as the number of param registers + * we eventually use */ + struct var_cache *next; +}; + +static GLvoid +var_cache_create (struct var_cache **va) +{ + *va = _mesa_malloc (sizeof (struct var_cache)); + if (*va) { + (**va).name = NULL; + (**va).type = vt_none; + (**va).attrib_binding = -1; + (**va).temp_binding = -1; + (**va).output_binding = -1; + (**va).output_binding_idx = -1; + (**va).param_binding_type = -1; + (**va).param_binding_begin = -1; + (**va).param_binding_length = -1; + (**va).alias_binding = NULL; + (**va).next = NULL; + } +} + +static GLvoid +var_cache_destroy (struct var_cache **va) +{ + if (*va) { + var_cache_destroy (&(**va).next); + _mesa_free (*va); + *va = NULL; + } +} + +static GLvoid +var_cache_append (struct var_cache **va, struct var_cache *nv) +{ + if (*va) + var_cache_append (&(**va).next, nv); + else + *va = nv; +} + +static struct var_cache * +var_cache_find (struct var_cache *va, byte * name) +{ + struct var_cache *first = va; + + while (va) { + if (!strcmp ( (const char*) name, (const char*) va->name)) { + if (va->type == vt_alias) + return var_cache_find (first, va->name); + return va; + } + + va = va->next; + } + + return NULL; +} + +/** + * constructs an integer from 4 bytes in LE format + */ +static GLuint +parse_position (byte ** inst) +{ + GLuint value; + + value = (GLuint) (*(*inst)++); + value += (GLuint) (*(*inst)++) * 0x100; + value += (GLuint) (*(*inst)++) * 0x10000; + value += (GLuint) (*(*inst)++) * 0x1000000; + + return value; +} + +/** + * This will, given a string, lookup the string as a variable name in the + * var cache. If the name is found, the var cache node corresponding to the + * var name is returned. If it is not found, a new entry is allocated + * + * \param I Points into the binary array where the string identifier begins + * \param found 1 if the string was found in the var_cache, 0 if it was allocated + * \return The location on the var_cache corresponding the the string starting at I + */ +static struct var_cache * +parse_string (byte ** inst, struct var_cache **vc_head, + struct arb_program *Program, GLuint * found) +{ + byte *i = *inst; + struct var_cache *va = NULL; + + *inst += _mesa_strlen ((char *) i) + 1; + + va = var_cache_find (*vc_head, i); + + if (va) { + *found = 1; + return va; + } + + *found = 0; + var_cache_create (&va); + va->name = i; + + var_cache_append (vc_head, va); + + return va; +} + +static char * +parse_string_without_adding (byte ** inst, struct arb_program *Program) +{ + byte *i = *inst; + + *inst += _mesa_strlen ((char *) i) + 1; + + return (char *) i; +} + +/** + * \return 0 if sign is plus, 1 if sign is minus + */ +static GLuint +parse_sign (byte ** inst) +{ + /*return *(*inst)++ != '+'; */ + + if (**inst == '-') { + *(*inst)++; + return 1; + } + else if (**inst == '+') { + *(*inst)++; + return 0; + } + + return 0; +} + +/** + * parses and returns signed integer + */ +static GLint +parse_integer (byte ** inst, struct arb_program *Program) +{ + GLint sign; + GLint value; + + /* check if *inst points to '+' or '-' + * if yes, grab the sign and increment *inst + */ + sign = parse_sign (inst); + + /* now check if *inst points to 0 + * if yes, increment the *inst and return the default value + */ + if (**inst == 0) { + *(*inst)++; + return 0; + } + + /* parse the integer as you normally would do it */ + value = _mesa_atoi (parse_string_without_adding (inst, Program)); + + /* now, after terminating 0 there is a position + * to parse it - parse_position() + */ + Program->Position = parse_position (inst); + + if (sign) + value *= -1; + + return value; +} + +/** + */ +static GLfloat +parse_float (byte ** inst, struct arb_program *Program) +{ + GLint tmp[5], denom; + GLfloat value = 0; + +#if 0 + tmp[0] = parse_sign (inst); /* This is the sign of the number + - >0, - -> 1 */ +#endif + tmp[1] = parse_integer (inst, Program); /* This is the integer portion of the number */ + tmp[2] = parse_integer (inst, Program); /* This is the fractional portion of the number */ + tmp[3] = parse_sign (inst); /* This is the sign of the exponent */ + tmp[4] = parse_integer (inst, Program); /* This is the exponent */ + + value = (GLfloat) tmp[1]; + denom = 1; + while (denom < tmp[2]) + denom *= 10; + value += (GLfloat) tmp[2] / (GLfloat) denom; +#if 0 + if (tmp[0]) + value *= -1; +#endif + value *= _mesa_pow (10, (GLfloat) tmp[3] * (GLfloat) tmp[4]); + + return value; +} + +/** + */ +static GLfloat +parse_signed_float (byte ** inst, struct arb_program *Program) +{ + GLint negate; + GLfloat value; + + negate = parse_sign (inst); + + value = parse_float (inst, Program); + + if (negate) + value *= -1; + + return value; +} + +/** + * This picks out a constant value from the parsed array. The constant vector is r + * returned in the *values array, which should be of length 4. + * + * \param values - The 4 component vector with the constant value in it + */ +static GLvoid +parse_constant (byte ** inst, GLfloat *values, struct arb_program *Program, + GLboolean use) +{ + GLuint components, i; + + + switch (*(*inst)++) { + case CONSTANT_SCALAR: + if (use == GL_TRUE) { + values[0] = + values[1] = + values[2] = values[3] = parse_float (inst, Program); + } + else { + values[0] = + values[1] = + values[2] = values[3] = parse_signed_float (inst, Program); + } + + break; + case CONSTANT_VECTOR: + values[0] = values[1] = values[2] = 0; + values[3] = 1; + components = *(*inst)++; + for (i = 0; i < components; i++) { + values[i] = parse_signed_float (inst, Program); + } + break; + } +} + + +/** + * \param color 0 if color type is primary, 1 if color type is secondary + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_color_type (GLcontext * ctx, byte ** inst, struct arb_program *Program, + GLint * color) +{ + *color = *(*inst)++ != COLOR_PRIMARY; + return 0; +} + +/** + * \param coord The texture unit index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_texcoord_num (GLcontext * ctx, byte ** inst, + struct arb_program *Program, GLuint * coord) +{ + *coord = parse_integer (inst, Program); + + if ((*coord < 0) || (*coord >= ctx->Const.MaxTextureUnits)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid texture unit index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index"); + return 1; + } + + Program->TexturesUsed[*coord] = 1; + return 0; +} + +/** + * \param coord The weight index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_weight_num (GLcontext * ctx, byte ** inst, struct arb_program *Program, + GLint * coord) +{ + *coord = parse_integer (inst, Program); + + if ((*coord < 0) || (*coord >= 1)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid weight index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid weight index"); + return 1; + } + + return 0; +} + +/** + * \param coord The clip plane index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_clipplane_num (GLcontext * ctx, byte ** inst, + struct arb_program *Program, GLint * coord) +{ + *coord = parse_integer (inst, Program); + + if ((*coord < 0) || (*coord >= ctx->Const.MaxClipPlanes)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid clip plane index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid clip plane index"); + return 1; + } + + return 0; +} + + + + +/** + * \return 0 on front face, 1 on back face + */ +static GLuint +parse_face_type (byte ** inst) +{ + switch (*(*inst)++) { + case FACE_FRONT: + return 0; + + case FACE_BACK: + return 1; + } +} + +/** + * Given a matrix and a modifier token on the binary array, return tokens + * that _mesa_fetch_state() [program.c] can understand. + * + * \param matrix - the matrix we are talking about + * \param matrix_idx - the index of the matrix we have (for texture & program matricies) + * \param matrix_modifier - the matrix modifier (trans, inv, etc) + * \return 0 on sucess, 1 on failure + */ +static GLuint +parse_matrix (GLcontext * ctx, byte ** inst, struct arb_program *Program, + GLint * matrix, GLint * matrix_idx, GLint * matrix_modifier) +{ + byte mat = *(*inst)++; + + *matrix_idx = 0; + + switch (mat) { + case MATRIX_MODELVIEW: + *matrix = STATE_MODELVIEW; + *matrix_idx = parse_integer (inst, Program); + /* XXX: if (*matrix_idx >= ctx->Const. */ + break; + + case MATRIX_PROJECTION: + *matrix = STATE_PROJECTION; + break; + + case MATRIX_MVP: + *matrix = STATE_MVP; + break; + + case MATRIX_TEXTURE: + *matrix = STATE_TEXTURE; + *matrix_idx = parse_integer (inst, Program); + if (*matrix_idx >= ctx->Const.MaxTextureUnits) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Texture Unit"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Texture Unit: %d", *matrix_idx); + return 1; + } + break; + + /* XXX: How should we handle the palette matrix? */ + case MATRIX_PALETTE: + *matrix_idx = parse_integer (inst, Program); + break; + + case MATRIX_PROGRAM: + *matrix = STATE_PROGRAM; + *matrix_idx = parse_integer (inst, Program); + if (*matrix_idx >= ctx->Const.MaxProgramMatrices) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Matrix"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Matrix: %d", *matrix_idx); + return 1; + } + break; + } + + switch (*(*inst)++) { + case MATRIX_MODIFIER_IDENTITY: + *matrix_modifier = 0; + break; + case MATRIX_MODIFIER_INVERSE: + *matrix_modifier = STATE_MATRIX_INVERSE; + break; + case MATRIX_MODIFIER_TRANSPOSE: + *matrix_modifier = STATE_MATRIX_TRANSPOSE; + break; + case MATRIX_MODIFIER_INVTRANS: + *matrix_modifier = STATE_MATRIX_INVTRANS; + break; + } + + return 0; +} + + +/** + * This parses a state string (rather, the binary version of it) into + * a 6-token sequence as described in _mesa_fetch_state() [program.c] + * + * \param inst - the start in the binary arry to start working from + * \param state_tokens - the storage for the 6-token state description + * \return - 0 on sucess, 1 on error + */ +static GLuint +parse_state_single_item (GLcontext * ctx, byte ** inst, + struct arb_program *Program, GLint * state_tokens) +{ + switch (*(*inst)++) { + case STATE_MATERIAL_PARSER: + state_tokens[0] = STATE_MATERIAL; + state_tokens[1] = parse_face_type (inst); + switch (*(*inst)++) { + case MATERIAL_AMBIENT: + state_tokens[2] = STATE_AMBIENT; + break; + case MATERIAL_DIFFUSE: + state_tokens[2] = STATE_DIFFUSE; + break; + case MATERIAL_SPECULAR: + state_tokens[2] = STATE_SPECULAR; + break; + case MATERIAL_EMISSION: + state_tokens[2] = STATE_EMISSION; + break; + case MATERIAL_SHININESS: + state_tokens[2] = STATE_SHININESS; + break; + } + break; + + case STATE_LIGHT_PARSER: + state_tokens[0] = STATE_LIGHT; + state_tokens[1] = parse_integer (inst, Program); + + /* Check the value of state_tokens[1] against the # of lights */ + if (state_tokens[1] >= ctx->Const.MaxLights) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Light Number"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Light Number: %d", state_tokens[1]); + return 1; + } + + switch (*(*inst)++) { + case LIGHT_AMBIENT: + state_tokens[2] = STATE_AMBIENT; + break; + case LIGHT_DIFFUSE: + state_tokens[2] = STATE_DIFFUSE; + break; + case LIGHT_SPECULAR: + state_tokens[2] = STATE_SPECULAR; + break; + case LIGHT_POSITION: + state_tokens[2] = STATE_POSITION; + break; + case LIGHT_ATTENUATION: + state_tokens[2] = STATE_ATTENUATION; + break; + case LIGHT_HALF: + state_tokens[2] = STATE_HALF; + break; + case LIGHT_SPOT_DIRECTION: + state_tokens[2] = STATE_SPOT_DIRECTION; + break; + } + break; + + case STATE_LIGHT_MODEL: + switch (*(*inst)++) { + case LIGHT_MODEL_AMBIENT: + state_tokens[0] = STATE_LIGHTMODEL_AMBIENT; + break; + case LIGHT_MODEL_SCENECOLOR: + state_tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; + state_tokens[1] = parse_face_type (inst); + break; + } + break; + + case STATE_LIGHT_PROD: + state_tokens[0] = STATE_LIGHTPROD; + state_tokens[1] = parse_integer (inst, Program); + + /* Check the value of state_tokens[1] against the # of lights */ + if (state_tokens[1] >= ctx->Const.MaxLights) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Light Number"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Light Number: %d", state_tokens[1]); + return 1; + } + + state_tokens[2] = parse_face_type (inst); + switch (*(*inst)++) { + case LIGHT_PROD_AMBIENT: + state_tokens[3] = STATE_AMBIENT; + break; + case LIGHT_PROD_DIFFUSE: + state_tokens[3] = STATE_DIFFUSE; + break; + case LIGHT_PROD_SPECULAR: + state_tokens[3] = STATE_SPECULAR; + break; + } + break; + + + case STATE_FOG: + switch (*(*inst)++) { + case FOG_COLOR: + state_tokens[0] = STATE_FOG_COLOR; + break; + case FOG_PARAMS: + state_tokens[0] = STATE_FOG_PARAMS; + break; + } + break; + + /* STATE_TEX_ENV == STATE_TEX_GEN */ + case STATE_TEX_ENV: + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + state_tokens[1] = parse_integer (inst, Program); + switch (*(*inst)++) { + case TEX_ENV_COLOR: + state_tokens[0] = STATE_TEXENV_COLOR; + break; + } + } + /* For vertex programs, this case is STATE_TEX_GEN */ + else { + GLuint type, coord; + + state_tokens[0] = STATE_TEXGEN; + /*state_tokens[1] = parse_integer (inst, Program);*/ /* Texture Unit */ + + if (parse_texcoord_num (ctx, inst, Program, &coord)) + return 1; + state_tokens[1] = coord; + + /* EYE or OBJECT */ + type = *(*inst++); + + /* 0 - s, 1 - t, 2 - r, 3 - q */ + coord = *(*inst++); + + if (type == TEX_GEN_EYE) { + switch (coord) { + case COMPONENT_X: + state_tokens[2] = STATE_TEXGEN_EYE_S; + break; + case COMPONENT_Y: + state_tokens[2] = STATE_TEXGEN_EYE_T; + break; + case COMPONENT_Z: + state_tokens[2] = STATE_TEXGEN_EYE_R; + break; + case COMPONENT_W: + state_tokens[2] = STATE_TEXGEN_EYE_Q; + break; + } + } + else { + switch (coord) { + case COMPONENT_X: + state_tokens[2] = STATE_TEXGEN_OBJECT_S; + break; + case COMPONENT_Y: + state_tokens[2] = STATE_TEXGEN_OBJECT_T; + break; + case COMPONENT_Z: + state_tokens[2] = STATE_TEXGEN_OBJECT_R; + break; + case COMPONENT_W: + state_tokens[2] = STATE_TEXGEN_OBJECT_Q; + break; + } + } + } + break; + + /* STATE_DEPTH = STATE_CLIP_PLANE */ + case STATE_DEPTH: + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + switch (*(*inst)++) { + case DEPTH_RANGE: + state_tokens[0] = STATE_DEPTH_RANGE; + break; + } + } + /* for vertex programs, we want STATE_CLIP_PLANE */ + else { + state_tokens[0] = STATE_CLIPPLANE; + state_tokens[1] = parse_integer (inst, Program); + if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1])) + return 1; + } + break; + + case STATE_POINT: + switch (*(*inst++)) { + case POINT_SIZE: + state_tokens[0] = STATE_POINT_SIZE; + break; + + case POINT_ATTENUATION: + state_tokens[0] = STATE_POINT_ATTENUATION; + break; + } + break; + + /* XXX: I think this is the correct format for a matrix row */ + case STATE_MATRIX_ROWS: + state_tokens[0] = STATE_MATRIX; + + if (parse_matrix + (ctx, inst, Program, &state_tokens[1], &state_tokens[2], + &state_tokens[5])) + return 1; + + state_tokens[3] = parse_integer (inst, Program); /* The first row to grab */ + + state_tokens[4] = parse_integer (inst, Program); /* Either the last row, 0 */ + if (state_tokens[4] == 0) { + state_tokens[4] = state_tokens[3]; + } + break; + } + + return 0; +} + +/** + * This parses a state string (rather, the binary version of it) into + * a 6-token similar for the state fetching code in program.c + * + * One might ask, why fetch these parameters into just like you fetch + * state when they are already stored in other places? + * + * Because of array offsets -> We can stick env/local parameters in the + * middle of a parameter array and then index someplace into the array + * when we execute. + * + * One optimization might be to only do this for the cases where the + * env/local parameters end up inside of an array, and leave the + * single parameters (or arrays of pure env/local pareameters) in their + * respective register files. + * + * For ENV parameters, the format is: + * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM + * state_tokens[1] = STATE_ENV + * state_tokens[2] = the parameter index + * + * for LOCAL parameters, the format is: + * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM + * state_tokens[1] = STATE_LOCAL + * state_tokens[2] = the parameter index + * + * \param inst - the start in the binary arry to start working from + * \param state_tokens - the storage for the 6-token state description + * \return - 0 on sucess, 1 on failure + */ +static GLuint +parse_program_single_item (GLcontext * ctx, byte ** inst, + struct arb_program *Program, GLint * state_tokens) +{ + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) + state_tokens[0] = STATE_FRAGMENT_PROGRAM; + else + state_tokens[0] = STATE_VERTEX_PROGRAM; + + + switch (*(*inst)++) { + case PROGRAM_PARAM_ENV: + state_tokens[1] = STATE_ENV; + state_tokens[2] = parse_integer (inst, Program); + /* Check state_tokens[2] against the number of ENV parameters available */ + if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) && + (state_tokens[2] >= ctx->Const.MaxFragmentProgramEnvParams)) + || + ((Program->type == GL_VERTEX_PROGRAM_ARB) && + (state_tokens[2] >= ctx->Const.MaxVertexProgramEnvParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Env Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Env Parameter: %d", + state_tokens[2]); + return 1; + } + + break; + + case PROGRAM_PARAM_LOCAL: + state_tokens[1] = STATE_LOCAL; + state_tokens[2] = parse_integer (inst, Program); + /* Check state_tokens[2] against the number of LOCAL parameters available */ + if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) && + (state_tokens[2] >= ctx->Const.MaxFragmentProgramLocalParams)) + || + ((Program->type == GL_VERTEX_PROGRAM_ARB) && + (state_tokens[2] >= ctx->Const.MaxVertexProgramLocalParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Local Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Local Parameter: %d", + state_tokens[2]); + return 1; + } + break; + } + + return 0; +} + + +/** + * This will handle the binding side of an ATTRIB var declaration + * + * \param binding - the fragment input register state, defined in nvfragprog.h + * \param binding_idx - the index in the attrib register file that binding is associated with + * \return returns 0 on sucess, 1 on error + * + * See nvfragparse.c for attrib register file layout + */ +static GLuint +parse_attrib_binding (GLcontext * ctx, byte ** inst, + struct arb_program *Program, GLuint * binding, + GLuint * binding_idx) +{ + GLuint texcoord; + GLint coord; + GLint err = 0; + + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + switch (*(*inst)++) { + case FRAGMENT_ATTRIB_COLOR: + err = parse_color_type (ctx, inst, Program, &coord); + *binding = FRAG_ATTRIB_COL0 + coord; + *binding_idx = 1 + coord; + break; + + case FRAGMENT_ATTRIB_TEXCOORD: + err = parse_texcoord_num (ctx, inst, Program, &texcoord); + *binding = FRAG_ATTRIB_TEX0 + texcoord; + *binding_idx = 4 + texcoord; + break; + + case FRAGMENT_ATTRIB_FOGCOORD: + *binding = FRAG_ATTRIB_FOGC; + *binding_idx = 3; + break; + + case FRAGMENT_ATTRIB_POSITION: + *binding = FRAG_ATTRIB_WPOS; + *binding_idx = 0; + break; + + default: + err = 1; + break; + } + } + else { + switch (*(*inst)++) { + case VERTEX_ATTRIB_POSITION: + *binding = VERT_ATTRIB_POS; + *binding_idx = 0; + break; + + case VERTEX_ATTRIB_WEIGHT: + { + GLint weight; + + err = parse_weight_num (ctx, inst, Program, &weight); + *binding = VERT_ATTRIB_WEIGHT; + *binding_idx = 1; + } + break; + + case VERTEX_ATTRIB_NORMAL: + *binding = VERT_ATTRIB_NORMAL; + *binding_idx = 2; + break; + + case VERTEX_ATTRIB_COLOR: + { + GLint color; + + err = parse_color_type (ctx, inst, Program, &color); + if (color) { + *binding = VERT_ATTRIB_COLOR1; + *binding_idx = 4; + } + else { + *binding = VERT_ATTRIB_COLOR0; + *binding_idx = 3; + } + } + break; + + case VERTEX_ATTRIB_FOGCOORD: + *binding = VERT_ATTRIB_FOG; + *binding_idx = 5; + break; + + case VERTEX_ATTRIB_TEXCOORD: + { + GLuint unit; + + err = parse_texcoord_num (ctx, inst, Program, &unit); + *binding = VERT_ATTRIB_TEX0 + unit; + *binding_idx = 8 + unit; + } + break; + + /* XXX: It looks like we don't support this at all, atm */ + case VERTEX_ATTRIB_MATRIXINDEX: + parse_integer (inst, Program); + break; + + /* XXX: */ + case VERTEX_ATTRIB_GENERIC: + break; + + default: + err = 1; + break; + } + } + + /* Can this even happen? */ + if (err) { + _mesa_set_program_error (ctx, Program->Position, + "Bad attribute binding"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Bad attribute binding"); + } + + Program->InputsRead |= (1 << *binding_idx); + + return err; +} + +/** + * This translates between a binary token for an output variable type + * and the mesa token for the same thing. + * + * + * XXX: What is the 'name' for vertex program state? -> do we need it? + * I don't think we do; + * + * See nvfragprog.h for definitions + * + * \param inst - The parsed tokens + * \param binding - The name of the state we are binding too + * \param binding_idx - The index into the result register file that this is bound too + * + * See nvfragparse.c for the register file layout for fragment programs + * See nvvertparse.c for the register file layout for vertex programs + */ +static GLuint +parse_result_binding (GLcontext * ctx, byte ** inst, GLuint * binding, + GLuint * binding_idx, struct arb_program *Program) +{ + GLint a; + GLuint b; + + switch (*(*inst)++) { + case FRAGMENT_RESULT_COLOR: + /* for frag programs, this is FRAGMENT_RESULT_COLOR */ + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + *binding = FRAG_OUTPUT_COLR; + *binding_idx = 0; + } + /* for vtx programs, this is VERTEX_RESULT_POSITION */ + else { + *binding_idx = 0; + } + break; + + case FRAGMENT_RESULT_DEPTH: + /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + *binding = FRAG_OUTPUT_DEPR; + *binding_idx = 2; + } + /* for vtx programs, this is VERTEX_RESULT_COLOR */ + else { + GLint color_type; + GLuint face_type = parse_face_type(inst); + GLint color_type_ret = parse_color_type(ctx, inst, Program, &color_type); + + /* back face */ + if (face_type) { + if (color_type_ret) return 1; + + /* secondary color */ + if (color_type) { + *binding_idx = 4; + } + /* primary color */ + else { + *binding_idx = 3; + } + } + /* front face */ + else { + /* secondary color */ + if (color_type) { + *binding_idx = 2; + } + /* primary color */ + else { + *binding_idx = 1; + } + } + } + break; + + case VERTEX_RESULT_FOGCOORD: + *binding_idx = 5; + break; + + case VERTEX_RESULT_POINTSIZE: + *binding_idx = 6; + break; + + case VERTEX_RESULT_TEXCOORD: + if (parse_texcoord_num (ctx, inst, Program, &b)) + return 1; + *binding_idx = 7 + b; + break; + } + + Program->OutputsWritten |= (1 << *binding_idx); + + return 0; +} + +/** + * This handles the declaration of ATTRIB variables + * + * XXX: Still needs + * parse_vert_attrib_binding(), or something like that + * + * \return 0 on sucess, 1 on error + */ +static GLint +parse_attrib (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + char *error_msg; + struct var_cache *attrib_var; + + attrib_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = + _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + attrib_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + attrib_var->type = vt_attrib; + + /* I think this is ok now - karl */ + /* XXX: */ + /*if (Program->type == GL_FRAGMENT_PROGRAM_ARB) */ + { + if (parse_attrib_binding + (ctx, inst, Program, &attrib_var->attrib_binding, + &attrib_var->attrib_binding_idx)) + return 1; + } + + Program->Base.NumAttributes++; + return 0; +} + +/** + * \param use -- TRUE if we're called when declaring implicit parameters, + * FALSE if we're declaraing variables. This has to do with + * if we get a signed or unsigned float for scalar constants + */ +static GLuint +parse_param_elements (GLcontext * ctx, byte ** inst, + struct var_cache *param_var, + struct arb_program *Program, GLboolean use) +{ + GLint idx; + GLuint found, specified_length, err; + GLint state_tokens[6]; + GLfloat const_values[4]; + char *error_msg; + + err = 0; + + switch (*(*inst)++) { + case PARAM_STATE_ELEMENT: + if (parse_state_single_item (ctx, inst, Program, state_tokens)) + return 1; + + /* If we adding STATE_MATRIX that has multiple rows, we need to + * unroll it and call _mesa_add_state_reference() for each row + */ + if ((state_tokens[0] == STATE_MATRIX) + && (state_tokens[3] != state_tokens[4])) { + GLint row; + GLint first_row = state_tokens[3]; + GLint last_row = state_tokens[4]; + + for (row = first_row; row <= last_row; row++) { + state_tokens[3] = state_tokens[4] = row; + + idx = + _mesa_add_state_reference (Program->Parameters, + state_tokens); + if (param_var->param_binding_begin == -1) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + } + else { + idx = + _mesa_add_state_reference (Program->Parameters, state_tokens); + if (param_var->param_binding_begin == -1) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + break; + + case PARAM_PROGRAM_ELEMENT: + if (parse_program_single_item (ctx, inst, Program, state_tokens)) + return 1; + idx = _mesa_add_state_reference (Program->Parameters, state_tokens); + if (param_var->param_binding_begin == -1) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + + /* Check if there is more: 0 -> we're done, else its an integer */ + if (**inst) { + GLuint out_of_range, new_idx; + GLuint start_idx = state_tokens[2] + 1; + GLuint end_idx = parse_integer (inst, Program); + + out_of_range = 0; + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + if (((state_tokens[1] == STATE_ENV) + && (end_idx >= ctx->Const.MaxFragmentProgramEnvParams)) + || ((state_tokens[1] == STATE_LOCAL) + && (end_idx >= + ctx->Const.MaxFragmentProgramLocalParams))) + out_of_range = 1; + } + else { + if (((state_tokens[1] == STATE_ENV) + && (end_idx >= ctx->Const.MaxFragmentProgramEnvParams)) + || ((state_tokens[1] == STATE_LOCAL) + && (end_idx >= + ctx->Const.MaxFragmentProgramLocalParams))) + out_of_range = 1; + } + if (out_of_range) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Parameter: %d", end_idx); + return 1; + } + + for (new_idx = start_idx; new_idx <= end_idx; new_idx++) { + state_tokens[2] = new_idx; + idx = + _mesa_add_state_reference (Program->Parameters, + state_tokens); + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + } + break; + + case PARAM_CONSTANT: + parse_constant (inst, const_values, Program, use); + idx = + _mesa_add_named_constant (Program->Parameters, + (char *) param_var->name, const_values); + if (param_var->param_binding_begin == -1) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unexpected token in parse_param_elements()"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unexpected token in parse_param_elements()"); + return 1; + } + + /* Make sure we haven't blown past our parameter limits */ + if (((Program->type == GL_VERTEX_PROGRAM_ARB) && + (Program->Base.NumParameters >= + ctx->Const.MaxVertexProgramLocalParams)) + || ((Program->type == GL_FRAGMENT_PROGRAM_ARB) + && (Program->Base.NumParameters >= + ctx->Const.MaxFragmentProgramLocalParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Too many parameter variables"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Too many parameter variables"); + return 1; + } + + return err; +} + +/** + * This picks out PARAM program parameter bindings. + * + * XXX: This needs to be stressed & tested + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_param (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found, specified_length, err; + GLint state_tokens[6]; + GLfloat const_values[4]; + char *error_msg; + struct var_cache *param_var; + + err = 0; + param_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (found) { + error_msg = _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + param_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + specified_length = parse_integer (inst, Program); + + if (specified_length < 0) { + _mesa_set_program_error (ctx, Program->Position, + "Negative parameter array length"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Negative parameter array length: %d", specified_length); + return 1; + } + + param_var->type = vt_param; + param_var->param_binding_length = 0; + + /* Right now, everything is shoved into the main state register file. + * + * In the future, it would be nice to leave things ENV/LOCAL params + * in their respective register files, if possible + */ + param_var->param_binding_type = PROGRAM_STATE_VAR; + + /* Remember to: + * * - add each guy to the parameter list + * * - increment the param_var->param_binding_len + * * - store the param_var->param_binding_begin for the first one + * * - compare the actual len to the specified len at the end + */ + while (**inst != PARAM_NULL) { + if (parse_param_elements (ctx, inst, param_var, Program, GL_FALSE)) + return 1; + } + + /* Test array length here! */ + if (specified_length) { + if (specified_length != param_var->param_binding_length) { + _mesa_set_program_error (ctx, Program->Position, + "Declared parameter array lenght does not match parameter list"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Declared parameter array lenght does not match parameter list"); + } + } + + (*inst)++; + + return 0; +} + +/** + * + */ +static GLuint +parse_param_use (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program, struct var_cache **new_var) +{ + struct var_cache *param_var; + + /* First, insert a dummy entry into the var_cache */ + var_cache_create (¶m_var); + param_var->name = (byte *) _mesa_strdup (" "); + param_var->type = vt_param; + + param_var->param_binding_length = 0; + /* Don't fill in binding_begin; We use the default value of -1 + * to tell if its already initialized, elsewhere. + * + * param_var->param_binding_begin = 0; + */ + param_var->param_binding_type = PROGRAM_STATE_VAR; + + + var_cache_append (vc_head, param_var); + + /* Then fill it with juicy parameter goodness */ + if (parse_param_elements (ctx, inst, param_var, Program, GL_TRUE)) + return 1; + + *new_var = param_var; + + return 0; +} + + +/** + * This handles the declaration of TEMP variables + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_temp (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + while (**inst != 0) { + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_temp; + + if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) && + (Program->Base.NumTemporaries >= + ctx->Const.MaxFragmentProgramTemps)) + || ((Program->type == GL_VERTEX_PROGRAM_ARB) + && (Program->Base.NumTemporaries >= + ctx->Const.MaxVertexProgramTemps))) { + _mesa_set_program_error (ctx, Program->Position, + "Too many TEMP variables declared"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Too many TEMP variables declared"); + return 1; + } + + temp_var->temp_binding = Program->Base.NumTemporaries; + Program->Base.NumTemporaries++; + } + (*inst)++; + + return 0; +} + +/** + * This handles variables of the OUTPUT variety + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_output (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *output_var; + + output_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + char *error_msg; + error_msg = + _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + output_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + output_var->type = vt_output; + return parse_result_binding (ctx, inst, &output_var->output_binding, + &output_var->output_binding_idx, Program); +} + +/** + * This handles variables of the ALIAS kind + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_alias (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + while (**inst != 0) { + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_temp; + + if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) && + (Program->Base.NumTemporaries >= + ctx->Const.MaxFragmentProgramTemps)) + || ((Program->type == GL_VERTEX_PROGRAM_ARB) + && (Program->Base.NumTemporaries >= + ctx->Const.MaxVertexProgramTemps))) { + _mesa_set_program_error (ctx, Program->Position, + "Too many TEMP variables declared"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Too many TEMP variables declared"); + return 1; + } + + temp_var->temp_binding = Program->Base.NumTemporaries; + Program->Base.NumTemporaries++; + } + (*inst)++; + + return 0; +} + +/** + * This handles variables of the ADDRESS kind + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_address (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + while (**inst != 0) { + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_address; + + if (Program->Base.NumAddressRegs >= + ctx->Const.MaxVertexProgramAddressRegs) { + _mesa_set_program_error (ctx, Program->Position, + "Too many ADDRESS variables declared"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Too many ADDRESS variables declared"); + return 1; + } + + temp_var->address_binding = Program->Base.NumAddressRegs; + Program->Base.NumAddressRegs++; + } + (*inst)++; + + return 0; +} + +/** + * Parse a program declaration + * + * \return 0 on sucess, 1 on error + */ +static GLint +parse_declaration (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLint err = 0; + + switch (*(*inst)++) { + case ADDRESS: + err = parse_address (ctx, inst, vc_head, Program); + break; + + case ALIAS: + err = parse_alias (ctx, inst, vc_head, Program); + break; + + case ATTRIB: + err = parse_attrib (ctx, inst, vc_head, Program); + break; + + case OUTPUT: + err = parse_output (ctx, inst, vc_head, Program); + break; + + case PARAM: + err = parse_param (ctx, inst, vc_head, Program); + break; + + case TEMP: + err = parse_temp (ctx, inst, vc_head, Program); + break; + } + + return err; +} + +/** + * Handle the parsing out of a masked destination register + * + * \param File - The register file we write to + * \param Index - The register index we write to + * \param WriteMask - The mask controlling which components we write (1->write) + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_masked_dst_reg (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + GLint * File, GLint * Index, GLboolean * WriteMask) +{ + GLuint err, result; + byte mask; + struct var_cache *dst; + + /* We either have a result register specified, or a + * variable that may or may not be writable + */ + switch (*(*inst)++) { + case REGISTER_RESULT: + if (parse_result_binding + (ctx, inst, &result, (GLuint *) Index, Program)) + return 1; + *File = PROGRAM_OUTPUT; + break; + + case REGISTER_ESTABLISHED_NAME: + dst = parse_string (inst, vc_head, Program, &result); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!result) { + _mesa_set_program_error (ctx, Program->Position, + "Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s", + dst->name); + return 1; + } + + switch (dst->type) { + case vt_output: + *File = PROGRAM_OUTPUT; + *Index = dst->output_binding_idx; + break; + + case vt_temp: + *File = PROGRAM_TEMPORARY; + *Index = dst->temp_binding; + break; + + /* If the var type is not vt_output or vt_temp, no go */ + default: + _mesa_set_program_error (ctx, Program->Position, + "Destination register is read only"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Destination register is read only: %s", + dst->name); + return 1; + } + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unexpected opcode in parse_masked_dst_reg()"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unexpected opcode in parse_masked_dst_reg()"); + return 1; + } + + /* And then the mask. + * w,a -> bit 0 + * z,b -> bit 1 + * y,g -> bit 2 + * x,r -> bit 3 + */ + mask = *(*inst)++; + + WriteMask[0] = (mask & (1 << 3)) >> 3; + WriteMask[1] = (mask & (1 << 2)) >> 2; + WriteMask[2] = (mask & (1 << 1)) >> 1; + WriteMask[3] = (mask & (1)); + + return 0; +} + +/** + * Handle the parsing out of a masked address register + * + * \param Index - The register index we write to + * \param WriteMask - The mask controlling which components we write (1->write) + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_masked_address_reg (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, + struct arb_program *Program, GLint * Index, + GLboolean * WriteMask) +{ + GLuint err, result; + byte mask; + struct var_cache *dst; + + dst = parse_string (inst, vc_head, Program, &result); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!result) { + _mesa_set_program_error (ctx, Program->Position, "Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s", + dst->name); + return 1; + } + + if (dst->type != vt_address) { + _mesa_set_program_error (ctx, Program->Position, + "Variable is not of type ADDRESS"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Variable: %s is not of type ADDRESS", dst->name); + return 1; + } + + /* Writemask of .x is implied */ + WriteMask[0] = 1; + WriteMask[1] = WriteMask[2] = WriteMask[3] = 0; + + return 0; +} + +/** + * Parse out a swizzle mask. + * + * The values in the input stream are: + * COMPONENT_X -> x/r + * COMPONENT_Y -> y/g + * COMPONENT_Z-> z/b + * COMPONENT_W-> w/a + * + * The values in the output mask are: + * 0 -> x/r + * 1 -> y/g + * 2 -> z/b + * 3 -> w/a + * + * The len parameter allows us to grab 4 components for a vector + * swizzle, or just 1 component for a scalar src register selection + */ +static GLuint +parse_swizzle_mask (byte ** inst, GLubyte * mask, GLint len) +{ + GLint a; + + for (a = 0; a < 4; a++) + mask[a] = a; + + for (a = 0; a < len; a++) { + switch (*(*inst)++) { + case COMPONENT_X: + mask[a] = 0; + break; + + case COMPONENT_Y: + mask[a] = 1; + break; + + case COMPONENT_Z: + mask[a] = 2; + break; + + case COMPONENT_W: + mask[a] = 3; + break; + } + } + + return 0; +} + +/** + */ +static GLuint +parse_extended_swizzle_mask (byte ** inst, GLubyte * mask, GLboolean * Negate) +{ + GLint a; + byte swz; + + *Negate = GL_FALSE; + for (a = 0; a < 4; a++) { + if (parse_sign (inst)) + *Negate = GL_TRUE; + + swz = *(*inst)++; + + switch (swz) { + case COMPONENT_0: + mask[a] = SWIZZLE_ZERO; + break; + case COMPONENT_1: + mask[a] = SWIZZLE_ONE; + break; + case COMPONENT_X: + mask[a] = 0; + break; + case COMPONENT_Y: + mask[a] = 1; + break; + case COMPONENT_Z: + mask[a] = 2; + break; + case COMPONENT_W: + mask[a] = 3; + break; + + } +#if 0 + if (swz == 0) + mask[a] = SWIZZLE_ZERO; + else if (swz == 1) + mask[a] = SWIZZLE_ONE; + else + mask[a] = swz - 2; +#endif + + } + + return 0; +} + + +static GLuint +parse_src_reg (GLcontext * ctx, byte ** inst, struct var_cache **vc_head, + struct arb_program *Program, GLint * File, GLint * Index) +{ + struct var_cache *src; + GLuint binding_state, binding_idx, found, offset; + + /* And the binding for the src */ + switch (*(*inst)++) { + case REGISTER_ATTRIB: + if (parse_attrib_binding + (ctx, inst, Program, &binding_state, &binding_idx)) + return 1; + *File = PROGRAM_INPUT; + *Index = binding_idx; + break; + + case REGISTER_PARAM: + + switch (**inst) { + case PARAM_ARRAY_ELEMENT: + *(*inst)++; + src = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (!found) { + _mesa_set_program_error (ctx, Program->Position, + "Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Undefined variable: %s", src->name); + return 1; + } + + *File = src->param_binding_type; + + switch (*(*inst)++) { + case ARRAY_INDEX_ABSOLUTE: + offset = parse_integer (inst, Program); + + if ((offset < 0) + || (offset >= src->param_binding_length)) { + _mesa_set_program_error (ctx, Program->Position, + "Index out of range"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Index %d out of range for %s", offset, + src->name); + return 1; + } + + *Index = src->param_binding_begin + offset; + break; + + /* XXX: */ + case ARRAY_INDEX_RELATIVE: + break; + } + break; + + default: + if (parse_param_use (ctx, inst, vc_head, Program, &src)) + return 1; + + *File = src->param_binding_type; + *Index = src->param_binding_begin; + break; + } + break; + + case REGISTER_ESTABLISHED_NAME: + src = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!found) { + _mesa_set_program_error (ctx, Program->Position, + "Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s", + src->name); + return 1; + } + + switch (src->type) { + case vt_attrib: + *File = PROGRAM_INPUT; + *Index = src->attrib_binding_idx; + break; + + /* XXX: We have to handle offsets someplace in here! -- or are those above? */ + case vt_param: + *File = src->param_binding_type; + *Index = src->param_binding_begin; + break; + + case vt_temp: + *File = PROGRAM_TEMPORARY; + *Index = src->temp_binding; + break; + + /* If the var type is vt_output no go */ + default: + _mesa_set_program_error (ctx, Program->Position, + "destination register is read only"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "destination register is read only: %s", + src->name); + return 1; + } + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unknown token in parse_src_reg"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unknown token in parse_src_reg"); + return 1; + } + + return 0; +} + +/** + */ +static GLuint +parse_vector_src_reg (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + GLint * File, GLint * Index, GLboolean * Negate, + GLubyte * Swizzle) +{ + /* Grab the sign */ + *Negate = parse_sign (inst); + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, File, Index)) + return 1; + + /* finally, the swizzle */ + parse_swizzle_mask (inst, Swizzle, 4); + + return 0; +} + +/** + */ +static GLuint +parse_scalar_src_reg (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + GLint * File, GLint * Index, GLboolean * Negate, + GLubyte * Swizzle) +{ + GLint a; + + /* Grab the sign */ + *Negate = parse_sign (inst); + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, File, Index)) + return 1; + + /* Now, get the component and shove it into all the swizzle slots */ + parse_swizzle_mask (inst, Swizzle, 1); + + return 0; +} + +/** + * This is a big mother that handles getting opcodes into the instruction + * and handling the src & dst registers for fragment program instructions + */ +static GLuint +parse_fp_instruction (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct fp_instruction *fp) +{ + GLint a, b; + GLubyte swz[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */ + GLuint texcoord; + byte class, type, code; + + /* No condition codes in ARB_fp */ + fp->UpdateCondRegister = 0; + + /* Record the position in the program string for debugging */ + fp->StringPos = Program->Position; + + /* F_ALU_INST or F_TEX_INST */ + class = *(*inst)++; + + /* F_ALU_{VECTOR, SCALAR, BINSC, BIN, TRI, SWZ}, + * F_TEX_{SAMPLE, KIL} + */ + type = *(*inst)++; + + /* The actual opcode name */ + code = *(*inst)++; + + + /* Increment the correct count */ + switch (class) { + case F_ALU_INST: + Program->NumAluInstructions++; + break; + case F_TEX_INST: + Program->NumTexInstructions++; + break; + } + + fp->Saturate = 0; + fp->Precision = FLOAT32; + + fp->DstReg.CondMask = COND_TR; + + switch (type) { + case F_ALU_VECTOR: + switch (code) { + case F_ABS_SAT: + fp->Saturate = 1; + case F_ABS: + fp->Opcode = FP_OPCODE_ABS; + break; + + case F_FLR_SAT: + fp->Saturate = 1; + case F_FLR: + fp->Opcode = FP_OPCODE_FLR; + break; + + case F_FRC_SAT: + fp->Saturate = 1; + case F_FRC: + fp->Opcode = FP_OPCODE_FRC; + break; + + case F_LIT_SAT: + fp->Saturate = 1; + case F_LIT: + fp->Opcode = FP_OPCODE_LIT; + break; + + case F_MOV_SAT: + fp->Saturate = 1; + case F_MOV: + fp->Opcode = FP_OPCODE_MOV; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + + fp->SrcReg[0].Abs = GL_FALSE; + fp->SrcReg[0].NegateAbs = GL_FALSE; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File, + &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[0].Swizzle[b] = swz[b]; + break; + + case F_ALU_SCALAR: + switch (code) { + case F_COS_SAT: + fp->Saturate = 1; + case F_COS: + fp->Opcode = FP_OPCODE_COS; + break; + + case F_EX2_SAT: + fp->Saturate = 1; + case F_EX2: + fp->Opcode = FP_OPCODE_EX2; + break; + + case F_LG2_SAT: + fp->Saturate = 1; + case F_LG2: + fp->Opcode = FP_OPCODE_LG2; + break; + + case F_RCP_SAT: + fp->Saturate = 1; + case F_RCP: + fp->Opcode = FP_OPCODE_RCP; + break; + + case F_RSQ_SAT: + fp->Saturate = 1; + case F_RSQ: + fp->Opcode = FP_OPCODE_RSQ; + break; + + case F_SIN_SAT: + fp->Saturate = 1; + case F_SIN: + fp->Opcode = FP_OPCODE_SIN; + break; + + case F_SCS_SAT: + fp->Saturate = 1; + case F_SCS: + fp->Opcode = FP_OPCODE_SCS; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + fp->SrcReg[0].Abs = GL_FALSE; + fp->SrcReg[0].NegateAbs = GL_FALSE; + if (parse_scalar_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File, + &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[0].Swizzle[b] = swz[b]; + break; + + case F_ALU_BINSC: + switch (code) { + case F_POW_SAT: + fp->Saturate = 1; + case F_POW: + fp->Opcode = FP_OPCODE_POW; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 2; a++) { + fp->SrcReg[a].Abs = GL_FALSE; + fp->SrcReg[a].NegateAbs = GL_FALSE; + if (parse_scalar_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File, + &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[a].Swizzle[b] = swz[b]; + } + break; + + + case F_ALU_BIN: + switch (code) { + case F_ADD_SAT: + fp->Saturate = 1; + case F_ADD: + fp->Opcode = FP_OPCODE_ADD; + break; + + case F_DP3_SAT: + fp->Saturate = 1; + case F_DP3: + fp->Opcode = FP_OPCODE_DP3; + break; + + case F_DP4_SAT: + fp->Saturate = 1; + case F_DP4: + fp->Opcode = FP_OPCODE_DP4; + break; + + case F_DPH_SAT: + fp->Saturate = 1; + case F_DPH: + fp->Opcode = FP_OPCODE_DPH; + break; + + case F_DST_SAT: + fp->Saturate = 1; + case F_DST: + fp->Opcode = FP_OPCODE_DST; + break; + + case F_MAX_SAT: + fp->Saturate = 1; + case F_MAX: + fp->Opcode = FP_OPCODE_MAX; + break; + + case F_MIN_SAT: + fp->Saturate = 1; + case F_MIN: + fp->Opcode = FP_OPCODE_MIN; + break; + + case F_MUL_SAT: + fp->Saturate = 1; + case F_MUL: + fp->Opcode = FP_OPCODE_MUL; + break; + + case F_SGE_SAT: + fp->Saturate = 1; + case F_SGE: + fp->Opcode = FP_OPCODE_SGE; + break; + + case F_SLT_SAT: + fp->Saturate = 1; + case F_SLT: + fp->Opcode = FP_OPCODE_SLT; + break; + + case F_SUB_SAT: + fp->Saturate = 1; + case F_SUB: + fp->Opcode = FP_OPCODE_SUB; + break; + + case F_XPD_SAT: + fp->Saturate = 1; + case F_XPD: + fp->Opcode = FP_OPCODE_X2D; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 2; a++) { + fp->SrcReg[a].Abs = GL_FALSE; + fp->SrcReg[a].NegateAbs = GL_FALSE; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File, + &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[a].Swizzle[b] = swz[b]; + } + break; + + case F_ALU_TRI: + switch (code) { + case F_CMP_SAT: + fp->Saturate = 1; + case F_CMP: + fp->Opcode = FP_OPCODE_CMP; + break; + + case F_LRP_SAT: + fp->Saturate = 1; + case F_LRP: + fp->Opcode = FP_OPCODE_LRP; + break; + + case F_MAD_SAT: + fp->Saturate = 1; + case F_MAD: + fp->Opcode = FP_OPCODE_MAD; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 3; a++) { + fp->SrcReg[a].Abs = GL_FALSE; + fp->SrcReg[a].NegateAbs = GL_FALSE; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[a].File, + &fp->SrcReg[a].Index, &fp->SrcReg[a].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[a].Swizzle[b] = swz[b]; + } + break; + + case F_ALU_SWZ: + switch (code) { + case F_SWZ_SAT: + fp->Saturate = 1; + case F_SWZ: + fp->Opcode = FP_OPCODE_SWZ; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + + if (parse_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File, + &fp->SrcReg[0].Index)) + return 1; + parse_extended_swizzle_mask (inst, swz, + &fp->SrcReg[0].NegateBase); + for (b=0; b<4; b++) + fp->SrcReg[0].Swizzle[b] = swz[b]; + break; + + case F_TEX_SAMPLE: + switch (code) { + case F_TEX_SAT: + fp->Saturate = 1; + case F_TEX: + fp->Opcode = FP_OPCODE_TEX; + break; + + case F_TXP_SAT: + fp->Saturate = 1; + case F_TXP: + fp->Opcode = FP_OPCODE_TXP; + break; + + case F_TXB_SAT: + fp->Saturate = 1; + case F_TXB: + fp->Opcode = FP_OPCODE_TXB; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->DstReg.File, + &fp->DstReg.Index, fp->DstReg.WriteMask)) + return 1; + fp->SrcReg[0].Abs = GL_FALSE; + fp->SrcReg[0].NegateAbs = GL_FALSE; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File, + &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[0].Swizzle[b] = swz[b]; + + /* texImageUnit */ + if (parse_texcoord_num (ctx, inst, Program, &texcoord)) + return 1; + fp->TexSrcUnit = texcoord; + + /* texTarget */ + switch (*(*inst)) { + case TEXTARGET_1D: + fp->TexSrcBit = TEXTURE_1D_BIT; + break; + case TEXTARGET_2D: + fp->TexSrcBit = TEXTURE_2D_BIT; + break; + case TEXTARGET_3D: + fp->TexSrcBit = TEXTURE_3D_BIT; + break; + case TEXTARGET_RECT: + fp->TexSrcBit = TEXTURE_RECT_BIT; + break; + case TEXTARGET_CUBE: + fp->TexSrcBit = TEXTURE_CUBE_BIT; + break; + } + break; + + case F_TEX_KIL: + fp->Opcode = FP_OPCODE_KIL; + fp->SrcReg[0].Abs = GL_FALSE; + fp->SrcReg[0].NegateAbs = GL_FALSE; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & fp->SrcReg[0].File, + &fp->SrcReg[0].Index, &fp->SrcReg[0].NegateBase, + swz)) + return 1; + for (b=0; b<4; b++) + fp->SrcReg[0].Swizzle[b] = swz[b]; + break; + } + + return 0; +} + +/** + * This is a big mother that handles getting opcodes into the instruction + * and handling the src & dst registers for vertex program instructions + */ +static GLuint +parse_vp_instruction (GLcontext * ctx, byte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct vp_instruction *vp) +{ + GLint a; + byte type, code; + + /* V_GEN_{ARL, VECTOR, SCALAR, BINSC, BIN, TRI, SWZ} */ + type = *(*inst)++; + + /* The actual opcode name */ + code = *(*inst)++; + + vp->SrcReg[0].RelAddr = vp->SrcReg[1].RelAddr = vp->SrcReg[2].RelAddr = 0; + + for (a = 0; a < 4; a++) { + vp->SrcReg[0].Swizzle[a] = a; + vp->SrcReg[1].Swizzle[a] = a; + vp->SrcReg[2].Swizzle[a] = a; + vp->DstReg.WriteMask[a] = 1; + } + + switch (type) { + /* XXX: */ + case V_GEN_ARL: + vp->Opcode = VP_OPCODE_ARL; + + /* Remember to set SrcReg.RelAddr; */ + + /* Get the masked address register [dst] */ + if (parse_masked_address_reg + (ctx, inst, vc_head, Program, &vp->DstReg.Index, + vp->DstReg.WriteMask)) + return 1; + vp->DstReg.File = PROGRAM_ADDRESS; + + + /* Get a scalar src register */ + if (parse_scalar_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File, + &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate, + vp->SrcReg[0].Swizzle)) + return 1; + + break; + + case V_GEN_VECTOR: + switch (code) { + case V_ABS: + vp->Opcode = VP_OPCODE_ABS; + break; + case V_FLR: + vp->Opcode = VP_OPCODE_FLR; + break; + case V_FRC: + vp->Opcode = VP_OPCODE_FRC; + break; + case V_LIT: + vp->Opcode = VP_OPCODE_LIT; + break; + case V_MOV: + vp->Opcode = VP_OPCODE_MOV; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File, + &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate, + vp->SrcReg[0].Swizzle)) + return 1; + break; + + case V_GEN_SCALAR: + switch (code) { + case V_EX2: + vp->Opcode = VP_OPCODE_EX2; + break; + case V_EXP: + vp->Opcode = VP_OPCODE_EXP; + break; + case V_LG2: + vp->Opcode = VP_OPCODE_LG2; + break; + case V_LOG: + vp->Opcode = VP_OPCODE_LOG; + break; + case V_RCP: + vp->Opcode = VP_OPCODE_RCP; + break; + case V_RSQ: + vp->Opcode = VP_OPCODE_RSQ; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + if (parse_scalar_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File, + &vp->SrcReg[0].Index, &vp->SrcReg[0].Negate, + vp->SrcReg[0].Swizzle)) + return 1; + break; + + case V_GEN_BINSC: + switch (code) { + case V_POW: + vp->Opcode = VP_OPCODE_POW; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 2; a++) { + if (parse_scalar_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File, + &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate, + vp->SrcReg[a].Swizzle)) + return 1; + } + break; + + case V_GEN_BIN: + switch (code) { + case V_ADD: + vp->Opcode = VP_OPCODE_ADD; + break; + case V_DP3: + vp->Opcode = VP_OPCODE_DP3; + break; + case V_DP4: + vp->Opcode = VP_OPCODE_DP4; + break; + case V_DPH: + vp->Opcode = VP_OPCODE_DPH; + break; + case V_DST: + vp->Opcode = VP_OPCODE_DST; + break; + case V_MAX: + vp->Opcode = VP_OPCODE_MAX; + break; + case V_MIN: + vp->Opcode = VP_OPCODE_MIN; + break; + case V_MUL: + vp->Opcode = VP_OPCODE_MUL; + break; + case V_SGE: + vp->Opcode = VP_OPCODE_SGE; + break; + case V_SLT: + vp->Opcode = VP_OPCODE_SLT; + break; + case V_SUB: + vp->Opcode = VP_OPCODE_SUB; + break; + case V_XPD: + vp->Opcode = VP_OPCODE_XPD; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 2; a++) { + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File, + &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate, + vp->SrcReg[a].Swizzle)) + return 1; + } + break; + + case V_GEN_TRI: + switch (code) { + case V_MAD: + vp->Opcode = VP_OPCODE_MAD; + break; + } + + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + for (a = 0; a < 3; a++) { + if (parse_vector_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[a].File, + &vp->SrcReg[a].Index, &vp->SrcReg[a].Negate, + vp->SrcReg[a].Swizzle)) + return 1; + } + break; + + case V_GEN_SWZ: + switch (code) { + case V_SWZ: + vp->Opcode = VP_OPCODE_SWZ; + break; + } + if (parse_masked_dst_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->DstReg.File, + &vp->DstReg.Index, vp->DstReg.WriteMask)) + return 1; + + if (parse_src_reg + (ctx, inst, vc_head, Program, (GLint *) & vp->SrcReg[0].File, + &vp->SrcReg[0].Index)) + return 1; + parse_extended_swizzle_mask (inst, vp->SrcReg[0].Swizzle, + &vp->SrcReg[0].Negate); + break; + } + return 0; +} + +#if DEBUG_PARSING + +static GLvoid +print_state_token (GLint token) +{ + switch (token) { + case STATE_MATERIAL: + fprintf (stderr, "STATE_MATERIAL "); + break; + case STATE_LIGHT: + fprintf (stderr, "STATE_LIGHT "); + break; + + case STATE_LIGHTMODEL_AMBIENT: + fprintf (stderr, "STATE_AMBIENT "); + break; + + case STATE_LIGHTMODEL_SCENECOLOR: + fprintf (stderr, "STATE_SCENECOLOR "); + break; + + case STATE_LIGHTPROD: + fprintf (stderr, "STATE_LIGHTPROD "); + break; + + case STATE_TEXGEN: + fprintf (stderr, "STATE_TEXGEN "); + break; + + case STATE_FOG_COLOR: + fprintf (stderr, "STATE_FOG_COLOR "); + break; + + case STATE_FOG_PARAMS: + fprintf (stderr, "STATE_FOG_PARAMS "); + break; + + case STATE_CLIPPLANE: + fprintf (stderr, "STATE_CLIPPLANE "); + break; + + case STATE_POINT_SIZE: + fprintf (stderr, "STATE_POINT_SIZE "); + break; + + case STATE_POINT_ATTENUATION: + fprintf (stderr, "STATE_ATTENUATION "); + break; + + case STATE_MATRIX: + fprintf (stderr, "STATE_MATRIX "); + break; + + case STATE_MODELVIEW: + fprintf (stderr, "STATE_MODELVIEW "); + break; + + case STATE_PROJECTION: + fprintf (stderr, "STATE_PROJECTION "); + break; + + case STATE_MVP: + fprintf (stderr, "STATE_MVP "); + break; + + case STATE_TEXTURE: + fprintf (stderr, "STATE_TEXTURE "); + break; + + case STATE_PROGRAM: + fprintf (stderr, "STATE_PROGRAM "); + break; + + case STATE_MATRIX_INVERSE: + fprintf (stderr, "STATE_INVERSE "); + break; + + case STATE_MATRIX_TRANSPOSE: + fprintf (stderr, "STATE_TRANSPOSE "); + break; + + case STATE_MATRIX_INVTRANS: + fprintf (stderr, "STATE_INVTRANS "); + break; + + case STATE_AMBIENT: + fprintf (stderr, "STATE_AMBIENT "); + break; + + case STATE_DIFFUSE: + fprintf (stderr, "STATE_DIFFUSE "); + break; + + case STATE_SPECULAR: + fprintf (stderr, "STATE_SPECULAR "); + break; + + case STATE_EMISSION: + fprintf (stderr, "STATE_EMISSION "); + break; + + case STATE_SHININESS: + fprintf (stderr, "STATE_SHININESS "); + break; + + case STATE_HALF: + fprintf (stderr, "STATE_HALF "); + break; + + case STATE_POSITION: + fprintf (stderr, "STATE_POSITION "); + break; + + case STATE_ATTENUATION: + fprintf (stderr, "STATE_ATTENUATION "); + break; + + case STATE_SPOT_DIRECTION: + fprintf (stderr, "STATE_DIRECTION "); + break; + + case STATE_TEXGEN_EYE_S: + fprintf (stderr, "STATE_TEXGEN_EYE_S "); + break; + + case STATE_TEXGEN_EYE_T: + fprintf (stderr, "STATE_TEXGEN_EYE_T "); + break; + + case STATE_TEXGEN_EYE_R: + fprintf (stderr, "STATE_TEXGEN_EYE_R "); + break; + + case STATE_TEXGEN_EYE_Q: + fprintf (stderr, "STATE_TEXGEN_EYE_Q "); + break; + + case STATE_TEXGEN_OBJECT_S: + fprintf (stderr, "STATE_TEXGEN_EYE_S "); + break; + + case STATE_TEXGEN_OBJECT_T: + fprintf (stderr, "STATE_TEXGEN_OBJECT_T "); + break; + + case STATE_TEXGEN_OBJECT_R: + fprintf (stderr, "STATE_TEXGEN_OBJECT_R "); + break; + + case STATE_TEXGEN_OBJECT_Q: + fprintf (stderr, "STATE_TEXGEN_OBJECT_Q "); + break; + + case STATE_TEXENV_COLOR: + fprintf (stderr, "STATE_TEXENV_COLOR "); + break; + + case STATE_DEPTH_RANGE: + fprintf (stderr, "STATE_DEPTH_RANGE "); + break; + + case STATE_VERTEX_PROGRAM: + fprintf (stderr, "STATE_VERTEX_PROGRAM "); + break; + + case STATE_FRAGMENT_PROGRAM: + fprintf (stderr, "STATE_FRAGMENT_PROGRAM "); + break; + + case STATE_ENV: + fprintf (stderr, "STATE_ENV "); + break; + + case STATE_LOCAL: + fprintf (stderr, "STATE_LOCAL "); + break; + + } + fprintf (stderr, "[%d] ", token); +} + + + + +static GLvoid +debug_variables (GLcontext * ctx, struct var_cache *vc_head, + struct arb_program *Program) +{ + struct var_cache *vc; + GLint a, b; + + fprintf (stderr, "debug_variables, vc_head: %x\n", vc_head); + + /* First of all, print out the contents of the var_cache */ + vc = vc_head; + while (vc) { + fprintf (stderr, "[%x]\n", vc); + switch (vc->type) { + case vt_none: + fprintf (stderr, "UNDEFINED %s\n", vc->name); + break; + case vt_attrib: + fprintf (stderr, "ATTRIB %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->attrib_binding); + break; + case vt_param: + fprintf (stderr, "PARAM %s begin: %d len: %d\n", vc->name, + vc->param_binding_begin, vc->param_binding_length); + b = vc->param_binding_begin; + for (a = 0; a < vc->param_binding_length; a++) { + fprintf (stderr, "%s\n", + Program->Parameters->Parameters[a + b].Name); + if (Program->Parameters->Parameters[a + b].Type == STATE) { + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[0]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[1]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[2]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[3]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[4]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[5]); + } + else + fprintf (stderr, "%f %f %f %f\n", + Program->Parameters->Parameters[a + b].Values[0], + Program->Parameters->Parameters[a + b].Values[1], + Program->Parameters->Parameters[a + b].Values[2], + Program->Parameters->Parameters[a + b].Values[3]); + } + break; + case vt_temp: + fprintf (stderr, "TEMP %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->temp_binding); + break; + case vt_output: + fprintf (stderr, "OUTPUT %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->output_binding); + break; + case vt_alias: + fprintf (stderr, "ALIAS %s\n", vc->name); + fprintf (stderr, " binding: 0x%x (%s)\n", + vc->alias_binding, vc->alias_binding->name); + break; + } + vc = vc->next; + } +} + +#endif + +/** + * The main loop for parsing a fragment or vertex program + * + * \return 0 on sucess, 1 on error + */ + +static GLint +parse_arb_program (GLcontext * ctx, byte * inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLint err = 0; + + Program->MajorVersion = (GLuint) * inst++; + Program->MinorVersion = (GLuint) * inst++; + + while (*inst != END) { + switch (*inst++) { + /* XXX: */ + case OPTION: + + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + switch (*inst++) { + case ARB_PRECISION_HINT_FASTEST: + Program->HintPrecisionFastest = 1; + break; + + case ARB_PRECISION_HINT_NICEST: + Program->HintPrecisionNicest = 1; + break; + + case ARB_FOG_EXP: + Program->HintFogExp = 1; + break; + + case ARB_FOG_EXP2: + Program->HintFogExp2 = 1; + break; + + case ARB_FOG_LINEAR: + Program->HintFogLinear = 1; + break; + } + } + else { + switch (*inst++) { + case ARB_POSITION_INVARIANT: + Program->HintPositionInvariant = 1; + break; + } + } + break; + + case INSTRUCTION: + Program->Position = parse_position (&inst); + + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + /* Realloc Program->FPInstructions */ + Program->FPInstructions = + (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, + Program->Base.NumInstructions*sizeof(struct fp_instruction), + (Program->Base.NumInstructions+1)*sizeof (struct fp_instruction)); + + /* parse the current instruction */ + err = parse_fp_instruction (ctx, &inst, vc_head, Program, + &Program->FPInstructions[Program->Base.NumInstructions]); + + } + else { + /* Realloc Program->VPInstructions */ + Program->VPInstructions = + (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, + Program->Base.NumInstructions*sizeof(struct vp_instruction), + (Program->Base.NumInstructions +1)*sizeof(struct vp_instruction)); + + /* parse the current instruction */ + err = parse_vp_instruction (ctx, &inst, vc_head, Program, + &Program->VPInstructions[Program->Base.NumInstructions]); + } + + /* increment Program->Base.NumInstructions */ + Program->Base.NumInstructions++; + break; + + case DECLARATION: + err = parse_declaration (ctx, &inst, vc_head, Program); + break; + + default: + break; + } + + if (err) + break; + } + + /* Finally, tag on an OPCODE_END instruction */ + if (Program->type == GL_FRAGMENT_PROGRAM_ARB) { + Program->FPInstructions = + (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, + Program->Base.NumInstructions*sizeof(struct fp_instruction), + (Program->Base.NumInstructions+1)*sizeof(struct fp_instruction)); + + Program->FPInstructions[Program->Base.NumInstructions].Opcode = FP_OPCODE_END; + } + else { + Program->VPInstructions = + (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, + Program->Base.NumInstructions*sizeof(struct vp_instruction), + (Program->Base.NumInstructions+1)*sizeof(struct vp_instruction)); + + Program->VPInstructions[Program->Base.NumInstructions].Opcode = VP_OPCODE_END; + } + + /* increment Program->Base.NumInstructions */ + Program->Base.NumInstructions++; + + return err; +} + +/** + * This kicks everything off. + * + * \param ctx - The GL Context + * \param str - The program string + * \param len - The program string length + * \param Program - The arb_program struct to return all the parsed info in + * \return 0 on sucess, 1 on error + */ +GLuint +_mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, + struct arb_program * Program) +{ + GLint a, err, error_pos; + char error_msg[300]; + GLuint parsed_len; + struct var_cache *vc_head; + dict *dt; + byte *parsed, *inst; + +#if DEBUG_PARSING + fprintf (stderr, "Loading grammar text!\n"); +#endif + dt = grammar_load_from_text ((byte *) arb_grammar_text); + if (!dt) { + grammar_get_last_error ((byte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Error loading grammer rule set"); + return 1; + } + +#if DEBUG_PARSING + printf ("Checking Grammar!\n"); +#endif + err = grammar_check (dt, str, &parsed, &parsed_len); + + + /* Syntax parse error */ + if (err == 0) { + grammar_get_last_error ((byte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, "Parse Error"); + + dict_destroy (&dt); + return 1; + } + +#if DEBUG_PARSING + printf ("Destroying grammer dict [parse retval: %d]\n", err); +#endif + dict_destroy (&dt); + + /* Initialize the arb_program struct */ + Program->Base.NumInstructions = + Program->Base.NumTemporaries = + Program->Base.NumParameters = + Program->Base.NumAttributes = Program->Base.NumAddressRegs = 0; + Program->Parameters = _mesa_new_parameter_list (); + Program->InputsRead = 0; + Program->OutputsWritten = 0; + Program->Position = 0; + Program->MajorVersion = Program->MinorVersion = 0; + Program->HintPrecisionFastest = + Program->HintPrecisionNicest = + Program->HintFogExp2 = + Program->HintFogExp = + Program->HintFogLinear = Program->HintPositionInvariant = 0; + for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++) + Program->TexturesUsed[a] = 0; + Program->NumAluInstructions = + Program->NumTexInstructions = + Program->NumTexIndirections = 0; + + Program->FPInstructions = NULL; + Program->VPInstructions = NULL; + + vc_head = NULL; + err = 0; + + /* Start examining the tokens in the array */ + inst = parsed; + + /* Check the grammer rev */ + if (*inst++ != REVISION) { + _mesa_set_program_error (ctx, 0, "Grammar version mismatch"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar verison mismatch"); + err = 1; + } + else { + switch (*inst++) { + case FRAGMENT_PROGRAM: + Program->type = GL_FRAGMENT_PROGRAM_ARB; + break; + + case VERTEX_PROGRAM: + Program->type = GL_VERTEX_PROGRAM_ARB; + break; + } + + err = parse_arb_program (ctx, inst, &vc_head, Program); +#if DEBUG_PARSING + fprintf (stderr, "Symantic analysis returns %d [1 is bad!]\n", err); +#endif + } + + /*debug_variables(ctx, vc_head, Program); */ + + /* We're done with the parsed binary array */ + var_cache_destroy (&vc_head); + + _mesa_free (parsed); +#if DEBUG_PARSING + printf ("_mesa_parse_arb_program() done\n"); +#endif + return err; +} diff --git a/src/mesa/main/arbparse.h b/src/mesa/main/arbparse.h new file mode 100644 index 00000000000..e6c43b9a983 --- /dev/null +++ b/src/mesa/main/arbparse.h @@ -0,0 +1,83 @@ +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * Copyright (C) 1999-2003 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Brian Paul + */ + + +#ifndef ARBPARSE_H +#define ARBPARSE_H + +#include "context.h" +#include "mtypes.h" +#include "nvvertprog.h" +#include "nvfragprog.h" + +/** + * This is basically a union of the vertex_program and fragment_program + * structs that we can use to parse the program into + * + * XXX: this should go into mtypes.h? + */ +struct arb_program +{ + GLuint type; /* FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB */ + + struct program Base; + struct program_parameter_list *Parameters; + GLuint InputsRead; + GLuint OutputsWritten; + + GLuint Position; /* Just used for error reporting while parsing */ + GLuint MajorVersion; + GLuint MinorVersion; + + /* ARB_vertex_program specifics */ + struct vp_instruction *VPInstructions; + + /* Options currently recognized by the parser */ + /* ARB_fp */ + GLboolean HintPrecisionFastest; + GLboolean HintPrecisionNicest; + GLboolean HintFogExp2; + GLboolean HintFogExp; + GLboolean HintFogLinear; + + /* ARB_fp & _vp */ + GLboolean HintPositionInvariant; + + /* ARB_fragment_program sepecifics */ + struct fp_instruction *FPInstructions; + GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; + GLuint NumAluInstructions; + GLuint NumTexInstructions; + GLuint NumTexIndirections; +}; + +extern GLuint +_mesa_parse_arb_program( GLcontext *ctx, const GLubyte *str, GLsizei len, + struct arb_program *Program ); + + +#endif diff --git a/src/mesa/main/arbparse_syn.h b/src/mesa/main/arbparse_syn.h new file mode 100644 index 00000000000..e8b9e933d29 --- /dev/null +++ b/src/mesa/main/arbparse_syn.h @@ -0,0 +1,1219 @@ +static char arb_grammar_text[] = ".syntax program;\n" +".emtcode REVISION 0x03\n" +".emtcode FRAGMENT_PROGRAM 0x01\n" +".emtcode VERTEX_PROGRAM 0x02\n" +".emtcode OPTION 0x01\n" +".emtcode INSTRUCTION 0x02\n" +".emtcode DECLARATION 0x03\n" +".emtcode END 0x04\n" +".emtcode ARB_PRECISION_HINT_FASTEST 0x01\n" +".emtcode ARB_PRECISION_HINT_NICEST 0x02\n" +".emtcode ARB_FOG_EXP 0x04\n" +".emtcode ARB_FOG_EXP2 0x08\n" +".emtcode ARB_FOG_LINEAR 0x10\n" +".emtcode ARB_POSITION_INVARIANT 0x01\n" +".emtcode F_ALU_INST 0x01\n" +".emtcode F_TEX_INST 0x02\n" +".emtcode F_ALU_VECTOR 0x01\n" +".emtcode F_ALU_SCALAR 0x02\n" +".emtcode F_ALU_BINSC 0x03\n" +".emtcode F_ALU_BIN 0x04\n" +".emtcode F_ALU_TRI 0x05\n" +".emtcode F_ALU_SWZ 0x06\n" +".emtcode F_TEX_SAMPLE 0x07\n" +".emtcode F_TEX_KIL 0x08\n" +".emtcode V_GEN_ARL 0x01\n" +".emtcode V_GEN_VECTOR 0x02\n" +".emtcode V_GEN_SCALAR 0x03\n" +".emtcode V_GEN_BINSC 0x04\n" +".emtcode V_GEN_BIN 0x05\n" +".emtcode V_GEN_TRI 0x06\n" +".emtcode V_GEN_SWZ 0x07\n" +".emtcode F_ABS 0x00\n" +".emtcode F_ABS_SAT 0x01\n" +".emtcode F_FLR 0x02\n" +".emtcode F_FLR_SAT 0x03\n" +".emtcode F_FRC 0x04\n" +".emtcode F_FRC_SAT 0x05\n" +".emtcode F_LIT 0x06\n" +".emtcode F_LIT_SAT 0x07\n" +".emtcode F_MOV 0x08\n" +".emtcode F_MOV_SAT 0x09\n" +".emtcode F_COS 0x0A\n" +".emtcode F_COS_SAT 0x0B\n" +".emtcode F_EX2 0x0C\n" +".emtcode F_EX2_SAT 0x0D\n" +".emtcode F_LG2 0x0E\n" +".emtcode F_LG2_SAT 0x0F\n" +".emtcode F_RCP 0x10\n" +".emtcode F_RCP_SAT 0x11\n" +".emtcode F_RSQ 0x12\n" +".emtcode F_RSQ_SAT 0x13\n" +".emtcode F_SIN 0x14\n" +".emtcode F_SIN_SAT 0x15\n" +".emtcode F_SCS 0x16\n" +".emtcode F_SCS_SAT 0x17\n" +".emtcode F_POW 0x18\n" +".emtcode F_POW_SAT 0x19\n" +".emtcode F_ADD 0x1A\n" +".emtcode F_ADD_SAT 0x1B\n" +".emtcode F_DP3 0x1C\n" +".emtcode F_DP3_SAT 0x1D\n" +".emtcode F_DP4 0x1E\n" +".emtcode F_DP4_SAT 0x1F\n" +".emtcode F_DPH 0x20\n" +".emtcode F_DPH_SAT 0x21\n" +".emtcode F_DST 0x22\n" +".emtcode F_DST_SAT 0x23\n" +".emtcode F_MAX 0x24\n" +".emtcode F_MAX_SAT 0x25\n" +".emtcode F_MIN 0x26\n" +".emtcode F_MIN_SAT 0x27\n" +".emtcode F_MUL 0x28\n" +".emtcode F_MUL_SAT 0x29\n" +".emtcode F_SGE 0x2A\n" +".emtcode F_SGE_SAT 0x2B\n" +".emtcode F_SLT 0x2C\n" +".emtcode F_SLT_SAT 0x2D\n" +".emtcode F_SUB 0x2E\n" +".emtcode F_SUB_SAT 0x2F\n" +".emtcode F_XPD 0x30\n" +".emtcode F_XPD_SAT 0x31\n" +".emtcode F_CMP 0x32\n" +".emtcode F_CMP_SAT 0x33\n" +".emtcode F_LRP 0x34\n" +".emtcode F_LRP_SAT 0x35\n" +".emtcode F_MAD 0x36\n" +".emtcode F_MAD_SAT 0x37\n" +".emtcode F_SWZ 0x38\n" +".emtcode F_SWZ_SAT 0x39\n" +".emtcode F_TEX 0x3A\n" +".emtcode F_TEX_SAT 0x3B\n" +".emtcode F_TXB 0x3C\n" +".emtcode F_TXB_SAT 0x3D\n" +".emtcode F_TXP 0x3E\n" +".emtcode F_TXP_SAT 0x3F\n" +".emtcode F_KIL 0x40\n" +".emtcode V_ARL 0x01\n" +".emtcode V_ABS 0x02\n" +".emtcode V_FLR 0x03\n" +".emtcode V_FRC 0x04\n" +".emtcode V_LIT 0x05\n" +".emtcode V_MOV 0x06\n" +".emtcode V_EX2 0x07\n" +".emtcode V_EXP 0x08\n" +".emtcode V_LG2 0x09\n" +".emtcode V_LOG 0x0A\n" +".emtcode V_RCP 0x0B\n" +".emtcode V_RSQ 0x0C\n" +".emtcode V_POW 0x0D\n" +".emtcode V_ADD 0x0E\n" +".emtcode V_DP3 0x0F\n" +".emtcode V_DP4 0x10\n" +".emtcode V_DPH 0x11\n" +".emtcode V_DST 0x12\n" +".emtcode V_MAX 0x13\n" +".emtcode V_MIN 0x14\n" +".emtcode V_MUL 0x15\n" +".emtcode V_SGE 0x16\n" +".emtcode V_SLT 0x17\n" +".emtcode V_SUB 0x18\n" +".emtcode V_XPD 0x19\n" +".emtcode V_MAD 0x1A\n" +".emtcode V_SWZ 0x1B\n" +".emtcode FRAGMENT_ATTRIB_COLOR 0x01\n" +".emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02\n" +".emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03\n" +".emtcode FRAGMENT_ATTRIB_POSITION 0x04\n" +".emtcode VERTEX_ATTRIB_POSITION 0x01\n" +".emtcode VERTEX_ATTRIB_WEIGHT 0x02\n" +".emtcode VERTEX_ATTRIB_NORMAL 0x03\n" +".emtcode VERTEX_ATTRIB_COLOR 0x04\n" +".emtcode VERTEX_ATTRIB_FOGCOORD 0x05\n" +".emtcode VERTEX_ATTRIB_TEXCOORD 0x06\n" +".emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07\n" +".emtcode VERTEX_ATTRIB_GENERIC 0x08\n" +".emtcode FRAGMENT_RESULT_COLOR 0x01\n" +".emtcode FRAGMENT_RESULT_DEPTH 0x02\n" +".emtcode VERTEX_RESULT_POSITION 0x01\n" +".emtcode VERTEX_RESULT_COLOR 0x02\n" +".emtcode VERTEX_RESULT_FOGCOORD 0x03\n" +".emtcode VERTEX_RESULT_POINTSIZE 0x04\n" +".emtcode VERTEX_RESULT_TEXCOORD 0x05\n" +".emtcode TEXTARGET_1D 0x01\n" +".emtcode TEXTARGET_2D 0x02\n" +".emtcode TEXTARGET_3D 0x03\n" +".emtcode TEXTARGET_RECT 0x04\n" +".emtcode TEXTARGET_CUBE 0x05\n" +".emtcode FACE_FRONT 0x00\n" +".emtcode FACE_BACK 0x01\n" +".emtcode COLOR_PRIMARY 0x00\n" +".emtcode COLOR_SECONDARY 0x01\n" +".emtcode COMPONENT_X 0x00\n" +".emtcode COMPONENT_Y 0x01\n" +".emtcode COMPONENT_Z 0x02\n" +".emtcode COMPONENT_W 0x03\n" +".emtcode COMPONENT_0 0x04\n" +".emtcode COMPONENT_1 0x05\n" +".emtcode ARRAY_INDEX_ABSOLUTE 0x00\n" +".emtcode ARRAY_INDEX_RELATIVE 0x01\n" +".emtcode MATRIX_MODELVIEW 0x01\n" +".emtcode MATRIX_PROJECTION 0x02\n" +".emtcode MATRIX_MVP 0x03\n" +".emtcode MATRIX_TEXTURE 0x04\n" +".emtcode MATRIX_PALETTE 0x05\n" +".emtcode MATRIX_PROGRAM 0x06\n" +".emtcode MATRIX_MODIFIER_IDENTITY 0x00\n" +".emtcode MATRIX_MODIFIER_INVERSE 0x01\n" +".emtcode MATRIX_MODIFIER_TRANSPOSE 0x02\n" +".emtcode MATRIX_MODIFIER_INVTRANS 0x03\n" +".emtcode CONSTANT_SCALAR 0x01\n" +".emtcode CONSTANT_VECTOR 0x02\n" +".emtcode PROGRAM_PARAM_ENV 0x01\n" +".emtcode PROGRAM_PARAM_LOCAL 0x02\n" +".emtcode REGISTER_ATTRIB 0x01\n" +".emtcode REGISTER_PARAM 0x02\n" +".emtcode REGISTER_RESULT 0x03\n" +".emtcode REGISTER_ESTABLISHED_NAME 0x04\n" +".emtcode PARAM_NULL 0x00\n" +".emtcode PARAM_ARRAY_ELEMENT 0x01\n" +".emtcode PARAM_STATE_ELEMENT 0x02\n" +".emtcode PARAM_PROGRAM_ELEMENT 0x03\n" +".emtcode PARAM_PROGRAM_ELEMENTS 0x04\n" +".emtcode PARAM_CONSTANT 0x05\n" +".emtcode STATE_MATERIAL 0x01\n" +".emtcode STATE_LIGHT 0x02\n" +".emtcode STATE_LIGHT_MODEL 0x03\n" +".emtcode STATE_LIGHT_PROD 0x04\n" +".emtcode STATE_FOG 0x05\n" +".emtcode STATE_MATRIX_ROWS 0x06\n" +".emtcode STATE_TEX_ENV 0x07\n" +".emtcode STATE_DEPTH 0x08\n" +".emtcode STATE_TEX_GEN 0x07\n" +".emtcode STATE_CLIP_PLANE 0x08\n" +".emtcode STATE_POINT 0x09\n" +".emtcode MATERIAL_AMBIENT 0x01\n" +".emtcode MATERIAL_DIFFUSE 0x02\n" +".emtcode MATERIAL_SPECULAR 0x03\n" +".emtcode MATERIAL_EMISSION 0x04\n" +".emtcode MATERIAL_SHININESS 0x05\n" +".emtcode LIGHT_AMBIENT 0x01\n" +".emtcode LIGHT_DIFFUSE 0x02\n" +".emtcode LIGHT_SPECULAR 0x03\n" +".emtcode LIGHT_POSITION 0x04\n" +".emtcode LIGHT_ATTENUATION 0x05\n" +".emtcode LIGHT_HALF 0x06\n" +".emtcode LIGHT_SPOT_DIRECTION 0x07\n" +".emtcode LIGHT_MODEL_AMBIENT 0x01\n" +".emtcode LIGHT_MODEL_SCENECOLOR 0x02\n" +".emtcode LIGHT_PROD_AMBIENT 0x01\n" +".emtcode LIGHT_PROD_DIFFUSE 0x02\n" +".emtcode LIGHT_PROD_SPECULAR 0x03\n" +".emtcode TEX_ENV_COLOR 0x01\n" +".emtcode TEX_GEN_EYE 0x01\n" +".emtcode TEX_GEN_OBJECT 0x02\n" +".emtcode FOG_COLOR 0x01\n" +".emtcode FOG_PARAMS 0x02\n" +".emtcode DEPTH_RANGE 0x01\n" +".emtcode POINT_SIZE 0x01\n" +".emtcode POINT_ATTENUATION 0x02\n" +".emtcode ATTRIB 0x01\n" +".emtcode PARAM 0x02\n" +".emtcode TEMP 0x03\n" +".emtcode OUTPUT 0x04\n" +".emtcode ALIAS 0x05\n" +".emtcode ADDRESS 0x06\n" +".errtext UNKNOWN_PROGRAM_SIGNATURE \"1001: '$e_signature$': unknown program signature\"\n" +".errtext MISSING_END_OR_INVALID_STATEMENT \"1002: '$e_statement$': invalid statement\"\n" +".errtext CODE_AFTER_END \"1003: '$e_statement$': code after 'END' keyword\"\n" +".errtext INVALID_PROGRAM_OPTION \"1004: '$e_identifier$': invalid program option\"\n" +".errtext EXT_SWIZ_COMP_EXPECTED \"1005: extended swizzle component expected but '$e_token$' found\"\n" +".errtext TEX_TARGET_EXPECTED \"1006: texture target expected but '$e_token$' found\"\n" +".errtext TEXTURE_EXPECTED \"1007: 'texture' expected but '$e_identifier$' found\"\n" +".errtext SOURCE_REGISTER_EXPECTED \"1008: source register expected but '$e_token$' found\"\n" +".errtext DESTINATION_REGISTER_EXPECTED \"1009: destination register expected but '$e_token$' found\"\n" +".errtext INVALID_ADDRESS_COMPONENT \"1010: '$e_identifier$': invalid address component\"\n" +".errtext INVALID_ADDRESS_WRITEMASK \"1011: '$e_identifier$': invalid address writemask\"\n" +".errtext INVALID_COMPONENT \"1012: '$e_charordigit$': invalid component\"\n" +".errtext INVALID_SUFFIX \"1013: '$e_identifier$': invalid suffix\"\n" +".errtext INVALID_WRITEMASK \"1014: '$e_identifier$': invalid writemask\"\n" +".errtext FRAGMENT_EXPECTED \"1015: 'fragment' expected but '$e_identifier$' found\"\n" +".errtext VERTEX_EXPECTED \"1016: 'vertex' expected but '$e_identifier$' found\"\n" +".errtext INVALID_FRAGMENT_PROPERTY \"1017: '$e_identifier$': invalid fragment property\"\n" +".errtext INVALID_VERTEX_PROPERTY \"1018: '$e_identifier$': invalid vertex property\"\n" +".errtext INVALID_STATE_PROPERTY \"1019: '$e_identifier$': invalid state property\"\n" +".errtext INVALID_MATERIAL_PROPERTY \"1020: '$e_identifier$': invalid material property\"\n" +".errtext INVALID_LIGHT_PROPERTY \"1021: '$e_identifier$': invalid light property\"\n" +".errtext INVALID_SPOT_PROPERTY \"1022: '$e_identifier$': invalid spot property\"\n" +".errtext INVALID_LIGHTMODEL_PROPERTY \"1023: '$e_identifier$': invalid light model property\"\n" +".errtext INVALID_LIGHTPROD_PROPERTY \"1024: '$e_identifier$': invalid light product property\"\n" +".errtext INVALID_TEXENV_PROPERTY \"1025: '$e_identifier$': invalid texture environment property\"\n" +".errtext INVALID_TEXGEN_PROPERTY \"1026: '$e_identifier$': invalid texture generating property\"\n" +".errtext INVALID_TEXGEN_COORD \"1027: '$e_identifier$': invalid texture generating coord\"\n" +".errtext INVALID_FOG_PROPERTY \"1028: '$e_identifier$': invalid fog property\"\n" +".errtext INVALID_DEPTH_PROPERTY \"1029: '$e_identifier$': invalid depth property\"\n" +".errtext INVALID_CLIPPLANE_PROPERTY \"1030: '$e_identifier$': invalid clip plane property\"\n" +".errtext INVALID_POINT_PROPERTY \"1031: '$e_identifier$': invalid point property\"\n" +".errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED \"1032: matrix row selector or modifier expected but '$e_token$' found\"\n" +".errtext INVALID_MATRIX_NAME \"1033: '$e_identifier$': invalid matrix name\"\n" +".errtext INVALID_PROGRAM_PROPERTY \"1034: '$e_identifier$': invalid program property\"\n" +".errtext RESULT_EXPECTED \"1035: 'result' expected but '$e_token$' found\"\n" +".errtext INVALID_RESULT_PROPERTY \"1036: '$e_identifier$': invalid result property\"\n" +".errtext INVALID_FACE_PROPERTY \"1037: '$e_identifier$': invalid face property\"\n" +".errtext INVALID_COLOR_PROPERTY \"1038: '$e_identifier$': invalid color property\"\n" +".errtext IDENTIFIER_EXPECTED \"1039: identifier expected but '$e_token$' found\"\n" +".errtext RESERVED_KEYWORD \"1040: use of reserved keyword as an identifier\"\n" +".errtext INTEGER_EXPECTED \"1041: integer value expected but '$e_token$' found\"\n" +".errtext MISSING_SEMICOLON \"1042: ';' expected but '$e_token$' found\"\n" +".errtext MISSING_COMMA \"1043: ',' expected but '$e_token$' found\"\n" +".errtext MISSING_LBRACKET \"1044: '[' expected but '$e_token$' found\"\n" +".errtext MISSING_RBRACKET \"1045: ']' expected but '$e_token$' found\"\n" +".errtext MISSING_DOT \"1046: '.' expected but '$e_token$' found\"\n" +".errtext MISSING_EQUAL \"1047: '=' expected but '$e_token$' found\"\n" +".errtext MISSING_LBRACE \"1048: '{' expected but '$e_token$' found\"\n" +".errtext MISSING_RBRACE \"1049: '}' expected but '$e_token$' found\"\n" +".errtext MISSING_DOTDOT \"1050: '..' expected but '$e_token$' found\"\n" +".errtext MISSING_FRACTION_OR_EXPONENT \"1051: missing fraction part or exponent\"\n" +".errtext MISSING_DOT_OR_EXPONENT \"1052: missing '.' or exponent\"\n" +".errtext EXPONENT_VALUE_EXPECTED \"1053: exponent value expected\"\n" +"program\n" +" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n" +"programs\n" +" frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or\n" +" vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;\n" +"frag_program_1_0\n" +" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and\n" +" optional_space .and fp_optionSequence .and fp_statementSequence .and\n" +" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" +" '\\0' .error CODE_AFTER_END;\n" +"vert_program_1_0\n" +" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and\n" +" optional_space .and vp_optionSequence .and vp_statementSequence .and\n" +" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" +" '\\0' .error CODE_AFTER_END;\n" +"fp_optionSequence\n" +" .loop fp_option;\n" +"vp_optionSequence\n" +" .loop vp_option;\n" +"fp_option\n" +" \"OPTION\" .emit OPTION .and space .and fp_optionString .error INVALID_PROGRAM_OPTION .and\n" +" semicolon;\n" +"vp_option\n" +" \"OPTION\" .emit OPTION .and space .and vp_optionString .error INVALID_PROGRAM_OPTION .and\n" +" semicolon;\n" +"fp_optionString\n" +" \"ARB_precision_hint_fastest\" .emit ARB_PRECISION_HINT_FASTEST .or\n" +" \"ARB_precision_hint_nicest\" .emit ARB_PRECISION_HINT_NICEST .or\n" +" \"ARB_fog_exp\" .emit ARB_FOG_EXP .or\n" +" \"ARB_fog_exp2\" .emit ARB_FOG_EXP2 .or\n" +" \"ARB_fog_linear\" .emit ARB_FOG_LINEAR;\n" +"vp_optionString\n" +" \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT;\n" +"fp_statementSequence\n" +" .loop fp_statement;\n" +"vp_statementSequence\n" +" .loop vp_statement;\n" +"fp_statement\n" +" fp_statement_1 .or fp_statement_2;\n" +"vp_statement\n" +" vp_statement_1 .or vp_statement_2;\n" +"fp_statement_1\n" +" fp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" +"fp_statement_2\n" +" fp_namingStatement .emit DECLARATION .and semicolon;\n" +"vp_statement_1\n" +" vp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" +"vp_statement_2\n" +" vp_namingStatement .emit DECLARATION .and semicolon;\n" +"fp_instruction\n" +" ALUInstruction .emit F_ALU_INST .or\n" +" TexInstruction .emit F_TEX_INST;\n" +"vp_instruction\n" +" ARL_instruction .emit V_GEN_ARL .or\n" +" vp_VECTORop_instruction .emit V_GEN_VECTOR .or\n" +" vp_SCALARop_instruction .emit V_GEN_SCALAR .or\n" +" vp_BINSCop_instruction .emit V_GEN_BINSC .or\n" +" vp_BINop_instruction .emit V_GEN_BIN .or\n" +" vp_TRIop_instruction .emit V_GEN_TRI .or\n" +" vp_SWZ_instruction .emit V_GEN_SWZ;\n" +"ALUInstruction\n" +" fp_VECTORop_instruction .emit F_ALU_VECTOR .or\n" +" fp_SCALARop_instruction .emit F_ALU_SCALAR .or\n" +" fp_BINSCop_instruction .emit F_ALU_BINSC .or\n" +" fp_BINop_instruction .emit F_ALU_BIN .or\n" +" fp_TRIop_instruction .emit F_ALU_TRI .or\n" +" fp_SWZ_instruction .emit F_ALU_SWZ;\n" +"TexInstruction\n" +" SAMPLE_instruction .emit F_TEX_SAMPLE .or\n" +" KIL_instruction .emit F_TEX_KIL;\n" +"ARL_instruction\n" +" \"ARL\" .emit V_ARL .and space .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n" +"fp_VECTORop_instruction\n" +" fp_VECTORop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg;\n" +"vp_VECTORop_instruction\n" +" vp_VECTORop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg;\n" +"fp_VECTORop\n" +" \"ABS\" .emit F_ABS .or \"ABS_SAT\" .emit F_ABS_SAT .or\n" +" \"FLR\" .emit F_FLR .or \"FLR_SAT\" .emit F_FLR_SAT .or\n" +" \"FRC\" .emit F_FRC .or \"FRC_SAT\" .emit F_FRC_SAT .or\n" +" \"LIT\" .emit F_LIT .or \"LIT_SAT\" .emit F_LIT_SAT .or\n" +" \"MOV\" .emit F_MOV .or \"MOV_SAT\" .emit F_MOV_SAT;\n" +"vp_VECTORop\n" +" \"ABS\" .emit V_ABS .or\n" +" \"FLR\" .emit V_FLR .or\n" +" \"FRC\" .emit V_FRC .or\n" +" \"LIT\" .emit V_LIT .or\n" +" \"MOV\" .emit V_MOV;\n" +"fp_SCALARop_instruction\n" +" fp_SCALARop .and space .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;\n" +"vp_SCALARop_instruction\n" +" vp_SCALARop .and space .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;\n" +"fp_SCALARop\n" +" \"COS\" .emit F_COS .or \"COS_SAT\" .emit F_COS_SAT .or\n" +" \"EX2\" .emit F_EX2 .or \"EX2_SAT\" .emit F_EX2_SAT .or\n" +" \"LG2\" .emit F_LG2 .or \"LG2_SAT\" .emit F_LG2_SAT .or\n" +" \"RCP\" .emit F_RCP .or \"RCP_SAT\" .emit F_RCP_SAT .or\n" +" \"RSQ\" .emit F_RSQ .or \"RSQ_SAT\" .emit F_RSQ_SAT .or\n" +" \"SIN\" .emit F_SIN .or \"SIN_SAT\" .emit F_SIN_SAT .or\n" +" \"SCS\" .emit F_SCS .or \"SCS_SAT\" .emit F_SCS_SAT;\n" +"vp_SCALARop\n" +" \"EX2\" .emit V_EX2 .or\n" +" \"EXP\" .emit V_EXP .or\n" +" \"LG2\" .emit V_LG2 .or\n" +" \"LOG\" .emit V_LOG .or\n" +" \"RCP\" .emit V_RCP .or\n" +" \"RSQ\" .emit V_RSQ;\n" +"fp_BINSCop_instruction\n" +" fp_BINSCop .and space .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and\n" +" fp_scalarSrcReg;\n" +"vp_BINSCop_instruction\n" +" vp_BINSCop .and space .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and\n" +" vp_scalarSrcReg;\n" +"fp_BINSCop\n" +" \"POW\" .emit F_POW .or \"POW_SAT\" .emit F_POW_SAT;\n" +"vp_BINSCop\n" +" \"POW\" .emit V_POW;\n" +"fp_BINop_instruction\n" +" fp_BINop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" vectorSrcReg;\n" +"vp_BINop_instruction\n" +" vp_BINop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" +" swizzleSrcReg;\n" +"fp_BINop\n" +" \"ADD\" .emit F_ADD .or \"ADD_SAT\" .emit F_ADD_SAT .or\n" +" \"DP3\" .emit F_DP3 .or \"DP3_SAT\" .emit F_DP3_SAT .or\n" +" \"DP4\" .emit F_DP4 .or \"DP4_SAT\" .emit F_DP4_SAT .or\n" +" \"DPH\" .emit F_DPH .or \"DPH_SAT\" .emit F_DPH_SAT .or\n" +" \"DST\" .emit F_DST .or \"DST_SAT\" .emit F_DST_SAT .or\n" +" \"MAX\" .emit F_MAX .or \"MAX_SAT\" .emit F_MAX_SAT .or\n" +" \"MIN\" .emit F_MIN .or \"MIN_SAT\" .emit F_MIN_SAT .or\n" +" \"MUL\" .emit F_MUL .or \"MUL_SAT\" .emit F_MUL_SAT .or\n" +" \"SGE\" .emit F_SGE .or \"SGE_SAT\" .emit F_SGE_SAT .or\n" +" \"SLT\" .emit F_SLT .or \"SLT_SAT\" .emit F_SLT_SAT .or\n" +" \"SUB\" .emit F_SUB .or \"SUB_SAT\" .emit F_SUB_SAT .or\n" +" \"XPD\" .emit F_XPD .or \"XPD_SAT\" .emit F_XPD_SAT;\n" +"vp_BINop\n" +" \"ADD\" .emit V_ADD .or\n" +" \"DP3\" .emit V_DP3 .or\n" +" \"DP4\" .emit V_DP4 .or\n" +" \"DPH\" .emit V_DPH .or\n" +" \"DST\" .emit V_DST .or\n" +" \"MAX\" .emit V_MAX .or\n" +" \"MIN\" .emit V_MIN .or\n" +" \"MUL\" .emit V_MUL .or\n" +" \"SGE\" .emit V_SGE .or\n" +" \"SLT\" .emit V_SLT .or\n" +" \"SUB\" .emit V_SUB .or\n" +" \"XPD\" .emit V_XPD;\n" +"fp_TRIop_instruction\n" +" fp_TRIop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" vectorSrcReg .and comma .and vectorSrcReg;\n" +"vp_TRIop_instruction\n" +" vp_TRIop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" +" swizzleSrcReg .and comma .and swizzleSrcReg;\n" +"fp_TRIop\n" +" \"CMP\" .emit F_CMP .or \"CMP_SAT\" .emit F_CMP_SAT .or\n" +" \"LRP\" .emit F_LRP .or \"LRP_SAT\" .emit F_LRP_SAT .or\n" +" \"MAD\" .emit F_MAD .or \"MAD_SAT\" .emit F_MAD_SAT;\n" +"vp_TRIop\n" +" \"MAD\" .emit V_MAD;\n" +"fp_SWZ_instruction\n" +" SWZop .and space .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and\n" +" fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" +"vp_SWZ_instruction\n" +" \"SWZ\" .emit V_SWZ .and space .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n" +" vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" +"SWZop\n" +" \"SWZ\" .emit F_SWZ .or \"SWZ_SAT\" .emit F_SWZ_SAT;\n" +"SAMPLE_instruction\n" +" SAMPLEop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;\n" +"SAMPLEop\n" +" \"TEX\" .emit F_TEX .or \"TEX_SAT\" .emit F_TEX_SAT .or\n" +" \"TXB\" .emit F_TXB .or \"TXB_SAT\" .emit F_TXB_SAT .or\n" +" \"TXP\" .emit F_TXP .or \"TXP_SAT\" .emit F_TXP_SAT;\n" +"KIL_instruction\n" +" \"KIL\" .emit F_KIL .and space .and vectorSrcReg;\n" +"texImageUnit\n" +" \"texture\" .error TEXTURE_EXPECTED .and optTexImageUnitNum;\n" +"texTarget\n" +" \"1D\" .emit TEXTARGET_1D .or\n" +" \"2D\" .emit TEXTARGET_2D .or\n" +" \"3D\" .emit TEXTARGET_3D .or\n" +" \"RECT\" .emit TEXTARGET_RECT .or\n" +" \"CUBE\" .emit TEXTARGET_CUBE;\n" +"optTexImageUnitNum\n" +" optTexImageUnitNum_1 .or .true .emit 0x00;\n" +"optTexImageUnitNum_1\n" +" lbracket_ne .and texImageUnitNum .and rbracket;\n" +"texImageUnitNum\n" +" integer;\n" +"fp_scalarSrcReg\n" +" optionalSign .and fp_srcReg .and fp_scalarSuffix;\n" +"vp_scalarSrcReg\n" +" optionalSign .and vp_srcReg .and vp_scalarSuffix;\n" +"swizzleSrcReg\n" +" optionalSign .and vp_srcReg .and swizzleSuffix;\n" +"vectorSrcReg\n" +" optionalSign .and fp_srcReg .and optionalSuffix;\n" +"fp_maskedDstReg\n" +" fp_dstReg .and fp_optionalMask;\n" +"vp_maskedDstReg\n" +" vp_dstReg .and vp_optionalMask;\n" +"maskedAddrReg\n" +" addrReg .and addrWriteMask;\n" +"fp_extendedSwizzle\n" +" xyzwExtendedSwizzle .or rgbaExtendedSwizzle;\n" +"vp_extendedSwizzle\n" +" extSwizComp .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"xyzwExtendedSwizzle\n" +" xyzwExtSwizComp .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"rgbaExtendedSwizzle\n" +" rgbaExtSwizComp .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"xyzwExtSwizComp\n" +" optionalSign .and xyzwExtSwizSel;\n" +"rgbaExtSwizComp\n" +" optionalSign .and rgbaExtSwizSel;\n" +"extSwizComp\n" +" optionalSign .and extSwizSel;\n" +"xyzwExtSwizSel\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or xyzwComponent_single;\n" +"rgbaExtSwizSel\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or rgbaComponent_single;\n" +"extSwizSel\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or vp_component_single;\n" +"fp_srcReg\n" +" fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" +"vp_srcReg\n" +" vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" +"fp_srcReg_1\n" +" fragmentAttribReg .emit REGISTER_ATTRIB .or\n" +" fp_progParamReg .emit REGISTER_PARAM .or\n" +" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"vp_srcReg_1\n" +" vertexAttribReg .emit REGISTER_ATTRIB .or\n" +" vp_progParamReg .emit REGISTER_PARAM .or\n" +" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"fp_dstReg\n" +" fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" +"vp_dstReg\n" +" vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" +"fp_dstReg_1\n" +" fragmentResultReg .emit REGISTER_RESULT .or\n" +" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"vp_dstReg_1\n" +" vertexResultReg .emit REGISTER_RESULT .or\n" +" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"fragmentAttribReg\n" +" fragAttribBinding;\n" +"vertexAttribReg\n" +" vtxAttribBinding;\n" +"fp_temporaryReg\n" +" fp_establishedName;\n" +"vp_temporaryReg\n" +" vp_establishedName;\n" +"fp_progParamReg\n" +" fp_paramSingleItemUse .or fp_progParamReg_1;\n" +"vp_progParamReg\n" +" vp_paramSingleItemUse .or vp_progParamReg_1;\n" +"fp_progParamReg_1\n" +" fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and\n" +" rbracket;\n" +"vp_progParamReg_1\n" +" vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and\n" +" rbracket;\n" +"fp_progParamArray\n" +" fp_establishedName;\n" +"vp_progParamArray\n" +" vp_establishedName;\n" +"progParamArrayMem\n" +" progParamArrayAbs .or progParamArrayRel;\n" +"progParamArrayAbs\n" +" integer .emit ARRAY_INDEX_ABSOLUTE;\n" +"progParamArrayRel\n" +" addrReg .emit ARRAY_INDEX_RELATIVE .and addrComponent .and addrRegRelOffset;\n" +"addrRegRelOffset\n" +" addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;\n" +"addrRegRelOffset_1\n" +" plus_ne .and addrRegPosOffset;\n" +"addrRegRelOffset_2\n" +" minus_ne .and addrRegNegOffset;\n" +"addrRegPosOffset\n" +" integer_0_63;\n" +"addrRegNegOffset\n" +" integer_0_64;\n" +"fragmentResultReg\n" +" fp_resultBinding;\n" +"vertexResultReg\n" +" vp_resultBinding;\n" +"addrReg\n" +" vp_establishedName;\n" +"addrComponent\n" +" dot .and \"x\" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X\n" +" .emit COMPONENT_X .emit COMPONENT_X;\n" +"addrWriteMask\n" +" dot .and \"x\" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;\n" +"fp_scalarSuffix\n" +" dot .and fp_component_single .error INVALID_COMPONENT;\n" +"vp_scalarSuffix\n" +" dot .and vp_component_single .error INVALID_COMPONENT;\n" +"swizzleSuffix\n" +" swizzleSuffix_1 .or .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z\n" +" .emit COMPONENT_W;\n" +"swizzleSuffix_1\n" +" dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;\n" +"swizzleSuffix_2\n" +" swizzleSuffix_3 .or swizzleSuffix_4;\n" +"swizzleSuffix_3\n" +" vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and\n" +" vp_component_multi .error INVALID_COMPONENT;\n" +"swizzleSuffix_4\n" +" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" +"optionalSuffix\n" +" optionalSuffix_1 .or .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z\n" +" .emit COMPONENT_W;\n" +"optionalSuffix_1\n" +" dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;\n" +"optionalSuffix_2\n" +" optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;\n" +"optionalSuffix_3\n" +" xyzwComponent_multi .and xyzwComponent_multi .and\n" +" xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;\n" +"optionalSuffix_4\n" +" rgbaComponent_multi .and rgbaComponent_multi .and\n" +" rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;\n" +"optionalSuffix_5\n" +" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or\n" +" \"r\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"g\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"b\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"a\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" +"fp_component_single\n" +" xyzwComponent_single .or rgbaComponent_single;\n" +"vp_component_multi\n" +" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" +" 'w' .emit COMPONENT_W;\n" +"vp_component_single\n" +" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W;\n" +"xyzwComponent_multi\n" +" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" +" 'w' .emit COMPONENT_W;\n" +"xyzwComponent_single\n" +" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W;\n" +"rgbaComponent_multi\n" +" 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or\n" +" 'a' .emit COMPONENT_W;\n" +"rgbaComponent_single\n" +" \"r\" .emit COMPONENT_X .or \"g\" .emit COMPONENT_Y .or \"b\" .emit COMPONENT_Z .or\n" +" \"a\" .emit COMPONENT_W;\n" +"fp_optionalMask\n" +" xyzwMask .or rgbaMask .or .true .emit 0x0F;\n" +"vp_optionalMask\n" +" xyzwMask .or .true .emit 0x0F;\n" +"xyzwMask\n" +" dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;\n" +"xyzwMask_1\n" +" \"xyzw\" .emit 0x0F .or \"xyz\" .emit 0x0E .or \"xyw\" .emit 0x0D .or \"xy\" .emit 0x0C .or\n" +" \"xzw\" .emit 0x0B .or \"xz\" .emit 0x0A .or \"xw\" .emit 0x09 .or \"x\" .emit 0x08 .or\n" +" \"yzw\" .emit 0x07 .or \"yz\" .emit 0x06 .or \"yw\" .emit 0x05 .or \"y\" .emit 0x04 .or\n" +" \"zw\" .emit 0x03 .or \"z\" .emit 0x02 .or \"w\" .emit 0x01;\n" +"rgbaMask\n" +" dot_ne .and rgbaMask_1 .error INVALID_WRITEMASK;\n" +"rgbaMask_1\n" +" \"rgba\" .emit 0x0F .or \"rgb\" .emit 0x0E .or \"rga\" .emit 0x0D .or \"rg\" .emit 0x0C .or\n" +" \"rba\" .emit 0x0B .or \"rb\" .emit 0x0A .or \"ra\" .emit 0x09 .or \"r\" .emit 0x08 .or\n" +" \"gba\" .emit 0x07 .or \"gb\" .emit 0x06 .or \"ga\" .emit 0x05 .or \"g\" .emit 0x04 .or\n" +" \"ba\" .emit 0x03 .or \"b\" .emit 0x02 .or \"a\" .emit 0x01;\n" +"fp_namingStatement\n" +" fp_ATTRIB_statement .emit ATTRIB .or\n" +" fp_PARAM_statement .emit PARAM .or\n" +" fp_TEMP_statement .emit TEMP .or\n" +" fp_OUTPUT_statement .emit OUTPUT .or\n" +" fp_ALIAS_statement .emit ALIAS;\n" +"vp_namingStatement\n" +" vp_ATTRIB_statement .emit ATTRIB .or\n" +" vp_PARAM_statement .emit PARAM .or\n" +" vp_TEMP_statement .emit TEMP .or\n" +" ADDRESS_statement .emit ADDRESS .or\n" +" vp_OUTPUT_statement .emit OUTPUT .or\n" +" vp_ALIAS_statement .emit ALIAS;\n" +"fp_ATTRIB_statement\n" +" \"ATTRIB\" .and space .and fp_establishName .and equal .and\n" +" fragAttribBinding .error FRAGMENT_EXPECTED;\n" +"vp_ATTRIB_statement\n" +" \"ATTRIB\" .and space .and vp_establishName .and equal .and\n" +" vtxAttribBinding .error VERTEX_EXPECTED;\n" +"fragAttribBinding\n" +" \"fragment\" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;\n" +"vtxAttribBinding\n" +" \"vertex\" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;\n" +"fragAttribItem\n" +" fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or\n" +" fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or\n" +" \"fogcoord\" .emit FRAGMENT_ATTRIB_FOGCOORD .or\n" +" \"position\" .emit FRAGMENT_ATTRIB_POSITION;\n" +"fragAttribItem_1\n" +" \"color\" .and optColorType;\n" +"fragAttribItem_2\n" +" \"texcoord\" .and optTexCoordNum;\n" +"vtxAttribItem\n" +" \"position\" .emit VERTEX_ATTRIB_POSITION .or\n" +" vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or\n" +" \"normal\" .emit VERTEX_ATTRIB_NORMAL .or\n" +" vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or\n" +" \"fogcoord\" .emit VERTEX_ATTRIB_FOGCOORD .or\n" +" vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or\n" +" vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or\n" +" vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;\n" +"vtxAttribItem_1\n" +" \"weight\" .and vtxOptWeightNum;\n" +"vtxAttribItem_2\n" +" \"color\" .and optColorType;\n" +"vtxAttribItem_3\n" +" \"texcoord\" .and optTexCoordNum;\n" +"vtxAttribItem_4\n" +" \"matrixindex\" .and lbracket .and vtxWeightNum .and rbracket;\n" +"vtxAttribItem_5\n" +" \"attrib\" .and lbracket .and vtxAttribNum .and rbracket;\n" +"vtxAttribNum\n" +" integer;\n" +"vtxOptWeightNum\n" +" vtxOptWeightNum_1 .or .true .emit 0x00;\n" +"vtxOptWeightNum_1\n" +" lbracket_ne .and vtxWeightNum .and rbracket;\n" +"vtxWeightNum\n" +" integer;\n" +"fp_PARAM_statement\n" +" fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;\n" +"vp_PARAM_statement\n" +" vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;\n" +"fp_PARAM_singleStmt\n" +" \"PARAM\" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and\n" +" .true .emit PARAM_NULL;\n" +"vp_PARAM_singleStmt\n" +" \"PARAM\" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and\n" +" .true .emit PARAM_NULL;\n" +"fp_PARAM_multipleStmt\n" +" \"PARAM\" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" +" fp_paramMultipleInit .and .true .emit PARAM_NULL;\n" +"vp_PARAM_multipleStmt\n" +" \"PARAM\" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" +" vp_paramMultipleInit .and .true .emit PARAM_NULL;\n" +"optArraySize\n" +" optional_integer;\n" +"fp_paramSingleInit\n" +" equal .and fp_paramSingleItemDecl;\n" +"vp_paramSingleInit\n" +" equal .and vp_paramSingleItemDecl;\n" +"fp_paramMultipleInit\n" +" equal .and lbrace .and fp_paramMultInitList .and rbrace;\n" +"vp_paramMultipleInit\n" +" equal .and lbrace .and vp_paramMultInitList .and rbrace;\n" +"fp_paramMultInitList\n" +" fp_paramMultInitList_1 .or fp_paramMultipleItem;\n" +"vp_paramMultInitList\n" +" vp_paramMultInitList_1 .or vp_paramMultipleItem;\n" +"fp_paramMultInitList_1\n" +" fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;\n" +"vp_paramMultInitList_1\n" +" vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;\n" +"fp_paramSingleItemDecl\n" +" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"vp_paramSingleItemDecl\n" +" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"fp_paramSingleItemUse\n" +" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstUse .emit PARAM_CONSTANT;\n" +"vp_paramSingleItemUse\n" +" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstUse .emit PARAM_CONSTANT;\n" +"fp_paramMultipleItem\n" +" fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" +" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"vp_paramMultipleItem\n" +" vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" +" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"fp_stateMultipleItem\n" +" stateMultipleItem_1 .or fp_stateSingleItem;\n" +"vp_stateMultipleItem\n" +" stateMultipleItem_1 .or vp_stateSingleItem;\n" +"stateMultipleItem_1\n" +" \"state\" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;\n" +"fp_stateSingleItem\n" +" \"state\" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" +"vp_stateSingleItem\n" +" \"state\" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" +"fp_stateSingleItem_1\n" +" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" +" stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;\n" +"vp_stateSingleItem_1\n" +" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" +" stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or\n" +" stateSingleItem_11;\n" +"stateSingleItem_1\n" +" stateMaterialItem .emit STATE_MATERIAL;\n" +"stateSingleItem_2\n" +" stateLightItem .emit STATE_LIGHT;\n" +"stateSingleItem_3\n" +" stateLightModelItem .emit STATE_LIGHT_MODEL;\n" +"stateSingleItem_4\n" +" stateLightProdItem .emit STATE_LIGHT_PROD;\n" +"stateSingleItem_5\n" +" stateTexEnvItem .emit STATE_TEX_ENV;\n" +"stateSingleItem_6\n" +" stateTexGenItem .emit STATE_TEX_GEN;\n" +"stateSingleItem_7\n" +" stateFogItem .emit STATE_FOG;\n" +"stateSingleItem_8\n" +" stateDepthItem .emit STATE_DEPTH;\n" +"stateSingleItem_9\n" +" stateClipPlaneItem .emit STATE_CLIP_PLANE;\n" +"stateSingleItem_10\n" +" statePointItem .emit STATE_POINT;\n" +"stateSingleItem_11\n" +" stateMatrixRow .emit STATE_MATRIX_ROWS;\n" +"stateMaterialItem\n" +" \"material\" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;\n" +"stateMatProperty\n" +" \"ambient\" .emit MATERIAL_AMBIENT .or\n" +" \"diffuse\" .emit MATERIAL_DIFFUSE .or\n" +" \"specular\" .emit MATERIAL_SPECULAR .or\n" +" \"emission\" .emit MATERIAL_EMISSION .or\n" +" \"shininess\" .emit MATERIAL_SHININESS;\n" +"stateLightItem\n" +" \"light\" .and lbracket .and stateLightNumber .and rbracket .and dot .and\n" +" stateLightProperty .error INVALID_LIGHT_PROPERTY;\n" +"stateLightProperty\n" +" \"ambient\" .emit LIGHT_AMBIENT .or\n" +" \"diffuse\" .emit LIGHT_DIFFUSE .or\n" +" \"specular\" .emit LIGHT_SPECULAR .or\n" +" \"position\" .emit LIGHT_POSITION .or\n" +" \"attenuation\" .emit LIGHT_ATTENUATION .or\n" +" stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or\n" +" \"half\" .emit LIGHT_HALF;\n" +"stateLightProperty_1\n" +" \"spot\" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;\n" +"stateSpotProperty\n" +" \"direction\";\n" +"stateLightModelItem\n" +" \"lightmodel\" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;\n" +"stateLModProperty\n" +" stateLModProperty_1 .or stateLModProperty_2;\n" +"stateLModProperty_1\n" +" dot .and \"ambient\" .emit LIGHT_MODEL_AMBIENT;\n" +"stateLModProperty_2\n" +" optFaceType .and dot .and \"scenecolor\" .emit LIGHT_MODEL_SCENECOLOR;\n" +"stateLightProdItem\n" +" \"lightprod\" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and\n" +" stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;\n" +"stateLProdProperty\n" +" \"ambient\" .emit LIGHT_PROD_AMBIENT .or\n" +" \"diffuse\" .emit LIGHT_PROD_DIFFUSE .or\n" +" \"specular\" .emit LIGHT_PROD_SPECULAR;\n" +"stateLightNumber\n" +" integer;\n" +"stateTexEnvItem\n" +" \"texenv\" .and optLegacyTexUnitNum .and dot .and\n" +" stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;\n" +"stateTexEnvProperty\n" +" \"color\" .emit TEX_ENV_COLOR;\n" +"optLegacyTexUnitNum\n" +" lbracket_ne .and legacyTexUnitNum .and rbracket;\n" +"legacyTexUnitNum\n" +" integer;\n" +"stateTexGenItem\n" +" \"texgen\" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and\n" +" dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;\n" +"stateTexGenType\n" +" \"eye\" .emit TEX_GEN_EYE .or\n" +" \"object\" .emit TEX_GEN_OBJECT;\n" +"stateTexGenCoord\n" +" \"s\" .emit COMPONENT_X .or\n" +" \"t\" .emit COMPONENT_Y .or\n" +" \"r\" .emit COMPONENT_Z .or\n" +" \"q\" .emit COMPONENT_W;\n" +"stateFogItem\n" +" \"fog\" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;\n" +"stateFogProperty\n" +" \"color\" .emit FOG_COLOR .or\n" +" \"params\" .emit FOG_PARAMS;\n" +"stateDepthItem\n" +" \"depth\" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;\n" +"stateDepthProperty\n" +" \"range\" .emit DEPTH_RANGE;\n" +"stateClipPlaneItem\n" +" \"clip\" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and\n" +" \"plane\" .error INVALID_CLIPPLANE_PROPERTY;\n" +"stateClipPlaneNum\n" +" integer;\n" +"statePointItem\n" +" \"point\" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;\n" +"statePointProperty\n" +" \"size\" .emit POINT_SIZE .or\n" +" \"attenuation\" .emit POINT_ATTENUATION;\n" +"stateMatrixRow\n" +" stateMatrixItem .and dot .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and\n" +" lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;\n" +"stateMatrixRows\n" +" stateMatrixItem .and optMatrixRows;\n" +"optMatrixRows\n" +" optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;\n" +"optMatrixRows_1\n" +" dot_ne .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and\n" +" stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;\n" +"stateMatrixItem\n" +" \"matrix\" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;\n" +"stateOptMatModifier\n" +" stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;\n" +"stateOptMatModifier_1\n" +" dot_ne .and stateMatModifier;\n" +"stateMatModifier\n" +" \"inverse\" .emit MATRIX_MODIFIER_INVERSE .or\n" +" \"transpose\" .emit MATRIX_MODIFIER_TRANSPOSE .or\n" +" \"invtrans\" .emit MATRIX_MODIFIER_INVTRANS;\n" +"stateMatrixRowNum\n" +" integer_0_3;\n" +"stateMatrixName\n" +" stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or\n" +" \"projection\" .emit MATRIX_PROJECTION .or\n" +" \"mvp\" .emit MATRIX_MVP .or\n" +" stateMatrixName_1_2 .emit MATRIX_TEXTURE .or\n" +" stateMatrixName_1_3 .emit MATRIX_PALETTE .or\n" +" stateMatrixName_1_4 .emit MATRIX_PROGRAM;\n" +"stateMatrixName_1_1\n" +" \"modelview\" .and stateOptModMatNum;\n" +"stateMatrixName_1_2\n" +" \"texture\" .and optTexCoordNum;\n" +"stateMatrixName_1_3\n" +" \"palette\" .and lbracket .and statePaletteMatNum .and rbracket;\n" +"stateMatrixName_1_4\n" +" \"program\" .and lbracket .and stateProgramMatNum .and rbracket;\n" +"stateOptModMatNum\n" +" stateOptModMatNum_1 .or .true .emit 0x00;\n" +"stateOptModMatNum_1\n" +" lbracket_ne .and stateModMatNum .and rbracket;\n" +"stateModMatNum\n" +" integer;\n" +"optTexCoordNum\n" +" optTexCoordNum_1 .or .true .emit 0x00;\n" +"optTexCoordNum_1\n" +" lbracket_ne .and texCoordNum .and rbracket;\n" +"texCoordNum\n" +" integer;\n" +"statePaletteMatNum\n" +" integer;\n" +"stateProgramMatNum\n" +" integer;\n" +"programSingleItem\n" +" \"program\" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" +"programSingleItem_1\n" +" progEnvParam .or progLocalParam;\n" +"programMultipleItem\n" +" \"program\" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" +"programMultipleItem_1\n" +" progEnvParams .or progLocalParams;\n" +"progEnvParams\n" +" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;\n" +"progEnvParamNums\n" +" progEnvParamNums_1 .or progEnvParamNums_2;\n" +"progEnvParamNums_1\n" +" progEnvParamNum .and dotdot_ne .and progEnvParamNum;\n" +"progEnvParamNums_2\n" +" progEnvParamNum .and .true .emit 0x00;\n" +"progEnvParam\n" +" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket;\n" +"progLocalParams\n" +" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;\n" +"progLocalParamNums\n" +" progLocalParamNums_1 .or progLocalParamNums_2;\n" +"progLocalParamNums_1\n" +" progLocalParamNum .and dotdot_ne .and progLocalParamNum;\n" +"progLocalParamNums_2\n" +" progLocalParamNum .and .true .emit 0x00;\n" +"progLocalParam\n" +" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket;\n" +"progEnvParamNum\n" +" integer;\n" +"progLocalParamNum\n" +" integer;\n" +"paramConstDecl\n" +" paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" +"paramConstUse\n" +" paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" +"paramConstScalarDecl\n" +" signedFloatConstant;\n" +"paramConstScalarUse\n" +" floatConstant;\n" +"paramConstVector\n" +" paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or\n" +" paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;\n" +"paramConstVector_1\n" +" lbrace_ne .and signedFloatConstant .and rbrace;\n" +"paramConstVector_2\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" +"paramConstVector_3\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" +" signedFloatConstant .and rbrace;\n" +"paramConstVector_4\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" +" signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" +"signedFloatConstant\n" +" optionalSign .and floatConstant;\n" +"floatConstant\n" +" float;\n" +"optionalSign\n" +" optional_sign_ne;\n" +"fp_TEMP_statement\n" +" \"TEMP\" .and space .and fp_varNameList .and .true .emit 0x00;\n" +"vp_TEMP_statement\n" +" \"TEMP\" .and space .and vp_varNameList .and .true .emit 0x00;\n" +"ADDRESS_statement\n" +" \"ADDRESS\" .and space .and vp_varNameList .and .true .emit 0x00;\n" +"fp_varNameList\n" +" fp_varNameList_1 .or fp_establishName;\n" +"vp_varNameList\n" +" vp_varNameList_1 .or vp_establishName;\n" +"fp_varNameList_1\n" +" fp_establishName .and comma_ne .and fp_varNameList;\n" +"vp_varNameList_1\n" +" vp_establishName .and comma_ne .and vp_varNameList;\n" +"fp_OUTPUT_statement\n" +" \"OUTPUT\" .and space .and fp_establishName .and equal .and\n" +" fp_resultBinding .error RESULT_EXPECTED;\n" +"vp_OUTPUT_statement\n" +" \"OUTPUT\" .and space .and vp_establishName .and equal .and\n" +" vp_resultBinding .error RESULT_EXPECTED;\n" +"fp_resultBinding\n" +" \"result\" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" +"vp_resultBinding\n" +" \"result\" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" +"fp_resultBinding_1\n" +" \"color\" .emit FRAGMENT_RESULT_COLOR .or\n" +" \"depth\" .emit FRAGMENT_RESULT_DEPTH;\n" +"vp_resultBinding_1\n" +" \"position\" .emit VERTEX_RESULT_POSITION .or\n" +" resultColBinding .emit VERTEX_RESULT_COLOR .or\n" +" \"fogcoord\" .emit VERTEX_RESULT_FOGCOORD .or\n" +" \"pointsize\" .emit VERTEX_RESULT_POINTSIZE .or\n" +" vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;\n" +"vp_resultBinding_2\n" +" \"texcoord\" .and optTexCoordNum;\n" +"resultColBinding\n" +" \"color\" .and optFaceType .and optColorType;\n" +"optFaceType\n" +" FaceType .or .true .emit FACE_FRONT;\n" +"FaceType\n" +" dot_ne .and FaceProperty;\n" +"FaceProperty\n" +" \"front\" .emit FACE_FRONT .or \"back\" .emit FACE_BACK;\n" +"optColorType\n" +" ColorType .or .true .emit COLOR_PRIMARY;\n" +"ColorType\n" +" dot_ne .and ColorProperty .error INVALID_COLOR_PROPERTY;\n" +"ColorProperty\n" +" \"primary\" .emit COLOR_PRIMARY .or \"secondary\" .emit COLOR_SECONDARY;\n" +"fp_ALIAS_statement\n" +" \"ALIAS\" .and space .and fp_establishName .and equal .and fp_establishedName;\n" +"vp_ALIAS_statement\n" +" \"ALIAS\" .and space .and vp_establishName .and equal .and vp_establishedName;\n" +"fp_establishName\n" +" fp_identifier;\n" +"vp_establishName\n" +" vp_identifier;\n" +"fp_establishedName\n" +" fp_identifier;\n" +"vp_establishedName\n" +" vp_identifier;\n" +"fp_identifier\n" +" fp_not_reserved_identifier .and identifier_ne .error IDENTIFIER_EXPECTED;\n" +"vp_identifier\n" +" vp_not_reserved_identifier .and identifier_ne .error IDENTIFIER_EXPECTED;\n" +"fp_not_reserved_identifier\n" +" fp_not_reserved_identifier_1 .or .true;\n" +"fp_not_reserved_identifier_1\n" +" fp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" +"vp_not_reserved_identifier\n" +" vp_not_reserved_identifier_1 .or .true;\n" +"vp_not_reserved_identifier_1\n" +" vp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" +"fp_reserved_identifier\n" +" \"ABS\" .or \"ABS_SAT\" .or \"ADD\" .or \"ADD_SAT\" .or \"ALIAS\" .or \"ATTRIB\" .or \"CMP\" .or \"CMP_SAT\" .or\n" +" \"COS\" .or \"COS_SAT\" .or \"DP3\" .or \"DP3_SAT\" .or \"DP4\" .or \"DP4_SAT\" .or \"DPH\" .or \"DPH_SAT\" .or\n" +" \"DST\" .or \"DST_SAT\" .or \"END\" .or \"EX2\" .or \"EX2_SAT\" .or \"FLR\" .or \"FLR_SAT\" .or \"FRC\" .or\n" +" \"FRC_SAT\" .or \"KIL\" .or \"LG2\" .or \"LG2_SAT\" .or \"LIT\" .or \"LIT_SAT\" .or \"LRP\" .or \"LRP_SAT\" .or\n" +" \"MAD\" .or \"MAD_SAT\" .or \"MAX\" .or \"MAX_SAT\" .or \"MIN\" .or \"MIN_SAT\" .or \"MOV\" .or \"MOV_SAT\" .or\n" +" \"MUL\" .or \"MUL_SAT\" .or \"OPTION\" .or \"OUTPUT\" .or \"PARAM\" .or \"POW\" .or \"POW_SAT\" .or \"RCP\" .or\n" +" \"RCP_SAT\" .or \"RSQ\" .or \"RSQ_SAT\" .or \"SIN\" .or \"SIN_SAT\" .or \"SCS\" .or \"SCS_SAT\" .or \"SGE\" .or\n" +" \"SGE_SAT\" .or \"SLT\" .or \"SLT_SAT\" .or \"SUB\" .or \"SUB_SAT\" .or \"SWZ\" .or \"SWZ_SAT\" .or \"TEMP\" .or\n" +" \"TEX\" .or \"TEX_SAT\" .or \"TXB\" .or \"TXB_SAT\" .or \"TXP\" .or \"TXP_SAT\" .or \"XPD\" .or \"XPD_SAT\" .or\n" +" \"fragment\" .or \"program\" .or \"result\" .or \"state\" .or \"texture\";\n" +"vp_reserved_identifier\n" +" \"ABS\" .or \"ADD\" .or \"ADDRESS\" .or \"ALIAS\" .or \"ARL\" .or \"ATTRIB\" .or \"DP3\" .or \"DP4\" .or\n" +" \"DPH\" .or \"DST\" .or \"END\" .or \"EX2\" .or \"EXP\" .or \"FLR\" .or \"FRC\" .or \"LG2\" .or \"LIT\" .or\n" +" \"LOG\" .or \"MAD\" .or \"MAX\" .or \"MIN\" .or \"MOV\" .or \"MUL\" .or \"OPTION\" .or \"OUTPUT\" .or\n" +" \"PARAM\" .or \"POW\" .or \"RCP\" .or \"RSQ\" .or \"SGE\" .or \"SLT\" .or \"SUB\" .or \"SWZ\" .or \"TEMP\" .or\n" +" \"XPD\" .or \"program\" .or \"result\" .or \"state\" .or \"vertex\";\n" +"integer\n" +" integer_ne .error INTEGER_EXPECTED;\n" +"integer_0_3\n" +" integer;\n" +"integer_0_63\n" +" integer;\n" +"integer_0_64\n" +" integer;\n" +"optional_space\n" +" space .or .true;\n" +"space\n" +" single_space .and .loop single_space;\n" +"single_space\n" +" white_char .or comment_block;\n" +"white_char\n" +" ' ' .or '\\t' .or '\\n' .or '\\r';\n" +"comment_block\n" +" '#' .and .loop comment_char .and new_line;\n" +"comment_char\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"new_line\n" +" '\\n' .or crlf .or '\\0';\n" +"crlf\n" +" '\\r' .and '\\n';\n" +"semicolon\n" +" optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" +"comma\n" +" optional_space .and ',' .error MISSING_COMMA .and optional_space;\n" +"comma_ne\n" +" optional_space .and ',' .and optional_space;\n" +"lbracket\n" +" optional_space .and '[' .error MISSING_LBRACKET .and optional_space;\n" +"lbracket_ne\n" +" optional_space .and '[' .and optional_space;\n" +"rbracket\n" +" optional_space .and ']' .error MISSING_RBRACKET .and optional_space;\n" +"dot\n" +" optional_space .and '.' .error MISSING_DOT .and optional_space;\n" +"dot_ne\n" +" optional_space .and '.' .and optional_space;\n" +"equal\n" +" optional_space .and '=' .error MISSING_EQUAL .and optional_space;\n" +"lbrace\n" +" optional_space .and '{' .error MISSING_LBRACE .and optional_space;\n" +"lbrace_ne\n" +" optional_space .and '{' .and optional_space;\n" +"rbrace\n" +" optional_space .and '}' .error MISSING_RBRACE .and optional_space;\n" +"dotdot\n" +" optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;\n" +"dotdot_ne\n" +" optional_space .and '.' .and '.' .and optional_space;\n" +"float\n" +" float_1 .or float_2;\n" +"float_1\n" +" '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;\n" +"float_2\n" +" integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;\n" +"float_3\n" +" float_4 .or float_5;\n" +"float_4\n" +" '.' .and optional_integer .and optional_exponent;\n" +"float_5\n" +" exponent .emit 0x00;\n" +"integer_ne\n" +" integer_ne_1 .and .true .emit 0x00 .emit $;\n" +"integer_ne_1\n" +" digit10 .emit * .and .loop digit10 .emit *;\n" +"optional_integer\n" +" integer_ne .or .true .emit 0x00;\n" +"optional_exponent\n" +" exponent .or .true .emit '1' .emit 0x00 .emit $;\n" +"exponent\n" +" exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;\n" +"exponent_1\n" +" 'e' .or 'E';\n" +"optional_sign_ne\n" +" minus_ne .or plus_ne .or .true;\n" +"plus_ne\n" +" optional_space .and '+' .and optional_space;\n" +"minus_ne\n" +" optional_space .and '-' .emit '-' .and optional_space;\n" +"identifier_ne\n" +" first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;\n" +"follow_idchar\n" +" first_idchar .or digit10;\n" +"first_idchar\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" +"digit10\n" +" '0'-'9';\n" +".string __string_filter;\n" +"__string_filter\n" +" .loop __identifier_char;\n" +"__identifier_char\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';\n" +"e_signature\n" +" e_signature_char .and .loop e_signature_char;\n" +"e_signature_char\n" +" '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" +"e_statement\n" +" .loop e_statement_not_term;\n" +"e_statement_not_term\n" +" '\\x3C'-'\\xFF' .or '\\x0E'-'\\x3A' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"e_identifier\n" +" e_identifier_first .and .loop e_identifier_next;\n" +"e_identifier_first\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" +"e_identifier_next\n" +" e_identifier_first .or '0'-'9';\n" +"e_token\n" +" e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or\n" +" '-' .or ',' .or ';';\n" +"e_token_number\n" +" e_token_digit .and .loop e_token_digit;\n" +"e_token_digit\n" +" '0'-'9';\n" +"e_charordigit\n" +" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" +""; diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 8ebae9d7da7..56aa6152630 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -44,7 +44,7 @@ #include "nvvertprog.h" -void +void GLAPIENTRY _mesa_EnableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); @@ -62,7 +62,7 @@ _mesa_EnableVertexAttribArrayARB(GLuint index) } -void +void GLAPIENTRY _mesa_DisableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); @@ -80,7 +80,7 @@ _mesa_DisableVertexAttribArrayARB(GLuint index) } -void +void GLAPIENTRY _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) { GLfloat fparams[4]; @@ -99,7 +99,7 @@ _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) } -void +void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -143,7 +143,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) } -void +void GLAPIENTRY _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) { GLfloat fparams[4]; @@ -162,7 +162,7 @@ _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); @@ -178,11 +178,11 @@ _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) return; } - *pointer = ctx->Array.VertexAttrib[index].Ptr;; + *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;; } -void +void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { @@ -215,7 +215,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } -void +void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { @@ -224,7 +224,7 @@ _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { @@ -234,7 +234,7 @@ _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -264,7 +264,7 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { @@ -273,7 +273,7 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params) { @@ -290,7 +290,7 @@ _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat *params) { @@ -325,7 +325,7 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -367,7 +367,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { @@ -379,7 +379,7 @@ _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) @@ -392,7 +392,7 @@ _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { @@ -405,7 +405,7 @@ _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params) { @@ -450,7 +450,7 @@ _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, /** * Note, this function is also used by the GL_NV_fragment_program extension. */ -void +void GLAPIENTRY _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble *params) { @@ -463,7 +463,7 @@ _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, } -void +void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) { struct program *prog; @@ -670,7 +670,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) { struct program *prog; diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h index 8bfb180bac1..e1b99ab686f 100644 --- a/src/mesa/main/arbprogram.h +++ b/src/mesa/main/arbprogram.h @@ -27,101 +27,101 @@ #define ARBPROGRAM_H -extern void +extern void GLAPIENTRY _mesa_EnableVertexAttribArrayARB(GLuint index); -extern void +extern void GLAPIENTRY _mesa_DisableVertexAttribArrayARB(GLuint index); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer); -extern void +extern void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string); -extern void +extern void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string); diff --git a/src/mesa/main/arbvertparse.c b/src/mesa/main/arbvertparse.c index 74922692318..0df17f370af 100644 --- a/src/mesa/main/arbvertparse.c +++ b/src/mesa/main/arbvertparse.c @@ -22,6 +22,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#define DEBUG_VP 0 + /** * \file arbvertparse.c * ARB_vertex_program parser. @@ -38,6594 +40,171 @@ #include "nvvertparse.h" #include "nvvertprog.h" -#include "arbvertparse.h" - -/** - * Overview: - * - * This is a simple top-down predictive parser. In a nutshell, there are two key - * elements to a predictive parser. First, is the 'look ahead' symbol. This is simply - * the next token in the input stream. The other component is a stack of symbols. - * - * Given the grammar, we can derive a look ahead table. This is just a 2D array, - * where one axis is the non-terminal on top of the stack and the other axis is - * the look ahead. Each entry in the array is the production to apply when the pair - * of stack symbol & look ahead is encountered. If no production is listed at - * a given entry in the table, a parse error occurs if this combination - * is seen. - * - * Since we want to drive the parsing from a couple of huge tables, we have to - * save some information later on for processing (e.g. for code generation). - * For this, we explicitly recreate the parse tree representing the derivation. - * We can then make several passes over the parse tree to perform all additional - * processing, and we can be sure the the parse is valid. - * - * The stack is initialized by pushing the start symbol onto it. The look ahead - * symbol is initially the first token in the program string. - * - * If there is a non-terminal symbol on top of the stack, the look ahead table - * is consulted to find if a production exists for the top of the stack - * and the look ahead. - * - * When we find a matching production, we pop the non-terminal off the top of - * the stack (the LHS of the production), and push the tokens on the RHS of - * the production onto the stack. Note that we store a pointer to the parse_tree_node - * containing the LHS token on the stack. This way, we can setup the children in - * the parse tree as we apply the production. - * - * If there is a terminal symbol on top of the stack, we compare it with the - * look ahead symbol. If they match, or we don't care about the value of the - * terminal (e.g. we know its an integer, but don't necessairly care what - * integer), the terminal symbol is popped off the stack and the look ahead - * is advanced. - * - * There are a few special nasty cases of productions for which we make special - * cases. These aren't found in the production/look-ahead tables, but listed - * out explicitly. - * - * After the parse tree has been constructed, we make several recusive passes - * over it to perform various tasks. - * - * The first pass is made to clean up the state bindings. This is done in - * parse_tree_fold_bindings(). The goal is to reduce the big mess of a parse tree - * created by strings such as: - * - * result.color.secondary - * - * and roll them up into one token and fill out some information in a symbol table. - * In this case, the token at the root of the derivation becomes BINDING_TOKEN, - * and the token attribute is an index into the binding table where this state - * is held. - * - * The next two passes go about associating variables with BINDING_TOKENs. This - * takes care of the cases like: - * - * OUTPUT foo = result.color.secondary; - * - * by inserting the index in the binding table for result.color.secondary into - * the attr field in the identifier table where the 'foo' variable sits. - * The second such pass deals with setting up arrays of program parameters, - * while the first only deals with scalars. - * - * We then examine all the information on variables and state that we have - * gathered, and layout which 'register' each variable or bit-of-state should use. - * - * - * Finally, we make a recursive pass of the parse tree and generate opcodes - * for Mesa to interpret while executing the program. - * - * It should be noted that each input/stack token has two parts, an 'identifier' - * and an 'attribute'. The identifier tells what class the token is, e.g. INTEGER_TOKEN, - * or NT_PROGRAM_SINGLE_ITEM_TOKEN. For some tokens, e.g. INTEGER_TOKEN, ID_TOKEN, - * FLOAT_TOKEN, or BINDING_TOKEN, the attribute for the token is an index into a table - * giving various properties about the token. - * - */ - -/** - * Here are all of the structs used to hold parse state and symbol - * tables used. - * - * All strings which are not reserved words, floats, ints, or misc - * puncuation (ie .) are considered to be [potential] identifiers. - * When we encounter such a string while lex'ing, insert it into - * the id symbol table, shown below. - * - * Sometime later, we'll initialize the variable types for identifiers - * which really are variables. This gets shoved into the 'type' field. - * - * For variables, we'll need additional info (e.g. state it is bound to, - * variable we're aliased to, etc). This is stored in the 'attr' field. - * - For alias variables, the attr is the idx in the id table of - * the variable we are bound to. - * - For other variables, we need a whole mess of info. This can be - * found in the binding symbol table, below. In this case, the - * attr field is the idx into the binding table that describes us. - * - For uninitialized ids, attr is -1. - * - * The data field holds the string of the id. - * - * len is the number of identifiers in the table. - */ -typedef struct st_id_table -{ - GLint len; - GLint *type; - GLint *attr; - GLubyte **data; -} -id_table; - -/** - * For PARAM arrays, we need to record the contents for use when - * laying out registers and loading state. - * - * len is the number of arrays in the table. - * - * num_elements[i] is the number of items in array i. In other words, this - * is the number of registers it would require when allocating. - * - * data[i][n] is the state bound to element n in array i. It is an idx into - * the binding table - */ -typedef struct st_array_table -{ - GLint len; - GLint *num_elements; - GLint **data; -} -array_table; - -/** - * For holding all of the data used to describe an identifier, we have the catch - * all binding symbol table. - * - * len is the number of bound items; - * - * type[i] tells what we are binding too, e.g. ATTRIB_POSITION, FOG_COLOR, or CONSTANT - * - * offset[i] gives the matrix number for matrix bindings, e.g. MATRIXROWS_MODELVIEW. - * Alternativly, it gives the number of the first parameter for PROGRAM_ENV_* and - * PROGRAM_LOCAL_*. - * - * num_rows[i] gives the number of rows for multiple matrix rows, or the number - * of parameters in a env/local array. - * - * consts gives the 4-GLfloat constant value for bindings of type CONSTANT - * - * reg_num gives the register number which this binding is held in. - */ -typedef struct st_binding_table -{ - GLint len; - GLint *type; - GLint *offset; - GLint *row; - GLint *num_rows; - GLfloat **consts; - GLint *reg_num; -} -binding_table; - -/** - * Integers and floats are stored here. - */ -typedef struct st_int_table -{ - GLint len; - GLint *data; -} -int_table; - -typedef struct st_float_table -{ - GLint len; - GLdouble *data; -} -float_table; - -/** - * To avoid writing tons of mindless parser code, the parsing is driven by - * a few big tables of rules, plus a few special cases. However, this means - * that we have to do all of our analysis outside of the parsing step. - * - * So, the parser will contruct a parse tree describing the program string - * which we can then operate on to do things like code generation. - * - * This struct represents a node in the parse tree. - * - * If tok is a non-terminal token, tok_attr is not relevant. - * If tok is BINDING_TOKEN, tok_attr is the index into the binding table. - * if tok is INTEGER_TOKEN or FLOAT_TOKEN, tok_attr is the index in the integer/GLfloat table - * - * prod_applied is the production number applied to this token in the derivation of - * the program string. See arbvp_grammar.txt for a listing of the productions, and - * their numbers. - */ -typedef struct st_parse_tree_node -{ - GLint tok, tok_attr, is_terminal; - GLint prod_applied; - struct st_parse_tree_node *children[4]; -} -parse_tree_node; - -/** This stores tokens that we lex out - */ -typedef struct st_token_list -{ - GLint tok, tok_attr; - parse_tree_node *pt; - - struct st_token_list *next; -} -token_list; - -/** - * This holds all of the productions in the grammar. - * - * lhs is a non-terminal token, e.g. NT_PROGRAM_TOKEN. - * rhs is either NULL_TOKEN, another non-terminal token, or a terminal token. - * In some cases, we need the RHS to be a certain value, e.g. for the dst reg write masks. - * For this, key is used to specify the string. If we don't care about the key, just - * specify "". - * Int/floats are slightly different, "-1" specifies 'we don't care'. - * - * lhs is not very useful here, but is is convient for sanity sake when specifing productions. - */ -typedef struct st_prod_table -{ - GLint lhs; - GLint rhs[4]; - char *key[4]; -} -prod_table; - -/** - * This holds the look ahead table to drive the parser. We examine the token on - * the top of the stack, as well as the next token in the input stream (the look ahead). - * We then match this against the table, and apply the approprate production. If nothing - * matches, we have a parse error. - * - * Here, LHS is the (non-terminal) token to match against the top of the stack. - * - * la is the token to match against the look ahead. - * - * If la is ID_TOKEN, we have to match a given keyword (e.g. 'ambient'). This is specified in - * la_kw. - * - * prod_idx is the idx into the prod_table of the production that we are to apply if this - * rule matches. - */ -typedef struct st_look_ahead_table -{ - GLint lhs; - GLint la; - char *la_kw; - GLint prod_idx; -} -look_ahead_table; - -/** - * This is the general catch-all for the parse state - */ -typedef struct st_parse_state -{ - char *str; - GLint len; - - /* lex stuff ------ */ - GLint start_pos, curr_pos; - GLint curr_state; - /* ---------------- */ - - id_table idents; - int_table ints; - float_table floats; - binding_table binds; - array_table arrays; - - token_list *stack_head, *stack_free_list; - - parse_tree_node *pt_head; -} -parse_state; - -/* local prototypes */ -static GLint float_table_add(float_table * tab, const char *str, GLint start, - GLint end); -static GLint int_table_add(int_table * tab, const char *str, GLint start, - GLint end); -static GLint id_table_add(id_table * tab, const char *str, GLint start, - GLint end); -static void parse_tree_free_children(parse_tree_node * ptn); - -/** - * Here we have a ton of defined terms that we use to identify productions, - * terminals, and nonterminals. - */ - -/** - * Terminal tokens - */ -#define EOF_TOKEN 0 -#define ID_TOKEN 1 -#define ABS_TOKEN 2 -#define ADD_TOKEN 3 -#define ADDRESS_TOKEN 4 -#define ALIAS_TOKEN 5 -#define ARL_TOKEN 6 -#define ATTRIB_TOKEN 7 - -#define DP3_TOKEN 8 -#define DP4_TOKEN 9 -#define DPH_TOKEN 10 -#define DST_TOKEN 11 - -#define END_TOKEN 12 -#define EX2_TOKEN 13 -#define EXP_TOKEN 14 - -#define FLR_TOKEN 15 -#define FRC_TOKEN 16 - -#define LG2_TOKEN 17 -#define LIT_TOKEN 18 -#define LOG_TOKEN 19 - -#define MAD_TOKEN 20 -#define MAX_TOKEN 21 -#define MIN_TOKEN 22 -#define MOV_TOKEN 23 -#define MUL_TOKEN 24 - -#define OPTION_TOKEN 25 -#define OUTPUT_TOKEN 26 - -#define PARAM_TOKEN 27 -#define POW_TOKEN 28 - -#define RCP_TOKEN 29 -#define RSQ_TOKEN 30 - -#define SGE_TOKEN 31 -#define SLT_TOKEN 32 -#define SUB_TOKEN 33 -#define SWZ_TOKEN 34 - -#define TEMP_TOKEN 35 - -#define XPD_TOKEN 36 - -#define SEMICOLON_TOKEN 37 -#define COMMA_TOKEN 38 -#define PLUS_TOKEN 39 -#define MINUS_TOKEN 40 -#define PERIOD_TOKEN 41 -#define DOTDOT_TOKEN 42 -#define LBRACKET_TOKEN 43 -#define RBRACKET_TOKEN 44 -#define LBRACE_TOKEN 45 -#define RBRACE_TOKEN 46 -#define EQUAL_TOKEN 47 - -#define INTEGER_TOKEN 48 -#define FLOAT_TOKEN 49 - -#define PROGRAM_TOKEN 50 -#define RESULT_TOKEN 51 -#define STATE_TOKEN 52 -#define VERTEX_TOKEN 53 - -#define NULL_TOKEN 54 - -#define BINDING_TOKEN 55 - -/** - * Non-terminal tokens - */ -#define NT_PROGRAM_TOKEN 100 -#define NT_OPTION_SEQUENCE_TOKEN 101 -#define NT_OPTION_SEQUENCE2_TOKEN 102 -#define NT_OPTION_TOKEN 103 -#define NT_STATEMENT_SEQUENCE_TOKEN 104 -#define NT_STATEMENT_SEQUENCE2_TOKEN 105 -#define NT_STATEMENT_TOKEN 106 - -#define NT_INSTRUCTION_TOKEN 107 -#define NT_ARL_INSTRUCTION_TOKEN 108 -#define NT_VECTOROP_INSTRUCTION_TOKEN 109 -#define NT_VECTOROP_TOKEN 110 -#define NT_SCALAROP_INSTRUCTION_TOKEN 111 -#define NT_SCALAROP_TOKEN 112 -#define NT_BINSCOP_INSTRUCTION_TOKEN 113 -#define NT_BINSCOP_INSTRUCTION2_TOKEN 114 -#define NT_BINSCOP_TOKEN 115 -#define NT_BINOP_INSTRUCTION_TOKEN 116 -#define NT_BINOP_INSTRUCTION2_TOKEN 117 -#define NT_BINOP_TOKEN 118 -#define NT_TRIOP_INSTRUCTION_TOKEN 119 -#define NT_TRIOP_INSTRUCTION2_TOKEN 120 -#define NT_TRIOP_INSTRUCTION3_TOKEN 121 -#define NT_TRIOP_TOKEN 122 -#define NT_SWZ_INSTRUCTION_TOKEN 123 -#define NT_SWZ_INSTRUCTION2_TOKEN 124 - -#define NT_SCALAR_SRC_REG_TOKEN 130 -#define NT_SWIZZLE_SRC_REG_TOKEN 131 -#define NT_MASKED_DST_REG_TOKEN 132 -#define NT_MASKED_ADDR_REG_TOKEN 133 -#define NT_EXTENDED_SWIZZLE_TOKEN 134 -#define NT_EXTENDED_SWIZZLE2_TOKEN 135 -#define NT_EXT_SWIZ_COMP_TOKEN 136 -#define NT_EXT_SWIZ_SEL_TOKEN 137 -#define NT_SRC_REG_TOKEN 138 -#define NT_DST_REG_TOKEN 139 -#define NT_VERTEX_ATTRIB_REG_TOKEN 140 - -#define NT_TEMPORARY_REG_TOKEN 150 -#define NT_PROG_PARAM_REG_TOKEN 151 -#define NT_PROG_PARAM_SINGLE_TOKEN 152 -#define NT_PROG_PARAM_ARRAY_TOKEN 153 -#define NT_PROG_PARAM_ARRAY_MEM_TOKEN 154 -#define NT_PROG_PARAM_ARRAY_ABS_TOKEN 155 -#define NT_PROG_PARAM_ARRAY_REL_TOKEN 156 - -#define NT_ADDR_REG_REL_OFFSET_TOKEN 157 -#define NT_ADDR_REG_POS_OFFSET_TOKEN 158 -#define NT_ADDR_REG_NEG_OFFSET_TOKEN 159 - -#define NT_VERTEX_RESULT_REG_TOKEN 160 -#define NT_ADDR_REG_TOKEN 161 -#define NT_ADDR_COMPONENT_TOKEN 162 -#define NT_ADDR_WRITE_MASK_TOKEN 163 -#define NT_SCALAR_SUFFIX_TOKEN 164 -#define NT_SWIZZLE_SUFFIX_TOKEN 165 - -#define NT_COMPONENT_TOKEN 166 -#define NT_OPTIONAL_MASK_TOKEN 167 -#define NT_OPTIONAL_MASK2_TOKEN 168 -#define NT_NAMING_STATEMENT_TOKEN 169 - -#define NT_ATTRIB_STATEMENT_TOKEN 170 -#define NT_VTX_ATTRIB_BINDING_TOKEN 171 -#define NT_VTX_ATTRIB_ITEM_TOKEN 172 -#define NT_VTX_ATTRIB_NUM_TOKEN 173 -#define NT_VTX_OPT_WEIGHT_NUM_TOKEN 174 -#define NT_VTX_WEIGHT_NUM_TOKEN 175 -#define NT_PARAM_STATEMENT_TOKEN 176 -#define NT_PARAM_STATEMENT2_TOKEN 177 -#define NT_OPT_ARRAY_SIZE_TOKEN 178 -#define NT_PARAM_SINGLE_INIT_TOKEN 179 -#define NT_PARAM_MULTIPLE_INIT_TOKEN 180 -#define NT_PARAM_MULT_INIT_LIST_TOKEN 181 -#define NT_PARAM_MULT_INIT_LIST2_TOKEN 182 -#define NT_PARAM_SINGLE_ITEM_DECL_TOKEN 183 -#define NT_PARAM_SINGLE_ITEM_USE_TOKEN 184 -#define NT_PARAM_MULTIPLE_ITEM_TOKEN 185 -#define NT_STATE_MULTIPLE_ITEM_TOKEN 186 -#define NT_STATE_MULTIPLE_ITEM2_TOKEN 187 -#define NT_FOO_TOKEN 188 -#define NT_FOO2_TOKEN 189 -#define NT_FOO3_TOKEN 190 -#define NT_FOO35_TOKEN 191 -#define NT_FOO4_TOKEN 192 -#define NT_STATE_SINGLE_ITEM_TOKEN 193 -#define NT_STATE_SINGLE_ITEM2_TOKEN 194 -#define NT_STATE_MATERIAL_ITEM_TOKEN 195 -#define NT_STATE_MATERIAL_ITEM2_TOKEN 196 -#define NT_STATE_MAT_PROPERTY_TOKEN 197 -#define NT_STATE_LIGHT_ITEM_TOKEN 198 -#define NT_STATE_LIGHT_ITEM2_TOKEN 199 -#define NT_STATE_LIGHT_PROPERTY_TOKEN 200 -#define NT_STATE_SPOT_PROPERTY_TOKEN 201 -#define NT_STATE_LIGHT_MODEL_ITEM_TOKEN 202 -#define NT_STATE_LMOD_PROPERTY_TOKEN 203 -#define NT_STATE_LMOD_PROPERTY2_TOKEN 204 - -#define NT_STATE_LIGHT_PROD_ITEM_TOKEN 207 -#define NT_STATE_LIGHT_PROD_ITEM15_TOKEN 208 -#define NT_STATE_LIGHT_PROD_ITEM2_TOKEN 209 -#define NT_STATE_LPROD_PROPERTY_TOKEN 210 -#define NT_STATE_LIGHT_NUMBER_TOKEN 211 -#define NT_STATE_TEX_GEN_ITEM_TOKEN 212 -#define NT_STATE_TEX_GEN_ITEM2_TOKEN 213 -#define NT_STATE_TEX_GEN_TYPE_TOKEN 214 -#define NT_STATE_TEX_GEN_COORD_TOKEN 215 -#define NT_STATE_FOG_ITEM_TOKEN 216 -#define NT_STATE_FOG_PROPERTY_TOKEN 217 - -#define NT_STATE_CLIP_PLANE_ITEM_TOKEN 218 -#define NT_STATE_CLIP_PLANE_ITEM2_TOKEN 219 -#define NT_STATE_CLIP_PLANE_NUM_TOKEN 220 -#define NT_STATE_POINT_ITEM_TOKEN 221 -#define NT_STATE_POINT_PROPERTY_TOKEN 222 -#define NT_STATE_MATRIX_ROW_TOKEN 223 -#define NT_STATE_MATRIX_ROW15_TOKEN 224 -#define NT_STATE_MATRIX_ROW2_TOKEN 225 -#define NT_STATE_MATRIX_ROW3_TOKEN 226 -#define NT_STATE_MAT_MODIFIER_TOKEN 227 -#define NT_STATE_MATRIX_ROW_NUM_TOKEN 228 -#define NT_STATE_MATRIX_NAME_TOKEN 229 -#define NT_STATE_OPT_MOD_MAT_NUM_TOKEN 230 -#define NT_STATE_MOD_MAT_NUM_TOKEN 231 -#define NT_STATE_PALETTE_MAT_NUM_TOKEN 232 -#define NT_STATE_PROGRAM_MAT_NUM_TOKEN 233 - -#define NT_PROGRAM_SINGLE_ITEM_TOKEN 234 -#define NT_PROGRAM_SINGLE_ITEM2_TOKEN 235 -#define NT_PROGRAM_MULTIPLE_ITEM_TOKEN 236 -#define NT_PROGRAM_MULTIPLE_ITEM2_TOKEN 237 -#define NT_PROG_ENV_PARAMS_TOKEN 238 -#define NT_PROG_ENV_PARAM_NUMS_TOKEN 239 -#define NT_PROG_ENV_PARAM_NUMS2_TOKEN 240 -#define NT_PROG_ENV_PARAM_TOKEN 250 -#define NT_PROG_LOCAL_PARAMS_TOKEN 251 -#define NT_PROG_LOCAL_PARAM_NUMS_TOKEN 252 -#define NT_PROG_LOCAL_PARAM_NUMS2_TOKEN 253 -#define NT_PROG_LOCAL_PARAM_TOKEN 254 -#define NT_PROG_ENV_PARAM_NUM_TOKEN 255 -#define NT_PROG_LOCAL_PARAM_NUM_TOKEN 256 - -#define NT_PARAM_CONST_DECL_TOKEN 257 -#define NT_PARAM_CONST_USE_TOKEN 258 -#define NT_PARAM_CONST_SCALAR_DECL_TOKEN 259 -#define NT_PARAM_CONST_SCALAR_USE_TOKEN 260 -#define NT_PARAM_CONST_VECTOR_TOKEN 261 -#define NT_PARAM_CONST_VECTOR2_TOKEN 262 -#define NT_PARAM_CONST_VECTOR3_TOKEN 263 -#define NT_PARAM_CONST_VECTOR4_TOKEN 264 - -#define NT_SIGNED_FLOAT_CONSTANT_TOKEN 265 -#define NT_FLOAT_CONSTANT_TOKEN 266 -#define NT_OPTIONAL_SIGN_TOKEN 267 - -#define NT_TEMP_STATEMENT_TOKEN 268 -#define NT_ADDRESS_STATEMENT_TOKEN 269 -#define NT_VAR_NAME_LIST_TOKEN 270 -#define NT_OUTPUT_STATEMENT_TOKEN 271 -#define NT_RESULT_BINDING_TOKEN 272 -#define NT_RESULT_BINDING2_TOKEN 273 -#define NT_RESULT_COL_BINDING_TOKEN 274 -#define NT_RESULT_COL_BINDING2_TOKEN 275 -#define NT_RESULT_COL_BINDING3_TOKEN 276 -#define NT_RESULT_COL_BINDING4_TOKEN 277 -#define NT_RESULT_COL_BINDING5_TOKEN 278 - -#define NT_OPT_FACE_TYPE2_TOKEN 279 -#define NT_OPT_COLOR_TYPE_TOKEN 280 -#define NT_OPT_COLOR_TYPE2_TOKEN 281 -#define NT_OPT_TEX_COORD_NUM_TOKEN 282 -#define NT_TEX_COORD_NUM_TOKEN 283 - -#define NT_ALIAS_STATEMENT_TOKEN 284 -#define NT_ESTABLISH_NAME_TOKEN 285 -#define NT_ESTABLISHED_NAME_TOKEN 286 - -#define NT_SWIZZLE_SUFFIX2_TOKEN 287 -#define NT_COMPONENT4_TOKEN 288 - -/** - * FSA States for lex - * - * XXX: These can be turned into enums - */ -#define STATE_BASE 0 -#define STATE_IDENT 1 - -#define STATE_A 2 -#define STATE_AB 3 -#define STATE_ABS 4 -#define STATE_AD 5 -#define STATE_ADD 6 -#define STATE_ADDR 7 -#define STATE_ADDRE 8 -#define STATE_ADDRES 9 -#define STATE_ADDRESS 10 -#define STATE_AL 11 -#define STATE_ALI 12 -#define STATE_ALIA 13 -#define STATE_ALIAS 14 -#define STATE_AR 15 -#define STATE_ARL 16 -#define STATE_AT 17 -#define STATE_ATT 18 -#define STATE_ATTR 19 -#define STATE_ATTRI 20 -#define STATE_ATTRIB 21 - -#define STATE_D 22 -#define STATE_DP 23 -#define STATE_DP3 24 -#define STATE_DP4 25 -#define STATE_DPH 26 -#define STATE_DS 27 -#define STATE_DST 28 - -#define STATE_E 29 -#define STATE_EN 30 -#define STATE_END 31 -#define STATE_EX 32 -#define STATE_EX2 33 -#define STATE_EXP 34 - -#define STATE_F 35 -#define STATE_FL 36 -#define STATE_FLR 37 -#define STATE_FR 38 -#define STATE_FRC 39 - -#define STATE_L 40 -#define STATE_LG 41 -#define STATE_LG2 42 -#define STATE_LI 43 -#define STATE_LIT 44 -#define STATE_LO 45 -#define STATE_LOG 46 - -#define STATE_M 47 -#define STATE_MA 48 -#define STATE_MAD 49 -#define STATE_MAX 50 -#define STATE_MI 51 -#define STATE_MIN 52 -#define STATE_MO 53 -#define STATE_MOV 54 -#define STATE_MU 55 -#define STATE_MUL 56 - -#define STATE_O 57 -#define STATE_OP 58 -#define STATE_OPT 59 -#define STATE_OPTI 60 -#define STATE_OPTIO 61 -#define STATE_OPTION 62 -#define STATE_OU 63 -#define STATE_OUT 64 -#define STATE_OUTP 65 -#define STATE_OUTPU 66 -#define STATE_OUTPUT 67 - -#define STATE_P 68 -#define STATE_PA 69 -#define STATE_PAR 70 -#define STATE_PARA 71 -#define STATE_PARAM 72 -#define STATE_PO 73 -#define STATE_POW 74 - -#define STATE_R 75 -#define STATE_RC 76 -#define STATE_RCP 77 -#define STATE_RS 78 -#define STATE_RSQ 79 - -#define STATE_S 80 -#define STATE_SG 81 -#define STATE_SGE 82 -#define STATE_SL 83 -#define STATE_SLT 84 -#define STATE_SU 85 -#define STATE_SUB 86 -#define STATE_SW 87 -#define STATE_SWZ 88 - -#define STATE_T 89 -#define STATE_TE 90 -#define STATE_TEM 91 -#define STATE_TEMP 92 - -#define STATE_X 93 -#define STATE_XP 94 -#define STATE_XPD 95 - -#define STATE_N1 96 -#define STATE_N2 97 -#define STATE_N3 98 -#define STATE_N4 99 -#define STATE_N5 100 -#define STATE_N6 101 -#define STATE_N7 102 - -#define STATE_COMMENT 103 - -/* LC == lower case, as in 'program' */ -#define STATE_LC_P 104 -#define STATE_LC_PR 105 -#define STATE_LC_PRO 106 -#define STATE_LC_PROG 107 -#define STATE_LC_PROGR 108 -#define STATE_LC_PROGRA 109 - -#define STATE_LC_R 110 -#define STATE_LC_RE 111 -#define STATE_LC_RES 112 -#define STATE_LC_RESU 113 -#define STATE_LC_RESUL 114 -#define STATE_LC_RESULT 115 - -#define STATE_LC_S 116 -#define STATE_LC_ST 117 -#define STATE_LC_STA 118 -#define STATE_LC_STAT 119 -#define STATE_LC_STATE 120 - -#define STATE_LC_V 121 -#define STATE_LC_VE 122 -#define STATE_LC_VER 123 -#define STATE_LC_VERT 124 -#define STATE_LC_VERTE 125 -#define STATE_LC_VERTEX 126 -#define STATE_LC_PROGRAM 127 - -/** - * Error codes - */ -#define ARB_VP_ERROR -1 -#define ARB_VP_SUCESS 0 - -/** - * Variable types - */ -#define TYPE_NONE 0 -#define TYPE_ATTRIB 1 -#define TYPE_PARAM 2 -#define TYPE_PARAM_SINGLE 3 -#define TYPE_PARAM_ARRAY 4 -#define TYPE_TEMP 5 -#define TYPE_ADDRESS 6 -#define TYPE_OUTPUT 7 -#define TYPE_ALIAS 8 - -/** - * Vertex Attrib Bindings - */ -#define ATTRIB_POSITION 1 -#define ATTRIB_WEIGHT 2 -#define ATTRIB_NORMAL 3 -#define ATTRIB_COLOR_PRIMARY 4 -#define ATTRIB_COLOR_SECONDARY 5 -#define ATTRIB_FOGCOORD 6 -#define ATTRIB_TEXCOORD 7 -#define ATTRIB_MATRIXINDEX 8 -#define ATTRIB_ATTRIB 9 - -/** - * Result Bindings - */ -#define RESULT_POSITION 10 -#define RESULT_FOGCOORD 11 -#define RESULT_POINTSIZE 12 -#define RESULT_COLOR_FRONT_PRIMARY 13 -#define RESULT_COLOR_FRONT_SECONDARY 14 -#define RESULT_COLOR_BACK_PRIMARY 15 -#define RESULT_COLOR_BACK_SECONDARY 16 -#define RESULT_TEXCOORD 17 - -/** - * Material Property Bindings - */ -#define MATERIAL_FRONT_AMBIENT 18 -#define MATERIAL_FRONT_DIFFUSE 19 -#define MATERIAL_FRONT_SPECULAR 20 -#define MATERIAL_FRONT_EMISSION 21 -#define MATERIAL_FRONT_SHININESS 22 -#define MATERIAL_BACK_AMBIENT 23 -#define MATERIAL_BACK_DIFFUSE 24 -#define MATERIAL_BACK_SPECULAR 25 -#define MATERIAL_BACK_EMISSION 26 -#define MATERIAL_BACK_SHININESS 27 - -/** - * Light Property Bindings - */ -#define LIGHT_AMBIENT 28 -#define LIGHT_DIFFUSE 29 -#define LIGHT_SPECULAR 30 -#define LIGHT_POSITION 31 -#define LIGHT_ATTENUATION 32 -#define LIGHT_SPOT_DIRECTION 33 -#define LIGHT_HALF 34 -#define LIGHTMODEL_AMBIENT 35 -#define LIGHTMODEL_FRONT_SCENECOLOR 36 -#define LIGHTMODEL_BACK_SCENECOLOR 37 -#define LIGHTPROD_FRONT_AMBIENT 38 -#define LIGHTPROD_FRONT_DIFFUSE 39 -#define LIGHTPROD_FRONT_SPECULAR 40 -#define LIGHTPROD_BACK_AMBIENT 41 -#define LIGHTPROD_BACK_DIFFUSE 42 -#define LIGHTPROD_BACK_SPECULAR 43 - -/** - * Texgen Property Bindings - */ -#define TEXGEN_EYE_S 44 -#define TEXGEN_EYE_T 45 -#define TEXGEN_EYE_R 46 -#define TEXGEN_EYE_Q 47 -#define TEXGEN_OBJECT_S 48 -#define TEXGEN_OBJECT_T 49 -#define TEXGEN_OBJECT_R 50 -#define TEXGEN_OBJECT_Q 51 - -/** - * Fog Property Bindings - */ -#define FOG_COLOR 52 -#define FOG_PARAMS 53 - -/** - * Clip Property Bindings - */ -#define CLIP_PLANE 54 - -/** - * Point Property Bindings - */ -#define POINT_SIZE 55 -#define POINT_ATTENUATION 56 - -/** - * Matrix Row Property Bindings - */ -#define MATRIXROW_MODELVIEW 57 -#define MATRIXROW_MODELVIEW_INVERSE 58 -#define MATRIXROW_MODELVIEW_INVTRANS 59 -#define MATRIXROW_MODELVIEW_TRANSPOSE 60 -#define MATRIXROW_PROJECTION 61 -#define MATRIXROW_PROJECTION_INVERSE 62 -#define MATRIXROW_PROJECTION_INVTRANS 63 -#define MATRIXROW_PROJECTION_TRANSPOSE 64 -#define MATRIXROW_MVP 65 -#define MATRIXROW_MVP_INVERSE 66 -#define MATRIXROW_MVP_INVTRANS 67 -#define MATRIXROW_MVP_TRANSPOSE 68 -#define MATRIXROW_TEXTURE 69 -#define MATRIXROW_TEXTURE_INVERSE 70 -#define MATRIXROW_TEXTURE_INVTRANS 71 -#define MATRIXROW_TEXTURE_TRANSPOSE 72 -#define MATRIXROW_PALETTE 73 -#define MATRIXROW_PALETTE_INVERSE 74 -#define MATRIXROW_PALETTE_INVTRANS 75 -#define MATRIXROW_PALETTE_TRANSPOSE 76 -#define MATRIXROW_PROGRAM 77 -#define MATRIXROW_PROGRAM_INVERSE 78 -#define MATRIXROW_PROGRAM_INVTRANS 79 -#define MATRIXROW_PROGRAM_TRANSPOSE 80 - -#define MATRIXROWS_MODELVIEW 81 -#define MATRIXROWS_MODELVIEW_INVERSE 82 -#define MATRIXROWS_MODELVIEW_INVTRANS 83 -#define MATRIXROWS_MODELVIEW_TRANSPOSE 84 -#define MATRIXROWS_PROJECTION 85 -#define MATRIXROWS_PROJECTION_INVERSE 86 -#define MATRIXROWS_PROJECTION_INVTRANS 87 -#define MATRIXROWS_PROJECTION_TRANSPOSE 88 -#define MATRIXROWS_MVP 89 -#define MATRIXROWS_MVP_INVERSE 90 -#define MATRIXROWS_MVP_INVTRANS 91 -#define MATRIXROWS_MVP_TRANSPOSE 92 -#define MATRIXROWS_TEXTURE 93 -#define MATRIXROWS_TEXTURE_INVERSE 94 -#define MATRIXROWS_TEXTURE_INVTRANS 95 -#define MATRIXROWS_TEXTURE_TRANSPOSE 96 -#define MATRIXROWS_PALETTE 97 -#define MATRIXROWS_PALETTE_INVERSE 98 -#define MATRIXROWS_PALETTE_INVTRANS 99 -#define MATRIXROWS_PALETTE_TRANSPOSE 100 -#define MATRIXROWS_PROGRAM 101 -#define MATRIXROWS_PROGRAM_INVERSE 102 -#define MATRIXROWS_PROGRAM_INVTRANS 103 -#define MATRIXROWS_PROGRAM_TRANSPOSE 104 - -#define PROGRAM_ENV_SINGLE 105 -#define PROGRAM_LOCAL_SINGLE 106 -#define PROGRAM_ENV_MULTI 107 -#define PROGRAM_LOCAL_MULTI 108 - -#define CONSTANT 109 - - - - -#define IS_WHITESPACE(c) (c == ' ') || (c == '\t') || (c == '\n') -#define IS_IDCHAR(c) ((c >= 'A') && (c <= 'Z')) || \ - ((c >= 'a') && (c <= 'z')) || \ - (c == '_') || (c == '$') -#define IS_DIGIT(c) (c >= '0') && (c <= '9') -#define IS_CD(c) (IS_DIGIT(c)) || (IS_IDCHAR(c)) - -#define ADV_TO_STATE(state) s->curr_state = state; s->curr_pos++; - -#define ADV_OR_FALLBACK(c, state) if (curr == c) { \ - ADV_TO_STATE(state); \ - } else {\ - if (IS_CD(curr)) { \ - ADV_TO_STATE(STATE_IDENT); \ - } else \ - s->curr_state = 1;\ - } - -#define FINISH(tok) *token = tok; s->start_pos = s->curr_pos; s->curr_state = STATE_BASE; return ARB_VP_SUCESS; -#define ADV_AND_FINISH(tok) *token = tok; s->start_pos = s->curr_pos+1; s->curr_pos++; \ - s->curr_state = STATE_BASE; return ARB_VP_SUCESS; - -#define FINISH_OR_FALLBACK(tok) if (IS_CD(curr)) {\ - ADV_TO_STATE(STATE_IDENT); \ - } else { \ - FINISH(tok)\ - } - -#define NO_KW {"", "", "", ""} -#define NULL2 NULL_TOKEN, NULL_TOKEN -#define NULL3 NULL_TOKEN, NULL2 -#define NULL4 NULL2, NULL2 - -/* This uglyness is the production table. See the prod_table struct definition for a description */ -prod_table ptab[] = { - {NT_PROGRAM_TOKEN, - {NT_OPTION_SEQUENCE_TOKEN, NT_STATEMENT_SEQUENCE_TOKEN, END_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_OPTION_SEQUENCE_TOKEN, {NT_OPTION_SEQUENCE2_TOKEN, NULL3}, NO_KW}, - {NT_OPTION_SEQUENCE2_TOKEN, {NT_OPTION_TOKEN, NT_OPTION_SEQUENCE2_TOKEN, NULL2}, NO_KW}, - {NT_OPTION_SEQUENCE2_TOKEN, {NULL4}, NO_KW}, - {NT_OPTION_TOKEN, {OPTION_TOKEN, ID_TOKEN, SEMICOLON_TOKEN, NULL_TOKEN}, NO_KW}, - - - /* 5: */ - {NT_STATEMENT_SEQUENCE_TOKEN, {NT_STATEMENT_SEQUENCE2_TOKEN, NULL3}, NO_KW}, - {NT_STATEMENT_SEQUENCE2_TOKEN, {NT_STATEMENT_TOKEN, NT_STATEMENT_SEQUENCE2_TOKEN, NULL2}, NO_KW}, - {NT_STATEMENT_SEQUENCE2_TOKEN, {NULL4}, NO_KW}, - {NT_STATEMENT_TOKEN, {NT_INSTRUCTION_TOKEN, SEMICOLON_TOKEN, NULL2}, NO_KW}, - {NT_STATEMENT_TOKEN, {NT_NAMING_STATEMENT_TOKEN, SEMICOLON_TOKEN, NULL2}, NO_KW}, - - /* 10: */ - {NT_INSTRUCTION_TOKEN, {NT_ARL_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_INSTRUCTION_TOKEN, {NT_VECTOROP_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_INSTRUCTION_TOKEN, {NT_SCALAROP_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_INSTRUCTION_TOKEN, {NT_BINSCOP_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_INSTRUCTION_TOKEN, {NT_BINOP_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - - /* 15: */ - {NT_INSTRUCTION_TOKEN, {NT_TRIOP_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_INSTRUCTION_TOKEN, {NT_SWZ_INSTRUCTION_TOKEN, NULL3}, NO_KW}, - {NT_ARL_INSTRUCTION_TOKEN, {ARL_TOKEN, NT_MASKED_ADDR_REG_TOKEN, - COMMA_TOKEN, NT_SCALAR_SRC_REG_TOKEN}, NO_KW}, - {NT_VECTOROP_INSTRUCTION_TOKEN, {NT_VECTOROP_TOKEN, NT_MASKED_DST_REG_TOKEN, COMMA_TOKEN, - NT_SWIZZLE_SRC_REG_TOKEN}, NO_KW}, - {NT_VECTOROP_TOKEN, {ABS_TOKEN, NULL3}, NO_KW}, - - /* 20: */ - {NT_VECTOROP_TOKEN, {FLR_TOKEN, NULL3}, NO_KW}, - {NT_VECTOROP_TOKEN, {FRC_TOKEN, NULL3}, NO_KW}, - {NT_VECTOROP_TOKEN, {LIT_TOKEN, NULL3}, NO_KW}, - {NT_VECTOROP_TOKEN, {MOV_TOKEN, NULL3}, NO_KW}, - {NT_SCALAROP_INSTRUCTION_TOKEN, {NT_SCALAROP_TOKEN, NT_MASKED_DST_REG_TOKEN, COMMA_TOKEN, - NT_SCALAR_SRC_REG_TOKEN}, NO_KW}, - - /* 25: */ - {NT_SCALAROP_TOKEN, {EX2_TOKEN, NULL3}, NO_KW}, - {NT_SCALAROP_TOKEN, {EXP_TOKEN, NULL3}, NO_KW}, - {NT_SCALAROP_TOKEN, {LG2_TOKEN, NULL3}, NO_KW}, - {NT_SCALAROP_TOKEN, {LOG_TOKEN, NULL3}, NO_KW}, - {NT_SCALAROP_TOKEN, {RCP_TOKEN, NULL3}, NO_KW}, - - /* 30: */ - {NT_SCALAROP_TOKEN, {RSQ_TOKEN, NULL3}, NO_KW}, - {NT_BINSCOP_INSTRUCTION_TOKEN, - {NT_BINSCOP_TOKEN, NT_MASKED_DST_REG_TOKEN, NT_BINSCOP_INSTRUCTION2_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_BINSCOP_INSTRUCTION2_TOKEN, - {COMMA_TOKEN, NT_SCALAR_SRC_REG_TOKEN, COMMA_TOKEN, - NT_SCALAR_SRC_REG_TOKEN}, NO_KW}, - {NT_BINSCOP_TOKEN, {POW_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_INSTRUCTION_TOKEN, - {NT_BINOP_TOKEN, NT_MASKED_DST_REG_TOKEN, NT_BINOP_INSTRUCTION2_TOKEN, - NULL_TOKEN}, NO_KW}, - - /* 35: */ - {NT_BINOP_INSTRUCTION2_TOKEN, - {COMMA_TOKEN, NT_SWIZZLE_SRC_REG_TOKEN, COMMA_TOKEN, - NT_SWIZZLE_SRC_REG_TOKEN}, NO_KW}, - {NT_BINOP_TOKEN, {ADD_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {DP3_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {DP4_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {DPH_TOKEN, NULL3}, NO_KW}, - - /* 40: */ - {NT_BINOP_TOKEN, {DST_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {MAX_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {MIN_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {MUL_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {SGE_TOKEN, NULL3}, NO_KW}, - - /* 45: */ - {NT_BINOP_TOKEN, {SLT_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {SUB_TOKEN, NULL3}, NO_KW}, - {NT_BINOP_TOKEN, {XPD_TOKEN, NULL3}, NO_KW}, - {NT_TRIOP_INSTRUCTION_TOKEN, - {NT_TRIOP_TOKEN, NT_MASKED_DST_REG_TOKEN, NT_TRIOP_INSTRUCTION2_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_TRIOP_INSTRUCTION2_TOKEN, - {COMMA_TOKEN, NT_SWIZZLE_SRC_REG_TOKEN, NT_TRIOP_INSTRUCTION3_TOKEN, - NULL_TOKEN}, NO_KW}, - - /* 50: */ - {NT_TRIOP_INSTRUCTION3_TOKEN, - {COMMA_TOKEN, NT_SWIZZLE_SRC_REG_TOKEN, COMMA_TOKEN, - NT_SWIZZLE_SRC_REG_TOKEN}, NO_KW}, - {NT_TRIOP_TOKEN, {MAD_TOKEN, NULL3}, NO_KW}, - {NT_SWZ_INSTRUCTION_TOKEN, - {SWZ_TOKEN, NT_MASKED_DST_REG_TOKEN, NT_SWZ_INSTRUCTION2_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_SWZ_INSTRUCTION2_TOKEN, - {COMMA_TOKEN, NT_SRC_REG_TOKEN, COMMA_TOKEN, NT_EXTENDED_SWIZZLE_TOKEN}, - NO_KW}, - {NT_SCALAR_SRC_REG_TOKEN, - {NT_OPTIONAL_SIGN_TOKEN, NT_SRC_REG_TOKEN, NT_SCALAR_SUFFIX_TOKEN, - NULL_TOKEN}, NO_KW}, - - /* 55 */ - {NT_SWIZZLE_SRC_REG_TOKEN, - {NT_OPTIONAL_SIGN_TOKEN, NT_SRC_REG_TOKEN, NT_SWIZZLE_SUFFIX_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_MASKED_DST_REG_TOKEN, - {NT_DST_REG_TOKEN, NT_OPTIONAL_MASK_TOKEN, NULL2}, NO_KW}, - {NT_MASKED_ADDR_REG_TOKEN, - {NT_ADDR_REG_TOKEN, NT_ADDR_WRITE_MASK_TOKEN, NULL2}, NO_KW}, - {NT_EXTENDED_SWIZZLE_TOKEN, - {NT_EXT_SWIZ_COMP_TOKEN, COMMA_TOKEN, NT_EXT_SWIZ_COMP_TOKEN, - NT_EXTENDED_SWIZZLE2_TOKEN}, NO_KW}, - {NT_EXTENDED_SWIZZLE2_TOKEN, - {COMMA_TOKEN, NT_EXT_SWIZ_COMP_TOKEN, COMMA_TOKEN, - NT_EXT_SWIZ_COMP_TOKEN}, NO_KW}, - - /* 60 */ - {NT_EXT_SWIZ_COMP_TOKEN,{NT_OPTIONAL_SIGN_TOKEN, NT_EXT_SWIZ_SEL_TOKEN, NULL2}, - NO_KW}, - {NT_EXT_SWIZ_SEL_TOKEN, {INTEGER_TOKEN, NULL3}, {"0", "", "", ""}}, - {NT_EXT_SWIZ_SEL_TOKEN, {INTEGER_TOKEN, NULL3}, {"1", "", "", ""}}, - {NT_EXT_SWIZ_SEL_TOKEN, {NT_COMPONENT_TOKEN, NULL3}, NO_KW}, - {NT_SRC_REG_TOKEN, {NT_VERTEX_ATTRIB_REG_TOKEN, NULL3}, NO_KW}, - - /* 65: */ - {NT_SRC_REG_TOKEN, {NT_TEMPORARY_REG_TOKEN, NULL3}, NO_KW}, - {NT_SRC_REG_TOKEN, {NT_PROG_PARAM_REG_TOKEN, NULL3}, NO_KW}, - {NT_DST_REG_TOKEN, {NT_TEMPORARY_REG_TOKEN, NULL3}, NO_KW}, - {NT_DST_REG_TOKEN, {NT_VERTEX_RESULT_REG_TOKEN, NULL3}, NO_KW}, - {NT_VERTEX_ATTRIB_REG_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - - /* 70: */ - {NT_VERTEX_ATTRIB_REG_TOKEN, {NT_VTX_ATTRIB_BINDING_TOKEN, NULL3}, NO_KW}, - {NT_TEMPORARY_REG_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - {NT_PROG_PARAM_REG_TOKEN, {NT_PROG_PARAM_SINGLE_TOKEN, NULL3}, NO_KW}, - {NT_PROG_PARAM_REG_TOKEN, - {NT_PROG_PARAM_ARRAY_TOKEN, LBRACKET_TOKEN, NT_PROG_PARAM_ARRAY_MEM_TOKEN, - RBRACKET_TOKEN}, NO_KW}, - {NT_PROG_PARAM_REG_TOKEN, {NT_PARAM_SINGLE_ITEM_USE_TOKEN, NULL3}, NO_KW}, - - /* 75: */ - {NT_PROG_PARAM_SINGLE_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - {NT_PROG_PARAM_ARRAY_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - {NT_PROG_PARAM_ARRAY_MEM_TOKEN, {NT_PROG_PARAM_ARRAY_ABS_TOKEN, NULL3}, NO_KW}, - {NT_PROG_PARAM_ARRAY_MEM_TOKEN, {NT_PROG_PARAM_ARRAY_REL_TOKEN, NULL3}, NO_KW}, - /* -1 matches all */ - {NT_PROG_PARAM_ARRAY_ABS_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - - - /* 80: */ - {NT_PROG_PARAM_ARRAY_REL_TOKEN, - {NT_ADDR_REG_TOKEN, NT_ADDR_COMPONENT_TOKEN, NT_ADDR_REG_REL_OFFSET_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_ADDR_REG_REL_OFFSET_TOKEN, {NULL4}, NO_KW}, - {NT_ADDR_REG_REL_OFFSET_TOKEN, - {PLUS_TOKEN, NT_ADDR_REG_POS_OFFSET_TOKEN, NULL2}, NO_KW}, - {NT_ADDR_REG_REL_OFFSET_TOKEN, - {MINUS_TOKEN, NT_ADDR_REG_NEG_OFFSET_TOKEN, NULL2}, NO_KW}, - {NT_ADDR_REG_POS_OFFSET_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - - /* 85: */ - {NT_ADDR_REG_NEG_OFFSET_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_VERTEX_RESULT_REG_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - {NT_VERTEX_RESULT_REG_TOKEN, {NT_RESULT_BINDING_TOKEN, NULL3}, NO_KW}, - {NT_ADDR_REG_TOKEN, {NT_ESTABLISHED_NAME_TOKEN, NULL3}, NO_KW}, - {NT_ADDR_COMPONENT_TOKEN, {PERIOD_TOKEN, ID_TOKEN, NULL2}, {"", "x", "", ""}}, - - /* 90: */ - {NT_ADDR_WRITE_MASK_TOKEN, {PERIOD_TOKEN, ID_TOKEN, NULL2}, {"", "x", "", ""}}, - {NT_SCALAR_SUFFIX_TOKEN, {PERIOD_TOKEN, NT_COMPONENT_TOKEN, NULL2}, {"", "x", "", ""}}, - {NT_SWIZZLE_SUFFIX_TOKEN, {NULL4}, NO_KW}, - {NT_COMPONENT_TOKEN, {ID_TOKEN, NULL3}, {"x", "", "", ""}}, - {NT_COMPONENT_TOKEN, {ID_TOKEN, NULL3}, {"y", "", "", ""}}, - - /* 95: */ - {NT_COMPONENT_TOKEN, {ID_TOKEN, NULL3}, {"z", "", "", ""}}, - {NT_COMPONENT_TOKEN, {ID_TOKEN, NULL3}, {"w", "", "", ""}}, - {NT_OPTIONAL_MASK_TOKEN, {PERIOD_TOKEN, NT_OPTIONAL_MASK2_TOKEN, NULL2}, NO_KW}, - {NT_OPTIONAL_MASK_TOKEN, {NULL4}, NO_KW}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"x", "", "", ""}}, - - /* 100: */ - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"y", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xy", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"z", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xz", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"yz", "", "", ""}}, - - /* 105: */ - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xyz", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"w", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xw", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"yw", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xyw", "", "", ""}}, - - /* 110: */ - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"zw", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xzw", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"yzw", "", "", ""}}, - {NT_OPTIONAL_MASK2_TOKEN, {ID_TOKEN, NULL3}, {"xyzw", "", "", ""}}, - {NT_NAMING_STATEMENT_TOKEN, {NT_ATTRIB_STATEMENT_TOKEN, NULL3}, NO_KW}, - - /* 115: */ - {NT_NAMING_STATEMENT_TOKEN, {NT_PARAM_STATEMENT_TOKEN, NULL3}, NO_KW}, - {NT_NAMING_STATEMENT_TOKEN, {NT_TEMP_STATEMENT_TOKEN, NULL3}, NO_KW}, - {NT_NAMING_STATEMENT_TOKEN, {NT_ADDRESS_STATEMENT_TOKEN, NULL3}, NO_KW}, - {NT_NAMING_STATEMENT_TOKEN, {NT_OUTPUT_STATEMENT_TOKEN, NULL3}, NO_KW}, - {NT_NAMING_STATEMENT_TOKEN, {NT_ALIAS_STATEMENT_TOKEN, NULL3}, NO_KW}, - - /* 120: */ - {NT_ATTRIB_STATEMENT_TOKEN, - {ATTRIB_TOKEN, NT_ESTABLISH_NAME_TOKEN, EQUAL_TOKEN, NT_VTX_ATTRIB_BINDING_TOKEN}, NO_KW}, - {NT_VTX_ATTRIB_BINDING_TOKEN, - {VERTEX_TOKEN, PERIOD_TOKEN, NT_VTX_ATTRIB_ITEM_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NULL3}, {"position", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NT_VTX_OPT_WEIGHT_NUM_TOKEN, NULL2},{"weight", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NULL3}, {"normal", "", "", ""}}, - - /* 125: */ - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NT_OPT_COLOR_TYPE_TOKEN, NULL2}, - {"color", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NULL3}, {"fogcoord", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, {ID_TOKEN, NT_OPT_TEX_COORD_NUM_TOKEN, NULL2}, - {"texcoord", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_VTX_WEIGHT_NUM_TOKEN, RBRACKET_TOKEN}, - {"matrixindex", "", "", ""}}, - {NT_VTX_ATTRIB_ITEM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_VTX_ATTRIB_NUM_TOKEN, RBRACKET_TOKEN}, - {"attrib", "", "", ""}}, - - /* 130: */ - {NT_VTX_ATTRIB_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, {NULL4}, NO_KW}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, {LBRACKET_TOKEN, NT_VTX_WEIGHT_NUM_TOKEN, RBRACKET_TOKEN, NULL_TOKEN}, - NO_KW}, - {NT_VTX_WEIGHT_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PARAM_STATEMENT_TOKEN, - {PARAM_TOKEN, NT_ESTABLISH_NAME_TOKEN, NT_PARAM_STATEMENT2_TOKEN, - NULL_TOKEN}, NO_KW}, - - /* 135: */ - {NT_PARAM_STATEMENT2_TOKEN, {NT_PARAM_SINGLE_INIT_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_STATEMENT2_TOKEN, {LBRACKET_TOKEN, NT_OPT_ARRAY_SIZE_TOKEN, RBRACKET_TOKEN, - NT_PARAM_MULTIPLE_INIT_TOKEN}, NO_KW}, - {NT_OPT_ARRAY_SIZE_TOKEN, {NULL4}, NO_KW}, - {NT_OPT_ARRAY_SIZE_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PARAM_SINGLE_INIT_TOKEN, {EQUAL_TOKEN, NT_PARAM_SINGLE_ITEM_DECL_TOKEN, NULL2}, - NO_KW}, - - - /* 140: */ - {NT_PARAM_MULTIPLE_INIT_TOKEN, - {EQUAL_TOKEN, LBRACE_TOKEN, NT_PARAM_MULT_INIT_LIST_TOKEN, RBRACE_TOKEN}, - NO_KW}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, NT_PARAM_MULT_INIT_LIST2_TOKEN, NULL2}, - NO_KW}, - {NT_PARAM_MULT_INIT_LIST2_TOKEN, - {COMMA_TOKEN, NT_PARAM_MULT_INIT_LIST_TOKEN, NULL2}, - NO_KW}, - {NT_PARAM_MULT_INIT_LIST2_TOKEN, {NULL4}, NO_KW}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, {NT_STATE_SINGLE_ITEM_TOKEN, NULL3}, - NO_KW}, - - /* 145: */ - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, {NT_PROGRAM_SINGLE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, {NT_PARAM_CONST_DECL_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, {NT_STATE_SINGLE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, {NT_PROGRAM_SINGLE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, {NT_PARAM_CONST_USE_TOKEN, NULL3}, NO_KW}, - - /* 150: */ - {NT_PARAM_MULTIPLE_ITEM_TOKEN, {NT_STATE_MULTIPLE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, {NT_PROGRAM_MULTIPLE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, {NT_PARAM_CONST_DECL_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM_TOKEN, - {STATE_TOKEN, PERIOD_TOKEN, NT_STATE_MULTIPLE_ITEM2_TOKEN, NULL_TOKEN}, - NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_MATERIAL_ITEM_TOKEN, NULL3}, NO_KW}, - - /* 155: */ - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_LIGHT_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_LIGHT_MODEL_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_LIGHT_PROD_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_TEX_GEN_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_FOG_ITEM_TOKEN, NULL3}, NO_KW}, - - /* 160: */ - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_CLIP_PLANE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, {NT_STATE_POINT_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, - {ID_TOKEN, PERIOD_TOKEN, NT_STATE_MATRIX_NAME_TOKEN, NT_FOO_TOKEN}, - {"matrix", "", "", ""}}, - {NT_FOO_TOKEN, {PERIOD_TOKEN, NT_FOO2_TOKEN, NULL2}, NO_KW}, - {NT_FOO2_TOKEN, {NT_STATE_MAT_MODIFIER_TOKEN, NT_FOO3_TOKEN, NULL2}, NO_KW}, - - /* 165: */ - {NT_FOO2_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, NT_STATE_MATRIX_ROW_NUM_TOKEN, NT_FOO4_TOKEN}, - {"row", "", "", ""}}, - {NT_FOO3_TOKEN, {NULL4}, NO_KW}, - {NT_FOO3_TOKEN, {PERIOD_TOKEN, ID_TOKEN, LBRACKET_TOKEN, NT_FOO35_TOKEN}, - {"", "row", "", ""}}, - {NT_FOO35_TOKEN, {NT_STATE_MATRIX_ROW_NUM_TOKEN, NT_FOO4_TOKEN, NULL2}, - NO_KW}, - {NT_FOO4_TOKEN, {RBRACKET_TOKEN, NULL3}, NO_KW}, - - /* 170: */ - {NT_FOO4_TOKEN, {DOTDOT_TOKEN, NT_STATE_MATRIX_ROW_NUM_TOKEN, RBRACKET_TOKEN, NULL_TOKEN}, - NO_KW}, - {NT_STATE_SINGLE_ITEM_TOKEN, - {STATE_TOKEN, PERIOD_TOKEN, NT_STATE_SINGLE_ITEM2_TOKEN, NULL_TOKEN}, - NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_MATERIAL_ITEM_TOKEN, NULL3}, - NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_LIGHT_ITEM_TOKEN, NULL3}, - NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_LIGHT_MODEL_ITEM_TOKEN, NULL3}, - NO_KW}, - - /* 175: */ - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_LIGHT_PROD_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_TEX_GEN_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_FOG_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_CLIP_PLANE_ITEM_TOKEN, NULL3}, NO_KW}, - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_POINT_ITEM_TOKEN, NULL3}, NO_KW}, - - /* 180: */ - {NT_STATE_SINGLE_ITEM2_TOKEN, {NT_STATE_MATRIX_ROW_TOKEN, NULL3}, NO_KW}, - {NT_STATE_MATERIAL_ITEM_TOKEN, - {ID_TOKEN, PERIOD_TOKEN, NT_STATE_MATERIAL_ITEM2_TOKEN, NULL_TOKEN}, - {"material", "", "", ""}}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, {NT_STATE_MAT_PROPERTY_TOKEN, NULL3}, - NO_KW}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, - {PERIOD_TOKEN, NT_OPT_FACE_TYPE2_TOKEN, PERIOD_TOKEN, - NT_STATE_MAT_PROPERTY_TOKEN}, NO_KW}, - {NT_STATE_MAT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"ambient", "", "", ""}}, - - /* 185 */ - {NT_STATE_MAT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"diffuse", "", "", ""}}, - {NT_STATE_MAT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"specular", "", "", ""}}, - {NT_STATE_MAT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"emission", "", "", ""}}, - {NT_STATE_MAT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"shininess", "", "", ""}}, - {NT_STATE_LIGHT_ITEM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_STATE_LIGHT_NUMBER_TOKEN, - NT_STATE_LIGHT_ITEM2_TOKEN}, {"light", "", "", ""}}, - - /* 190: */ - {NT_STATE_LIGHT_ITEM2_TOKEN, {RBRACKET_TOKEN, PERIOD_TOKEN, NT_STATE_LIGHT_PROPERTY_TOKEN, NULL_TOKEN}, - NO_KW}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"ambient", "", "", ""}}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"diffuse", "", "", ""}}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"specular", "", "", ""}}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"position", "", "", ""}}, - - /* 195: */ - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"attenuation", "", "", ""}}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, - {ID_TOKEN, PERIOD_TOKEN, NT_STATE_SPOT_PROPERTY_TOKEN, NULL_TOKEN}, - {"spot", "", "", ""}}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"half", "", "", ""}}, - {NT_STATE_SPOT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"direction", "", "", ""}}, - {NT_STATE_LIGHT_MODEL_ITEM_TOKEN, - {ID_TOKEN, NT_STATE_LMOD_PROPERTY_TOKEN, NULL2}, {"lightmodel", "", "", ""}}, - - /* 200: */ - {NT_STATE_LMOD_PROPERTY_TOKEN, {PERIOD_TOKEN, NT_STATE_LMOD_PROPERTY2_TOKEN, NULL2}, NO_KW}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, {ID_TOKEN, NULL3}, {"ambient", "", "", ""}}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, {ID_TOKEN, NULL3}, {"scenecolor", "", "", ""}}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, - {NT_OPT_FACE_TYPE2_TOKEN, PERIOD_TOKEN, ID_TOKEN, NULL_TOKEN}, - {"scenecolor", "", "", ""}}, - {NT_STATE_LIGHT_PROD_ITEM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_STATE_LIGHT_NUMBER_TOKEN, - NT_STATE_LIGHT_PROD_ITEM15_TOKEN}, {"lightprod", "", "", ""}}, - - /* 205: */ - {NT_STATE_LIGHT_PROD_ITEM15_TOKEN, - {RBRACKET_TOKEN, PERIOD_TOKEN, NT_STATE_LIGHT_PROD_ITEM2_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, {NT_STATE_LPROD_PROPERTY_TOKEN, NULL3}, NO_KW}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, - {NT_OPT_FACE_TYPE2_TOKEN, PERIOD_TOKEN, NT_STATE_LPROD_PROPERTY_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_STATE_LPROD_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"diffuse", "", "", ""}}, - {NT_STATE_LPROD_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"ambient", "", "", ""}}, - - /* 210: */ - {NT_STATE_LPROD_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"specular", "", "", ""}}, - {NT_STATE_LIGHT_NUMBER_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_STATE_TEX_GEN_ITEM_TOKEN, {ID_TOKEN, NT_OPT_TEX_COORD_NUM_TOKEN, - NT_STATE_TEX_GEN_ITEM2_TOKEN, NULL_TOKEN}, {"texgen", "", "", ""}}, - {NT_STATE_TEX_GEN_ITEM2_TOKEN,{PERIOD_TOKEN, NT_STATE_TEX_GEN_TYPE_TOKEN, PERIOD_TOKEN, - NT_STATE_TEX_GEN_COORD_TOKEN}, NO_KW}, - {NT_STATE_TEX_GEN_TYPE_TOKEN, {ID_TOKEN, NULL3}, {"eye", "", "", ""}}, - - /* 215: */ - {NT_STATE_TEX_GEN_TYPE_TOKEN, {ID_TOKEN, NULL3}, {"object", "", "", ""}}, - {NT_STATE_TEX_GEN_COORD_TOKEN, {ID_TOKEN, NULL3}, {"s", "", "", ""}}, - {NT_STATE_TEX_GEN_COORD_TOKEN, {ID_TOKEN, NULL3}, {"t", "", "", ""}}, - {NT_STATE_TEX_GEN_COORD_TOKEN, {ID_TOKEN, NULL3}, {"r", "", "", ""}}, - {NT_STATE_TEX_GEN_COORD_TOKEN, {ID_TOKEN, NULL3}, {"q", "", "", ""}}, - - /* 220: */ - {NT_STATE_FOG_ITEM_TOKEN, {ID_TOKEN, PERIOD_TOKEN, NT_STATE_FOG_PROPERTY_TOKEN, NULL_TOKEN}, - {"fog", "","",""}}, - {NT_STATE_FOG_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"color", "", "", ""}}, - {NT_STATE_FOG_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"params", "", "", ""}}, - {NT_STATE_CLIP_PLANE_ITEM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_STATE_CLIP_PLANE_NUM_TOKEN, - NT_STATE_CLIP_PLANE_ITEM2_TOKEN}, {"clip", "", "", ""}}, - {NT_STATE_CLIP_PLANE_ITEM2_TOKEN, - {RBRACKET_TOKEN, PERIOD_TOKEN, ID_TOKEN, NULL_TOKEN}, - {"", "", "plane", ""}}, - - /* 225: */ - {NT_STATE_CLIP_PLANE_NUM_TOKEN,{INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_STATE_POINT_ITEM_TOKEN, {ID_TOKEN, PERIOD_TOKEN, NT_STATE_POINT_PROPERTY_TOKEN, NULL_TOKEN}, - {"point", "", "", ""}}, - {NT_STATE_POINT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"size", "", "", ""}}, - {NT_STATE_POINT_PROPERTY_TOKEN, {ID_TOKEN, NULL3}, {"attenuation", "", "", ""}}, - {NT_STATE_MATRIX_ROW_TOKEN, {ID_TOKEN, PERIOD_TOKEN, NT_STATE_MATRIX_NAME_TOKEN, - NT_STATE_MATRIX_ROW15_TOKEN}, {"matrix", "", "", ""}}, - - /* 230: */ - {NT_STATE_MATRIX_ROW15_TOKEN, {PERIOD_TOKEN, NT_STATE_MATRIX_ROW2_TOKEN, NULL2}, NO_KW}, - {NT_STATE_MATRIX_ROW2_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, - NT_STATE_MATRIX_ROW_NUM_TOKEN, RBRACKET_TOKEN}, - {"row", "", "", ""}}, - {NT_STATE_MATRIX_ROW2_TOKEN, {NT_STATE_MAT_MODIFIER_TOKEN, PERIOD_TOKEN, ID_TOKEN, - NT_STATE_MATRIX_ROW3_TOKEN}, - {"", "", "row", ""}}, - {NT_STATE_MATRIX_ROW3_TOKEN, {LBRACKET_TOKEN, NT_STATE_MATRIX_ROW_NUM_TOKEN, RBRACKET_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_STATE_MAT_MODIFIER_TOKEN, {ID_TOKEN, NULL3}, {"inverse", "", "", ""}}, - - /* 235: */ - {NT_STATE_MAT_MODIFIER_TOKEN, {ID_TOKEN, NULL3}, {"transpose", "", "", ""}}, - {NT_STATE_MAT_MODIFIER_TOKEN, {ID_TOKEN, NULL3}, {"invtrans", "", "", ""}}, - {NT_STATE_MATRIX_ROW_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_STATE_MATRIX_NAME_TOKEN, {ID_TOKEN, NT_STATE_OPT_MOD_MAT_NUM_TOKEN, NULL2}, - {"modelview", "", "", ""}}, - {NT_STATE_MATRIX_NAME_TOKEN, {ID_TOKEN, NULL3}, {"projection", "", "", ""}}, - - /* 240: */ - {NT_STATE_MATRIX_NAME_TOKEN, {ID_TOKEN, NULL3}, {"mvp", "", "", ""}}, - {NT_STATE_MATRIX_NAME_TOKEN, {ID_TOKEN, NT_OPT_TEX_COORD_NUM_TOKEN, NULL2}, - {"texture", "", "", ""}}, - {NT_STATE_MATRIX_NAME_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, NT_STATE_PALETTE_MAT_NUM_TOKEN, - RBRACKET_TOKEN}, {"palette", "", "", ""}}, - {NT_STATE_MATRIX_NAME_TOKEN, {PROGRAM_TOKEN, LBRACKET_TOKEN, NT_STATE_PROGRAM_MAT_NUM_TOKEN, - RBRACKET_TOKEN}, NO_KW}, - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, {NULL4}, NO_KW}, - - /* 245: */ - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, - {LBRACKET_TOKEN, NT_STATE_MOD_MAT_NUM_TOKEN, RBRACKET_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_STATE_MOD_MAT_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_STATE_PALETTE_MAT_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_STATE_PROGRAM_MAT_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PROGRAM_SINGLE_ITEM_TOKEN, - {PROGRAM_TOKEN, PERIOD_TOKEN, NT_PROGRAM_SINGLE_ITEM2_TOKEN, NULL_TOKEN}, NO_KW}, - - /* 250: */ - {NT_PROGRAM_SINGLE_ITEM2_TOKEN, {NT_PROG_ENV_PARAM_TOKEN, NULL3}, NO_KW}, - {NT_PROGRAM_SINGLE_ITEM2_TOKEN, {NT_PROG_LOCAL_PARAM_TOKEN, NULL3}, NO_KW}, - {NT_PROGRAM_MULTIPLE_ITEM_TOKEN, - {PROGRAM_TOKEN, PERIOD_TOKEN, NT_PROGRAM_MULTIPLE_ITEM2_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN, {NT_PROG_ENV_PARAMS_TOKEN, NULL3}, NO_KW}, - {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN, {NT_PROG_LOCAL_PARAMS_TOKEN, NULL3}, NO_KW}, - - /* 255: */ - {NT_PROG_ENV_PARAMS_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, NT_PROG_ENV_PARAM_NUMS_TOKEN, RBRACKET_TOKEN}, - {"env", "", "", ""}}, - {NT_PROG_ENV_PARAM_NUMS_TOKEN, {NT_PROG_ENV_PARAM_NUM_TOKEN, NT_PROG_ENV_PARAM_NUMS2_TOKEN, NULL2}, - NO_KW}, - {NT_PROG_ENV_PARAM_NUMS2_TOKEN, {DOTDOT_TOKEN, NT_PROG_ENV_PARAM_NUM_TOKEN, NULL2}, NO_KW}, - {NT_PROG_ENV_PARAM_NUMS2_TOKEN, {NULL4}, NO_KW}, - {NT_PROG_ENV_PARAM_TOKEN, - {ID_TOKEN, LBRACKET_TOKEN, NT_PROG_ENV_PARAM_NUM_TOKEN, RBRACKET_TOKEN}, - {"env", "", "", ""}}, - - /* 260: */ - {NT_PROG_LOCAL_PARAMS_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, NT_PROG_LOCAL_PARAM_NUMS_TOKEN, - RBRACKET_TOKEN}, {"local", "", "", ""}}, - {NT_PROG_LOCAL_PARAM_NUMS_TOKEN, - {NT_PROG_LOCAL_PARAM_NUM_TOKEN, NT_PROG_LOCAL_PARAM_NUMS2_TOKEN, NULL2}, - NO_KW}, - {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN, {DOTDOT_TOKEN, NT_PROG_LOCAL_PARAM_NUM_TOKEN, NULL2}, NO_KW}, - {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN, {NULL4}, NO_KW}, - {NT_PROG_LOCAL_PARAM_TOKEN, {ID_TOKEN, LBRACKET_TOKEN, NT_PROG_LOCAL_PARAM_NUM_TOKEN, RBRACKET_TOKEN}, - {"local", "", "", ""}}, - - /* 265: */ - {NT_PROG_ENV_PARAM_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PROG_LOCAL_PARAM_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PARAM_CONST_DECL_TOKEN, {NT_PARAM_CONST_SCALAR_DECL_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_DECL_TOKEN, {NT_PARAM_CONST_VECTOR_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_USE_TOKEN, {NT_PARAM_CONST_SCALAR_USE_TOKEN, NULL3}, NO_KW}, - - /* 270: */ - {NT_PARAM_CONST_USE_TOKEN, {NT_PARAM_CONST_VECTOR_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_SCALAR_DECL_TOKEN, {NT_SIGNED_FLOAT_CONSTANT_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_SCALAR_USE_TOKEN, {FLOAT_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_PARAM_CONST_VECTOR_TOKEN, {LBRACE_TOKEN, NT_SIGNED_FLOAT_CONSTANT_TOKEN, - NT_PARAM_CONST_VECTOR2_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_PARAM_CONST_VECTOR2_TOKEN,{RBRACE_TOKEN, NULL3}, NO_KW}, - - /* 275: */ - {NT_PARAM_CONST_VECTOR2_TOKEN, {COMMA_TOKEN, NT_SIGNED_FLOAT_CONSTANT_TOKEN, - NT_PARAM_CONST_VECTOR3_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_PARAM_CONST_VECTOR3_TOKEN, {RBRACE_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_VECTOR3_TOKEN, {COMMA_TOKEN, NT_SIGNED_FLOAT_CONSTANT_TOKEN, - NT_PARAM_CONST_VECTOR4_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_PARAM_CONST_VECTOR4_TOKEN, {RBRACE_TOKEN, NULL3}, NO_KW}, - {NT_PARAM_CONST_VECTOR4_TOKEN, {COMMA_TOKEN, NT_SIGNED_FLOAT_CONSTANT_TOKEN, - RBRACE_TOKEN, NULL_TOKEN}, NO_KW}, - - /* 280: */ - {NT_SIGNED_FLOAT_CONSTANT_TOKEN, {NT_OPTIONAL_SIGN_TOKEN, FLOAT_TOKEN, NULL2}, - {"", "-1", "", ""}}, - {NT_OPTIONAL_SIGN_TOKEN, {NULL4}, NO_KW}, - {NT_OPTIONAL_SIGN_TOKEN, {MINUS_TOKEN, NULL3}, NO_KW}, - {NT_OPTIONAL_SIGN_TOKEN, {PLUS_TOKEN, NULL3}, NO_KW}, - {NT_TEMP_STATEMENT_TOKEN, {TEMP_TOKEN, NT_VAR_NAME_LIST_TOKEN, NULL2}, - NO_KW}, - - /* 285: */ - {NT_ADDRESS_STATEMENT_TOKEN, {ADDRESS_TOKEN, NT_VAR_NAME_LIST_TOKEN, NULL2}, NO_KW}, - {NT_VAR_NAME_LIST_TOKEN, {NT_ESTABLISH_NAME_TOKEN, NULL3}, NO_KW}, - {NT_VAR_NAME_LIST_TOKEN, {NT_ESTABLISH_NAME_TOKEN, COMMA_TOKEN, NT_VAR_NAME_LIST_TOKEN, - NULL_TOKEN}, NO_KW}, - {NT_OUTPUT_STATEMENT_TOKEN, {OUTPUT_TOKEN, NT_ESTABLISH_NAME_TOKEN, EQUAL_TOKEN, - NT_RESULT_BINDING_TOKEN}, NO_KW}, - {NT_RESULT_BINDING_TOKEN, {RESULT_TOKEN, PERIOD_TOKEN, NT_RESULT_BINDING2_TOKEN, NULL_TOKEN}, - NO_KW}, - - /* 290: */ - {NT_RESULT_BINDING2_TOKEN, {ID_TOKEN, NULL3}, {"position", "", "", ""}}, - {NT_RESULT_BINDING2_TOKEN, {ID_TOKEN, NULL3}, {"fogcoord", "", "", ""}}, - {NT_RESULT_BINDING2_TOKEN, {ID_TOKEN, NULL3}, {"pointsize", "", "", ""}}, - {NT_RESULT_BINDING2_TOKEN, {NT_RESULT_COL_BINDING_TOKEN, NULL3}, NO_KW}, - {NT_RESULT_BINDING2_TOKEN, {ID_TOKEN, NT_OPT_TEX_COORD_NUM_TOKEN, NULL2}, - {"texcoord", "", "", ""}}, - - /* 295: */ - {NT_RESULT_COL_BINDING_TOKEN, {ID_TOKEN, NT_RESULT_COL_BINDING2_TOKEN, NULL2}, {"color", "", "", ""}}, - {NT_RESULT_COL_BINDING2_TOKEN, {NULL4}, NO_KW}, - {NT_RESULT_COL_BINDING2_TOKEN, {PERIOD_TOKEN, NT_RESULT_COL_BINDING3_TOKEN, NULL2}, NO_KW}, - {NT_RESULT_COL_BINDING3_TOKEN, {ID_TOKEN, NT_RESULT_COL_BINDING4_TOKEN, NULL2}, {"front", "", "", ""}}, - {NT_RESULT_COL_BINDING3_TOKEN, {ID_TOKEN, NT_RESULT_COL_BINDING4_TOKEN, NULL2}, {"back", "", "", ""}}, - - /* 300: */ - {NT_RESULT_COL_BINDING4_TOKEN, {NULL4}, NO_KW}, - {NT_RESULT_COL_BINDING4_TOKEN, {PERIOD_TOKEN, NT_RESULT_COL_BINDING5_TOKEN, NULL2}, NO_KW}, - {NT_RESULT_COL_BINDING5_TOKEN, {ID_TOKEN, NULL3}, {"primary", "", "", ""}}, - {NT_RESULT_COL_BINDING5_TOKEN, {ID_TOKEN, NULL3}, {"secondary", "", "", ""}}, - {NT_OPT_FACE_TYPE2_TOKEN, {ID_TOKEN, NULL3}, {"front", "", "", ""}}, - - /* 305: */ - {NT_OPT_FACE_TYPE2_TOKEN, {ID_TOKEN, NULL3}, {"back", "", "", ""}}, - {NT_OPT_COLOR_TYPE_TOKEN, {PERIOD_TOKEN, NT_OPT_COLOR_TYPE2_TOKEN, NULL2}, NO_KW}, - {NT_OPT_COLOR_TYPE_TOKEN, {NULL4}, NO_KW}, - {NT_OPT_COLOR_TYPE2_TOKEN, {ID_TOKEN, NULL3}, {"primary", "", "", ""}}, - {NT_OPT_COLOR_TYPE2_TOKEN, {ID_TOKEN, NULL3}, {"secondary", "", "", ""}}, - - /* 310: */ - {NT_OPT_TEX_COORD_NUM_TOKEN, {NULL4}, NO_KW}, - {NT_OPT_TEX_COORD_NUM_TOKEN, - {LBRACKET_TOKEN, NT_TEX_COORD_NUM_TOKEN, RBRACKET_TOKEN, NULL_TOKEN}, NO_KW}, - {NT_TEX_COORD_NUM_TOKEN, {INTEGER_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_ALIAS_STATEMENT_TOKEN, {ALIAS_TOKEN, NT_ESTABLISH_NAME_TOKEN, EQUAL_TOKEN, - NT_ESTABLISHED_NAME_TOKEN}, NO_KW}, - {NT_ESTABLISH_NAME_TOKEN, {ID_TOKEN, NULL3}, {"-1", "", "", ""}}, - - /* 315: */ - {NT_ESTABLISHED_NAME_TOKEN, {ID_TOKEN, NULL3}, {"-1", "", "", ""}}, - {NT_FOO_TOKEN, {NULL4}, NO_KW}, - {NT_SWIZZLE_SUFFIX_TOKEN, {PERIOD_TOKEN, NT_SWIZZLE_SUFFIX2_TOKEN, NULL2}, - NO_KW}, - {NT_SWIZZLE_SUFFIX2_TOKEN, {NT_COMPONENT_TOKEN, NULL3}, NO_KW}, - {NT_SWIZZLE_SUFFIX2_TOKEN, {NT_COMPONENT4_TOKEN, NULL3}, NO_KW}, -}; - -/* This is the look ahead table. See the look_ahead_table struct def for a description */ -look_ahead_table latab[] = { - {NT_PROGRAM_TOKEN, ABS_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, ADD_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, ADDRESS_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, ALIAS_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, ARL_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, ATTRIB_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, DP3_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, DP4_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, DPH_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, DST_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, END_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, EOF_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, EX2_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, EXP_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, FLR_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, FRC_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, LIT_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, LG2_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, LOG_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, MAD_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, MAX_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, MIN_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, MOV_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, MUL_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, OPTION_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, OUTPUT_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, PARAM_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, POW_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, RCP_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, RSQ_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, SGE_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, SLT_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, SUB_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, SWZ_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, XPD_TOKEN, "", 0}, - {NT_PROGRAM_TOKEN, TEMP_TOKEN, "", 0}, - - {NT_OPTION_SEQUENCE_TOKEN, ABS_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, ADD_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, ADDRESS_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, ALIAS_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, ARL_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, ATTRIB_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, DP3_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, DP4_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, DPH_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, DST_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, END_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, EX2_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, EXP_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, FLR_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, FRC_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, LIT_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, LG2_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, LOG_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, MAD_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, MAX_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, MIN_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, MOV_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, MUL_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, OPTION_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, OUTPUT_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, PARAM_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, POW_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, RCP_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, RSQ_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, SGE_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, SLT_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, SUB_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, SWZ_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, XPD_TOKEN, "", 1}, - {NT_OPTION_SEQUENCE_TOKEN, TEMP_TOKEN, "", 1}, - - {NT_OPTION_SEQUENCE2_TOKEN, OPTION_TOKEN, "", 2}, - - {NT_OPTION_SEQUENCE2_TOKEN, ABS_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, ADD_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, ADDRESS_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, ALIAS_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, ARL_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, ATTRIB_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, DP3_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, DP4_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, DPH_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, DST_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, END_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, EX2_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, EXP_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, FLR_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, FRC_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, LIT_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, LG2_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, LOG_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, MAD_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, MAX_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, MIN_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, MOV_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, MUL_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, OUTPUT_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, PARAM_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, POW_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, RCP_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, RSQ_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, SGE_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, SLT_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, SUB_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, SWZ_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, XPD_TOKEN, "", 3}, - {NT_OPTION_SEQUENCE2_TOKEN, TEMP_TOKEN, "", 3}, - - {NT_OPTION_TOKEN, OPTION_TOKEN, "", 4}, - - {NT_STATEMENT_SEQUENCE_TOKEN, ABS_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, ADD_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, ADDRESS_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, ALIAS_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, ARL_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, ATTRIB_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, DP3_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, DP4_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, DPH_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, DST_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, END_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, EX2_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, EXP_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, FLR_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, FRC_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, LIT_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, LG2_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, LOG_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, MAD_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, MAX_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, MIN_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, MOV_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, MUL_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, OUTPUT_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, PARAM_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, POW_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, RCP_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, RSQ_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, SGE_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, SLT_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, SUB_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, SWZ_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, XPD_TOKEN, "", 5}, - {NT_STATEMENT_SEQUENCE_TOKEN, TEMP_TOKEN, "", 5}, - - {NT_STATEMENT_SEQUENCE2_TOKEN, ABS_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, ADD_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, ADDRESS_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, ALIAS_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, ARL_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, ATTRIB_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, DP3_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, DP4_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, DPH_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, DST_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, EX2_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, EXP_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, FLR_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, FRC_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, LIT_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, LG2_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, LOG_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, MAD_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, MAX_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, MIN_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, MOV_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, MUL_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, OUTPUT_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, PARAM_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, POW_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, RCP_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, RSQ_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, SGE_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, SLT_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, SUB_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, SWZ_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, XPD_TOKEN, "", 6}, - {NT_STATEMENT_SEQUENCE2_TOKEN, TEMP_TOKEN, "", 6}, - - {NT_STATEMENT_SEQUENCE2_TOKEN, END_TOKEN, "", 7}, - - - {NT_STATEMENT_TOKEN, ABS_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, ADD_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, ARL_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, DP3_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, DP4_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, DPH_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, DST_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, EX2_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, EXP_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, FLR_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, FRC_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, LIT_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, LG2_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, LOG_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, MAD_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, MAX_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, MIN_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, MOV_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, MUL_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, POW_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, RCP_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, RSQ_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, SGE_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, SLT_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, SUB_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, SWZ_TOKEN, "", 8}, - {NT_STATEMENT_TOKEN, XPD_TOKEN, "", 8}, - - {NT_STATEMENT_TOKEN, ADDRESS_TOKEN, "", 9}, - {NT_STATEMENT_TOKEN, ALIAS_TOKEN, "", 9}, - {NT_STATEMENT_TOKEN, ATTRIB_TOKEN, "", 9}, - {NT_STATEMENT_TOKEN, OUTPUT_TOKEN, "", 9}, - {NT_STATEMENT_TOKEN, PARAM_TOKEN, "", 9}, - {NT_STATEMENT_TOKEN, TEMP_TOKEN, "", 9}, - - {NT_INSTRUCTION_TOKEN, ARL_TOKEN, "", 10}, - - {NT_INSTRUCTION_TOKEN, ABS_TOKEN, "", 11}, - {NT_INSTRUCTION_TOKEN, FLR_TOKEN, "", 11}, - {NT_INSTRUCTION_TOKEN, FRC_TOKEN, "", 11}, - {NT_INSTRUCTION_TOKEN, LIT_TOKEN, "", 11}, - {NT_INSTRUCTION_TOKEN, MOV_TOKEN, "", 11}, - - {NT_INSTRUCTION_TOKEN, EX2_TOKEN, "", 12}, - {NT_INSTRUCTION_TOKEN, EXP_TOKEN, "", 12}, - {NT_INSTRUCTION_TOKEN, LG2_TOKEN, "", 12}, - {NT_INSTRUCTION_TOKEN, LOG_TOKEN, "", 12}, - {NT_INSTRUCTION_TOKEN, RCP_TOKEN, "", 12}, - {NT_INSTRUCTION_TOKEN, RSQ_TOKEN, "", 12}, - - {NT_INSTRUCTION_TOKEN, POW_TOKEN, "", 13}, - - {NT_INSTRUCTION_TOKEN, ADD_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, DP3_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, DP4_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, DPH_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, DST_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, MAX_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, MIN_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, MUL_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, SGE_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, SLT_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, SUB_TOKEN, "", 14}, - {NT_INSTRUCTION_TOKEN, XPD_TOKEN, "", 14}, - - {NT_INSTRUCTION_TOKEN, MAD_TOKEN, "", 15}, - - {NT_INSTRUCTION_TOKEN, SWZ_TOKEN, "", 16}, - - {NT_ARL_INSTRUCTION_TOKEN, ARL_TOKEN, "", 17}, - - {NT_VECTOROP_INSTRUCTION_TOKEN, ABS_TOKEN, "", 18}, - {NT_VECTOROP_INSTRUCTION_TOKEN, FLR_TOKEN, "", 18}, - {NT_VECTOROP_INSTRUCTION_TOKEN, FRC_TOKEN, "", 18}, - {NT_VECTOROP_INSTRUCTION_TOKEN, LIT_TOKEN, "", 18}, - {NT_VECTOROP_INSTRUCTION_TOKEN, MOV_TOKEN, "", 18}, - - {NT_VECTOROP_TOKEN, ABS_TOKEN, "", 19}, - - {NT_VECTOROP_TOKEN, FLR_TOKEN, "", 20}, - - {NT_VECTOROP_TOKEN, FRC_TOKEN, "", 21}, - - {NT_VECTOROP_TOKEN, LIT_TOKEN, "", 22}, - - {NT_VECTOROP_TOKEN, MOV_TOKEN, "", 23}, - - {NT_SCALAROP_INSTRUCTION_TOKEN, EX2_TOKEN, "", 24}, - {NT_SCALAROP_INSTRUCTION_TOKEN, EXP_TOKEN, "", 24}, - {NT_SCALAROP_INSTRUCTION_TOKEN, LG2_TOKEN, "", 24}, - {NT_SCALAROP_INSTRUCTION_TOKEN, LOG_TOKEN, "", 24}, - {NT_SCALAROP_INSTRUCTION_TOKEN, RCP_TOKEN, "", 24}, - {NT_SCALAROP_INSTRUCTION_TOKEN, RSQ_TOKEN, "", 24}, - - {NT_SCALAROP_TOKEN, EX2_TOKEN, "", 25}, - - {NT_SCALAROP_TOKEN, EXP_TOKEN, "", 26}, - - {NT_SCALAROP_TOKEN, LG2_TOKEN, "", 27}, - - {NT_SCALAROP_TOKEN, LOG_TOKEN, "", 28}, - - {NT_SCALAROP_TOKEN, RCP_TOKEN, "", 29}, - - {NT_SCALAROP_TOKEN, RSQ_TOKEN, "", 30}, - - {NT_BINSCOP_INSTRUCTION_TOKEN, POW_TOKEN, "", 31}, - - {NT_BINSCOP_INSTRUCTION2_TOKEN, COMMA_TOKEN, "", 32}, - - {NT_BINSCOP_TOKEN, POW_TOKEN, "", 33}, - - {NT_BINOP_INSTRUCTION_TOKEN, ADD_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, DP3_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, DP4_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, DPH_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, DST_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, MAX_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, MIN_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, MUL_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, SGE_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, SLT_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, SUB_TOKEN, "", 34}, - {NT_BINOP_INSTRUCTION_TOKEN, XPD_TOKEN, "", 34}, - - {NT_BINOP_INSTRUCTION2_TOKEN, COMMA_TOKEN, "", 35}, - - {NT_BINOP_TOKEN, ADD_TOKEN, "", 36}, - {NT_BINOP_TOKEN, DP3_TOKEN, "", 37}, - {NT_BINOP_TOKEN, DP4_TOKEN, "", 38}, - {NT_BINOP_TOKEN, DPH_TOKEN, "", 39}, - {NT_BINOP_TOKEN, DST_TOKEN, "", 40}, - {NT_BINOP_TOKEN, MAX_TOKEN, "", 41}, - {NT_BINOP_TOKEN, MIN_TOKEN, "", 42}, - {NT_BINOP_TOKEN, MUL_TOKEN, "", 43}, - {NT_BINOP_TOKEN, SGE_TOKEN, "", 44}, - {NT_BINOP_TOKEN, SLT_TOKEN, "", 45}, - {NT_BINOP_TOKEN, SUB_TOKEN, "", 46}, - {NT_BINOP_TOKEN, XPD_TOKEN, "", 47}, - - {NT_TRIOP_INSTRUCTION_TOKEN, MAD_TOKEN, "", 48}, - {NT_TRIOP_INSTRUCTION2_TOKEN, COMMA_TOKEN, "", 49}, - {NT_TRIOP_INSTRUCTION3_TOKEN, COMMA_TOKEN, "", 50}, - - {NT_TRIOP_TOKEN, MAD_TOKEN, "", 51}, - {NT_SWZ_INSTRUCTION_TOKEN, SWZ_TOKEN, "", 52}, - {NT_SWZ_INSTRUCTION2_TOKEN, COMMA_TOKEN, "", 53}, - - {NT_SCALAR_SRC_REG_TOKEN, PLUS_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, MINUS_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, VERTEX_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, STATE_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, PROGRAM_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, LBRACE_TOKEN, "", 54}, - {NT_SCALAR_SRC_REG_TOKEN, FLOAT_TOKEN, "-1", 54}, - {NT_SCALAR_SRC_REG_TOKEN, INTEGER_TOKEN, "-1", 54}, - {NT_SCALAR_SRC_REG_TOKEN, ID_TOKEN, "-1", 54}, - - {NT_SWIZZLE_SRC_REG_TOKEN, PLUS_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, MINUS_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, VERTEX_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, STATE_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, PROGRAM_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, LBRACE_TOKEN, "", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, FLOAT_TOKEN, "-1", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, INTEGER_TOKEN, "-1", 55}, - {NT_SWIZZLE_SRC_REG_TOKEN, ID_TOKEN, "-1", 55}, - - {NT_MASKED_DST_REG_TOKEN, ID_TOKEN, "-1", 56}, - {NT_MASKED_DST_REG_TOKEN, RESULT_TOKEN, "", 56}, - {NT_MASKED_ADDR_REG_TOKEN, ID_TOKEN, "-1", 57}, - - {NT_EXTENDED_SWIZZLE_TOKEN, PLUS_TOKEN, "", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, MINUS_TOKEN, "", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, INTEGER_TOKEN, "0", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, INTEGER_TOKEN, "1", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, ID_TOKEN, "x", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, ID_TOKEN, "y", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, ID_TOKEN, "z", 58}, - {NT_EXTENDED_SWIZZLE_TOKEN, ID_TOKEN, "w", 58}, - - {NT_EXTENDED_SWIZZLE2_TOKEN, COMMA_TOKEN, "", 59}, - - {NT_EXT_SWIZ_COMP_TOKEN, PLUS_TOKEN, "", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, MINUS_TOKEN, "", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, INTEGER_TOKEN, "0", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, INTEGER_TOKEN, "1", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, ID_TOKEN, "x", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, ID_TOKEN, "y", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, ID_TOKEN, "z", 60}, - {NT_EXT_SWIZ_COMP_TOKEN, ID_TOKEN, "w", 60}, - - {NT_EXT_SWIZ_SEL_TOKEN, INTEGER_TOKEN, "0", 61}, - {NT_EXT_SWIZ_SEL_TOKEN, INTEGER_TOKEN, "1", 62}, - {NT_EXT_SWIZ_SEL_TOKEN, ID_TOKEN, "x", 63}, - {NT_EXT_SWIZ_SEL_TOKEN, ID_TOKEN, "y", 63}, - {NT_EXT_SWIZ_SEL_TOKEN, ID_TOKEN, "z", 63}, - {NT_EXT_SWIZ_SEL_TOKEN, ID_TOKEN, "w", 63}, +#include "arbparse.h" - /* Special case for 64 - 68 */ - {NT_DST_REG_TOKEN, RESULT_TOKEN, "", 68}, - {NT_VERTEX_ATTRIB_REG_TOKEN, ID_TOKEN, "-1", 69}, - {NT_VERTEX_ATTRIB_REG_TOKEN, VERTEX_TOKEN, "", 70}, - {NT_TEMPORARY_REG_TOKEN, ID_TOKEN, "-1", 71}, - - /* Special case for 72 - 73 */ - - {NT_PROG_PARAM_REG_TOKEN, STATE_TOKEN, "", 74}, - {NT_PROG_PARAM_REG_TOKEN, PROGRAM_TOKEN, "", 74}, - {NT_PROG_PARAM_REG_TOKEN, LBRACE_TOKEN, "", 74}, - {NT_PROG_PARAM_REG_TOKEN, FLOAT_TOKEN, "-1", 74}, - - {NT_PROG_PARAM_SINGLE_TOKEN, ID_TOKEN, "-1", 75}, - {NT_PROG_PARAM_ARRAY_TOKEN, ID_TOKEN, "-1", 76}, - {NT_PROG_PARAM_ARRAY_MEM_TOKEN, INTEGER_TOKEN, "-1", 77}, - {NT_PROG_PARAM_ARRAY_MEM_TOKEN, ID_TOKEN, "-1", 78}, - {NT_PROG_PARAM_ARRAY_ABS_TOKEN, INTEGER_TOKEN, "-1", 79}, - {NT_PROG_PARAM_ARRAY_REL_TOKEN, ID_TOKEN, "-1", 80}, - - {NT_ADDR_REG_REL_OFFSET_TOKEN, RBRACKET_TOKEN, "", 81}, - {NT_ADDR_REG_REL_OFFSET_TOKEN, PLUS_TOKEN, "", 82}, - {NT_ADDR_REG_REL_OFFSET_TOKEN, MINUS_TOKEN, "", 83}, - {NT_ADDR_REG_POS_OFFSET_TOKEN, INTEGER_TOKEN, "-1", 84}, - {NT_ADDR_REG_NEG_OFFSET_TOKEN, INTEGER_TOKEN, "-1", 85}, - - - {NT_VERTEX_RESULT_REG_TOKEN, ID_TOKEN, "-1", 86}, - {NT_VERTEX_RESULT_REG_TOKEN, RESULT_TOKEN, "", 87}, - {NT_ADDR_REG_TOKEN, ID_TOKEN, "-1", 88}, - {NT_ADDR_COMPONENT_TOKEN, PERIOD_TOKEN, "", 89}, - {NT_ADDR_WRITE_MASK_TOKEN, PERIOD_TOKEN, "", 90}, - - {NT_SCALAR_SUFFIX_TOKEN, PERIOD_TOKEN, "", 91}, - - {NT_SWIZZLE_SUFFIX_TOKEN, COMMA_TOKEN, "", 92}, - {NT_SWIZZLE_SUFFIX_TOKEN, SEMICOLON_TOKEN, "", 92}, - {NT_SWIZZLE_SUFFIX_TOKEN, PERIOD_TOKEN, "", 317}, - - {NT_COMPONENT_TOKEN, ID_TOKEN, "x", 93}, - {NT_COMPONENT_TOKEN, ID_TOKEN, "y", 94}, - {NT_COMPONENT_TOKEN, ID_TOKEN, "z", 95}, - {NT_COMPONENT_TOKEN, ID_TOKEN, "w", 96}, - - {NT_OPTIONAL_MASK_TOKEN, PERIOD_TOKEN, "", 97}, - {NT_OPTIONAL_MASK_TOKEN, COMMA_TOKEN, "", 98}, - - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "x", 99}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "y", 100}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xy", 101}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "z", 102}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xz", 103}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "yz", 104}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xyz", 105}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "w", 106}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xw", 107}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "yw", 108}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xyw", 109}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "zw", 110}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xzw", 111}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "yzw", 112}, - {NT_OPTIONAL_MASK2_TOKEN, ID_TOKEN, "xyzw", 113}, - - - {NT_NAMING_STATEMENT_TOKEN, ATTRIB_TOKEN, "", 114}, - {NT_NAMING_STATEMENT_TOKEN, PARAM_TOKEN, "", 115}, - {NT_NAMING_STATEMENT_TOKEN, TEMP_TOKEN, "", 116}, - {NT_NAMING_STATEMENT_TOKEN, ADDRESS_TOKEN, "", 117}, - {NT_NAMING_STATEMENT_TOKEN, OUTPUT_TOKEN, "", 118}, - {NT_NAMING_STATEMENT_TOKEN, ALIAS_TOKEN, "", 119}, - - {NT_ATTRIB_STATEMENT_TOKEN, ATTRIB_TOKEN, "", 120}, - {NT_VTX_ATTRIB_BINDING_TOKEN, VERTEX_TOKEN, "", 121}, - - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "position", 122}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "weight", 123}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "normal", 124}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "color", 125}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "fogcoord", 126}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "texcoord", 127}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "matrixindex", 128}, - {NT_VTX_ATTRIB_ITEM_TOKEN, ID_TOKEN, "attrib", 129}, - - {NT_VTX_ATTRIB_NUM_TOKEN, INTEGER_TOKEN, "-1", 130}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, SEMICOLON_TOKEN, "", 131}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, COMMA_TOKEN, "", 131}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, PERIOD_TOKEN, "", 131}, - {NT_VTX_OPT_WEIGHT_NUM_TOKEN, LBRACKET_TOKEN, "", 132}, - - {NT_VTX_WEIGHT_NUM_TOKEN, INTEGER_TOKEN, "-1", 133}, - {NT_PARAM_STATEMENT_TOKEN, PARAM_TOKEN, "", 134}, - {NT_PARAM_STATEMENT2_TOKEN, EQUAL_TOKEN, "", 135}, - {NT_PARAM_STATEMENT2_TOKEN, LBRACKET_TOKEN, "", 136}, - - {NT_OPT_ARRAY_SIZE_TOKEN, RBRACKET_TOKEN, "", 137}, - {NT_OPT_ARRAY_SIZE_TOKEN, INTEGER_TOKEN, "-1", 138}, - - {NT_PARAM_SINGLE_INIT_TOKEN, EQUAL_TOKEN, "", 139}, - {NT_PARAM_MULTIPLE_INIT_TOKEN, EQUAL_TOKEN, "", 140}, - - {NT_PARAM_MULT_INIT_LIST_TOKEN, STATE_TOKEN, "", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, PROGRAM_TOKEN, "", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, PLUS_TOKEN, "", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, MINUS_TOKEN, "", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, FLOAT_TOKEN, "-1", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, INTEGER_TOKEN, "-1", 141}, - {NT_PARAM_MULT_INIT_LIST_TOKEN, LBRACE_TOKEN, "", 141}, - - - {NT_PARAM_MULT_INIT_LIST2_TOKEN, COMMA_TOKEN, "", 142}, - {NT_PARAM_MULT_INIT_LIST2_TOKEN, RBRACE_TOKEN, "", 143}, - - - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, STATE_TOKEN, "", 144}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, PROGRAM_TOKEN, "", 145}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, PLUS_TOKEN, "", 146}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, MINUS_TOKEN, "", 146}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, FLOAT_TOKEN, "-1", 146}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, INTEGER_TOKEN, "-1", 146}, - {NT_PARAM_SINGLE_ITEM_DECL_TOKEN, LBRACE_TOKEN, "", 146}, - - - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, STATE_TOKEN, "", 147}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, PROGRAM_TOKEN, "", 148}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, LBRACE_TOKEN, "", 149}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, FLOAT_TOKEN, "-1", 149}, - {NT_PARAM_SINGLE_ITEM_USE_TOKEN, INTEGER_TOKEN, "-1", 149}, - - {NT_PARAM_MULTIPLE_ITEM_TOKEN, STATE_TOKEN, "", 150}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, PROGRAM_TOKEN, "", 151}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, PLUS_TOKEN, "", 152}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, MINUS_TOKEN, "", 152}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, FLOAT_TOKEN, "-1", 152}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, INTEGER_TOKEN, "-1", 152}, - {NT_PARAM_MULTIPLE_ITEM_TOKEN, LBRACE_TOKEN, "", 152}, - - {NT_STATE_MULTIPLE_ITEM_TOKEN, STATE_TOKEN, "", 153}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "material", 154}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "light", 155}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "lightmodel", 156}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "lightprod", 157}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "texgen", 158}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "fog", 159}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "clip", 160}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "point", 161}, - {NT_STATE_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "matrix", 162}, - - {NT_FOO_TOKEN, PERIOD_TOKEN, "", 163}, - {NT_FOO_TOKEN, COMMA_TOKEN, "", 316}, - {NT_FOO_TOKEN, RBRACE_TOKEN, "", 316}, - {NT_FOO2_TOKEN, ID_TOKEN, "inverse", 164}, - {NT_FOO2_TOKEN, ID_TOKEN, "transpose", 164}, - {NT_FOO2_TOKEN, ID_TOKEN, "invtrans", 164}, - {NT_FOO2_TOKEN, ID_TOKEN, "row", 165}, - {NT_FOO3_TOKEN, COMMA_TOKEN, "", 166}, - {NT_FOO3_TOKEN, RBRACE_TOKEN, "", 166}, - {NT_FOO3_TOKEN, PERIOD_TOKEN, "", 167}, - - {NT_FOO35_TOKEN, INTEGER_TOKEN, "-1", 168}, - {NT_FOO4_TOKEN, RBRACKET_TOKEN, "", 169}, - {NT_FOO4_TOKEN, DOTDOT_TOKEN, "", 170}, - - {NT_STATE_SINGLE_ITEM_TOKEN, STATE_TOKEN, "", 171}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "material", 172}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "light", 173}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "lightmodel", 174}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "lightprod", 175}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "texgen", 176}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "fog", 177}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "clip", 178}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "point", 179}, - {NT_STATE_SINGLE_ITEM2_TOKEN, ID_TOKEN, "matrix", 180}, - - - {NT_STATE_MATERIAL_ITEM_TOKEN, ID_TOKEN, "material", 181}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, ID_TOKEN, "ambient", 182}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, ID_TOKEN, "diffuse", 182}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, ID_TOKEN, "specular", 182}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, ID_TOKEN, "emission", 182}, - {NT_STATE_MATERIAL_ITEM2_TOKEN, ID_TOKEN, "shininess", 182}, - - {NT_STATE_MATERIAL_ITEM2_TOKEN, PERIOD_TOKEN, "", 183}, - {NT_STATE_MAT_PROPERTY_TOKEN, ID_TOKEN, "ambient", 184}, - {NT_STATE_MAT_PROPERTY_TOKEN, ID_TOKEN, "diffuse", 185}, - {NT_STATE_MAT_PROPERTY_TOKEN, ID_TOKEN, "specular", 186}, - {NT_STATE_MAT_PROPERTY_TOKEN, ID_TOKEN, "emission", 187}, - {NT_STATE_MAT_PROPERTY_TOKEN, ID_TOKEN, "shininess", 188}, - - - {NT_STATE_LIGHT_ITEM_TOKEN, ID_TOKEN, "light", 189}, - {NT_STATE_LIGHT_ITEM2_TOKEN, RBRACKET_TOKEN, "", 190}, - - - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "ambient", 191}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "diffuse", 192}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "specular", 193}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "position", 194}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "attenuation", 195}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "spot", 196}, - {NT_STATE_LIGHT_PROPERTY_TOKEN, ID_TOKEN, "half", 197}, - - {NT_STATE_SPOT_PROPERTY_TOKEN, ID_TOKEN, "direction", 198}, - {NT_STATE_LIGHT_MODEL_ITEM_TOKEN, ID_TOKEN, "lightmodel", 199}, - - - {NT_STATE_LMOD_PROPERTY_TOKEN, PERIOD_TOKEN, "", 200}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, ID_TOKEN, "ambient", 201}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, ID_TOKEN, "scenecolor", 202}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, ID_TOKEN, "front", 203}, - {NT_STATE_LMOD_PROPERTY2_TOKEN, ID_TOKEN, "back", 203}, - - - {NT_STATE_LIGHT_PROD_ITEM_TOKEN, ID_TOKEN, "lightprod", 204}, - {NT_STATE_LIGHT_PROD_ITEM15_TOKEN, RBRACKET_TOKEN, "", 205}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, ID_TOKEN, "ambient", 206}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, ID_TOKEN, "diffuse", 206}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, ID_TOKEN, "specular", 206}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, ID_TOKEN, "front", 207}, - {NT_STATE_LIGHT_PROD_ITEM2_TOKEN, ID_TOKEN, "back", 207}, - - {NT_STATE_LPROD_PROPERTY_TOKEN, ID_TOKEN, "ambient", 208}, - {NT_STATE_LPROD_PROPERTY_TOKEN, ID_TOKEN, "diffuse", 209}, - {NT_STATE_LPROD_PROPERTY_TOKEN, ID_TOKEN, "specular", 210}, - - {NT_STATE_LIGHT_NUMBER_TOKEN, INTEGER_TOKEN, "-1", 211}, - {NT_STATE_TEX_GEN_ITEM_TOKEN, ID_TOKEN, "texgen", 212}, - {NT_STATE_TEX_GEN_ITEM2_TOKEN, PERIOD_TOKEN, "", 213}, - {NT_STATE_TEX_GEN_TYPE_TOKEN, ID_TOKEN, "eye", 214}, - {NT_STATE_TEX_GEN_TYPE_TOKEN, ID_TOKEN, "object", 215}, - - - {NT_STATE_TEX_GEN_COORD_TOKEN, ID_TOKEN, "s", 216}, - {NT_STATE_TEX_GEN_COORD_TOKEN, ID_TOKEN, "t", 217}, - {NT_STATE_TEX_GEN_COORD_TOKEN, ID_TOKEN, "r", 218}, - {NT_STATE_TEX_GEN_COORD_TOKEN, ID_TOKEN, "q", 219}, - - {NT_STATE_FOG_ITEM_TOKEN, ID_TOKEN, "fog", 220}, - - {NT_STATE_FOG_PROPERTY_TOKEN, ID_TOKEN, "color", 221}, - {NT_STATE_FOG_PROPERTY_TOKEN, ID_TOKEN, "params", 222}, - - {NT_STATE_CLIP_PLANE_ITEM_TOKEN, ID_TOKEN, "clip", 223}, - {NT_STATE_CLIP_PLANE_ITEM2_TOKEN, RBRACKET_TOKEN, "", 224}, - {NT_STATE_CLIP_PLANE_NUM_TOKEN, INTEGER_TOKEN, "-1", 225}, - {NT_STATE_POINT_ITEM_TOKEN, ID_TOKEN, "point", 226}, - {NT_STATE_POINT_PROPERTY_TOKEN, ID_TOKEN, "size", 227}, - {NT_STATE_POINT_PROPERTY_TOKEN, ID_TOKEN, "attenuation", 228}, - - - {NT_STATE_MATRIX_ROW_TOKEN, ID_TOKEN, "matrix", 229}, - {NT_STATE_MATRIX_ROW15_TOKEN, PERIOD_TOKEN, "", 230}, - {NT_STATE_MATRIX_ROW2_TOKEN, ID_TOKEN, "row", 231}, - {NT_STATE_MATRIX_ROW2_TOKEN, ID_TOKEN, "inverse", 232}, - {NT_STATE_MATRIX_ROW2_TOKEN, ID_TOKEN, "transpose", 232}, - {NT_STATE_MATRIX_ROW2_TOKEN, ID_TOKEN, "invtrans", 232}, - {NT_STATE_MATRIX_ROW3_TOKEN, LBRACKET_TOKEN, "", 233}, - - {NT_STATE_MAT_MODIFIER_TOKEN, ID_TOKEN, "inverse", 234}, - {NT_STATE_MAT_MODIFIER_TOKEN, ID_TOKEN, "transpose", 235}, - {NT_STATE_MAT_MODIFIER_TOKEN, ID_TOKEN, "invtrans", 236}, - {NT_STATE_MATRIX_ROW_NUM_TOKEN, INTEGER_TOKEN, "-1", 237}, - - - {NT_STATE_MATRIX_NAME_TOKEN, ID_TOKEN, "modelview", 238}, - {NT_STATE_MATRIX_NAME_TOKEN, ID_TOKEN, "projection", 239}, - {NT_STATE_MATRIX_NAME_TOKEN, ID_TOKEN, "mvp", 240}, - {NT_STATE_MATRIX_NAME_TOKEN, ID_TOKEN, "texture", 241}, - {NT_STATE_MATRIX_NAME_TOKEN, ID_TOKEN, "palette", 242}, - {NT_STATE_MATRIX_NAME_TOKEN, PROGRAM_TOKEN, "", 243}, - - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, PERIOD_TOKEN, "", 244}, - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, COMMA_TOKEN, "", 244}, - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, RBRACE_TOKEN, "", 244}, - {NT_STATE_OPT_MOD_MAT_NUM_TOKEN, LBRACKET_TOKEN, "", 245}, - - {NT_STATE_MOD_MAT_NUM_TOKEN, INTEGER_TOKEN, "-1", 246}, - {NT_STATE_PALETTE_MAT_NUM_TOKEN, INTEGER_TOKEN, "-1", 247}, - {NT_STATE_PROGRAM_MAT_NUM_TOKEN, INTEGER_TOKEN, "-1", 248}, - - {NT_PROGRAM_SINGLE_ITEM_TOKEN, PROGRAM_TOKEN, "", 249}, - {NT_PROGRAM_SINGLE_ITEM2_TOKEN, ID_TOKEN, "env", 250}, - {NT_PROGRAM_SINGLE_ITEM2_TOKEN, ID_TOKEN, "local", 251}, - - - {NT_PROGRAM_MULTIPLE_ITEM_TOKEN, PROGRAM_TOKEN, "", 252}, - {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "env", 253}, - {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN, ID_TOKEN, "local", 254}, - {NT_PROG_ENV_PARAMS_TOKEN, ID_TOKEN, "env", 255}, - {NT_PROG_ENV_PARAM_NUMS_TOKEN, INTEGER_TOKEN, "-1", 256}, - {NT_PROG_ENV_PARAM_NUMS2_TOKEN, DOTDOT_TOKEN, "", 257}, - {NT_PROG_ENV_PARAM_NUMS2_TOKEN, RBRACKET_TOKEN, "", 258}, - {NT_PROG_ENV_PARAM_TOKEN, ID_TOKEN, "env", 259}, - - {NT_PROG_LOCAL_PARAMS_TOKEN, ID_TOKEN, "local", 260}, - {NT_PROG_LOCAL_PARAM_NUMS_TOKEN, INTEGER_TOKEN, "-1", 261}, - {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN, DOTDOT_TOKEN, "", 262}, - {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN, RBRACKET_TOKEN, "", 263}, - {NT_PROG_LOCAL_PARAM_TOKEN, ID_TOKEN, "local", 264}, - {NT_PROG_ENV_PARAM_NUM_TOKEN, INTEGER_TOKEN, "-1", 265}, - {NT_PROG_LOCAL_PARAM_NUM_TOKEN, INTEGER_TOKEN, "-1", 266}, - {NT_PARAM_CONST_DECL_TOKEN, PLUS_TOKEN, "", 267}, - {NT_PARAM_CONST_DECL_TOKEN, MINUS_TOKEN, "", 267}, - {NT_PARAM_CONST_DECL_TOKEN, FLOAT_TOKEN, "-1", 267}, - {NT_PARAM_CONST_DECL_TOKEN, INTEGER_TOKEN, "-1", 267}, - {NT_PARAM_CONST_DECL_TOKEN, LBRACE_TOKEN, "", 268}, - - {NT_PARAM_CONST_USE_TOKEN, FLOAT_TOKEN, "-1", 269}, - {NT_PARAM_CONST_USE_TOKEN, INTEGER_TOKEN, "-1", 269}, - {NT_PARAM_CONST_USE_TOKEN, LBRACE_TOKEN, "", 270}, - - - {NT_PARAM_CONST_SCALAR_DECL_TOKEN, PLUS_TOKEN, "", 271}, - {NT_PARAM_CONST_SCALAR_DECL_TOKEN, MINUS_TOKEN, "", 271}, - {NT_PARAM_CONST_SCALAR_DECL_TOKEN, FLOAT_TOKEN, "-1", 271}, - {NT_PARAM_CONST_SCALAR_DECL_TOKEN, INTEGER_TOKEN, "-1", 271}, - - {NT_PARAM_CONST_SCALAR_USE_TOKEN, FLOAT_TOKEN, "-1", 272}, - {NT_PARAM_CONST_SCALAR_USE_TOKEN, INTEGER_TOKEN, "-1", 272}, - {NT_PARAM_CONST_VECTOR_TOKEN, LBRACE_TOKEN, "", 273}, - {NT_PARAM_CONST_VECTOR2_TOKEN, RBRACE_TOKEN, "", 274}, - {NT_PARAM_CONST_VECTOR2_TOKEN, COMMA_TOKEN, "", 275}, - {NT_PARAM_CONST_VECTOR3_TOKEN, RBRACE_TOKEN, "", 276}, - {NT_PARAM_CONST_VECTOR3_TOKEN, COMMA_TOKEN, "", 277}, - {NT_PARAM_CONST_VECTOR4_TOKEN, RBRACE_TOKEN, "", 278}, - {NT_PARAM_CONST_VECTOR4_TOKEN, COMMA_TOKEN, "", 279}, - - {NT_SIGNED_FLOAT_CONSTANT_TOKEN, PLUS_TOKEN, "", 280}, - {NT_SIGNED_FLOAT_CONSTANT_TOKEN, MINUS_TOKEN, "", 280}, - {NT_SIGNED_FLOAT_CONSTANT_TOKEN, FLOAT_TOKEN, "-1", 280}, - {NT_SIGNED_FLOAT_CONSTANT_TOKEN, INTEGER_TOKEN, "-1", 280}, - - {NT_OPTIONAL_SIGN_TOKEN, FLOAT_TOKEN, "-1", 281}, - {NT_OPTIONAL_SIGN_TOKEN, INTEGER_TOKEN, "0", 281}, - {NT_OPTIONAL_SIGN_TOKEN, INTEGER_TOKEN, "1", 281}, - {NT_OPTIONAL_SIGN_TOKEN, INTEGER_TOKEN, "-1", 281}, - {NT_OPTIONAL_SIGN_TOKEN, ID_TOKEN, "-1", 281}, - {NT_OPTIONAL_SIGN_TOKEN, STATE_TOKEN, "", 281}, - {NT_OPTIONAL_SIGN_TOKEN, PROGRAM_TOKEN, "", 281}, - {NT_OPTIONAL_SIGN_TOKEN, VERTEX_TOKEN, "", 281}, - {NT_OPTIONAL_SIGN_TOKEN, LBRACE_TOKEN, "", 281}, - - - {NT_OPTIONAL_SIGN_TOKEN, MINUS_TOKEN, "", 282}, - {NT_OPTIONAL_SIGN_TOKEN, PLUS_TOKEN, "", 283}, - - {NT_TEMP_STATEMENT_TOKEN, TEMP_TOKEN, "", 284}, - {NT_ADDRESS_STATEMENT_TOKEN, ADDRESS_TOKEN, "", 285}, - - /* Special case 286-7 */ - - {NT_OUTPUT_STATEMENT_TOKEN, OUTPUT_TOKEN, "", 288}, - {NT_RESULT_BINDING_TOKEN, RESULT_TOKEN, "", 289}, - {NT_RESULT_BINDING2_TOKEN, ID_TOKEN, "position", 290}, - {NT_RESULT_BINDING2_TOKEN, ID_TOKEN, "fogcoord", 291}, - {NT_RESULT_BINDING2_TOKEN, ID_TOKEN, "pointsize", 292}, - {NT_RESULT_BINDING2_TOKEN, ID_TOKEN, "color", 293}, - {NT_RESULT_BINDING2_TOKEN, ID_TOKEN, "texcoord", 294}, - - {NT_RESULT_COL_BINDING_TOKEN, ID_TOKEN, "color", 295}, - - /* Special case 296-7 */ - - {NT_RESULT_COL_BINDING3_TOKEN, ID_TOKEN, "front", 298}, - {NT_RESULT_COL_BINDING3_TOKEN, ID_TOKEN, "back", 299}, - - /* Special case 300-301 */ - - {NT_RESULT_COL_BINDING5_TOKEN, ID_TOKEN, "primary", 302}, - {NT_RESULT_COL_BINDING5_TOKEN, ID_TOKEN, "secondary", 303}, - {NT_OPT_FACE_TYPE2_TOKEN, ID_TOKEN, "front", 304}, - {NT_OPT_FACE_TYPE2_TOKEN, ID_TOKEN, "back", 305}, - - /* Special case 306-7 */ - - {NT_OPT_COLOR_TYPE2_TOKEN, ID_TOKEN, "primary", 308}, - {NT_OPT_COLOR_TYPE2_TOKEN, ID_TOKEN, "secondary", 309}, - - {NT_OPT_TEX_COORD_NUM_TOKEN, PERIOD_TOKEN, "", 310}, - {NT_OPT_TEX_COORD_NUM_TOKEN, SEMICOLON_TOKEN, "", 310}, - {NT_OPT_TEX_COORD_NUM_TOKEN, COMMA_TOKEN, "", 310}, - {NT_OPT_TEX_COORD_NUM_TOKEN, RBRACE_TOKEN, "", 310}, - {NT_OPT_TEX_COORD_NUM_TOKEN, LBRACKET_TOKEN, "", 311}, - - {NT_TEX_COORD_NUM_TOKEN, INTEGER_TOKEN, "-1", 312}, - - /* Special case for 313 to get aliasing correct */ - - {NT_ESTABLISH_NAME_TOKEN, ID_TOKEN, "-1", 314}, - {NT_ESTABLISHED_NAME_TOKEN, ID_TOKEN, "-1", 315}, - - /* Special case for 318-9 */ -}; - -static GLint nprods = sizeof(ptab) / sizeof(prod_table); -static GLint nlas = sizeof(latab) / sizeof(look_ahead_table); - -/** - * This is a gigantic FSA to recognize the keywords put forth in the - * GL_ARB_vertex_program spec. - * - * All other tokens are deemed 'identifiers', and shoved into the - * identifier symbol table (as opposed to the GLint and GLfloat symbol tables) - * - * \param s The parse state - * \param token The next token seen is returned in this value - * \param token_attr The token attribute for the next token is returned here. This - * is the index into the approprate symbol table if token is INTEGER_TOKEN, - * FLOAT_TOKEN, or ID_TOKEN - * - * \return ARB_VP_ERROR on lex error, ARB_VP_SUCESS on sucess - */ -static GLint -get_next_token(parse_state * s, GLint * token, GLint * token_attr) -{ - GLubyte curr; - - while (s->start_pos < s->len) { - curr = s->str[s->curr_pos]; - - switch (s->curr_state) { - /* Default state */ - case STATE_BASE: - if (IS_WHITESPACE(curr)) { - s->start_pos++; - s->curr_pos++; - } - else { - if (IS_IDCHAR(curr)) { - switch (curr) { - case 'A': - ADV_TO_STATE(STATE_A); - break; - - case 'D': - ADV_TO_STATE(STATE_D); - break; - - case 'E': - ADV_TO_STATE(STATE_E); - break; - - case 'F': - ADV_TO_STATE(STATE_F); - break; - - case 'L': - ADV_TO_STATE(STATE_L); - break; - - case 'M': - ADV_TO_STATE(STATE_M); - break; - - case 'O': - ADV_TO_STATE(STATE_O); - break; - - case 'P': - ADV_TO_STATE(STATE_P); - break; - - case 'R': - ADV_TO_STATE(STATE_R); - break; - - case 'S': - ADV_TO_STATE(STATE_S); - break; - - case 'T': - ADV_TO_STATE(STATE_T); - break; - - case 'X': - ADV_TO_STATE(STATE_X); - break; - - case 'p': - ADV_TO_STATE(STATE_LC_P); - break; - - case 'r': - ADV_TO_STATE(STATE_LC_R); - break; - - case 's': - ADV_TO_STATE(STATE_LC_S); - break; - - case 'v': - ADV_TO_STATE(STATE_LC_V); - break; - - default: - s->curr_state = 1; - s->start_pos = s->curr_pos; - s->curr_pos++; - } - } - else if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N4); - } - else { - switch (curr) { - case '#': - ADV_TO_STATE(STATE_COMMENT); - break; - case ';': - ADV_AND_FINISH(SEMICOLON_TOKEN); - break; - case ',': - ADV_AND_FINISH(COMMA_TOKEN); - break; - case '+': - ADV_AND_FINISH(PLUS_TOKEN); - break; - case '-': - ADV_AND_FINISH(MINUS_TOKEN); - break; - case '[': - ADV_AND_FINISH(LBRACKET_TOKEN); - break; - case ']': - ADV_AND_FINISH(RBRACKET_TOKEN); - break; - case '{': - ADV_AND_FINISH(LBRACE_TOKEN); - break; - case '}': - ADV_AND_FINISH(RBRACE_TOKEN); - break; - case '=': - ADV_AND_FINISH(EQUAL_TOKEN); - break; - - case '.': - ADV_TO_STATE(STATE_N1); - break; - - default: - return ARB_VP_ERROR; - break; - } - } - } - break; - - - /* Main identifier state */ - case STATE_IDENT: - if (IS_CD(curr)) { - s->curr_pos++; - } - else { - *token = ID_TOKEN; - *token_attr = - id_table_add(&s->idents, s->str, s->start_pos, s->curr_pos); - - s->curr_state = 0; - s->start_pos = s->curr_pos; - return ARB_VP_SUCESS; - } - break; - - /* ----------------------------------------------------- - * Beginning of the A* keywords - */ - case STATE_A: - if (IS_CD(curr)) { - switch (curr) { - case 'B': - ADV_TO_STATE(STATE_AB); - break; - case 'D': - ADV_TO_STATE(STATE_AD); - break; - case 'L': - ADV_TO_STATE(STATE_AL); - break; - case 'R': - ADV_TO_STATE(STATE_AR); - break; - case 'T': - ADV_TO_STATE(STATE_AT); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_AB: - ADV_OR_FALLBACK('S', STATE_ABS); - break; - - case STATE_ABS: - FINISH_OR_FALLBACK(ABS_TOKEN); - break; - - case STATE_AD: - ADV_OR_FALLBACK('D', STATE_ADD); - break; - - case STATE_ADD: - if (curr == 'R') { - ADV_TO_STATE(STATE_ADDR); - } - else if (IS_CD(curr)) { - ADV_TO_STATE(STATE_IDENT); - } - else { - FINISH(ADD_TOKEN); - } - break; - - case STATE_ADDR: - ADV_OR_FALLBACK('E', STATE_ADDRE); - break; - - case STATE_ADDRE: - ADV_OR_FALLBACK('S', STATE_ADDRES); - break; - - case STATE_ADDRES: - ADV_OR_FALLBACK('S', STATE_ADDRESS); - break; - - case STATE_ADDRESS: - FINISH_OR_FALLBACK(ADDRESS_TOKEN); - break; - - case STATE_AL: - ADV_OR_FALLBACK('I', STATE_ALI); - break; - - case STATE_ALI: - ADV_OR_FALLBACK('A', STATE_ALIA); - break; - - case STATE_ALIA: - ADV_OR_FALLBACK('S', STATE_ALIAS); - break; - - case STATE_ALIAS: - FINISH_OR_FALLBACK(ALIAS_TOKEN); - break; - - case STATE_AR: - ADV_OR_FALLBACK('L', STATE_ARL); - break; - - case STATE_ARL: - FINISH_OR_FALLBACK(ARL_TOKEN); - break; - - case STATE_AT: - ADV_OR_FALLBACK('T', STATE_ATT); - break; - - case STATE_ATT: - ADV_OR_FALLBACK('R', STATE_ATTR); - break; - - case STATE_ATTR: - ADV_OR_FALLBACK('I', STATE_ATTRI); - break; - - case STATE_ATTRI: - ADV_OR_FALLBACK('B', STATE_ATTRIB); - break; - - case STATE_ATTRIB: - FINISH_OR_FALLBACK(ATTRIB_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the D* keywords - */ - case STATE_D: - if (IS_CD(curr)) { - switch (curr) { - case 'P': - ADV_TO_STATE(STATE_DP); - break; - case 'S': - ADV_TO_STATE(STATE_DS); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_DP: - if (IS_CD(curr)) { - switch (curr) { - case '3': - ADV_TO_STATE(STATE_DP3); - break; - case '4': - ADV_TO_STATE(STATE_DP4); - break; - case 'H': - ADV_TO_STATE(STATE_DPH); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_DP3: - FINISH_OR_FALLBACK(DP3_TOKEN); - break; - - case STATE_DP4: - FINISH_OR_FALLBACK(DP4_TOKEN); - break; - - case STATE_DPH: - FINISH_OR_FALLBACK(DPH_TOKEN); - break; - - case STATE_DS: - ADV_OR_FALLBACK('T', STATE_DST); - break; - - case STATE_DST: - FINISH_OR_FALLBACK(DST_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the E* keywords - */ - case STATE_E: - if (IS_CD(curr)) { - switch (curr) { - case 'N': - ADV_TO_STATE(STATE_EN); - break; - case 'X': - ADV_TO_STATE(STATE_EX); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_EN: - ADV_OR_FALLBACK('D', STATE_END); - break; - - case STATE_END: - FINISH_OR_FALLBACK(END_TOKEN); - break; - - case STATE_EX: - if (IS_CD(curr)) { - switch (curr) { - case '2': - ADV_TO_STATE(STATE_EX2); - break; - case 'P': - ADV_TO_STATE(STATE_EXP); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_EX2: - FINISH_OR_FALLBACK(EX2_TOKEN); - break; - - case STATE_EXP: - FINISH_OR_FALLBACK(EXP_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the F* keywords - */ - case STATE_F: - if (IS_CD(curr)) { - switch (curr) { - case 'L': - ADV_TO_STATE(STATE_FL); - break; - case 'R': - ADV_TO_STATE(STATE_FR); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_FL: - ADV_OR_FALLBACK('R', STATE_FLR); - break; - - case STATE_FLR: - FINISH_OR_FALLBACK(FLR_TOKEN); - break; - - case STATE_FR: - ADV_OR_FALLBACK('C', STATE_FRC); - break; - - case STATE_FRC: - FINISH_OR_FALLBACK(FRC_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the L* keywords - */ - case STATE_L: - if (IS_CD(curr)) { - switch (curr) { - case 'G': - ADV_TO_STATE(STATE_LG); - break; - case 'I': - ADV_TO_STATE(STATE_LI); - break; - case 'O': - ADV_TO_STATE(STATE_LO); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_LG: - ADV_OR_FALLBACK('2', STATE_LG2); - break; - - case STATE_LG2: - FINISH_OR_FALLBACK(LG2_TOKEN); - break; - - case STATE_LI: - ADV_OR_FALLBACK('T', STATE_LIT); - break; - - case STATE_LIT: - FINISH_OR_FALLBACK(LIT_TOKEN); - break; - - case STATE_LO: - ADV_OR_FALLBACK('G', STATE_LOG); - break; - - case STATE_LOG: - FINISH_OR_FALLBACK(LOG_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the M* keywords - */ - case STATE_M: - if (IS_CD(curr)) { - switch (curr) { - case 'A': - ADV_TO_STATE(STATE_MA); - break; - case 'I': - ADV_TO_STATE(STATE_MI); - break; - case 'O': - ADV_TO_STATE(STATE_MO); - break; - case 'U': - ADV_TO_STATE(STATE_MU); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_MA: - if (IS_CD(curr)) { - switch (curr) { - case 'D': - ADV_TO_STATE(STATE_MAD); - break; - case 'X': - ADV_TO_STATE(STATE_MAX); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_MAD: - FINISH_OR_FALLBACK(MAD_TOKEN); - break; - - case STATE_MAX: - FINISH_OR_FALLBACK(MAX_TOKEN); - break; - - case STATE_MI: - ADV_OR_FALLBACK('N', STATE_MIN); - break; - - case STATE_MIN: - FINISH_OR_FALLBACK(MIN_TOKEN); - break; - - case STATE_MO: - ADV_OR_FALLBACK('V', STATE_MOV); - break; - - case STATE_MOV: - FINISH_OR_FALLBACK(MOV_TOKEN); - break; - - case STATE_MU: - ADV_OR_FALLBACK('L', STATE_MUL); - break; - - case STATE_MUL: - FINISH_OR_FALLBACK(MUL_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the O* keywords - */ - case STATE_O: - if (IS_CD(curr)) { - switch (curr) { - case 'P': - ADV_TO_STATE(STATE_OP); - break; - case 'U': - ADV_TO_STATE(STATE_OU); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_OP: - ADV_OR_FALLBACK('T', STATE_OPT); - break; - - case STATE_OPT: - ADV_OR_FALLBACK('I', STATE_OPTI); - break; - - case STATE_OPTI: - ADV_OR_FALLBACK('O', STATE_OPTIO); - break; - - case STATE_OPTIO: - ADV_OR_FALLBACK('N', STATE_OPTION); - break; - - case STATE_OPTION: - FINISH_OR_FALLBACK(OPTION_TOKEN); - break; - - case STATE_OU: - ADV_OR_FALLBACK('T', STATE_OUT); - break; - - case STATE_OUT: - ADV_OR_FALLBACK('P', STATE_OUTP); - break; - - case STATE_OUTP: - ADV_OR_FALLBACK('U', STATE_OUTPU); - break; - - case STATE_OUTPU: - ADV_OR_FALLBACK('T', STATE_OUTPUT); - break; - - case STATE_OUTPUT: - FINISH_OR_FALLBACK(OUTPUT_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the P* keywords - */ - case STATE_P: - if (IS_CD(curr)) { - switch (curr) { - case 'A': - ADV_TO_STATE(STATE_PA); - break; - case 'O': - ADV_TO_STATE(STATE_PO); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_PA: - ADV_OR_FALLBACK('R', STATE_PAR); - break; - - case STATE_PAR: - ADV_OR_FALLBACK('A', STATE_PARA); - break; - - case STATE_PARA: - ADV_OR_FALLBACK('M', STATE_PARAM); - break; - - case STATE_PARAM: - FINISH_OR_FALLBACK(PARAM_TOKEN); - break; - - case STATE_PO: - ADV_OR_FALLBACK('W', STATE_POW); - break; - - case STATE_POW: - FINISH_OR_FALLBACK(POW_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the R* keywords - */ - case STATE_R: - if (IS_CD(curr)) { - switch (curr) { - case 'C': - ADV_TO_STATE(STATE_RC); - break; - case 'S': - ADV_TO_STATE(STATE_RS); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_RC: - ADV_OR_FALLBACK('P', STATE_RCP); - break; - - case STATE_RCP: - FINISH_OR_FALLBACK(RCP_TOKEN); - break; - - case STATE_RS: - ADV_OR_FALLBACK('Q', STATE_RSQ); - break; - - case STATE_RSQ: - FINISH_OR_FALLBACK(RSQ_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the S* keywords - */ - case STATE_S: - if (IS_CD(curr)) { - switch (curr) { - case 'G': - ADV_TO_STATE(STATE_SG); - break; - case 'L': - ADV_TO_STATE(STATE_SL); - break; - case 'U': - ADV_TO_STATE(STATE_SU); - break; - case 'W': - ADV_TO_STATE(STATE_SW); - break; - default: - ADV_TO_STATE(STATE_IDENT); - break; - } - } - else { - s->curr_state = 1; - } - break; - - case STATE_SG: - ADV_OR_FALLBACK('E', STATE_SGE); - break; - - case STATE_SGE: - FINISH_OR_FALLBACK(SGE_TOKEN); - break; - - case STATE_SL: - ADV_OR_FALLBACK('T', STATE_SLT); - break; - - case STATE_SLT: - FINISH_OR_FALLBACK(SLT_TOKEN); - break; - - case STATE_SU: - ADV_OR_FALLBACK('B', STATE_SUB); - break; - - case STATE_SUB: - FINISH_OR_FALLBACK(SUB_TOKEN); - break; - - case STATE_SW: - ADV_OR_FALLBACK('Z', STATE_SWZ); - break; - - case STATE_SWZ: - FINISH_OR_FALLBACK(SWZ_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the T* keywords - */ - case STATE_T: - ADV_OR_FALLBACK('E', STATE_TE); - break; - - case STATE_TE: - ADV_OR_FALLBACK('M', STATE_TEM); - break; - - case STATE_TEM: - ADV_OR_FALLBACK('P', STATE_TEMP); - break; - - case STATE_TEMP: - FINISH_OR_FALLBACK(TEMP_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the X* keywords - */ - case STATE_X: - ADV_OR_FALLBACK('P', STATE_XP); - break; - - case STATE_XP: - ADV_OR_FALLBACK('D', STATE_XPD); - break; - - case STATE_XPD: - FINISH_OR_FALLBACK(XPD_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the p* keywords - */ - case STATE_LC_P: - ADV_OR_FALLBACK('r', STATE_LC_PR); - break; - - case STATE_LC_PR: - ADV_OR_FALLBACK('o', STATE_LC_PRO); - break; - - case STATE_LC_PRO: - ADV_OR_FALLBACK('g', STATE_LC_PROG); - break; - - case STATE_LC_PROG: - ADV_OR_FALLBACK('r', STATE_LC_PROGR); - break; - - case STATE_LC_PROGR: - ADV_OR_FALLBACK('a', STATE_LC_PROGRA); - break; - - case STATE_LC_PROGRA: - ADV_OR_FALLBACK('m', STATE_LC_PROGRAM); - break; - - case STATE_LC_PROGRAM: - FINISH_OR_FALLBACK(PROGRAM_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the r* keywords - */ - case STATE_LC_R: - ADV_OR_FALLBACK('e', STATE_LC_RE); - break; - - case STATE_LC_RE: - ADV_OR_FALLBACK('s', STATE_LC_RES); - break; - - case STATE_LC_RES: - ADV_OR_FALLBACK('u', STATE_LC_RESU); - break; - - case STATE_LC_RESU: - ADV_OR_FALLBACK('l', STATE_LC_RESUL); - break; - - case STATE_LC_RESUL: - ADV_OR_FALLBACK('t', STATE_LC_RESULT); - break; - - case STATE_LC_RESULT: - FINISH_OR_FALLBACK(RESULT_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the s* keywords - */ - case STATE_LC_S: - ADV_OR_FALLBACK('t', STATE_LC_ST); - break; - - case STATE_LC_ST: - ADV_OR_FALLBACK('a', STATE_LC_STA); - break; - - case STATE_LC_STA: - ADV_OR_FALLBACK('t', STATE_LC_STAT); - break; - - case STATE_LC_STAT: - ADV_OR_FALLBACK('e', STATE_LC_STATE); - break; - - case STATE_LC_STATE: - FINISH_OR_FALLBACK(STATE_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the v* keywords - */ - case STATE_LC_V: - ADV_OR_FALLBACK('e', STATE_LC_VE); - break; - - case STATE_LC_VE: - ADV_OR_FALLBACK('r', STATE_LC_VER); - break; - - case STATE_LC_VER: - ADV_OR_FALLBACK('t', STATE_LC_VERT); - break; - - case STATE_LC_VERT: - ADV_OR_FALLBACK('e', STATE_LC_VERTE); - break; - - case STATE_LC_VERTE: - ADV_OR_FALLBACK('x', STATE_LC_VERTEX); - break; - - case STATE_LC_VERTEX: - FINISH_OR_FALLBACK(VERTEX_TOKEN); - break; - - /* ----------------------------------------------------- - * Beginning of the number & comment FSAs - */ - case STATE_N1: - if (curr == '.') { - ADV_TO_STATE(STATE_N2); - } - else if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N3); - } - else { - /*ADV_AND_FINISH(PERIOD_TOKEN); */ - FINISH(PERIOD_TOKEN); - } - break; - - case STATE_N2: -#if 1 - /*ADV_AND_FINISH(DOTDOT_TOKEN);*/ - FINISH(DOTDOT_TOKEN); -#else - FINISH(PERIOD_TOKEN); -#endif - break; - - case STATE_N3: - if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N3); - } - else if ((curr == 'E') || (curr == 'e')) { - ADV_TO_STATE(STATE_N5); - } - else if (curr == '.') { - /* Blech! we have something like 1.. -> have to backup */ - s->curr_pos -= 1; - *token_attr = - int_table_add(&s->ints, s->str, s->start_pos, s->curr_pos); - FINISH(INTEGER_TOKEN); - } - else { - *token_attr = - float_table_add(&s->floats, s->str, s->start_pos, s->curr_pos); - /*ADV_AND_FINISH(FLOAT_TOKEN);*/ - FINISH(FLOAT_TOKEN); - } - break; - - case STATE_N4: - if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N4); - } - else if ((curr == 'E') || (curr == 'e')) { - ADV_TO_STATE(STATE_N5); - } - else if (curr == '.') { - ADV_TO_STATE(STATE_N3); - } - else { - *token_attr = - int_table_add(&s->ints, s->str, s->start_pos, s->curr_pos); - /*ADV_AND_FINISH(INTEGER_TOKEN);*/ - FINISH(INTEGER_TOKEN); - } - break; - - case STATE_N5: - if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N6); - } - else if ((curr == '+') || (curr == '-')) { - ADV_TO_STATE(STATE_N7) - } - else { - return ARB_VP_ERROR; - } - break; - - case STATE_N6: - if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N6); - } - else { - *token_attr = - float_table_add(&s->floats, s->str, s->start_pos, s->curr_pos); - /*ADV_AND_FINISH(FLOAT_TOKEN);*/ - FINISH(FLOAT_TOKEN); - } - break; - - case STATE_N7: - if (IS_DIGIT(curr)) { - ADV_TO_STATE(STATE_N6); - } - else { - return ARB_VP_ERROR; - } - - break; - - case STATE_COMMENT: - if ((curr == '\n') || (curr == '\r')) { - s->start_pos = s->curr_pos + 1; - s->curr_pos++; - s->curr_state = 0; - } - else { - ADV_TO_STATE(STATE_COMMENT); - } - } - } - - *token = EOF_TOKEN; - return ARB_VP_SUCESS; -} - -/** - * This does the same as get_next_token(), but it does not advance the - * position pointers (Err, rather it does, but then it resets them) - * - * \param s The parse state - * \param token The next token seen is returned in this value - * \param token_attr The token attribute for the next token is returned here. This - * is the index into the approprate symbol table if token is INTEGER_TOKEN, - * FLOAT_TOKEN, or ID_TOKEN - * \param how_many How many tokens to peek ahead - * - * \return ARB_VP_ERROR on lex error, ARB_VP_SUCESS on sucess - */ -static GLint -peek_next_token(parse_state * s, GLint * token, GLint * token_attr, - GLint how_many) -{ - GLint tmp_state = s->curr_state; - GLint tmp_sp = s->start_pos; - GLint tmp_cp = s->curr_pos; - GLint a, retval; - - for (a = 0; a < how_many; a++) { - retval = get_next_token(s, token, token_attr); - - if (retval == ARB_VP_ERROR) - return retval; - } - - s->curr_state = tmp_state; - s->start_pos = tmp_sp; - s->curr_pos = tmp_cp; - - return retval; -} - -/** - * Print out the value of a token - */ -static void -debug_token(parse_state * state, GLint t, GLint ta) -{ - switch (t) { - case EOF_TOKEN: - printf("EOF\n"); - break; - case ID_TOKEN: - printf("|%s| ", state->idents.data[ta]); - break; - case INTEGER_TOKEN: - printf("|%d| ", state->ints.data[ta]); - break; - case FLOAT_TOKEN: - printf("|%f| ", state->floats.data[ta]); - break; - - case ABS_TOKEN: - printf("ABS "); - break; - case ADD_TOKEN: - printf("ADD "); - break; - case ADDRESS_TOKEN: - printf("ADDRESS "); - break; - case ALIAS_TOKEN: - printf("ALIAS "); - break; - case ARL_TOKEN: - printf("ARL "); - break; - case ATTRIB_TOKEN: - printf("ATTRIB "); - break; - - case DP3_TOKEN: - printf("DP3 "); - break; - case DP4_TOKEN: - printf("DP4 "); - break; - case DPH_TOKEN: - printf("DPH "); - break; - case DST_TOKEN: - printf("DST "); - break; - - case END_TOKEN: - printf("END "); - break; - case EX2_TOKEN: - printf("EX2 "); - break; - case EXP_TOKEN: - printf("EXP "); - break; - - case FLR_TOKEN: - printf("FLR "); - break; - case FRC_TOKEN: - printf("FRC "); - break; - - case LG2_TOKEN: - printf("LG2 "); - break; - case LIT_TOKEN: - printf("LIT "); - break; - case LOG_TOKEN: - printf("LOG "); - break; - - case MAD_TOKEN: - printf("MAD "); - break; - case MAX_TOKEN: - printf("MAX "); - break; - case MIN_TOKEN: - printf("MIN "); - break; - case MOV_TOKEN: - printf("MOV "); - break; - case MUL_TOKEN: - printf("MUL "); - break; - - case OPTION_TOKEN: - printf("OPTION "); - break; - case OUTPUT_TOKEN: - printf("OUTPUT "); - break; - - case PARAM_TOKEN: - printf("PARAM "); - break; - case POW_TOKEN: - printf("POW "); - break; - - case RCP_TOKEN: - printf("RCP "); - break; - case RSQ_TOKEN: - printf("RSQ "); - break; - - case SGE_TOKEN: - printf("SGE "); - break; - case SLT_TOKEN: - printf("SLT "); - break; - case SUB_TOKEN: - printf("SUB "); - break; - case SWZ_TOKEN: - printf("SWZ "); - break; - - case TEMP_TOKEN: - printf("TEMP "); - break; - - case XPD_TOKEN: - printf("XPD "); - break; - - case SEMICOLON_TOKEN: - printf("; "); - break; - case COMMA_TOKEN: - printf(", "); - break; - case PLUS_TOKEN: - printf("+ "); - break; - case MINUS_TOKEN: - printf("- "); - break; - case PERIOD_TOKEN: - printf(". "); - break; - case DOTDOT_TOKEN: - printf(".. "); - break; - case LBRACKET_TOKEN: - printf("[ "); - break; - case RBRACKET_TOKEN: - printf("] "); - break; - case LBRACE_TOKEN: - printf("{ "); - break; - case RBRACE_TOKEN: - printf("} "); - break; - case EQUAL_TOKEN: - printf("= "); - break; - - case PROGRAM_TOKEN: - printf("program "); - break; - case RESULT_TOKEN: - printf("result "); - break; - case STATE_TOKEN: - printf("state "); - break; - case VERTEX_TOKEN: - printf("vertex "); - break; - default: - printf("Unknown token type %d\n", t); - } -} - -/** - * Setup the state used by the parser / lex - * - * \param str The program string, with the !!ARBvp1.0 token stripped off - * \param len The lenght of the given string - * - * \return A parse_state struct to keep track of all the things we need while parsing - */ -static parse_state * -parse_state_init(GLubyte * str, GLint len) -{ - parse_state *s = (parse_state *) _mesa_malloc(sizeof(parse_state)); - - s->str = _mesa_strdup((char *) str); - s->len = len; - s->curr_pos = 0; - s->start_pos = 0; - - s->curr_state = 0; - - s->idents.len = 0; - s->idents.data = NULL; - - s->ints.len = 0; - s->ints.data = NULL; - - s->floats.len = 0; - s->floats.data = NULL; - printf("%s\n", s->str); - - s->binds.len = 0; - s->binds.type = NULL; - s->binds.offset = NULL; - s->binds.row = NULL; - s->binds.consts = NULL; - - s->arrays.len = 0; - s->arrays.num_elements = NULL; - s->arrays.data = NULL; - - s->stack_head = NULL; - s->stack_free_list = NULL; - - s->pt_head = NULL; - - return s; -} - -/** - * This frees all the things we hold while parsing. - * - * \param s The struct created by parse_state_init() - */ -static void -parse_state_cleanup(parse_state * s) -{ - GLint a; - token_list *tl, *next; - - /* Free our copy of the string [Mesa has its own] */ - _mesa_free(s->str); - - /* Free all the tables ident, int, float, bind, mat */ - _mesa_free(s->idents.type); - _mesa_free(s->idents.attr); - for (a = 0; a < s->idents.len; a++) - _mesa_free(s->idents.data[a]); - - _mesa_free(s->ints.data); - _mesa_free(s->floats.data); - - _mesa_free(s->arrays.num_elements); - for (a = 0; a < s->arrays.len; a++) - _mesa_free(s->arrays.data[a]); - - _mesa_free(s->binds.type); - _mesa_free(s->binds.offset); - _mesa_free(s->binds.row); - _mesa_free(s->binds.num_rows); - _mesa_free(s->binds.reg_num); -#if 0 - for (a = 0; a < s->binds.len; a++) { - printf("6: %d/%d\n", a, s->binds.len - 1); - _mesa_free(s->binds.consts[a]); - } -#endif - - /* Free the stack */ - tl = s->stack_head; - while (tl) { - next = tl->next; - free(tl); - tl = next; - } - tl = s->stack_free_list; - while (tl) { - next = tl->next; - free(tl); - tl = next; - } - printf("freed stack free list\n"); - -#if 0 - /* Free the parse tree */ - parse_tree_free_children(s->pt_head); - printf("freed parse_tree\n"); -#endif - free(s); - printf("freed state\n"); -} - -/** - * Alloc a new node for a parse tree. - * - * \return An empty node to fill and stick into the parse tree - */ -static parse_tree_node * -parse_tree_node_init(void) -{ - GLint a; - parse_tree_node *pt; - - pt = (parse_tree_node *) _mesa_malloc(sizeof(parse_tree_node)); - pt->tok = -1; - pt->tok_attr = -1; - pt->is_terminal = 0; - pt->prod_applied = -1; - - for (a = 0; a < 4; a++) - pt->children[a] = NULL; - - return pt; -} - -/** - * We maintain a stack of nonterminals used for predictive parsing. To keep - * from thrashing malloc/free, we keep a free list of token_list structs - * to be used for this stack. This function is called to refill the free - * list, when we try to grab a new token_list struct, and find that there are none - * available - * - * \param s The parse state - */ -static void -_fill_free_list(parse_state * s) -{ - GLint a; - token_list *tl; - - if (s->stack_free_list) - return; - - for (a = 0; a < 20; a++) { - tl = (token_list *) _mesa_malloc(sizeof(token_list)); - - tl->next = s->stack_free_list; - s->stack_free_list = tl; - } -} - -/** - * Peek at the head of the nonterminal stack, - * - * \param s The parse state - * \param token Return for the nonterminal token on the top of the stack - * \param token_attr Return for the the token attribute on the top of the stack - * - * \return ARB_VP_ERROR on an empty stack [not necessarily a bad thing], else ARB_VP_SUCESS - */ -static GLint -_stack_peek(parse_state * s, GLint * token, GLint * token_attr) -{ - if (!s->stack_head) { - fprintf(stderr, "ACK! Empty stack on peek!\n"); - return ARB_VP_ERROR; - } - - *token = s->stack_head->tok; - *token_attr = s->stack_head->tok_attr; - - return ARB_VP_SUCESS; -} - -/** - * Remove the token at the head of the nonterminal stack - * \param s The parse state - * \param token Return for the nonterminal token on the top of the stack - * \param token_attr Return for the the token attribute on the top of the stack - * \param ptn Return for a pointer to the place in the parse tree where - * the token lives - * - * \return ARB_VP_ERROR on an empty stack [not necessarily a bad thing], else ARB_VP_SUCESS - */ -static GLint -_stack_pop(parse_state * s, GLint * token, GLint * token_attr, - parse_tree_node ** ptn) -{ - token_list *tl; - - if (!s->stack_head) { - fprintf(stderr, "ACK! Empty stack!\n"); - return ARB_VP_ERROR; - } - - *token = s->stack_head->tok; - *token_attr = s->stack_head->tok_attr; - if (ptn) - *ptn = s->stack_head->pt; - tl = s->stack_head; - - s->stack_head = tl->next; - tl->next = s->stack_free_list; - s->stack_free_list = tl; - - return ARB_VP_SUCESS; -} - -/** - * Put a token, its attribute, and the the parse tree node where the token is stored, onto - * the parse stack. - * - * \param s The parse state - * \param token Return for the nonterminal token on the top of the stack - * \param token_attr Return for the the token attribute on the top of the stack - * \param ptn Return for a pointer to the place in the parse tree where - * the token lives - * - * \return ARB_VP_ERROR on out of memory while allocing more storage for the stack, - * else ARB_VP_SUCESS - */ -static GLint -_stack_push(parse_state * s, GLint token, GLint token_attr, - parse_tree_node * ptn) -{ - token_list *tl; - - if (!s->stack_free_list) { - _fill_free_list(s); - if (!s->stack_free_list) { - fprintf(stderr, "ACK! Error filling stack free list\n"); - return ARB_VP_ERROR; - } - } - - tl = s->stack_free_list; - - s->stack_free_list = tl->next; - - tl->tok = token; - tl->tok_attr = token_attr; - tl->pt = ptn; - tl->next = s->stack_head; - - s->stack_head = tl; - - return ARB_VP_SUCESS; -} - -/** - * Allocate a new entry in the array table - * - * \param tab The array table to add a new element too - * - * \return The index into the array table where the new element is. - */ -static GLint -array_table_new(array_table * tab) -{ - GLint idx; - if (tab->len == 0) { - tab->num_elements = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->data = (GLint **) _mesa_malloc(sizeof(GLint *)); - idx = 0; - } - else { - tab->num_elements = - (GLint *) _mesa_realloc(tab->num_elements, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->data = - (GLint **) _mesa_realloc(tab->data, tab->len * sizeof(GLint *), - (tab->len + 1) * sizeof(GLint *)); - idx = tab->len; - } - - tab->len++; - tab->num_elements[idx] = 0; - tab->data[idx] = NULL; - - return idx; -} - -/** - * Add a new element to a array in a array table - * - * \param tab The array table - * \param idx The index into the array table of the array we want to append an item onto - * \param data The program parameter that goes into the idx-th array - */ -static void -array_table_add_data(array_table * tab, GLint idx, GLint data) -{ - if ((idx < 0) || (idx >= tab->len)) { - printf("Bad matrix index %d!\n", idx); - return; - } - - if (tab->data[idx] == NULL) { - tab->data[idx] = (GLint *) _mesa_malloc(sizeof(GLint)); - } - else { - tab->data[idx] = - (GLint *) _mesa_realloc(tab->data[idx], - tab->num_elements[idx] * sizeof(GLint), - (tab->num_elements[idx] + - 1) * sizeof(GLint)); - } - - tab->data[idx][tab->num_elements[idx]] = data; - tab->num_elements[idx]++; -} - - -/** - * This adds a new entry into the binding table. - * - * \param tab The binding table - * \param type The type of the state - * \param offset For matrix bindings, e.g. MATRIXROWS_MODELVIEW, this gives the matrix number. - * For PROGRAM_ENV_* and PROGRAM_LOCAL_* bindings, this gives the number of the first parameter - * - * \param row For MATRIXROWS bindings, this is the first row in the matrix we're bound to - * \param nrows For MATRIXROWS bindings, this is the number of rows of the matrix we have. - * For PROGRAM_ENV/LOCAL bindings, this is the number of parameters in the array we're bound to - * \param values For CONSTANT bindings, these are the constant values we're bound to - * \return The index into the binding table where this state is bound - */ -static GLint -binding_table_add(binding_table * tab, GLint type, GLint offset, GLint row, - GLint nrows, GLfloat * values) -{ - GLint key, a; - - key = tab->len; - - /* test for existance */ - for (a = 0; a < tab->len; a++) { - if ((tab->type[a] == type) && (tab->offset[a] == offset) - && (tab->row[a] == row) && (tab->num_rows[a] == nrows) && - (fabs(tab->consts[a][0] - values[0]) < .0001) && - (fabs(tab->consts[a][1] - values[1]) < .0001) && - (fabs(tab->consts[a][2] - values[2]) < .0001) && - (fabs(tab->consts[a][3] - values[3]) < .0001)) - return a; - } - - if (tab->len == 0) { - tab->type = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->offset = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->row = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->num_rows = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->consts = (GLfloat **) _mesa_malloc(sizeof(GLfloat *)); - tab->consts[0] = (GLfloat *) _mesa_malloc(4 * sizeof(GLfloat)); - tab->reg_num = (GLint *) _mesa_malloc(sizeof(GLint)); - } - else { - tab->type = - (GLint *) _mesa_realloc(tab->type, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->offset = - (GLint *) _mesa_realloc(tab->offset, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->row = - (GLint *) _mesa_realloc(tab->row, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->num_rows = - (GLint *) _mesa_realloc(tab->num_rows, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->consts = - (GLfloat **) _mesa_realloc(tab->consts, tab->len * sizeof(GLfloat), - (tab->len + 1) * sizeof(GLfloat *)); - tab->consts[tab->len] = (GLfloat *) _mesa_malloc(4 * sizeof(GLfloat)); - tab->reg_num = - (GLint *) _mesa_realloc(tab->reg_num, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - } - - tab->type[key] = type; - tab->offset[key] = offset; - tab->row[key] = row; /*key;*/ - tab->num_rows[key] = nrows; - tab->reg_num[key] = 0; - _mesa_memcpy(tab->consts[key], values, 4 * sizeof(GLfloat)); - tab->len++; - - return key; -} - -/** - * Given a string and a start/end point, add a string into the float - * symbol table (and convert it into a float) - * - * If we already have this GLfloat in the table, don't bother - * adding another, just return the key to the existing one - * - * \param tab The float table - * \param str The string containing the float - * \param start The starting position of the float in str - * \param end The ending position of the float in str - * - * \return The index of the float, after we insert it, in the float table - */ -static GLint -float_table_add(float_table *tab, const char *str, GLint start, GLint end) -{ - GLint key, a; - GLubyte *newstr; - - key = tab->len; - - newstr = (GLubyte *) _mesa_malloc(end - start + 2); - _mesa_memset(newstr, 0, end - start + 2); - _mesa_memcpy(newstr, str + start, end - start); - - /* test for existance */ - for (a = 0; a < tab->len; a++) { - if (tab->data[a] == atof((char *) newstr)) { - _mesa_free(newstr); - return a; - } - } - - if (tab->len == 0) { - tab->data = (GLdouble *) _mesa_malloc(sizeof(GLdouble)); - } - else { - tab->data = - (GLdouble *) _mesa_realloc(tab->data, tab->len * sizeof(GLdouble), - (tab->len + 1) * sizeof(GLdouble)); - } - - tab->data[key] = atof((char *) newstr); - tab->len++; - - _mesa_free(newstr); - return key; -} - -/** - * Given a string and a start/end point, add a string into the int - * symbol table (and convert it into a int) - * - * If we already have this int in the table, don't bother - * adding another, just return the key to the existing one - * - * \param tab The int table - * \param str The string containing the int - * \param start The starting position of the int in str - * \param end The ending position of the int in str - * - * \return The index of the int, after we insert it, in the int table - */ -static GLint -int_table_add(int_table * tab, const char *str, GLint start, GLint end) -{ - GLint key, a; - char *newstr; - - key = tab->len; - - newstr = (char *) _mesa_malloc(end - start + 2); - _mesa_memset(newstr, 0, end - start + 2); - _mesa_memcpy(newstr, str + start, end - start); - - for (a = 0; a < tab->len; a++) { - if (tab->data[a] == _mesa_atoi(newstr)) { - _mesa_free(newstr); - return a; - } - } - - if (tab->len == 0) { - tab->data = (GLint *) _mesa_malloc(sizeof(GLint)); - } - else { - tab->data = - (GLint *) _mesa_realloc(tab->data, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - } - - tab->data[key] = _mesa_atoi(newstr); - tab->len++; - - _mesa_free(newstr); - return key; -} - -/** - * Insert an identifier into the identifier symbol table - * - * If we already have this id in the table, don't bother - * adding another, just return the key to the existing one - * - * If we already have this id in the table, and it has been - * initialized to an ALIAS, return what the alias points - * to, not the alias var - * - * \param tab The ID table - * \param str The string containing the id - * \param start The position in str where the id begins - * \param end The position in str where the id ends - * - * \return either: - * 1) The index into the id table where the id is - * 2) The index into the id table where the alias of id, if we already have id - * in the table, and it has been initialized to type ALIAS - */ -static GLint -id_table_add(id_table * tab, const char * str, GLint start, GLint end) -{ - GLint key, a; - GLubyte *newstr; - - key = tab->len; - - if (tab->len == 0) { - tab->data = (GLubyte **) _mesa_malloc(sizeof(GLubyte *)); - tab->type = (GLint *) _mesa_malloc(sizeof(GLint)); - tab->attr = (GLint *) _mesa_malloc(sizeof(GLint)); - } - else { - tab->data = - (GLubyte **) _mesa_realloc(tab->data, tab->len * sizeof(GLubyte *), - (tab->len + 1) * sizeof(GLubyte *)); - tab->type = - (GLint *) _mesa_realloc(tab->type, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - tab->attr = - (GLint *) _mesa_realloc(tab->attr, tab->len * sizeof(GLint), - (tab->len + 1) * sizeof(GLint)); - } - - /*tab->type[key] = TYPE_NONE;*/ - - newstr = (GLubyte *) _mesa_malloc((end - start + 2) * sizeof(GLubyte)); - _mesa_memset(newstr, 0, end - start + 2); - _mesa_memcpy(newstr, str + start, end - start); - - for (a = 0; a < tab->len; a++) { - /* aha! we found it in the table */ - if (!_mesa_strcmp((char *) tab->data[a], (char *) newstr)) { - _mesa_free(newstr); - - key = a; - while ((tab->type[key] == TYPE_ALIAS) && (tab->attr[key] != -1)) { - printf("----------- %s is an alias, renaming to %s\n", - tab->data[key], tab->data[tab->attr[key]]); - key = tab->attr[key]; - } - - return key; - } - } - - /* oh, we really have a new id */ - tab->data[key] = newstr; - tab->type[key] = TYPE_NONE; - tab->attr[key] = -1; - tab->len++; - - return key; -} - -/*#define SHOW_STEPS 1*/ - - -/** - * Apply the specified production number to the parse state. This handles - * looking at the production table and sticking new tokens onto the - * parse stack. - * - * It also handles the construction of the parse tree - * - * \param s The parse state - * \param num The production number to apply [the idx in the production table] - * - */ -static void -apply_production(parse_state * s, int num) -{ - GLint a, str_key, stack_tok, stack_tok_attr; - GLint tok, nnptr = 0; - parse_tree_node *ptn; - parse_tree_node *pt_ptr_new[4]; - - (void) _stack_pop(s, &stack_tok, &stack_tok_attr, &ptn); - /*printf("apply prod %d\n", num); */ - - ptn->prod_applied = num; - for (a = 3; a >= 0; a--) { - str_key = 0; - tok = ptab[num].rhs[a]; - - if (tok == NULL_TOKEN) - continue; - - /* If we are pushing an identifier or a number, we need to translate the string literal - * in the production table into an entry in the approprate symbol table - */ - if (tok == ID_TOKEN) { - str_key = id_table_add(&s->idents, ptab[num].key[a], 0, - _mesa_strlen(ptab[num].key[a])); - } - else if (tok == INTEGER_TOKEN) { - str_key = int_table_add(&s->ints, ptab[num].key[a], 0, - _mesa_strlen(ptab[num].key[a])); - } - else if (tok == FLOAT_TOKEN) { - str_key = float_table_add(&s->floats, ptab[num].key[a], 0, - _mesa_strlen(ptab[num].key[a])); - } - - /* "-1" is a wildcard flag, accept any id/float/int */ - if ((!_mesa_strcmp(ptab[num].key[a], "-1")) && - ((tok == FLOAT_TOKEN) || (tok == INTEGER_TOKEN) - || (tok == ID_TOKEN))) { - pt_ptr_new[nnptr] = parse_tree_node_init(); - pt_ptr_new[nnptr]->is_terminal = 0; - pt_ptr_new[nnptr]->tok = tok; - pt_ptr_new[nnptr]->tok_attr = str_key; - nnptr++; - _stack_push(s, ptab[num].rhs[a], str_key, pt_ptr_new[nnptr - 1]); - } - else if (tok >= NT_PROGRAM_TOKEN) { - pt_ptr_new[nnptr] = parse_tree_node_init(); - pt_ptr_new[nnptr]->is_terminal = 0; - pt_ptr_new[nnptr]->tok = tok; - nnptr++; - _stack_push(s, ptab[num].rhs[a], str_key, pt_ptr_new[nnptr - 1]); - } - else - _stack_push(s, ptab[num].rhs[a], str_key, NULL); - } - - tok = 0; - if (ptn) { - /*printf("%x %d:[%x %x %x %x]\n", ptn, nnptr, pt_ptr_new[0], pt_ptr_new[1], pt_ptr_new[2], pt_ptr_new[3]); */ - - for (a = nnptr - 1; a >= 0; a--) { - ptn->children[tok] = pt_ptr_new[a]; - /*printf("%x->children[%d] = %x\n", ptn, tok, pt_ptr_new[a]); */ - tok++; - } - } -} - -/** - * Here we initialize a bunch of variables to a given type (e.g. TEMP). - * - * We stick the variable type into the 0-th element in the var_queue array, followed by var_queue_size - * indicies into the identifier table which designate the variables we are to init. - * - * \param s The parse state - * \param var_queue The queue of variables to initialize. The first element in the array is variable - * type. It is followed by var_queue_size indicies into the identifier table - * who we are supposed to init to type var_queue[0]. - * \param var_queue_size The number of variables listed in var_queue[]. - * - * \return ARB_VP_ERROR if we have already initilized a variable in var_queue, otherwise - * ARB_VP_SUCESS - */ -static GLint -init_vars(parse_state * s, GLint * var_queue, GLint var_queue_size) +static GLvoid +debug_vp_inst(GLint num, struct vp_instruction *vp) { GLint a; - a = 1; - while (a < var_queue_size) { - /* Make sure we haven't already init'd this var. This will - * catch multiple definations of the same symbol - */ - if (s->idents.type[var_queue[a]] != TYPE_NONE) { - printf("%s already init'd! (%d)\n", s->idents.data[var_queue[a]], - s->idents.type[var_queue[a]]); - return ARB_VP_ERROR; - } - - s->idents.type[var_queue[a]] = var_queue[0]; - s->idents.attr[var_queue[a]] = -1; - a++; - } - - return ARB_VP_SUCESS; -} - -/** - * The main parsing loop. This applies productions and builds the parse tree. - * - * \param s The parse state - * - * \return ARB_VP_ERROR on a parse error, else ARB_VP_SUCESS - */ -static GLint -parse(parse_state * s) -{ - GLint input_tok, input_tok_attr; - GLint stack_tok, stack_tok_attr; - GLint peek_tok, peek_tok_attr, ret; - GLint idx, str_key; - GLint var_queue_size = 0; - GLint *var_queue; - parse_tree_node *ptn, *ptn2; - - /* This should be MAX_VAR + 1 */ - var_queue = (GLint *) _mesa_malloc(1000 * sizeof(int)); - - s->stack_head = NULL; - - /* init the system by pushing the start symbol onto the stack */ - ptn = parse_tree_node_init(); - ptn->is_terminal = 0; - ptn->tok = NT_PROGRAM_TOKEN; - s->pt_head = ptn; - _stack_push(s, NT_PROGRAM_TOKEN, 0, ptn); - - /* and get the first token */ - if (get_next_token(s, &input_tok, &input_tok_attr) == ARB_VP_ERROR) { - fprintf(stderr, "LEX ERROR!!\n"); - return ARB_VP_ERROR; - } - - while (1) { - GLint la, is_nonterm; - - /* If the stack is empty, and we've eaten all the input, we're done */ - if ((_stack_peek(s, &stack_tok, &stack_tok_attr) == ARB_VP_ERROR) && - (input_tok == EOF_TOKEN)) - break; - -#ifdef SHOW_STEPS - printf("stack: %d input: ", stack_tok); - debug_token(s, input_tok, input_tok_attr); - printf("\n"); -#endif - - /* We [may] have a non-terminal on top of the stack, apply - * productions! - */ - switch (stack_tok) { - /* Special case non-terminals */ - - /* productions 64-66 */ - case NT_SRC_REG_TOKEN: - if ((input_tok == VERTEX_TOKEN) || - ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == TYPE_ATTRIB))) { - apply_production(s, 64); - } - else - if ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == TYPE_TEMP)) { - apply_production(s, 65); - } - else - if ((input_tok == STATE_TOKEN) || - (input_tok == PROGRAM_TOKEN) || - (input_tok == LBRACE_TOKEN) || - (input_tok == FLOAT_TOKEN) || - (input_tok == INTEGER_TOKEN) || - ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == TYPE_PARAM_SINGLE)) - || ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == - TYPE_PARAM_ARRAY))) { - apply_production(s, 66); - } - else { - return ARB_VP_ERROR; - } - break; - - /* productions 67-68 */ - case NT_DST_REG_TOKEN: - /* We can only write to result.*, TEMP vars, or OUTPUT vars */ - if (input_tok == RESULT_TOKEN) { - apply_production(s, 68); - } - else if (input_tok == ID_TOKEN) { - if (s->idents.type[input_tok_attr] == TYPE_TEMP) { - apply_production(s, 67); - } - else if (s->idents.type[input_tok_attr] == TYPE_OUTPUT) { - apply_production(s, 68); - } - else { - return ARB_VP_ERROR; - } - } - else { - return ARB_VP_ERROR; - } - break; - - /* productions 72-4 */ - case NT_PROG_PARAM_REG_TOKEN: - if ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == TYPE_PARAM_SINGLE)) { - apply_production(s, 72); - } - else - if ((input_tok == ID_TOKEN) - && (s->idents.type[input_tok_attr] == TYPE_PARAM_ARRAY)) { - apply_production(s, 73); - } - else - if ((input_tok == STATE_TOKEN) || - (input_tok == PROGRAM_TOKEN) || - (input_tok == FLOAT_TOKEN) || - (input_tok == INTEGER_TOKEN) || (input_tok == LBRACE_TOKEN)) { - apply_production(s, 74); - } - else { - return ARB_VP_ERROR; - } - break; - - /* productions 286-7 */ - case NT_VAR_NAME_LIST_TOKEN: - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - - var_queue[var_queue_size] = input_tok_attr; - var_queue_size++; + for (a=0; a<num; a++) { + switch (vp[a].Opcode) { + case VP_OPCODE_MOV: + fprintf(stderr, "VP_OPCODE_MOV"); break; - if ((ret == ARB_VP_ERROR) || (peek_tok != COMMA_TOKEN)) { - apply_production(s, 286); + case VP_OPCODE_LIT: + fprintf(stderr, "VP_OPCODE_LIT"); break; - /* Dump the var_queue & assign types */ - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; - } - else { - apply_production(s, 287); - } - break; + case VP_OPCODE_RCP: + fprintf(stderr, "VP_OPCODE_RCP"); break; - /* productions 296-7 */ - case NT_RESULT_COL_BINDING2_TOKEN: - if ((input_tok == SEMICOLON_TOKEN) || (input_tok == COMMA_TOKEN)) { - apply_production(s, 296); - } - else if (input_tok == PERIOD_TOKEN) { - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - if ((peek_tok == ID_TOKEN) && - ((!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "back")) || - (!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "front")))) { - apply_production(s, 297); - } - else { - apply_production(s, 296); - } - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_RSQ: + fprintf(stderr, "VP_OPCODE_RSQ"); break; - /* productions 300-1 */ - case NT_RESULT_COL_BINDING4_TOKEN: - if ((input_tok == SEMICOLON_TOKEN) || (input_tok == COMMA_TOKEN)) { - apply_production(s, 300); - } - else if (input_tok == PERIOD_TOKEN) { - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - if ((ret == ARB_VP_SUCESS) && (peek_tok == ID_TOKEN) && - ((!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "primary")) || - (!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "secondary")))) - { - apply_production(s, 301); - } - else { - apply_production(s, 300); - } - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_EXP: + fprintf(stderr, "VP_OPCODE_EXP"); break; - /* productions 306-7 */ - case NT_OPT_COLOR_TYPE_TOKEN: - if ((input_tok == SEMICOLON_TOKEN) || (input_tok == COMMA_TOKEN)) { - apply_production(s, 307); - } - else if (input_tok == PERIOD_TOKEN) { - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - if ((ret == ARB_VP_SUCESS) && (peek_tok == ID_TOKEN) && - ((!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "primary")) || - (!_mesa_strcmp((char *) s->idents.data[peek_tok_attr], "secondary")))) - { - apply_production(s, 306); - } - else { - apply_production(s, 307); - } - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_LOG: + fprintf(stderr, "VP_OPCODE_LOG"); break; - /* production 313 -- Do this so we can mangle IDs as they are - * added into the ID table for the lex - */ - case NT_ALIAS_STATEMENT_TOKEN: - if (input_tok == ALIAS_TOKEN) { - GLint alias_to; + case VP_OPCODE_MUL: + fprintf(stderr, "VP_OPCODE_MUL"); break; - apply_production(s, 313); + case VP_OPCODE_ADD: + fprintf(stderr, "VP_OPCODE_ADD"); break; + + case VP_OPCODE_DP3: + fprintf(stderr, "VP_OPCODE_DP3"); break; - /* stack ALIAS */ - var_queue_size = 1; - var_queue[0] = TYPE_ALIAS; - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - var_queue[var_queue_size] = peek_tok_attr; - var_queue_size++; + case VP_OPCODE_DP4: + fprintf(stderr, "VP_OPCODE_DP4"); break; - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; + case VP_OPCODE_DST: + fprintf(stderr, "VP_OPCODE_DST"); break; - /* Now, peek ahead and see what we are aliasing _to_ */ - alias_to = peek_tok_attr; - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 3); - if (ret == ARB_VP_SUCESS) { - s->idents.attr[alias_to] = peek_tok_attr; - } - else - return ARB_VP_ERROR; - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_MIN: + fprintf(stderr, "VP_OPCODE_MIN"); break; - /* productions 314 (ESTABLISH_NAME) duplicates are caught by the ID symbol table */ + case VP_OPCODE_MAX: + fprintf(stderr, "VP_OPCODE_MAX"); break; - /* productions 315 */ - case NT_ESTABLISHED_NAME_TOKEN: - if (input_tok == ID_TOKEN) { - if (s->idents.type[input_tok_attr] == TYPE_NONE) { - printf("Trying to use variable %s before initializing!\n", - s->idents.data[input_tok_attr]); - return ARB_VP_ERROR; - } - else { - apply_production(s, 315); - } - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_SLT: + fprintf(stderr, "VP_OPCODE_SLT"); break; + case VP_OPCODE_SGE: + fprintf(stderr, "VP_OPCODE_SGE"); break; - /* productions 318-9 */ - case NT_SWIZZLE_SUFFIX2_TOKEN: - if (_mesa_strlen((char *) s->idents.data[input_tok_attr]) == 1) { - apply_production(s, 318); - } - else if (_mesa_strlen((char *) s->idents.data[input_tok_attr]) == 4) { - apply_production(s, 319); - } - else { - return ARB_VP_ERROR; - } - break; + case VP_OPCODE_MAD: + fprintf(stderr, "VP_OPCODE_MAD"); break; - /* 4-component swizzle mask -- this is a total hack */ -#define IS_SWZ_CMP(foo) ((foo == 'x') || (foo == 'y') || (foo == 'z') || (foo == 'w')) - case NT_COMPONENT4_TOKEN: - { - GLubyte *str = s->idents.data[input_tok_attr]; + case VP_OPCODE_ARL: + fprintf(stderr, "VP_OPCODE_ARL"); break; - if (IS_SWZ_CMP(str[0]) && IS_SWZ_CMP(str[1]) && IS_SWZ_CMP(str[2]) - && IS_SWZ_CMP(str[3])) { - _stack_pop(s, &stack_tok, &stack_tok_attr, &ptn); - /* _stack_push(s, input_tok, input_tok_attr, NULL);*/ + case VP_OPCODE_DPH: + fprintf(stderr, "VP_OPCODE_DPH"); break; - ptn2 = parse_tree_node_init(); - ptn2->tok = input_tok; - ptn2->tok_attr = input_tok_attr; - ptn2->is_terminal = 1; - ptn->children[0] = ptn2; - _stack_push(s, input_tok, input_tok_attr, ptn2); - } - else { - return ARB_VP_ERROR; - } - } - break; + case VP_OPCODE_RCC: + fprintf(stderr, "VP_OPCODE_RCC"); break; - /* Handle general non-terminals using tables, and terminals */ - default: - is_nonterm = 0; - for (la = 0; la < nlas; la++) { - if (latab[la].lhs != stack_tok) - continue; + case VP_OPCODE_SUB: + fprintf(stderr, "VP_OPCODE_SUB"); break; - if (latab[la].la != input_tok) - continue; + case VP_OPCODE_ABS: + fprintf(stderr, "VP_OPCODE_ABS"); break; - if (input_tok == ID_TOKEN) { - str_key = - id_table_add(&s->idents, latab[la].la_kw, 0, - _mesa_strlen(latab[la].la_kw)); - if ((str_key != input_tok_attr) - && (_mesa_strcmp(latab[la].la_kw, "-1"))) - continue; - } - else if (input_tok == INTEGER_TOKEN) { - if ((s->ints.data[input_tok_attr] != - _mesa_atoi(latab[la].la_kw)) - && (_mesa_atoi(latab[la].la_kw) != -1)) { - continue; - } - } - else if (input_tok == FLOAT_TOKEN) { - if ((s->floats.data[input_tok_attr] != atof(latab[la].la_kw)) - && (atof(latab[la].la_kw) != -1)) - continue; - } - idx = latab[la].prod_idx; + case VP_OPCODE_FLR: + fprintf(stderr, "VP_OPCODE_FLR"); break; - /* Here we stack identifiers onto the var_queue */ - switch (idx) { - /* setup ATTRIB */ - case 120: - var_queue_size = 1; - var_queue[0] = TYPE_ATTRIB; - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - var_queue[var_queue_size] = peek_tok_attr; - var_queue_size++; + case VP_OPCODE_FRC: + fprintf(stderr, "VP_OPCODE_FRC"); break; - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; - break; + case VP_OPCODE_EX2: + fprintf(stderr, "VP_OPCODE_EX2"); break; - /* stack PARAM */ - case 134: - var_queue_size = 1; - var_queue[0] = TYPE_PARAM; + case VP_OPCODE_LG2: + fprintf(stderr, "VP_OPCODE_LG2"); break; - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - var_queue[var_queue_size] = peek_tok_attr; - var_queue_size++; + case VP_OPCODE_POW: + fprintf(stderr, "VP_OPCODE_POW"); break; - break; + case VP_OPCODE_XPD: + fprintf(stderr, "VP_OPCODE_XPD"); break; - case 135: - var_queue[0] = TYPE_PARAM_SINGLE; - - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; - break; - - case 136: - var_queue[0] = TYPE_PARAM_ARRAY; - - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; - break; - - /* stack TEMP */ - case 284: - var_queue_size = 1; - var_queue[0] = TYPE_TEMP; - break; - - /* stack ADDRESS */ - case 285: - var_queue_size = 1; - var_queue[0] = TYPE_ADDRESS; - break; - - /* stack OUTPUT */ - case 288: - var_queue_size = 1; - var_queue[0] = TYPE_OUTPUT; - ret = peek_next_token(s, &peek_tok, &peek_tok_attr, 1); - var_queue[var_queue_size] = peek_tok_attr; - var_queue_size++; - - if (init_vars(s, var_queue, var_queue_size) == ARB_VP_ERROR) - return ARB_VP_ERROR; - break; - - - /* stack opts for varNameList -- see above */ - - } - - /* finally.. we match! apply the production */ - if ((idx < 0) || (idx >= nprods)) { - fprintf(stderr, - "Prod IDX of %d in look ahead table [%d] is horked!\n", - idx, la); - exit(1); - } - - apply_production(s, idx); - is_nonterm = 1; - break; - } - - if (!is_nonterm) { - if ((stack_tok == EOF_TOKEN) && (s->stack_head == NULL)) - return ARB_VP_SUCESS; - - if ((input_tok == stack_tok) || - ((stack_tok == FLOAT_TOKEN) - && (input_tok == INTEGER_TOKEN))) { - /* XXX: Need to check values for int/id/GLfloat tokens here -- yes! */ - - _stack_pop(s, &stack_tok, &stack_tok_attr, &ptn); - if ((ptn) - && ((stack_tok == FLOAT_TOKEN) - || (stack_tok == INTEGER_TOKEN) - || (stack_tok == ID_TOKEN))) { - ptn->is_terminal = 1; - ptn->tok = input_tok; - ptn->tok_attr = input_tok_attr; - } - - if (get_next_token(s, &input_tok, &input_tok_attr) == - ARB_VP_ERROR) { - fprintf(stderr, "PARSE ERROR!!\n"); - return ARB_VP_ERROR; - } - } - else { - fprintf(stderr, "PARSE ERROR!\n"); - return ARB_VP_ERROR; - } - } - break; + case VP_OPCODE_SWZ: + fprintf(stderr, "VP_OPCODE_SWZ"); break; + + case VP_OPCODE_END: + fprintf(stderr, "VP_OPCODE_END"); break; } - } - - return ARB_VP_SUCESS; - - -} - -/** - * Print out the parse tree from a given point. Just for debugging. - * - * \param s The parse state - * \param ptn The root to start printing from - */ -static void -print_parse_tree(parse_state * s, parse_tree_node * ptn) -{ - GLint a; - - /* If we're terminal, prGLint and exit */ - if (ptn->is_terminal) { - debug_token(s, ptn->tok, ptn->tok_attr); - printf("\n"); - return; - } - - /* Else, recurse on all our children */ - for (a = 0; a < 4; a++) { - if (!ptn->children[a]) - return; - - print_parse_tree(s, ptn->children[a]); - } -} - -/** - * Free all of the children of a given parse tree node. - * - * \param ptn The root node whose children we recursively free - */ -static void -parse_tree_free_children(parse_tree_node * ptn) -{ - GLint a; - if (!ptn) - return; - if (!ptn->children[0]) - return; + fprintf(stderr, " D(0x%x:%d:%d%d%d%d) ", vp[a].DstReg.File, vp[a].DstReg.Index, + vp[a].DstReg.WriteMask[0], + vp[a].DstReg.WriteMask[1], + vp[a].DstReg.WriteMask[2], + vp[a].DstReg.WriteMask[3]); + + fprintf(stderr, "S1(0x%x:%d:%d%d%d%d) ", vp[a].SrcReg[0].File, vp[a].SrcReg[0].Index, + vp[a].SrcReg[0].Swizzle[0], + vp[a].SrcReg[0].Swizzle[1], + vp[a].SrcReg[0].Swizzle[2], + vp[a].SrcReg[0].Swizzle[3]); - for (a = 0; a < 4; a++) { - if (ptn->children[a]) { - parse_tree_free_children(ptn->children[a]); - _mesa_free(ptn->children[a]); - ptn->children[a] = NULL; - } - } -} + fprintf(stderr, "S2(0x%x:%d:%d%d%d%d) ", vp[a].SrcReg[1].File, vp[a].SrcReg[1].Index, + vp[a].SrcReg[1].Swizzle[0], + vp[a].SrcReg[1].Swizzle[1], + vp[a].SrcReg[1].Swizzle[2], + vp[a].SrcReg[1].Swizzle[3]); -/** - * Given the name of a matrix, and a modifier, expand into a binding type. - * - * names: 0 -- modelview - * 1 -- projection - * 2 -- mvp - * 3 -- texture - * 4 -- palette - * 5 -- program - * - * mods: 0 -- normal - * 1 -- inverse - * 2 -- invtrans - * 3 -- transpose - * - * \param name The number of the matrix type - * \param mod The number of the matrix modifier - * - * \return The binding state corresponding to name & mod - */ -static GLint -name_and_mod_to_matrixrows(GLint name, GLint mod) -{ - switch (name) { - case 0: /* modelview */ - switch (mod) { - case 0: - return MATRIXROWS_MODELVIEW; - case 1: - return MATRIXROWS_MODELVIEW_INVERSE; - case 2: - return MATRIXROWS_MODELVIEW_INVTRANS; - case 3: - return MATRIXROWS_MODELVIEW_TRANSPOSE; - } - break; - case 1: /* projection */ - switch (mod) { - case 0: - return MATRIXROWS_PROJECTION; - case 1: - return MATRIXROWS_PROJECTION_INVERSE; - case 2: - return MATRIXROWS_PROJECTION_INVTRANS; - case 3: - return MATRIXROWS_PROJECTION_TRANSPOSE; - } - - break; - case 2: /* mvp */ - switch (mod) { - case 0: - return MATRIXROWS_MVP; - case 1: - return MATRIXROWS_MVP_INVERSE; - case 2: - return MATRIXROWS_MVP_INVTRANS; - case 3: - return MATRIXROWS_MVP_TRANSPOSE; - } + fprintf(stderr, "S3(0x%x:%d:%d%d%d%d)", vp[a].SrcReg[2].File, vp[a].SrcReg[2].Index, + vp[a].SrcReg[2].Swizzle[0], + vp[a].SrcReg[2].Swizzle[1], + vp[a].SrcReg[2].Swizzle[2], + vp[a].SrcReg[2].Swizzle[3]); - break; - case 3: /* texture */ - switch (mod) { - case 0: - return MATRIXROWS_TEXTURE; - case 1: - return MATRIXROWS_TEXTURE_INVERSE; - case 2: - return MATRIXROWS_TEXTURE_INVTRANS; - case 3: - return MATRIXROWS_TEXTURE_TRANSPOSE; - } - break; - case 4: /* palette */ - switch (mod) { - case 0: - return MATRIXROWS_PALETTE; - case 1: - return MATRIXROWS_PALETTE_INVERSE; - case 2: - return MATRIXROWS_PALETTE_INVTRANS; - case 3: - return MATRIXROWS_PALETTE_TRANSPOSE; - } - break; - case 5: /* program */ - switch (mod) { - case 0: - return MATRIXROWS_PROGRAM; - case 1: - return MATRIXROWS_PROGRAM_INVERSE; - case 2: - return MATRIXROWS_PROGRAM_INVTRANS; - case 3: - return MATRIXROWS_PROGRAM_TRANSPOSE; - } - break; + fprintf(stderr, "\n"); } - - return 0; } -/** - * This takes a node in the parse tree for an OPTIONAL_MASK token - * being derived into a write mask for a register. - * - * This will expand the production number into a 4-component - * write mask. - * - * \param mask_node The parse tree node for the optional_mask non-termina - * \param mask 4-component write mask - */ -static void -get_optional_mask(parse_tree_node * mask_node, GLint * mask) -{ - if (mask_node->prod_applied == 97) { - switch (mask_node->children[0]->prod_applied) { - case 99: /* x */ - mask[0] = 1; - mask[1] = 0; - mask[2] = 0; - mask[3] = 0; - break; - - case 100: /* y */ - mask[0] = 0; - mask[1] = 1; - mask[2] = 0; - mask[3] = 0; - break; - - case 101: /* xy */ - mask[0] = 1; - mask[1] = 1; - mask[2] = 0; - mask[3] = 0; - break; - - case 102: /* z */ - mask[0] = 0; - mask[1] = 0; - mask[2] = 1; - mask[3] = 0; - break; - - case 103: /* xz */ - mask[0] = 1; - mask[1] = 0; - mask[2] = 1; - mask[3] = 0; - break; - - case 104: /* yz */ - mask[0] = 0; - mask[1] = 1; - mask[2] = 1; - mask[3] = 0; - break; - - case 105: /* xyz */ - mask[0] = 1; - mask[1] = 1; - mask[2] = 1; - mask[3] = 0; - break; - - case 106: /* w */ - mask[0] = 0; - mask[1] = 0; - mask[2] = 0; - mask[3] = 1; - break; - - case 107: /* xw */ - mask[0] = 1; - mask[1] = 0; - mask[2] = 0; - mask[3] = 1; - break; - - case 108: /* yw */ - mask[0] = 0; - mask[1] = 1; - mask[2] = 0; - mask[3] = 1; - break; - case 109: /* xyw */ - mask[0] = 1; - mask[1] = 1; - mask[2] = 0; - mask[3] = 1; - break; - - case 110: /* zw */ - mask[0] = 0; - mask[1] = 0; - mask[2] = 1; - mask[3] = 1; - break; - - case 111: /* xzw */ - mask[0] = 1; - mask[1] = 0; - mask[2] = 1; - mask[3] = 1; - break; - - case 112: /* yzw */ - mask[0] = 0; - mask[1] = 1; - mask[2] = 1; - mask[3] = 1; - break; - - case 113: /* xyzw */ - mask[0] = 1; - mask[1] = 1; - mask[2] = 1; - mask[3] = 1; - break; - } - } -} - -/** - * Given a MASKED_DST_REG token in a parse tree node, figure out what - * register number and write mask the production results in. - * - * \param s The parse state - * \param mdr The parse tree node - * \param dest The destination register number - * \param dest_mask The 4-component write mask - */ -static void -get_masked_dst_reg(parse_state * s, parse_tree_node * mdr, GLint * dest, - GLint * dest_mask) -{ - GLint a; - - /* dest is a TEMP variable */ - if (mdr->children[0]->prod_applied == 67) { - a = mdr->children[0]->children[0]->children[0]->children[0]->tok_attr; - *dest = s->binds.reg_num[s->idents.attr[a]]; - printf("dst reg: %d (%s)\n", *dest, s->idents.data[a]); - } - else { - /* dest is a result variable */ - if (mdr->children[0]->children[0]->prod_applied == 86) { - a = mdr->children[0]->children[0]->children[0]->children[0]-> - tok_attr; - *dest = s->binds.reg_num[s->idents.attr[a]]; - printf("dest reg: %d (%s)\n", *dest, s->idents.data[a]); - } - /* dest is an implicit binding to result/output state */ - else { - a = mdr->children[0]->children[0]->children[0]->tok_attr; - *dest = s->binds.reg_num[a]; - printf("dst: %d\n", *dest); - } - } - - /* mdr->children[1] is the write mask */ - get_optional_mask(mdr->children[1], dest_mask); -} - - -/** - * Given a parse tree node with a swizzled src token, figure out the swizzle - * mask. - * - * \param s The parse state - * \param ssr The parse tree node - * \param swz The 4-component swizzle, 0 - x, 1 - y, 2 - z, 3 - w - */ -static void -get_src_swizzle(parse_state * s, parse_tree_node * ssr, GLint * swz) -{ - GLint a; - GLubyte *c; - - if (ssr->prod_applied == 317) { - if (ssr->children[0]->prod_applied == 318) { /* single component */ - switch (ssr->children[0]->children[0]->prod_applied) { - case 93: /* x */ - for (a = 0; a < 4; a++) - swz[a] = 0; - break; - - case 94: /* y */ - for (a = 0; a < 4; a++) - swz[a] = 1; - break; - - case 95: /* z */ - for (a = 0; a < 4; a++) - swz[a] = 2; - break; - - case 96: /* w */ - for (a = 0; a < 4; a++) - swz[a] = 3; - break; - } - } - else { /* 4-component */ - - c = s->idents.data[ssr->children[0]->children[0]->children[0]-> - tok_attr]; - for (a = 0; a < 4; a++) { - switch (c[a]) { - case 'x': - swz[a] = 0; - break; - case 'y': - swz[a] = 1; - break; - case 'z': - swz[a] = 2; - break; - case 'w': - swz[a] = 3; - break; - } - } - } - } -} - - -/** - * Given a parse tree node for a src register with an optional sign, figure out - * what register the src maps to, and what the sign is - * - * \param s The parse state - * \param ssr The parse tree node to work from - * \param sign The sign (1 or -1) - * \param ssrc The src register number - */ -static void -get_optional_sign_and_src_reg(parse_state * s, parse_tree_node * ssr, - int *sign, int *ssrc) -{ - GLint a; - - /* ssr->children[0] is the optionalSign */ - if (ssr->children[0]->prod_applied == 282) { /* - */ - *sign = -1; - } - - /* ssr->children[1] is the srcReg */ - - /* The src is a vertex attrib */ - if (ssr->children[1]->prod_applied == 64) { - if (ssr->children[1]->children[0]->prod_applied == 69) { /* variable */ - a = ssr->children[1]->children[0]->children[0]->children[0]-> - tok_attr; - *ssrc = s->binds.reg_num[s->idents.attr[a]]; - printf("src reg: %d (%s)\n", *ssrc, s->idents.data[a]); - } - else { /* implicit binding */ - - a = ssr->children[1]->children[0]->children[0]->tok_attr; - *ssrc = s->binds.reg_num[a]; - printf("src reg: %d %d (implicit binding)\n", - *ssrc, s->binds.type[a]); - } - } - else - /* The src is a temp variable */ - if (ssr->children[1]->prod_applied == 65) { - a = ssr->children[1]->children[0]->children[0]->children[0]->tok_attr; - *ssrc = s->binds.reg_num[s->idents.attr[a]]; - printf("src reg: %d (%s)\n", *ssrc, s->idents.data[a]); - } - /* The src is a param */ - else { - /* We have a single item */ - if (ssr->children[1]->children[0]->prod_applied == 72) { - a = ssr->children[1]->children[0]->children[0]->children[0]-> - children[0]->tok_attr; - *ssrc = s->binds.reg_num[s->idents.attr[a]]; - printf("src reg: %d (%s)\n", *ssrc, s->idents.data[a]); - } - else - /* We have an array of items */ - if (ssr->children[1]->children[0]->prod_applied == 73) { - a = ssr->children[1]->children[0]->children[0]->children[0]-> - children[0]->tok_attr; - *ssrc = s->binds.reg_num[s->idents.attr[a]]; - - /* We have an absolute offset into the array */ - if (ssr->children[1]->children[0]->children[1]->prod_applied == 77) { - /* Ok, are array will be layed out fully in registers, so we can compute the reg */ - printf("array base: %s\n", s->idents.data[a]); - a = ssr->children[1]->children[0]->children[1]->children[0]-> - children[0]->tok_attr; - printf("array absolute offset: %d\n", s->ints.data[a]); - *ssrc += s->ints.data[a]; - } - /* Otherwise, we have to grab the offset register */ - else { /* progParamArrayRel */ - - /* XXX: We don't know the offset, so we have to grab the offset register # */ - } - } - /* Otherwise, we have an implicit binding */ - else { /* paramSingleItemUse */ - - if (ssr->children[1]->children[0]->children[0]->prod_applied == 148) { /* programSingleItem */ - a = ssr->children[1]->children[0]->children[0]->children[0]-> - tok_attr; - } - else { - a = ssr->children[1]->children[0]->children[0]->children[0]-> - children[0]->tok_attr; - } - *ssrc = s->binds.reg_num[a]; - printf("src reg: %d %d (implicit binding)\n", *ssrc, - s->binds.type[a]); - } - } -} - - -/** - * Figure out what register a src reg is in, as well as the swizzle mask and the - * sign - * - * \param s The parse state - * \param ssr The swizzeled src reg parse tree node - * \param sign The return value for the sign {1, -1} - * \param ssrc The return value for the register number - * \param swz The 4-component swizzle mask - */ -static void -get_swizzle_src_reg(parse_state * s, parse_tree_node * ssr, GLint * sign, - GLint * ssrc, GLint * swz) -{ - get_optional_sign_and_src_reg(s, ssr, sign, ssrc); - - /* ssr->children[2] is the swizzleSuffix */ - get_src_swizzle(s, ssr->children[2], swz); -} - -/** - * Just like get_swizzle_src_reg, but find the scalar value to use from the register instead - * of the swizzle mask - * - * \param s The parse state - * \param ssr The swizzeled src reg parse tree node - * \param sign The return value for the sign {1, -1} - * \param ssrc The return value for the register number - * \param scalar The 1-component scalar number - */ -static void -get_scalar_src_reg(parse_state * s, parse_tree_node * ssr, GLint * sign, - GLint * ssrc, GLint * scalar) -{ - get_optional_sign_and_src_reg(s, ssr, sign, ssrc); - - /* sn->children[2] is a scalarSuffix */ - switch (ssr->children[2]->children[0]->prod_applied) { - case 93: - *scalar = 0; - break; - case 94: - *scalar = 1; - break; - case 95: - *scalar = 2; - break; - case 96: - *scalar = 3; - break; - } -} - -/** - * Recursivly traverse the parse tree and generate Mesa opcodes - * - * \param s The parse state - * \param ptn The parse tree node to process - */ -static void -parse_tree_generate_opcodes(parse_state * s, parse_tree_node * ptn) -{ - GLint a; - GLint opcode, dst, src[3]; - GLint dst_mask[4], src_swz[3][4], src_scalar[2], src_sign[3]; - parse_tree_node *dn, *sn[3]; - - src_sign[0] = src_sign[1] = src_sign[2] = 1; - for (a = 0; a < 4; a++) { - src_swz[0][a] = a; - src_swz[1][a] = a; - src_swz[2][a] = a; - } - src_scalar[0] = src_scalar[1] = src_scalar[2] = 0; - dst_mask[0] = dst_mask[1] = dst_mask[2] = dst_mask[3] = 1; - - switch (ptn->prod_applied) { - case 17: /* ARL */ - opcode = VP_OPCODE_ARL; - - dn = ptn->children[0]; - sn[0] = ptn->children[1]; - - /* dn is a maskedAddrReg */ - /* dn->children[0] is an addrReg */ - /* dn->children[1] is an addrWriteMask */ - /* XXX: do this.. */ - break; - - case 18: /* VECTORop */ - switch (ptn->children[0]->prod_applied) { - case 19: /* ABS */ - opcode = VP_OPCODE_ABS; - break; - case 20: /* FLR */ - opcode = VP_OPCODE_FLR; - break; - case 21: /* FRC */ - opcode = VP_OPCODE_FRC; - break; - case 22: /* LIT */ - opcode = VP_OPCODE_LIT; - break; - case 23: /* MOV */ - opcode = VP_OPCODE_MOV; - break; - } - printf("opcode: %d\n", opcode); - - /* dn is a maskedDstReg */ - dn = ptn->children[1]; - - /* sn is a swizzleSrcReg */ - sn[0] = ptn->children[2]; - - get_masked_dst_reg(s, dn, &dst, dst_mask); - printf("dst: %d mask: %d %d %d %d\n", dst, dst_mask[0], dst_mask[1], - dst_mask[2], dst_mask[3]); - - get_swizzle_src_reg(s, sn[0], &src_sign[0], &src[0], src_swz[0]); - - printf("src sign: %d reg: %d swz: %d %d %d %d\n", - src_sign[0], src[0], src_swz[0][0], src_swz[0][1], src_swz[0][2], - src_swz[0][3]); - break; - - case 24: /* SCALARop */ - switch (ptn->children[0]->prod_applied) { - case 25: /* EX2 */ - opcode = VP_OPCODE_EX2; - break; - case 26: /* EXP */ - opcode = VP_OPCODE_EXP; - break; - case 27: /* LG2 */ - opcode = VP_OPCODE_LG2; - break; - case 28: /* LOG */ - opcode = VP_OPCODE_LOG; - break; - case 29: /* RCP */ - opcode = VP_OPCODE_RCP; - break; - case 30: /* RSQ */ - opcode = VP_OPCODE_RSQ; - break; - } - - printf("opcode: %d\n", opcode); - /* dn is a maskedDstReg */ - dn = ptn->children[1]; - - get_masked_dst_reg(s, dn, &dst, dst_mask); - printf("dst: %d mask: %d %d %d %d\n", dst, dst_mask[0], dst_mask[1], - dst_mask[2], dst_mask[3]); - - /* sn is a scalarSrcReg */ - sn[0] = ptn->children[2]; - - get_scalar_src_reg(s, sn[0], &src_sign[0], &src[0], &src_scalar[0]); - printf("src sign: %d reg: %d scalar: %d\n", src_sign[0], src[0], - src_scalar[0]); - break; - - case 31: /* BINSC */ - opcode = VP_OPCODE_POW; - - printf("opcode: %d\n", opcode); - /* maskedDstReg */ - dn = ptn->children[1]; - get_masked_dst_reg(s, dn, &dst, dst_mask); - printf("dst: %d mask: %d %d %d %d\n", dst, dst_mask[0], dst_mask[1], - dst_mask[2], dst_mask[3]); - - /* sn are scalarSrcReg's */ - sn[0] = ptn->children[2]->children[0]; - sn[1] = ptn->children[2]->children[1]; - - get_scalar_src_reg(s, sn[0], &src_sign[0], &src[0], &src_scalar[0]); - get_scalar_src_reg(s, sn[1], &src_sign[1], &src[1], &src_scalar[1]); - - printf("src0 sign: %d reg: %d scalar: %d\n", src_sign[0], src[0], - src_scalar[0]); - printf("src1 sign: %d reg: %d scalar: %d\n", src_sign[1], src[1], - src_scalar[1]); - break; - - - case 34: /* BIN */ - switch (ptn->children[0]->prod_applied) { - case 36: /* ADD */ - opcode = VP_OPCODE_ADD; - break; - case 37: /* DP3 */ - opcode = VP_OPCODE_DP3; - break; - case 38: /* DP4 */ - opcode = VP_OPCODE_DP4; - break; - case 39: /* DPH */ - opcode = VP_OPCODE_DPH; - break; - case 40: /* DST */ - opcode = VP_OPCODE_DST; - break; - case 41: /* MAX */ - opcode = VP_OPCODE_MAX; - break; - case 42: /* MIN */ - opcode = VP_OPCODE_MIN; - break; - case 43: /* MUL */ - opcode = VP_OPCODE_MUL; - break; - case 44: /* SGE */ - opcode = VP_OPCODE_SGE; - break; - case 45: /* SLT */ - opcode = VP_OPCODE_SLT; - break; - case 46: /* SUB */ - opcode = VP_OPCODE_SUB; - break; - case 47: /* XPD */ - opcode = VP_OPCODE_XPD; - break; - } - - printf("opcode: %d\n", opcode); - - /* maskedDstReg */ - dn = ptn->children[1]; - get_masked_dst_reg(s, dn, &dst, dst_mask); - printf("dst: %d mask: %d %d %d %d\n", dst, dst_mask[0], dst_mask[1], - dst_mask[2], dst_mask[3]); - - /* sn are scalarSrcReg's */ - sn[0] = ptn->children[2]->children[0]; - sn[1] = ptn->children[2]->children[1]; - - get_swizzle_src_reg(s, sn[0], &src_sign[0], &src[0], src_swz[0]); - get_swizzle_src_reg(s, sn[1], &src_sign[1], &src[1], src_swz[1]); - - printf("src0 sign: %d reg: %d swz: %d %d %d %d\n", - src_sign[0], src[0], src_swz[0][0], src_swz[0][1], src_swz[0][2], - src_swz[0][3]); - printf("src1 sign: %d reg: %d swz: %d %d %d %d\n", src_sign[1], src[1], - src_swz[1][0], src_swz[1][1], src_swz[1][2], src_swz[1][3]); - break; - - case 48: /* TRI */ - opcode = VP_OPCODE_MAD; - - printf("opcode: %d\n", opcode); - - /* maskedDstReg */ - dn = ptn->children[1]; - get_masked_dst_reg(s, dn, &dst, dst_mask); - printf("dst: %d mask: %d %d %d %d\n", dst, dst_mask[0], dst_mask[1], - dst_mask[2], dst_mask[3]); - - /* sn are scalarSrcReg's */ - sn[0] = ptn->children[2]->children[0]; - sn[1] = ptn->children[2]->children[1]->children[0]; - sn[2] = ptn->children[2]->children[1]->children[1]; - - get_swizzle_src_reg(s, sn[0], &src_sign[0], &src[0], src_swz[0]); - get_swizzle_src_reg(s, sn[1], &src_sign[1], &src[1], src_swz[1]); - get_swizzle_src_reg(s, sn[2], &src_sign[2], &src[2], src_swz[2]); - - printf("src0 sign: %d reg: %d swz: %d %d %d %d\n", - src_sign[0], src[0], src_swz[0][0], src_swz[0][1], src_swz[0][2], - src_swz[0][3]); - printf("src1 sign: %d reg: %d swz: %d %d %d %d\n", src_sign[1], src[1], - src_swz[1][0], src_swz[1][1], src_swz[1][2], src_swz[1][3]); - printf("src2 sign: %d reg: %d swz: %d %d %d %d\n", src_sign[2], src[2], - src_swz[2][0], src_swz[2][1], src_swz[2][2], src_swz[2][3]); - - } - - for (a = 0; a < 4; a++) { - if (!ptn->children[a]) - return; - parse_tree_generate_opcodes(s, ptn->children[a]); - } -} - -/** - * When we go to examine the parse tree to generate opcodes, things are not exactly pretty to deal with. - * Parameters, constants, matricies, attribute bindings, and the like are represented by large numbers - * of nodes. - * - * In order to keep the code generation code cleaner, we make a recursive pass over the parse tree and 'roll up' these deep - * derivations of the attribs, and replace them with a single token, BINDING_TOKEN. The token attribute for - * BINDING_TOKEN is a index in the 'binding table' where all the relavant info on the chunk of state is stored, - * e.g its type. - * - * For example, the string 'vertex.color.secondary' is represented by 4 productions, and 4 nodes in the parse - * tree. The token at the root of this derivation is NT_VTX_ATTRIB_BINDING_TOKEN. After this folding, - * the token at the root is BINDING_TOKEN, and s->binds[token_attr_at_the_root].type = ATTRIB_COLOR_SECONDARY. - * - * \param s The parse state - * \param ptn The root parse tree node to start folding bindings - */ -static void -parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn) -{ - GLint a, b; - GLint eat_children, bind_type, bind_idx, bind_row, bind_nrows; - GLfloat bind_vals[4]; - parse_tree_node *ptmp; - - eat_children = 0; - bind_row = 0; - bind_nrows = 1; - bind_vals[0] = bind_vals[1] = bind_vals[2] = bind_vals[3] = 0.0f; - switch (ptn->prod_applied) { - /* vertex */ - case 121: - eat_children = 1; - bind_idx = 0; - switch (ptn->children[0]->prod_applied) { - case 122: /* position */ - bind_type = ATTRIB_POSITION; - break; - case 123: /* weight */ - bind_type = ATTRIB_WEIGHT; - if (ptn->children[0]->children[0]->prod_applied == 132) { - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - children[0]->tok_attr]; - } - break; - case 124: /* normal */ - bind_type = ATTRIB_NORMAL; - break; - case 125: /* color */ - bind_type = ATTRIB_COLOR_PRIMARY; - if (ptn->children[0]->children[0]->prod_applied == 306) { - if (ptn->children[0]->children[0]->children[0]->prod_applied == - 309) - bind_type = ATTRIB_COLOR_SECONDARY; - } - break; - case 126: /* fogcoord */ - bind_type = ATTRIB_FOGCOORD; - break; - case 127: /* texcoord */ - bind_type = ATTRIB_TEXCOORD; - if (ptn->children[0]->children[0]->prod_applied == 311) { - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - children[0]->tok_attr]; - } - break; - case 128: /* matrixindex */ - bind_type = ATTRIB_MATRIXINDEX; - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - tok_attr]; - break; - case 129: /* attrib */ - bind_type = ATTRIB_ATTRIB; - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - tok_attr]; - break; - } - break; - - /* state */ - case 154: - case 172: /* material */ - eat_children = 2; - bind_idx = 0; - ptmp = ptn->children[0]->children[0]; - - a = 0; - if (ptmp->prod_applied == 182) { - a = 1; - b = 0; - } - else - if ((ptmp->prod_applied == 183) - && (ptmp->children[0]->prod_applied == 305)) { - a = 1; - b = 1; - } - - /* no explicit face, or explicit front */ - if (a) { - switch (ptmp->children[b]->prod_applied) { - case 184: /* ambient */ - bind_type = MATERIAL_FRONT_AMBIENT; - break; - case 185: /* diffuse */ - bind_type = MATERIAL_FRONT_DIFFUSE; - break; - case 186: /* specular */ - bind_type = MATERIAL_FRONT_SPECULAR; - break; - case 187: /* emission */ - bind_type = MATERIAL_FRONT_EMISSION; - break; - case 188: /* shininess */ - bind_type = MATERIAL_FRONT_SHININESS; - break; - } - } - /* has explicit back face */ - else { - switch (ptmp->children[1]->prod_applied) { - case 184: /* ambient */ - bind_type = MATERIAL_BACK_AMBIENT; - break; - case 185: /* diffuse */ - bind_type = MATERIAL_BACK_DIFFUSE; - break; - case 186: /* specular */ - bind_type = MATERIAL_BACK_SPECULAR; - break; - case 187: /* emission */ - bind_type = MATERIAL_BACK_EMISSION; - break; - case 188: /* shininess */ - bind_type = MATERIAL_BACK_SHININESS; - break; - } - } - break; - case 155: - case 173: /* light */ - eat_children = 2; - bind_idx = 0; - printf("FOLDING LIGHT!\n"); - ptmp = ptn->children[0]; - bind_idx = s->ints.data[ptmp->children[0]->children[0]->tok_attr]; - switch (ptmp->children[1]->children[0]->prod_applied) { - case 191: /* ambient */ - bind_type = LIGHT_AMBIENT; - break; - case 192: /* diffuse */ - bind_type = LIGHT_DIFFUSE; - break; - case 193: /* specular */ - bind_type = LIGHT_SPECULAR; - break; - case 194: /* position */ - bind_type = LIGHT_POSITION; - break; - case 195: /* attenuation */ - bind_type = LIGHT_ATTENUATION; - break; - case 196: /* spot */ - bind_type = LIGHT_SPOT_DIRECTION; - break; - case 197: /* half */ - bind_type = LIGHT_HALF; - break; - } - break; - - case 156: - case 174: /* lightmodel */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - switch (ptmp->prod_applied) { - case 201: /* ambient */ - bind_type = LIGHTMODEL_AMBIENT; - break; - case 202: /* scenecolor */ - bind_type = LIGHTMODEL_FRONT_SCENECOLOR; - break; - case 203: /* foo.scenecolor */ - if (ptmp->children[0]->prod_applied == 304) - bind_type = LIGHTMODEL_FRONT_SCENECOLOR; - else - bind_type = LIGHTMODEL_BACK_SCENECOLOR; - } - break; - case 157: - case 175: /* lightprod */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - bind_idx = s->ints.data[ptmp->children[0]->children[0]->tok_attr]; - /* No explicit face */ - if (ptmp->children[1]->children[0]->prod_applied == 206) { - a = 1; /* front */ - b = 0; /* 0-th child */ - } - else - if ((ptmp->children[1]->children[0]->prod_applied == 207) && - (ptmp->children[1]->children[0]->children[0]->prod_applied == - 304)) { - a = 1; /* front */ - b = 1; /* 1-th child */ - } - else { - a = 0; - b = 1; - } - if (a) { - switch (ptmp->children[1]->children[0]->children[b]->prod_applied) { - case 208: /* ambient */ - bind_type = LIGHTPROD_FRONT_AMBIENT; - break; - case 209: /* diffuse */ - bind_type = LIGHTPROD_FRONT_DIFFUSE; - break; - case 210: /* specular */ - bind_type = LIGHTPROD_FRONT_SPECULAR; - break; - } - } - else { - switch (ptmp->children[1]->children[0]->children[b]->prod_applied) { - case 208: /* ambient */ - bind_type = LIGHTPROD_BACK_AMBIENT; - break; - case 209: /* diffuse */ - bind_type = LIGHTPROD_BACK_DIFFUSE; - break; - case 210: /* specular */ - bind_type = LIGHTPROD_BACK_SPECULAR; - break; - } - } - break; - case 158: - case 176: /* texgen */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - if (ptmp->children[0]->prod_applied == 311) - bind_idx = - s->ints.data[ptmp->children[0]->children[0]->children[0]-> - tok_attr]; - ptmp = ptn->children[0]->children[1]; - if (ptmp->children[0]->prod_applied == 214) - a = 1; /* eye */ - else - a = 0; /* object */ - b = ptmp->children[1]->prod_applied - 216; - if (a == 1) { - switch (b) { - case 0: - bind_type = TEXGEN_EYE_S; - break; - case 1: - bind_type = TEXGEN_EYE_T; - break; - case 2: - bind_type = TEXGEN_EYE_R; - break; - case 3: - bind_type = TEXGEN_EYE_Q; - break; - } - } - else { - switch (b) { - case 0: - bind_type = TEXGEN_OBJECT_S; - break; - case 1: - bind_type = TEXGEN_OBJECT_T; - break; - case 2: - bind_type = TEXGEN_OBJECT_R; - break; - case 3: - bind_type = TEXGEN_OBJECT_Q; - break; - } - } - break; - case 159: - case 177: /* fog */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - if (ptmp->children[0]->prod_applied == 221) - bind_type = FOG_COLOR; - else - bind_type = FOG_PARAMS; - break; - case 160: - case 178: /* clip */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - bind_idx = s->ints.data[ptmp->children[0]->children[0]->tok_attr]; - bind_type = CLIP_PLANE; - break; - case 161: - case 179: /* point */ - eat_children = 2; - bind_idx = 0; - - ptmp = ptn->children[0]; - if (ptmp->children[0]->prod_applied == 227) - bind_type = POINT_SIZE; - else - bind_type = POINT_ATTENUATION; - break; - - case 162: /* matrix rows/whole matrix */ - eat_children = 2; - bind_idx = 0; - { - parse_tree_node *mname; - GLint mod = 0; - GLint name = 0; - - mname = ptn->children[0]; - switch (mname->prod_applied) { - case 238: /* modelview */ - name = 0; - if (mname->children[0]->prod_applied == 245) - bind_idx = - s->ints.data[mname->children[0]->children[0]->children[0]-> - tok_attr]; - break; - case 239: /* projection */ - name = 1; - break; - case 240: /* mvp */ - name = 2; - break; - case 241: /* texture */ - if (mname->children[0]->prod_applied == 311) - bind_idx = - s->ints.data[mname->children[0]->children[0]->children[0]-> - tok_attr]; - name = 3; - break; - case 242: /* palette */ - bind_idx = - s->ints.data[mname->children[0]->children[0]->tok_attr]; - name = 4; - break; - case 243: /* program */ - bind_idx = - s->ints.data[mname->children[0]->children[0]->tok_attr]; - name = 5; - break; - } - - ptmp = ptn->children[1]; - if (ptmp->prod_applied == 316) { - bind_type = name_and_mod_to_matrixrows(name, mod); - bind_row = 0; - bind_nrows = 4; - } - else { - if (ptmp->children[0]->prod_applied == 164) { - switch (ptmp->children[0]->children[0]->prod_applied) { - case 234: /* inverse */ - mod = 1; - break; - case 235: /* transpose */ - mod = 3; - break; - case 236: /* invtrans */ - mod = 2; - break; - } - if (ptmp->children[0]->children[1]->prod_applied == 166) { - bind_type = name_and_mod_to_matrixrows(name, mod); - bind_row = 0; - bind_nrows = 4; - } - else { /* prod 167 */ - - bind_type = name_and_mod_to_matrixrows(name, mod); - bind_row = - s->ints.data[ptmp->children[0]->children[1]-> - children[0]->children[0]->children[0]-> - tok_attr]; - if (ptmp->children[0]->children[1]->children[0]-> - children[1]->prod_applied == 169) - bind_nrows = 1; - else { - bind_nrows = - s->ints.data[ptmp->children[0]->children[1]-> - children[0]->children[1]->children[0]-> - children[0]->tok_attr] - bind_row + 1; - } - } - } - else { /* prod 165 */ - - bind_type = name_and_mod_to_matrixrows(name, mod); - - bind_row = - s->ints.data[ptmp->children[0]->children[0]->children[0]-> - tok_attr]; - if (ptmp->children[0]->children[1]->prod_applied == 169) - bind_nrows = 1; - else - bind_nrows = - s->ints.data[ptmp->children[0]->children[1]-> - children[0]->children[0]->tok_attr] - - bind_row + 1; - } - } - } - - printf("folding matrixrows: %d %d %d %d\n", bind_type, bind_idx, - bind_row, bind_nrows); - break; - - case 180: /* matrix row */ - eat_children = 2; - bind_idx = 0; - - { - GLint mod; - parse_tree_node *mname, *mrow; - - ptmp = ptn->children[0]; - mname = ptmp->children[0]; - mod = 0; - if (ptmp->children[1]->children[0]->prod_applied == 232) { - mrow = - ptmp->children[1]->children[0]->children[1]->children[0]-> - children[0]; - switch (ptmp->children[1]->children[0]->children[0]->prod_applied) { - case 234: - mod = 1; /* inverse */ - break; - case 235: - mod = 2; /* transpose */ - break; - case 236: - mod = 3; /* invtrans */ - break; - } - } - else { - mrow = ptmp->children[1]->children[0]->children[0]->children[0]; - } - bind_row = s->ints.data[mrow->tok_attr]; - - switch (mname->prod_applied) { - case 238: /* modelview */ - if (mname->children[0]->prod_applied == 245) { - bind_idx = - s->ints.data[mname->children[0]->children[0]->children[0]-> - tok_attr]; - } - switch (mod) { - case 0: - bind_type = MATRIXROW_MODELVIEW; - break; - case 1: - bind_type = MATRIXROW_MODELVIEW_INVERSE; - break; - case 2: - bind_type = MATRIXROW_MODELVIEW_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_MODELVIEW_INVTRANS; - } - break; - - case 239: /* projection */ - switch (mod) { - case 0: - bind_type = MATRIXROW_PROJECTION; - break; - case 1: - bind_type = MATRIXROW_PROJECTION_INVERSE; - break; - case 2: - bind_type = MATRIXROW_PROJECTION_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_PROJECTION_INVTRANS; - } - break; - - case 240: /* mvp */ - switch (mod) { - case 0: - bind_type = MATRIXROW_MVP; - break; - case 1: - bind_type = MATRIXROW_MVP_INVERSE; - break; - case 2: - bind_type = MATRIXROW_MVP_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_MVP_INVTRANS; - } - break; - - case 241: /* texture */ - if (mname->children[0]->prod_applied == 311) { - bind_idx = - s->ints.data[mname->children[0]->children[0]->children[0]-> - tok_attr]; - } - switch (mod) { - case 0: - bind_type = MATRIXROW_TEXTURE; - break; - case 1: - bind_type = MATRIXROW_TEXTURE_INVERSE; - break; - case 2: - bind_type = MATRIXROW_TEXTURE_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_TEXTURE_INVTRANS; - } - break; - - case 242: /* palette */ - bind_idx = - s->ints.data[mname->children[0]->children[0]->tok_attr]; - switch (mod) { - case 0: - bind_type = MATRIXROW_PALETTE; - break; - case 1: - bind_type = MATRIXROW_PALETTE_INVERSE; - break; - case 2: - bind_type = MATRIXROW_PALETTE_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_PALETTE_INVTRANS; - } - break; - - case 243: /* program */ - bind_idx = - s->ints.data[mname->children[0]->children[0]->tok_attr]; - switch (mod) { - case 0: - bind_type = MATRIXROW_PROGRAM; - break; - case 1: - bind_type = MATRIXROW_PROGRAM_INVERSE; - break; - case 2: - bind_type = MATRIXROW_PROGRAM_TRANSPOSE; - break; - case 3: - bind_type = MATRIXROW_PROGRAM_INVTRANS; - } - break; - } - } - break; - - /* program (single) */ - case 249: - eat_children = 1; - bind_idx = 0; - switch (ptn->children[0]->prod_applied) { - case 250: /* env */ - bind_type = PROGRAM_ENV_SINGLE; - break; - case 251: /* local */ - bind_type = PROGRAM_LOCAL_SINGLE; - break; - } - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - children[0]->tok_attr]; - break; - - /* program (multi) */ - case 252: - eat_children = 1; - bind_idx = 0; - switch (ptn->children[0]->prod_applied) { - case 253: /* env */ - case 254: /* local */ - if (ptn->children[0]->prod_applied == 253) - bind_type = PROGRAM_ENV_MULTI; - else - bind_type = PROGRAM_LOCAL_MULTI; - - ptmp = ptn->children[0]->children[0]->children[0]; - bind_idx = bind_row = - s->ints.data[ptmp->children[0]->children[0]->tok_attr]; - bind_nrows = 1; - - ptmp = ptn->children[0]->children[0]->children[0]->children[1]; - if ((ptmp->prod_applied == 257) || (ptmp->prod_applied == 262)) - bind_nrows = - s->ints.data[ptmp->children[0]->children[0]->tok_attr] - - bind_idx; - break; - } - break; - -#define FOLD_FLOAT_CONSTANT(float_ptr, bind_vals_idx, sign) \ - if (float_ptr->tok == 49) /* GLfloat */ {\ - bind_vals[bind_vals_idx] = sign * (GLfloat) s->floats.data[float_ptr->tok_attr];\ - }\ - else /* GLint */ {\ - bind_vals[bind_vals_idx] = sign * s->ints.data[float_ptr->tok_attr];\ - } - -#define FOLD_SIGNED_FLOAT_CONSTANT(sf_ptr, bind_vals_idx) \ - {\ - GLfloat __mul = 1.0F;\ - if (sf_ptr->children[0]->prod_applied == 282) \ - __mul = -1.0F;\ - FOLD_FLOAT_CONSTANT(sf_ptr->children[1], bind_vals_idx, __mul);\ - } - - /* const scalar decl */ - case 271: - eat_children = 1; - bind_idx = 0; - bind_type = CONSTANT; - - FOLD_SIGNED_FLOAT_CONSTANT(ptn->children[0], 0); -#if 0 - { - GLfloat mul = 1.; - if (ptn->children[0]->children[0]->prod_applied == 282) { - mul = -1; - } - - FOLD_FLOAT_CONSTANT(ptn->children[0]->children[1], 0, mul); - } -#endif - break; - - /* const vector */ - case 273: - eat_children = 1; - bind_idx = 0; - bind_type = CONSTANT; - - FOLD_SIGNED_FLOAT_CONSTANT(ptn->children[0], 0); - if (ptn->children[1]->prod_applied == 275) { - FOLD_SIGNED_FLOAT_CONSTANT(ptn->children[1]->children[0], 1); - if (ptn->children[1]->children[1]->prod_applied == 277) { - FOLD_SIGNED_FLOAT_CONSTANT(ptn->children[1]->children[1]-> - children[0], 2); - if (ptn->children[1]->children[1]->children[1]->prod_applied == - 279) { - FOLD_SIGNED_FLOAT_CONSTANT(ptn->children[1]->children[1]-> - children[1]->children[0], 3); - } - } - } - break; - - /* result */ - case 289: - eat_children = 1; - bind_idx = 0; - switch (ptn->children[0]->prod_applied) { - case 290: /* position */ - bind_type = RESULT_POSITION; - break; - case 291: /* fogcoord */ - bind_type = RESULT_FOGCOORD; - break; - case 292: /* pointsize */ - bind_type = RESULT_POINTSIZE; - break; - case 293: /* color */ - bind_type = RESULT_COLOR_FRONT_PRIMARY; - ptmp = ptn->children[0]->children[0]->children[0]; - if (ptmp->prod_applied == 297) { - if (ptmp->children[0]->prod_applied == 298) { /* front */ - if (ptmp->children[0]->children[0]->prod_applied == 301) { - if (ptmp->children[0]->children[0]->children[0]->prod_applied == 303) /* secondary */ - bind_type = RESULT_COLOR_FRONT_SECONDARY; - } - } - else { /* back */ - - bind_type = RESULT_COLOR_BACK_PRIMARY; - if (ptmp->children[0]->children[0]->prod_applied == 301) { - if (ptmp->children[0]->children[0]->children[0]->prod_applied == 303) /* secondary */ - bind_type = RESULT_COLOR_BACK_SECONDARY; - } - - } - } - break; - case 294: /* texcoord */ - bind_type = RESULT_TEXCOORD; - if (ptn->children[0]->children[0]->prod_applied == 311) { - bind_idx = - s->ints.data[ptn->children[0]->children[0]->children[0]-> - children[0]->tok_attr]; - } - break; - } - break; - } - - /* Mmmmm... baaaaby */ - if (eat_children) { - if (eat_children == 2) - parse_tree_free_children(ptn->children[0]); - else - parse_tree_free_children(ptn); - - /* Insert the binding into the binding table */ - ptn->tok = BINDING_TOKEN; - ptn->tok_attr = - binding_table_add(&s->binds, bind_type, bind_idx, bind_row, - bind_nrows, bind_vals); - - printf("Got binding %d %d %d %d at pos %d in bind tab [%f %f %f %f]\n", - bind_type, bind_idx, bind_row, bind_nrows, ptn->tok_attr, - bind_vals[0], bind_vals[1], bind_vals[2], bind_vals[3]); - } - - - for (a = 0; a < 4; a++) { - if (!ptn->children[a]) - return; - - parse_tree_fold_bindings(s, ptn->children[a]); - } -} - -/** - * After we have figured out what mess of parse tree actually represents GL state (or constants, or - * whatnot), we have to line up variables with the state. For example, a line something like - * - * OUTPUT foo = result.position; - * - * We would have 'foo' in the identifier table at some position foo_idx, and 'result.position' in the - * binding table at some position res_pos_idx. To set things up such that 'foo' is associated with - * the result position state, we need to set ident[foo_idx].attr = res_pos_idx so we can generate - * opcodes without going bonkers. - * - * This function works on OUTPUT, ATTRIB, and PARAM single bindings. PARAM array bindings are handled in - * parse_tree_assign_param_arrays(). - * - * \param s The parse state - * \param ptn The root of the parse tree from which to start lining up state and variables - */ -static void -parse_tree_assign_bindings(parse_state * s, parse_tree_node * ptn) -{ - GLint a; - parse_tree_node *var_name, *attr_item; - - /* OUTPUT, ATTRIB */ - if ((ptn->prod_applied == 288) || (ptn->prod_applied == 120)) { - var_name = ptn->children[0]->children[0]; - attr_item = ptn->children[1]; - - if (attr_item->tok != BINDING_TOKEN) { - fprintf(stderr, - "sanity check: trying to bind an output variable to something funky!\n"); - return; - } - - s->idents.attr[var_name->tok_attr] = attr_item->tok_attr; - printf("result: %s bound to %d\n", s->idents.data[var_name->tok_attr], - s->binds.type[s->idents.attr[var_name->tok_attr]]); - return; - } - - /* stateSingleItemDecl */ - if (ptn->prod_applied == 134) { - var_name = ptn->children[0]->children[0]; - if (ptn->children[1]->prod_applied == 135) { - if (ptn->children[1]->children[0]->prod_applied == 139) { - if (ptn->children[1]->children[0]->children[0]->prod_applied == - 144) - attr_item = - ptn->children[1]->children[0]->children[0]->children[0]-> - children[0]; - else if (ptn->children[1]->children[0]->children[0]-> - prod_applied == 145) - attr_item = - ptn->children[1]->children[0]->children[0]->children[0]; - else - attr_item = - ptn->children[1]->children[0]->children[0]->children[0]-> - children[0]; - - if (attr_item->tok != BINDING_TOKEN) { - fprintf(stderr, - "sanity check: trying to bind an param variable (%s) to something funky! [%d]\n", - s->idents.data[var_name->tok_attr], attr_item->tok); - exit(1); - } - - s->idents.attr[var_name->tok_attr] = attr_item->tok_attr; - printf("result: %s bound to %d\n", - s->idents.data[var_name->tok_attr], - s->binds.type[s->idents.attr[var_name->tok_attr]]); - return; - } - } - - } - - /* else, recurse on all our children */ - for (a = 0; a < 4; a++) { - if (!ptn->children[a]) - return; - - parse_tree_assign_bindings(s, ptn->children[a]); - } - -} - -/** - * This handles lining up PARAM arrays with variables, much like parse_tree_assign_bindings(). - * - * In parse_tree_assign_bindings, we set the identifier attr to the index into the binding table of - * the bound state. - * - * Here, instead, we allocate a slot in the 'array table' to stick the bound state into. Instead - * of an index into the binding table, the identifier attr now holds the index into the array table. - * - * \param s The parse state - * \param pnt The root parse tree node to handle arrays from - * - */ -static void -parse_tree_assign_param_arrays(parse_state * s, parse_tree_node * ptn) -{ - GLint a, is_mult, array_len; - parse_tree_node *var_name, *binding, *arraysize, *ptmp; - - /* If we're a param */ - if (ptn->prod_applied == 134) { - /* establish name */ - var_name = ptn->children[0]; - - /* param_statement2 */ - binding = ptn->children[1]; - if (binding->prod_applied == 136) { - /* optarraysize */ - arraysize = binding->children[0]; - - is_mult = 0; - - /* foo[3] */ - if (arraysize->prod_applied == 138) { - debug_token(s, var_name->children[0]->tok, - var_name->children[0]->tok_attr); - debug_token(s, arraysize->children[0]->tok, - arraysize->children[0]->tok_attr); - printf("\n"); - is_mult = 1; - } - else - /* foo[] */ - if (arraysize->prod_applied == 137) { - arraysize = NULL; - printf("How do I init a PARAM array like foo[]?? \n"); - is_mult = 1; - } - - if (!is_mult) - return; - - s->idents.attr[var_name->tok_attr] = array_table_new(&s->arrays); - - binding = binding->children[1]->children[0]; - ptmp = binding->children[0]; - array_len = 0; - - if (ptmp->prod_applied == 150) { /* state */ - printf("matrix 0 [state]:\n"); - printf("%d %d\n", ptmp->children[0]->children[0]->tok, - ptmp->children[0]->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->children[0]->tok_attr); - array_len += - s->binds.num_rows[ptmp->children[0]->children[0]->tok_attr]; - } - else if (ptmp->prod_applied == 151) { /* program */ - printf("matrix 0 [program]:\n"); - printf("%d %d\n", ptmp->children[0]->tok, - ptmp->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->tok_attr); - array_len += s->binds.num_rows[ptmp->children[0]->tok_attr]; - } - else { /* constant */ - - printf("matrix 0 [constant]:\n"); - printf("%d %d\n", ptmp->children[0]->children[0]->tok, - ptmp->children[0]->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->children[0]->tok_attr); - array_len += - s->binds.num_rows[ptmp->children[0]->children[0]->tok_attr]; - } - binding = binding->children[1]; - - while (binding->prod_applied != 143) { - ptmp = binding->children[0]->children[0]; - printf("mat: %d\n", ptmp->prod_applied); - if (ptmp->prod_applied == 150) { /* state */ - printf("matrix %d:\n", array_len); - printf("%d %d\n", ptmp->children[0]->children[0]->tok, - ptmp->children[0]->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->children[0]->tok_attr); - array_len += - s->binds.num_rows[ptmp->children[0]->children[0]->tok_attr]; - } - else if (ptmp->prod_applied == 151) { /* program */ - printf("matrix %d [program]:\n", array_len); - printf("%d %d\n", ptmp->children[0]->tok, - ptmp->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->tok_attr); - array_len += s->binds.num_rows[ptmp->children[0]->tok_attr]; - } - else { /* constant */ - - printf("matrix %d [constant]:\n", array_len); - printf("%d %d\n", ptmp->children[0]->children[0]->tok, - ptmp->children[0]->children[0]->tok_attr); - array_table_add_data(&s->arrays, - s->idents.attr[var_name->tok_attr], - ptmp->children[0]->children[0]->tok_attr); - array_len += - s->binds.num_rows[ptmp->children[0]->children[0]->tok_attr]; - } - binding = binding->children[0]->children[1]; - } - - /* XXX: have to compare the requested size, and the actual - * size, and fix up any inconsistancies - */ - if (arraysize) { - printf("matrix wants to get %d rows\n", - s->ints.data[arraysize->children[0]->tok_attr]); - } - printf("matrix num rows: %d\n", array_len); - } - - return; - } - - /* Else, recurse on all our children */ - for (a = 0; a < 4; a++) { - if (!ptn->children[a]) - return; - - parse_tree_assign_param_arrays(s, ptn->children[a]); - } - -} - -/* XXX: This needs to be written properly. */ -/** - * Here we allocate 'registers' for all of the various variables and bound state. - * - * The 'register' number is given by the reg_num field in the binding table. Note that this field - * is not stored in the identifier table. If it were, we would need a different mechanism for handling - * implicit bindings. - * - * However, after some discussion with Brian, implicit bindings may be handled by grabbing state - * directly from Mesa's state structs. This might be a little hairy here, maybe not.. Implicit - * bindings are those in the binding table that are not pointed to by any ident.attr or array.data - * - * This should also do various error checking, like the multiple vertex attrib error, or 'too many bindings' - * error. - * - * \param s The parse state - */ -static void -assign_regs(parse_state * s) -{ - GLint a; - GLfloat foo[4]; - - for (a = 0; a < s->idents.len; a++) { - if (s->idents.type[a] == TYPE_TEMP) { - s->idents.attr[a] = - binding_table_add(&s->binds, TYPE_TEMP, 0, 0, 0, foo); - } - } -} - -/** - * Parse/compile the 'str' returning the compiled 'program'. - * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos - * indicates the position of the error in 'str'. - */ void _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target, - const GLubyte * string, GLsizei len, + const GLubyte * str, GLsizei len, struct vertex_program *program) { - GLubyte *our_string; - parse_state *state; - - /* XXX: How do I handle these errors? */ - if (len < 10 || _mesa_strncmp((const char *) string, "!!ARBvp1.0", 10)) { - ctx->Program.ErrorPos = 0; - _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramStringARB(bad header)"); - return; - } + GLuint retval; + struct arb_program ap; + + retval = _mesa_parse_arb_program(ctx, str, len, &ap); - /* Make a null-terminated copy of the program string */ - our_string = (GLubyte *) MALLOC(len + 1); - if (!our_string) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); + /* XXX: Parse error. Cleanup things and return */ + if (retval) + { return; } - MEMCPY(our_string, string, len); - our_string[len] = 0; - state = parse_state_init(our_string + 10, _mesa_strlen((char *) our_string) - 10); - - if (parse(state) == ARB_VP_SUCESS) { - printf("parse sucess!\n"); - } - else { - printf("*** error\n"); - parse_state_cleanup(state); - return; - } - - /* First, we 'fold' bindings from a big mess of productions and - * tokens into one BINDING_TOKEN, which points to an entry - * in the binding sym table that holds all of the relevant - * info for the binding destination. - */ - parse_tree_fold_bindings(state, state->pt_head); - - /* Now, for each type of binding, walk the parse tree and stick - * the index into the binding sym table - */ - parse_tree_assign_bindings(state, state->pt_head); - - /* XXX: this still needs a' fixin to get folded bindings - * -- it does? wtf do I mean? */ - parse_tree_assign_param_arrays(state, state->pt_head); - - /* XXX: Now, assign registers. For this, we'll need to create - * bindings for all temps (and what else?? ) - */ - assign_regs(state); - - /* Ok, now generate code */ - parse_tree_generate_opcodes(state, state->pt_head); - - /* Just for testing.. */ - program->Base.Target = target; - if (program->Base.String) { - FREE(program->Base.String); + /* XXX: Eh.. we parsed something that wasn't a vertex program. doh! */ + if (ap.type != GL_VERTEX_PROGRAM_ARB) + { + return; } - program->Base.String = our_string; - program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB; - - if (program->Instructions) { - FREE(program->Instructions); - } - - program->Instructions = - (struct vp_instruction *) _mesa_malloc(sizeof(struct vp_instruction)); - program->Instructions[0].Opcode = VP_OPCODE_END; - program->InputsRead = 0; - program->OutputsWritten = 0; - program->IsPositionInvariant = 0; - - parse_state_cleanup(state); + +#if DEBUG_VP + debug_vp_inst(ap.Base.NumInstructions, ap.VPInstructions); +#endif - /* TODO: - * - handle implicit state grabbing & register allocation like discussed - * - implicit param declarations -- see above - * - * - variable bindings -- ADDRESS - * - deal with explicit array sizes & size mismatches - * - shuddup all my debugging crap - * - grep for XXX - * - multiple vtx attrib binding error - * - What do I do on look ahead for prod 54 & 55? (see arbvp_grammar.txt) - * - misc errors - * - check integer ranges - * - check array index ranges - * - check variable counts - * - param register allocation - * - exercise swizzles and masks - * - error handling - * - generate opcodes - * + Get addres registers for relative offsets in PARAM arrays - * + Properly encode implicit PARAMs and ATTRIBs. - * + ARL - * + SWZ - * + actually emit Mesa opcodes - * - segfaults while freeing stuff - * - OPTION + /* copy the relvant contents of the arb_program struct into the + * fragment_program struct */ + program->Base.NumInstructions = ap.Base.NumInstructions; + program->Base.NumTemporaries = ap.Base.NumTemporaries; + program->Base.NumParameters = ap.Base.NumParameters; + program->Base.NumAttributes = ap.Base.NumAttributes; + program->Base.NumAddressRegs = ap.Base.NumAddressRegs; + + program->Instructions = ap.VPInstructions; + program->IsPositionInvariant = ap.HintPositionInvariant; + program->InputsRead = ap.InputsRead; + program->OutputsWritten = ap.OutputsWritten; + program->Parameters = ap.Parameters; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 198bb34cbb9..62d968a32fa 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -65,7 +65,7 @@ new_attrib_node( GLbitfield kind ) } -void +void GLAPIENTRY _mesa_PushAttrib(GLbitfield mask) { struct gl_attrib_node *newnode; @@ -783,7 +783,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) * We could at least check if the value to restore equals the current value * and then skip the Mesa call. */ -void +void GLAPIENTRY _mesa_PopAttrib(void) { struct gl_attrib_node *attr, *next; @@ -1138,7 +1138,7 @@ _mesa_PopAttrib(void) #define GL_CLIENT_UNPACK_BIT (1<<21) -void +void GLAPIENTRY _mesa_PushClientAttrib(GLbitfield mask) { struct gl_attrib_node *newnode; @@ -1190,7 +1190,7 @@ _mesa_PushClientAttrib(GLbitfield mask) -void +void GLAPIENTRY _mesa_PopClientAttrib(void) { struct gl_attrib_node *attr, *next; diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h index 82676246373..09d75196b23 100644 --- a/src/mesa/main/attrib.h +++ b/src/mesa/main/attrib.h @@ -43,16 +43,16 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_PushAttrib( GLbitfield mask ); -extern void +extern void GLAPIENTRY _mesa_PopAttrib( void ); -extern void +extern void GLAPIENTRY _mesa_PushClientAttrib( GLbitfield mask ); -extern void +extern void GLAPIENTRY _mesa_PopClientAttrib( void ); extern void diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index dad5184dd92..e5032bf1bb6 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -50,7 +50,7 @@ * flushes the vertices and notifies the driver via * dd_function_table::BlendFunc callback. */ -void +void GLAPIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) { @@ -144,7 +144,7 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) * On a change, flush the vertices and notify the driver via * dd_function_table::BlendFuncSeparate. */ -void +void GLAPIENTRY _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -285,7 +285,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, /* This is really an extension function! */ -void +void GLAPIENTRY _mesa_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -334,8 +334,9 @@ _mesa_BlendEquation( GLenum mode ) /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. */ - ctx->Color.ColorLogicOpEnabled = (mode==GL_LOGIC_OP && - ctx->Color.BlendEnabled); + ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled || + (ctx->Color.BlendEnabled && + mode == GL_LOGIC_OP)); if (ctx->Driver.BlendEquation) (*ctx->Driver.BlendEquation)( ctx, mode ); @@ -358,7 +359,7 @@ _mesa_BlendEquation( GLenum mode ) * change, flushes the vertices and notifies the driver via * dd_function_table::BlendColor callback. */ -void +void GLAPIENTRY _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; @@ -391,7 +392,7 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) * On a change, flushes the vertices and notifies the driver via * dd_function_table::AlphaFunc callback. */ -void +void GLAPIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); @@ -436,7 +437,7 @@ gl_colorbuffer_attrib::LogicOp. * On a change, flushes the vertices and notifies the driver via the * dd_function_table::LogicOpcode callback. */ -void +void GLAPIENTRY _mesa_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); @@ -476,7 +477,7 @@ _mesa_LogicOp( GLenum opcode ) } #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); @@ -508,7 +509,7 @@ _mesa_IndexMask( GLuint mask ) * change, flushes the vertices and notifies the driver via the * dd_function_table::ColorMask callback. */ -void +void GLAPIENTRY _mesa_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { @@ -572,6 +573,7 @@ void _mesa_init_color( GLcontext * ctx ) ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 ); ctx->Color.IndexLogicOpEnabled = GL_FALSE; ctx->Color.ColorLogicOpEnabled = GL_FALSE; + ctx->Color._LogicOpEnabled = GL_FALSE; ctx->Color.LogicOp = GL_COPY; ctx->Color.DitherFlag = GL_TRUE; diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h index a967937e682..ae96bd46b65 100644 --- a/src/mesa/main/blend.h +++ b/src/mesa/main/blend.h @@ -36,39 +36,39 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); -extern void +extern void GLAPIENTRY _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ); -extern void +extern void GLAPIENTRY _mesa_BlendEquation( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -extern void +extern void GLAPIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref ); -extern void +extern void GLAPIENTRY _mesa_LogicOp( GLenum opcode ); -extern void +extern void GLAPIENTRY _mesa_IndexMask( GLuint mask ); -extern void +extern void GLAPIENTRY _mesa_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); -extern void +extern void _mesa_init_color( GLcontext * ctx ); #endif diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e47065415db..0f70829ff49 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -62,7 +62,7 @@ buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str ) break; default: _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str); - break; + return NULL; } if (bufObj->Name == 0) @@ -347,6 +347,18 @@ _mesa_init_buffer_objects( GLcontext *ctx ) for (i = 0; i < VERT_ATTRIB_MAX; i++) { ctx->Array.VertexAttrib[i].BufferObj = ctx->Array.NullBufferObj; } + + /* Device drivers might override these assignments after the Mesa + * context is initialized. + */ + ctx->Driver.NewBufferObject = _mesa_new_buffer_object; + ctx->Driver.DeleteBuffer = _mesa_delete_buffer_object; + ctx->Driver.BindBuffer = NULL; + ctx->Driver.BufferData = _mesa_buffer_data; + ctx->Driver.BufferSubData = _mesa_buffer_subdata; + ctx->Driver.GetBufferSubData = _mesa_buffer_get_subdata; + ctx->Driver.MapBuffer = _mesa_buffer_map; + ctx->Driver.UnmapBuffer = NULL; } @@ -355,7 +367,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) /* API Functions */ /**********************************************************************/ -void +void GLAPIENTRY _mesa_BindBufferARB(GLenum target, GLuint buffer) { GET_CURRENT_CONTEXT(ctx); @@ -424,7 +436,7 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer) * \param n Number of buffer objects to delete. * \param buffer Array of \c n buffer object IDs. */ -void +void GLAPIENTRY _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); @@ -499,7 +511,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) * \param n Number of IDs to generate. * \param buffer Array of \c n locations to store the IDs. */ -void +void GLAPIENTRY _mesa_GenBuffersARB(GLsizei n, GLuint *buffer) { GET_CURRENT_CONTEXT(ctx); @@ -548,7 +560,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer) * \return \c GL_TRUE if \c id is the name of a buffer object, * \c GL_FALSE otherwise. */ -GLboolean +GLboolean GLAPIENTRY _mesa_IsBufferARB(GLuint id) { struct gl_buffer_object * bufObj; @@ -566,7 +578,7 @@ _mesa_IsBufferARB(GLuint id) } -void +void GLAPIENTRY _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) { @@ -603,7 +615,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, } if (bufObj->Pointer) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB(buffer is mapped)" ); + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" ); return; } @@ -614,7 +626,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, } -void +void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { @@ -623,7 +635,7 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, - "glBufferSubDataARB" ); + "BufferSubDataARB" ); if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" ); return; @@ -639,7 +651,7 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, } -void +void GLAPIENTRY _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data) { @@ -648,7 +660,7 @@ _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, - "glGetBufferSubDataARB" ); + "GetBufferSubDataARB" ); if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferSubDataARB" ); return; @@ -664,7 +676,7 @@ _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, } -void * +void * GLAPIENTRY _mesa_MapBufferARB(GLenum target, GLenum access) { GET_CURRENT_CONTEXT(ctx); @@ -699,11 +711,13 @@ _mesa_MapBufferARB(GLenum target, GLenum access) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); } + bufObj->Access = access; + return bufObj->Pointer; } -GLboolean +GLboolean GLAPIENTRY _mesa_UnmapBufferARB(GLenum target) { GET_CURRENT_CONTEXT(ctx); @@ -711,7 +725,6 @@ _mesa_UnmapBufferARB(GLenum target) GLboolean status = GL_TRUE; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" ); if ( bufObj == NULL ) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" ); @@ -727,13 +740,14 @@ _mesa_UnmapBufferARB(GLenum target) status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj ); } + bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ bufObj->Pointer = NULL; return status; } -void +void GLAPIENTRY _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -766,7 +780,7 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index dddaa527147..8490e36fc54 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -84,37 +84,37 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, * API functions */ -extern void +extern void GLAPIENTRY _mesa_BindBufferARB(GLenum target, GLuint buffer); -extern void +extern void GLAPIENTRY _mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer); -extern void +extern void GLAPIENTRY _mesa_GenBuffersARB(GLsizei n, GLuint * buffer); -GLboolean +extern GLboolean GLAPIENTRY _mesa_IsBufferARB(GLuint buffer); -extern void +extern void GLAPIENTRY _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); -extern void +extern void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); -extern void +extern void GLAPIENTRY _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); -extern void * +extern void * GLAPIENTRY _mesa_MapBufferARB(GLenum target, GLenum access); -GLboolean +extern GLboolean GLAPIENTRY _mesa_UnmapBufferARB(GLenum target); -extern void +extern void GLAPIENTRY _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params); #endif diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 6c58ed408c4..519bfb34b94 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -41,7 +41,7 @@ #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); @@ -75,7 +75,7 @@ _mesa_ClearIndex( GLfloat c ) * change, flushes the vertices and notifies the driver via the * dd_function_table::ClearColor callback. */ -void +void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; @@ -110,7 +110,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) * etc. If the rasterization mode is set to GL_RENDER then requests the driver * to clear the buffers, via the dd_function_table::Clear callback. */ -void +void GLAPIENTRY _mesa_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); @@ -176,7 +176,7 @@ _mesa_Clear( GLbitfield mask ) * __GLcontextRec::NewState and notifies the driver via the * dd_function_table::DrawBuffer callback. */ -void +void GLAPIENTRY _mesa_DrawBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -327,7 +327,7 @@ _mesa_DrawBuffer( GLenum mode ) * new pixel state in __GLcontextRec::NewState and notifies the driver via * dd_function_table::ReadBuffer. */ -void +void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -436,7 +436,7 @@ _mesa_ReadBuffer( GLenum mode ) * \note This function may be called from within Mesa or called by the * user directly (see the GL_MESA_resize_buffers extension). */ -void +void GLAPIENTRY _mesa_ResizeBuffersMESA( void ) { GLcontext *ctx = _mesa_get_current_context(); @@ -488,7 +488,7 @@ _mesa_ResizeBuffersMESA( void ) /* * XXX move somewhere else someday? */ -void +void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) { GLcontext *ctx = _mesa_get_current_context(); @@ -520,7 +520,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) * change flushes the vertices and notifies the driver via * the dd_function_table::Scissor callback. */ -void +void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 7c992a98cad..83e1b482511 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -36,29 +36,29 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_ClearIndex( GLfloat c ); -extern void +extern void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); -extern void +extern void GLAPIENTRY _mesa_Clear( GLbitfield mask ); -extern void +extern void GLAPIENTRY _mesa_DrawBuffer( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_ResizeBuffersMESA( void ); -extern void +extern void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); -extern void +extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); extern void diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index a061980af42..31e6af91bd1 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -41,7 +41,7 @@ -void +void GLAPIENTRY _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) { GET_CURRENT_CONTEXT(ctx); @@ -98,7 +98,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) } -void +void GLAPIENTRY _mesa_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/clip.h b/src/mesa/main/clip.h index 154e3ce9482..9442e864395 100644 --- a/src/mesa/main/clip.h +++ b/src/mesa/main/clip.h @@ -33,8 +33,10 @@ #include "mtypes.h" -extern void _mesa_ClipPlane( GLenum plane, const GLdouble *equation ); +extern void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); -extern void _mesa_GetClipPlane( GLenum plane, GLdouble *equation ); +extern void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); #endif diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index cc268557268..a44f9a01c54 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -155,7 +155,7 @@ set_component_sizes( struct gl_color_table *table ) -void +void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *data ) @@ -439,7 +439,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, -void +void GLAPIENTRY _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ) @@ -637,7 +637,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, /* XXX not tested */ -void +void GLAPIENTRY _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { @@ -651,7 +651,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, /* XXX not tested */ -void +void GLAPIENTRY _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { @@ -663,7 +663,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, -void +void GLAPIENTRY _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { @@ -864,7 +864,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, -void +void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -957,7 +957,7 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) -void +void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GLfloat fparams[4]; @@ -980,7 +980,7 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) -void +void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1154,7 +1154,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) -void +void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index 9ccf27693f0..4bd16210a0b 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -41,40 +41,40 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); -extern void +extern void GLAPIENTRY _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table ); -extern void +extern void GLAPIENTRY _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -extern void +extern void GLAPIENTRY _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -extern void +extern void GLAPIENTRY _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *table ); -extern void +extern void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7341a8bb892..e554f7508e7 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1062,6 +1062,15 @@ _mesa_init_constants( GLcontext *ctx ) ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; + /* If we're running in the X server, do bounds checking to prevent + * segfaults and server crashes! + */ +#if defined(XFree86LOADER) && defined(IN_MODULE) + ctx->Const.CheckArrayBounds = GL_TRUE; +#else + ctx->Const.CheckArrayBounds = GL_FALSE; +#endif + ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); } @@ -1906,7 +1915,7 @@ _mesa_record_error( GLcontext *ctx, GLenum error ) * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the * dd_function_table::Finish driver callback, if not NULL. */ -void +void GLAPIENTRY _mesa_Finish( void ) { GET_CURRENT_CONTEXT(ctx); @@ -1922,7 +1931,7 @@ _mesa_Finish( void ) * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the * dd_function_table::Flush driver callback, if not NULL. */ -void +void GLAPIENTRY _mesa_Flush( void ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index caf81d8a21c..663cfc84500 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -250,10 +250,10 @@ extern void _mesa_record_error( GLcontext *ctx, GLenum error ); -extern void +extern void GLAPIENTRY _mesa_Finish( void ); -extern void +extern void GLAPIENTRY _mesa_Flush( void ); /*@}*/ diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 341d60eacdd..b7d2eeb20f9 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -101,7 +101,7 @@ base_filter_format( GLenum format ) } -void +void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { GLint baseFormat; @@ -174,7 +174,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G } -void +void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { GLint baseFormat; @@ -257,7 +257,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G } -void +void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); @@ -300,7 +300,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) } -void +void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -356,7 +356,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) } -void +void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); @@ -399,7 +399,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) } -void +void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -468,7 +468,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) } -void +void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GLint baseFormat; @@ -496,7 +496,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi } -void +void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { GLint baseFormat; @@ -529,7 +529,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi } -void +void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { const struct gl_convolution_attrib *filter; @@ -579,7 +579,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im } -void +void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -640,7 +640,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void +void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -710,7 +710,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; @@ -768,7 +768,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, } -void +void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h index deac1e2c0b3..4505cdae01e 100644 --- a/src/mesa/main/convolve.h +++ b/src/mesa/main/convolve.h @@ -32,51 +32,51 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -extern void +extern void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -extern void +extern void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); -extern void +extern void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params); -extern void +extern void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); -extern void +extern void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -extern void +extern void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -extern void +extern void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); -extern void +extern void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -extern void +extern void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index e14ae7f1a68..e9826abd6d2 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -480,6 +480,17 @@ struct dd_function_table { GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); + /** + * Called to validate a certain compressed format. + */ + GLboolean (*IsCompressedFormat)( GLcontext *ctx, GLenum internalFormat ); + /** + * Called to get bytes of storage needed for the given texture size and + * compressed format. + */ + GLuint (*CompressedTextureSize)( GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format ); /*@}*/ /** @@ -905,76 +916,76 @@ typedef struct { * \name Vertex */ /*@{*/ - void (*ArrayElement)( GLint ); /* NOTE */ - void (*Color3f)( GLfloat, GLfloat, GLfloat ); - void (*Color3fv)( const GLfloat * ); - void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (*Color4fv)( const GLfloat * ); - void (*EdgeFlag)( GLboolean ); - void (*EdgeFlagv)( const GLboolean * ); - void (*EvalCoord1f)( GLfloat ); /* NOTE */ - void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */ - void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ - void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */ - void (*EvalPoint1)( GLint ); /* NOTE */ - void (*EvalPoint2)( GLint, GLint ); /* NOTE */ - void (*FogCoordfEXT)( GLfloat ); - void (*FogCoordfvEXT)( const GLfloat * ); - void (*Indexf)( GLfloat ); - void (*Indexfv)( const GLfloat * ); - void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ - void (*MultiTexCoord1fARB)( GLenum, GLfloat ); - void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * ); - void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); - void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * ); - void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); - void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * ); - void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); - void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * ); - void (*Normal3f)( GLfloat, GLfloat, GLfloat ); - void (*Normal3fv)( const GLfloat * ); - void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); - void (*SecondaryColor3fvEXT)( const GLfloat * ); - void (*TexCoord1f)( GLfloat ); - void (*TexCoord1fv)( const GLfloat * ); - void (*TexCoord2f)( GLfloat, GLfloat ); - void (*TexCoord2fv)( const GLfloat * ); - void (*TexCoord3f)( GLfloat, GLfloat, GLfloat ); - void (*TexCoord3fv)( const GLfloat * ); - void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (*TexCoord4fv)( const GLfloat * ); - void (*Vertex2f)( GLfloat, GLfloat ); - void (*Vertex2fv)( const GLfloat * ); - void (*Vertex3f)( GLfloat, GLfloat, GLfloat ); - void (*Vertex3fv)( const GLfloat * ); - void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (*Vertex4fv)( const GLfloat * ); - void (*CallList)( GLuint ); /* NOTE */ - void (*CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ - void (*Begin)( GLenum ); - void (*End)( void ); - void (*VertexAttrib1fNV)( GLuint index, GLfloat x ); - void (*VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); - void (*VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); - void (*VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); - void (*VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); - void (*VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); - void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); - void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */ + void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color3fv)( const GLfloat * ); + void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color4fv)( const GLfloat * ); + void (GLAPIENTRYP EdgeFlag)( GLboolean ); + void (GLAPIENTRYP EdgeFlagv)( const GLboolean * ); + void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */ + void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ + void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */ + void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */ + void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); + void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); + void (GLAPIENTRYP Indexf)( GLfloat ); + void (GLAPIENTRYP Indexfv)( const GLfloat * ); + void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); + void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Normal3fv)( const GLfloat * ); + void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * ); + void (GLAPIENTRYP TexCoord1f)( GLfloat ); + void (GLAPIENTRYP TexCoord1fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord2fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord3fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord4fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex2fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); + void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */ + void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ + void (GLAPIENTRYP Begin)( GLenum ); + void (GLAPIENTRYP End)( void ); + void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); + void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); + void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); + void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); /*@}*/ /* */ - void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); /** * \name Array */ /*@{*/ - void (*DrawArrays)( GLenum mode, GLint start, GLsizei count ); - void (*DrawElements)( GLenum mode, GLsizei count, GLenum type, + void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); + void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); - void (*DrawRangeElements)( GLenum mode, GLuint start, + void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); /*@}*/ @@ -990,8 +1001,8 @@ typedef struct { * accelerated vertex formats, eventually... */ /*@{*/ - void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); - void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); + void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); /*@}*/ } GLvertexformat; diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 1e07607c463..eb8c8b821b2 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -39,25 +39,26 @@ -void +void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); - GLfloat tmp = (GLfloat) CLAMP( depth, 0.0, 1.0 ); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (ctx->Depth.Clear == tmp) + depth = CLAMP( depth, 0.0, 1.0 ); + + if (ctx->Depth.Clear == depth) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.Clear = tmp; + ctx->Depth.Clear = depth; if (ctx->Driver.ClearDepth) (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); } -void +void GLAPIENTRY _mesa_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); @@ -93,7 +94,7 @@ _mesa_DepthFunc( GLenum func ) -void +void GLAPIENTRY _mesa_DepthMask( GLboolean flag ) { GET_CURRENT_CONTEXT(ctx); @@ -119,7 +120,7 @@ _mesa_DepthMask( GLboolean flag ) /* GL_EXT_depth_bounds_test */ -void +void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/depth.h b/src/mesa/main/depth.h index ce5f28e84d6..0532a2e6d16 100644 --- a/src/mesa/main/depth.h +++ b/src/mesa/main/depth.h @@ -37,19 +37,19 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ); -extern void +extern void GLAPIENTRY _mesa_DepthFunc( GLenum func ); -extern void +extern void GLAPIENTRY _mesa_DepthMask( GLboolean flag ); extern void _mesa_init_depth( GLcontext * ctx ); -extern void +extern void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); #else diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms index 41b5fe52e2b..67d4e2de817 100644 --- a/src/mesa/main/descrip.mms +++ b/src/mesa/main/descrip.mms @@ -20,6 +20,7 @@ SOURCES =accum.c \ api_loopback.c \ api_noop.c \ api_validate.c \ + arbparse.c \ arbfragparse.c \ arbprogram.c \ arbvertparse.c \ @@ -71,13 +72,13 @@ SOURCES =accum.c \ texstore.c \ texutil.c \ varray.c \ - vtxfmt.c \ - vsnprintf.c + vtxfmt.c OBJECTS=accum.obj,\ api_loopback.obj,\ api_noop.obj,\ api_validate.obj,\ +arbparse.obj,\ arbfragparse.obj,\ arbprogram.obj,\ arbvertparse.obj,\ @@ -129,8 +130,7 @@ texstate.obj,\ texstore.obj,\ texutil.obj,\ varray.obj,\ -vtxfmt.obj,\ -vsnprintf.obj +vtxfmt.obj ##### RULES ##### @@ -150,6 +150,7 @@ accum.obj : accum.c api_loopback.obj : api_loopback.c api_noop.obj : api_noop.c api_validate.obj : api_validate.c +arbparse.obj : arbparse.c arbfragparse.obj : arbfragparse.c arbprogram.obj : arbprogram.c arbvertparse.obj : arbvertparse.c @@ -177,7 +178,7 @@ hash.obj : hash.c hint.obj : hint.c histogram.obj : histogram.c image.obj : image.c -imports.obj : imports.c +imports.obj : imports.c vsnprintf.c light.obj : light.c lines.obj : lines.c matrix.obj : matrix.c @@ -202,4 +203,3 @@ texstore.obj : texstore.c texutil.obj : texutil.c varray.obj : varray.c vtxfmt.obj : vtxfmt.c -vsnprintf.obj : vsnprintf.c diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 095ec45f057..c547a2c74db 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -866,7 +866,7 @@ _mesa_alloc_opcode( GLcontext *ctx, /* * Display List compilation functions */ -static void save_Accum( GLenum op, GLfloat value ) +static void GLAPIENTRY save_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -882,7 +882,7 @@ static void save_Accum( GLenum op, GLfloat value ) } -static void save_AlphaFunc( GLenum func, GLclampf ref ) +static void GLAPIENTRY save_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -898,7 +898,7 @@ static void save_AlphaFunc( GLenum func, GLclampf ref ) } -static void save_BindTexture( GLenum target, GLuint texture ) +static void GLAPIENTRY save_BindTexture( GLenum target, GLuint texture ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -914,7 +914,7 @@ static void save_BindTexture( GLenum target, GLuint texture ) } -static void save_Bitmap( GLsizei width, GLsizei height, +static void GLAPIENTRY save_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *pixels ) @@ -943,7 +943,7 @@ static void save_Bitmap( GLsizei width, GLsizei height, } -static void save_BlendEquation( GLenum mode ) +static void GLAPIENTRY save_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -958,7 +958,7 @@ static void save_BlendEquation( GLenum mode ) } -static void save_BlendFunc( GLenum sfactor, GLenum dfactor ) +static void GLAPIENTRY save_BlendFunc( GLenum sfactor, GLenum dfactor ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -974,7 +974,7 @@ static void save_BlendFunc( GLenum sfactor, GLenum dfactor ) } -static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, +static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { GET_CURRENT_CONTEXT(ctx); @@ -994,7 +994,7 @@ static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, } -static void save_BlendColor( GLfloat red, GLfloat green, +static void GLAPIENTRY save_BlendColor( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CURRENT_CONTEXT(ctx); @@ -1013,7 +1013,7 @@ static void save_BlendColor( GLfloat red, GLfloat green, } -void _mesa_save_CallList( GLuint list ) +void GLAPIENTRY _mesa_save_CallList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1034,7 +1034,7 @@ void _mesa_save_CallList( GLuint list ) } -void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) +void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -1078,7 +1078,7 @@ void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) } -static void save_Clear( GLbitfield mask ) +static void GLAPIENTRY save_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1093,7 +1093,7 @@ static void save_Clear( GLbitfield mask ) } -static void save_ClearAccum( GLfloat red, GLfloat green, +static void GLAPIENTRY save_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CURRENT_CONTEXT(ctx); @@ -1112,7 +1112,7 @@ static void save_ClearAccum( GLfloat red, GLfloat green, } -static void save_ClearColor( GLclampf red, GLclampf green, +static void GLAPIENTRY save_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GET_CURRENT_CONTEXT(ctx); @@ -1131,7 +1131,7 @@ static void save_ClearColor( GLclampf red, GLclampf green, } -static void save_ClearDepth( GLclampd depth ) +static void GLAPIENTRY save_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1146,7 +1146,7 @@ static void save_ClearDepth( GLclampd depth ) } -static void save_ClearIndex( GLfloat c ) +static void GLAPIENTRY save_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1161,7 +1161,7 @@ static void save_ClearIndex( GLfloat c ) } -static void save_ClearStencil( GLint s ) +static void GLAPIENTRY save_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1176,7 +1176,7 @@ static void save_ClearStencil( GLint s ) } -static void save_ClipPlane( GLenum plane, const GLdouble *equ ) +static void GLAPIENTRY save_ClipPlane( GLenum plane, const GLdouble *equ ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1196,7 +1196,7 @@ static void save_ClipPlane( GLenum plane, const GLdouble *equ ) -static void save_ColorMask( GLboolean red, GLboolean green, +static void GLAPIENTRY save_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { GET_CURRENT_CONTEXT(ctx); @@ -1215,7 +1215,7 @@ static void save_ColorMask( GLboolean red, GLboolean green, } -static void save_ColorMaterial( GLenum face, GLenum mode ) +static void GLAPIENTRY save_ColorMaterial( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1232,7 +1232,7 @@ static void save_ColorMaterial( GLenum face, GLenum mode ) } -static void save_ColorTable( GLenum target, GLenum internalFormat, +static void GLAPIENTRY save_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ) { @@ -1271,7 +1271,7 @@ static void save_ColorTable( GLenum target, GLenum internalFormat, -static void +static void GLAPIENTRY save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -1300,7 +1300,7 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) } -static void +static void GLAPIENTRY save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -1330,7 +1330,7 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) -static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, +static void GLAPIENTRY save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table) { @@ -1357,7 +1357,7 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, } -static void +static void GLAPIENTRY save_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { @@ -1379,7 +1379,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start, } -static void +static void GLAPIENTRY save_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { @@ -1401,7 +1401,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat, } -static void +static void GLAPIENTRY save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *filter) { @@ -1429,7 +1429,7 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, } -static void +static void GLAPIENTRY save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *filter) @@ -1459,7 +1459,7 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, } -static void +static void GLAPIENTRY save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); @@ -1477,7 +1477,7 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) } -static void +static void GLAPIENTRY save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -1505,7 +1505,7 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) } -static void +static void GLAPIENTRY save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); @@ -1523,7 +1523,7 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) } -static void +static void GLAPIENTRY save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -1551,7 +1551,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) } -static void +static void GLAPIENTRY save_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) { @@ -1573,7 +1573,7 @@ save_CopyPixels( GLint x, GLint y, -static void +static void GLAPIENTRY save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ) { @@ -1597,7 +1597,7 @@ save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, } -static void +static void GLAPIENTRY save_CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, @@ -1625,7 +1625,7 @@ save_CopyTexImage2D( GLenum target, GLint level, -static void +static void GLAPIENTRY save_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) @@ -1648,7 +1648,7 @@ save_CopyTexSubImage1D( GLenum target, GLint level, } -static void +static void GLAPIENTRY save_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, @@ -1675,7 +1675,7 @@ save_CopyTexSubImage2D( GLenum target, GLint level, } -static void +static void GLAPIENTRY save_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, @@ -1704,7 +1704,7 @@ save_CopyTexSubImage3D( GLenum target, GLint level, } -static void save_CullFace( GLenum mode ) +static void GLAPIENTRY save_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1719,7 +1719,7 @@ static void save_CullFace( GLenum mode ) } -static void save_DepthFunc( GLenum func ) +static void GLAPIENTRY save_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1734,7 +1734,7 @@ static void save_DepthFunc( GLenum func ) } -static void save_DepthMask( GLboolean mask ) +static void GLAPIENTRY save_DepthMask( GLboolean mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1749,7 +1749,7 @@ static void save_DepthMask( GLboolean mask ) } -static void save_DepthRange( GLclampd nearval, GLclampd farval ) +static void GLAPIENTRY save_DepthRange( GLclampd nearval, GLclampd farval ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1765,7 +1765,7 @@ static void save_DepthRange( GLclampd nearval, GLclampd farval ) } -static void save_Disable( GLenum cap ) +static void GLAPIENTRY save_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1780,7 +1780,7 @@ static void save_Disable( GLenum cap ) } -static void save_DrawBuffer( GLenum mode ) +static void GLAPIENTRY save_DrawBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1795,7 +1795,7 @@ static void save_DrawBuffer( GLenum mode ) } -static void save_DrawPixels( GLsizei width, GLsizei height, +static void GLAPIENTRY save_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { @@ -1822,7 +1822,7 @@ static void save_DrawPixels( GLsizei width, GLsizei height, -static void save_Enable( GLenum cap ) +static void GLAPIENTRY save_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1838,7 +1838,7 @@ static void save_Enable( GLenum cap ) -void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) +void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1855,7 +1855,7 @@ void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) } -void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) +void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1876,7 +1876,7 @@ void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) -static void save_Fogfv( GLenum pname, const GLfloat *params ) +static void GLAPIENTRY save_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1895,13 +1895,13 @@ static void save_Fogfv( GLenum pname, const GLfloat *params ) } -static void save_Fogf( GLenum pname, GLfloat param ) +static void GLAPIENTRY save_Fogf( GLenum pname, GLfloat param ) { save_Fogfv(pname, ¶m); } -static void save_Fogiv(GLenum pname, const GLint *params ) +static void GLAPIENTRY save_Fogiv(GLenum pname, const GLint *params ) { GLfloat p[4]; switch (pname) { @@ -1926,13 +1926,13 @@ static void save_Fogiv(GLenum pname, const GLint *params ) } -static void save_Fogi(GLenum pname, GLint param ) +static void GLAPIENTRY save_Fogi(GLenum pname, GLint param ) { save_Fogiv(pname, ¶m); } -static void save_FrontFace( GLenum mode ) +static void GLAPIENTRY save_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1947,7 +1947,7 @@ static void save_FrontFace( GLenum mode ) } -static void save_Frustum( GLdouble left, GLdouble right, +static void GLAPIENTRY save_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { @@ -1969,7 +1969,7 @@ static void save_Frustum( GLdouble left, GLdouble right, } -static void save_Hint( GLenum target, GLenum mode ) +static void GLAPIENTRY save_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1985,7 +1985,7 @@ static void save_Hint( GLenum target, GLenum mode ) } -static void +static void GLAPIENTRY save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); @@ -2005,7 +2005,7 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean si } -static void save_IndexMask( GLuint mask ) +static void GLAPIENTRY save_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2020,7 +2020,7 @@ static void save_IndexMask( GLuint mask ) } -static void save_InitNames( void ) +static void GLAPIENTRY save_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2031,7 +2031,7 @@ static void save_InitNames( void ) } -static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) +static void GLAPIENTRY save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2085,13 +2085,13 @@ static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) } -static void save_Lightf( GLenum light, GLenum pname, GLfloat params ) +static void GLAPIENTRY save_Lightf( GLenum light, GLenum pname, GLfloat params ) { save_Lightfv(light, pname, ¶ms); } -static void save_Lightiv( GLenum light, GLenum pname, const GLint *params ) +static void GLAPIENTRY save_Lightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { @@ -2129,13 +2129,13 @@ static void save_Lightiv( GLenum light, GLenum pname, const GLint *params ) } -static void save_Lighti( GLenum light, GLenum pname, GLint param ) +static void GLAPIENTRY save_Lighti( GLenum light, GLenum pname, GLint param ) { save_Lightiv( light, pname, ¶m ); } -static void save_LightModelfv( GLenum pname, const GLfloat *params ) +static void GLAPIENTRY save_LightModelfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2154,13 +2154,13 @@ static void save_LightModelfv( GLenum pname, const GLfloat *params ) } -static void save_LightModelf( GLenum pname, GLfloat param ) +static void GLAPIENTRY save_LightModelf( GLenum pname, GLfloat param ) { save_LightModelfv(pname, ¶m); } -static void save_LightModeliv( GLenum pname, const GLint *params ) +static void GLAPIENTRY save_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { @@ -2183,13 +2183,13 @@ static void save_LightModeliv( GLenum pname, const GLint *params ) } -static void save_LightModeli( GLenum pname, GLint param ) +static void GLAPIENTRY save_LightModeli( GLenum pname, GLint param ) { save_LightModeliv(pname, ¶m); } -static void save_LineStipple( GLint factor, GLushort pattern ) +static void GLAPIENTRY save_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2205,7 +2205,7 @@ static void save_LineStipple( GLint factor, GLushort pattern ) } -static void save_LineWidth( GLfloat width ) +static void GLAPIENTRY save_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2220,7 +2220,7 @@ static void save_LineWidth( GLfloat width ) } -static void save_ListBase( GLuint base ) +static void GLAPIENTRY save_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2235,7 +2235,7 @@ static void save_ListBase( GLuint base ) } -static void save_LoadIdentity( void ) +static void GLAPIENTRY save_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2246,7 +2246,7 @@ static void save_LoadIdentity( void ) } -static void save_LoadMatrixf( const GLfloat *m ) +static void GLAPIENTRY save_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2264,7 +2264,7 @@ static void save_LoadMatrixf( const GLfloat *m ) } -static void save_LoadMatrixd( const GLdouble *m ) +static void GLAPIENTRY save_LoadMatrixd( const GLdouble *m ) { GLfloat f[16]; GLint i; @@ -2275,7 +2275,7 @@ static void save_LoadMatrixd( const GLdouble *m ) } -static void save_LoadName( GLuint name ) +static void GLAPIENTRY save_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2290,7 +2290,7 @@ static void save_LoadName( GLuint name ) } -static void save_LogicOp( GLenum opcode ) +static void GLAPIENTRY save_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2305,7 +2305,7 @@ static void save_LogicOp( GLenum opcode ) } -static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, +static void GLAPIENTRY save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) { GET_CURRENT_CONTEXT(ctx); @@ -2326,7 +2326,7 @@ static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, } } -static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, +static void GLAPIENTRY save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) { GET_CURRENT_CONTEXT(ctx); @@ -2348,7 +2348,7 @@ static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, } -static void save_Map2d( GLenum target, +static void GLAPIENTRY save_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ) @@ -2380,7 +2380,7 @@ static void save_Map2d( GLenum target, } -static void save_Map2f( GLenum target, +static void GLAPIENTRY save_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ) @@ -2411,7 +2411,7 @@ static void save_Map2f( GLenum target, } -static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) +static void GLAPIENTRY save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2428,13 +2428,13 @@ static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) } -static void save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) +static void GLAPIENTRY save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2); } -static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, +static void GLAPIENTRY save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); @@ -2456,7 +2456,7 @@ static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, -static void save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, +static void GLAPIENTRY save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, @@ -2464,7 +2464,7 @@ static void save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, } -static void save_MatrixMode( GLenum mode ) +static void GLAPIENTRY save_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2479,7 +2479,7 @@ static void save_MatrixMode( GLenum mode ) } -static void +static void GLAPIENTRY save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); @@ -2498,7 +2498,7 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) } -static void save_MultMatrixf( const GLfloat *m ) +static void GLAPIENTRY save_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2516,7 +2516,7 @@ static void save_MultMatrixf( const GLfloat *m ) } -static void save_MultMatrixd( const GLdouble *m ) +static void GLAPIENTRY save_MultMatrixd( const GLdouble *m ) { GLfloat f[16]; GLint i; @@ -2527,7 +2527,7 @@ static void save_MultMatrixd( const GLdouble *m ) } -static void save_NewList( GLuint list, GLenum mode ) +static void GLAPIENTRY save_NewList( GLuint list, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); /* It's an error to call this function while building a display list */ @@ -2538,7 +2538,7 @@ static void save_NewList( GLuint list, GLenum mode ) -static void save_Ortho( GLdouble left, GLdouble right, +static void GLAPIENTRY save_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { @@ -2560,7 +2560,7 @@ static void save_Ortho( GLdouble left, GLdouble right, } -static void +static void GLAPIENTRY save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); @@ -2579,7 +2579,7 @@ save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) } -static void +static void GLAPIENTRY save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; @@ -2598,7 +2598,7 @@ save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ) } -static void +static void GLAPIENTRY save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; @@ -2617,7 +2617,7 @@ save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values) } -static void +static void GLAPIENTRY save_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); @@ -2634,14 +2634,14 @@ save_PixelTransferf( GLenum pname, GLfloat param ) } -static void +static void GLAPIENTRY save_PixelTransferi( GLenum pname, GLint param ) { save_PixelTransferf( pname, (GLfloat) param ); } -static void +static void GLAPIENTRY save_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); @@ -2658,7 +2658,7 @@ save_PixelZoom( GLfloat xfactor, GLfloat yfactor ) } -static void +static void GLAPIENTRY save_PointParameterfvEXT( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -2677,25 +2677,25 @@ save_PointParameterfvEXT( GLenum pname, const GLfloat *params ) } -static void save_PointParameterfEXT( GLenum pname, GLfloat param ) +static void GLAPIENTRY save_PointParameterfEXT( GLenum pname, GLfloat param ) { save_PointParameterfvEXT(pname, ¶m); } -static void save_PointParameteriNV( GLenum pname, GLint param ) +static void GLAPIENTRY save_PointParameteriNV( GLenum pname, GLint param ) { GLfloat p = (GLfloat) param; save_PointParameterfvEXT(pname, &p); } -static void save_PointParameterivNV( GLenum pname, const GLint *param ) +static void GLAPIENTRY save_PointParameterivNV( GLenum pname, const GLint *param ) { GLfloat p = (GLfloat) param[0]; save_PointParameterfvEXT(pname, &p); } -static void save_PointSize( GLfloat size ) +static void GLAPIENTRY save_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2710,7 +2710,7 @@ static void save_PointSize( GLfloat size ) } -static void save_PolygonMode( GLenum face, GLenum mode ) +static void GLAPIENTRY save_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2729,7 +2729,7 @@ static void save_PolygonMode( GLenum face, GLenum mode ) /* * Polygon stipple must have been upacked already! */ -static void save_PolygonStipple( const GLubyte *pattern ) +static void GLAPIENTRY save_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2747,7 +2747,7 @@ static void save_PolygonStipple( const GLubyte *pattern ) } -static void save_PolygonOffset( GLfloat factor, GLfloat units ) +static void GLAPIENTRY save_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2763,14 +2763,14 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units ) } -static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) +static void GLAPIENTRY save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); save_PolygonOffset(factor, ctx->DepthMaxF * bias); } -static void save_PopAttrib( void ) +static void GLAPIENTRY save_PopAttrib( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2781,7 +2781,7 @@ static void save_PopAttrib( void ) } -static void save_PopMatrix( void ) +static void GLAPIENTRY save_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2792,7 +2792,7 @@ static void save_PopMatrix( void ) } -static void save_PopName( void ) +static void GLAPIENTRY save_PopName( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2803,7 +2803,7 @@ static void save_PopName( void ) } -static void save_PrioritizeTextures( GLsizei num, const GLuint *textures, +static void GLAPIENTRY save_PrioritizeTextures( GLsizei num, const GLuint *textures, const GLclampf *priorities ) { GET_CURRENT_CONTEXT(ctx); @@ -2824,7 +2824,7 @@ static void save_PrioritizeTextures( GLsizei num, const GLuint *textures, } -static void save_PushAttrib( GLbitfield mask ) +static void GLAPIENTRY save_PushAttrib( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2839,7 +2839,7 @@ static void save_PushAttrib( GLbitfield mask ) } -static void save_PushMatrix( void ) +static void GLAPIENTRY save_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); @@ -2850,7 +2850,7 @@ static void save_PushMatrix( void ) } -static void save_PushName( GLuint name ) +static void GLAPIENTRY save_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2865,7 +2865,7 @@ static void save_PushName( GLuint name ) } -static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -2882,125 +2882,125 @@ static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) } } -static void save_RasterPos2d(GLdouble x, GLdouble y) +static void GLAPIENTRY save_RasterPos2d(GLdouble x, GLdouble y) { save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -static void save_RasterPos2f(GLfloat x, GLfloat y) +static void GLAPIENTRY save_RasterPos2f(GLfloat x, GLfloat y) { save_RasterPos4f(x, y, 0.0F, 1.0F); } -static void save_RasterPos2i(GLint x, GLint y) +static void GLAPIENTRY save_RasterPos2i(GLint x, GLint y) { save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -static void save_RasterPos2s(GLshort x, GLshort y) +static void GLAPIENTRY save_RasterPos2s(GLshort x, GLshort y) { save_RasterPos4f(x, y, 0.0F, 1.0F); } -static void save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) +static void GLAPIENTRY save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -static void save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) +static void GLAPIENTRY save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { save_RasterPos4f(x, y, z, 1.0F); } -static void save_RasterPos3i(GLint x, GLint y, GLint z) +static void GLAPIENTRY save_RasterPos3i(GLint x, GLint y, GLint z) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -static void save_RasterPos3s(GLshort x, GLshort y, GLshort z) +static void GLAPIENTRY save_RasterPos3s(GLshort x, GLshort y, GLshort z) { save_RasterPos4f(x, y, z, 1.0F); } -static void save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +static void GLAPIENTRY save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) +static void GLAPIENTRY save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) +static void GLAPIENTRY save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { save_RasterPos4f(x, y, z, w); } -static void save_RasterPos2dv(const GLdouble *v) +static void GLAPIENTRY save_RasterPos2dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -static void save_RasterPos2fv(const GLfloat *v) +static void GLAPIENTRY save_RasterPos2fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } -static void save_RasterPos2iv(const GLint *v) +static void GLAPIENTRY save_RasterPos2iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -static void save_RasterPos2sv(const GLshort *v) +static void GLAPIENTRY save_RasterPos2sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } -static void save_RasterPos3dv(const GLdouble *v) +static void GLAPIENTRY save_RasterPos3dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -static void save_RasterPos3fv(const GLfloat *v) +static void GLAPIENTRY save_RasterPos3fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], v[2], 1.0F); } -static void save_RasterPos3iv(const GLint *v) +static void GLAPIENTRY save_RasterPos3iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -static void save_RasterPos3sv(const GLshort *v) +static void GLAPIENTRY save_RasterPos3sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], v[2], 1.0F); } -static void save_RasterPos4dv(const GLdouble *v) +static void GLAPIENTRY save_RasterPos4dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void save_RasterPos4fv(const GLfloat *v) +static void GLAPIENTRY save_RasterPos4fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], v[2], v[3]); } -static void save_RasterPos4iv(const GLint *v) +static void GLAPIENTRY save_RasterPos4iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void save_RasterPos4sv(const GLshort *v) +static void GLAPIENTRY save_RasterPos4sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], v[2], v[3]); } -static void save_PassThrough( GLfloat token ) +static void GLAPIENTRY save_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3015,7 +3015,7 @@ static void save_PassThrough( GLfloat token ) } -static void save_ReadBuffer( GLenum mode ) +static void GLAPIENTRY save_ReadBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3030,7 +3030,7 @@ static void save_ReadBuffer( GLenum mode ) } -static void +static void GLAPIENTRY save_ResetHistogram(GLenum target) { GET_CURRENT_CONTEXT(ctx); @@ -3046,7 +3046,7 @@ save_ResetHistogram(GLenum target) } -static void +static void GLAPIENTRY save_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); @@ -3062,7 +3062,7 @@ save_ResetMinmax(GLenum target) } -static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3080,13 +3080,13 @@ static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) } -static void save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) +static void GLAPIENTRY save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); } -static void save_Scalef( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY save_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3103,13 +3103,13 @@ static void save_Scalef( GLfloat x, GLfloat y, GLfloat z ) } -static void save_Scaled( GLdouble x, GLdouble y, GLdouble z ) +static void GLAPIENTRY save_Scaled( GLdouble x, GLdouble y, GLdouble z ) { save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); } -static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +static void GLAPIENTRY save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3127,7 +3127,7 @@ static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) } -static void save_ShadeModel( GLenum mode ) +static void GLAPIENTRY save_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3142,7 +3142,7 @@ static void save_ShadeModel( GLenum mode ) } -static void save_StencilFunc( GLenum func, GLint ref, GLuint mask ) +static void GLAPIENTRY save_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3159,7 +3159,7 @@ static void save_StencilFunc( GLenum func, GLint ref, GLuint mask ) } -static void save_StencilMask( GLuint mask ) +static void GLAPIENTRY save_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3174,7 +3174,7 @@ static void save_StencilMask( GLuint mask ) } -static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) +static void GLAPIENTRY save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3191,7 +3191,7 @@ static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) } -static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) +static void GLAPIENTRY save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3211,13 +3211,13 @@ static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) } -static void save_TexEnvf( GLenum target, GLenum pname, GLfloat param ) +static void GLAPIENTRY save_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { save_TexEnvfv( target, pname, ¶m ); } -static void save_TexEnvi( GLenum target, GLenum pname, GLint param ) +static void GLAPIENTRY save_TexEnvi( GLenum target, GLenum pname, GLint param ) { GLfloat p[4]; p[0] = (GLfloat) param; @@ -3226,7 +3226,7 @@ static void save_TexEnvi( GLenum target, GLenum pname, GLint param ) } -static void save_TexEnviv( GLenum target, GLenum pname, const GLint *param ) +static void GLAPIENTRY save_TexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; p[0] = INT_TO_FLOAT( param[0] ); @@ -3237,7 +3237,7 @@ static void save_TexEnviv( GLenum target, GLenum pname, const GLint *param ) } -static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +static void GLAPIENTRY save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3257,7 +3257,7 @@ static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) } -static void save_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) +static void GLAPIENTRY save_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; @@ -3268,14 +3268,14 @@ static void save_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) } -static void save_TexGend(GLenum coord, GLenum pname, GLdouble param ) +static void GLAPIENTRY save_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p = (GLfloat) param; save_TexGenfv( coord, pname, &p ); } -static void save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) +static void GLAPIENTRY save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; @@ -3286,19 +3286,19 @@ static void save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) } -static void save_TexGenf( GLenum coord, GLenum pname, GLfloat param ) +static void GLAPIENTRY save_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { save_TexGenfv(coord, pname, ¶m); } -static void save_TexGeni( GLenum coord, GLenum pname, GLint param ) +static void GLAPIENTRY save_TexGeni( GLenum coord, GLenum pname, GLint param ) { save_TexGeniv( coord, pname, ¶m ); } -static void save_TexParameterfv( GLenum target, +static void GLAPIENTRY save_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -3319,13 +3319,13 @@ static void save_TexParameterfv( GLenum target, } -static void save_TexParameterf( GLenum target, GLenum pname, GLfloat param ) +static void GLAPIENTRY save_TexParameterf( GLenum target, GLenum pname, GLfloat param ) { save_TexParameterfv(target, pname, ¶m); } -static void save_TexParameteri( GLenum target, GLenum pname, GLint param ) +static void GLAPIENTRY save_TexParameteri( GLenum target, GLenum pname, GLint param ) { GLfloat fparam[4]; fparam[0] = (GLfloat) param; @@ -3334,7 +3334,7 @@ static void save_TexParameteri( GLenum target, GLenum pname, GLint param ) } -static void save_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) +static void GLAPIENTRY save_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) { GLfloat fparam[4]; fparam[0] = (GLfloat) params[0]; @@ -3343,7 +3343,7 @@ static void save_TexParameteriv( GLenum target, GLenum pname, const GLint *param } -static void save_TexImage1D( GLenum target, +static void GLAPIENTRY save_TexImage1D( GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, @@ -3382,7 +3382,7 @@ static void save_TexImage1D( GLenum target, } -static void save_TexImage2D( GLenum target, +static void GLAPIENTRY save_TexImage2D( GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, @@ -3422,7 +3422,7 @@ static void save_TexImage2D( GLenum target, } -static void save_TexImage3D( GLenum target, +static void GLAPIENTRY save_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -3464,7 +3464,7 @@ static void save_TexImage3D( GLenum target, } -static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, +static void GLAPIENTRY save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ) { @@ -3493,7 +3493,7 @@ static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, } -static void save_TexSubImage2D( GLenum target, GLint level, +static void GLAPIENTRY save_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -3526,7 +3526,7 @@ static void save_TexSubImage2D( GLenum target, GLint level, } -static void save_TexSubImage3D( GLenum target, GLint level, +static void GLAPIENTRY save_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset,GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, @@ -3562,7 +3562,7 @@ static void save_TexSubImage3D( GLenum target, GLint level, } -static void save_Translatef( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY save_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3579,14 +3579,14 @@ static void save_Translatef( GLfloat x, GLfloat y, GLfloat z ) } -static void save_Translated( GLdouble x, GLdouble y, GLdouble z ) +static void GLAPIENTRY save_Translated( GLdouble x, GLdouble y, GLdouble z ) { save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); } -static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) +static void GLAPIENTRY save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3604,7 +3604,7 @@ static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) } -static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3621,119 +3621,119 @@ static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) } } -static void save_WindowPos2dMESA(GLdouble x, GLdouble y) +static void GLAPIENTRY save_WindowPos2dMESA(GLdouble x, GLdouble y) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -static void save_WindowPos2fMESA(GLfloat x, GLfloat y) +static void GLAPIENTRY save_WindowPos2fMESA(GLfloat x, GLfloat y) { save_WindowPos4fMESA(x, y, 0.0F, 1.0F); } -static void save_WindowPos2iMESA(GLint x, GLint y) +static void GLAPIENTRY save_WindowPos2iMESA(GLint x, GLint y) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -static void save_WindowPos2sMESA(GLshort x, GLshort y) +static void GLAPIENTRY save_WindowPos2sMESA(GLshort x, GLshort y) { save_WindowPos4fMESA(x, y, 0.0F, 1.0F); } -static void save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) +static void GLAPIENTRY save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -static void save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) +static void GLAPIENTRY save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { save_WindowPos4fMESA(x, y, z, 1.0F); } -static void save_WindowPos3iMESA(GLint x, GLint y, GLint z) +static void GLAPIENTRY save_WindowPos3iMESA(GLint x, GLint y, GLint z) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -static void save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) +static void GLAPIENTRY save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { save_WindowPos4fMESA(x, y, z, 1.0F); } -static void save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +static void GLAPIENTRY save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) +static void GLAPIENTRY save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -static void save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) +static void GLAPIENTRY save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { save_WindowPos4fMESA(x, y, z, w); } -static void save_WindowPos2dvMESA(const GLdouble *v) +static void GLAPIENTRY save_WindowPos2dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -static void save_WindowPos2fvMESA(const GLfloat *v) +static void GLAPIENTRY save_WindowPos2fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); } -static void save_WindowPos2ivMESA(const GLint *v) +static void GLAPIENTRY save_WindowPos2ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -static void save_WindowPos2svMESA(const GLshort *v) +static void GLAPIENTRY save_WindowPos2svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); } -static void save_WindowPos3dvMESA(const GLdouble *v) +static void GLAPIENTRY save_WindowPos3dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -static void save_WindowPos3fvMESA(const GLfloat *v) +static void GLAPIENTRY save_WindowPos3fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); } -static void save_WindowPos3ivMESA(const GLint *v) +static void GLAPIENTRY save_WindowPos3ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -static void save_WindowPos3svMESA(const GLshort *v) +static void GLAPIENTRY save_WindowPos3svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); } -static void save_WindowPos4dvMESA(const GLdouble *v) +static void GLAPIENTRY save_WindowPos4dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void save_WindowPos4fvMESA(const GLfloat *v) +static void GLAPIENTRY save_WindowPos4fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); } -static void save_WindowPos4ivMESA(const GLint *v) +static void GLAPIENTRY save_WindowPos4ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -static void save_WindowPos4svMESA(const GLshort *v) +static void GLAPIENTRY save_WindowPos4svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); } @@ -3741,7 +3741,7 @@ static void save_WindowPos4svMESA(const GLshort *v) /* GL_ARB_multitexture */ -static void save_ActiveTextureARB( GLenum target ) +static void GLAPIENTRY save_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -3758,7 +3758,7 @@ static void save_ActiveTextureARB( GLenum target ) /* GL_ARB_transpose_matrix */ -static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) +static void GLAPIENTRY save_LoadTransposeMatrixdARB( const GLdouble m[16] ) { GLfloat tm[16]; _math_transposefd(tm, m); @@ -3766,7 +3766,7 @@ static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) } -static void save_LoadTransposeMatrixfARB( const GLfloat m[16] ) +static void GLAPIENTRY save_LoadTransposeMatrixfARB( const GLfloat m[16] ) { GLfloat tm[16]; _math_transposef(tm, m); @@ -3774,7 +3774,7 @@ static void save_LoadTransposeMatrixfARB( const GLfloat m[16] ) } -static void +static void GLAPIENTRY save_MultTransposeMatrixdARB( const GLdouble m[16] ) { GLfloat tm[16]; @@ -3783,7 +3783,7 @@ save_MultTransposeMatrixdARB( const GLdouble m[16] ) } -static void +static void GLAPIENTRY save_MultTransposeMatrixfARB( const GLfloat m[16] ) { GLfloat tm[16]; @@ -3792,7 +3792,7 @@ save_MultTransposeMatrixfARB( const GLfloat m[16] ) } -static void +static void GLAPIENTRY save_PixelTexGenSGIX(GLenum mode) { GET_CURRENT_CONTEXT(ctx); @@ -3809,7 +3809,7 @@ save_PixelTexGenSGIX(GLenum mode) /* GL_ARB_texture_compression */ -static void +static void GLAPIENTRY save_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, @@ -3853,7 +3853,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, } -static void +static void GLAPIENTRY save_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, @@ -3898,7 +3898,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, } -static void +static void GLAPIENTRY save_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -3944,7 +3944,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, } -static void +static void GLAPIENTRY save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) @@ -3982,7 +3982,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, } -static void +static void GLAPIENTRY save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, @@ -4023,7 +4023,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, } -static void +static void GLAPIENTRY save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, @@ -4067,7 +4067,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, /* GL_ARB_multisample */ -static void +static void GLAPIENTRY save_SampleCoverageARB(GLclampf value, GLboolean invert) { GET_CURRENT_CONTEXT(ctx); @@ -4086,7 +4086,7 @@ save_SampleCoverageARB(GLclampf value, GLboolean invert) /* GL_SGIS_pixel_texture */ -static void +static void GLAPIENTRY save_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); @@ -4103,21 +4103,21 @@ save_PixelTexGenParameteriSGIS(GLenum target, GLint value) } -static void +static void GLAPIENTRY save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) { save_PixelTexGenParameteriSGIS(target, (GLint) value); } -static void +static void GLAPIENTRY save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) { save_PixelTexGenParameteriSGIS(target, *value); } -static void +static void GLAPIENTRY save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) { save_PixelTexGenParameteriSGIS(target, (GLint) *value); @@ -4128,7 +4128,7 @@ save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) * GL_NV_vertex_program */ #if FEATURE_NV_vertex_program -static void +static void GLAPIENTRY save_BindProgramNV(GLenum target, GLuint id) { GET_CURRENT_CONTEXT(ctx); @@ -4144,7 +4144,7 @@ save_BindProgramNV(GLenum target, GLuint id) } } -static void +static void GLAPIENTRY save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -4165,7 +4165,7 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) } -static void +static void GLAPIENTRY save_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) @@ -4188,7 +4188,7 @@ save_ProgramParameter4fNV(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) { save_ProgramParameter4fNV(target, index, params[0], params[1], @@ -4196,7 +4196,7 @@ save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) } -static void +static void GLAPIENTRY save_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) @@ -4206,7 +4206,7 @@ save_ProgramParameter4dNV(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params) { @@ -4216,7 +4216,7 @@ save_ProgramParameter4dvNV(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params) { @@ -4227,7 +4227,7 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params) { @@ -4238,7 +4238,7 @@ save_ProgramParameters4fvNV(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program) { @@ -4267,7 +4267,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } -static void +static void GLAPIENTRY save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); @@ -4290,7 +4290,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids) } -static void +static void GLAPIENTRY save_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform) { @@ -4315,7 +4315,7 @@ save_TrackMatrixNV(GLenum target, GLuint address, * GL_NV_fragment_program */ #if FEATURE_NV_fragment_program -static void +static void GLAPIENTRY save_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -4337,7 +4337,7 @@ save_ProgramLocalParameter4fARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { @@ -4359,7 +4359,7 @@ save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) @@ -4382,7 +4382,7 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { @@ -4403,7 +4403,7 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, } } -static void +static void GLAPIENTRY save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -4433,7 +4433,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, } -static void +static void GLAPIENTRY save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]) { @@ -4441,7 +4441,7 @@ save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, } -static void +static void GLAPIENTRY save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { @@ -4450,7 +4450,7 @@ save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, } -static void +static void GLAPIENTRY save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]) { @@ -4464,7 +4464,7 @@ save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, /* GL_EXT_stencil_two_side */ -static void save_ActiveStencilFaceEXT( GLenum face ) +static void GLAPIENTRY save_ActiveStencilFaceEXT( GLenum face ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -4480,7 +4480,7 @@ static void save_ActiveStencilFaceEXT( GLenum face ) /* GL_EXT_depth_bounds_test */ -static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) +static void GLAPIENTRY save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -4499,7 +4499,7 @@ static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -static void +static void GLAPIENTRY save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { @@ -4528,7 +4528,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } -static void +static void GLAPIENTRY save_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -4550,7 +4550,7 @@ save_ProgramEnvParameter4fARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { @@ -4559,7 +4559,7 @@ save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { @@ -4571,7 +4571,7 @@ save_ProgramEnvParameter4dARB(GLenum target, GLuint index, } -static void +static void GLAPIENTRY save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { @@ -5230,7 +5230,7 @@ islist(GLcontext *ctx, GLuint list) * the absolute list number, not relative to ListBase. * \param list - display list number */ -static void +static void GLAPIENTRY execute_list( GLcontext *ctx, GLuint list ) { Node *n; @@ -6019,7 +6019,7 @@ execute_list( GLcontext *ctx, GLuint list ) /* * Test if a display list number is valid. */ -GLboolean +GLboolean GLAPIENTRY _mesa_IsList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); @@ -6032,7 +6032,7 @@ _mesa_IsList( GLuint list ) /* * Delete a sequence of consecutive display lists. */ -void +void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ) { GET_CURRENT_CONTEXT(ctx); @@ -6055,7 +6055,7 @@ _mesa_DeleteLists( GLuint list, GLsizei range ) * Return a display list number, n, such that lists n through n+range-1 * are free. */ -GLuint +GLuint GLAPIENTRY _mesa_GenLists(GLsizei range ) { GET_CURRENT_CONTEXT(ctx); @@ -6095,7 +6095,7 @@ _mesa_GenLists(GLsizei range ) /* * Begin a new display list. */ -void +void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -6156,7 +6156,7 @@ _mesa_NewList( GLuint list, GLenum mode ) /* * End definition of current display list. */ -void +void GLAPIENTRY _mesa_EndList( void ) { GET_CURRENT_CONTEXT(ctx); @@ -6196,7 +6196,7 @@ _mesa_EndList( void ) -void +void GLAPIENTRY _mesa_CallList( GLuint list ) { GLboolean save_compile_flag; @@ -6235,7 +6235,7 @@ _mesa_CallList( GLuint list ) /* * Execute glCallLists: call multiple display lists. */ -void +void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); @@ -6289,7 +6289,7 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) /* * Set the offset added to list numbers in glCallLists. */ -void +void GLAPIENTRY _mesa_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); @@ -6301,182 +6301,182 @@ _mesa_ListBase( GLuint base ) /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. */ -static void exec_Finish( void ) +static void GLAPIENTRY exec_Finish( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->Finish(); } -static void exec_Flush( void ) +static void GLAPIENTRY exec_Flush( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->Flush( ); } -static void exec_GetBooleanv( GLenum pname, GLboolean *params ) +static void GLAPIENTRY exec_GetBooleanv( GLenum pname, GLboolean *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetBooleanv( pname, params ); } -static void exec_GetClipPlane( GLenum plane, GLdouble *equation ) +static void GLAPIENTRY exec_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetClipPlane( plane, equation ); } -static void exec_GetDoublev( GLenum pname, GLdouble *params ) +static void GLAPIENTRY exec_GetDoublev( GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetDoublev( pname, params ); } -static GLenum exec_GetError( void ) +static GLenum GLAPIENTRY exec_GetError( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return ctx->Exec->GetError( ); } -static void exec_GetFloatv( GLenum pname, GLfloat *params ) +static void GLAPIENTRY exec_GetFloatv( GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetFloatv( pname, params ); } -static void exec_GetIntegerv( GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetIntegerv( GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetIntegerv( pname, params ); } -static void exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) +static void GLAPIENTRY exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetLightfv( light, pname, params ); } -static void exec_GetLightiv( GLenum light, GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetLightiv( light, pname, params ); } -static void exec_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +static void GLAPIENTRY exec_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetMapdv( target, query, v ); } -static void exec_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +static void GLAPIENTRY exec_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetMapfv( target, query, v ); } -static void exec_GetMapiv( GLenum target, GLenum query, GLint *v ) +static void GLAPIENTRY exec_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetMapiv( target, query, v ); } -static void exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) +static void GLAPIENTRY exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetMaterialfv( face, pname, params ); } -static void exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetMaterialiv( face, pname, params ); } -static void exec_GetPixelMapfv( GLenum map, GLfloat *values ) +static void GLAPIENTRY exec_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPixelMapfv( map, values ); } -static void exec_GetPixelMapuiv( GLenum map, GLuint *values ) +static void GLAPIENTRY exec_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPixelMapuiv( map, values ); } -static void exec_GetPixelMapusv( GLenum map, GLushort *values ) +static void GLAPIENTRY exec_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPixelMapusv( map, values ); } -static void exec_GetPolygonStipple( GLubyte *dest ) +static void GLAPIENTRY exec_GetPolygonStipple( GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPolygonStipple( dest ); } -static const GLubyte *exec_GetString( GLenum name ) +static const GLubyte * GLAPIENTRY exec_GetString( GLenum name ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return ctx->Exec->GetString( name ); } -static void exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) +static void GLAPIENTRY exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexEnvfv( target, pname, params ); } -static void exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexEnviv( target, pname, params ); } -static void exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +static void GLAPIENTRY exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexGendv( coord, pname, params ); } -static void exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +static void GLAPIENTRY exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexGenfv( coord, pname, params ); } -static void exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexGeniv( coord, pname, params ); } -static void exec_GetTexImage( GLenum target, GLint level, GLenum format, +static void GLAPIENTRY exec_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); @@ -6484,7 +6484,7 @@ static void exec_GetTexImage( GLenum target, GLint level, GLenum format, ctx->Exec->GetTexImage( target, level, format, type, pixels ); } -static void exec_GetTexLevelParameterfv( GLenum target, GLint level, +static void GLAPIENTRY exec_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6492,7 +6492,7 @@ static void exec_GetTexLevelParameterfv( GLenum target, GLint level, ctx->Exec->GetTexLevelParameterfv( target, level, pname, params ); } -static void exec_GetTexLevelParameteriv( GLenum target, GLint level, +static void GLAPIENTRY exec_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6500,7 +6500,7 @@ static void exec_GetTexLevelParameteriv( GLenum target, GLint level, ctx->Exec->GetTexLevelParameteriv( target, level, pname, params ); } -static void exec_GetTexParameterfv( GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6508,35 +6508,35 @@ static void exec_GetTexParameterfv( GLenum target, GLenum pname, ctx->Exec->GetTexParameterfv( target, pname, params ); } -static void exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) +static void GLAPIENTRY exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetTexParameteriv( target, pname, params ); } -static GLboolean exec_IsEnabled( GLenum cap ) +static GLboolean GLAPIENTRY exec_IsEnabled( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return ctx->Exec->IsEnabled( cap ); } -static void exec_PixelStoref( GLenum pname, GLfloat param ) +static void GLAPIENTRY exec_PixelStoref( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->PixelStoref( pname, param ); } -static void exec_PixelStorei( GLenum pname, GLint param ) +static void GLAPIENTRY exec_PixelStorei( GLenum pname, GLint param ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->PixelStorei( pname, param ); } -static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, +static void GLAPIENTRY exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); @@ -6544,28 +6544,28 @@ static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels ); } -static GLint exec_RenderMode( GLenum mode ) +static GLint GLAPIENTRY exec_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return ctx->Exec->RenderMode( mode ); } -static void exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) +static void GLAPIENTRY exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->FeedbackBuffer( size, type, buffer ); } -static void exec_SelectBuffer( GLsizei size, GLuint *buffer ) +static void GLAPIENTRY exec_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->SelectBuffer( size, buffer ); } -static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName, +static GLboolean GLAPIENTRY exec_AreTexturesResident(GLsizei n, const GLuint *texName, GLboolean *residences) { GET_CURRENT_CONTEXT(ctx); @@ -6573,7 +6573,7 @@ static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName, return ctx->Exec->AreTexturesResident( n, texName, residences); } -static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6581,56 +6581,56 @@ static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride, ctx->Exec->ColorPointer( size, type, stride, ptr); } -static void exec_DeleteTextures( GLsizei n, const GLuint *texName) +static void GLAPIENTRY exec_DeleteTextures( GLsizei n, const GLuint *texName) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->DeleteTextures( n, texName); } -static void exec_DisableClientState( GLenum cap ) +static void GLAPIENTRY exec_DisableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->DisableClientState( cap ); } -static void exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) +static void GLAPIENTRY exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->EdgeFlagPointer( stride, vptr); } -static void exec_EnableClientState( GLenum cap ) +static void GLAPIENTRY exec_EnableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->EnableClientState( cap ); } -static void exec_GenTextures( GLsizei n, GLuint *texName ) +static void GLAPIENTRY exec_GenTextures( GLsizei n, GLuint *texName ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GenTextures( n, texName ); } -static void exec_GetPointerv( GLenum pname, GLvoid **params ) +static void GLAPIENTRY exec_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPointerv( pname, params ); } -static void exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) +static void GLAPIENTRY exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->IndexPointer( type, stride, ptr); } -static void exec_InterleavedArrays(GLenum format, GLsizei stride, +static void GLAPIENTRY exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); @@ -6638,35 +6638,35 @@ static void exec_InterleavedArrays(GLenum format, GLsizei stride, ctx->Exec->InterleavedArrays( format, stride, pointer); } -static GLboolean exec_IsTexture( GLuint texture ) +static GLboolean GLAPIENTRY exec_IsTexture( GLuint texture ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return ctx->Exec->IsTexture( texture ); } -static void exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) +static void GLAPIENTRY exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->NormalPointer( type, stride, ptr ); } -static void exec_PopClientAttrib(void) +static void GLAPIENTRY exec_PopClientAttrib(void) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->PopClientAttrib(); } -static void exec_PushClientAttrib(GLbitfield mask) +static void GLAPIENTRY exec_PushClientAttrib(GLbitfield mask) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->PushClientAttrib( mask); } -static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6674,7 +6674,7 @@ static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, ctx->Exec->TexCoordPointer( size, type, stride, ptr); } -static void exec_GetCompressedTexImageARB(GLenum target, GLint level, +static void GLAPIENTRY exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { GET_CURRENT_CONTEXT(ctx); @@ -6682,7 +6682,7 @@ static void exec_GetCompressedTexImageARB(GLenum target, GLint level, ctx->Exec->GetCompressedTexImageARB( target, level, img); } -static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6690,7 +6690,7 @@ static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride, ctx->Exec->VertexPointer( size, type, stride, ptr); } -static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, +static void GLAPIENTRY exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); @@ -6698,7 +6698,7 @@ static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width); } -static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, +static void GLAPIENTRY exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { @@ -6708,7 +6708,7 @@ static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, height); } -static void exec_GetColorTable( GLenum target, GLenum format, +static void GLAPIENTRY exec_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); @@ -6716,7 +6716,7 @@ static void exec_GetColorTable( GLenum target, GLenum format, ctx->Exec->GetColorTable( target, format, type, data ); } -static void exec_GetColorTableParameterfv( GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6724,7 +6724,7 @@ static void exec_GetColorTableParameterfv( GLenum target, GLenum pname, ctx->Exec->GetColorTableParameterfv( target, pname, params ); } -static void exec_GetColorTableParameteriv( GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6732,7 +6732,7 @@ static void exec_GetColorTableParameteriv( GLenum target, GLenum pname, ctx->Exec->GetColorTableParameteriv( target, pname, params ); } -static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, +static void GLAPIENTRY exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { GET_CURRENT_CONTEXT(ctx); @@ -6740,7 +6740,7 @@ static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, ctx->Exec->GetConvolutionFilter( target, format, type, image); } -static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -6748,7 +6748,7 @@ static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname, ctx->Exec->GetConvolutionParameterfv( target, pname, params); } -static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -6756,7 +6756,7 @@ static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname, ctx->Exec->GetConvolutionParameteriv( target, pname, params); } -static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, +static void GLAPIENTRY exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -6764,7 +6764,7 @@ static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, ctx->Exec->GetHistogram( target, reset, format, type, values); } -static void exec_GetHistogramParameterfv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -6772,7 +6772,7 @@ static void exec_GetHistogramParameterfv(GLenum target, GLenum pname, ctx->Exec->GetHistogramParameterfv( target, pname, params); } -static void exec_GetHistogramParameteriv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -6780,7 +6780,7 @@ static void exec_GetHistogramParameteriv(GLenum target, GLenum pname, ctx->Exec->GetHistogramParameteriv( target, pname, params); } -static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, +static void GLAPIENTRY exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -6788,7 +6788,7 @@ static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, ctx->Exec->GetMinmax( target, reset, format, type, values); } -static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -6796,7 +6796,7 @@ static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname, ctx->Exec->GetMinmaxParameterfv( target, pname, params); } -static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname, +static void GLAPIENTRY exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -6804,7 +6804,7 @@ static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname, ctx->Exec->GetMinmaxParameteriv( target, pname, params); } -static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, +static void GLAPIENTRY exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { GET_CURRENT_CONTEXT(ctx); @@ -6812,7 +6812,7 @@ static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, ctx->Exec->GetSeparableFilter( target, format, type, row, column, span); } -static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat, +static void GLAPIENTRY exec_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) @@ -6823,21 +6823,21 @@ static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat, type, row, column); } -static void exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +static void GLAPIENTRY exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPixelTexGenParameterivSGIS( target, value); } -static void exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +static void GLAPIENTRY exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value); } -static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6845,7 +6845,7 @@ static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr); } -static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, +static void GLAPIENTRY exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6853,7 +6853,7 @@ static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr); } -static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, +static void GLAPIENTRY exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6861,7 +6861,7 @@ static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, ctx->Exec->IndexPointerEXT( type, stride, count, ptr); } -static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, +static void GLAPIENTRY exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6869,7 +6869,7 @@ static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, ctx->Exec->NormalPointerEXT( type, stride, count, ptr); } -static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6877,7 +6877,7 @@ static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr); } -static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, +static void GLAPIENTRY exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6885,21 +6885,21 @@ static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr); } -static void exec_LockArraysEXT(GLint first, GLsizei count) +static void GLAPIENTRY exec_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->LockArraysEXT( first, count); } -static void exec_UnlockArraysEXT( void ) +static void GLAPIENTRY exec_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->UnlockArraysEXT( ); } -static void exec_ResizeBuffersMESA( void ) +static void GLAPIENTRY exec_ResizeBuffersMESA( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); @@ -6907,14 +6907,14 @@ static void exec_ResizeBuffersMESA( void ) } -static void exec_ClientActiveTextureARB( GLenum target ) +static void GLAPIENTRY exec_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); ctx->Exec->ClientActiveTextureARB(target); } -static void exec_SecondaryColorPointerEXT(GLint size, GLenum type, +static void GLAPIENTRY exec_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6922,7 +6922,7 @@ static void exec_SecondaryColorPointerEXT(GLint size, GLenum type, ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr); } -static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, +static void GLAPIENTRY exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); @@ -6931,7 +6931,7 @@ static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, } /* GL_EXT_multi_draw_arrays */ -static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first, +static void GLAPIENTRY exec_MultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); @@ -6940,7 +6940,7 @@ static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first, } /* GL_EXT_multi_draw_arrays */ -static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, +static void GLAPIENTRY exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) { @@ -6950,7 +6950,7 @@ static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, } /* GL_IBM_multimode_draw_arrays */ -static void exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first, +static void GLAPIENTRY exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride) { @@ -6960,7 +6960,7 @@ static void exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first, } /* GL_IBM_multimode_draw_arrays */ -static void exec_MultiModeDrawElementsIBM(const GLenum *mode, +static void GLAPIENTRY exec_MultiModeDrawElementsIBM(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, @@ -7504,7 +7504,7 @@ static const char *enum_string( GLenum k ) * Print the commands in a display list. For debugging only. * TODO: many commands aren't handled yet. */ -static void print_list( GLcontext *ctx, GLuint list ) +static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list ) { Node *n; GLboolean done; diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index f0beaf47acb..a6b9c363a11 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -42,21 +42,21 @@ extern void _mesa_init_lists( void ); extern void _mesa_destroy_list( GLcontext *ctx, GLuint list ); -extern void _mesa_CallList( GLuint list ); +extern void GLAPIENTRY _mesa_CallList( GLuint list ); -extern void _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); +extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); -extern void _mesa_DeleteLists( GLuint list, GLsizei range ); +extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ); -extern void _mesa_EndList( void ); +extern void GLAPIENTRY _mesa_EndList( void ); -extern GLuint _mesa_GenLists( GLsizei range ); +extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range ); -extern GLboolean _mesa_IsList( GLuint list ); +extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list ); -extern void _mesa_ListBase( GLuint base ); +extern void GLAPIENTRY _mesa_ListBase( GLuint base ); -extern void _mesa_NewList( GLuint list, GLenum mode ); +extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ); extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ); @@ -73,11 +73,11 @@ extern int _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, void (*destroy)( GLcontext *, void * ), void (*print)( GLcontext *, void * ) ); -extern void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, +extern void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); -extern void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); -extern void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); -extern void _mesa_save_CallList( GLuint list ); +extern void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); +extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); +extern void GLAPIENTRY _mesa_save_CallList( GLuint list ); extern void _mesa_init_display_list( GLcontext * ctx ); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index b9b472492b0..12b9f2930d8 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -38,7 +38,7 @@ /* * Execute glDrawPixels */ -void +void GLAPIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { @@ -87,7 +87,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, } } -void +void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ) { @@ -139,7 +139,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, -void +void GLAPIENTRY _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) { @@ -168,7 +168,7 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, -void +void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) @@ -232,7 +232,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, * Z-compositing. Normally, this operation requires two glDrawPixels * calls with stencil testing. */ -void +void GLAPIENTRY _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, GLenum colorFormat, GLenum colorType, const GLvoid *colors, diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h index 478767af4bf..2a2d7de8d81 100644 --- a/src/mesa/main/drawpix.h +++ b/src/mesa/main/drawpix.h @@ -31,22 +31,22 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ); -extern void +extern void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 8cb84d55d6e..a882cf4580c 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -156,7 +156,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls client_state(). */ -void +void GLAPIENTRY _mesa_EnableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); @@ -175,7 +175,7 @@ _mesa_EnableClientState( GLenum cap ) * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls client_state(). */ -void +void GLAPIENTRY _mesa_DisableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); @@ -231,9 +231,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.BlendEnabled = state; - /* The following needed to accomodate 1.0 RGB logic op blending */ - ctx->Color.ColorLogicOpEnabled = - (ctx->Color.BlendEquation == GL_LOGIC_OP && state); + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. + */ + ctx->Color._LogicOpEnabled = + (ctx->Color.ColorLogicOpEnabled || + (state && ctx->Color.BlendEquation == GL_LOGIC_OP)); break; #if FEATURE_userclip case GL_CLIP_PLANE0: @@ -383,6 +386,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ColorLogicOpEnabled = state; + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. + */ + ctx->Color._LogicOpEnabled = + (state || (ctx->Color.BlendEnabled && + ctx->Color.BlendEquation == GL_LOGIC_OP)); break; case GL_MAP1_COLOR_4: if (ctx->Eval.Map1Color4 == state) @@ -1009,7 +1018,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls _mesa_set_enable(). */ -void +void GLAPIENTRY _mesa_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); @@ -1029,7 +1038,7 @@ _mesa_Enable( GLenum cap ) * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls _mesa_set_enable(). */ -void +void GLAPIENTRY _mesa_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); @@ -1056,7 +1065,7 @@ _mesa_Disable( GLenum cap ) * For the capabilities associated with extensions verifies that those * extensions are effectively present before reporting. */ -GLboolean +GLboolean GLAPIENTRY _mesa_IsEnabled( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/enable.h b/src/mesa/main/enable.h index eeafb2dddd4..25c90b0275a 100644 --- a/src/mesa/main/enable.h +++ b/src/mesa/main/enable.h @@ -38,19 +38,19 @@ extern void _mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state ); -extern void +extern void GLAPIENTRY _mesa_Disable( GLenum cap ); -extern void +extern void GLAPIENTRY _mesa_Enable( GLenum cap ); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsEnabled( GLenum cap ); -extern void +extern void GLAPIENTRY _mesa_EnableClientState( GLenum cap ); -extern void +extern void GLAPIENTRY _mesa_DisableClientState( GLenum cap ); diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 314ecf0491d..3f89f9c1eae 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -417,7 +417,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, -void +void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { @@ -425,7 +425,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, } -void +void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { @@ -516,7 +516,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, } -void +void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, @@ -527,7 +527,7 @@ _mesa_Map2f( GLenum target, } -void +void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, @@ -539,7 +539,7 @@ _mesa_Map2d( GLenum target, -void +void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); @@ -604,7 +604,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) } -void +void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); @@ -669,7 +669,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) } -void +void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); @@ -735,7 +735,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) -void +void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); @@ -753,14 +753,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) } -void +void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); } -void +void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { @@ -788,7 +788,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, } -void +void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h index 525835c7d5d..b3ff0a96f82 100644 --- a/src/mesa/main/eval.h +++ b/src/mesa/main/eval.h @@ -72,47 +72,47 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target, -extern void +extern void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); -extern void +extern void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ); -extern void +extern void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); -extern void +extern void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ); -extern void +extern void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); -extern void +extern void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); -extern void +extern void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); -extern void +extern void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); -extern void +extern void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); -extern void +extern void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); -extern void +extern void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); #else diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index fb67683a396..fa7a33e0c0d 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -143,6 +143,7 @@ static const struct { { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, + { OFF, "GL_S3_s3tc", F(S3_s3tc) }, }; @@ -281,9 +282,11 @@ void _mesa_enable_1_4_extensions(GLcontext *ctx) { ctx->Extensions.ARB_depth_texture = GL_TRUE; + ctx->Extensions.ARB_fragment_program = GL_TRUE; ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; + ctx->Extensions.ARB_vertex_program = GL_TRUE; ctx->Extensions.ARB_window_pos = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 731fdf86bb8..106f34300a8 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -48,7 +48,7 @@ -void +void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); @@ -102,7 +102,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) } -void +void GLAPIENTRY _mesa_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); @@ -171,7 +171,7 @@ void _mesa_feedback_vertex( GLcontext *ctx, * Verifies we're not in selection mode, flushes the vertices and initialize * the fields in __GLcontextRec::Select with the given buffer. */ -void +void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); @@ -273,7 +273,7 @@ static void write_hit_record( GLcontext *ctx ) * the hit record data in gl_selection. Marks new render mode in * __GLcontextRec::NewState. */ -void +void GLAPIENTRY _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); @@ -304,7 +304,7 @@ _mesa_InitNames( void ) * * sa __GLcontextRec::Select. */ -void +void GLAPIENTRY _mesa_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); @@ -343,7 +343,7 @@ _mesa_LoadName( GLuint name ) * * sa __GLcontextRec::Select. */ -void +void GLAPIENTRY _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); @@ -374,7 +374,7 @@ _mesa_PushName( GLuint name ) * * sa __GLcontextRec::Select. */ -void +void GLAPIENTRY _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); @@ -417,7 +417,7 @@ _mesa_PopName( void ) * __GLcontextRec::RenderMode and notifies the driver via the * dd_function_table::RenderMode callback. */ -GLint +GLint GLAPIENTRY _mesa_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index e1f47030c91..bbd27e3a975 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -54,28 +54,28 @@ extern void _mesa_feedback_vertex( GLcontext *ctx, extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); -extern void +extern void GLAPIENTRY _mesa_PassThrough( GLfloat token ); -extern void +extern void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); -extern void +extern void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ); -extern void +extern void GLAPIENTRY _mesa_InitNames( void ); -extern void +extern void GLAPIENTRY _mesa_LoadName( GLuint name ); -extern void +extern void GLAPIENTRY _mesa_PushName( GLuint name ); -extern void +extern void GLAPIENTRY _mesa_PopName( void ); -extern GLint +extern GLint GLAPIENTRY _mesa_RenderMode( GLenum mode ); diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index b7f967ed673..d3b8a923aae 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -31,14 +31,14 @@ -void +void GLAPIENTRY _mesa_Fogf(GLenum pname, GLfloat param) { _mesa_Fogfv(pname, ¶m); } -void +void GLAPIENTRY _mesa_Fogi(GLenum pname, GLint param ) { GLfloat fparam = (GLfloat) param; @@ -46,7 +46,7 @@ _mesa_Fogi(GLenum pname, GLint param ) } -void +void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ) { GLfloat p[4]; @@ -73,7 +73,7 @@ _mesa_Fogiv(GLenum pname, const GLint *params ) } -void +void GLAPIENTRY _mesa_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/fog.h b/src/mesa/main/fog.h index 4a0417545b5..a14d19cdb39 100644 --- a/src/mesa/main/fog.h +++ b/src/mesa/main/fog.h @@ -42,16 +42,16 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_Fogf(GLenum pname, GLfloat param); -extern void +extern void GLAPIENTRY _mesa_Fogi(GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_Fogfv(GLenum pname, const GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ); extern void _mesa_init_fog( GLcontext * ctx ); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 76f70d26a71..dc5ddccb4b7 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -133,7 +133,7 @@ pixel_texgen_mode(const GLcontext *ctx) * otherwise gets the specified parameter from the current context, converting * it value into GLboolean. */ -void +void GLAPIENTRY _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1676,7 +1676,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) * otherwise gets the specified parameter from the current context, converting * it value into GLdouble. */ -void +void GLAPIENTRY _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); @@ -3213,7 +3213,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) * otherwise gets the specified parameter from the current context, converting * it value into GLfloat. */ -void +void GLAPIENTRY _mesa_GetFloatv( GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -4726,7 +4726,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) * otherwise gets the specified parameter from the current context, converting * it value into GLinteger. */ -void +void GLAPIENTRY _mesa_GetIntegerv( GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -6276,7 +6276,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) * Tries to get the specified pointer via dd_function_table::GetPointerv, * otherwise gets the specified pointer from the current context. */ -void +void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); @@ -6295,28 +6295,28 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) switch (pname) { case GL_VERTEX_ARRAY_POINTER: - *params = ctx->Array.Vertex.Ptr; + *params = (GLvoid *) ctx->Array.Vertex.Ptr; break; case GL_NORMAL_ARRAY_POINTER: - *params = ctx->Array.Normal.Ptr; + *params = (GLvoid *) ctx->Array.Normal.Ptr; break; case GL_COLOR_ARRAY_POINTER: - *params = ctx->Array.Color.Ptr; + *params = (GLvoid *) ctx->Array.Color.Ptr; break; case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: - *params = ctx->Array.SecondaryColor.Ptr; + *params = (GLvoid *) ctx->Array.SecondaryColor.Ptr; break; case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: - *params = ctx->Array.FogCoord.Ptr; + *params = (GLvoid *) ctx->Array.FogCoord.Ptr; break; case GL_INDEX_ARRAY_POINTER: - *params = ctx->Array.Index.Ptr; + *params = (GLvoid *) ctx->Array.Index.Ptr; break; case GL_TEXTURE_COORD_ARRAY_POINTER: - *params = ctx->Array.TexCoord[clientUnit].Ptr; + *params = (GLvoid *) ctx->Array.TexCoord[clientUnit].Ptr; break; case GL_EDGE_FLAG_ARRAY_POINTER: - *params = ctx->Array.EdgeFlag.Ptr; + *params = (GLvoid *) ctx->Array.EdgeFlag.Ptr; break; case GL_FEEDBACK_BUFFER_POINTER: *params = ctx->Feedback.Buffer; @@ -6371,7 +6371,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) * Tries to get the string from dd_function_table::GetString, otherwise returns * the hardcoded strings. */ -const GLubyte * +const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name ) { GET_CURRENT_CONTEXT(ctx); @@ -6466,7 +6466,7 @@ _mesa_GetString( GLenum name ) * * Returns __GLcontextRec::ErrorValue. */ -GLenum +GLenum GLAPIENTRY _mesa_GetError( void ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h index 5c7a81e1511..9b47b230a98 100644 --- a/src/mesa/main/get.h +++ b/src/mesa/main/get.h @@ -35,25 +35,25 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_GetBooleanv( GLenum pname, GLboolean *params ); -extern void +extern void GLAPIENTRY _mesa_GetDoublev( GLenum pname, GLdouble *params ); -extern void +extern void GLAPIENTRY _mesa_GetFloatv( GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetIntegerv( GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ); -extern const GLubyte * +extern const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name ); -extern GLenum +extern GLenum GLAPIENTRY _mesa_GetError( void ); #endif diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 5af819194ad..23ab1e6d0e6 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -32,7 +32,7 @@ -void +void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/hint.h b/src/mesa/main/hint.h index 57f3823fcfb..bfc3887107d 100644 --- a/src/mesa/main/hint.h +++ b/src/mesa/main/hint.h @@ -41,7 +41,7 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ); extern void diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index ea2c465e433..f390a2dade9 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -662,7 +662,7 @@ base_histogram_format( GLenum format ) */ -void +void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -729,7 +729,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo } -void +void GLAPIENTRY _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -792,7 +792,7 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G } -void +void GLAPIENTRY _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -839,7 +839,7 @@ _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void +void GLAPIENTRY _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -886,7 +886,7 @@ _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -912,7 +912,7 @@ _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void +void GLAPIENTRY _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -938,7 +938,7 @@ _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { GLuint i; @@ -1021,7 +1021,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s } -void +void GLAPIENTRY _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); @@ -1049,7 +1049,7 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) } -void +void GLAPIENTRY _mesa_ResetHistogram(GLenum target) { GLuint i; @@ -1077,7 +1077,7 @@ _mesa_ResetHistogram(GLenum target) } -void +void GLAPIENTRY _mesa_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index 548e0ba3839..67ddce01cfc 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -48,25 +48,35 @@ extern void _mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); -extern void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); +extern void GLAPIENTRY +_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); -extern void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +extern void GLAPIENTRY +_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -extern void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); +extern void GLAPIENTRY +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); -extern void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); +extern void GLAPIENTRY +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); -extern void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); +extern void GLAPIENTRY +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); -extern void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); +extern void GLAPIENTRY +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); -extern void _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +extern void GLAPIENTRY +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -extern void _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); +extern void GLAPIENTRY +_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); -extern void _mesa_ResetHistogram(GLenum target); +extern void GLAPIENTRY +_mesa_ResetHistogram(GLenum target); -extern void _mesa_ResetMinmax(GLenum target); +extern void GLAPIENTRY +_mesa_ResetMinmax(GLenum target); extern void _mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index b9f026d7e65..955f14f6b18 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -161,6 +161,8 @@ GLint _mesa_sizeof_type( GLenum type ) return sizeof(GLint); case GL_FLOAT: return sizeof(GLfloat); + case GL_HALF_FLOAT_NV: + return sizeof(GLhalfNV); default: return -1; } @@ -188,6 +190,8 @@ GLint _mesa_sizeof_packed_type( GLenum type ) return sizeof(GLuint); case GL_INT: return sizeof(GLint); + case GL_HALF_FLOAT_NV: + return sizeof(GLhalfNV); case GL_FLOAT: return sizeof(GLfloat); case GL_UNSIGNED_BYTE_3_3_2: @@ -297,6 +301,8 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) return comps * sizeof(GLint); case GL_FLOAT: return comps * sizeof(GLfloat); + case GL_HALF_FLOAT_NV: + return comps * sizeof(GLhalfNV); case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: if (format == GL_RGB || format == GL_BGR) @@ -361,6 +367,7 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_HALF_FLOAT_NV: return GL_TRUE; default: return GL_FALSE; @@ -381,6 +388,7 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_HALF_FLOAT_NV: return GL_TRUE; default: return GL_FALSE; @@ -395,6 +403,7 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_HALF_FLOAT_NV: case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: @@ -414,6 +423,7 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_HALF_FLOAT_NV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: @@ -1538,6 +1548,82 @@ _mesa_pack_float_rgba_span( GLcontext *ctx, } } break; + case GL_HALF_FLOAT_NV: + { + GLhalfNV *dst = (GLhalfNV *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = _mesa_float_to_half(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = _mesa_float_to_half(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = _mesa_float_to_half(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = _mesa_float_to_half(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = _mesa_float_to_half(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = _mesa_float_to_half(luminance[i]); + dst[i*2+1] = _mesa_float_to_half(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = _mesa_float_to_half(rgba[i][RCOMP]); + dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]); + dst[i*3+2] = _mesa_float_to_half(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = _mesa_float_to_half(rgba[i][RCOMP]); + dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]); + dst[i*4+2] = _mesa_float_to_half(rgba[i][BCOMP]); + dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = _mesa_float_to_half(rgba[i][BCOMP]); + dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]); + dst[i*3+2] = _mesa_float_to_half(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = _mesa_float_to_half(rgba[i][BCOMP]); + dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]); + dst[i*4+2] = _mesa_float_to_half(rgba[i][RCOMP]); + dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]); + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = _mesa_float_to_half(rgba[i][ACOMP]); + dst[i*4+1] = _mesa_float_to_half(rgba[i][BCOMP]); + dst[i*4+2] = _mesa_float_to_half(rgba[i][GCOMP]); + dst[i*4+3] = _mesa_float_to_half(rgba[i][RCOMP]); + } + break; + default: + _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps ); + } + } + break; case GL_UNSIGNED_BYTE_3_3_2: if (dstFormat == GL_RGB) { GLubyte *dst = (GLubyte *) dstAddr; @@ -1925,6 +2011,7 @@ extract_uint_indexes(GLuint n, GLuint indexes[], srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT); switch (srcType) { @@ -2062,6 +2149,23 @@ extract_uint_indexes(GLuint n, GLuint indexes[], } } break; + case GL_HALF_FLOAT_NV: + { + GLuint i; + const GLhalfNV *s = (const GLhalfNV *) src; + if (unpack->SwapBytes) { + for (i = 0; i < n; i++) { + GLhalfNV value = s[i]; + SWAP2BYTE(value); + indexes[i] = (GLuint) _mesa_half_to_float(value); + } + } + else { + for (i = 0; i < n; i++) + indexes[i] = (GLuint) _mesa_half_to_float(s[i]); + } + } + break; default: _mesa_problem(NULL, "bad srcType in extract_uint_indexes"); return; @@ -2113,6 +2217,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || @@ -2291,6 +2396,12 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat)); PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat)); break; + case GL_HALF_FLOAT_NV: + PROCESS(redIndex, RCOMP, 0.0F, GLhalfNV, _mesa_half_to_float); + PROCESS(greenIndex, GCOMP, 0.0F, GLhalfNV, _mesa_half_to_float); + PROCESS(blueIndex, BCOMP, 0.0F, GLhalfNV, _mesa_half_to_float); + PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfNV, _mesa_half_to_float); + break; case GL_UNSIGNED_BYTE_3_3_2: { const GLubyte *ubsrc = (const GLubyte *) src; @@ -2626,6 +2737,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx, srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || @@ -3019,6 +3131,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || @@ -3285,6 +3398,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT); ASSERT(dstType == GL_UNSIGNED_BYTE || @@ -3457,6 +3571,18 @@ _mesa_pack_index_span( const GLcontext *ctx, GLuint n, } } break; + case GL_HALF_FLOAT_NV: + { + GLhalfNV *dst = (GLhalfNV *) dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = _mesa_float_to_half((GLfloat) source[i]); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n ); + } + } + break; default: _mesa_problem(ctx, "bad type in _mesa_pack_index_span"); } @@ -3491,6 +3617,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || + srcType == GL_HALF_FLOAT_NV || srcType == GL_FLOAT); ASSERT(dstType == GL_UNSIGNED_BYTE || @@ -3677,6 +3804,18 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, } } break; + case GL_HALF_FLOAT_NV: + { + GLhalfNV *dst = (GLhalfNV *) dest; + GLuint i; + for (i=0;i<n;i++) { + dst[i] = _mesa_half_to_float(source[i]); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n ); + } + } + break; case GL_BITMAP: if (dstPacking->LsbFirst) { GLubyte *dst = (GLubyte *) dest; @@ -3778,6 +3917,15 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, case GL_FLOAT: MEMCPY(dest, source, n * sizeof(GLfloat)); break; + case GL_HALF_FLOAT_NV: + { + GLuint i; + const GLhalfNV *src = (const GLhalfNV *) source; + for (i = 0; i < n; i++) { + dest[i] = _mesa_half_to_float(src[i]); + } + } + break; default: _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()"); return; @@ -3898,6 +4046,18 @@ _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, } } break; + case GL_HALF_FLOAT_NV: + { + GLhalfNV *dst = (GLhalfNV *) dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = _mesa_float_to_half(depthSpan[i]); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n ); + } + } + break; default: _mesa_problem(ctx, "bad type in _mesa_pack_depth_span"); } diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 41179f4d940..3ca91fb15b7 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -64,8 +64,11 @@ #ifdef WIN32 #define vsnprintf _vsnprintf -#elif defined(__IBMC__) || defined(__IBMCPP__) || defined(VMS) +#elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 ) extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); +#ifdef __VMS +#include "vsnprintf.c" +#endif #endif @@ -350,6 +353,9 @@ static void init_sqrt_table(void) } +/** + * Single precision square root. + */ float _mesa_sqrtf( float x ) { @@ -494,7 +500,9 @@ _mesa_inv_sqrtf(float n) } -/** Wrapper around either pow() or xf86pow() */ +/** + * Wrapper around either pow() or xf86pow(). + */ double _mesa_pow(double x, double y) { @@ -506,7 +514,7 @@ _mesa_pow(double x, double y) } -/* +/** * Return number of bits set in given GLuint. */ unsigned int @@ -519,6 +527,145 @@ _mesa_bitcount(unsigned int n) return bits; } + +/** + * Convert a 4-byte float to a 2-byte half float. + * Based on code from: + * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html + */ +GLhalfNV +_mesa_float_to_half(float val) +{ + const int flt = *((int *) &val); + const int flt_m = flt & 0x7fffff; + const int flt_e = (flt >> 23) & 0xff; + const int flt_s = (flt >> 31) & 0x1; + int s, e, m; + GLhalfNV result; + + /* sign bit */ + s = flt_s; + + /* handle special cases */ + if ((flt_e == 0) && (flt_m == 0)) { + /* zero */ + m = 0; + e = 0; + } + else if ((flt_e == 0) && (flt_m != 0)) { + /* denorm -- denorm float maps to 0 half */ + m = 0; + e = 0; + } + else if ((flt_e == 0xff) && (flt_m == 0)) { + /* infinity */ + m = 0; + e = 31; + } + else if ((flt_e == 0xff) && (flt_m != 0)) { + /* NaN */ + m = 1; + e = 31; + } + else { + /* regular number */ + const int new_exp = flt_e - 127; + if (new_exp < -24) { + /* this maps to 0 */ + m = 0; + e = 0; + } + else if (new_exp < -14) { + /* this maps to a denorm */ + unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/ + e = 0; + switch (exp_val) { + case 0: + _mesa_warning(NULL, + "float_to_half: logical error in denorm creation!\n"); + m = 0; + break; + case 1: m = 512 + (flt_m >> 14); break; + case 2: m = 256 + (flt_m >> 15); break; + case 3: m = 128 + (flt_m >> 16); break; + case 4: m = 64 + (flt_m >> 17); break; + case 5: m = 32 + (flt_m >> 18); break; + case 6: m = 16 + (flt_m >> 19); break; + case 7: m = 8 + (flt_m >> 20); break; + case 8: m = 4 + (flt_m >> 21); break; + case 9: m = 2 + (flt_m >> 22); break; + case 10: m = 1; break; + } + } + else if (new_exp > 15) { + /* map this value to infinity */ + m = 0; + e = 31; + } + else { + /* regular */ + e = new_exp + 15; + m = flt_m >> 13; + } + } + + result = (s << 15) | (e << 10) | m; + return result; +} + + +/** + * Convert a 2-byte half float to a 4-byte float. + * Based on code from: + * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html + */ +float +_mesa_half_to_float(GLhalfNV val) +{ + /* XXX could also use a 64K-entry lookup table */ + const int m = val & 0x3ff; + const int e = (val >> 10) & 0x1f; + const int s = (val >> 15) & 0x1; + int flt_m, flt_e, flt_s, flt; + float result; + + /* sign bit */ + flt_s = s; + + /* handle special cases */ + if ((e == 0) && (m == 0)) { + /* zero */ + flt_m = 0; + flt_e = 0; + } + else if ((e == 0) && (m != 0)) { + /* denorm -- denorm half will fit in non-denorm single */ + const float half_denorm = 1.0f / 16384.0f; /* 2^-14 */ + float mantissa = ((float) (m)) / 1024.0f; + float sign = s ? -1.0f : 1.0f; + return sign * mantissa * half_denorm; + } + else if ((e == 31) && (m == 0)) { + /* infinity */ + flt_e = 0xff; + flt_m = 0; + } + else if ((e == 31) && (m != 0)) { + /* NaN */ + flt_e = 0xff; + flt_m = 1; + } + else { + /* regular */ + flt_e = e + 112; + flt_m = m << 13; + } + + flt = (flt_s << 31) | (flt_e << 23) | flt_m; + result = *((float *) &flt); + return result; +} + /*@}*/ @@ -526,7 +673,9 @@ _mesa_bitcount(unsigned int n) /** \name Environment vars */ /*@{*/ -/** Wrapper around either () or xf86() */ +/** + * Wrapper for getenv(). + */ char * _mesa_getenv( const char *var ) { diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 2c9c2fc3429..0c0a291e164 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -696,6 +696,12 @@ _mesa_log2(float x); extern unsigned int _mesa_bitcount(unsigned int n); +extern GLhalfNV +_mesa_float_to_half(float f); + +extern float +_mesa_half_to_float(GLhalfNV h); + extern char * _mesa_getenv( const char *var ); diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 5d473135681..4febf6faaa5 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -34,7 +34,7 @@ #include "math/m_matrix.h" -void +void GLAPIENTRY _mesa_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -59,14 +59,14 @@ _mesa_ShadeModel( GLenum mode ) } -void +void GLAPIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param ) { _mesa_Lightfv( light, pname, ¶m ); } -void +void GLAPIENTRY _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -192,14 +192,14 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) } -void +void GLAPIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param ) { _mesa_Lightiv( light, pname, ¶m ); } -void +void GLAPIENTRY _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; @@ -241,7 +241,7 @@ _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ) -void +void GLAPIENTRY _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -291,7 +291,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) } -void +void GLAPIENTRY _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -361,7 +361,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) /**********************************************************************/ -void +void GLAPIENTRY _mesa_LightModelfv( GLenum pname, const GLfloat *params ) { GLenum newenum; @@ -428,7 +428,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) } -void +void GLAPIENTRY _mesa_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; @@ -453,14 +453,14 @@ _mesa_LightModeliv( GLenum pname, const GLint *params ) } -void +void GLAPIENTRY _mesa_LightModeli( GLenum pname, GLint param ) { _mesa_LightModeliv( pname, ¶m ); } -void +void GLAPIENTRY _mesa_LightModelf( GLenum pname, GLfloat param ) { _mesa_LightModelfv( pname, ¶m ); @@ -649,7 +649,7 @@ _mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] ) } -void +void GLAPIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -687,7 +687,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) } -void +void GLAPIENTRY _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -733,7 +733,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) } -void +void GLAPIENTRY _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h index 1eb7f56985f..1f19019450f 100644 --- a/src/mesa/main/light.h +++ b/src/mesa/main/light.h @@ -34,47 +34,47 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_ShadeModel( GLenum mode ); #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ); -extern void +extern void GLAPIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_LightModelf( GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_LightModelfv( GLenum pname, const GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_LightModeli( GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_LightModeliv( GLenum pname, const GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 27f778a3946..c30d9ac109e 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -50,7 +50,7 @@ * width is different from one. Notifies the driver via the * dd_function_table::LineWidth callback. */ -void +void GLAPIENTRY _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); @@ -93,7 +93,7 @@ _mesa_LineWidth( GLfloat width ) * change flushes the vertices and notifies the driver via * the dd_function_table::LineStipple callback. */ -void +void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); @@ -122,7 +122,7 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) * Initializes __GLcontextRec::Line and line related constants in * __GLcontextRec::Const. */ -void _mesa_init_line( GLcontext * ctx ) +void GLAPIENTRY _mesa_init_line( GLcontext * ctx ) { /* Line group */ ctx->Line.SmoothFlag = GL_FALSE; diff --git a/src/mesa/main/lines.h b/src/mesa/main/lines.h index 7305a986473..5a47e9858d5 100644 --- a/src/mesa/main/lines.h +++ b/src/mesa/main/lines.h @@ -36,13 +36,13 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_LineWidth( GLfloat width ); -extern void +extern void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ); -extern void +extern void GLAPIENTRY _mesa_init_line( GLcontext * ctx ); #endif diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index e0ede0804a8..4370a580751 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -44,45 +44,45 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)] /** Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */ -#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) +#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) /** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */ -#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F)) +#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F)) /** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */ -#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) +#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) /** Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */ -#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) +#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) /** Convert GLfloat in [0.0,1.0] to GLushort in [0,65536] */ -#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F)) +#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F)) /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ -#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) +#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) /** Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */ -#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) +#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ -#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) +#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) /** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ -#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) +#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ -#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) +#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ /* causes overflow: -#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) +#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) */ /* a close approximation: */ -#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) +#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) #define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) @@ -124,13 +124,13 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /*@{*/ /** Zero */ -#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 +#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 /** Test for equality */ -#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ - (a)[1] == (b)[1] && \ - (a)[2] == (b)[2] && \ - (a)[3] == (b)[3]) +#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2] && \ + (a)[3] == (b)[3]) /** Test for equality (unsigned bytes) */ #if defined(__i386__) @@ -140,149 +140,148 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #endif /** Copy a 4-element vector */ -#define COPY_4V( DST, SRC ) \ -do { \ - (DST)[0] = (SRC)[0]; \ - (DST)[1] = (SRC)[1]; \ - (DST)[2] = (SRC)[2]; \ - (DST)[3] = (SRC)[3]; \ +#define COPY_4V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ + (DST)[3] = (SRC)[3]; \ } while (0) /** Copy a 4-element vector with cast */ -#define COPY_4V_CAST( DST, SRC, CAST ) \ -do { \ - (DST)[0] = (CAST)(SRC)[0]; \ - (DST)[1] = (CAST)(SRC)[1]; \ - (DST)[2] = (CAST)(SRC)[2]; \ - (DST)[3] = (CAST)(SRC)[3]; \ +#define COPY_4V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ + (DST)[3] = (CAST)(SRC)[3]; \ } while (0) /** Copy a 4-element unsigned byte vector */ #if defined(__i386__) -#define COPY_4UBV(DST, SRC) \ -do { \ - *((GLuint*)(DST)) = *((GLuint*)(SRC)); \ +#define COPY_4UBV(DST, SRC) \ +do { \ + *((GLuint*)(DST)) = *((GLuint*)(SRC)); \ } while (0) #else /* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */ -#define COPY_4UBV(DST, SRC) \ -do { \ - (DST)[0] = (SRC)[0]; \ - (DST)[1] = (SRC)[1]; \ - (DST)[2] = (SRC)[2]; \ - (DST)[3] = (SRC)[3]; \ +#define COPY_4UBV(DST, SRC) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ + (DST)[3] = (SRC)[3]; \ } while (0) #endif -/** Copy a 4-element float vector */ -#define COPY_4FV( DST, SRC ) \ -do { \ - const GLfloat *_tmp = (SRC); \ - (DST)[0] = _tmp[0]; \ - (DST)[1] = _tmp[1]; \ - (DST)[2] = _tmp[2]; \ - (DST)[3] = _tmp[3]; \ +/** Copy a 4-element float vector (Use COPY_FLOAT to avoid loading FPU) */ +#define COPY_4FV( DST, SRC ) \ +do { \ + COPY_FLOAT((DST)[0], (SRC)[0]); \ + COPY_FLOAT((DST)[1], (SRC)[1]); \ + COPY_FLOAT((DST)[2], (SRC)[2]); \ + COPY_FLOAT((DST)[3], (SRC)[3]); \ } while (0) /** Copy \p SZ elements into a 4-element vector */ -#define COPY_SZ_4V(DST, SZ, SRC) \ -do { \ - switch (SZ) { \ - case 4: (DST)[3] = (SRC)[3]; \ - case 3: (DST)[2] = (SRC)[2]; \ - case 2: (DST)[1] = (SRC)[1]; \ - case 1: (DST)[0] = (SRC)[0]; \ - } \ +#define COPY_SZ_4V(DST, SZ, SRC) \ +do { \ + switch (SZ) { \ + case 4: (DST)[3] = (SRC)[3]; \ + case 3: (DST)[2] = (SRC)[2]; \ + case 2: (DST)[1] = (SRC)[1]; \ + case 1: (DST)[0] = (SRC)[0]; \ + } \ } while(0) /** Copy \p SZ elements into a homegeneous (4-element) vector, giving * default values to the remaining */ -#define COPY_CLEAN_4V(DST, SZ, SRC) \ -do { \ - ASSIGN_4V( DST, 0, 0, 0, 1 ); \ - COPY_SZ_4V( DST, SZ, SRC ); \ +#define COPY_CLEAN_4V(DST, SZ, SRC) \ +do { \ + ASSIGN_4V( DST, 0, 0, 0, 1 ); \ + COPY_SZ_4V( DST, SZ, SRC ); \ } while (0) /** Subtraction */ -#define SUB_4V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ - (DST)[3] = (SRCA)[3] - (SRCB)[3]; \ +#define SUB_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] - (SRCB)[3]; \ } while (0) /** Addition */ -#define ADD_4V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ - (DST)[3] = (SRCA)[3] + (SRCB)[3]; \ +#define ADD_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] + (SRCB)[3]; \ } while (0) /** Element-wise multiplication */ -#define SCALE_4V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ - (DST)[3] = (SRCA)[3] * (SRCB)[3]; \ +#define SCALE_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] * (SRCB)[3]; \ } while (0) /** In-place addition */ -#define ACC_4V( DST, SRC ) \ -do { \ - (DST)[0] += (SRC)[0]; \ - (DST)[1] += (SRC)[1]; \ - (DST)[2] += (SRC)[2]; \ - (DST)[3] += (SRC)[3]; \ +#define ACC_4V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ + (DST)[2] += (SRC)[2]; \ + (DST)[3] += (SRC)[3]; \ } while (0) /** Element-wise multiplication and addition */ -#define ACC_SCALE_4V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ - (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ - (DST)[3] += (SRCA)[3] * (SRCB)[3]; \ +#define ACC_SCALE_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ + (DST)[3] += (SRCA)[3] * (SRCB)[3]; \ } while (0) /** In-place scalar multiplication and addition */ -#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ -do { \ - (DST)[0] += S * (SRCB)[0]; \ - (DST)[1] += S * (SRCB)[1]; \ - (DST)[2] += S * (SRCB)[2]; \ - (DST)[3] += S * (SRCB)[3]; \ +#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ + (DST)[2] += S * (SRCB)[2]; \ + (DST)[3] += S * (SRCB)[3]; \ } while (0) /** Scalar multiplication */ -#define SCALE_SCALAR_4V( DST, S, SRCB ) \ -do { \ - (DST)[0] = S * (SRCB)[0]; \ - (DST)[1] = S * (SRCB)[1]; \ - (DST)[2] = S * (SRCB)[2]; \ - (DST)[3] = S * (SRCB)[3]; \ +#define SCALE_SCALAR_4V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ + (DST)[2] = S * (SRCB)[2]; \ + (DST)[3] = S * (SRCB)[3]; \ } while (0) /** In-place scalar multiplication */ -#define SELF_SCALE_SCALAR_4V( DST, S ) \ -do { \ - (DST)[0] *= S; \ - (DST)[1] *= S; \ - (DST)[2] *= S; \ - (DST)[3] *= S; \ +#define SELF_SCALE_SCALAR_4V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ + (DST)[2] *= S; \ + (DST)[3] *= S; \ } while (0) /** Assignment */ -#define ASSIGN_4V( V, V0, V1, V2, V3 ) \ -do { \ - V[0] = V0; \ - V[1] = V1; \ - V[2] = V2; \ - V[3] = V3; \ +#define ASSIGN_4V( V, V0, V1, V2, V3 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ + V[2] = V2; \ + V[3] = V3; \ } while(0) /*@}*/ @@ -293,124 +292,124 @@ do { \ /*@{*/ /** Zero */ -#define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0 +#define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0 /** Test for equality */ -#define TEST_EQ_3V(a,b) ((a)[0] == (b)[0] && \ - (a)[1] == (b)[1] && \ - (a)[2] == (b)[2]) +#define TEST_EQ_3V(a,b) ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2]) /** Copy a 3-element vector */ -#define COPY_3V( DST, SRC ) \ -do { \ - (DST)[0] = (SRC)[0]; \ - (DST)[1] = (SRC)[1]; \ - (DST)[2] = (SRC)[2]; \ +#define COPY_3V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ } while (0) /** Copy a 3-element vector with cast */ -#define COPY_3V_CAST( DST, SRC, CAST ) \ -do { \ - (DST)[0] = (CAST)(SRC)[0]; \ - (DST)[1] = (CAST)(SRC)[1]; \ - (DST)[2] = (CAST)(SRC)[2]; \ +#define COPY_3V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ } while (0) /** Copy a 3-element float vector */ -#define COPY_3FV( DST, SRC ) \ -do { \ - const GLfloat *_tmp = (SRC); \ - (DST)[0] = _tmp[0]; \ - (DST)[1] = _tmp[1]; \ - (DST)[2] = _tmp[2]; \ +#define COPY_3FV( DST, SRC ) \ +do { \ + const GLfloat *_tmp = (SRC); \ + (DST)[0] = _tmp[0]; \ + (DST)[1] = _tmp[1]; \ + (DST)[2] = _tmp[2]; \ } while (0) /** Subtraction */ -#define SUB_3V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ +#define SUB_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ } while (0) /** Addition */ -#define ADD_3V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ +#define ADD_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ } while (0) /** In-place scalar multiplication */ -#define SCALE_3V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ - (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ +#define SCALE_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ } while (0) /** In-place element-wise multiplication */ -#define SELF_SCALE_3V( DST, SRC ) \ -do { \ - (DST)[0] *= (SRC)[0]; \ - (DST)[1] *= (SRC)[1]; \ - (DST)[2] *= (SRC)[2]; \ +#define SELF_SCALE_3V( DST, SRC ) \ +do { \ + (DST)[0] *= (SRC)[0]; \ + (DST)[1] *= (SRC)[1]; \ + (DST)[2] *= (SRC)[2]; \ } while (0) /** In-place addition */ -#define ACC_3V( DST, SRC ) \ -do { \ - (DST)[0] += (SRC)[0]; \ - (DST)[1] += (SRC)[1]; \ - (DST)[2] += (SRC)[2]; \ +#define ACC_3V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ + (DST)[2] += (SRC)[2]; \ } while (0) /** Element-wise multiplication and addition */ -#define ACC_SCALE_3V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ - (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ +#define ACC_SCALE_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ } while (0) /** Scalar multiplication */ -#define SCALE_SCALAR_3V( DST, S, SRCB ) \ -do { \ - (DST)[0] = S * (SRCB)[0]; \ - (DST)[1] = S * (SRCB)[1]; \ - (DST)[2] = S * (SRCB)[2]; \ +#define SCALE_SCALAR_3V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ + (DST)[2] = S * (SRCB)[2]; \ } while (0) /** In-place scalar multiplication and addition */ -#define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \ -do { \ - (DST)[0] += S * (SRCB)[0]; \ - (DST)[1] += S * (SRCB)[1]; \ - (DST)[2] += S * (SRCB)[2]; \ +#define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ + (DST)[2] += S * (SRCB)[2]; \ } while (0) /** In-place scalar multiplication */ -#define SELF_SCALE_SCALAR_3V( DST, S ) \ -do { \ - (DST)[0] *= S; \ - (DST)[1] *= S; \ - (DST)[2] *= S; \ +#define SELF_SCALE_SCALAR_3V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ + (DST)[2] *= S; \ } while (0) /** In-place scalar addition */ -#define ACC_SCALAR_3V( DST, S ) \ -do { \ - (DST)[0] += S; \ - (DST)[1] += S; \ - (DST)[2] += S; \ +#define ACC_SCALAR_3V( DST, S ) \ +do { \ + (DST)[0] += S; \ + (DST)[1] += S; \ + (DST)[2] += S; \ } while (0) /** Assignment */ -#define ASSIGN_3V( V, V0, V1, V2 ) \ -do { \ - V[0] = V0; \ - V[1] = V1; \ - V[2] = V2; \ +#define ASSIGN_3V( V, V0, V1, V2 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ + V[2] = V2; \ } while(0) /*@}*/ @@ -421,91 +420,91 @@ do { \ /*@{*/ /** Zero */ -#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 +#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 /** Copy a 2-element vector */ -#define COPY_2V( DST, SRC ) \ -do { \ - (DST)[0] = (SRC)[0]; \ - (DST)[1] = (SRC)[1]; \ +#define COPY_2V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ } while (0) /** Copy a 2-element vector with cast */ -#define COPY_2V_CAST( DST, SRC, CAST ) \ -do { \ - (DST)[0] = (CAST)(SRC)[0]; \ - (DST)[1] = (CAST)(SRC)[1]; \ +#define COPY_2V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ } while (0) /** Copy a 2-element float vector */ -#define COPY_2FV( DST, SRC ) \ -do { \ - const GLfloat *_tmp = (SRC); \ - (DST)[0] = _tmp[0]; \ - (DST)[1] = _tmp[1]; \ +#define COPY_2FV( DST, SRC ) \ +do { \ + const GLfloat *_tmp = (SRC); \ + (DST)[0] = _tmp[0]; \ + (DST)[1] = _tmp[1]; \ } while (0) /** Subtraction */ -#define SUB_2V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ +#define SUB_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ } while (0) /** Addition */ -#define ADD_2V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ +#define ADD_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ } while (0) /** In-place scalar multiplication */ -#define SCALE_2V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ +#define SCALE_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ } while (0) /** In-place addition */ -#define ACC_2V( DST, SRC ) \ -do { \ - (DST)[0] += (SRC)[0]; \ - (DST)[1] += (SRC)[1]; \ +#define ACC_2V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ } while (0) /** Element-wise multiplication and addition */ -#define ACC_SCALE_2V( DST, SRCA, SRCB ) \ -do { \ - (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ - (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ +#define ACC_SCALE_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ } while (0) /** Scalar multiplication */ -#define SCALE_SCALAR_2V( DST, S, SRCB ) \ -do { \ - (DST)[0] = S * (SRCB)[0]; \ - (DST)[1] = S * (SRCB)[1]; \ +#define SCALE_SCALAR_2V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ } while (0) /** In-place scalar multiplication and addition */ -#define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \ -do { \ - (DST)[0] += S * (SRCB)[0]; \ - (DST)[1] += S * (SRCB)[1]; \ +#define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ } while (0) /** In-place scalar multiplication */ -#define SELF_SCALE_SCALAR_2V( DST, S ) \ -do { \ - (DST)[0] *= S; \ - (DST)[1] *= S; \ +#define SELF_SCALE_SCALAR_2V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ } while (0) /** In-place scalar addition */ -#define ACC_SCALAR_2V( DST, S ) \ -do { \ - (DST)[0] += S; \ - (DST)[1] += S; \ +#define ACC_SCALAR_2V( DST, S ) \ +do { \ + (DST)[0] += S; \ + (DST)[1] += S; \ } while (0) @@ -516,79 +515,79 @@ do { \ * \note \p OUT argument is evaluated twice! * \note Be wary of using *coord++ as an argument to any of these macros! */ -#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) +#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) /* Can do better with integer math */ -#define INTERP_UB( t, dstub, outub, inub ) \ -do { \ - GLfloat inf = UBYTE_TO_FLOAT( inub ); \ - GLfloat outf = UBYTE_TO_FLOAT( outub ); \ - GLfloat dstf = LINTERP( t, outf, inf ); \ - UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \ +#define INTERP_UB( t, dstub, outub, inub ) \ +do { \ + GLfloat inf = UBYTE_TO_FLOAT( inub ); \ + GLfloat outf = UBYTE_TO_FLOAT( outub ); \ + GLfloat dstf = LINTERP( t, outf, inf ); \ + UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \ } while (0) -#define INTERP_CHAN( t, dstc, outc, inc ) \ -do { \ - GLfloat inf = CHAN_TO_FLOAT( inc ); \ - GLfloat outf = CHAN_TO_FLOAT( outc ); \ - GLfloat dstf = LINTERP( t, outf, inf ); \ - UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ +#define INTERP_CHAN( t, dstc, outc, inc ) \ +do { \ + GLfloat inf = CHAN_TO_FLOAT( inc ); \ + GLfloat outf = CHAN_TO_FLOAT( outc ); \ + GLfloat dstf = LINTERP( t, outf, inf ); \ + UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ } while (0) -#define INTERP_UI( t, dstui, outui, inui ) \ +#define INTERP_UI( t, dstui, outui, inui ) \ dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) ) -#define INTERP_F( t, dstf, outf, inf ) \ +#define INTERP_F( t, dstf, outf, inf ) \ dstf = LINTERP( t, outf, inf ) -#define INTERP_4F( t, dst, out, in ) \ -do { \ - dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ - dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ - dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ - dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ +#define INTERP_4F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ + dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ } while (0) -#define INTERP_3F( t, dst, out, in ) \ -do { \ - dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ - dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ - dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ +#define INTERP_3F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ } while (0) -#define INTERP_4CHAN( t, dst, out, in ) \ -do { \ - INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ - INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ - INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ - INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ +#define INTERP_4CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ + INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ } while (0) -#define INTERP_3CHAN( t, dst, out, in ) \ -do { \ - INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ - INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ - INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ +#define INTERP_3CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ } while (0) -#define INTERP_SZ( t, vec, to, out, in, sz ) \ -do { \ - switch (sz) { \ - case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ - case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ - case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ - case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ - } \ +#define INTERP_SZ( t, vec, to, out, in, sz ) \ +do { \ + switch (sz) { \ + case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ + case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ + case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ + case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ + } \ } while(0) /** Assign scalers to short vectors */ -#define ASSIGN_2V( V, V0, V1 ) \ -do { \ - V[0] = V0; \ - V[1] = V1; \ +#define ASSIGN_2V( V, V0, V1 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ } while(0) /*@}*/ @@ -618,31 +617,31 @@ do { \ /** Dot product of two 4-element vectors */ #define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \ - (a)[2]*(b)[2] + (a)[3]*(b)[3] ) + (a)[2]*(b)[2] + (a)[3]*(b)[3] ) /** Dot product of two 4-element vectors */ #define DOT4V(v,a,b,c,d) (v[0]*(a) + v[1]*(b) + v[2]*(c) + v[3]*(d)) /** Cross product of two 3-element vectors */ -#define CROSS3(n, u, v) \ -do { \ - (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ - (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ - (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \ +#define CROSS3(n, u, v) \ +do { \ + (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ + (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ + (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \ } while (0) /* Normalize a 3-element vector to unit length. */ -#define NORMALIZE_3FV( V ) \ -do { \ - GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ - if (len) { \ - len = INV_SQRTF(len); \ - (V)[0] = (GLfloat) ((V)[0] * len); \ - (V)[1] = (GLfloat) ((V)[1] * len); \ - (V)[2] = (GLfloat) ((V)[2] * len); \ - } \ +#define NORMALIZE_3FV( V ) \ +do { \ + GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ + if (len) { \ + len = INV_SQRTF(len); \ + (V)[0] = (GLfloat) ((V)[0] * len); \ + (V)[1] = (GLfloat) ((V)[1] * len); \ + (V)[2] = (GLfloat) ((V)[2] * len); \ + } \ } while(0) #define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])) diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index e74e1728e79..76ca28451f7 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -61,7 +61,7 @@ * the top matrix of the current matrix stack and sets * __GLcontextRec::NewState. */ -void +void GLAPIENTRY _mesa_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) @@ -103,7 +103,7 @@ _mesa_Frustum( GLdouble left, GLdouble right, * the top matrix of the current matrix stack and sets * __GLcontextRec::NewState. */ -void +void GLAPIENTRY _mesa_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) @@ -142,7 +142,7 @@ _mesa_Ortho( GLdouble left, GLdouble right, * __GLcontextRec::CurrentStack and gl_transform_attrib::MatrixMode with the * specified matrix stack. */ -void +void GLAPIENTRY _mesa_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -222,7 +222,7 @@ _mesa_MatrixMode( GLenum mode ) * matrix in the stack. Marks __GLcontextRec::NewState with the stack dirty * flag. */ -void +void GLAPIENTRY _mesa_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); @@ -254,7 +254,7 @@ _mesa_PushMatrix( void ) * moves the stack head down. Marks __GLcontextRec::NewState with the dirty * stack flag. */ -void +void GLAPIENTRY _mesa_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); @@ -284,7 +284,7 @@ _mesa_PopMatrix( void ) * matrix in the current stack. Marks __GLcontextRec::NewState with the stack * dirty flag. */ -void +void GLAPIENTRY _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); @@ -309,7 +309,7 @@ _mesa_LoadIdentity( void ) * in the current stack and the given matrix. Marks __GLcontextRec::NewState * with the dirty stack flag. */ -void +void GLAPIENTRY _mesa_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); @@ -339,7 +339,7 @@ _mesa_LoadMatrixf( const GLfloat *m ) * matrix in the current stack and the given matrix. Marks * __GLcontextRec::NewState with the dirty stack flag. */ -void +void GLAPIENTRY _mesa_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); @@ -371,7 +371,7 @@ _mesa_MultMatrixf( const GLfloat *m ) * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ -void +void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); @@ -396,7 +396,7 @@ _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ -void +void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); @@ -419,7 +419,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ -void +void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); @@ -430,7 +430,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_LoadMatrixd( const GLdouble *m ) { GLint i; @@ -441,7 +441,7 @@ _mesa_LoadMatrixd( const GLdouble *m ) _mesa_LoadMatrixf(f); } -void +void GLAPIENTRY _mesa_MultMatrixd( const GLdouble *m ) { GLint i; @@ -453,21 +453,21 @@ _mesa_MultMatrixd( const GLdouble *m ) } -void +void GLAPIENTRY _mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { _mesa_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); } -void +void GLAPIENTRY _mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ) { _mesa_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); } -void +void GLAPIENTRY _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ) { _mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); @@ -476,7 +476,7 @@ _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ) #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_LoadTransposeMatrixfARB( const GLfloat *m ) { GLfloat tm[16]; @@ -486,7 +486,7 @@ _mesa_LoadTransposeMatrixfARB( const GLfloat *m ) } -void +void GLAPIENTRY _mesa_LoadTransposeMatrixdARB( const GLdouble *m ) { GLfloat tm[16]; @@ -496,7 +496,7 @@ _mesa_LoadTransposeMatrixdARB( const GLdouble *m ) } -void +void GLAPIENTRY _mesa_MultTransposeMatrixfARB( const GLfloat *m ) { GLfloat tm[16]; @@ -506,7 +506,7 @@ _mesa_MultTransposeMatrixfARB( const GLfloat *m ) } -void +void GLAPIENTRY _mesa_MultTransposeMatrixdARB( const GLdouble *m ) { GLfloat tm[16]; @@ -528,7 +528,7 @@ _mesa_MultTransposeMatrixdARB( const GLdouble *m ) * Flushes the vertices and calls _mesa_set_viewport() with the given * parameters. */ -void +void GLAPIENTRY _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); @@ -625,7 +625,7 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_DepthRange( GLclampd nearval, GLclampd farval ) { /* diff --git a/src/mesa/main/matrix.h b/src/mesa/main/matrix.h index b81ab848448..38769867a75 100644 --- a/src/mesa/main/matrix.h +++ b/src/mesa/main/matrix.h @@ -35,77 +35,77 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ); -extern void +extern void GLAPIENTRY _mesa_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ); -extern void +extern void GLAPIENTRY _mesa_PushMatrix( void ); -extern void +extern void GLAPIENTRY _mesa_PopMatrix( void ); -extern void +extern void GLAPIENTRY _mesa_LoadIdentity( void ); -extern void +extern void GLAPIENTRY _mesa_LoadMatrixf( const GLfloat *m ); -extern void +extern void GLAPIENTRY _mesa_LoadMatrixd( const GLdouble *m ); -extern void +extern void GLAPIENTRY _mesa_MatrixMode( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_MultMatrixf( const GLfloat *m ); -extern void +extern void GLAPIENTRY _mesa_MultMatrixd( const GLdouble *m ); -extern void +extern void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); -extern void +extern void GLAPIENTRY _mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); -extern void +extern void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); -extern void +extern void GLAPIENTRY _mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); -extern void +extern void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); -extern void +extern void GLAPIENTRY _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); -extern void +extern void GLAPIENTRY _mesa_LoadTransposeMatrixfARB( const GLfloat *m ); -extern void +extern void GLAPIENTRY _mesa_LoadTransposeMatrixdARB( const GLdouble *m ); -extern void +extern void GLAPIENTRY _mesa_MultTransposeMatrixfARB( const GLfloat *m ); -extern void +extern void GLAPIENTRY _mesa_MultTransposeMatrixdARB( const GLdouble *m ); -extern void +extern void GLAPIENTRY _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ); -extern void +extern void _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ); -extern void +extern void GLAPIENTRY _mesa_DepthRange( GLclampd nearval, GLclampd farval ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a8432a985fd..012667a2abe 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -430,6 +430,7 @@ struct gl_colorbuffer_attrib { GLenum LogicOp; /**< Logic operator */ GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */ GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */ + GLboolean _LogicOpEnabled; /**< RGBA logic op + EXT_blend_logic_op enabled flag */ /*@}*/ GLboolean DitherFlag; /**< Dither enable flag */ @@ -473,7 +474,7 @@ struct gl_current_attrib { */ struct gl_depthbuffer_attrib { GLenum Func; /**< Function for depth buffer compare */ - GLfloat Clear; /**< Value to clear depth buffer to */ + GLclampd Clear; /**< Value to clear depth buffer to */ GLboolean Test; /**< Depth buffering enabled flag */ GLboolean Mask; /**< Depth buffer writable? */ GLboolean OcclusionTest; /**< GL_HP_occlusion_test */ @@ -1289,13 +1290,15 @@ struct gl_client_array { GLenum Type; GLsizei Stride; /**< user-specified stride */ GLsizei StrideB; /**< actual stride in bytes */ - GLubyte *Ptr; - GLuint Flags; + const GLubyte *Ptr; GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */ GLboolean Normalized; /**< GL_ARB_vertex_program */ /**< GL_ARB_vertex_buffer_object */ struct gl_buffer_object *BufferObj; + GLuint _MaxElement; + + GLuint Flags; }; @@ -1327,6 +1330,7 @@ struct gl_array_attrib { struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; #endif + GLuint _MaxElement; /* Min of all enabled array's maxes */ }; @@ -1442,7 +1446,8 @@ enum register_file PROGRAM_ENV_PARAM, PROGRAM_NAMED_PARAM, PROGRAM_STATE_VAR, - PROGRAM_WRITE_ONLY + PROGRAM_WRITE_ONLY, + PROGRAM_ADDRESS }; @@ -1481,6 +1486,7 @@ struct vertex_program GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ GLuint InputsRead; /* Bitmask of which input regs are read */ GLuint OutputsWritten; /* Bitmask of which output regs are written to */ + struct program_parameter_list *Parameters; /**< array [NumParameters] */ }; @@ -1718,6 +1724,8 @@ struct gl_constants /* vertex or fragment program */ GLuint MaxProgramMatrices; GLuint MaxProgramMatrixStackDepth; + /* vertex array / buffer object bounds checking */ + GLboolean CheckArrayBounds; }; @@ -1807,6 +1815,7 @@ struct gl_extensions GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean TDFX_texture_compression_FXT1; GLboolean APPLE_client_storage; + GLboolean S3_s3tc; /*@}*/ /* The extension string */ const GLubyte *String; diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index 2fb20772879..65ce7ca6526 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -49,7 +49,7 @@ * Execute a vertex state program. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { struct vertex_program *vprog; @@ -81,7 +81,7 @@ _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, +GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences) { GLint i, j; @@ -128,7 +128,7 @@ GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, * Request that a set of programs be resident in hardware. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids) { GLint i; @@ -166,7 +166,7 @@ _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params) { @@ -201,7 +201,7 @@ _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params) { @@ -236,7 +236,7 @@ _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) { struct program *prog; @@ -273,7 +273,7 @@ _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) { struct program *prog; @@ -307,7 +307,7 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params) { @@ -349,7 +349,7 @@ _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); @@ -385,7 +385,7 @@ _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -421,7 +421,7 @@ _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -468,7 +468,7 @@ _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); @@ -484,7 +484,7 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) return; } - *pointer = ctx->Array.VertexAttrib[index].Ptr;; + *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;; } @@ -493,7 +493,7 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) * Load/parse/compile a program. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program) { @@ -555,7 +555,7 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, * Set a program parameter register. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { @@ -568,7 +568,7 @@ _mesa_ProgramParameter4dNV(GLenum target, GLuint index, * Set a program parameter register. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params) { @@ -582,7 +582,7 @@ _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, * Set a program parameter register. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -609,7 +609,7 @@ _mesa_ProgramParameter4fNV(GLenum target, GLuint index, * Set a program parameter register. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) { @@ -623,7 +623,7 @@ _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, * Set a sequence of program parameter registers. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params) { @@ -655,7 +655,7 @@ _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, * Set a sequence of program parameter registers. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params) { @@ -685,7 +685,7 @@ _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, * Setup tracking of matrices into program parameter registers. * \note Called from the GL API dispatcher. */ -void +void GLAPIENTRY _mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform) { @@ -743,7 +743,7 @@ _mesa_TrackMatrixNV(GLenum target, GLuint address, } -void +void GLAPIENTRY _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { @@ -779,7 +779,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, } -void +void GLAPIENTRY _mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]) { @@ -787,7 +787,7 @@ _mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, } -void +void GLAPIENTRY _mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { @@ -796,7 +796,7 @@ _mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, } -void +void GLAPIENTRY _mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]) { @@ -806,7 +806,7 @@ _mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, } -void +void GLAPIENTRY _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params) { @@ -844,7 +844,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, } -void +void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params) { diff --git a/src/mesa/main/nvprogram.h b/src/mesa/main/nvprogram.h index f505a84ab8c..dcea7727e04 100644 --- a/src/mesa/main/nvprogram.h +++ b/src/mesa/main/nvprogram.h @@ -30,88 +30,88 @@ #define NVPROGRAM_H -extern void +extern void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences); -extern void +extern void GLAPIENTRY _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids); -extern void +extern void GLAPIENTRY _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program); -extern void +extern void GLAPIENTRY _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer); -extern void +extern void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program); -extern void +extern void GLAPIENTRY _mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params); -extern void +extern void GLAPIENTRY _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform); -extern void +extern void GLAPIENTRY _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]); -extern void +extern void GLAPIENTRY _mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]); -extern void +extern void GLAPIENTRY _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -extern void +extern void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c index 580d04abca5..f3034ea6991 100644 --- a/src/mesa/main/nvvertexec.c +++ b/src/mesa/main/nvvertexec.c @@ -64,6 +64,23 @@ _mesa_init_vp_registers(GLcontext *ctx) } /* The program parameters aren't touched */ + /* XXX: This should be moved to glBegin() time, but its safe (and slow!) + * here - Karl + */ + if (ctx->VertexProgram.Current->Parameters) { + + /* Grab the state */ + _mesa_load_state_parameters(ctx, ctx->VertexProgram.Current->Parameters); + + /* And copy it into the program state */ + for (i=0; i<ctx->VertexProgram.Current->Parameters->NumParameters; i++) { + MEMCPY(ctx->VertexProgram.Parameters[i], + &ctx->VertexProgram.Current->Parameters->Parameters[i].Values, + 4*sizeof(GLfloat)); + } + + } + } @@ -234,13 +251,11 @@ get_register_pointer( const struct vp_src_register *source, return state->Inputs[source->Index]; case PROGRAM_LOCAL_PARAM: /* XXX fix */ - return state->Temporaries[source->Index]; + return state->Temporaries[source->Index]; case PROGRAM_ENV_PARAM: return state->Parameters[source->Index]; case PROGRAM_STATE_VAR: - /* XXX fix */ - return NULL; - break; + return state->Parameters[source->Index]; default: _mesa_problem(NULL, "Bad source register file in fetch_vector4(vp)"); diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c index 871beb9e541..1285874ef6f 100644 --- a/src/mesa/main/occlude.c +++ b/src/mesa/main/occlude.c @@ -97,7 +97,7 @@ delete_query_object(struct occlusion_query *q) } -void +void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids) { GET_CURRENT_CONTEXT(ctx); @@ -131,7 +131,7 @@ _mesa_GenQueriesARB(GLsizei n, GLuint *ids) } -void +void GLAPIENTRY _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); @@ -161,7 +161,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) } -GLboolean +GLboolean GLAPIENTRY _mesa_IsQueryARB(GLuint id) { GET_CURRENT_CONTEXT(ctx); @@ -174,7 +174,7 @@ _mesa_IsQueryARB(GLuint id) } -void +void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id) { GET_CURRENT_CONTEXT(ctx); @@ -216,7 +216,7 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) } -void +void GLAPIENTRY _mesa_EndQueryARB(GLenum target) { GET_CURRENT_CONTEXT(ctx); @@ -245,7 +245,7 @@ _mesa_EndQueryARB(GLenum target) } -void +void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -270,7 +270,7 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -299,7 +299,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) } -void +void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/occlude.h b/src/mesa/main/occlude.h index e837dd72eb4..5696463aecf 100644 --- a/src/mesa/main/occlude.h +++ b/src/mesa/main/occlude.h @@ -30,28 +30,28 @@ extern void _mesa_init_occlude(GLcontext *ctx); -extern void +extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); -extern void +extern void GLAPIENTRY _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsQueryARB(GLuint id); -extern void +extern void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id); -extern void +extern void GLAPIENTRY _mesa_EndQueryARB(GLenum target); -extern void +extern void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params); -extern void +extern void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params); diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index e0c792b4f18..61c7e570da1 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -38,7 +38,7 @@ -void +void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); @@ -59,7 +59,7 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) /**********************************************************************/ -void +void GLAPIENTRY _mesa_PixelStorei( GLenum pname, GLint param ) { /* NOTE: this call can't be compiled into the display list */ @@ -240,7 +240,7 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } -void +void GLAPIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param ) { _mesa_PixelStorei( pname, (GLint) param ); @@ -254,7 +254,7 @@ _mesa_PixelStoref( GLenum pname, GLfloat param ) -void +void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) { GLint i; @@ -352,7 +352,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) -void +void GLAPIENTRY _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) { const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE); @@ -373,7 +373,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) -void +void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) { const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE); @@ -394,7 +394,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) -void +void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); @@ -442,7 +442,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) } -void +void GLAPIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); @@ -502,7 +502,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) } -void +void GLAPIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); @@ -576,7 +576,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values ) * Implements glPixelTransfer[fi] whether called immediately or from a * display list. */ -void +void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); @@ -770,7 +770,7 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) } -void +void GLAPIENTRY _mesa_PixelTransferi( GLenum pname, GLint param ) { _mesa_PixelTransferf( pname, (GLfloat) param ); diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index e41d6b1d83f..a3efcf5666e 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -38,37 +38,38 @@ /** \name API functions */ /*@*/ -extern void +extern void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ); -extern void +extern void GLAPIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values ); -extern void +extern void GLAPIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values ); -extern void +extern void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ); -extern void +extern void GLAPIENTRY _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ); -extern void +extern void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ); -extern void +extern void GLAPIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param ); -extern void + +extern void GLAPIENTRY _mesa_PixelStorei( GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_PixelTransferi( GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); /*@}*/ diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 466be5712bf..cbb91554a1e 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -49,7 +49,7 @@ * size is different from one. Notifies the driver via * the dd_function_table::PointSize callback. */ -void +void GLAPIENTRY _mesa_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); @@ -84,7 +84,7 @@ _mesa_PointSize( GLfloat size ) /* * Added by GL_NV_point_sprite */ -void +void GLAPIENTRY _mesa_PointParameteriNV( GLenum pname, GLint param ) { const GLfloat value = (GLfloat) param; @@ -95,7 +95,7 @@ _mesa_PointParameteriNV( GLenum pname, GLint param ) /* * Added by GL_NV_point_sprite */ -void +void GLAPIENTRY _mesa_PointParameterivNV( GLenum pname, const GLint *params ) { const GLfloat value = (GLfloat) params[0]; @@ -107,7 +107,7 @@ _mesa_PointParameterivNV( GLenum pname, const GLint *params ) /* * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. */ -void +void GLAPIENTRY _mesa_PointParameterfEXT( GLenum pname, GLfloat param) { _mesa_PointParameterfvEXT(pname, ¶m); @@ -118,7 +118,7 @@ _mesa_PointParameterfEXT( GLenum pname, GLfloat param) /* * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. */ -void +void GLAPIENTRY _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h index 7a4a77caa9b..16513c3ec67 100644 --- a/src/mesa/main/points.h +++ b/src/mesa/main/points.h @@ -35,19 +35,19 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_PointSize( GLfloat size ); -extern void +extern void GLAPIENTRY _mesa_PointParameteriNV( GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_PointParameterivNV( GLenum pname, const GLint *params ); -extern void +extern void GLAPIENTRY _mesa_PointParameterfEXT( GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); extern void diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 1051c8ce179..192c40516fb 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -49,7 +49,7 @@ * change, flushes the vertices and notifies the driver via * the dd_function_table::CullFace callback. */ -void +void GLAPIENTRY _mesa_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -85,7 +85,7 @@ _mesa_CullFace( GLenum mode ) * flushes the vertices and notifies the driver via * the dd_function_table::FrontFace callback. */ -void +void GLAPIENTRY _mesa_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -124,7 +124,7 @@ _mesa_FrontFace( GLenum mode ) * gl_polygon_attrib::BackMode. On change flushes the vertices and notifies the * driver via the dd_function_table::PolygonMode callback. */ -void +void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -177,7 +177,7 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) #if _HAVE_FULL_GL -void +void GLAPIENTRY _mesa_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); @@ -195,7 +195,7 @@ _mesa_PolygonStipple( const GLubyte *pattern ) -void +void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); @@ -208,7 +208,7 @@ _mesa_GetPolygonStipple( GLubyte *dest ) } -void +void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); @@ -231,7 +231,7 @@ _mesa_PolygonOffset( GLfloat factor, GLfloat units ) -void +void GLAPIENTRY _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h index ec0735b1080..ef2fd0e92d1 100644 --- a/src/mesa/main/polygon.h +++ b/src/mesa/main/polygon.h @@ -35,28 +35,28 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_CullFace( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_FrontFace( GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ); -extern void +extern void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ); -extern void +extern void GLAPIENTRY _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ); -extern void +extern void GLAPIENTRY _mesa_PolygonStipple( const GLubyte *mask ); -extern void +extern void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *mask ); -extern void +extern void _mesa_update_polygon( GLcontext *ctx ); extern void diff --git a/src/mesa/main/program.c b/src/mesa/main/program.c index bd7de4e4ac7..546c0540032 100644 --- a/src/mesa/main/program.c +++ b/src/mesa/main/program.c @@ -726,8 +726,9 @@ _mesa_fetch_state(GLcontext *ctx, const enum state_index state[], case STATE_LOCAL: COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]); break; - default: - break; + default: + _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); + return; } } return; @@ -746,8 +747,9 @@ _mesa_fetch_state(GLcontext *ctx, const enum state_index state[], case STATE_LOCAL: COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]); break; - default: - break; + default: + _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); + return; } } return; @@ -789,7 +791,7 @@ _mesa_load_state_parameters(GLcontext *ctx, * \note Called from the GL API dispatcher by both glBindProgramNV * and glBindProgramARB. */ -void +void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id) { struct program *prog; @@ -892,7 +894,7 @@ _mesa_BindProgram(GLenum target, GLuint id) * \note Not compiled into display lists. * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB. */ -void +void GLAPIENTRY _mesa_DeletePrograms(GLsizei n, const GLuint *ids) { GLint i; @@ -943,7 +945,7 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids) * \note Not compiled into display lists. * \note Called by both glGenProgramsNV and glGenProgramsARB. */ -void +void GLAPIENTRY _mesa_GenPrograms(GLsizei n, GLuint *ids) { GLuint first; @@ -988,7 +990,7 @@ _mesa_GenPrograms(GLsizei n, GLuint *ids) * \param id is the program identifier * \return GL_TRUE if id is a program, else GL_FALSE. */ -GLboolean +GLboolean GLAPIENTRY _mesa_IsProgram(GLuint id) { struct program *prog; diff --git a/src/mesa/main/program.h b/src/mesa/main/program.h index ac107d9e372..23807746a6a 100644 --- a/src/mesa/main/program.h +++ b/src/mesa/main/program.h @@ -206,16 +206,16 @@ _mesa_load_state_parameters(GLcontext *ctx, * API functions */ -extern void +extern void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id); -extern void +extern void GLAPIENTRY _mesa_DeletePrograms(GLsizei n, const GLuint *ids); -extern void +extern void GLAPIENTRY _mesa_GenPrograms(GLsizei n, GLuint *ids); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsProgram(GLuint id); diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 7e39ddc4164..dfd404e4004 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -411,70 +411,70 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y) { _mesa_RasterPos4f(x, y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y) { _mesa_RasterPos4f(x, y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { _mesa_RasterPos4f(x, y, z, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) { _mesa_RasterPos4f(x, y, z, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } /** Calls raster_pos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); @@ -482,77 +482,77 @@ _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { _mesa_RasterPos4f(x, y, z, w); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], @@ -560,14 +560,14 @@ _mesa_RasterPos4dv(const GLdouble *v) } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], @@ -575,7 +575,7 @@ _mesa_RasterPos4iv(const GLint *v) } /** Calls _mesa_RasterPos4f() */ -void +void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); @@ -664,147 +664,147 @@ window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) } -void +void GLAPIENTRY _mesa_WindowPos2dMESA(GLdouble x, GLdouble y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2fMESA(GLfloat x, GLfloat y) { window_pos4f(x, y, 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2iMESA(GLint x, GLint y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2sMESA(GLshort x, GLshort y) { window_pos4f(x, y, 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { window_pos4f(x, y, z, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { window_pos4f(x, y, z, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void +void GLAPIENTRY _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { window_pos4f(x, y, z, w); } -void +void GLAPIENTRY _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void +void GLAPIENTRY _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { window_pos4f(x, y, z, w); } -void +void GLAPIENTRY _mesa_WindowPos2dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos2svMESA(const GLshort *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], 1.0); } -void +void GLAPIENTRY _mesa_WindowPos3ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos3svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], 1.0F); } -void +void GLAPIENTRY _mesa_WindowPos4dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void +void GLAPIENTRY _mesa_WindowPos4fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], v[3]); } -void +void GLAPIENTRY _mesa_WindowPos4ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void +void GLAPIENTRY _mesa_WindowPos4svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], v[3]); diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h index ae7278c4700..363f86ad87b 100644 --- a/src/mesa/main/rastpos.h +++ b/src/mesa/main/rastpos.h @@ -35,76 +35,76 @@ #include "glheader.h" -extern void +extern void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y); -extern void +extern void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y); -extern void +extern void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y); -extern void +extern void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y); -extern void +extern void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z); -extern void +extern void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z); -extern void +extern void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z); -extern void +extern void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z); -extern void +extern void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w); -extern void +extern void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); -extern void +extern void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v); @@ -113,76 +113,76 @@ _mesa_RasterPos4sv(const GLshort *v); /**********************************************************************/ /*@{*/ -extern void +extern void GLAPIENTRY _mesa_WindowPos2dMESA(GLdouble x, GLdouble y); -extern void +extern void GLAPIENTRY _mesa_WindowPos2fMESA(GLfloat x, GLfloat y); -extern void +extern void GLAPIENTRY _mesa_WindowPos2iMESA(GLint x, GLint y); -extern void +extern void GLAPIENTRY _mesa_WindowPos2sMESA(GLshort x, GLshort y); -extern void +extern void GLAPIENTRY _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); -extern void +extern void GLAPIENTRY _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); -extern void +extern void GLAPIENTRY _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); -extern void +extern void GLAPIENTRY _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); -extern void +extern void GLAPIENTRY _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void +extern void GLAPIENTRY _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void +extern void GLAPIENTRY _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); -extern void +extern void GLAPIENTRY _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); -extern void +extern void GLAPIENTRY _mesa_WindowPos2dvMESA(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos2fvMESA(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos2ivMESA(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos2svMESA(const GLshort *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos3dvMESA(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos3fvMESA(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos3ivMESA(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos3svMESA(const GLshort *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos4dvMESA(const GLdouble *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos4fvMESA(const GLfloat *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos4ivMESA(const GLint *v); -extern void +extern void GLAPIENTRY _mesa_WindowPos4svMESA(const GLshort *v); extern void diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 7c0d2aaa6a2..4c6f75a8811 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -60,6 +60,7 @@ #include "imports.h" #include "light.h" #include "lines.h" +#include "macros.h" #include "matrix.h" #if FEATURE_ARB_occlusion_query #include "occlude.h" @@ -752,6 +753,110 @@ update_program( GLcontext *ctx ) } +/** + * Update state dependent on vertex arrays. + */ +static void +update_arrays( GLcontext *ctx ) +{ + GLuint i, min; + + /* find min of _MaxElement values for all enabled arrays */ + + /* 0 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { + min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement; + } + else if (ctx->Array.Vertex.Enabled) { + min = ctx->Array.Vertex._MaxElement; + } + else { + /* can't draw anything without vertex positions! */ + min = 0; + } + + /* 1 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); + } + /* no conventional vertex weight array */ + + /* 2 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); + } + else if (ctx->Array.Normal.Enabled) { + min = MIN2(min, ctx->Array.Normal._MaxElement); + } + + /* 3 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); + } + else if (ctx->Array.Color.Enabled) { + min = MIN2(min, ctx->Array.Color._MaxElement); + } + + /* 4 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); + } + else if (ctx->Array.SecondaryColor.Enabled) { + min = MIN2(min, ctx->Array.SecondaryColor._MaxElement); + } + + /* 5 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); + } + else if (ctx->Array.FogCoord.Enabled) { + min = MIN2(min, ctx->Array.FogCoord._MaxElement); + } + + /* 6 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement); + } + + /* 7 */ + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement); + } + + /* 8..15 */ + for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) { + if (ctx->VertexProgram.Enabled + && ctx->Array.VertexAttrib[i].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement); + } + else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits + && ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { + min = MIN2(min, ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); + } + } + + if (ctx->Array.Index.Enabled) { + min = MIN2(min, ctx->Array.Index._MaxElement); + } + + if (ctx->Array.EdgeFlag.Enabled) { + min = MIN2(min, ctx->Array.EdgeFlag._MaxElement); + } + + /* _MaxElement is one past the last legal array element */ + ctx->Array._MaxElement = min; +} + + + /* * If __GLcontextRec::NewState is non-zero then this function \b must be called * before rendering any primitive. Basically, function pointers and @@ -793,6 +898,9 @@ void _mesa_update_state( GLcontext *ctx ) if (new_state & _NEW_PROGRAM) update_program( ctx ); + if (new_state & _NEW_ARRAY) + update_arrays( ctx ); + /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index bcfe383790b..8c89e8cc13c 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -49,7 +49,7 @@ * flushes the vertices and notifies the driver via * the dd_function_table::ClearStencil callback. */ -void +void GLAPIENTRY _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); @@ -80,7 +80,7 @@ _mesa_ClearStencil( GLint s ) * __GLcontextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilFunc callback. */ -void +void GLAPIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); @@ -133,7 +133,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and * notifies the driver via the dd_function_table::StencilMask callback. */ -void +void GLAPIENTRY _mesa_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); @@ -166,7 +166,7 @@ _mesa_StencilMask( GLuint mask ) * __GLcontextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilOp callback. */ -void +void GLAPIENTRY _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); @@ -246,7 +246,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) #if _HAVE_FULL_GL /* GL_EXT_stencil_two_side */ -void +void GLAPIENTRY _mesa_ActiveStencilFaceEXT(GLenum face) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index cf645608f81..5620d14c730 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -35,27 +35,27 @@ #include "mtypes.h" -extern void +extern void GLAPIENTRY _mesa_ClearStencil( GLint s ); -extern void +extern void GLAPIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); -extern void +extern void GLAPIENTRY _mesa_StencilMask( GLuint mask ); -extern void +extern void GLAPIENTRY _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); -extern void +extern void GLAPIENTRY _mesa_ActiveStencilFaceEXT(GLenum face); -extern void +extern void _mesa_init_stencil( GLcontext * ctx ); #endif diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index e6a96957229..4c6eaae4cf3 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -73,6 +73,17 @@ _mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ) n += 3; } } + if (ctx->Extensions.S3_s3tc) { + if (formats) { + formats[n++] = GL_RGB_S3TC; + formats[n++] = GL_RGB4_S3TC; + formats[n++] = GL_RGBA_S3TC; + formats[n++] = GL_RGBA4_S3TC; + } + else { + n += 4; + } + } } return n; } @@ -96,20 +107,35 @@ _mesa_compressed_texture_size( GLcontext *ctx, { GLuint size; + if (ctx->Driver.CompressedTextureSize) { + return ctx->Driver.CompressedTextureSize(ctx, width, height, depth, format); + } + + ASSERT(depth == 1); + switch (format) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: - /* round up to multiple of 4 */ - size = ((width + 7) / 8) * ((height + 3) / 4) * 16; + /* round up width to next multiple of 8, height to next multiple of 4 */ + width = (width + 7) & ~7; + height = (height + 3) & ~3; + /* 16 bytes per 8x4 tile of RGB[A] texels */ + size = width * height / 2; + /* Textures smaller than 8x4 will effectively be made into 8x4 and + * take 16 bytes. + */ + if (size < 16) + size = 16; return size; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; - ASSERT(depth == 1); /* 8 bytes per 4x4 tile of RGB[A] texels */ - size = (width * height * 8) / 16; + size = width * height / 2; /* Textures smaller than 4x4 will effectively be made into 4x4 and * take 8 bytes. */ @@ -118,10 +144,11 @@ _mesa_compressed_texture_size( GLcontext *ctx, return size; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; - ASSERT(depth == 1); /* 16 bytes per 4x4 tile of RGBA texels */ size = width * height; /* simple! */ /* Textures smaller than 4x4 will effectively be made into 4x4 and @@ -147,22 +174,29 @@ _mesa_compressed_texture_size( GLcontext *ctx, GLint _mesa_compressed_row_stride(GLenum format, GLsizei width) { - GLint bytesPerTile, stride; + GLint stride; switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */ + break; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - bytesPerTile = 8; + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ break; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - bytesPerTile = 16; + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ break; default: return 0; } - stride = ((width + 3) / 4) * bytesPerTile; return stride; } @@ -185,29 +219,39 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, GLenum format, GLsizei width, const GLubyte *image) { - GLint bytesPerTile, stride; GLubyte *addr; - ASSERT((row & 3) == 0); - ASSERT((col & 3) == 0); (void) img; + /* We try to spot a "complete" subtexture "above" ROW, COL; + * this texture is given by appropriate rounding of WIDTH x ROW. + * Then we just add the amount left (usually on the left). + * + * Example for X*Y microtiles (Z bytes each) + * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X); + */ + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8); + break; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - bytesPerTile = 8; + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); break; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - bytesPerTile = 16; + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); break; default: return 0; } - stride = ((width + 3) / 4) * bytesPerTile; - - addr = (GLubyte *) image + (row / 4) * stride + (col / 4) * bytesPerTile; return addr; } diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b5c721f211d..7af0b1cdf48 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -453,6 +453,40 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */ }; +const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { + MESA_FORMAT_RGB_FXT1, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_2d_texel_rgb_fxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { + MESA_FORMAT_RGBA_FXT1, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 1, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_2d_texel_rgba_fxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ +}; + const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { MESA_FORMAT_RGB_DXT1, /* MesaFormat */ GL_RGB, /* BaseFormat */ @@ -838,13 +872,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COMPRESSED_RGB_ARB: if (!ctx->Extensions.ARB_texture_compression) _mesa_problem(ctx, "texture compression extension not enabled"); - if (ctx->Extensions.EXT_texture_compression_s3tc) + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgb_fxt1; + else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; return &_mesa_texformat_rgb; case GL_COMPRESSED_RGBA_ARB: if (!ctx->Extensions.ARB_texture_compression) _mesa_problem(ctx, "texture compression extension not enabled"); - if (ctx->Extensions.EXT_texture_compression_s3tc) + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgba_fxt1; + else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1! See the spec */ return &_mesa_texformat_rgba; @@ -855,6 +893,18 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, else return &_mesa_texformat_ycbcr_rev; + /* GL_3DFX_texture_compression_FXT1 */ + case GL_COMPRESSED_RGB_FXT1_3DFX: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgb_fxt1; + else + return NULL; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgba_fxt1; + else + return NULL; + /* GL_EXT_texture_compression_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) @@ -877,6 +927,20 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, else return NULL; + /* GL_S3_s3tc */ + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + if (ctx->Extensions.S3_s3tc) + return &_mesa_texformat_rgb_dxt1; + else + return NULL; + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + if (ctx->Extensions.S3_s3tc) + return &_mesa_texformat_rgba_dxt3; + else + return NULL; + default: _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return NULL; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 07fa2adb75f..c43da46d7b1 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -75,6 +75,8 @@ enum _format { MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ /*@}*/ + MESA_FORMAT_RGB_FXT1, + MESA_FORMAT_RGBA_FXT1, MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, MESA_FORMAT_RGBA_DXT3, @@ -162,6 +164,8 @@ extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; extern const struct gl_texture_format _mesa_texformat_ycbcr; extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; +extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; +extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 840fcd25498..14eb0463abf 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -337,9 +337,9 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ const GLushort *src1 = src0 + 1; /* odd */ const GLubyte y0 = *src0 & 0xff; /* luminance */ - const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma U */ + const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ const GLubyte y1 = *src1 & 0xff; /* luminance */ - const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma V */ + const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ GLchan *rgba = (GLchan *) texel; GLint r, g, b; if (i & 1) { @@ -362,6 +362,27 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, #if DIM == 2 +static void FETCH(rgb_fxt1)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + /* Extract the (i,j) pixel from texImage->Data and return it + * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. + */ +} +#endif + +#if DIM == 2 +static void FETCH(rgba_fxt1)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + /* Extract the (i,j) pixel from texImage->Data and return it + * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. + */ +} +#endif + + +#if DIM == 2 static void FETCH(rgb_dxt1)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index e10b75b0b3c..ec08168fc02 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -262,6 +262,30 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format ) return GL_RGBA; else return -1; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + if (ctx->Extensions.EXT_texture_compression_s3tc) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + if (ctx->Extensions.EXT_texture_compression_s3tc) + return GL_RGBA; + else + return -1; + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + if (ctx->Extensions.S3_s3tc) + return GL_RGB; + else + return -1; + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + if (ctx->Extensions.S3_s3tc) + return GL_RGBA; + else + return -1; case GL_YCBCR_MESA: if (ctx->Extensions.MESA_ycbcr_texture) @@ -366,13 +390,24 @@ is_index_format(GLenum format) * are supported. */ static GLboolean -is_compressed_format(GLenum internalFormat) +is_compressed_format(GLcontext *ctx, GLenum internalFormat) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: return GL_TRUE; default: + if (ctx->Driver.IsCompressedFormat) { + return ctx->Driver.IsCompressedFormat(ctx, internalFormat); + } return GL_FALSE; } } @@ -916,7 +951,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Height2 = height - 2 * border; /*1 << img->HeightLog2;*/ img->Depth2 = depth - 2 * border; /*1 << img->DepthLog2;*/ img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); - img->IsCompressed = is_compressed_format(internalFormat); + img->IsCompressed = is_compressed_format(ctx, internalFormat); if (img->IsCompressed) img->CompressedSize = _mesa_compressed_texture_size(ctx, width, height, depth, internalFormat); @@ -1236,7 +1271,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } } - if (is_compressed_format(internalFormat)) { + if (is_compressed_format(ctx, internalFormat)) { if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { /* OK */ } @@ -1569,7 +1604,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - if (is_compressed_format(internalFormat)) { + if (is_compressed_format(ctx, internalFormat)) { if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%d(target)", dimensions); @@ -1756,7 +1791,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, * \param type pixel data type. * \param pixels pixel data. */ -void +void GLAPIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { @@ -1895,7 +1930,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, /* * Called from the API. Note that width includes the border. */ -void +void GLAPIENTRY _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) @@ -1984,7 +2019,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } -void +void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, @@ -2089,7 +2124,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, * Called by the API or display list executor. * Note that width and height include the border. */ -void +void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -2170,7 +2205,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } -void +void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -2182,7 +2217,7 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, -void +void GLAPIENTRY _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -2227,7 +2262,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } -void +void GLAPIENTRY _mesa_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -2276,7 +2311,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, @@ -2321,7 +2356,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -2381,7 +2416,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) @@ -2441,7 +2476,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, -void +void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -2477,7 +2512,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) @@ -2516,7 +2551,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) @@ -2612,7 +2647,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, maxTextureSize = 1 << (maxLevels - 1); - if (!is_compressed_format(internalFormat)) + if (!is_compressed_format(ctx, internalFormat)) return GL_INVALID_ENUM; if (border != 0) @@ -2701,7 +2736,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, maxTextureSize = 1 << (maxLevels - 1); - if (!is_compressed_format(format)) + if (!is_compressed_format(ctx, format)) return GL_INVALID_ENUM; if (width < 1 || width > maxTextureSize) @@ -2733,7 +2768,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, -void +void GLAPIENTRY _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, @@ -2812,7 +2847,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } -void +void GLAPIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, @@ -2896,7 +2931,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } -void +void GLAPIENTRY _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -2976,7 +3011,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } -void +void GLAPIENTRY _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) @@ -3024,7 +3059,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, } -void +void GLAPIENTRY _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, @@ -3074,7 +3109,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, } -void +void GLAPIENTRY _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, @@ -3126,7 +3161,7 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, } -void +void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { const struct gl_texture_unit *texUnit; diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index e90cd717052..699b4e6bdf3 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -97,44 +97,44 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, /** \name API entry point functions */ /*@{*/ -extern void +extern void GLAPIENTRY _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -142,7 +142,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, @@ -150,48 +150,48 @@ _mesa_TexSubImage3D( GLenum target, GLint level, const GLvoid *pixels ); -extern void +extern void GLAPIENTRY _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ); -extern void +extern void GLAPIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); -extern void +extern void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -extern void +extern void GLAPIENTRY _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -extern void +extern void GLAPIENTRY _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -extern void +extern void GLAPIENTRY _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -extern void +extern void GLAPIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -extern void +extern void GLAPIENTRY _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -202,24 +202,24 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR #endif -extern void +extern void GLAPIENTRY _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -extern void +extern void GLAPIENTRY _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -extern void +extern void GLAPIENTRY _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -extern void +extern void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); /*@}*/ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 08c59a0854d..10fff646767 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -603,7 +603,7 @@ _glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); * to find a block of free texture IDs which are stored in \p texName. * Corresponding empty texture objects are also generated. */ -void +void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *texName ) { GET_CURRENT_CONTEXT(ctx); @@ -655,7 +655,7 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) * it and decrementing the reference count if so. If the texture reference * count is zero, delete its object. */ -void +void GLAPIENTRY _mesa_DeleteTextures( GLsizei n, const GLuint *texName) { GET_CURRENT_CONTEXT(ctx); @@ -744,7 +744,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) * calls dd_function_table::BindTexture. Decrements the old texture reference * count and deletes it if it reaches zero. */ -void +void GLAPIENTRY _mesa_BindTexture( GLenum target, GLuint texName ) { GET_CURRENT_CONTEXT(ctx); @@ -900,7 +900,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) * Looks up each texture in the hash, clamps the corresponding priority between * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture. */ -void +void GLAPIENTRY _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, const GLclampf *priorities ) { @@ -945,7 +945,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, * Looks up each texture in the hash and calls * dd_function_table::IsTextureResident. */ -GLboolean +GLboolean GLAPIENTRY _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, GLboolean *residences) { @@ -1006,7 +1006,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, * * Calls _mesa_HashLookup(). */ -GLboolean +GLboolean GLAPIENTRY _mesa_IsTexture( GLuint texture ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index f7e8e690c4c..c5cce28c370 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -72,28 +72,28 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, */ /*@{*/ -extern void +extern void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ); -extern void +extern void GLAPIENTRY _mesa_DeleteTextures( GLsizei n, const GLuint *textures ); -extern void +extern void GLAPIENTRY _mesa_BindTexture( GLenum target, GLuint texture ); -extern void +extern void GLAPIENTRY _mesa_PrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities ); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_AreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsTexture( GLuint texture ); /*@}*/ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 95009a23a5c..0cfddc15768 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -151,7 +151,7 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ) /**********************************************************************/ -void +void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) { GET_CURRENT_CONTEXT(ctx); @@ -580,7 +580,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } -void +void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { _mesa_TexEnvfv( target, pname, ¶m ); @@ -588,7 +588,7 @@ _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) -void +void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) { GLfloat p[4]; @@ -598,7 +598,7 @@ _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) } -void +void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; @@ -616,7 +616,7 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) } -void +void GLAPIENTRY _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -827,7 +827,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) } -void +void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1078,14 +1078,14 @@ _mesa_validate_texture_wrap_mode(GLcontext * ctx, } -void +void GLAPIENTRY _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) { _mesa_TexParameterfv(target, pname, ¶m); } -void +void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1404,7 +1404,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } -void +void GLAPIENTRY _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) { GLfloat fparam[4]; @@ -1417,7 +1417,7 @@ _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) } -void +void GLAPIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) { GLfloat fparam[4]; @@ -1438,7 +1438,7 @@ _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) } -void +void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { @@ -1480,7 +1480,7 @@ tex_image_dimensions(GLcontext *ctx, GLenum target) } -void +void GLAPIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { @@ -1656,7 +1656,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, -void +void GLAPIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1780,7 +1780,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) } -void +void GLAPIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1917,7 +1917,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) /**********************************************************************/ #if FEATURE_texgen -void +void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -2156,7 +2156,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) } -void +void GLAPIENTRY _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; @@ -2173,7 +2173,7 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) } -void +void GLAPIENTRY _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p = (GLfloat) param; @@ -2181,7 +2181,7 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) } -void +void GLAPIENTRY _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; @@ -2198,14 +2198,14 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) } -void +void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { _mesa_TexGenfv(coord, pname, ¶m); } -void +void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) { _mesa_TexGeniv( coord, pname, ¶m ); @@ -2213,7 +2213,7 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -void +void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); @@ -2290,7 +2290,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -void +void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -2367,7 +2367,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) -void +void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -2468,7 +2468,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) #endif /* GL_ARB_multitexture */ -void +void GLAPIENTRY _mesa_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); @@ -2503,7 +2503,7 @@ _mesa_ActiveTextureARB( GLenum target ) /* GL_ARB_multitexture */ -void +void GLAPIENTRY _mesa_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); @@ -2525,7 +2525,7 @@ _mesa_ClientActiveTextureARB( GLenum target ) /* Pixel Texgen Extensions */ /**********************************************************************/ -void +void GLAPIENTRY _mesa_PixelTexGenSGIX(GLenum mode) { GLenum newRgbSource, newAlphaSource; @@ -2564,21 +2564,21 @@ _mesa_PixelTexGenSGIX(GLenum mode) } -void +void GLAPIENTRY _mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) { _mesa_PixelTexGenParameteriSGIS(target, (GLint) value); } -void +void GLAPIENTRY _mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) { _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); } -void +void GLAPIENTRY _mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); @@ -2609,14 +2609,14 @@ _mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) } -void +void GLAPIENTRY _mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) { _mesa_PixelTexGenParameteriSGIS(target, *value); } -void +void GLAPIENTRY _mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) { GET_CURRENT_CONTEXT(ctx); @@ -2634,7 +2634,7 @@ _mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) } -void +void GLAPIENTRY _mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index d2cde7b326f..7cc3d2c19ce 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -47,89 +47,89 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); */ /*@{*/ -extern void +extern void GLAPIENTRY _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); -extern void +extern void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ); -extern void +extern void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); -extern void +extern void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); -extern void +extern void GLAPIENTRY _mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); -extern void +extern void GLAPIENTRY _mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); -extern void +extern void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); -extern void +extern void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); -extern void +extern void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); -extern void +extern void GLAPIENTRY _mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); /* * GL_ARB_multitexture */ -extern void +extern void GLAPIENTRY _mesa_ActiveTextureARB( GLenum target ); -extern void +extern void GLAPIENTRY _mesa_ClientActiveTextureARB( GLenum target ); @@ -137,37 +137,37 @@ _mesa_ClientActiveTextureARB( GLenum target ); * Pixel Texture Extensions */ -extern void +extern void GLAPIENTRY _mesa_PixelTexGenSGIX(GLenum mode); -extern void +extern void GLAPIENTRY _mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); #ifdef VMS #define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv #endif -extern void +extern void GLAPIENTRY _mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); -extern void +extern void GLAPIENTRY _mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); #ifdef VMS #define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv #endif -extern void +extern void GLAPIENTRY _mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); #ifdef VMS #define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv #endif -extern void +extern void GLAPIENTRY _mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); #ifdef VMS #define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv #endif -extern void +extern void GLAPIENTRY _mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); /*@}*/ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 5a564fbc153..f4b864cfb3e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1092,7 +1092,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, texImage->Format, texImage->TexFormat, texImage->Data, width, height, depth, /* src size */ - xoffset, yoffset, xoffset, /* dest offsets */ + xoffset, yoffset, zoffset, /* dest offsets */ texImage->Width * texelBytes, /* dst row stride */ texImage->Width * texImage->Height * texelBytes, format, type, pixels, packing); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index fb410540b6c..ddd04b4c81c 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -34,9 +34,53 @@ #include "varray.h" -void +#ifndef GL_BOOLEAN +#define GL_BOOLEAN 0x9999 +#endif + + +/** + * Update the fields of a vertex array structure. + * We need to do a few special things for arrays that live in + * vertex buffer objects. + */ +static void +update_array(GLcontext *ctx, struct gl_client_array *array, + GLuint dirtyFlag, GLsizei elementSize, + GLint size, GLenum type, + GLsizei stride, GLboolean normalized, const GLvoid *ptr) +{ + array->Size = size; + array->Type = type; + array->Stride = stride; + array->StrideB = stride ? stride : elementSize; + array->Normalized = normalized; + array->Ptr = (const GLubyte *) ptr; +#if FEATURE_ARB_vertex_buffer_object + array->BufferObj->RefCount--; + /* XXX free buffer object if RefCount == 0 ? */ + array->BufferObj = ctx->Array.ArrayBufferObj; + array->BufferObj->RefCount++; + /* Compute the index of the last array element that's inside the buffer. + * Later in glDrawArrays we'll check if start + count > _MaxElement to + * be sure we won't go out of bounds. + */ + if (ctx->Array.ArrayBufferObj->Name) + array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size + - (GLsizeiptrARB) array->Ptr) / array->StrideB; + else +#endif + array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ + + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= dirtyFlag; +} + + +void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -56,43 +100,34 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) /* always need to check that <type> is legal */ switch (type) { case GL_SHORT: - ctx->Array.Vertex.StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_INT: - ctx->Array.Vertex.StrideB = size * sizeof(GLint); + elementSize = size * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.Vertex.StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Vertex.StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; } - if (stride) - ctx->Array.Vertex.StrideB = stride; - - ctx->Array.Vertex.Size = size; - ctx->Array.Vertex.Type = type; - ctx->Array.Vertex.Stride = stride; - ctx->Array.Vertex.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.Vertex.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_VERTEX; + update_array(ctx, &ctx->Array.Vertex, _NEW_ARRAY_VERTEX, + elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.VertexPointer) ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -107,45 +142,37 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) switch (type) { case GL_BYTE: - ctx->Array.Normal.StrideB = 3 * sizeof(GLbyte); + elementSize = 3 * sizeof(GLbyte); break; case GL_SHORT: - ctx->Array.Normal.StrideB = 3 * sizeof(GLshort); + elementSize = 3 * sizeof(GLshort); break; case GL_INT: - ctx->Array.Normal.StrideB = 3 * sizeof(GLint); + elementSize = 3 * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.Normal.StrideB = 3 * sizeof(GLfloat); + elementSize = 3 * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Normal.StrideB = 3 * sizeof(GLdouble); + elementSize = 3 * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; } - if (stride) - ctx->Array.Normal.StrideB = stride; - ctx->Array.Normal.Size = 3; - ctx->Array.Normal.Type = type; - ctx->Array.Normal.Stride = stride; - ctx->Array.Normal.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.Normal.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_NORMAL; + update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL, + elementSize, 3, type, stride, GL_FALSE, ptr); if (ctx->Driver.NormalPointer) ctx->Driver.NormalPointer( ctx, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -153,7 +180,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); return; } - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); return; } @@ -164,55 +191,46 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) switch (type) { case GL_BYTE: - ctx->Array.Color.StrideB = size * sizeof(GLbyte); + elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: - ctx->Array.Color.StrideB = size * sizeof(GLubyte); + elementSize = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.Color.StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: - ctx->Array.Color.StrideB = size * sizeof(GLushort); + elementSize = size * sizeof(GLushort); break; case GL_INT: - ctx->Array.Color.StrideB = size * sizeof(GLint); + elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: - ctx->Array.Color.StrideB = size * sizeof(GLuint); + elementSize = size * sizeof(GLuint); break; case GL_FLOAT: - ctx->Array.Color.StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Color.StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; } - if (stride) - ctx->Array.Color.StrideB = stride; - - ctx->Array.Color.Size = size; - ctx->Array.Color.Type = type; - ctx->Array.Color.Stride = stride; - ctx->Array.Color.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.Color.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_COLOR0; + update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0, + elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.ColorPointer) ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) { + GLint elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -223,37 +241,28 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) switch (type) { case GL_FLOAT: - ctx->Array.FogCoord.StrideB = sizeof(GLfloat); + elementSize = sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.FogCoord.StrideB = sizeof(GLdouble); + elementSize = sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); return; } - if (stride) - ctx->Array.FogCoord.StrideB = stride; - - ctx->Array.FogCoord.Size = 1; - ctx->Array.FogCoord.Type = type; - ctx->Array.FogCoord.Stride = stride; - ctx->Array.FogCoord.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.FogCoord.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_FOGCOORD; + update_array(ctx, &ctx->Array.FogCoord, _NEW_ARRAY_FOGCOORD, + elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.FogCoordPointer) ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -264,47 +273,38 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) switch (type) { case GL_UNSIGNED_BYTE: - ctx->Array.Index.StrideB = sizeof(GLubyte); + elementSize = sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.Index.StrideB = sizeof(GLshort); + elementSize = sizeof(GLshort); break; case GL_INT: - ctx->Array.Index.StrideB = sizeof(GLint); + elementSize = sizeof(GLint); break; case GL_FLOAT: - ctx->Array.Index.StrideB = sizeof(GLfloat); + elementSize = sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Index.StrideB = sizeof(GLdouble); + elementSize = sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); return; } - if (stride) - ctx->Array.Index.StrideB = stride; - - ctx->Array.Index.Size = 1; - ctx->Array.Index.Type = type; - ctx->Array.Index.Stride = stride; - ctx->Array.Index.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.Index.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_INDEX; + update_array(ctx, &ctx->Array.Index, _NEW_ARRAY_INDEX, + elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.IndexPointer) ctx->Driver.IndexPointer( ctx, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -323,58 +323,49 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, switch (type) { case GL_BYTE: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLbyte); + elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLubyte); + elementSize = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLushort); + elementSize = size * sizeof(GLushort); break; case GL_INT: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLint); + elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLuint); + elementSize = size * sizeof(GLuint); break; case GL_FLOAT: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.SecondaryColor.StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); return; } - if (stride) - ctx->Array.SecondaryColor.StrideB = stride; - - ctx->Array.SecondaryColor.Size = 3; /* hardwire */ - ctx->Array.SecondaryColor.Type = type; - ctx->Array.SecondaryColor.Stride = stride; - ctx->Array.SecondaryColor.Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.SecondaryColor.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_COLOR1; + update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1, + elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.SecondaryColorPointer) ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); } -void +void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + GLint elementSize; GET_CURRENT_CONTEXT(ctx); - GLuint texUnit = ctx->Array.ActiveTexture; + const GLuint unit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size < 1 || size > 4) { @@ -388,64 +379,48 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n", - texUnit, size, _mesa_lookup_enum_by_nr( type ), stride); + unit, size, _mesa_lookup_enum_by_nr( type ), stride); /* always need to check that <type> is legal */ switch (type) { case GL_SHORT: - ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_INT: - ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLint); + elementSize = size * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; } - if (stride) - ctx->Array.TexCoord[texUnit].StrideB = stride; - - ctx->Array.TexCoord[texUnit].Size = size; - ctx->Array.TexCoord[texUnit].Type = type; - ctx->Array.TexCoord[texUnit].Stride = stride; - ctx->Array.TexCoord[texUnit].Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.TexCoord[texUnit].BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_TEXCOORD(texUnit); + update_array(ctx, &ctx->Array.TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit), + elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.TexCoordPointer) ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); } -void -_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) +void GLAPIENTRY +_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); - const GLboolean *ptr = (GLboolean *)vptr; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); return; } - ctx->Array.EdgeFlag.Stride = stride; - ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); - ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.EdgeFlag.BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_EDGEFLAG; + + update_array(ctx, &ctx->Array.EdgeFlag, _NEW_ARRAY_EDGEFLAG, + sizeof(GLboolean), 1, GL_BOOLEAN, stride, GL_FALSE, ptr); if (ctx->Driver.EdgeFlagPointer) ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); @@ -453,10 +428,11 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) #if FEATURE_NV_vertex_program -void +void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -483,34 +459,24 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLubyte); + elementSize = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_FLOAT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" ); return; } - if (stride) - ctx->Array.VertexAttrib[index].StrideB = stride; - - ctx->Array.VertexAttrib[index].Stride = stride; - ctx->Array.VertexAttrib[index].Size = size; - ctx->Array.VertexAttrib[index].Type = type; - ctx->Array.VertexAttrib[index].Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.VertexAttrib[index].BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); + update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -519,11 +485,12 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, #if FEATURE_ARB_vertex_program -void +void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr) { + GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -551,47 +518,36 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, /* NOTE: more types are supported here than in the NV extension */ switch (type) { case GL_BYTE: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLbyte); + elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLubyte); + elementSize = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLshort); + elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLushort); + elementSize = size * sizeof(GLushort); break; case GL_INT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLint); + elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLuint); + elementSize = size * sizeof(GLuint); break; case GL_FLOAT: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLfloat); + elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLdouble); + elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" ); return; } - if (stride) - ctx->Array.VertexAttrib[index].StrideB = stride; - - ctx->Array.VertexAttrib[index].Stride = stride; - ctx->Array.VertexAttrib[index].Size = size; - ctx->Array.VertexAttrib[index].Type = type; - ctx->Array.VertexAttrib[index].Normalized = normalized; - ctx->Array.VertexAttrib[index].Ptr = (GLubyte *) ptr; -#if FEATURE_ARB_vertex_buffer_object - ctx->Array.VertexAttrib[index].BufferObj = ctx->Array.ArrayBufferObj; -#endif - ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); + update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, stride, normalized, ptr); /* XXX fix if (ctx->Driver.VertexAttribPointer) @@ -601,7 +557,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, #endif -void +void GLAPIENTRY _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { @@ -610,7 +566,7 @@ _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, } -void +void GLAPIENTRY _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { @@ -619,7 +575,7 @@ _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, } -void +void GLAPIENTRY _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { @@ -628,7 +584,7 @@ _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, } -void +void GLAPIENTRY _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { @@ -637,7 +593,7 @@ _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, } -void +void GLAPIENTRY _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { @@ -646,7 +602,7 @@ _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, } -void +void GLAPIENTRY _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) { (void) count; @@ -654,13 +610,12 @@ _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) } -void +void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); GLboolean tflag, cflag, nflag; /* enable/disable flags */ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ - GLenum ctype = 0; /* color type */ GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */ GLint defstride; /* default stride */ @@ -670,9 +625,9 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); f = sizeof(GLfloat); - c = f * ((4*sizeof(GLubyte) + (f-1)) / f); + c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f); - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" ); return; } @@ -849,7 +804,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) } -void +void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); @@ -876,7 +831,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) } -void +void GLAPIENTRY _mesa_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); @@ -897,7 +852,7 @@ _mesa_UnlockArraysEXT( void ) /* GL_EXT_multi_draw_arrays */ /* Somebody forgot to spec the first and count parameters as const! <sigh> */ -void +void GLAPIENTRY _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount ) { @@ -915,7 +870,7 @@ _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, /* GL_EXT_multi_draw_arrays */ -void +void GLAPIENTRY _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount ) { @@ -939,7 +894,7 @@ _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, /* GL_IBM_multimode_draw_arrays */ -void +void GLAPIENTRY _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride ) @@ -959,7 +914,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, /* GL_IBM_multimode_draw_arrays */ -void +void GLAPIENTRY _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ) @@ -984,7 +939,7 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, /***** Initialization *****/ /**********************************************************************/ -void +void _mesa_init_varray( GLcontext * ctx ) { GLuint i; @@ -1047,12 +1002,12 @@ _mesa_init_varray( GLcontext * ctx ) ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { - ctx->Array.TexCoord[i].Size = 4; - ctx->Array.TexCoord[i].Type = GL_FLOAT; - ctx->Array.TexCoord[i].Stride = 0; - ctx->Array.TexCoord[i].StrideB = 0; - ctx->Array.TexCoord[i].Ptr = NULL; - ctx->Array.TexCoord[i].Enabled = GL_FALSE; - ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA; + ctx->Array.VertexAttrib[i].Size = 4; + ctx->Array.VertexAttrib[i].Type = GL_FLOAT; + ctx->Array.VertexAttrib[i].Stride = 0; + ctx->Array.VertexAttrib[i].StrideB = 0; + ctx->Array.VertexAttrib[i].Ptr = NULL; + ctx->Array.VertexAttrib[i].Enabled = GL_FALSE; + ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA; } } diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index d81213f358e..3589735f684 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -41,107 +41,107 @@ #if _HAVE_FULL_GL -extern void +extern void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_UnlockArraysEXT( void ); -extern void +extern void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count); -extern void +extern void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr); -extern void +extern void GLAPIENTRY _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); -extern void +extern void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -extern void +extern void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -extern void +extern void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); -extern void +extern void GLAPIENTRY _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount ); -extern void +extern void GLAPIENTRY _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount ); -extern void +extern void GLAPIENTRY _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride ); -extern void +extern void GLAPIENTRY _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ); diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h index 3cbd278371c..044ec1bbaf7 100644 --- a/src/mesa/main/vtxfmt_tmp.h +++ b/src/mesa/main/vtxfmt_tmp.h @@ -30,316 +30,316 @@ #define PRE_LOOPBACK( FUNC ) #endif -static void TAG(ArrayElement)( GLint i ) +static void GLAPIENTRY TAG(ArrayElement)( GLint i ) { PRE_LOOPBACK( ArrayElement ); _glapi_Dispatch->ArrayElement( i ); } -static void TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) +static void GLAPIENTRY TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( Color3f ); _glapi_Dispatch->Color3f( r, g, b ); } -static void TAG(Color3fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v ) { PRE_LOOPBACK( Color3fv ); _glapi_Dispatch->Color3fv( v ); } -static void TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +static void GLAPIENTRY TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) { PRE_LOOPBACK( Color4f ); _glapi_Dispatch->Color4f( r, g, b, a ); } -static void TAG(Color4fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v ) { PRE_LOOPBACK( Color4fv ); _glapi_Dispatch->Color4fv( v ); } -static void TAG(EdgeFlag)( GLboolean e ) +static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e ) { PRE_LOOPBACK( EdgeFlag ); _glapi_Dispatch->EdgeFlag( e ); } -static void TAG(EdgeFlagv)( const GLboolean *v ) +static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v ) { PRE_LOOPBACK( EdgeFlagv ); _glapi_Dispatch->EdgeFlagv( v ); } -static void TAG(EvalCoord1f)( GLfloat s ) +static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s ) { PRE_LOOPBACK( EvalCoord1f ); _glapi_Dispatch->EvalCoord1f( s ); } -static void TAG(EvalCoord1fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(EvalCoord1fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord1fv ); _glapi_Dispatch->EvalCoord1fv( v ); } -static void TAG(EvalCoord2f)( GLfloat s, GLfloat t ) +static void GLAPIENTRY TAG(EvalCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( EvalCoord2f ); _glapi_Dispatch->EvalCoord2f( s, t ); } -static void TAG(EvalCoord2fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(EvalCoord2fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord2fv ); _glapi_Dispatch->EvalCoord2fv( v ); } -static void TAG(EvalPoint1)( GLint i ) +static void GLAPIENTRY TAG(EvalPoint1)( GLint i ) { PRE_LOOPBACK( EvalPoint1 ); _glapi_Dispatch->EvalPoint1( i ); } -static void TAG(EvalPoint2)( GLint i, GLint j ) +static void GLAPIENTRY TAG(EvalPoint2)( GLint i, GLint j ) { PRE_LOOPBACK( EvalPoint2 ); _glapi_Dispatch->EvalPoint2( i, j ); } -static void TAG(FogCoordfEXT)( GLfloat f ) +static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat f ) { PRE_LOOPBACK( FogCoordfEXT ); _glapi_Dispatch->FogCoordfEXT( f ); } -static void TAG(FogCoordfvEXT)( const GLfloat *v ) +static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v ) { PRE_LOOPBACK( FogCoordfvEXT ); _glapi_Dispatch->FogCoordfvEXT( v ); } -static void TAG(Indexf)( GLfloat f ) +static void GLAPIENTRY TAG(Indexf)( GLfloat f ) { PRE_LOOPBACK( Indexf ); - _glapi_Dispatch->Indexi( f ); + _glapi_Dispatch->Indexf( f ); } -static void TAG(Indexfv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Indexfv)( const GLfloat *v ) { PRE_LOOPBACK( Indexfv ); _glapi_Dispatch->Indexfv( v ); } -static void TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) +static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) { PRE_LOOPBACK( Materialfv ); _glapi_Dispatch->Materialfv( face, pname, v ); } -static void TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) +static void GLAPIENTRY TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) { PRE_LOOPBACK( MultiTexCoord1fARB ); _glapi_Dispatch->MultiTexCoord1fARB( target, a ); } -static void TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) +static void GLAPIENTRY TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord1fvARB ); _glapi_Dispatch->MultiTexCoord1fvARB( target, tc ); } -static void TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) +static void GLAPIENTRY TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) { PRE_LOOPBACK( MultiTexCoord2fARB ); _glapi_Dispatch->MultiTexCoord2fARB( target, s, t ); } -static void TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) +static void GLAPIENTRY TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord2fvARB ); _glapi_Dispatch->MultiTexCoord2fvARB( target, tc ); } -static void TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, +static void GLAPIENTRY TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, GLfloat t, GLfloat r ) { PRE_LOOPBACK( MultiTexCoord3fARB ); _glapi_Dispatch->MultiTexCoord3fARB( target, s, t, r ); } -static void TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) +static void GLAPIENTRY TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord3fvARB ); _glapi_Dispatch->MultiTexCoord3fvARB( target, tc ); } -static void TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, +static void GLAPIENTRY TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( MultiTexCoord4fARB ); _glapi_Dispatch->MultiTexCoord4fARB( target, s, t, r, q ); } -static void TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) +static void GLAPIENTRY TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord4fvARB ); _glapi_Dispatch->MultiTexCoord4fvARB( target, tc ); } -static void TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Normal3f ); _glapi_Dispatch->Normal3f( x, y, z ); } -static void TAG(Normal3fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v ) { PRE_LOOPBACK( Normal3fv ); _glapi_Dispatch->Normal3fv( v ); } -static void TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) +static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( SecondaryColor3fEXT ); _glapi_Dispatch->SecondaryColor3fEXT( r, g, b ); } -static void TAG(SecondaryColor3fvEXT)( const GLfloat *v ) +static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v ) { PRE_LOOPBACK( SecondaryColor3fvEXT ); _glapi_Dispatch->SecondaryColor3fvEXT( v ); } -static void TAG(TexCoord1f)( GLfloat s ) +static void GLAPIENTRY TAG(TexCoord1f)( GLfloat s ) { PRE_LOOPBACK( TexCoord1f ); _glapi_Dispatch->TexCoord1f( s ); } -static void TAG(TexCoord1fv)( const GLfloat *tc ) +static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord1fv ); _glapi_Dispatch->TexCoord1fv( tc ); } -static void TAG(TexCoord2f)( GLfloat s, GLfloat t ) +static void GLAPIENTRY TAG(TexCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( TexCoord2f ); _glapi_Dispatch->TexCoord2f( s, t ); } -static void TAG(TexCoord2fv)( const GLfloat *tc ) +static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord2fv ); _glapi_Dispatch->TexCoord2fv( tc ); } -static void TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) +static void GLAPIENTRY TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) { PRE_LOOPBACK( TexCoord3f ); _glapi_Dispatch->TexCoord3f( s, t, r ); } -static void TAG(TexCoord3fv)( const GLfloat *tc ) +static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord3fv ); _glapi_Dispatch->TexCoord3fv( tc ); } -static void TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +static void GLAPIENTRY TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( TexCoord4f ); _glapi_Dispatch->TexCoord4f( s, t, r, q ); } -static void TAG(TexCoord4fv)( const GLfloat *tc ) +static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord4fv ); _glapi_Dispatch->TexCoord4fv( tc ); } -static void TAG(Vertex2f)( GLfloat x, GLfloat y ) +static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y ) { PRE_LOOPBACK( Vertex2f ); _glapi_Dispatch->Vertex2f( x, y ); } -static void TAG(Vertex2fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex2fv ); _glapi_Dispatch->Vertex2fv( v ); } -static void TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Vertex3f ); _glapi_Dispatch->Vertex3f( x, y, z ); } -static void TAG(Vertex3fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex3fv ); _glapi_Dispatch->Vertex3fv( v ); } -static void TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( Vertex4f ); _glapi_Dispatch->Vertex4f( x, y, z, w ); } -static void TAG(Vertex4fv)( const GLfloat *v ) +static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex4fv ); _glapi_Dispatch->Vertex4fv( v ); } -static void TAG(CallList)( GLuint i ) +static void GLAPIENTRY TAG(CallList)( GLuint i ) { PRE_LOOPBACK( CallList ); _glapi_Dispatch->CallList( i ); } -static void TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v ) +static void GLAPIENTRY TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v ) { PRE_LOOPBACK( CallLists ); _glapi_Dispatch->CallLists( sz, type, v ); } -static void TAG(Begin)( GLenum mode ) +static void GLAPIENTRY TAG(Begin)( GLenum mode ) { PRE_LOOPBACK( Begin ); _glapi_Dispatch->Begin( mode ); } -static void TAG(End)( void ) +static void GLAPIENTRY TAG(End)( void ) { PRE_LOOPBACK( End ); _glapi_Dispatch->End(); } -static void TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +static void GLAPIENTRY TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { PRE_LOOPBACK( Rectf ); _glapi_Dispatch->Rectf( x1, y1, x2, y2 ); } -static void TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) +static void GLAPIENTRY TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) { PRE_LOOPBACK( DrawArrays ); _glapi_Dispatch->DrawArrays( mode, start, count ); } -static void TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, +static void GLAPIENTRY TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) { PRE_LOOPBACK( DrawElements ); _glapi_Dispatch->DrawElements( mode, count, type, indices ); } -static void TAG(DrawRangeElements)( GLenum mode, GLuint start, +static void GLAPIENTRY TAG(DrawRangeElements)( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) { @@ -347,64 +347,64 @@ static void TAG(DrawRangeElements)( GLenum mode, GLuint start, _glapi_Dispatch->DrawRangeElements( mode, start, end, count, type, indices ); } -static void TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) +static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) { PRE_LOOPBACK( EvalMesh1 ); _glapi_Dispatch->EvalMesh1( mode, i1, i2 ); } -static void TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, +static void GLAPIENTRY TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { PRE_LOOPBACK( EvalMesh2 ); _glapi_Dispatch->EvalMesh2( mode, i1, i2, j1, j2 ); } -static void TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) +static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) { PRE_LOOPBACK( VertexAttrib1fNV ); _glapi_Dispatch->VertexAttrib1fNV( index, x ); } -static void TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v ) +static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib1fvNV ); _glapi_Dispatch->VertexAttrib1fvNV( index, v ); } -static void TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ) +static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ) { PRE_LOOPBACK( VertexAttrib2fNV ); _glapi_Dispatch->VertexAttrib2fNV( index, x, y ); } -static void TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v ) +static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib2fvNV ); _glapi_Dispatch->VertexAttrib2fvNV( index, v ); } -static void TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( VertexAttrib3fNV ); _glapi_Dispatch->VertexAttrib3fNV( index, x, y, z ); } -static void TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v ) +static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib3fvNV ); _glapi_Dispatch->VertexAttrib3fvNV( index, v ); } -static void TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( VertexAttrib4fNV ); _glapi_Dispatch->VertexAttrib4fNV( index, x, y, z, w ); } -static void TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) +static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) { - PRE_LOOPBACK( VertexAttrib4fNV ); + PRE_LOOPBACK( VertexAttrib4fvNV ); _glapi_Dispatch->VertexAttrib4fvNV( index, v ); } diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index 345df378ff0..6d522ffd870 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -780,7 +780,7 @@ _swrast_blend_span( GLcontext *ctx, const struct sw_span *span, ASSERT(span->end <= MAX_WIDTH); ASSERT(span->arrayMask & SPAN_RGBA); - ASSERT(!ctx->Color.ColorLogicOpEnabled); + ASSERT(!ctx->Color._LogicOpEnabled); /* Read span of current frame buffer pixels */ if (span->arrayMask & SPAN_XY) { diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 99da79afd5f..fb09eb30601 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -59,7 +59,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) if (ctx->Visual.rgbMode) { const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); if (colorMask != 0xffffffff) RasterMask |= MASKING_BIT; - if (ctx->Color.ColorLogicOpEnabled) RasterMask |= LOGIC_OP_BIT; + if (ctx->Color._LogicOpEnabled) RasterMask |= LOGIC_OP_BIT; if (ctx->Texture._EnabledUnits) RasterMask |= TEXTURE_BIT; } else { @@ -269,7 +269,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) } -static void +static void _ASMAPI _swrast_validate_blend_func( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan src[][4], @@ -311,11 +311,6 @@ _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, lambda, rgba ); - - /* GL_SGI_texture_color_table */ - if (ctx->Texture.Unit[texUnit].ColorTableEnabled) { - _swrast_texture_table_lookup(&ctx->Texture.Unit[texUnit].ColorTable, n, rgba); - } } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index c699078e166..6dc8b13b0e7 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -202,14 +202,9 @@ typedef void (*texture_sample_func)(GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]); -#ifdef USE_MMX_ASM typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan src[][4], CONST GLchan dst[][4] ); -#else -typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], - GLchan src[][4], CONST GLchan dst[][4] ); -#endif typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index 332edc5c86e..94458238b51 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -38,7 +38,6 @@ /* if 1, print some debugging info */ #define DEBUG_FRAG 0 - /** * Fetch a texel. */ @@ -120,13 +119,14 @@ get_register_pointer( GLcontext *ctx, ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_PARAMS); src = ctx->FragmentProgram.Parameters[source->Index]; break; + + case PROGRAM_STATE_VAR: + /* Fallthrough */ + case PROGRAM_NAMED_PARAM: ASSERT(source->Index < (GLint) program->Parameters->NumParameters); src = program->Parameters->Parameters[source->Index].Values; break; - case PROGRAM_STATE_VAR: - src = NULL; - break; default: _mesa_problem(ctx, "Invalid input register file in fetch_vector4"); src = NULL; @@ -572,6 +572,12 @@ execute_program( GLcontext *ctx, printf("execute fragment program --------------------\n"); #endif + /* XXX: This should go someplace else, but it is safe here (and slow!) + * - karl + */ + _mesa_load_state_parameters(ctx, program->Parameters); + + for (pc = 0; pc < maxInst; pc++) { const struct fp_instruction *inst = program->Instructions + pc; diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 00aa43d07cc..f2b91e05282 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 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"), @@ -61,6 +60,17 @@ read_index_pixels( GLcontext *ctx, return; } + if (type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_INT && + type != GL_UNSIGNED_INT && + type != GL_FLOAT) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(index type)"); + return; + } + _swrast_use_read_buffer(ctx); readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index a3be9734c3d..013114768d2 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -716,7 +716,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) /* make copy of incoming colors */ MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); - if (ctx->Color.ColorLogicOpEnabled) { + if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, span, rgbaTmp); } else if (ctx->Color.BlendEnabled) { @@ -1100,7 +1100,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) } else { /* normal: write to exactly one buffer */ - if (ctx->Color.ColorLogicOpEnabled) { + if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, span, span->array->rgba); monoColor = GL_FALSE; } @@ -1373,7 +1373,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) } else { /* normal: write to exactly one buffer */ - if (ctx->Color.ColorLogicOpEnabled) { + if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, span, span->array->rgba); } else if (ctx->Color.BlendEnabled) { diff --git a/src/mesa/swrast/s_spantemp.h b/src/mesa/swrast/s_spantemp.h index df08f14760a..95d9358a16d 100644 --- a/src/mesa/swrast/s_spantemp.h +++ b/src/mesa/swrast/s_spantemp.h @@ -366,6 +366,7 @@ NAME(read_index_pixels)( const GLcontext *ctx, #undef NAME +#undef SPAN_VARS #undef INIT_PIXEL_PTR #undef INC_PIXEL_PTR #undef STORE_RGB_PIXEL diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index a196f34c275..2342179a4e6 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -3873,9 +3873,6 @@ texture_apply( const GLcontext *ctx, else if (format == GL_DEPTH_COMPONENT) { format = texUnit->_Current->DepthMode; } - else if (texUnit->ColorTableEnabled) { - format = texUnit->ColorTable.Format; - } switch (texUnit->EnvMode) { case GL_REPLACE: diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index c000e41943b..eb133f969c8 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -83,10 +83,10 @@ _swsetup_DestroyContext( GLcontext *ctx ) ALIGN_FREE(swsetup->verts); if (swsetup->ChanSecondaryColor.Ptr) - ALIGN_FREE(swsetup->ChanSecondaryColor.Ptr); + ALIGN_FREE((void *) swsetup->ChanSecondaryColor.Ptr); if (swsetup->ChanColor.Ptr) - ALIGN_FREE(swsetup->ChanColor.Ptr); + ALIGN_FREE((void *) swsetup->ChanColor.Ptr); FREE(swsetup); ctx->swsetup_context = 0; diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 0357829ff48..f9f5fe99511 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -124,7 +124,7 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, /** * Called via the GL API dispatcher. */ -void +void GLAPIENTRY _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); @@ -278,7 +278,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) /** * Called via the GL API dispatcher. */ -void +void GLAPIENTRY _tnl_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) @@ -291,8 +291,12 @@ _tnl_DrawRangeElements(GLenum mode, if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - ASSERT(ctx->Array.ElementArrayBufferObj->Data); - indices = (GLuint *) ctx->Array.ElementArrayBufferObj->Data; + if (!ctx->Array.ElementArrayBufferObj->Data) { + _mesa_warning(ctx, + "DrawRangeElements with empty vertex elements buffer!"); + return; + } + indices = (GLvoid *) ctx->Array.ElementArrayBufferObj->Data; } /* Check arguments, etc. @@ -349,7 +353,7 @@ _tnl_DrawRangeElements(GLenum mode, /** * Called via the GL API dispatcher. */ -void +void GLAPIENTRY _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { @@ -361,7 +365,10 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - ASSERT(ctx->Array.ElementArrayBufferObj->Data); + if (!ctx->Array.ElementArrayBufferObj->Data) { + _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!"); + return; + } indices = (const GLvoid *) ctx->Array.ElementArrayBufferObj->Data; } diff --git a/src/mesa/tnl/t_array_api.h b/src/mesa/tnl/t_array_api.h index c26112bef5c..61d1f696b00 100644 --- a/src/mesa/tnl/t_array_api.h +++ b/src/mesa/tnl/t_array_api.h @@ -30,12 +30,12 @@ #include "t_context.h" -extern void _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); +extern void GLAPIENTRY _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); -extern void _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, +extern void GLAPIENTRY _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -extern void _tnl_DrawRangeElements(GLenum mode, GLuint start, +extern void GLAPIENTRY _tnl_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 7ced47561e7..16874dfb9a6 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -46,7 +46,7 @@ static void _tnl_import_vertex( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_vertex(ctx, GL_FLOAT, @@ -69,7 +69,7 @@ static void _tnl_import_normal( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_normal(ctx, GL_FLOAT, stride ? 3*sizeof(GLfloat) : 0, writeable, @@ -136,7 +136,7 @@ static void _tnl_import_fogcoord( GLcontext *ctx, struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_fogcoord(ctx, GL_FLOAT, stride ? sizeof(GLfloat) : 0, writeable, @@ -155,7 +155,7 @@ static void _tnl_import_index( GLcontext *ctx, struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_index(ctx, GL_FLOAT, stride ? sizeof(GLfloat) : 0, writeable, @@ -176,7 +176,7 @@ static void _tnl_import_texcoord( GLcontext *ctx, struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT, stride ? 4 * sizeof(GLfloat) : 0, @@ -199,7 +199,7 @@ static void _tnl_import_edgeflag( GLcontext *ctx, struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, sizeof(GLubyte), @@ -220,7 +220,7 @@ static void _tnl_import_attrib( GLcontext *ctx, struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; - GLubyte *data; + const GLubyte *data; tmp = _ac_import_attrib(ctx, index, GL_FLOAT, stride ? 4 * sizeof(GLfloat) : 0, diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index e649e0f9b62..6ffc53d7e06 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -352,22 +352,20 @@ static void texgen( GLcontext *ctx, struct vertex_buffer *VB = &tnl->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const GLvector4f *obj = VB->ObjPtr; const GLvector4f *eye = VB->EyePtr; const GLvector4f *normal = VB->NormalPtr; + const GLfloat *m = store->tmp_m; + const GLuint count = VB->Count; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; - GLfloat *indata; - GLuint count = VB->Count; GLfloat (*f)[3] = store->tmp_f; - GLfloat *m = store->tmp_m; GLuint holes = 0; - if (texUnit->_GenFlags & TEXGEN_NEED_M) { - build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); + build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { - build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); } if (!in) { @@ -413,8 +411,8 @@ static void texgen( GLcontext *ctx, texUnit->EyePlaneS ); break; case GL_SPHERE_MAP: - for (indata=in->start,i=0 ; i<count ;i++, STRIDE_F(indata,in->stride)) - texcoord[i][0] = indata[0] * m[i] + 0.5F; + for (i = 0; i < count; i++) + texcoord[i][0] = f[i][0] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;i<count;i++) @@ -446,8 +444,8 @@ static void texgen( GLcontext *ctx, texUnit->EyePlaneT ); break; case GL_SPHERE_MAP: - for (indata=in->start,i=0; i<count ;i++,STRIDE_F(indata,in->stride)) - texcoord[i][1] = indata[1] * m[i] + 0.5F; + for (i = 0; i < count; i++) + texcoord[i][1] = f[i][1] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;i<count;i++) @@ -547,9 +545,9 @@ static GLboolean run_validate_texgen_stage( GLcontext *ctx, if (texUnit->TexGenEnabled) { GLuint sz; - if (texUnit->TexGenEnabled & R_BIT) + if (texUnit->TexGenEnabled & Q_BIT) sz = 4; - else if (texUnit->TexGenEnabled & Q_BIT) + else if (texUnit->TexGenEnabled & R_BIT) sz = 3; else if (texUnit->TexGenEnabled & T_BIT) sz = 2; @@ -558,8 +556,9 @@ static GLboolean run_validate_texgen_stage( GLcontext *ctx, store->TexgenSize[i] = sz; store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled); - store->TexgenFunc[i] = texgen; + store->TexgenFunc[i] = texgen; /* general solution */ + /* look for special texgen cases */ if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { store->TexgenFunc[i] = texgen_reflection_map_nv; diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h index 53e554728d8..54648dfe9ec 100644 --- a/src/mesa/x86/assyntax.h +++ b/src/mesa/x86/assyntax.h @@ -1,4 +1,4 @@ -/* $Id: assyntax.h,v 1.22 2003/10/02 17:36:45 brianp Exp $ */ +/* $Id: assyntax.h,v 1.22.2.1 2003/11/21 15:49:45 keithw Exp $ */ #ifndef __ASSYNTAX_H__ #define __ASSYNTAX_H__ @@ -1074,7 +1074,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define B_REGDB(d, b) BYTE_PTR [b + d] /* Variable indirect: */ -#define VARINDIRECT(var) var +#define VARINDIRECT(var) [var] /* Use register contents as jump/call target: */ #define CODEPTR(reg) P_(reg) @@ -1086,6 +1086,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define P_(a) P_ ## a #define X_(a) X_ ## a #define D_(a) D_ ## a +#define SR_(a) W_ ## a #define S_(a) L_ ## a #define L_(a) L_ ## a #define W_(a) W_ ## a @@ -1227,7 +1228,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define LOOPNZ(a) loopnz a #define LSL(a, b) lsl b, a #define LTR(a) ltr a -#define MOV_SR(a, b) mov S_(b), S_(a) +#define MOV_SR(a, b) mov SR_(b), SR_(a) #define MOV_L(a, b) mov L_(b), L_(a) #define MOV_W(a, b) mov W_(b), W_(a) #define MOV_B(a, b) mov B_(b), B_(a) @@ -1262,14 +1263,14 @@ SECTION _DATA public align=16 class=DATA use32 flat #define OUTS_L outsd #define OUTS_W outsw #define OUTS_B outsb -#define POP_SR(a) pop S_(a) +#define POP_SR(a) pop SR_(a) #define POP_L(a) pop L_(a) #define POP_W(a) pop W_(a) #define POPA_L popad #define POPA_W popa #define POPF_L popfd #define POPF_W popf -#define PUSH_SR(a) push S_(a) +#define PUSH_SR(a) push SR_(a) #define PUSH_L(a) push L_(a) #define PUSH_W(a) push W_(a) #define PUSH_B(a) push B_(a) @@ -1341,15 +1342,15 @@ SECTION _DATA public align=16 class=DATA use32 flat #define SETZ(a) setz a #define SGDT(a) sgdt a #define SIDT(a) sidt a -#define SHL_L(a, b) shl L_(b), L_(a) -#define SHL_W(a, b) shl W_(b), W_(a) +#define SHL_L(a, b) shl L_(b), B_(a) +#define SHL_W(a, b) shl W_(b), B_(a) #define SHL_B(a, b) shl B_(b), B_(a) #define SHLD_L(a,b,c) shld #define SHLD2_L(a,b) shld L_(b), L_(a) #define SHLD_W(a,b,c) shld #define SHLD2_W(a,b) shld W_(b), W_(a) -#define SHR_L(a, b) shr L_(b), L_(a) -#define SHR_W(a, b) shr W_(b), W_(a) +#define SHR_L(a, b) shr L_(b), B_(a) +#define SHR_W(a, b) shr W_(b), B_(a) #define SHR_B(a, b) shr B_(b), B_(a) #define SHRD_L(a,b,c) shrd #define SHRD2_L(a,b) shrd L_(b), L_(a) @@ -1360,9 +1361,9 @@ SECTION _DATA public align=16 class=DATA use32 flat #define STC stc #define STD std #define STI sti -#define STOS_L stos -#define STOS_W stos -#define STOS_B stos +#define STOS_L stosd +#define STOS_W stosw +#define STOS_B stosb #define STR(a) str a #define SUB_L(a, b) sub L_(b), L_(a) #define SUB_W(a, b) sub W_(b), W_(a) @@ -1693,5 +1694,18 @@ SECTION _DATA public align=16 class=DATA use32 flat #define LLBL(a) a #endif +/* Segment overrides */ +#define SEGCS D_BYTE 46 +#define SEGDS D_BYTE 62 +#define SEGES D_BYTE 38 +#define SEGFS D_BYTE 100 +#define SEGGS D_BYTE 101 + +/* Temporary labels: valid until next non-local label */ +#ifdef NASM_ASSEMBLER +#define TLBL(a) CONCAT(.,a) +#else +#define TLBL(a) CONCAT(a,$) +#endif #endif /* __ASSYNTAX_H__ */ diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index da572dfbf0a..ba0aaea94ed 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -1,4 +1,4 @@ -/* $Id: common_x86.c,v 1.22 2003/02/04 02:22:51 brianp Exp $ */ +/* $Id: common_x86.c,v 1.22.4.1 2003/11/21 15:49:45 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -52,14 +52,12 @@ int _mesa_x86_cpu_features = 0; /* No reason for this to be public. */ -extern int _mesa_identify_x86_cpu_features(void); - -extern GLuint _mesa_x86_has_cpuid(void); -extern void _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); -extern GLuint _mesa_x86_cpuid_eax(GLuint op); -extern GLuint _mesa_x86_cpuid_ebx(GLuint op); -extern GLuint _mesa_x86_cpuid_ecx(GLuint op); -extern GLuint _mesa_x86_cpuid_edx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_has_cpuid(void); +extern void _ASMAPI _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); +extern GLuint _ASMAPI _mesa_x86_cpuid_eax(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ebx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ecx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_edx(GLuint op); static void message( const char *msg ) { diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 54c3670ed13..6ad65e6d5a3 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -4,5396 +4,5399 @@ #ifndef __WIN32__ -#if defined(USE_MGL_NAMESPACE) -#define GL_PREFIX(n) GLNAME(CONCAT(mgl,n)) +#if defined(STDCALL_API) +#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2)) +#elif defined(USE_MGL_NAMESPACE) +#define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n)) #else -#define GL_PREFIX(n) GLNAME(CONCAT(gl,n)) +#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n)) #endif #define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX)) -#if defined(GNU_ASSEMBLER) && !defined(DJGPP) +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) #define GLOBL_FN(x) GLOBL x ; .type x,@function #else #define GLOBL_FN(x) GLOBL x #endif +SEG_TEXT EXTERN GLNAME(_glapi_Dispatch) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NewList)) -GL_PREFIX(NewList): +GLOBL_FN(GL_PREFIX(NewList,NewList@8)) +GL_PREFIX(NewList,NewList@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NewList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EndList)) -GL_PREFIX(EndList): +GLOBL_FN(GL_PREFIX(EndList,EndList@0)) +GL_PREFIX(EndList,EndList@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EndList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CallList)) -GL_PREFIX(CallList): +GLOBL_FN(GL_PREFIX(CallList,CallList@4)) +GL_PREFIX(CallList,CallList@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CallList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CallLists)) -GL_PREFIX(CallLists): +GLOBL_FN(GL_PREFIX(CallLists,CallLists@12)) +GL_PREFIX(CallLists,CallLists@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CallLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteLists)) -GL_PREFIX(DeleteLists): +GLOBL_FN(GL_PREFIX(DeleteLists,DeleteLists@8)) +GL_PREFIX(DeleteLists,DeleteLists@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenLists)) -GL_PREFIX(GenLists): +GLOBL_FN(GL_PREFIX(GenLists,GenLists@4)) +GL_PREFIX(GenLists,GenLists@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListBase)) -GL_PREFIX(ListBase): +GLOBL_FN(GL_PREFIX(ListBase,ListBase@4)) +GL_PREFIX(ListBase,ListBase@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListBase)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Begin)) -GL_PREFIX(Begin): +GLOBL_FN(GL_PREFIX(Begin,Begin@4)) +GL_PREFIX(Begin,Begin@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Begin)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Bitmap)) -GL_PREFIX(Bitmap): +GLOBL_FN(GL_PREFIX(Bitmap,Bitmap@28)) +GL_PREFIX(Bitmap,Bitmap@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Bitmap)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3b)) -GL_PREFIX(Color3b): +GLOBL_FN(GL_PREFIX(Color3b,Color3b@12)) +GL_PREFIX(Color3b,Color3b@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3b)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3bv)) -GL_PREFIX(Color3bv): +GLOBL_FN(GL_PREFIX(Color3bv,Color3bv@4)) +GL_PREFIX(Color3bv,Color3bv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3bv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3d)) -GL_PREFIX(Color3d): +GLOBL_FN(GL_PREFIX(Color3d,Color3d@24)) +GL_PREFIX(Color3d,Color3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3dv)) -GL_PREFIX(Color3dv): +GLOBL_FN(GL_PREFIX(Color3dv,Color3dv@4)) +GL_PREFIX(Color3dv,Color3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3f)) -GL_PREFIX(Color3f): +GLOBL_FN(GL_PREFIX(Color3f,Color3f@12)) +GL_PREFIX(Color3f,Color3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3fv)) -GL_PREFIX(Color3fv): +GLOBL_FN(GL_PREFIX(Color3fv,Color3fv@4)) +GL_PREFIX(Color3fv,Color3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3i)) -GL_PREFIX(Color3i): +GLOBL_FN(GL_PREFIX(Color3i,Color3i@12)) +GL_PREFIX(Color3i,Color3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3iv)) -GL_PREFIX(Color3iv): +GLOBL_FN(GL_PREFIX(Color3iv,Color3iv@4)) +GL_PREFIX(Color3iv,Color3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3s)) -GL_PREFIX(Color3s): +GLOBL_FN(GL_PREFIX(Color3s,Color3s@12)) +GL_PREFIX(Color3s,Color3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3sv)) -GL_PREFIX(Color3sv): +GLOBL_FN(GL_PREFIX(Color3sv,Color3sv@4)) +GL_PREFIX(Color3sv,Color3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3ub)) -GL_PREFIX(Color3ub): +GLOBL_FN(GL_PREFIX(Color3ub,Color3ub@12)) +GL_PREFIX(Color3ub,Color3ub@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ub)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3ubv)) -GL_PREFIX(Color3ubv): +GLOBL_FN(GL_PREFIX(Color3ubv,Color3ubv@4)) +GL_PREFIX(Color3ubv,Color3ubv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ubv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3ui)) -GL_PREFIX(Color3ui): +GLOBL_FN(GL_PREFIX(Color3ui,Color3ui@12)) +GL_PREFIX(Color3ui,Color3ui@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ui)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3uiv)) -GL_PREFIX(Color3uiv): +GLOBL_FN(GL_PREFIX(Color3uiv,Color3uiv@4)) +GL_PREFIX(Color3uiv,Color3uiv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3uiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3us)) -GL_PREFIX(Color3us): +GLOBL_FN(GL_PREFIX(Color3us,Color3us@12)) +GL_PREFIX(Color3us,Color3us@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3us)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3usv)) -GL_PREFIX(Color3usv): +GLOBL_FN(GL_PREFIX(Color3usv,Color3usv@4)) +GL_PREFIX(Color3usv,Color3usv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3usv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4b)) -GL_PREFIX(Color4b): +GLOBL_FN(GL_PREFIX(Color4b,Color4b@16)) +GL_PREFIX(Color4b,Color4b@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4b)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4bv)) -GL_PREFIX(Color4bv): +GLOBL_FN(GL_PREFIX(Color4bv,Color4bv@4)) +GL_PREFIX(Color4bv,Color4bv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4bv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4d)) -GL_PREFIX(Color4d): +GLOBL_FN(GL_PREFIX(Color4d,Color4d@32)) +GL_PREFIX(Color4d,Color4d@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4dv)) -GL_PREFIX(Color4dv): +GLOBL_FN(GL_PREFIX(Color4dv,Color4dv@4)) +GL_PREFIX(Color4dv,Color4dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4f)) -GL_PREFIX(Color4f): +GLOBL_FN(GL_PREFIX(Color4f,Color4f@16)) +GL_PREFIX(Color4f,Color4f@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4fv)) -GL_PREFIX(Color4fv): +GLOBL_FN(GL_PREFIX(Color4fv,Color4fv@4)) +GL_PREFIX(Color4fv,Color4fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4i)) -GL_PREFIX(Color4i): +GLOBL_FN(GL_PREFIX(Color4i,Color4i@16)) +GL_PREFIX(Color4i,Color4i@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4iv)) -GL_PREFIX(Color4iv): +GLOBL_FN(GL_PREFIX(Color4iv,Color4iv@4)) +GL_PREFIX(Color4iv,Color4iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4s)) -GL_PREFIX(Color4s): +GLOBL_FN(GL_PREFIX(Color4s,Color4s@16)) +GL_PREFIX(Color4s,Color4s@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4sv)) -GL_PREFIX(Color4sv): +GLOBL_FN(GL_PREFIX(Color4sv,Color4sv@4)) +GL_PREFIX(Color4sv,Color4sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4ub)) -GL_PREFIX(Color4ub): +GLOBL_FN(GL_PREFIX(Color4ub,Color4ub@16)) +GL_PREFIX(Color4ub,Color4ub@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ub)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4ubv)) -GL_PREFIX(Color4ubv): +GLOBL_FN(GL_PREFIX(Color4ubv,Color4ubv@4)) +GL_PREFIX(Color4ubv,Color4ubv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ubv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4ui)) -GL_PREFIX(Color4ui): +GLOBL_FN(GL_PREFIX(Color4ui,Color4ui@16)) +GL_PREFIX(Color4ui,Color4ui@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ui)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4uiv)) -GL_PREFIX(Color4uiv): +GLOBL_FN(GL_PREFIX(Color4uiv,Color4uiv@4)) +GL_PREFIX(Color4uiv,Color4uiv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4uiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4us)) -GL_PREFIX(Color4us): +GLOBL_FN(GL_PREFIX(Color4us,Color4us@16)) +GL_PREFIX(Color4us,Color4us@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4us)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4usv)) -GL_PREFIX(Color4usv): +GLOBL_FN(GL_PREFIX(Color4usv,Color4usv@4)) +GL_PREFIX(Color4usv,Color4usv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4usv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlag)) -GL_PREFIX(EdgeFlag): +GLOBL_FN(GL_PREFIX(EdgeFlag,EdgeFlag@4)) +GL_PREFIX(EdgeFlag,EdgeFlag@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlag)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagv)) -GL_PREFIX(EdgeFlagv): +GLOBL_FN(GL_PREFIX(EdgeFlagv,EdgeFlagv@4)) +GL_PREFIX(EdgeFlagv,EdgeFlagv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(End)) -GL_PREFIX(End): +GLOBL_FN(GL_PREFIX(End,End@0)) +GL_PREFIX(End,End@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_End)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexd)) -GL_PREFIX(Indexd): +GLOBL_FN(GL_PREFIX(Indexd,Indexd@8)) +GL_PREFIX(Indexd,Indexd@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexdv)) -GL_PREFIX(Indexdv): +GLOBL_FN(GL_PREFIX(Indexdv,Indexdv@4)) +GL_PREFIX(Indexdv,Indexdv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexf)) -GL_PREFIX(Indexf): +GLOBL_FN(GL_PREFIX(Indexf,Indexf@4)) +GL_PREFIX(Indexf,Indexf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexfv)) -GL_PREFIX(Indexfv): +GLOBL_FN(GL_PREFIX(Indexfv,Indexfv@4)) +GL_PREFIX(Indexfv,Indexfv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexi)) -GL_PREFIX(Indexi): +GLOBL_FN(GL_PREFIX(Indexi,Indexi@4)) +GL_PREFIX(Indexi,Indexi@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexiv)) -GL_PREFIX(Indexiv): +GLOBL_FN(GL_PREFIX(Indexiv,Indexiv@4)) +GL_PREFIX(Indexiv,Indexiv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexs)) -GL_PREFIX(Indexs): +GLOBL_FN(GL_PREFIX(Indexs,Indexs@4)) +GL_PREFIX(Indexs,Indexs@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexs)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexsv)) -GL_PREFIX(Indexsv): +GLOBL_FN(GL_PREFIX(Indexsv,Indexsv@4)) +GL_PREFIX(Indexsv,Indexsv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3b)) -GL_PREFIX(Normal3b): +GLOBL_FN(GL_PREFIX(Normal3b,Normal3b@12)) +GL_PREFIX(Normal3b,Normal3b@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3b)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3bv)) -GL_PREFIX(Normal3bv): +GLOBL_FN(GL_PREFIX(Normal3bv,Normal3bv@4)) +GL_PREFIX(Normal3bv,Normal3bv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3bv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3d)) -GL_PREFIX(Normal3d): +GLOBL_FN(GL_PREFIX(Normal3d,Normal3d@24)) +GL_PREFIX(Normal3d,Normal3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3dv)) -GL_PREFIX(Normal3dv): +GLOBL_FN(GL_PREFIX(Normal3dv,Normal3dv@4)) +GL_PREFIX(Normal3dv,Normal3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3f)) -GL_PREFIX(Normal3f): +GLOBL_FN(GL_PREFIX(Normal3f,Normal3f@12)) +GL_PREFIX(Normal3f,Normal3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3fv)) -GL_PREFIX(Normal3fv): +GLOBL_FN(GL_PREFIX(Normal3fv,Normal3fv@4)) +GL_PREFIX(Normal3fv,Normal3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3i)) -GL_PREFIX(Normal3i): +GLOBL_FN(GL_PREFIX(Normal3i,Normal3i@12)) +GL_PREFIX(Normal3i,Normal3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3iv)) -GL_PREFIX(Normal3iv): +GLOBL_FN(GL_PREFIX(Normal3iv,Normal3iv@4)) +GL_PREFIX(Normal3iv,Normal3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3s)) -GL_PREFIX(Normal3s): +GLOBL_FN(GL_PREFIX(Normal3s,Normal3s@12)) +GL_PREFIX(Normal3s,Normal3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3sv)) -GL_PREFIX(Normal3sv): +GLOBL_FN(GL_PREFIX(Normal3sv,Normal3sv@4)) +GL_PREFIX(Normal3sv,Normal3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2d)) -GL_PREFIX(RasterPos2d): +GLOBL_FN(GL_PREFIX(RasterPos2d,RasterPos2d@16)) +GL_PREFIX(RasterPos2d,RasterPos2d@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2dv)) -GL_PREFIX(RasterPos2dv): +GLOBL_FN(GL_PREFIX(RasterPos2dv,RasterPos2dv@4)) +GL_PREFIX(RasterPos2dv,RasterPos2dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2f)) -GL_PREFIX(RasterPos2f): +GLOBL_FN(GL_PREFIX(RasterPos2f,RasterPos2f@8)) +GL_PREFIX(RasterPos2f,RasterPos2f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2fv)) -GL_PREFIX(RasterPos2fv): +GLOBL_FN(GL_PREFIX(RasterPos2fv,RasterPos2fv@4)) +GL_PREFIX(RasterPos2fv,RasterPos2fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2i)) -GL_PREFIX(RasterPos2i): +GLOBL_FN(GL_PREFIX(RasterPos2i,RasterPos2i@8)) +GL_PREFIX(RasterPos2i,RasterPos2i@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2iv)) -GL_PREFIX(RasterPos2iv): +GLOBL_FN(GL_PREFIX(RasterPos2iv,RasterPos2iv@4)) +GL_PREFIX(RasterPos2iv,RasterPos2iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2s)) -GL_PREFIX(RasterPos2s): +GLOBL_FN(GL_PREFIX(RasterPos2s,RasterPos2s@8)) +GL_PREFIX(RasterPos2s,RasterPos2s@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2sv)) -GL_PREFIX(RasterPos2sv): +GLOBL_FN(GL_PREFIX(RasterPos2sv,RasterPos2sv@4)) +GL_PREFIX(RasterPos2sv,RasterPos2sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3d)) -GL_PREFIX(RasterPos3d): +GLOBL_FN(GL_PREFIX(RasterPos3d,RasterPos3d@24)) +GL_PREFIX(RasterPos3d,RasterPos3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3dv)) -GL_PREFIX(RasterPos3dv): +GLOBL_FN(GL_PREFIX(RasterPos3dv,RasterPos3dv@4)) +GL_PREFIX(RasterPos3dv,RasterPos3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3f)) -GL_PREFIX(RasterPos3f): +GLOBL_FN(GL_PREFIX(RasterPos3f,RasterPos3f@12)) +GL_PREFIX(RasterPos3f,RasterPos3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3fv)) -GL_PREFIX(RasterPos3fv): +GLOBL_FN(GL_PREFIX(RasterPos3fv,RasterPos3fv@4)) +GL_PREFIX(RasterPos3fv,RasterPos3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3i)) -GL_PREFIX(RasterPos3i): +GLOBL_FN(GL_PREFIX(RasterPos3i,RasterPos3i@12)) +GL_PREFIX(RasterPos3i,RasterPos3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3iv)) -GL_PREFIX(RasterPos3iv): +GLOBL_FN(GL_PREFIX(RasterPos3iv,RasterPos3iv@4)) +GL_PREFIX(RasterPos3iv,RasterPos3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3s)) -GL_PREFIX(RasterPos3s): +GLOBL_FN(GL_PREFIX(RasterPos3s,RasterPos3s@12)) +GL_PREFIX(RasterPos3s,RasterPos3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3sv)) -GL_PREFIX(RasterPos3sv): +GLOBL_FN(GL_PREFIX(RasterPos3sv,RasterPos3sv@4)) +GL_PREFIX(RasterPos3sv,RasterPos3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4d)) -GL_PREFIX(RasterPos4d): +GLOBL_FN(GL_PREFIX(RasterPos4d,RasterPos4d@32)) +GL_PREFIX(RasterPos4d,RasterPos4d@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4dv)) -GL_PREFIX(RasterPos4dv): +GLOBL_FN(GL_PREFIX(RasterPos4dv,RasterPos4dv@4)) +GL_PREFIX(RasterPos4dv,RasterPos4dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4f)) -GL_PREFIX(RasterPos4f): +GLOBL_FN(GL_PREFIX(RasterPos4f,RasterPos4f@16)) +GL_PREFIX(RasterPos4f,RasterPos4f@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4fv)) -GL_PREFIX(RasterPos4fv): +GLOBL_FN(GL_PREFIX(RasterPos4fv,RasterPos4fv@4)) +GL_PREFIX(RasterPos4fv,RasterPos4fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4i)) -GL_PREFIX(RasterPos4i): +GLOBL_FN(GL_PREFIX(RasterPos4i,RasterPos4i@16)) +GL_PREFIX(RasterPos4i,RasterPos4i@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4iv)) -GL_PREFIX(RasterPos4iv): +GLOBL_FN(GL_PREFIX(RasterPos4iv,RasterPos4iv@4)) +GL_PREFIX(RasterPos4iv,RasterPos4iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4s)) -GL_PREFIX(RasterPos4s): +GLOBL_FN(GL_PREFIX(RasterPos4s,RasterPos4s@16)) +GL_PREFIX(RasterPos4s,RasterPos4s@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4sv)) -GL_PREFIX(RasterPos4sv): +GLOBL_FN(GL_PREFIX(RasterPos4sv,RasterPos4sv@4)) +GL_PREFIX(RasterPos4sv,RasterPos4sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectd)) -GL_PREFIX(Rectd): +GLOBL_FN(GL_PREFIX(Rectd,Rectd@32)) +GL_PREFIX(Rectd,Rectd@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectdv)) -GL_PREFIX(Rectdv): +GLOBL_FN(GL_PREFIX(Rectdv,Rectdv@8)) +GL_PREFIX(Rectdv,Rectdv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectf)) -GL_PREFIX(Rectf): +GLOBL_FN(GL_PREFIX(Rectf,Rectf@16)) +GL_PREFIX(Rectf,Rectf@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectfv)) -GL_PREFIX(Rectfv): +GLOBL_FN(GL_PREFIX(Rectfv,Rectfv@8)) +GL_PREFIX(Rectfv,Rectfv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Recti)) -GL_PREFIX(Recti): +GLOBL_FN(GL_PREFIX(Recti,Recti@16)) +GL_PREFIX(Recti,Recti@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Recti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectiv)) -GL_PREFIX(Rectiv): +GLOBL_FN(GL_PREFIX(Rectiv,Rectiv@8)) +GL_PREFIX(Rectiv,Rectiv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rects)) -GL_PREFIX(Rects): +GLOBL_FN(GL_PREFIX(Rects,Rects@16)) +GL_PREFIX(Rects,Rects@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rects)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectsv)) -GL_PREFIX(Rectsv): +GLOBL_FN(GL_PREFIX(Rectsv,Rectsv@8)) +GL_PREFIX(Rectsv,Rectsv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1d)) -GL_PREFIX(TexCoord1d): +GLOBL_FN(GL_PREFIX(TexCoord1d,TexCoord1d@8)) +GL_PREFIX(TexCoord1d,TexCoord1d@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1dv)) -GL_PREFIX(TexCoord1dv): +GLOBL_FN(GL_PREFIX(TexCoord1dv,TexCoord1dv@4)) +GL_PREFIX(TexCoord1dv,TexCoord1dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1f)) -GL_PREFIX(TexCoord1f): +GLOBL_FN(GL_PREFIX(TexCoord1f,TexCoord1f@4)) +GL_PREFIX(TexCoord1f,TexCoord1f@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1fv)) -GL_PREFIX(TexCoord1fv): +GLOBL_FN(GL_PREFIX(TexCoord1fv,TexCoord1fv@4)) +GL_PREFIX(TexCoord1fv,TexCoord1fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1i)) -GL_PREFIX(TexCoord1i): +GLOBL_FN(GL_PREFIX(TexCoord1i,TexCoord1i@4)) +GL_PREFIX(TexCoord1i,TexCoord1i@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1iv)) -GL_PREFIX(TexCoord1iv): +GLOBL_FN(GL_PREFIX(TexCoord1iv,TexCoord1iv@4)) +GL_PREFIX(TexCoord1iv,TexCoord1iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1s)) -GL_PREFIX(TexCoord1s): +GLOBL_FN(GL_PREFIX(TexCoord1s,TexCoord1s@4)) +GL_PREFIX(TexCoord1s,TexCoord1s@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1sv)) -GL_PREFIX(TexCoord1sv): +GLOBL_FN(GL_PREFIX(TexCoord1sv,TexCoord1sv@4)) +GL_PREFIX(TexCoord1sv,TexCoord1sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2d)) -GL_PREFIX(TexCoord2d): +GLOBL_FN(GL_PREFIX(TexCoord2d,TexCoord2d@16)) +GL_PREFIX(TexCoord2d,TexCoord2d@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2dv)) -GL_PREFIX(TexCoord2dv): +GLOBL_FN(GL_PREFIX(TexCoord2dv,TexCoord2dv@4)) +GL_PREFIX(TexCoord2dv,TexCoord2dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2f)) -GL_PREFIX(TexCoord2f): +GLOBL_FN(GL_PREFIX(TexCoord2f,TexCoord2f@8)) +GL_PREFIX(TexCoord2f,TexCoord2f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2fv)) -GL_PREFIX(TexCoord2fv): +GLOBL_FN(GL_PREFIX(TexCoord2fv,TexCoord2fv@4)) +GL_PREFIX(TexCoord2fv,TexCoord2fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2i)) -GL_PREFIX(TexCoord2i): +GLOBL_FN(GL_PREFIX(TexCoord2i,TexCoord2i@8)) +GL_PREFIX(TexCoord2i,TexCoord2i@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2iv)) -GL_PREFIX(TexCoord2iv): +GLOBL_FN(GL_PREFIX(TexCoord2iv,TexCoord2iv@4)) +GL_PREFIX(TexCoord2iv,TexCoord2iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2s)) -GL_PREFIX(TexCoord2s): +GLOBL_FN(GL_PREFIX(TexCoord2s,TexCoord2s@8)) +GL_PREFIX(TexCoord2s,TexCoord2s@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2sv)) -GL_PREFIX(TexCoord2sv): +GLOBL_FN(GL_PREFIX(TexCoord2sv,TexCoord2sv@4)) +GL_PREFIX(TexCoord2sv,TexCoord2sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3d)) -GL_PREFIX(TexCoord3d): +GLOBL_FN(GL_PREFIX(TexCoord3d,TexCoord3d@24)) +GL_PREFIX(TexCoord3d,TexCoord3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3dv)) -GL_PREFIX(TexCoord3dv): +GLOBL_FN(GL_PREFIX(TexCoord3dv,TexCoord3dv@4)) +GL_PREFIX(TexCoord3dv,TexCoord3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3f)) -GL_PREFIX(TexCoord3f): +GLOBL_FN(GL_PREFIX(TexCoord3f,TexCoord3f@12)) +GL_PREFIX(TexCoord3f,TexCoord3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3fv)) -GL_PREFIX(TexCoord3fv): +GLOBL_FN(GL_PREFIX(TexCoord3fv,TexCoord3fv@4)) +GL_PREFIX(TexCoord3fv,TexCoord3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3i)) -GL_PREFIX(TexCoord3i): +GLOBL_FN(GL_PREFIX(TexCoord3i,TexCoord3i@12)) +GL_PREFIX(TexCoord3i,TexCoord3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3iv)) -GL_PREFIX(TexCoord3iv): +GLOBL_FN(GL_PREFIX(TexCoord3iv,TexCoord3iv@4)) +GL_PREFIX(TexCoord3iv,TexCoord3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3s)) -GL_PREFIX(TexCoord3s): +GLOBL_FN(GL_PREFIX(TexCoord3s,TexCoord3s@12)) +GL_PREFIX(TexCoord3s,TexCoord3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3sv)) -GL_PREFIX(TexCoord3sv): +GLOBL_FN(GL_PREFIX(TexCoord3sv,TexCoord3sv@4)) +GL_PREFIX(TexCoord3sv,TexCoord3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4d)) -GL_PREFIX(TexCoord4d): +GLOBL_FN(GL_PREFIX(TexCoord4d,TexCoord4d@32)) +GL_PREFIX(TexCoord4d,TexCoord4d@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4dv)) -GL_PREFIX(TexCoord4dv): +GLOBL_FN(GL_PREFIX(TexCoord4dv,TexCoord4dv@4)) +GL_PREFIX(TexCoord4dv,TexCoord4dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4f)) -GL_PREFIX(TexCoord4f): +GLOBL_FN(GL_PREFIX(TexCoord4f,TexCoord4f@16)) +GL_PREFIX(TexCoord4f,TexCoord4f@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4fv)) -GL_PREFIX(TexCoord4fv): +GLOBL_FN(GL_PREFIX(TexCoord4fv,TexCoord4fv@4)) +GL_PREFIX(TexCoord4fv,TexCoord4fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4i)) -GL_PREFIX(TexCoord4i): +GLOBL_FN(GL_PREFIX(TexCoord4i,TexCoord4i@16)) +GL_PREFIX(TexCoord4i,TexCoord4i@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4iv)) -GL_PREFIX(TexCoord4iv): +GLOBL_FN(GL_PREFIX(TexCoord4iv,TexCoord4iv@4)) +GL_PREFIX(TexCoord4iv,TexCoord4iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4s)) -GL_PREFIX(TexCoord4s): +GLOBL_FN(GL_PREFIX(TexCoord4s,TexCoord4s@16)) +GL_PREFIX(TexCoord4s,TexCoord4s@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4sv)) -GL_PREFIX(TexCoord4sv): +GLOBL_FN(GL_PREFIX(TexCoord4sv,TexCoord4sv@4)) +GL_PREFIX(TexCoord4sv,TexCoord4sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2d)) -GL_PREFIX(Vertex2d): +GLOBL_FN(GL_PREFIX(Vertex2d,Vertex2d@16)) +GL_PREFIX(Vertex2d,Vertex2d@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2dv)) -GL_PREFIX(Vertex2dv): +GLOBL_FN(GL_PREFIX(Vertex2dv,Vertex2dv@4)) +GL_PREFIX(Vertex2dv,Vertex2dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2f)) -GL_PREFIX(Vertex2f): +GLOBL_FN(GL_PREFIX(Vertex2f,Vertex2f@8)) +GL_PREFIX(Vertex2f,Vertex2f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2fv)) -GL_PREFIX(Vertex2fv): +GLOBL_FN(GL_PREFIX(Vertex2fv,Vertex2fv@4)) +GL_PREFIX(Vertex2fv,Vertex2fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2i)) -GL_PREFIX(Vertex2i): +GLOBL_FN(GL_PREFIX(Vertex2i,Vertex2i@8)) +GL_PREFIX(Vertex2i,Vertex2i@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2iv)) -GL_PREFIX(Vertex2iv): +GLOBL_FN(GL_PREFIX(Vertex2iv,Vertex2iv@4)) +GL_PREFIX(Vertex2iv,Vertex2iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2s)) -GL_PREFIX(Vertex2s): +GLOBL_FN(GL_PREFIX(Vertex2s,Vertex2s@8)) +GL_PREFIX(Vertex2s,Vertex2s@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2sv)) -GL_PREFIX(Vertex2sv): +GLOBL_FN(GL_PREFIX(Vertex2sv,Vertex2sv@4)) +GL_PREFIX(Vertex2sv,Vertex2sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3d)) -GL_PREFIX(Vertex3d): +GLOBL_FN(GL_PREFIX(Vertex3d,Vertex3d@24)) +GL_PREFIX(Vertex3d,Vertex3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3dv)) -GL_PREFIX(Vertex3dv): +GLOBL_FN(GL_PREFIX(Vertex3dv,Vertex3dv@4)) +GL_PREFIX(Vertex3dv,Vertex3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3f)) -GL_PREFIX(Vertex3f): +GLOBL_FN(GL_PREFIX(Vertex3f,Vertex3f@12)) +GL_PREFIX(Vertex3f,Vertex3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3fv)) -GL_PREFIX(Vertex3fv): +GLOBL_FN(GL_PREFIX(Vertex3fv,Vertex3fv@4)) +GL_PREFIX(Vertex3fv,Vertex3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3i)) -GL_PREFIX(Vertex3i): +GLOBL_FN(GL_PREFIX(Vertex3i,Vertex3i@12)) +GL_PREFIX(Vertex3i,Vertex3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3iv)) -GL_PREFIX(Vertex3iv): +GLOBL_FN(GL_PREFIX(Vertex3iv,Vertex3iv@4)) +GL_PREFIX(Vertex3iv,Vertex3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3s)) -GL_PREFIX(Vertex3s): +GLOBL_FN(GL_PREFIX(Vertex3s,Vertex3s@12)) +GL_PREFIX(Vertex3s,Vertex3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3sv)) -GL_PREFIX(Vertex3sv): +GLOBL_FN(GL_PREFIX(Vertex3sv,Vertex3sv@4)) +GL_PREFIX(Vertex3sv,Vertex3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4d)) -GL_PREFIX(Vertex4d): +GLOBL_FN(GL_PREFIX(Vertex4d,Vertex4d@32)) +GL_PREFIX(Vertex4d,Vertex4d@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4dv)) -GL_PREFIX(Vertex4dv): +GLOBL_FN(GL_PREFIX(Vertex4dv,Vertex4dv@4)) +GL_PREFIX(Vertex4dv,Vertex4dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4f)) -GL_PREFIX(Vertex4f): +GLOBL_FN(GL_PREFIX(Vertex4f,Vertex4f@16)) +GL_PREFIX(Vertex4f,Vertex4f@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4fv)) -GL_PREFIX(Vertex4fv): +GLOBL_FN(GL_PREFIX(Vertex4fv,Vertex4fv@4)) +GL_PREFIX(Vertex4fv,Vertex4fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4i)) -GL_PREFIX(Vertex4i): +GLOBL_FN(GL_PREFIX(Vertex4i,Vertex4i@16)) +GL_PREFIX(Vertex4i,Vertex4i@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4iv)) -GL_PREFIX(Vertex4iv): +GLOBL_FN(GL_PREFIX(Vertex4iv,Vertex4iv@4)) +GL_PREFIX(Vertex4iv,Vertex4iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4s)) -GL_PREFIX(Vertex4s): +GLOBL_FN(GL_PREFIX(Vertex4s,Vertex4s@16)) +GL_PREFIX(Vertex4s,Vertex4s@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4sv)) -GL_PREFIX(Vertex4sv): +GLOBL_FN(GL_PREFIX(Vertex4sv,Vertex4sv@4)) +GL_PREFIX(Vertex4sv,Vertex4sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClipPlane)) -GL_PREFIX(ClipPlane): +GLOBL_FN(GL_PREFIX(ClipPlane,ClipPlane@8)) +GL_PREFIX(ClipPlane,ClipPlane@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMaterial)) -GL_PREFIX(ColorMaterial): +GLOBL_FN(GL_PREFIX(ColorMaterial,ColorMaterial@8)) +GL_PREFIX(ColorMaterial,ColorMaterial@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorMaterial)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullFace)) -GL_PREFIX(CullFace): +GLOBL_FN(GL_PREFIX(CullFace,CullFace@4)) +GL_PREFIX(CullFace,CullFace@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogf)) -GL_PREFIX(Fogf): +GLOBL_FN(GL_PREFIX(Fogf,Fogf@8)) +GL_PREFIX(Fogf,Fogf@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogfv)) -GL_PREFIX(Fogfv): +GLOBL_FN(GL_PREFIX(Fogfv,Fogfv@8)) +GL_PREFIX(Fogfv,Fogfv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogi)) -GL_PREFIX(Fogi): +GLOBL_FN(GL_PREFIX(Fogi,Fogi@8)) +GL_PREFIX(Fogi,Fogi@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogiv)) -GL_PREFIX(Fogiv): +GLOBL_FN(GL_PREFIX(Fogiv,Fogiv@8)) +GL_PREFIX(Fogiv,Fogiv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FrontFace)) -GL_PREFIX(FrontFace): +GLOBL_FN(GL_PREFIX(FrontFace,FrontFace@4)) +GL_PREFIX(FrontFace,FrontFace@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FrontFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Hint)) -GL_PREFIX(Hint): +GLOBL_FN(GL_PREFIX(Hint,Hint@8)) +GL_PREFIX(Hint,Hint@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Hint)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightf)) -GL_PREFIX(Lightf): +GLOBL_FN(GL_PREFIX(Lightf,Lightf@12)) +GL_PREFIX(Lightf,Lightf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightfv)) -GL_PREFIX(Lightfv): +GLOBL_FN(GL_PREFIX(Lightfv,Lightfv@12)) +GL_PREFIX(Lightfv,Lightfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lighti)) -GL_PREFIX(Lighti): +GLOBL_FN(GL_PREFIX(Lighti,Lighti@12)) +GL_PREFIX(Lighti,Lighti@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lighti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightiv)) -GL_PREFIX(Lightiv): +GLOBL_FN(GL_PREFIX(Lightiv,Lightiv@12)) +GL_PREFIX(Lightiv,Lightiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelf)) -GL_PREFIX(LightModelf): +GLOBL_FN(GL_PREFIX(LightModelf,LightModelf@8)) +GL_PREFIX(LightModelf,LightModelf@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModelf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelfv)) -GL_PREFIX(LightModelfv): +GLOBL_FN(GL_PREFIX(LightModelfv,LightModelfv@8)) +GL_PREFIX(LightModelfv,LightModelfv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModelfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeli)) -GL_PREFIX(LightModeli): +GLOBL_FN(GL_PREFIX(LightModeli,LightModeli@8)) +GL_PREFIX(LightModeli,LightModeli@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModeli)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeliv)) -GL_PREFIX(LightModeliv): +GLOBL_FN(GL_PREFIX(LightModeliv,LightModeliv@8)) +GL_PREFIX(LightModeliv,LightModeliv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModeliv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineStipple)) -GL_PREFIX(LineStipple): +GLOBL_FN(GL_PREFIX(LineStipple,LineStipple@8)) +GL_PREFIX(LineStipple,LineStipple@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LineStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineWidth)) -GL_PREFIX(LineWidth): +GLOBL_FN(GL_PREFIX(LineWidth,LineWidth@4)) +GL_PREFIX(LineWidth,LineWidth@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LineWidth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialf)) -GL_PREFIX(Materialf): +GLOBL_FN(GL_PREFIX(Materialf,Materialf@12)) +GL_PREFIX(Materialf,Materialf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialfv)) -GL_PREFIX(Materialfv): +GLOBL_FN(GL_PREFIX(Materialfv,Materialfv@12)) +GL_PREFIX(Materialfv,Materialfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materiali)) -GL_PREFIX(Materiali): +GLOBL_FN(GL_PREFIX(Materiali,Materiali@12)) +GL_PREFIX(Materiali,Materiali@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materiali)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialiv)) -GL_PREFIX(Materialiv): +GLOBL_FN(GL_PREFIX(Materialiv,Materialiv@12)) +GL_PREFIX(Materialiv,Materialiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointSize)) -GL_PREFIX(PointSize): +GLOBL_FN(GL_PREFIX(PointSize,PointSize@4)) +GL_PREFIX(PointSize,PointSize@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointSize)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonMode)) -GL_PREFIX(PolygonMode): +GLOBL_FN(GL_PREFIX(PolygonMode,PolygonMode@8)) +GL_PREFIX(PolygonMode,PolygonMode@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonStipple)) -GL_PREFIX(PolygonStipple): +GLOBL_FN(GL_PREFIX(PolygonStipple,PolygonStipple@4)) +GL_PREFIX(PolygonStipple,PolygonStipple@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scissor)) -GL_PREFIX(Scissor): +GLOBL_FN(GL_PREFIX(Scissor,Scissor@16)) +GL_PREFIX(Scissor,Scissor@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scissor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ShadeModel)) -GL_PREFIX(ShadeModel): +GLOBL_FN(GL_PREFIX(ShadeModel,ShadeModel@4)) +GL_PREFIX(ShadeModel,ShadeModel@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ShadeModel)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterf)) -GL_PREFIX(TexParameterf): +GLOBL_FN(GL_PREFIX(TexParameterf,TexParameterf@12)) +GL_PREFIX(TexParameterf,TexParameterf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameterf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterfv)) -GL_PREFIX(TexParameterfv): +GLOBL_FN(GL_PREFIX(TexParameterfv,TexParameterfv@12)) +GL_PREFIX(TexParameterfv,TexParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteri)) -GL_PREFIX(TexParameteri): +GLOBL_FN(GL_PREFIX(TexParameteri,TexParameteri@12)) +GL_PREFIX(TexParameteri,TexParameteri@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameteri)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteriv)) -GL_PREFIX(TexParameteriv): +GLOBL_FN(GL_PREFIX(TexParameteriv,TexParameteriv@12)) +GL_PREFIX(TexParameteriv,TexParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage1D)) -GL_PREFIX(TexImage1D): +GLOBL_FN(GL_PREFIX(TexImage1D,TexImage1D@32)) +GL_PREFIX(TexImage1D,TexImage1D@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage2D)) -GL_PREFIX(TexImage2D): +GLOBL_FN(GL_PREFIX(TexImage2D,TexImage2D@36)) +GL_PREFIX(TexImage2D,TexImage2D@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvf)) -GL_PREFIX(TexEnvf): +GLOBL_FN(GL_PREFIX(TexEnvf,TexEnvf@12)) +GL_PREFIX(TexEnvf,TexEnvf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvfv)) -GL_PREFIX(TexEnvfv): +GLOBL_FN(GL_PREFIX(TexEnvfv,TexEnvfv@12)) +GL_PREFIX(TexEnvfv,TexEnvfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvi)) -GL_PREFIX(TexEnvi): +GLOBL_FN(GL_PREFIX(TexEnvi,TexEnvi@12)) +GL_PREFIX(TexEnvi,TexEnvi@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnviv)) -GL_PREFIX(TexEnviv): +GLOBL_FN(GL_PREFIX(TexEnviv,TexEnviv@12)) +GL_PREFIX(TexEnviv,TexEnviv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGend)) -GL_PREFIX(TexGend): +GLOBL_FN(GL_PREFIX(TexGend,TexGend@16)) +GL_PREFIX(TexGend,TexGend@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGend)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGendv)) -GL_PREFIX(TexGendv): +GLOBL_FN(GL_PREFIX(TexGendv,TexGendv@12)) +GL_PREFIX(TexGendv,TexGendv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenf)) -GL_PREFIX(TexGenf): +GLOBL_FN(GL_PREFIX(TexGenf,TexGenf@12)) +GL_PREFIX(TexGenf,TexGenf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGenf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenfv)) -GL_PREFIX(TexGenfv): +GLOBL_FN(GL_PREFIX(TexGenfv,TexGenfv@12)) +GL_PREFIX(TexGenfv,TexGenfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeni)) -GL_PREFIX(TexGeni): +GLOBL_FN(GL_PREFIX(TexGeni,TexGeni@12)) +GL_PREFIX(TexGeni,TexGeni@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGeni)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeniv)) -GL_PREFIX(TexGeniv): +GLOBL_FN(GL_PREFIX(TexGeniv,TexGeniv@12)) +GL_PREFIX(TexGeniv,TexGeniv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FeedbackBuffer)) -GL_PREFIX(FeedbackBuffer): +GLOBL_FN(GL_PREFIX(FeedbackBuffer,FeedbackBuffer@12)) +GL_PREFIX(FeedbackBuffer,FeedbackBuffer@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SelectBuffer)) -GL_PREFIX(SelectBuffer): +GLOBL_FN(GL_PREFIX(SelectBuffer,SelectBuffer@8)) +GL_PREFIX(SelectBuffer,SelectBuffer@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SelectBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RenderMode)) -GL_PREFIX(RenderMode): +GLOBL_FN(GL_PREFIX(RenderMode,RenderMode@4)) +GL_PREFIX(RenderMode,RenderMode@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RenderMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InitNames)) -GL_PREFIX(InitNames): +GLOBL_FN(GL_PREFIX(InitNames,InitNames@0)) +GL_PREFIX(InitNames,InitNames@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InitNames)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadName)) -GL_PREFIX(LoadName): +GLOBL_FN(GL_PREFIX(LoadName,LoadName@4)) +GL_PREFIX(LoadName,LoadName@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PassThrough)) -GL_PREFIX(PassThrough): +GLOBL_FN(GL_PREFIX(PassThrough,PassThrough@4)) +GL_PREFIX(PassThrough,PassThrough@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PassThrough)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopName)) -GL_PREFIX(PopName): +GLOBL_FN(GL_PREFIX(PopName,PopName@0)) +GL_PREFIX(PopName,PopName@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushName)) -GL_PREFIX(PushName): +GLOBL_FN(GL_PREFIX(PushName,PushName@4)) +GL_PREFIX(PushName,PushName@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawBuffer)) -GL_PREFIX(DrawBuffer): +GLOBL_FN(GL_PREFIX(DrawBuffer,DrawBuffer@4)) +GL_PREFIX(DrawBuffer,DrawBuffer@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Clear)) -GL_PREFIX(Clear): +GLOBL_FN(GL_PREFIX(Clear,Clear@4)) +GL_PREFIX(Clear,Clear@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Clear)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearAccum)) -GL_PREFIX(ClearAccum): +GLOBL_FN(GL_PREFIX(ClearAccum,ClearAccum@16)) +GL_PREFIX(ClearAccum,ClearAccum@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearAccum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearIndex)) -GL_PREFIX(ClearIndex): +GLOBL_FN(GL_PREFIX(ClearIndex,ClearIndex@4)) +GL_PREFIX(ClearIndex,ClearIndex@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearIndex)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearColor)) -GL_PREFIX(ClearColor): +GLOBL_FN(GL_PREFIX(ClearColor,ClearColor@16)) +GL_PREFIX(ClearColor,ClearColor@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearStencil)) -GL_PREFIX(ClearStencil): +GLOBL_FN(GL_PREFIX(ClearStencil,ClearStencil@4)) +GL_PREFIX(ClearStencil,ClearStencil@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearStencil)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearDepth)) -GL_PREFIX(ClearDepth): +GLOBL_FN(GL_PREFIX(ClearDepth,ClearDepth@8)) +GL_PREFIX(ClearDepth,ClearDepth@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearDepth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilMask)) -GL_PREFIX(StencilMask): +GLOBL_FN(GL_PREFIX(StencilMask,StencilMask@4)) +GL_PREFIX(StencilMask,StencilMask@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMask)) -GL_PREFIX(ColorMask): +GLOBL_FN(GL_PREFIX(ColorMask,ColorMask@16)) +GL_PREFIX(ColorMask,ColorMask@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthMask)) -GL_PREFIX(DepthMask): +GLOBL_FN(GL_PREFIX(DepthMask,DepthMask@4)) +GL_PREFIX(DepthMask,DepthMask@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexMask)) -GL_PREFIX(IndexMask): +GLOBL_FN(GL_PREFIX(IndexMask,IndexMask@4)) +GL_PREFIX(IndexMask,IndexMask@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Accum)) -GL_PREFIX(Accum): +GLOBL_FN(GL_PREFIX(Accum,Accum@8)) +GL_PREFIX(Accum,Accum@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Disable)) -GL_PREFIX(Disable): +GLOBL_FN(GL_PREFIX(Disable,Disable@4)) +GL_PREFIX(Disable,Disable@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Disable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Enable)) -GL_PREFIX(Enable): +GLOBL_FN(GL_PREFIX(Enable,Enable@4)) +GL_PREFIX(Enable,Enable@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Enable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Finish)) -GL_PREFIX(Finish): +GLOBL_FN(GL_PREFIX(Finish,Finish@0)) +GL_PREFIX(Finish,Finish@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Finish)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Flush)) -GL_PREFIX(Flush): +GLOBL_FN(GL_PREFIX(Flush,Flush@0)) +GL_PREFIX(Flush,Flush@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Flush)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopAttrib)) -GL_PREFIX(PopAttrib): +GLOBL_FN(GL_PREFIX(PopAttrib,PopAttrib@0)) +GL_PREFIX(PopAttrib,PopAttrib@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushAttrib)) -GL_PREFIX(PushAttrib): +GLOBL_FN(GL_PREFIX(PushAttrib,PushAttrib@4)) +GL_PREFIX(PushAttrib,PushAttrib@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1d)) -GL_PREFIX(Map1d): +GLOBL_FN(GL_PREFIX(Map1d,Map1d@32)) +GL_PREFIX(Map1d,Map1d@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1f)) -GL_PREFIX(Map1f): +GLOBL_FN(GL_PREFIX(Map1f,Map1f@24)) +GL_PREFIX(Map1f,Map1f@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2d)) -GL_PREFIX(Map2d): +GLOBL_FN(GL_PREFIX(Map2d,Map2d@56)) +GL_PREFIX(Map2d,Map2d@56): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2f)) -GL_PREFIX(Map2f): +GLOBL_FN(GL_PREFIX(Map2f,Map2f@40)) +GL_PREFIX(Map2f,Map2f@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1d)) -GL_PREFIX(MapGrid1d): +GLOBL_FN(GL_PREFIX(MapGrid1d,MapGrid1d@20)) +GL_PREFIX(MapGrid1d,MapGrid1d@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1f)) -GL_PREFIX(MapGrid1f): +GLOBL_FN(GL_PREFIX(MapGrid1f,MapGrid1f@12)) +GL_PREFIX(MapGrid1f,MapGrid1f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2d)) -GL_PREFIX(MapGrid2d): +GLOBL_FN(GL_PREFIX(MapGrid2d,MapGrid2d@40)) +GL_PREFIX(MapGrid2d,MapGrid2d@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2f)) -GL_PREFIX(MapGrid2f): +GLOBL_FN(GL_PREFIX(MapGrid2f,MapGrid2f@24)) +GL_PREFIX(MapGrid2f,MapGrid2f@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1d)) -GL_PREFIX(EvalCoord1d): +GLOBL_FN(GL_PREFIX(EvalCoord1d,EvalCoord1d@8)) +GL_PREFIX(EvalCoord1d,EvalCoord1d@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1dv)) -GL_PREFIX(EvalCoord1dv): +GLOBL_FN(GL_PREFIX(EvalCoord1dv,EvalCoord1dv@4)) +GL_PREFIX(EvalCoord1dv,EvalCoord1dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1f)) -GL_PREFIX(EvalCoord1f): +GLOBL_FN(GL_PREFIX(EvalCoord1f,EvalCoord1f@4)) +GL_PREFIX(EvalCoord1f,EvalCoord1f@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1fv)) -GL_PREFIX(EvalCoord1fv): +GLOBL_FN(GL_PREFIX(EvalCoord1fv,EvalCoord1fv@4)) +GL_PREFIX(EvalCoord1fv,EvalCoord1fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2d)) -GL_PREFIX(EvalCoord2d): +GLOBL_FN(GL_PREFIX(EvalCoord2d,EvalCoord2d@16)) +GL_PREFIX(EvalCoord2d,EvalCoord2d@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2dv)) -GL_PREFIX(EvalCoord2dv): +GLOBL_FN(GL_PREFIX(EvalCoord2dv,EvalCoord2dv@4)) +GL_PREFIX(EvalCoord2dv,EvalCoord2dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2f)) -GL_PREFIX(EvalCoord2f): +GLOBL_FN(GL_PREFIX(EvalCoord2f,EvalCoord2f@8)) +GL_PREFIX(EvalCoord2f,EvalCoord2f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2fv)) -GL_PREFIX(EvalCoord2fv): +GLOBL_FN(GL_PREFIX(EvalCoord2fv,EvalCoord2fv@4)) +GL_PREFIX(EvalCoord2fv,EvalCoord2fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh1)) -GL_PREFIX(EvalMesh1): +GLOBL_FN(GL_PREFIX(EvalMesh1,EvalMesh1@12)) +GL_PREFIX(EvalMesh1,EvalMesh1@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalMesh1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint1)) -GL_PREFIX(EvalPoint1): +GLOBL_FN(GL_PREFIX(EvalPoint1,EvalPoint1@4)) +GL_PREFIX(EvalPoint1,EvalPoint1@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalPoint1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh2)) -GL_PREFIX(EvalMesh2): +GLOBL_FN(GL_PREFIX(EvalMesh2,EvalMesh2@20)) +GL_PREFIX(EvalMesh2,EvalMesh2@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalMesh2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint2)) -GL_PREFIX(EvalPoint2): +GLOBL_FN(GL_PREFIX(EvalPoint2,EvalPoint2@8)) +GL_PREFIX(EvalPoint2,EvalPoint2@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalPoint2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AlphaFunc)) -GL_PREFIX(AlphaFunc): +GLOBL_FN(GL_PREFIX(AlphaFunc,AlphaFunc@8)) +GL_PREFIX(AlphaFunc,AlphaFunc@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AlphaFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFunc)) -GL_PREFIX(BlendFunc): +GLOBL_FN(GL_PREFIX(BlendFunc,BlendFunc@8)) +GL_PREFIX(BlendFunc,BlendFunc@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LogicOp)) -GL_PREFIX(LogicOp): +GLOBL_FN(GL_PREFIX(LogicOp,LogicOp@4)) +GL_PREFIX(LogicOp,LogicOp@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LogicOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilFunc)) -GL_PREFIX(StencilFunc): +GLOBL_FN(GL_PREFIX(StencilFunc,StencilFunc@12)) +GL_PREFIX(StencilFunc,StencilFunc@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilOp)) -GL_PREFIX(StencilOp): +GLOBL_FN(GL_PREFIX(StencilOp,StencilOp@12)) +GL_PREFIX(StencilOp,StencilOp@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthFunc)) -GL_PREFIX(DepthFunc): +GLOBL_FN(GL_PREFIX(DepthFunc,DepthFunc@4)) +GL_PREFIX(DepthFunc,DepthFunc@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelZoom)) -GL_PREFIX(PixelZoom): +GLOBL_FN(GL_PREFIX(PixelZoom,PixelZoom@8)) +GL_PREFIX(PixelZoom,PixelZoom@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelZoom)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferf)) -GL_PREFIX(PixelTransferf): +GLOBL_FN(GL_PREFIX(PixelTransferf,PixelTransferf@8)) +GL_PREFIX(PixelTransferf,PixelTransferf@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTransferf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferi)) -GL_PREFIX(PixelTransferi): +GLOBL_FN(GL_PREFIX(PixelTransferi,PixelTransferi@8)) +GL_PREFIX(PixelTransferi,PixelTransferi@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTransferi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStoref)) -GL_PREFIX(PixelStoref): +GLOBL_FN(GL_PREFIX(PixelStoref,PixelStoref@8)) +GL_PREFIX(PixelStoref,PixelStoref@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelStoref)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStorei)) -GL_PREFIX(PixelStorei): +GLOBL_FN(GL_PREFIX(PixelStorei,PixelStorei@8)) +GL_PREFIX(PixelStorei,PixelStorei@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelStorei)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapfv)) -GL_PREFIX(PixelMapfv): +GLOBL_FN(GL_PREFIX(PixelMapfv,PixelMapfv@12)) +GL_PREFIX(PixelMapfv,PixelMapfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapuiv)) -GL_PREFIX(PixelMapuiv): +GLOBL_FN(GL_PREFIX(PixelMapuiv,PixelMapuiv@12)) +GL_PREFIX(PixelMapuiv,PixelMapuiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapusv)) -GL_PREFIX(PixelMapusv): +GLOBL_FN(GL_PREFIX(PixelMapusv,PixelMapusv@12)) +GL_PREFIX(PixelMapusv,PixelMapusv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadBuffer)) -GL_PREFIX(ReadBuffer): +GLOBL_FN(GL_PREFIX(ReadBuffer,ReadBuffer@4)) +GL_PREFIX(ReadBuffer,ReadBuffer@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyPixels)) -GL_PREFIX(CopyPixels): +GLOBL_FN(GL_PREFIX(CopyPixels,CopyPixels@20)) +GL_PREFIX(CopyPixels,CopyPixels@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadPixels)) -GL_PREFIX(ReadPixels): +GLOBL_FN(GL_PREFIX(ReadPixels,ReadPixels@28)) +GL_PREFIX(ReadPixels,ReadPixels@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawPixels)) -GL_PREFIX(DrawPixels): +GLOBL_FN(GL_PREFIX(DrawPixels,DrawPixels@20)) +GL_PREFIX(DrawPixels,DrawPixels@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBooleanv)) -GL_PREFIX(GetBooleanv): +GLOBL_FN(GL_PREFIX(GetBooleanv,GetBooleanv@8)) +GL_PREFIX(GetBooleanv,GetBooleanv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetBooleanv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetClipPlane)) -GL_PREFIX(GetClipPlane): +GLOBL_FN(GL_PREFIX(GetClipPlane,GetClipPlane@8)) +GL_PREFIX(GetClipPlane,GetClipPlane@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDoublev)) -GL_PREFIX(GetDoublev): +GLOBL_FN(GL_PREFIX(GetDoublev,GetDoublev@8)) +GL_PREFIX(GetDoublev,GetDoublev@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetDoublev)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetError)) -GL_PREFIX(GetError): +GLOBL_FN(GL_PREFIX(GetError,GetError@0)) +GL_PREFIX(GetError,GetError@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetError)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFloatv)) -GL_PREFIX(GetFloatv): +GLOBL_FN(GL_PREFIX(GetFloatv,GetFloatv@8)) +GL_PREFIX(GetFloatv,GetFloatv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFloatv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetIntegerv)) -GL_PREFIX(GetIntegerv): +GLOBL_FN(GL_PREFIX(GetIntegerv,GetIntegerv@8)) +GL_PREFIX(GetIntegerv,GetIntegerv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetIntegerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightfv)) -GL_PREFIX(GetLightfv): +GLOBL_FN(GL_PREFIX(GetLightfv,GetLightfv@12)) +GL_PREFIX(GetLightfv,GetLightfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetLightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightiv)) -GL_PREFIX(GetLightiv): +GLOBL_FN(GL_PREFIX(GetLightiv,GetLightiv@12)) +GL_PREFIX(GetLightiv,GetLightiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetLightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapdv)) -GL_PREFIX(GetMapdv): +GLOBL_FN(GL_PREFIX(GetMapdv,GetMapdv@12)) +GL_PREFIX(GetMapdv,GetMapdv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapfv)) -GL_PREFIX(GetMapfv): +GLOBL_FN(GL_PREFIX(GetMapfv,GetMapfv@12)) +GL_PREFIX(GetMapfv,GetMapfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapiv)) -GL_PREFIX(GetMapiv): +GLOBL_FN(GL_PREFIX(GetMapiv,GetMapiv@12)) +GL_PREFIX(GetMapiv,GetMapiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialfv)) -GL_PREFIX(GetMaterialfv): +GLOBL_FN(GL_PREFIX(GetMaterialfv,GetMaterialfv@12)) +GL_PREFIX(GetMaterialfv,GetMaterialfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMaterialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialiv)) -GL_PREFIX(GetMaterialiv): +GLOBL_FN(GL_PREFIX(GetMaterialiv,GetMaterialiv@12)) +GL_PREFIX(GetMaterialiv,GetMaterialiv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMaterialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapfv)) -GL_PREFIX(GetPixelMapfv): +GLOBL_FN(GL_PREFIX(GetPixelMapfv,GetPixelMapfv@8)) +GL_PREFIX(GetPixelMapfv,GetPixelMapfv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) -GL_PREFIX(GetPixelMapuiv): +GLOBL_FN(GL_PREFIX(GetPixelMapuiv,GetPixelMapuiv@8)) +GL_PREFIX(GetPixelMapuiv,GetPixelMapuiv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapusv)) -GL_PREFIX(GetPixelMapusv): +GLOBL_FN(GL_PREFIX(GetPixelMapusv,GetPixelMapusv@8)) +GL_PREFIX(GetPixelMapusv,GetPixelMapusv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPolygonStipple)) -GL_PREFIX(GetPolygonStipple): +GLOBL_FN(GL_PREFIX(GetPolygonStipple,GetPolygonStipple@4)) +GL_PREFIX(GetPolygonStipple,GetPolygonStipple@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetString)) -GL_PREFIX(GetString): +GLOBL_FN(GL_PREFIX(GetString,GetString@4)) +GL_PREFIX(GetString,GetString@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetString)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnvfv)) -GL_PREFIX(GetTexEnvfv): +GLOBL_FN(GL_PREFIX(GetTexEnvfv,GetTexEnvfv@12)) +GL_PREFIX(GetTexEnvfv,GetTexEnvfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnviv)) -GL_PREFIX(GetTexEnviv): +GLOBL_FN(GL_PREFIX(GetTexEnviv,GetTexEnviv@12)) +GL_PREFIX(GetTexEnviv,GetTexEnviv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGendv)) -GL_PREFIX(GetTexGendv): +GLOBL_FN(GL_PREFIX(GetTexGendv,GetTexGendv@12)) +GL_PREFIX(GetTexGendv,GetTexGendv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGenfv)) -GL_PREFIX(GetTexGenfv): +GLOBL_FN(GL_PREFIX(GetTexGenfv,GetTexGenfv@12)) +GL_PREFIX(GetTexGenfv,GetTexGenfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGeniv)) -GL_PREFIX(GetTexGeniv): +GLOBL_FN(GL_PREFIX(GetTexGeniv,GetTexGeniv@12)) +GL_PREFIX(GetTexGeniv,GetTexGeniv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexImage)) -GL_PREFIX(GetTexImage): +GLOBL_FN(GL_PREFIX(GetTexImage,GetTexImage@20)) +GL_PREFIX(GetTexImage,GetTexImage@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexImage)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameterfv)) -GL_PREFIX(GetTexParameterfv): +GLOBL_FN(GL_PREFIX(GetTexParameterfv,GetTexParameterfv@12)) +GL_PREFIX(GetTexParameterfv,GetTexParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameteriv)) -GL_PREFIX(GetTexParameteriv): +GLOBL_FN(GL_PREFIX(GetTexParameteriv,GetTexParameteriv@12)) +GL_PREFIX(GetTexParameteriv,GetTexParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) -GL_PREFIX(GetTexLevelParameterfv): +GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv,GetTexLevelParameterfv@16)) +GL_PREFIX(GetTexLevelParameterfv,GetTexLevelParameterfv@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) -GL_PREFIX(GetTexLevelParameteriv): +GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv,GetTexLevelParameteriv@16)) +GL_PREFIX(GetTexLevelParameteriv,GetTexLevelParameteriv@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsEnabled)) -GL_PREFIX(IsEnabled): +GLOBL_FN(GL_PREFIX(IsEnabled,IsEnabled@4)) +GL_PREFIX(IsEnabled,IsEnabled@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsEnabled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsList)) -GL_PREFIX(IsList): +GLOBL_FN(GL_PREFIX(IsList,IsList@4)) +GL_PREFIX(IsList,IsList@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthRange)) -GL_PREFIX(DepthRange): +GLOBL_FN(GL_PREFIX(DepthRange,DepthRange@16)) +GL_PREFIX(DepthRange,DepthRange@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthRange)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Frustum)) -GL_PREFIX(Frustum): +GLOBL_FN(GL_PREFIX(Frustum,Frustum@48)) +GL_PREFIX(Frustum,Frustum@48): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Frustum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadIdentity)) -GL_PREFIX(LoadIdentity): +GLOBL_FN(GL_PREFIX(LoadIdentity,LoadIdentity@0)) +GL_PREFIX(LoadIdentity,LoadIdentity@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadIdentity)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixf)) -GL_PREFIX(LoadMatrixf): +GLOBL_FN(GL_PREFIX(LoadMatrixf,LoadMatrixf@4)) +GL_PREFIX(LoadMatrixf,LoadMatrixf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixd)) -GL_PREFIX(LoadMatrixd): +GLOBL_FN(GL_PREFIX(LoadMatrixd,LoadMatrixd@4)) +GL_PREFIX(LoadMatrixd,LoadMatrixd@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MatrixMode)) -GL_PREFIX(MatrixMode): +GLOBL_FN(GL_PREFIX(MatrixMode,MatrixMode@4)) +GL_PREFIX(MatrixMode,MatrixMode@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MatrixMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixf)) -GL_PREFIX(MultMatrixf): +GLOBL_FN(GL_PREFIX(MultMatrixf,MultMatrixf@4)) +GL_PREFIX(MultMatrixf,MultMatrixf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixd)) -GL_PREFIX(MultMatrixd): +GLOBL_FN(GL_PREFIX(MultMatrixd,MultMatrixd@4)) +GL_PREFIX(MultMatrixd,MultMatrixd@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Ortho)) -GL_PREFIX(Ortho): +GLOBL_FN(GL_PREFIX(Ortho,Ortho@48)) +GL_PREFIX(Ortho,Ortho@48): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Ortho)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopMatrix)) -GL_PREFIX(PopMatrix): +GLOBL_FN(GL_PREFIX(PopMatrix,PopMatrix@0)) +GL_PREFIX(PopMatrix,PopMatrix@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushMatrix)) -GL_PREFIX(PushMatrix): +GLOBL_FN(GL_PREFIX(PushMatrix,PushMatrix@0)) +GL_PREFIX(PushMatrix,PushMatrix@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotated)) -GL_PREFIX(Rotated): +GLOBL_FN(GL_PREFIX(Rotated,Rotated@32)) +GL_PREFIX(Rotated,Rotated@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rotated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotatef)) -GL_PREFIX(Rotatef): +GLOBL_FN(GL_PREFIX(Rotatef,Rotatef@16)) +GL_PREFIX(Rotatef,Rotatef@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rotatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scaled)) -GL_PREFIX(Scaled): +GLOBL_FN(GL_PREFIX(Scaled,Scaled@24)) +GL_PREFIX(Scaled,Scaled@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scaled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scalef)) -GL_PREFIX(Scalef): +GLOBL_FN(GL_PREFIX(Scalef,Scalef@12)) +GL_PREFIX(Scalef,Scalef@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scalef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translated)) -GL_PREFIX(Translated): +GLOBL_FN(GL_PREFIX(Translated,Translated@24)) +GL_PREFIX(Translated,Translated@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Translated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translatef)) -GL_PREFIX(Translatef): +GLOBL_FN(GL_PREFIX(Translatef,Translatef@12)) +GL_PREFIX(Translatef,Translatef@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Translatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Viewport)) -GL_PREFIX(Viewport): +GLOBL_FN(GL_PREFIX(Viewport,Viewport@16)) +GL_PREFIX(Viewport,Viewport@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Viewport)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElement)) -GL_PREFIX(ArrayElement): +GLOBL_FN(GL_PREFIX(ArrayElement,ArrayElement@4)) +GL_PREFIX(ArrayElement,ArrayElement@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointer)) -GL_PREFIX(ColorPointer): +GLOBL_FN(GL_PREFIX(ColorPointer,ColorPointer@16)) +GL_PREFIX(ColorPointer,ColorPointer@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DisableClientState)) -GL_PREFIX(DisableClientState): +GLOBL_FN(GL_PREFIX(DisableClientState,DisableClientState@4)) +GL_PREFIX(DisableClientState,DisableClientState@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DisableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArrays)) -GL_PREFIX(DrawArrays): +GLOBL_FN(GL_PREFIX(DrawArrays,DrawArrays@12)) +GL_PREFIX(DrawArrays,DrawArrays@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawElements)) -GL_PREFIX(DrawElements): +GLOBL_FN(GL_PREFIX(DrawElements,DrawElements@16)) +GL_PREFIX(DrawElements,DrawElements@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) -GL_PREFIX(EdgeFlagPointer): +GLOBL_FN(GL_PREFIX(EdgeFlagPointer,EdgeFlagPointer@8)) +GL_PREFIX(EdgeFlagPointer,EdgeFlagPointer@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EnableClientState)) -GL_PREFIX(EnableClientState): +GLOBL_FN(GL_PREFIX(EnableClientState,EnableClientState@4)) +GL_PREFIX(EnableClientState,EnableClientState@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EnableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointerv)) -GL_PREFIX(GetPointerv): +GLOBL_FN(GL_PREFIX(GetPointerv,GetPointerv@8)) +GL_PREFIX(GetPointerv,GetPointerv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointer)) -GL_PREFIX(IndexPointer): +GLOBL_FN(GL_PREFIX(IndexPointer,IndexPointer@12)) +GL_PREFIX(IndexPointer,IndexPointer@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InterleavedArrays)) -GL_PREFIX(InterleavedArrays): +GLOBL_FN(GL_PREFIX(InterleavedArrays,InterleavedArrays@12)) +GL_PREFIX(InterleavedArrays,InterleavedArrays@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InterleavedArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointer)) -GL_PREFIX(NormalPointer): +GLOBL_FN(GL_PREFIX(NormalPointer,NormalPointer@12)) +GL_PREFIX(NormalPointer,NormalPointer@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NormalPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointer)) -GL_PREFIX(TexCoordPointer): +GLOBL_FN(GL_PREFIX(TexCoordPointer,TexCoordPointer@16)) +GL_PREFIX(TexCoordPointer,TexCoordPointer@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoordPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointer)) -GL_PREFIX(VertexPointer): +GLOBL_FN(GL_PREFIX(VertexPointer,VertexPointer@16)) +GL_PREFIX(VertexPointer,VertexPointer@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonOffset)) -GL_PREFIX(PolygonOffset): +GLOBL_FN(GL_PREFIX(PolygonOffset,PolygonOffset@8)) +GL_PREFIX(PolygonOffset,PolygonOffset@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonOffset)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexImage1D)) -GL_PREFIX(CopyTexImage1D): +GLOBL_FN(GL_PREFIX(CopyTexImage1D,CopyTexImage1D@28)) +GL_PREFIX(CopyTexImage1D,CopyTexImage1D@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexImage2D)) -GL_PREFIX(CopyTexImage2D): +GLOBL_FN(GL_PREFIX(CopyTexImage2D,CopyTexImage2D@32)) +GL_PREFIX(CopyTexImage2D,CopyTexImage2D@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage1D)) -GL_PREFIX(CopyTexSubImage1D): +GLOBL_FN(GL_PREFIX(CopyTexSubImage1D,CopyTexSubImage1D@24)) +GL_PREFIX(CopyTexSubImage1D,CopyTexSubImage1D@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage2D)) -GL_PREFIX(CopyTexSubImage2D): +GLOBL_FN(GL_PREFIX(CopyTexSubImage2D,CopyTexSubImage2D@32)) +GL_PREFIX(CopyTexSubImage2D,CopyTexSubImage2D@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage1D)) -GL_PREFIX(TexSubImage1D): +GLOBL_FN(GL_PREFIX(TexSubImage1D,TexSubImage1D@28)) +GL_PREFIX(TexSubImage1D,TexSubImage1D@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage2D)) -GL_PREFIX(TexSubImage2D): +GLOBL_FN(GL_PREFIX(TexSubImage2D,TexSubImage2D@36)) +GL_PREFIX(TexSubImage2D,TexSubImage2D@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResident)) -GL_PREFIX(AreTexturesResident): +GLOBL_FN(GL_PREFIX(AreTexturesResident,AreTexturesResident@12)) +GL_PREFIX(AreTexturesResident,AreTexturesResident@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AreTexturesResident)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTexture)) -GL_PREFIX(BindTexture): +GLOBL_FN(GL_PREFIX(BindTexture,BindTexture@8)) +GL_PREFIX(BindTexture,BindTexture@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTextures)) -GL_PREFIX(DeleteTextures): +GLOBL_FN(GL_PREFIX(DeleteTextures,DeleteTextures@8)) +GL_PREFIX(DeleteTextures,DeleteTextures@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenTextures)) -GL_PREFIX(GenTextures): +GLOBL_FN(GL_PREFIX(GenTextures,GenTextures@8)) +GL_PREFIX(GenTextures,GenTextures@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTexture)) -GL_PREFIX(IsTexture): +GLOBL_FN(GL_PREFIX(IsTexture,IsTexture@4)) +GL_PREFIX(IsTexture,IsTexture@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTextures)) -GL_PREFIX(PrioritizeTextures): +GLOBL_FN(GL_PREFIX(PrioritizeTextures,PrioritizeTextures@12)) +GL_PREFIX(PrioritizeTextures,PrioritizeTextures@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexub)) -GL_PREFIX(Indexub): +GLOBL_FN(GL_PREFIX(Indexub,Indexub@4)) +GL_PREFIX(Indexub,Indexub@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexub)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexubv)) -GL_PREFIX(Indexubv): +GLOBL_FN(GL_PREFIX(Indexubv,Indexubv@4)) +GL_PREFIX(Indexubv,Indexubv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexubv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopClientAttrib)) -GL_PREFIX(PopClientAttrib): +GLOBL_FN(GL_PREFIX(PopClientAttrib,PopClientAttrib@0)) +GL_PREFIX(PopClientAttrib,PopClientAttrib@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushClientAttrib)) -GL_PREFIX(PushClientAttrib): +GLOBL_FN(GL_PREFIX(PushClientAttrib,PushClientAttrib@4)) +GL_PREFIX(PushClientAttrib,PushClientAttrib@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendColor)) -GL_PREFIX(BlendColor): +GLOBL_FN(GL_PREFIX(BlendColor,BlendColor@16)) +GL_PREFIX(BlendColor,BlendColor@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquation)) -GL_PREFIX(BlendEquation): +GLOBL_FN(GL_PREFIX(BlendEquation,BlendEquation@4)) +GL_PREFIX(BlendEquation,BlendEquation@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawRangeElements)) -GL_PREFIX(DrawRangeElements): +GLOBL_FN(GL_PREFIX(DrawRangeElements,DrawRangeElements@24)) +GL_PREFIX(DrawRangeElements,DrawRangeElements@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTable)) -GL_PREFIX(ColorTable): +GLOBL_FN(GL_PREFIX(ColorTable,ColorTable@24)) +GL_PREFIX(ColorTable,ColorTable@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) -GL_PREFIX(ColorTableParameterfv): +GLOBL_FN(GL_PREFIX(ColorTableParameterfv,ColorTableParameterfv@12)) +GL_PREFIX(ColorTableParameterfv,ColorTableParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) -GL_PREFIX(ColorTableParameteriv): +GLOBL_FN(GL_PREFIX(ColorTableParameteriv,ColorTableParameteriv@12)) +GL_PREFIX(ColorTableParameteriv,ColorTableParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorTable)) -GL_PREFIX(CopyColorTable): +GLOBL_FN(GL_PREFIX(CopyColorTable,CopyColorTable@20)) +GL_PREFIX(CopyColorTable,CopyColorTable@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTable)) -GL_PREFIX(GetColorTable): +GLOBL_FN(GL_PREFIX(GetColorTable,GetColorTable@16)) +GL_PREFIX(GetColorTable,GetColorTable@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) -GL_PREFIX(GetColorTableParameterfv): +GLOBL_FN(GL_PREFIX(GetColorTableParameterfv,GetColorTableParameterfv@12)) +GL_PREFIX(GetColorTableParameterfv,GetColorTableParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) -GL_PREFIX(GetColorTableParameteriv): +GLOBL_FN(GL_PREFIX(GetColorTableParameteriv,GetColorTableParameteriv@12)) +GL_PREFIX(GetColorTableParameteriv,GetColorTableParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorSubTable)) -GL_PREFIX(ColorSubTable): +GLOBL_FN(GL_PREFIX(ColorSubTable,ColorSubTable@24)) +GL_PREFIX(ColorSubTable,ColorSubTable@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorSubTable)) -GL_PREFIX(CopyColorSubTable): +GLOBL_FN(GL_PREFIX(CopyColorSubTable,CopyColorSubTable@20)) +GL_PREFIX(CopyColorSubTable,CopyColorSubTable@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) -GL_PREFIX(ConvolutionFilter1D): +GLOBL_FN(GL_PREFIX(ConvolutionFilter1D,ConvolutionFilter1D@24)) +GL_PREFIX(ConvolutionFilter1D,ConvolutionFilter1D@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionFilter2D)) -GL_PREFIX(ConvolutionFilter2D): +GLOBL_FN(GL_PREFIX(ConvolutionFilter2D,ConvolutionFilter2D@28)) +GL_PREFIX(ConvolutionFilter2D,ConvolutionFilter2D@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameterf)) -GL_PREFIX(ConvolutionParameterf): +GLOBL_FN(GL_PREFIX(ConvolutionParameterf,ConvolutionParameterf@12)) +GL_PREFIX(ConvolutionParameterf,ConvolutionParameterf@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameterfv)) -GL_PREFIX(ConvolutionParameterfv): +GLOBL_FN(GL_PREFIX(ConvolutionParameterfv,ConvolutionParameterfv@12)) +GL_PREFIX(ConvolutionParameterfv,ConvolutionParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameteri)) -GL_PREFIX(ConvolutionParameteri): +GLOBL_FN(GL_PREFIX(ConvolutionParameteri,ConvolutionParameteri@12)) +GL_PREFIX(ConvolutionParameteri,ConvolutionParameteri@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameteriv)) -GL_PREFIX(ConvolutionParameteriv): +GLOBL_FN(GL_PREFIX(ConvolutionParameteriv,ConvolutionParameteriv@12)) +GL_PREFIX(ConvolutionParameteriv,ConvolutionParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) -GL_PREFIX(CopyConvolutionFilter1D): +GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D,CopyConvolutionFilter1D@20)) +GL_PREFIX(CopyConvolutionFilter1D,CopyConvolutionFilter1D@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2D)) -GL_PREFIX(CopyConvolutionFilter2D): +GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2D,CopyConvolutionFilter2D@24)) +GL_PREFIX(CopyConvolutionFilter2D,CopyConvolutionFilter2D@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) -GL_PREFIX(GetConvolutionFilter): +GLOBL_FN(GL_PREFIX(GetConvolutionFilter,GetConvolutionFilter@16)) +GL_PREFIX(GetConvolutionFilter,GetConvolutionFilter@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionFilter)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionParameterfv)) -GL_PREFIX(GetConvolutionParameterfv): +GLOBL_FN(GL_PREFIX(GetConvolutionParameterfv,GetConvolutionParameterfv@12)) +GL_PREFIX(GetConvolutionParameterfv,GetConvolutionParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionParameteriv)) -GL_PREFIX(GetConvolutionParameteriv): +GLOBL_FN(GL_PREFIX(GetConvolutionParameteriv,GetConvolutionParameteriv@12)) +GL_PREFIX(GetConvolutionParameteriv,GetConvolutionParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSeparableFilter)) -GL_PREFIX(GetSeparableFilter): +GLOBL_FN(GL_PREFIX(GetSeparableFilter,GetSeparableFilter@24)) +GL_PREFIX(GetSeparableFilter,GetSeparableFilter@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SeparableFilter2D)) -GL_PREFIX(SeparableFilter2D): +GLOBL_FN(GL_PREFIX(SeparableFilter2D,SeparableFilter2D@32)) +GL_PREFIX(SeparableFilter2D,SeparableFilter2D@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogram)) -GL_PREFIX(GetHistogram): +GLOBL_FN(GL_PREFIX(GetHistogram,GetHistogram@20)) +GL_PREFIX(GetHistogram,GetHistogram@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogram)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogramParameterfv)) -GL_PREFIX(GetHistogramParameterfv): +GLOBL_FN(GL_PREFIX(GetHistogramParameterfv,GetHistogramParameterfv@12)) +GL_PREFIX(GetHistogramParameterfv,GetHistogramParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogramParameteriv)) -GL_PREFIX(GetHistogramParameteriv): +GLOBL_FN(GL_PREFIX(GetHistogramParameteriv,GetHistogramParameteriv@12)) +GL_PREFIX(GetHistogramParameteriv,GetHistogramParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmax)) -GL_PREFIX(GetMinmax): +GLOBL_FN(GL_PREFIX(GetMinmax,GetMinmax@20)) +GL_PREFIX(GetMinmax,GetMinmax@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmaxParameterfv)) -GL_PREFIX(GetMinmaxParameterfv): +GLOBL_FN(GL_PREFIX(GetMinmaxParameterfv,GetMinmaxParameterfv@12)) +GL_PREFIX(GetMinmaxParameterfv,GetMinmaxParameterfv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmaxParameteriv)) -GL_PREFIX(GetMinmaxParameteriv): +GLOBL_FN(GL_PREFIX(GetMinmaxParameteriv,GetMinmaxParameteriv@12)) +GL_PREFIX(GetMinmaxParameteriv,GetMinmaxParameteriv@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Histogram)) -GL_PREFIX(Histogram): +GLOBL_FN(GL_PREFIX(Histogram,Histogram@16)) +GL_PREFIX(Histogram,Histogram@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Minmax)) -GL_PREFIX(Minmax): +GLOBL_FN(GL_PREFIX(Minmax,Minmax@12)) +GL_PREFIX(Minmax,Minmax@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetHistogram)) -GL_PREFIX(ResetHistogram): +GLOBL_FN(GL_PREFIX(ResetHistogram,ResetHistogram@4)) +GL_PREFIX(ResetHistogram,ResetHistogram@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetMinmax)) -GL_PREFIX(ResetMinmax): +GLOBL_FN(GL_PREFIX(ResetMinmax,ResetMinmax@4)) +GL_PREFIX(ResetMinmax,ResetMinmax@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage3D)) -GL_PREFIX(TexImage3D): +GLOBL_FN(GL_PREFIX(TexImage3D,TexImage3D@40)) +GL_PREFIX(TexImage3D,TexImage3D@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage3D)) -GL_PREFIX(TexSubImage3D): +GLOBL_FN(GL_PREFIX(TexSubImage3D,TexSubImage3D@44)) +GL_PREFIX(TexSubImage3D,TexSubImage3D@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) -GL_PREFIX(CopyTexSubImage3D): +GLOBL_FN(GL_PREFIX(CopyTexSubImage3D,CopyTexSubImage3D@36)) +GL_PREFIX(CopyTexSubImage3D,CopyTexSubImage3D@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ActiveTextureARB)) -GL_PREFIX(ActiveTextureARB): +GLOBL_FN(GL_PREFIX(ActiveTextureARB,ActiveTextureARB@4)) +GL_PREFIX(ActiveTextureARB,ActiveTextureARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClientActiveTextureARB)) -GL_PREFIX(ClientActiveTextureARB): +GLOBL_FN(GL_PREFIX(ClientActiveTextureARB,ClientActiveTextureARB@4)) +GL_PREFIX(ClientActiveTextureARB,ClientActiveTextureARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1dARB)) -GL_PREFIX(MultiTexCoord1dARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1dARB,MultiTexCoord1dARB@12)) +GL_PREFIX(MultiTexCoord1dARB,MultiTexCoord1dARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1dvARB)) -GL_PREFIX(MultiTexCoord1dvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1dvARB,MultiTexCoord1dvARB@8)) +GL_PREFIX(MultiTexCoord1dvARB,MultiTexCoord1dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1fARB)) -GL_PREFIX(MultiTexCoord1fARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1fARB,MultiTexCoord1fARB@8)) +GL_PREFIX(MultiTexCoord1fARB,MultiTexCoord1fARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1fvARB)) -GL_PREFIX(MultiTexCoord1fvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1fvARB,MultiTexCoord1fvARB@8)) +GL_PREFIX(MultiTexCoord1fvARB,MultiTexCoord1fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1iARB)) -GL_PREFIX(MultiTexCoord1iARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1iARB,MultiTexCoord1iARB@8)) +GL_PREFIX(MultiTexCoord1iARB,MultiTexCoord1iARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1ivARB)) -GL_PREFIX(MultiTexCoord1ivARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1ivARB,MultiTexCoord1ivARB@8)) +GL_PREFIX(MultiTexCoord1ivARB,MultiTexCoord1ivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1sARB)) -GL_PREFIX(MultiTexCoord1sARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1sARB,MultiTexCoord1sARB@8)) +GL_PREFIX(MultiTexCoord1sARB,MultiTexCoord1sARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1svARB)) -GL_PREFIX(MultiTexCoord1svARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord1svARB,MultiTexCoord1svARB@8)) +GL_PREFIX(MultiTexCoord1svARB,MultiTexCoord1svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2dARB)) -GL_PREFIX(MultiTexCoord2dARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2dARB,MultiTexCoord2dARB@20)) +GL_PREFIX(MultiTexCoord2dARB,MultiTexCoord2dARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2dvARB)) -GL_PREFIX(MultiTexCoord2dvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2dvARB,MultiTexCoord2dvARB@8)) +GL_PREFIX(MultiTexCoord2dvARB,MultiTexCoord2dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2fARB)) -GL_PREFIX(MultiTexCoord2fARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2fARB,MultiTexCoord2fARB@12)) +GL_PREFIX(MultiTexCoord2fARB,MultiTexCoord2fARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2fvARB)) -GL_PREFIX(MultiTexCoord2fvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2fvARB,MultiTexCoord2fvARB@8)) +GL_PREFIX(MultiTexCoord2fvARB,MultiTexCoord2fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2iARB)) -GL_PREFIX(MultiTexCoord2iARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2iARB,MultiTexCoord2iARB@12)) +GL_PREFIX(MultiTexCoord2iARB,MultiTexCoord2iARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2ivARB)) -GL_PREFIX(MultiTexCoord2ivARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2ivARB,MultiTexCoord2ivARB@8)) +GL_PREFIX(MultiTexCoord2ivARB,MultiTexCoord2ivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2sARB)) -GL_PREFIX(MultiTexCoord2sARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2sARB,MultiTexCoord2sARB@12)) +GL_PREFIX(MultiTexCoord2sARB,MultiTexCoord2sARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2svARB)) -GL_PREFIX(MultiTexCoord2svARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord2svARB,MultiTexCoord2svARB@8)) +GL_PREFIX(MultiTexCoord2svARB,MultiTexCoord2svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3dARB)) -GL_PREFIX(MultiTexCoord3dARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3dARB,MultiTexCoord3dARB@28)) +GL_PREFIX(MultiTexCoord3dARB,MultiTexCoord3dARB@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3dvARB)) -GL_PREFIX(MultiTexCoord3dvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3dvARB,MultiTexCoord3dvARB@8)) +GL_PREFIX(MultiTexCoord3dvARB,MultiTexCoord3dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3fARB)) -GL_PREFIX(MultiTexCoord3fARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3fARB,MultiTexCoord3fARB@16)) +GL_PREFIX(MultiTexCoord3fARB,MultiTexCoord3fARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3fvARB)) -GL_PREFIX(MultiTexCoord3fvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3fvARB,MultiTexCoord3fvARB@8)) +GL_PREFIX(MultiTexCoord3fvARB,MultiTexCoord3fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3iARB)) -GL_PREFIX(MultiTexCoord3iARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3iARB,MultiTexCoord3iARB@16)) +GL_PREFIX(MultiTexCoord3iARB,MultiTexCoord3iARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3ivARB)) -GL_PREFIX(MultiTexCoord3ivARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3ivARB,MultiTexCoord3ivARB@8)) +GL_PREFIX(MultiTexCoord3ivARB,MultiTexCoord3ivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3sARB)) -GL_PREFIX(MultiTexCoord3sARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3sARB,MultiTexCoord3sARB@16)) +GL_PREFIX(MultiTexCoord3sARB,MultiTexCoord3sARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3svARB)) -GL_PREFIX(MultiTexCoord3svARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord3svARB,MultiTexCoord3svARB@8)) +GL_PREFIX(MultiTexCoord3svARB,MultiTexCoord3svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4dARB)) -GL_PREFIX(MultiTexCoord4dARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4dARB,MultiTexCoord4dARB@36)) +GL_PREFIX(MultiTexCoord4dARB,MultiTexCoord4dARB@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4dvARB)) -GL_PREFIX(MultiTexCoord4dvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4dvARB,MultiTexCoord4dvARB@8)) +GL_PREFIX(MultiTexCoord4dvARB,MultiTexCoord4dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4fARB)) -GL_PREFIX(MultiTexCoord4fARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4fARB,MultiTexCoord4fARB@20)) +GL_PREFIX(MultiTexCoord4fARB,MultiTexCoord4fARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4fvARB)) -GL_PREFIX(MultiTexCoord4fvARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4fvARB,MultiTexCoord4fvARB@8)) +GL_PREFIX(MultiTexCoord4fvARB,MultiTexCoord4fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4iARB)) -GL_PREFIX(MultiTexCoord4iARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4iARB,MultiTexCoord4iARB@20)) +GL_PREFIX(MultiTexCoord4iARB,MultiTexCoord4iARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4ivARB)) -GL_PREFIX(MultiTexCoord4ivARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4ivARB,MultiTexCoord4ivARB@8)) +GL_PREFIX(MultiTexCoord4ivARB,MultiTexCoord4ivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4sARB)) -GL_PREFIX(MultiTexCoord4sARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4sARB,MultiTexCoord4sARB@20)) +GL_PREFIX(MultiTexCoord4sARB,MultiTexCoord4sARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4svARB)) -GL_PREFIX(MultiTexCoord4svARB): +GLOBL_FN(GL_PREFIX(MultiTexCoord4svARB,MultiTexCoord4svARB@8)) +GL_PREFIX(MultiTexCoord4svARB,MultiTexCoord4svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) -GL_PREFIX(LoadTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB,LoadTransposeMatrixfARB@4)) +GL_PREFIX(LoadTransposeMatrixfARB,LoadTransposeMatrixfARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) -GL_PREFIX(LoadTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB,LoadTransposeMatrixdARB@4)) +GL_PREFIX(LoadTransposeMatrixdARB,LoadTransposeMatrixdARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) -GL_PREFIX(MultTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB,MultTransposeMatrixfARB@4)) +GL_PREFIX(MultTransposeMatrixfARB,MultTransposeMatrixfARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) -GL_PREFIX(MultTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB,MultTransposeMatrixdARB@4)) +GL_PREFIX(MultTransposeMatrixdARB,MultTransposeMatrixdARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleCoverageARB)) -GL_PREFIX(SampleCoverageARB): +GLOBL_FN(GL_PREFIX(SampleCoverageARB,SampleCoverageARB@8)) +GL_PREFIX(SampleCoverageARB,SampleCoverageARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(__unused413)) -GL_PREFIX(__unused413): +GLOBL_FN(GL_PREFIX(__unused413,__unused413@0)) +GL_PREFIX(__unused413,__unused413@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset___unused413)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) -GL_PREFIX(CompressedTexImage3DARB): +GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB,CompressedTexImage3DARB@36)) +GL_PREFIX(CompressedTexImage3DARB,CompressedTexImage3DARB@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) -GL_PREFIX(CompressedTexImage2DARB): +GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB,CompressedTexImage2DARB@32)) +GL_PREFIX(CompressedTexImage2DARB,CompressedTexImage2DARB@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) -GL_PREFIX(CompressedTexImage1DARB): +GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB,CompressedTexImage1DARB@28)) +GL_PREFIX(CompressedTexImage1DARB,CompressedTexImage1DARB@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) -GL_PREFIX(CompressedTexSubImage3DARB): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB,CompressedTexSubImage3DARB@44)) +GL_PREFIX(CompressedTexSubImage3DARB,CompressedTexSubImage3DARB@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) -GL_PREFIX(CompressedTexSubImage2DARB): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB,CompressedTexSubImage2DARB@36)) +GL_PREFIX(CompressedTexSubImage2DARB,CompressedTexSubImage2DARB@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) -GL_PREFIX(CompressedTexSubImage1DARB): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB,CompressedTexSubImage1DARB@28)) +GL_PREFIX(CompressedTexSubImage1DARB,CompressedTexSubImage1DARB@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) -GL_PREFIX(GetCompressedTexImageARB): +GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB,GetCompressedTexImageARB@12)) +GL_PREFIX(GetCompressedTexImageARB,GetCompressedTexImageARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ActiveTexture)) -GL_PREFIX(ActiveTexture): +GLOBL_FN(GL_PREFIX(ActiveTexture,ActiveTexture@4)) +GL_PREFIX(ActiveTexture,ActiveTexture@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClientActiveTexture)) -GL_PREFIX(ClientActiveTexture): +GLOBL_FN(GL_PREFIX(ClientActiveTexture,ClientActiveTexture@4)) +GL_PREFIX(ClientActiveTexture,ClientActiveTexture@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1d)) -GL_PREFIX(MultiTexCoord1d): +GLOBL_FN(GL_PREFIX(MultiTexCoord1d,MultiTexCoord1d@12)) +GL_PREFIX(MultiTexCoord1d,MultiTexCoord1d@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1dv)) -GL_PREFIX(MultiTexCoord1dv): +GLOBL_FN(GL_PREFIX(MultiTexCoord1dv,MultiTexCoord1dv@8)) +GL_PREFIX(MultiTexCoord1dv,MultiTexCoord1dv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1f)) -GL_PREFIX(MultiTexCoord1f): +GLOBL_FN(GL_PREFIX(MultiTexCoord1f,MultiTexCoord1f@8)) +GL_PREFIX(MultiTexCoord1f,MultiTexCoord1f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1fv)) -GL_PREFIX(MultiTexCoord1fv): +GLOBL_FN(GL_PREFIX(MultiTexCoord1fv,MultiTexCoord1fv@8)) +GL_PREFIX(MultiTexCoord1fv,MultiTexCoord1fv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1i)) -GL_PREFIX(MultiTexCoord1i): +GLOBL_FN(GL_PREFIX(MultiTexCoord1i,MultiTexCoord1i@8)) +GL_PREFIX(MultiTexCoord1i,MultiTexCoord1i@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1iv)) -GL_PREFIX(MultiTexCoord1iv): +GLOBL_FN(GL_PREFIX(MultiTexCoord1iv,MultiTexCoord1iv@8)) +GL_PREFIX(MultiTexCoord1iv,MultiTexCoord1iv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1s)) -GL_PREFIX(MultiTexCoord1s): +GLOBL_FN(GL_PREFIX(MultiTexCoord1s,MultiTexCoord1s@8)) +GL_PREFIX(MultiTexCoord1s,MultiTexCoord1s@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1sv)) -GL_PREFIX(MultiTexCoord1sv): +GLOBL_FN(GL_PREFIX(MultiTexCoord1sv,MultiTexCoord1sv@8)) +GL_PREFIX(MultiTexCoord1sv,MultiTexCoord1sv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2d)) -GL_PREFIX(MultiTexCoord2d): +GLOBL_FN(GL_PREFIX(MultiTexCoord2d,MultiTexCoord2d@20)) +GL_PREFIX(MultiTexCoord2d,MultiTexCoord2d@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2dv)) -GL_PREFIX(MultiTexCoord2dv): +GLOBL_FN(GL_PREFIX(MultiTexCoord2dv,MultiTexCoord2dv@8)) +GL_PREFIX(MultiTexCoord2dv,MultiTexCoord2dv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2f)) -GL_PREFIX(MultiTexCoord2f): +GLOBL_FN(GL_PREFIX(MultiTexCoord2f,MultiTexCoord2f@12)) +GL_PREFIX(MultiTexCoord2f,MultiTexCoord2f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2fv)) -GL_PREFIX(MultiTexCoord2fv): +GLOBL_FN(GL_PREFIX(MultiTexCoord2fv,MultiTexCoord2fv@8)) +GL_PREFIX(MultiTexCoord2fv,MultiTexCoord2fv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2i)) -GL_PREFIX(MultiTexCoord2i): +GLOBL_FN(GL_PREFIX(MultiTexCoord2i,MultiTexCoord2i@12)) +GL_PREFIX(MultiTexCoord2i,MultiTexCoord2i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2iv)) -GL_PREFIX(MultiTexCoord2iv): +GLOBL_FN(GL_PREFIX(MultiTexCoord2iv,MultiTexCoord2iv@8)) +GL_PREFIX(MultiTexCoord2iv,MultiTexCoord2iv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2s)) -GL_PREFIX(MultiTexCoord2s): +GLOBL_FN(GL_PREFIX(MultiTexCoord2s,MultiTexCoord2s@12)) +GL_PREFIX(MultiTexCoord2s,MultiTexCoord2s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2sv)) -GL_PREFIX(MultiTexCoord2sv): +GLOBL_FN(GL_PREFIX(MultiTexCoord2sv,MultiTexCoord2sv@8)) +GL_PREFIX(MultiTexCoord2sv,MultiTexCoord2sv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3d)) -GL_PREFIX(MultiTexCoord3d): +GLOBL_FN(GL_PREFIX(MultiTexCoord3d,MultiTexCoord3d@28)) +GL_PREFIX(MultiTexCoord3d,MultiTexCoord3d@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3dv)) -GL_PREFIX(MultiTexCoord3dv): +GLOBL_FN(GL_PREFIX(MultiTexCoord3dv,MultiTexCoord3dv@8)) +GL_PREFIX(MultiTexCoord3dv,MultiTexCoord3dv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3f)) -GL_PREFIX(MultiTexCoord3f): +GLOBL_FN(GL_PREFIX(MultiTexCoord3f,MultiTexCoord3f@16)) +GL_PREFIX(MultiTexCoord3f,MultiTexCoord3f@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3fv)) -GL_PREFIX(MultiTexCoord3fv): +GLOBL_FN(GL_PREFIX(MultiTexCoord3fv,MultiTexCoord3fv@8)) +GL_PREFIX(MultiTexCoord3fv,MultiTexCoord3fv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3i)) -GL_PREFIX(MultiTexCoord3i): +GLOBL_FN(GL_PREFIX(MultiTexCoord3i,MultiTexCoord3i@16)) +GL_PREFIX(MultiTexCoord3i,MultiTexCoord3i@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3iv)) -GL_PREFIX(MultiTexCoord3iv): +GLOBL_FN(GL_PREFIX(MultiTexCoord3iv,MultiTexCoord3iv@8)) +GL_PREFIX(MultiTexCoord3iv,MultiTexCoord3iv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3s)) -GL_PREFIX(MultiTexCoord3s): +GLOBL_FN(GL_PREFIX(MultiTexCoord3s,MultiTexCoord3s@16)) +GL_PREFIX(MultiTexCoord3s,MultiTexCoord3s@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3sv)) -GL_PREFIX(MultiTexCoord3sv): +GLOBL_FN(GL_PREFIX(MultiTexCoord3sv,MultiTexCoord3sv@8)) +GL_PREFIX(MultiTexCoord3sv,MultiTexCoord3sv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4d)) -GL_PREFIX(MultiTexCoord4d): +GLOBL_FN(GL_PREFIX(MultiTexCoord4d,MultiTexCoord4d@36)) +GL_PREFIX(MultiTexCoord4d,MultiTexCoord4d@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4dv)) -GL_PREFIX(MultiTexCoord4dv): +GLOBL_FN(GL_PREFIX(MultiTexCoord4dv,MultiTexCoord4dv@8)) +GL_PREFIX(MultiTexCoord4dv,MultiTexCoord4dv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4f)) -GL_PREFIX(MultiTexCoord4f): +GLOBL_FN(GL_PREFIX(MultiTexCoord4f,MultiTexCoord4f@20)) +GL_PREFIX(MultiTexCoord4f,MultiTexCoord4f@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4fv)) -GL_PREFIX(MultiTexCoord4fv): +GLOBL_FN(GL_PREFIX(MultiTexCoord4fv,MultiTexCoord4fv@8)) +GL_PREFIX(MultiTexCoord4fv,MultiTexCoord4fv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4i)) -GL_PREFIX(MultiTexCoord4i): +GLOBL_FN(GL_PREFIX(MultiTexCoord4i,MultiTexCoord4i@20)) +GL_PREFIX(MultiTexCoord4i,MultiTexCoord4i@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4iv)) -GL_PREFIX(MultiTexCoord4iv): +GLOBL_FN(GL_PREFIX(MultiTexCoord4iv,MultiTexCoord4iv@8)) +GL_PREFIX(MultiTexCoord4iv,MultiTexCoord4iv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4s)) -GL_PREFIX(MultiTexCoord4s): +GLOBL_FN(GL_PREFIX(MultiTexCoord4s,MultiTexCoord4s@20)) +GL_PREFIX(MultiTexCoord4s,MultiTexCoord4s@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4sv)) -GL_PREFIX(MultiTexCoord4sv): +GLOBL_FN(GL_PREFIX(MultiTexCoord4sv,MultiTexCoord4sv@8)) +GL_PREFIX(MultiTexCoord4sv,MultiTexCoord4sv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixf)) -GL_PREFIX(LoadTransposeMatrixf): +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixf,LoadTransposeMatrixf@4)) +GL_PREFIX(LoadTransposeMatrixf,LoadTransposeMatrixf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixd)) -GL_PREFIX(LoadTransposeMatrixd): +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixd,LoadTransposeMatrixd@4)) +GL_PREFIX(LoadTransposeMatrixd,LoadTransposeMatrixd@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixf)) -GL_PREFIX(MultTransposeMatrixf): +GLOBL_FN(GL_PREFIX(MultTransposeMatrixf,MultTransposeMatrixf@4)) +GL_PREFIX(MultTransposeMatrixf,MultTransposeMatrixf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixd)) -GL_PREFIX(MultTransposeMatrixd): +GLOBL_FN(GL_PREFIX(MultTransposeMatrixd,MultTransposeMatrixd@4)) +GL_PREFIX(MultTransposeMatrixd,MultTransposeMatrixd@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleCoverage)) -GL_PREFIX(SampleCoverage): +GLOBL_FN(GL_PREFIX(SampleCoverage,SampleCoverage@8)) +GL_PREFIX(SampleCoverage,SampleCoverage@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage3D)) -GL_PREFIX(CompressedTexImage3D): +GLOBL_FN(GL_PREFIX(CompressedTexImage3D,CompressedTexImage3D@36)) +GL_PREFIX(CompressedTexImage3D,CompressedTexImage3D@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage2D)) -GL_PREFIX(CompressedTexImage2D): +GLOBL_FN(GL_PREFIX(CompressedTexImage2D,CompressedTexImage2D@32)) +GL_PREFIX(CompressedTexImage2D,CompressedTexImage2D@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage1D)) -GL_PREFIX(CompressedTexImage1D): +GLOBL_FN(GL_PREFIX(CompressedTexImage1D,CompressedTexImage1D@28)) +GL_PREFIX(CompressedTexImage1D,CompressedTexImage1D@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage3D)) -GL_PREFIX(CompressedTexSubImage3D): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage3D,CompressedTexSubImage3D@44)) +GL_PREFIX(CompressedTexSubImage3D,CompressedTexSubImage3D@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage2D)) -GL_PREFIX(CompressedTexSubImage2D): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage2D,CompressedTexSubImage2D@36)) +GL_PREFIX(CompressedTexSubImage2D,CompressedTexSubImage2D@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage1D)) -GL_PREFIX(CompressedTexSubImage1D): +GLOBL_FN(GL_PREFIX(CompressedTexSubImage1D,CompressedTexSubImage1D@28)) +GL_PREFIX(CompressedTexSubImage1D,CompressedTexSubImage1D@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCompressedTexImage)) -GL_PREFIX(GetCompressedTexImage): +GLOBL_FN(GL_PREFIX(GetCompressedTexImage,GetCompressedTexImage@12)) +GL_PREFIX(GetCompressedTexImage,GetCompressedTexImage@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendColorEXT)) -GL_PREFIX(BlendColorEXT): +GLOBL_FN(GL_PREFIX(BlendColorEXT,BlendColorEXT@16)) +GL_PREFIX(BlendColorEXT,BlendColorEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonOffsetEXT)) -GL_PREFIX(PolygonOffsetEXT): +GLOBL_FN(GL_PREFIX(PolygonOffsetEXT,PolygonOffsetEXT@8)) +GL_PREFIX(PolygonOffsetEXT,PolygonOffsetEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonOffsetEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage3DEXT)) -GL_PREFIX(TexImage3DEXT): +GLOBL_FN(GL_PREFIX(TexImage3DEXT,TexImage3DEXT@40)) +GL_PREFIX(TexImage3DEXT,TexImage3DEXT@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) -GL_PREFIX(TexSubImage3DEXT): +GLOBL_FN(GL_PREFIX(TexSubImage3DEXT,TexSubImage3DEXT@44)) +GL_PREFIX(TexSubImage3DEXT,TexSubImage3DEXT@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) -GL_PREFIX(GetTexFilterFuncSGIS): +GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS,GetTexFilterFuncSGIS@12)) +GL_PREFIX(GetTexFilterFuncSGIS,GetTexFilterFuncSGIS@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexFilterFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexFilterFuncSGIS)) -GL_PREFIX(TexFilterFuncSGIS): +GLOBL_FN(GL_PREFIX(TexFilterFuncSGIS,TexFilterFuncSGIS@16)) +GL_PREFIX(TexFilterFuncSGIS,TexFilterFuncSGIS@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) -GL_PREFIX(TexSubImage1DEXT): +GLOBL_FN(GL_PREFIX(TexSubImage1DEXT,TexSubImage1DEXT@28)) +GL_PREFIX(TexSubImage1DEXT,TexSubImage1DEXT@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) -GL_PREFIX(TexSubImage2DEXT): +GLOBL_FN(GL_PREFIX(TexSubImage2DEXT,TexSubImage2DEXT@36)) +GL_PREFIX(TexSubImage2DEXT,TexSubImage2DEXT@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) -GL_PREFIX(CopyTexImage1DEXT): +GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT,CopyTexImage1DEXT@28)) +GL_PREFIX(CopyTexImage1DEXT,CopyTexImage1DEXT@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) -GL_PREFIX(CopyTexImage2DEXT): +GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT,CopyTexImage2DEXT@32)) +GL_PREFIX(CopyTexImage2DEXT,CopyTexImage2DEXT@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) -GL_PREFIX(CopyTexSubImage1DEXT): +GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT,CopyTexSubImage1DEXT@24)) +GL_PREFIX(CopyTexSubImage1DEXT,CopyTexSubImage1DEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) -GL_PREFIX(CopyTexSubImage2DEXT): +GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT,CopyTexSubImage2DEXT@32)) +GL_PREFIX(CopyTexSubImage2DEXT,CopyTexSubImage2DEXT@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) -GL_PREFIX(CopyTexSubImage3DEXT): +GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT,CopyTexSubImage3DEXT@36)) +GL_PREFIX(CopyTexSubImage3DEXT,CopyTexSubImage3DEXT@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogramEXT)) -GL_PREFIX(GetHistogramEXT): +GLOBL_FN(GL_PREFIX(GetHistogramEXT,GetHistogramEXT@20)) +GL_PREFIX(GetHistogramEXT,GetHistogramEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogramParameterfvEXT)) -GL_PREFIX(GetHistogramParameterfvEXT): +GLOBL_FN(GL_PREFIX(GetHistogramParameterfvEXT,GetHistogramParameterfvEXT@12)) +GL_PREFIX(GetHistogramParameterfvEXT,GetHistogramParameterfvEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetHistogramParameterivEXT)) -GL_PREFIX(GetHistogramParameterivEXT): +GLOBL_FN(GL_PREFIX(GetHistogramParameterivEXT,GetHistogramParameterivEXT@12)) +GL_PREFIX(GetHistogramParameterivEXT,GetHistogramParameterivEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmaxEXT)) -GL_PREFIX(GetMinmaxEXT): +GLOBL_FN(GL_PREFIX(GetMinmaxEXT,GetMinmaxEXT@20)) +GL_PREFIX(GetMinmaxEXT,GetMinmaxEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmaxParameterfvEXT)) -GL_PREFIX(GetMinmaxParameterfvEXT): +GLOBL_FN(GL_PREFIX(GetMinmaxParameterfvEXT,GetMinmaxParameterfvEXT@12)) +GL_PREFIX(GetMinmaxParameterfvEXT,GetMinmaxParameterfvEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMinmaxParameterivEXT)) -GL_PREFIX(GetMinmaxParameterivEXT): +GLOBL_FN(GL_PREFIX(GetMinmaxParameterivEXT,GetMinmaxParameterivEXT@12)) +GL_PREFIX(GetMinmaxParameterivEXT,GetMinmaxParameterivEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(HistogramEXT)) -GL_PREFIX(HistogramEXT): +GLOBL_FN(GL_PREFIX(HistogramEXT,HistogramEXT@16)) +GL_PREFIX(HistogramEXT,HistogramEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MinmaxEXT)) -GL_PREFIX(MinmaxEXT): +GLOBL_FN(GL_PREFIX(MinmaxEXT,MinmaxEXT@12)) +GL_PREFIX(MinmaxEXT,MinmaxEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) -GL_PREFIX(ResetHistogramEXT): +GLOBL_FN(GL_PREFIX(ResetHistogramEXT,ResetHistogramEXT@4)) +GL_PREFIX(ResetHistogramEXT,ResetHistogramEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) -GL_PREFIX(ResetMinmaxEXT): +GLOBL_FN(GL_PREFIX(ResetMinmaxEXT,ResetMinmaxEXT@4)) +GL_PREFIX(ResetMinmaxEXT,ResetMinmaxEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) -GL_PREFIX(ConvolutionFilter1DEXT): +GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT,ConvolutionFilter1DEXT@24)) +GL_PREFIX(ConvolutionFilter1DEXT,ConvolutionFilter1DEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) -GL_PREFIX(ConvolutionFilter2DEXT): +GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT,ConvolutionFilter2DEXT@28)) +GL_PREFIX(ConvolutionFilter2DEXT,ConvolutionFilter2DEXT@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) -GL_PREFIX(ConvolutionParameterfEXT): +GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT,ConvolutionParameterfEXT@12)) +GL_PREFIX(ConvolutionParameterfEXT,ConvolutionParameterfEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) -GL_PREFIX(ConvolutionParameterfvEXT): +GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT,ConvolutionParameterfvEXT@12)) +GL_PREFIX(ConvolutionParameterfvEXT,ConvolutionParameterfvEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) -GL_PREFIX(ConvolutionParameteriEXT): +GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT,ConvolutionParameteriEXT@12)) +GL_PREFIX(ConvolutionParameteriEXT,ConvolutionParameteriEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) -GL_PREFIX(ConvolutionParameterivEXT): +GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT,ConvolutionParameterivEXT@12)) +GL_PREFIX(ConvolutionParameterivEXT,ConvolutionParameterivEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) -GL_PREFIX(CopyConvolutionFilter1DEXT): +GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT,CopyConvolutionFilter1DEXT@20)) +GL_PREFIX(CopyConvolutionFilter1DEXT,CopyConvolutionFilter1DEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) -GL_PREFIX(CopyConvolutionFilter2DEXT): +GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT,CopyConvolutionFilter2DEXT@24)) +GL_PREFIX(CopyConvolutionFilter2DEXT,CopyConvolutionFilter2DEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionFilterEXT)) -GL_PREFIX(GetConvolutionFilterEXT): +GLOBL_FN(GL_PREFIX(GetConvolutionFilterEXT,GetConvolutionFilterEXT@16)) +GL_PREFIX(GetConvolutionFilterEXT,GetConvolutionFilterEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionFilterEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionParameterfvEXT)) -GL_PREFIX(GetConvolutionParameterfvEXT): +GLOBL_FN(GL_PREFIX(GetConvolutionParameterfvEXT,GetConvolutionParameterfvEXT@12)) +GL_PREFIX(GetConvolutionParameterfvEXT,GetConvolutionParameterfvEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetConvolutionParameterivEXT)) -GL_PREFIX(GetConvolutionParameterivEXT): +GLOBL_FN(GL_PREFIX(GetConvolutionParameterivEXT,GetConvolutionParameterivEXT@12)) +GL_PREFIX(GetConvolutionParameterivEXT,GetConvolutionParameterivEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSeparableFilterEXT)) -GL_PREFIX(GetSeparableFilterEXT): +GLOBL_FN(GL_PREFIX(GetSeparableFilterEXT,GetSeparableFilterEXT@24)) +GL_PREFIX(GetSeparableFilterEXT,GetSeparableFilterEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSeparableFilterEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) -GL_PREFIX(SeparableFilter2DEXT): +GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT,SeparableFilter2DEXT@32)) +GL_PREFIX(SeparableFilter2DEXT,SeparableFilter2DEXT@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableSGI)) -GL_PREFIX(ColorTableSGI): +GLOBL_FN(GL_PREFIX(ColorTableSGI,ColorTableSGI@24)) +GL_PREFIX(ColorTableSGI,ColorTableSGI@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) -GL_PREFIX(ColorTableParameterfvSGI): +GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI,ColorTableParameterfvSGI@12)) +GL_PREFIX(ColorTableParameterfvSGI,ColorTableParameterfvSGI@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) -GL_PREFIX(ColorTableParameterivSGI): +GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI,ColorTableParameterivSGI@12)) +GL_PREFIX(ColorTableParameterivSGI,ColorTableParameterivSGI@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) -GL_PREFIX(CopyColorTableSGI): +GLOBL_FN(GL_PREFIX(CopyColorTableSGI,CopyColorTableSGI@20)) +GL_PREFIX(CopyColorTableSGI,CopyColorTableSGI@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableSGI)) -GL_PREFIX(GetColorTableSGI): +GLOBL_FN(GL_PREFIX(GetColorTableSGI,GetColorTableSGI@16)) +GL_PREFIX(GetColorTableSGI,GetColorTableSGI@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableSGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfvSGI)) -GL_PREFIX(GetColorTableParameterfvSGI): +GLOBL_FN(GL_PREFIX(GetColorTableParameterfvSGI,GetColorTableParameterfvSGI@12)) +GL_PREFIX(GetColorTableParameterfvSGI,GetColorTableParameterfvSGI@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvSGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterivSGI)) -GL_PREFIX(GetColorTableParameterivSGI): +GLOBL_FN(GL_PREFIX(GetColorTableParameterivSGI,GetColorTableParameterivSGI@12)) +GL_PREFIX(GetColorTableParameterivSGI,GetColorTableParameterivSGI@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) -GL_PREFIX(PixelTexGenSGIX): +GLOBL_FN(GL_PREFIX(PixelTexGenSGIX,PixelTexGenSGIX@4)) +GL_PREFIX(PixelTexGenSGIX,PixelTexGenSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) -GL_PREFIX(PixelTexGenParameteriSGIS): +GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS,PixelTexGenParameteriSGIS@8)) +GL_PREFIX(PixelTexGenParameteriSGIS,PixelTexGenParameteriSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) -GL_PREFIX(PixelTexGenParameterivSGIS): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS,PixelTexGenParameterivSGIS@8)) +GL_PREFIX(PixelTexGenParameterivSGIS,PixelTexGenParameterivSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) -GL_PREFIX(PixelTexGenParameterfSGIS): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS,PixelTexGenParameterfSGIS@8)) +GL_PREFIX(PixelTexGenParameterfSGIS,PixelTexGenParameterfSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) -GL_PREFIX(PixelTexGenParameterfvSGIS): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS,PixelTexGenParameterfvSGIS@8)) +GL_PREFIX(PixelTexGenParameterfvSGIS,PixelTexGenParameterfvSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) -GL_PREFIX(GetPixelTexGenParameterivSGIS): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS,GetPixelTexGenParameterivSGIS@8)) +GL_PREFIX(GetPixelTexGenParameterivSGIS,GetPixelTexGenParameterivSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) -GL_PREFIX(GetPixelTexGenParameterfvSGIS): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS,GetPixelTexGenParameterfvSGIS@8)) +GL_PREFIX(GetPixelTexGenParameterfvSGIS,GetPixelTexGenParameterfvSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) -GL_PREFIX(TexImage4DSGIS): +GLOBL_FN(GL_PREFIX(TexImage4DSGIS,TexImage4DSGIS@44)) +GL_PREFIX(TexImage4DSGIS,TexImage4DSGIS@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) -GL_PREFIX(TexSubImage4DSGIS): +GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS,TexSubImage4DSGIS@52)) +GL_PREFIX(TexSubImage4DSGIS,TexSubImage4DSGIS@52): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) -GL_PREFIX(AreTexturesResidentEXT): +GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT,AreTexturesResidentEXT@12)) +GL_PREFIX(AreTexturesResidentEXT,AreTexturesResidentEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTextureEXT)) -GL_PREFIX(BindTextureEXT): +GLOBL_FN(GL_PREFIX(BindTextureEXT,BindTextureEXT@8)) +GL_PREFIX(BindTextureEXT,BindTextureEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) -GL_PREFIX(DeleteTexturesEXT): +GLOBL_FN(GL_PREFIX(DeleteTexturesEXT,DeleteTexturesEXT@8)) +GL_PREFIX(DeleteTexturesEXT,DeleteTexturesEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenTexturesEXT)) -GL_PREFIX(GenTexturesEXT): +GLOBL_FN(GL_PREFIX(GenTexturesEXT,GenTexturesEXT@8)) +GL_PREFIX(GenTexturesEXT,GenTexturesEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTextureEXT)) -GL_PREFIX(IsTextureEXT): +GLOBL_FN(GL_PREFIX(IsTextureEXT,IsTextureEXT@4)) +GL_PREFIX(IsTextureEXT,IsTextureEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsTextureEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) -GL_PREFIX(PrioritizeTexturesEXT): +GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT,PrioritizeTexturesEXT@12)) +GL_PREFIX(PrioritizeTexturesEXT,PrioritizeTexturesEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) -GL_PREFIX(DetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS,DetailTexFuncSGIS@12)) +GL_PREFIX(DetailTexFuncSGIS,DetailTexFuncSGIS@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) -GL_PREFIX(GetDetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS,GetDetailTexFuncSGIS@8)) +GL_PREFIX(GetDetailTexFuncSGIS,GetDetailTexFuncSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) -GL_PREFIX(SharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS,SharpenTexFuncSGIS@12)) +GL_PREFIX(SharpenTexFuncSGIS,SharpenTexFuncSGIS@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) -GL_PREFIX(GetSharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS,GetSharpenTexFuncSGIS@8)) +GL_PREFIX(GetSharpenTexFuncSGIS,GetSharpenTexFuncSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) -GL_PREFIX(SampleMaskSGIS): +GLOBL_FN(GL_PREFIX(SampleMaskSGIS,SampleMaskSGIS@8)) +GL_PREFIX(SampleMaskSGIS,SampleMaskSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) -GL_PREFIX(SamplePatternSGIS): +GLOBL_FN(GL_PREFIX(SamplePatternSGIS,SamplePatternSGIS@4)) +GL_PREFIX(SamplePatternSGIS,SamplePatternSGIS@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElementEXT)) -GL_PREFIX(ArrayElementEXT): +GLOBL_FN(GL_PREFIX(ArrayElementEXT,ArrayElementEXT@4)) +GL_PREFIX(ArrayElementEXT,ArrayElementEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointerEXT)) -GL_PREFIX(ColorPointerEXT): +GLOBL_FN(GL_PREFIX(ColorPointerEXT,ColorPointerEXT@20)) +GL_PREFIX(ColorPointerEXT,ColorPointerEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArraysEXT)) -GL_PREFIX(DrawArraysEXT): +GLOBL_FN(GL_PREFIX(DrawArraysEXT,DrawArraysEXT@12)) +GL_PREFIX(DrawArraysEXT,DrawArraysEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) -GL_PREFIX(EdgeFlagPointerEXT): +GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT,EdgeFlagPointerEXT@12)) +GL_PREFIX(EdgeFlagPointerEXT,EdgeFlagPointerEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointervEXT)) -GL_PREFIX(GetPointervEXT): +GLOBL_FN(GL_PREFIX(GetPointervEXT,GetPointervEXT@8)) +GL_PREFIX(GetPointervEXT,GetPointervEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointerEXT)) -GL_PREFIX(IndexPointerEXT): +GLOBL_FN(GL_PREFIX(IndexPointerEXT,IndexPointerEXT@16)) +GL_PREFIX(IndexPointerEXT,IndexPointerEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointerEXT)) -GL_PREFIX(NormalPointerEXT): +GLOBL_FN(GL_PREFIX(NormalPointerEXT,NormalPointerEXT@16)) +GL_PREFIX(NormalPointerEXT,NormalPointerEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) -GL_PREFIX(TexCoordPointerEXT): +GLOBL_FN(GL_PREFIX(TexCoordPointerEXT,TexCoordPointerEXT@20)) +GL_PREFIX(TexCoordPointerEXT,TexCoordPointerEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointerEXT)) -GL_PREFIX(VertexPointerEXT): +GLOBL_FN(GL_PREFIX(VertexPointerEXT,VertexPointerEXT@20)) +GL_PREFIX(VertexPointerEXT,VertexPointerEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquationEXT)) -GL_PREFIX(BlendEquationEXT): +GLOBL_FN(GL_PREFIX(BlendEquationEXT,BlendEquationEXT@4)) +GL_PREFIX(BlendEquationEXT,BlendEquationEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) -GL_PREFIX(SpriteParameterfSGIX): +GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX,SpriteParameterfSGIX@8)) +GL_PREFIX(SpriteParameterfSGIX,SpriteParameterfSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) -GL_PREFIX(SpriteParameterfvSGIX): +GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX,SpriteParameterfvSGIX@8)) +GL_PREFIX(SpriteParameterfvSGIX,SpriteParameterfvSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) -GL_PREFIX(SpriteParameteriSGIX): +GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX,SpriteParameteriSGIX@8)) +GL_PREFIX(SpriteParameteriSGIX,SpriteParameteriSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) -GL_PREFIX(SpriteParameterivSGIX): +GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX,SpriteParameterivSGIX@8)) +GL_PREFIX(SpriteParameterivSGIX,SpriteParameterivSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfEXT)) -GL_PREFIX(PointParameterfEXT): +GLOBL_FN(GL_PREFIX(PointParameterfEXT,PointParameterfEXT@8)) +GL_PREFIX(PointParameterfEXT,PointParameterfEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) -GL_PREFIX(PointParameterfvEXT): +GLOBL_FN(GL_PREFIX(PointParameterfvEXT,PointParameterfvEXT@8)) +GL_PREFIX(PointParameterfvEXT,PointParameterfvEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfARB)) -GL_PREFIX(PointParameterfARB): +GLOBL_FN(GL_PREFIX(PointParameterfARB,PointParameterfARB@8)) +GL_PREFIX(PointParameterfARB,PointParameterfARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfvARB)) -GL_PREFIX(PointParameterfvARB): +GLOBL_FN(GL_PREFIX(PointParameterfvARB,PointParameterfvARB@8)) +GL_PREFIX(PointParameterfvARB,PointParameterfvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) -GL_PREFIX(PointParameterfSGIS): +GLOBL_FN(GL_PREFIX(PointParameterfSGIS,PointParameterfSGIS@8)) +GL_PREFIX(PointParameterfSGIS,PointParameterfSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) -GL_PREFIX(PointParameterfvSGIS): +GLOBL_FN(GL_PREFIX(PointParameterfvSGIS,PointParameterfvSGIS@8)) +GL_PREFIX(PointParameterfvSGIS,PointParameterfvSGIS@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) -GL_PREFIX(GetInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX,GetInstrumentsSGIX@0)) +GL_PREFIX(GetInstrumentsSGIX,GetInstrumentsSGIX@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) -GL_PREFIX(InstrumentsBufferSGIX): +GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX,InstrumentsBufferSGIX@8)) +GL_PREFIX(InstrumentsBufferSGIX,InstrumentsBufferSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) -GL_PREFIX(PollInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX,PollInstrumentsSGIX@4)) +GL_PREFIX(PollInstrumentsSGIX,PollInstrumentsSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) -GL_PREFIX(ReadInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX,ReadInstrumentsSGIX@4)) +GL_PREFIX(ReadInstrumentsSGIX,ReadInstrumentsSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) -GL_PREFIX(StartInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX,StartInstrumentsSGIX@0)) +GL_PREFIX(StartInstrumentsSGIX,StartInstrumentsSGIX@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) -GL_PREFIX(StopInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX,StopInstrumentsSGIX@4)) +GL_PREFIX(StopInstrumentsSGIX,StopInstrumentsSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) -GL_PREFIX(FrameZoomSGIX): +GLOBL_FN(GL_PREFIX(FrameZoomSGIX,FrameZoomSGIX@4)) +GL_PREFIX(FrameZoomSGIX,FrameZoomSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) -GL_PREFIX(TagSampleBufferSGIX): +GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX,TagSampleBufferSGIX@0)) +GL_PREFIX(TagSampleBufferSGIX,TagSampleBufferSGIX@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) -GL_PREFIX(ReferencePlaneSGIX): +GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX,ReferencePlaneSGIX@4)) +GL_PREFIX(ReferencePlaneSGIX,ReferencePlaneSGIX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReferencePlaneSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FlushRasterSGIX)) -GL_PREFIX(FlushRasterSGIX): +GLOBL_FN(GL_PREFIX(FlushRasterSGIX,FlushRasterSGIX@0)) +GL_PREFIX(FlushRasterSGIX,FlushRasterSGIX@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) -GL_PREFIX(ColorSubTableEXT): +GLOBL_FN(GL_PREFIX(ColorSubTableEXT,ColorSubTableEXT@24)) +GL_PREFIX(ColorSubTableEXT,ColorSubTableEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) -GL_PREFIX(CopyColorSubTableEXT): +GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT,CopyColorSubTableEXT@20)) +GL_PREFIX(CopyColorSubTableEXT,CopyColorSubTableEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(HintPGI)) -GL_PREFIX(HintPGI): +GLOBL_FN(GL_PREFIX(HintPGI,HintPGI@8)) +GL_PREFIX(HintPGI,HintPGI@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_HintPGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableEXT)) -GL_PREFIX(ColorTableEXT): +GLOBL_FN(GL_PREFIX(ColorTableEXT,ColorTableEXT@24)) +GL_PREFIX(ColorTableEXT,ColorTableEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableEXT)) -GL_PREFIX(GetColorTableEXT): +GLOBL_FN(GL_PREFIX(GetColorTableEXT,GetColorTableEXT@16)) +GL_PREFIX(GetColorTableEXT,GetColorTableEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) -GL_PREFIX(GetColorTableParameterivEXT): +GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT,GetColorTableParameterivEXT@12)) +GL_PREFIX(GetColorTableParameterivEXT,GetColorTableParameterivEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) -GL_PREFIX(GetColorTableParameterfvEXT): +GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT,GetColorTableParameterfvEXT@12)) +GL_PREFIX(GetColorTableParameterfvEXT,GetColorTableParameterfvEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) -GL_PREFIX(GetListParameterfvSGIX): +GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX,GetListParameterfvSGIX@12)) +GL_PREFIX(GetListParameterfvSGIX,GetListParameterfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetListParameterfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetListParameterivSGIX)) -GL_PREFIX(GetListParameterivSGIX): +GLOBL_FN(GL_PREFIX(GetListParameterivSGIX,GetListParameterivSGIX@12)) +GL_PREFIX(GetListParameterivSGIX,GetListParameterivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetListParameterivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListParameterfSGIX)) -GL_PREFIX(ListParameterfSGIX): +GLOBL_FN(GL_PREFIX(ListParameterfSGIX,ListParameterfSGIX@12)) +GL_PREFIX(ListParameterfSGIX,ListParameterfSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListParameterfvSGIX)) -GL_PREFIX(ListParameterfvSGIX): +GLOBL_FN(GL_PREFIX(ListParameterfvSGIX,ListParameterfvSGIX@12)) +GL_PREFIX(ListParameterfvSGIX,ListParameterfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListParameteriSGIX)) -GL_PREFIX(ListParameteriSGIX): +GLOBL_FN(GL_PREFIX(ListParameteriSGIX,ListParameteriSGIX@12)) +GL_PREFIX(ListParameteriSGIX,ListParameteriSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameteriSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListParameterivSGIX)) -GL_PREFIX(ListParameterivSGIX): +GLOBL_FN(GL_PREFIX(ListParameterivSGIX,ListParameterivSGIX@12)) +GL_PREFIX(ListParameterivSGIX,ListParameterivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexMaterialEXT)) -GL_PREFIX(IndexMaterialEXT): +GLOBL_FN(GL_PREFIX(IndexMaterialEXT,IndexMaterialEXT@8)) +GL_PREFIX(IndexMaterialEXT,IndexMaterialEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexMaterialEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexFuncEXT)) -GL_PREFIX(IndexFuncEXT): +GLOBL_FN(GL_PREFIX(IndexFuncEXT,IndexFuncEXT@8)) +GL_PREFIX(IndexFuncEXT,IndexFuncEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LockArraysEXT)) -GL_PREFIX(LockArraysEXT): +GLOBL_FN(GL_PREFIX(LockArraysEXT,LockArraysEXT@8)) +GL_PREFIX(LockArraysEXT,LockArraysEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) -GL_PREFIX(UnlockArraysEXT): +GLOBL_FN(GL_PREFIX(UnlockArraysEXT,UnlockArraysEXT@0)) +GL_PREFIX(UnlockArraysEXT,UnlockArraysEXT@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) -GL_PREFIX(CullParameterdvEXT): +GLOBL_FN(GL_PREFIX(CullParameterdvEXT,CullParameterdvEXT@8)) +GL_PREFIX(CullParameterdvEXT,CullParameterdvEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) -GL_PREFIX(CullParameterfvEXT): +GLOBL_FN(GL_PREFIX(CullParameterfvEXT,CullParameterfvEXT@8)) +GL_PREFIX(CullParameterfvEXT,CullParameterfvEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) -GL_PREFIX(FragmentColorMaterialSGIX): +GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX,FragmentColorMaterialSGIX@8)) +GL_PREFIX(FragmentColorMaterialSGIX,FragmentColorMaterialSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentColorMaterialSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightfSGIX)) -GL_PREFIX(FragmentLightfSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightfSGIX,FragmentLightfSGIX@12)) +GL_PREFIX(FragmentLightfSGIX,FragmentLightfSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightfvSGIX)) -GL_PREFIX(FragmentLightfvSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightfvSGIX,FragmentLightfvSGIX@12)) +GL_PREFIX(FragmentLightfvSGIX,FragmentLightfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightiSGIX)) -GL_PREFIX(FragmentLightiSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightiSGIX,FragmentLightiSGIX@12)) +GL_PREFIX(FragmentLightiSGIX,FragmentLightiSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightiSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightivSGIX)) -GL_PREFIX(FragmentLightivSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightivSGIX,FragmentLightivSGIX@12)) +GL_PREFIX(FragmentLightivSGIX,FragmentLightivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightModelfSGIX)) -GL_PREFIX(FragmentLightModelfSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightModelfSGIX,FragmentLightModelfSGIX@8)) +GL_PREFIX(FragmentLightModelfSGIX,FragmentLightModelfSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightModelfvSGIX)) -GL_PREFIX(FragmentLightModelfvSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightModelfvSGIX,FragmentLightModelfvSGIX@8)) +GL_PREFIX(FragmentLightModelfvSGIX,FragmentLightModelfvSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightModeliSGIX)) -GL_PREFIX(FragmentLightModeliSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightModeliSGIX,FragmentLightModeliSGIX@8)) +GL_PREFIX(FragmentLightModeliSGIX,FragmentLightModeliSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModeliSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentLightModelivSGIX)) -GL_PREFIX(FragmentLightModelivSGIX): +GLOBL_FN(GL_PREFIX(FragmentLightModelivSGIX,FragmentLightModelivSGIX@8)) +GL_PREFIX(FragmentLightModelivSGIX,FragmentLightModelivSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentMaterialfSGIX)) -GL_PREFIX(FragmentMaterialfSGIX): +GLOBL_FN(GL_PREFIX(FragmentMaterialfSGIX,FragmentMaterialfSGIX@12)) +GL_PREFIX(FragmentMaterialfSGIX,FragmentMaterialfSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentMaterialfvSGIX)) -GL_PREFIX(FragmentMaterialfvSGIX): +GLOBL_FN(GL_PREFIX(FragmentMaterialfvSGIX,FragmentMaterialfvSGIX@12)) +GL_PREFIX(FragmentMaterialfvSGIX,FragmentMaterialfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentMaterialiSGIX)) -GL_PREFIX(FragmentMaterialiSGIX): +GLOBL_FN(GL_PREFIX(FragmentMaterialiSGIX,FragmentMaterialiSGIX@12)) +GL_PREFIX(FragmentMaterialiSGIX,FragmentMaterialiSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialiSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FragmentMaterialivSGIX)) -GL_PREFIX(FragmentMaterialivSGIX): +GLOBL_FN(GL_PREFIX(FragmentMaterialivSGIX,FragmentMaterialivSGIX@12)) +GL_PREFIX(FragmentMaterialivSGIX,FragmentMaterialivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFragmentLightfvSGIX)) -GL_PREFIX(GetFragmentLightfvSGIX): +GLOBL_FN(GL_PREFIX(GetFragmentLightfvSGIX,GetFragmentLightfvSGIX@12)) +GL_PREFIX(GetFragmentLightfvSGIX,GetFragmentLightfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentLightfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFragmentLightivSGIX)) -GL_PREFIX(GetFragmentLightivSGIX): +GLOBL_FN(GL_PREFIX(GetFragmentLightivSGIX,GetFragmentLightivSGIX@12)) +GL_PREFIX(GetFragmentLightivSGIX,GetFragmentLightivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentLightivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFragmentMaterialfvSGIX)) -GL_PREFIX(GetFragmentMaterialfvSGIX): +GLOBL_FN(GL_PREFIX(GetFragmentMaterialfvSGIX,GetFragmentMaterialfvSGIX@12)) +GL_PREFIX(GetFragmentMaterialfvSGIX,GetFragmentMaterialfvSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFragmentMaterialivSGIX)) -GL_PREFIX(GetFragmentMaterialivSGIX): +GLOBL_FN(GL_PREFIX(GetFragmentMaterialivSGIX,GetFragmentMaterialivSGIX@12)) +GL_PREFIX(GetFragmentMaterialivSGIX,GetFragmentMaterialivSGIX@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightEnviSGIX)) -GL_PREFIX(LightEnviSGIX): +GLOBL_FN(GL_PREFIX(LightEnviSGIX,LightEnviSGIX@8)) +GL_PREFIX(LightEnviSGIX,LightEnviSGIX@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) -GL_PREFIX(DrawRangeElementsEXT): +GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT,DrawRangeElementsEXT@24)) +GL_PREFIX(DrawRangeElementsEXT,DrawRangeElementsEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3bEXT)) -GL_PREFIX(SecondaryColor3bEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3bEXT,SecondaryColor3bEXT@12)) +GL_PREFIX(SecondaryColor3bEXT,SecondaryColor3bEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3bvEXT)) -GL_PREFIX(SecondaryColor3bvEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3bvEXT,SecondaryColor3bvEXT@4)) +GL_PREFIX(SecondaryColor3bvEXT,SecondaryColor3bvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3dEXT)) -GL_PREFIX(SecondaryColor3dEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3dEXT,SecondaryColor3dEXT@24)) +GL_PREFIX(SecondaryColor3dEXT,SecondaryColor3dEXT@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3dvEXT)) -GL_PREFIX(SecondaryColor3dvEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3dvEXT,SecondaryColor3dvEXT@4)) +GL_PREFIX(SecondaryColor3dvEXT,SecondaryColor3dvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3fEXT)) -GL_PREFIX(SecondaryColor3fEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3fEXT,SecondaryColor3fEXT@12)) +GL_PREFIX(SecondaryColor3fEXT,SecondaryColor3fEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3fvEXT)) -GL_PREFIX(SecondaryColor3fvEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3fvEXT,SecondaryColor3fvEXT@4)) +GL_PREFIX(SecondaryColor3fvEXT,SecondaryColor3fvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3iEXT)) -GL_PREFIX(SecondaryColor3iEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3iEXT,SecondaryColor3iEXT@12)) +GL_PREFIX(SecondaryColor3iEXT,SecondaryColor3iEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ivEXT)) -GL_PREFIX(SecondaryColor3ivEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3ivEXT,SecondaryColor3ivEXT@4)) +GL_PREFIX(SecondaryColor3ivEXT,SecondaryColor3ivEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3sEXT)) -GL_PREFIX(SecondaryColor3sEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3sEXT,SecondaryColor3sEXT@12)) +GL_PREFIX(SecondaryColor3sEXT,SecondaryColor3sEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3svEXT)) -GL_PREFIX(SecondaryColor3svEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3svEXT,SecondaryColor3svEXT@4)) +GL_PREFIX(SecondaryColor3svEXT,SecondaryColor3svEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ubEXT)) -GL_PREFIX(SecondaryColor3ubEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3ubEXT,SecondaryColor3ubEXT@12)) +GL_PREFIX(SecondaryColor3ubEXT,SecondaryColor3ubEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ubvEXT)) -GL_PREFIX(SecondaryColor3ubvEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3ubvEXT,SecondaryColor3ubvEXT@4)) +GL_PREFIX(SecondaryColor3ubvEXT,SecondaryColor3ubvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3uiEXT)) -GL_PREFIX(SecondaryColor3uiEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3uiEXT,SecondaryColor3uiEXT@12)) +GL_PREFIX(SecondaryColor3uiEXT,SecondaryColor3uiEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3uivEXT)) -GL_PREFIX(SecondaryColor3uivEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3uivEXT,SecondaryColor3uivEXT@4)) +GL_PREFIX(SecondaryColor3uivEXT,SecondaryColor3uivEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3usEXT)) -GL_PREFIX(SecondaryColor3usEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3usEXT,SecondaryColor3usEXT@12)) +GL_PREFIX(SecondaryColor3usEXT,SecondaryColor3usEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3usvEXT)) -GL_PREFIX(SecondaryColor3usvEXT): +GLOBL_FN(GL_PREFIX(SecondaryColor3usvEXT,SecondaryColor3usvEXT@4)) +GL_PREFIX(SecondaryColor3usvEXT,SecondaryColor3usvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColorPointerEXT)) -GL_PREFIX(SecondaryColorPointerEXT): +GLOBL_FN(GL_PREFIX(SecondaryColorPointerEXT,SecondaryColorPointerEXT@16)) +GL_PREFIX(SecondaryColorPointerEXT,SecondaryColorPointerEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiDrawArraysEXT)) -GL_PREFIX(MultiDrawArraysEXT): +GLOBL_FN(GL_PREFIX(MultiDrawArraysEXT,MultiDrawArraysEXT@16)) +GL_PREFIX(MultiDrawArraysEXT,MultiDrawArraysEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiDrawElementsEXT)) -GL_PREFIX(MultiDrawElementsEXT): +GLOBL_FN(GL_PREFIX(MultiDrawElementsEXT,MultiDrawElementsEXT@20)) +GL_PREFIX(MultiDrawElementsEXT,MultiDrawElementsEXT@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordfEXT)) -GL_PREFIX(FogCoordfEXT): +GLOBL_FN(GL_PREFIX(FogCoordfEXT,FogCoordfEXT@4)) +GL_PREFIX(FogCoordfEXT,FogCoordfEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordfvEXT)) -GL_PREFIX(FogCoordfvEXT): +GLOBL_FN(GL_PREFIX(FogCoordfvEXT,FogCoordfvEXT@4)) +GL_PREFIX(FogCoordfvEXT,FogCoordfvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoorddEXT)) -GL_PREFIX(FogCoorddEXT): +GLOBL_FN(GL_PREFIX(FogCoorddEXT,FogCoorddEXT@8)) +GL_PREFIX(FogCoorddEXT,FogCoorddEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoorddvEXT)) -GL_PREFIX(FogCoorddvEXT): +GLOBL_FN(GL_PREFIX(FogCoorddvEXT,FogCoorddvEXT@4)) +GL_PREFIX(FogCoorddvEXT,FogCoorddvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordPointerEXT)) -GL_PREFIX(FogCoordPointerEXT): +GLOBL_FN(GL_PREFIX(FogCoordPointerEXT,FogCoordPointerEXT@12)) +GL_PREFIX(FogCoordPointerEXT,FogCoordPointerEXT@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFuncSeparateEXT)) -GL_PREFIX(BlendFuncSeparateEXT): +GLOBL_FN(GL_PREFIX(BlendFuncSeparateEXT,BlendFuncSeparateEXT@16)) +GL_PREFIX(BlendFuncSeparateEXT,BlendFuncSeparateEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR)) -GL_PREFIX(BlendFuncSeparateINGR): +GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR,BlendFuncSeparateINGR@16)) +GL_PREFIX(BlendFuncSeparateINGR,BlendFuncSeparateINGR@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexWeightfEXT)) -GL_PREFIX(VertexWeightfEXT): +GLOBL_FN(GL_PREFIX(VertexWeightfEXT,VertexWeightfEXT@4)) +GL_PREFIX(VertexWeightfEXT,VertexWeightfEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexWeightfvEXT)) -GL_PREFIX(VertexWeightfvEXT): +GLOBL_FN(GL_PREFIX(VertexWeightfvEXT,VertexWeightfvEXT@4)) +GL_PREFIX(VertexWeightfvEXT,VertexWeightfvEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexWeightPointerEXT)) -GL_PREFIX(VertexWeightPointerEXT): +GLOBL_FN(GL_PREFIX(VertexWeightPointerEXT,VertexWeightPointerEXT@16)) +GL_PREFIX(VertexWeightPointerEXT,VertexWeightPointerEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) -GL_PREFIX(FlushVertexArrayRangeNV): +GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV,FlushVertexArrayRangeNV@0)) +GL_PREFIX(FlushVertexArrayRangeNV,FlushVertexArrayRangeNV@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) -GL_PREFIX(VertexArrayRangeNV): +GLOBL_FN(GL_PREFIX(VertexArrayRangeNV,VertexArrayRangeNV@8)) +GL_PREFIX(VertexArrayRangeNV,VertexArrayRangeNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) -GL_PREFIX(CombinerParameterfvNV): +GLOBL_FN(GL_PREFIX(CombinerParameterfvNV,CombinerParameterfvNV@8)) +GL_PREFIX(CombinerParameterfvNV,CombinerParameterfvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerParameterfNV)) -GL_PREFIX(CombinerParameterfNV): +GLOBL_FN(GL_PREFIX(CombinerParameterfNV,CombinerParameterfNV@8)) +GL_PREFIX(CombinerParameterfNV,CombinerParameterfNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterfNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerParameterivNV)) -GL_PREFIX(CombinerParameterivNV): +GLOBL_FN(GL_PREFIX(CombinerParameterivNV,CombinerParameterivNV@8)) +GL_PREFIX(CombinerParameterivNV,CombinerParameterivNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerParameteriNV)) -GL_PREFIX(CombinerParameteriNV): +GLOBL_FN(GL_PREFIX(CombinerParameteriNV,CombinerParameteriNV@8)) +GL_PREFIX(CombinerParameteriNV,CombinerParameteriNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameteriNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerInputNV)) -GL_PREFIX(CombinerInputNV): +GLOBL_FN(GL_PREFIX(CombinerInputNV,CombinerInputNV@24)) +GL_PREFIX(CombinerInputNV,CombinerInputNV@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerInputNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CombinerOutputNV)) -GL_PREFIX(CombinerOutputNV): +GLOBL_FN(GL_PREFIX(CombinerOutputNV,CombinerOutputNV@40)) +GL_PREFIX(CombinerOutputNV,CombinerOutputNV@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerOutputNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FinalCombinerInputNV)) -GL_PREFIX(FinalCombinerInputNV): +GLOBL_FN(GL_PREFIX(FinalCombinerInputNV,FinalCombinerInputNV@16)) +GL_PREFIX(FinalCombinerInputNV,FinalCombinerInputNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FinalCombinerInputNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCombinerInputParameterfvNV)) -GL_PREFIX(GetCombinerInputParameterfvNV): +GLOBL_FN(GL_PREFIX(GetCombinerInputParameterfvNV,GetCombinerInputParameterfvNV@20)) +GL_PREFIX(GetCombinerInputParameterfvNV,GetCombinerInputParameterfvNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCombinerInputParameterivNV)) -GL_PREFIX(GetCombinerInputParameterivNV): +GLOBL_FN(GL_PREFIX(GetCombinerInputParameterivNV,GetCombinerInputParameterivNV@20)) +GL_PREFIX(GetCombinerInputParameterivNV,GetCombinerInputParameterivNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterfvNV)) -GL_PREFIX(GetCombinerOutputParameterfvNV): +GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterfvNV,GetCombinerOutputParameterfvNV@16)) +GL_PREFIX(GetCombinerOutputParameterfvNV,GetCombinerOutputParameterfvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterivNV)) -GL_PREFIX(GetCombinerOutputParameterivNV): +GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterivNV,GetCombinerOutputParameterivNV@16)) +GL_PREFIX(GetCombinerOutputParameterivNV,GetCombinerOutputParameterivNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterfvNV)) -GL_PREFIX(GetFinalCombinerInputParameterfvNV): +GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterfvNV,GetFinalCombinerInputParameterfvNV@12)) +GL_PREFIX(GetFinalCombinerInputParameterfvNV,GetFinalCombinerInputParameterfvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterivNV)) -GL_PREFIX(GetFinalCombinerInputParameterivNV): +GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterivNV,GetFinalCombinerInputParameterivNV@12)) +GL_PREFIX(GetFinalCombinerInputParameterivNV,GetFinalCombinerInputParameterivNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) -GL_PREFIX(ResizeBuffersMESA): +GLOBL_FN(GL_PREFIX(ResizeBuffersMESA,ResizeBuffersMESA@0)) +GL_PREFIX(ResizeBuffersMESA,ResizeBuffersMESA@0): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) -GL_PREFIX(WindowPos2dMESA): +GLOBL_FN(GL_PREFIX(WindowPos2dMESA,WindowPos2dMESA@16)) +GL_PREFIX(WindowPos2dMESA,WindowPos2dMESA@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) -GL_PREFIX(WindowPos2dvMESA): +GLOBL_FN(GL_PREFIX(WindowPos2dvMESA,WindowPos2dvMESA@4)) +GL_PREFIX(WindowPos2dvMESA,WindowPos2dvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) -GL_PREFIX(WindowPos2fMESA): +GLOBL_FN(GL_PREFIX(WindowPos2fMESA,WindowPos2fMESA@8)) +GL_PREFIX(WindowPos2fMESA,WindowPos2fMESA@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) -GL_PREFIX(WindowPos2fvMESA): +GLOBL_FN(GL_PREFIX(WindowPos2fvMESA,WindowPos2fvMESA@4)) +GL_PREFIX(WindowPos2fvMESA,WindowPos2fvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) -GL_PREFIX(WindowPos2iMESA): +GLOBL_FN(GL_PREFIX(WindowPos2iMESA,WindowPos2iMESA@8)) +GL_PREFIX(WindowPos2iMESA,WindowPos2iMESA@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) -GL_PREFIX(WindowPos2ivMESA): +GLOBL_FN(GL_PREFIX(WindowPos2ivMESA,WindowPos2ivMESA@4)) +GL_PREFIX(WindowPos2ivMESA,WindowPos2ivMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) -GL_PREFIX(WindowPos2sMESA): +GLOBL_FN(GL_PREFIX(WindowPos2sMESA,WindowPos2sMESA@8)) +GL_PREFIX(WindowPos2sMESA,WindowPos2sMESA@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) -GL_PREFIX(WindowPos2svMESA): +GLOBL_FN(GL_PREFIX(WindowPos2svMESA,WindowPos2svMESA@4)) +GL_PREFIX(WindowPos2svMESA,WindowPos2svMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) -GL_PREFIX(WindowPos3dMESA): +GLOBL_FN(GL_PREFIX(WindowPos3dMESA,WindowPos3dMESA@24)) +GL_PREFIX(WindowPos3dMESA,WindowPos3dMESA@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) -GL_PREFIX(WindowPos3dvMESA): +GLOBL_FN(GL_PREFIX(WindowPos3dvMESA,WindowPos3dvMESA@4)) +GL_PREFIX(WindowPos3dvMESA,WindowPos3dvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) -GL_PREFIX(WindowPos3fMESA): +GLOBL_FN(GL_PREFIX(WindowPos3fMESA,WindowPos3fMESA@12)) +GL_PREFIX(WindowPos3fMESA,WindowPos3fMESA@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) -GL_PREFIX(WindowPos3fvMESA): +GLOBL_FN(GL_PREFIX(WindowPos3fvMESA,WindowPos3fvMESA@4)) +GL_PREFIX(WindowPos3fvMESA,WindowPos3fvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) -GL_PREFIX(WindowPos3iMESA): +GLOBL_FN(GL_PREFIX(WindowPos3iMESA,WindowPos3iMESA@12)) +GL_PREFIX(WindowPos3iMESA,WindowPos3iMESA@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) -GL_PREFIX(WindowPos3ivMESA): +GLOBL_FN(GL_PREFIX(WindowPos3ivMESA,WindowPos3ivMESA@4)) +GL_PREFIX(WindowPos3ivMESA,WindowPos3ivMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) -GL_PREFIX(WindowPos3sMESA): +GLOBL_FN(GL_PREFIX(WindowPos3sMESA,WindowPos3sMESA@12)) +GL_PREFIX(WindowPos3sMESA,WindowPos3sMESA@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) -GL_PREFIX(WindowPos3svMESA): +GLOBL_FN(GL_PREFIX(WindowPos3svMESA,WindowPos3svMESA@4)) +GL_PREFIX(WindowPos3svMESA,WindowPos3svMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) -GL_PREFIX(WindowPos4dMESA): +GLOBL_FN(GL_PREFIX(WindowPos4dMESA,WindowPos4dMESA@32)) +GL_PREFIX(WindowPos4dMESA,WindowPos4dMESA@32): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) -GL_PREFIX(WindowPos4dvMESA): +GLOBL_FN(GL_PREFIX(WindowPos4dvMESA,WindowPos4dvMESA@4)) +GL_PREFIX(WindowPos4dvMESA,WindowPos4dvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) -GL_PREFIX(WindowPos4fMESA): +GLOBL_FN(GL_PREFIX(WindowPos4fMESA,WindowPos4fMESA@16)) +GL_PREFIX(WindowPos4fMESA,WindowPos4fMESA@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) -GL_PREFIX(WindowPos4fvMESA): +GLOBL_FN(GL_PREFIX(WindowPos4fvMESA,WindowPos4fvMESA@4)) +GL_PREFIX(WindowPos4fvMESA,WindowPos4fvMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) -GL_PREFIX(WindowPos4iMESA): +GLOBL_FN(GL_PREFIX(WindowPos4iMESA,WindowPos4iMESA@16)) +GL_PREFIX(WindowPos4iMESA,WindowPos4iMESA@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) -GL_PREFIX(WindowPos4ivMESA): +GLOBL_FN(GL_PREFIX(WindowPos4ivMESA,WindowPos4ivMESA@4)) +GL_PREFIX(WindowPos4ivMESA,WindowPos4ivMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) -GL_PREFIX(WindowPos4sMESA): +GLOBL_FN(GL_PREFIX(WindowPos4sMESA,WindowPos4sMESA@16)) +GL_PREFIX(WindowPos4sMESA,WindowPos4sMESA@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) -GL_PREFIX(WindowPos4svMESA): +GLOBL_FN(GL_PREFIX(WindowPos4svMESA,WindowPos4svMESA@4)) +GL_PREFIX(WindowPos4svMESA,WindowPos4svMESA@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiModeDrawArraysIBM)) -GL_PREFIX(MultiModeDrawArraysIBM): +GLOBL_FN(GL_PREFIX(MultiModeDrawArraysIBM,MultiModeDrawArraysIBM@20)) +GL_PREFIX(MultiModeDrawArraysIBM,MultiModeDrawArraysIBM@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiModeDrawArraysIBM)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiModeDrawElementsIBM)) -GL_PREFIX(MultiModeDrawElementsIBM): +GLOBL_FN(GL_PREFIX(MultiModeDrawElementsIBM,MultiModeDrawElementsIBM@24)) +GL_PREFIX(MultiModeDrawElementsIBM,MultiModeDrawElementsIBM@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiModeDrawElementsIBM)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) -GL_PREFIX(TbufferMask3DFX): +GLOBL_FN(GL_PREFIX(TbufferMask3DFX,TbufferMask3DFX@4)) +GL_PREFIX(TbufferMask3DFX,TbufferMask3DFX@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleMaskEXT)) -GL_PREFIX(SampleMaskEXT): +GLOBL_FN(GL_PREFIX(SampleMaskEXT,SampleMaskEXT@8)) +GL_PREFIX(SampleMaskEXT,SampleMaskEXT@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePatternEXT)) -GL_PREFIX(SamplePatternEXT): +GLOBL_FN(GL_PREFIX(SamplePatternEXT,SamplePatternEXT@4)) +GL_PREFIX(SamplePatternEXT,SamplePatternEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dARB)) -GL_PREFIX(WindowPos2dARB): +GLOBL_FN(GL_PREFIX(WindowPos2dARB,WindowPos2dARB@16)) +GL_PREFIX(WindowPos2dARB,WindowPos2dARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fARB)) -GL_PREFIX(WindowPos2fARB): +GLOBL_FN(GL_PREFIX(WindowPos2fARB,WindowPos2fARB@8)) +GL_PREFIX(WindowPos2fARB,WindowPos2fARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2iARB)) -GL_PREFIX(WindowPos2iARB): +GLOBL_FN(GL_PREFIX(WindowPos2iARB,WindowPos2iARB@8)) +GL_PREFIX(WindowPos2iARB,WindowPos2iARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2sARB)) -GL_PREFIX(WindowPos2sARB): +GLOBL_FN(GL_PREFIX(WindowPos2sARB,WindowPos2sARB@8)) +GL_PREFIX(WindowPos2sARB,WindowPos2sARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dvARB)) -GL_PREFIX(WindowPos2dvARB): +GLOBL_FN(GL_PREFIX(WindowPos2dvARB,WindowPos2dvARB@4)) +GL_PREFIX(WindowPos2dvARB,WindowPos2dvARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fvARB)) -GL_PREFIX(WindowPos2fvARB): +GLOBL_FN(GL_PREFIX(WindowPos2fvARB,WindowPos2fvARB@4)) +GL_PREFIX(WindowPos2fvARB,WindowPos2fvARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2ivARB)) -GL_PREFIX(WindowPos2ivARB): +GLOBL_FN(GL_PREFIX(WindowPos2ivARB,WindowPos2ivARB@4)) +GL_PREFIX(WindowPos2ivARB,WindowPos2ivARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2svARB)) -GL_PREFIX(WindowPos2svARB): +GLOBL_FN(GL_PREFIX(WindowPos2svARB,WindowPos2svARB@4)) +GL_PREFIX(WindowPos2svARB,WindowPos2svARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dARB)) -GL_PREFIX(WindowPos3dARB): +GLOBL_FN(GL_PREFIX(WindowPos3dARB,WindowPos3dARB@24)) +GL_PREFIX(WindowPos3dARB,WindowPos3dARB@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fARB)) -GL_PREFIX(WindowPos3fARB): +GLOBL_FN(GL_PREFIX(WindowPos3fARB,WindowPos3fARB@12)) +GL_PREFIX(WindowPos3fARB,WindowPos3fARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3iARB)) -GL_PREFIX(WindowPos3iARB): +GLOBL_FN(GL_PREFIX(WindowPos3iARB,WindowPos3iARB@12)) +GL_PREFIX(WindowPos3iARB,WindowPos3iARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3sARB)) -GL_PREFIX(WindowPos3sARB): +GLOBL_FN(GL_PREFIX(WindowPos3sARB,WindowPos3sARB@12)) +GL_PREFIX(WindowPos3sARB,WindowPos3sARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dvARB)) -GL_PREFIX(WindowPos3dvARB): +GLOBL_FN(GL_PREFIX(WindowPos3dvARB,WindowPos3dvARB@4)) +GL_PREFIX(WindowPos3dvARB,WindowPos3dvARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fvARB)) -GL_PREFIX(WindowPos3fvARB): +GLOBL_FN(GL_PREFIX(WindowPos3fvARB,WindowPos3fvARB@4)) +GL_PREFIX(WindowPos3fvARB,WindowPos3fvARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3ivARB)) -GL_PREFIX(WindowPos3ivARB): +GLOBL_FN(GL_PREFIX(WindowPos3ivARB,WindowPos3ivARB@4)) +GL_PREFIX(WindowPos3ivARB,WindowPos3ivARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3svARB)) -GL_PREFIX(WindowPos3svARB): +GLOBL_FN(GL_PREFIX(WindowPos3svARB,WindowPos3svARB@4)) +GL_PREFIX(WindowPos3svARB,WindowPos3svARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreProgramsResidentNV)) -GL_PREFIX(AreProgramsResidentNV): +GLOBL_FN(GL_PREFIX(AreProgramsResidentNV,AreProgramsResidentNV@12)) +GL_PREFIX(AreProgramsResidentNV,AreProgramsResidentNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AreProgramsResidentNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindProgramNV)) -GL_PREFIX(BindProgramNV): +GLOBL_FN(GL_PREFIX(BindProgramNV,BindProgramNV@8)) +GL_PREFIX(BindProgramNV,BindProgramNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteProgramsNV)) -GL_PREFIX(DeleteProgramsNV): +GLOBL_FN(GL_PREFIX(DeleteProgramsNV,DeleteProgramsNV@8)) +GL_PREFIX(DeleteProgramsNV,DeleteProgramsNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ExecuteProgramNV)) -GL_PREFIX(ExecuteProgramNV): +GLOBL_FN(GL_PREFIX(ExecuteProgramNV,ExecuteProgramNV@12)) +GL_PREFIX(ExecuteProgramNV,ExecuteProgramNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ExecuteProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenProgramsNV)) -GL_PREFIX(GenProgramsNV): +GLOBL_FN(GL_PREFIX(GenProgramsNV,GenProgramsNV@8)) +GL_PREFIX(GenProgramsNV,GenProgramsNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramParameterdvNV)) -GL_PREFIX(GetProgramParameterdvNV): +GLOBL_FN(GL_PREFIX(GetProgramParameterdvNV,GetProgramParameterdvNV@16)) +GL_PREFIX(GetProgramParameterdvNV,GetProgramParameterdvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramParameterdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramParameterfvNV)) -GL_PREFIX(GetProgramParameterfvNV): +GLOBL_FN(GL_PREFIX(GetProgramParameterfvNV,GetProgramParameterfvNV@16)) +GL_PREFIX(GetProgramParameterfvNV,GetProgramParameterfvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramivNV)) -GL_PREFIX(GetProgramivNV): +GLOBL_FN(GL_PREFIX(GetProgramivNV,GetProgramivNV@12)) +GL_PREFIX(GetProgramivNV,GetProgramivNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramStringNV)) -GL_PREFIX(GetProgramStringNV): +GLOBL_FN(GL_PREFIX(GetProgramStringNV,GetProgramStringNV@12)) +GL_PREFIX(GetProgramStringNV,GetProgramStringNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramStringNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTrackMatrixivNV)) -GL_PREFIX(GetTrackMatrixivNV): +GLOBL_FN(GL_PREFIX(GetTrackMatrixivNV,GetTrackMatrixivNV@16)) +GL_PREFIX(GetTrackMatrixivNV,GetTrackMatrixivNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTrackMatrixivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribdvNV)) -GL_PREFIX(GetVertexAttribdvNV): +GLOBL_FN(GL_PREFIX(GetVertexAttribdvNV,GetVertexAttribdvNV@12)) +GL_PREFIX(GetVertexAttribdvNV,GetVertexAttribdvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribfvNV)) -GL_PREFIX(GetVertexAttribfvNV): +GLOBL_FN(GL_PREFIX(GetVertexAttribfvNV,GetVertexAttribfvNV@12)) +GL_PREFIX(GetVertexAttribfvNV,GetVertexAttribfvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribivNV)) -GL_PREFIX(GetVertexAttribivNV): +GLOBL_FN(GL_PREFIX(GetVertexAttribivNV,GetVertexAttribivNV@12)) +GL_PREFIX(GetVertexAttribivNV,GetVertexAttribivNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribPointervNV)) -GL_PREFIX(GetVertexAttribPointervNV): +GLOBL_FN(GL_PREFIX(GetVertexAttribPointervNV,GetVertexAttribPointervNV@12)) +GL_PREFIX(GetVertexAttribPointervNV,GetVertexAttribPointervNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribPointervNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsProgramNV)) -GL_PREFIX(IsProgramNV): +GLOBL_FN(GL_PREFIX(IsProgramNV,IsProgramNV@4)) +GL_PREFIX(IsProgramNV,IsProgramNV@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadProgramNV)) -GL_PREFIX(LoadProgramNV): +GLOBL_FN(GL_PREFIX(LoadProgramNV,LoadProgramNV@16)) +GL_PREFIX(LoadProgramNV,LoadProgramNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameter4dNV)) -GL_PREFIX(ProgramParameter4dNV): +GLOBL_FN(GL_PREFIX(ProgramParameter4dNV,ProgramParameter4dNV@40)) +GL_PREFIX(ProgramParameter4dNV,ProgramParameter4dNV@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameter4dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameter4dvNV)) -GL_PREFIX(ProgramParameter4dvNV): +GLOBL_FN(GL_PREFIX(ProgramParameter4dvNV,ProgramParameter4dvNV@12)) +GL_PREFIX(ProgramParameter4dvNV,ProgramParameter4dvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameter4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameter4fNV)) -GL_PREFIX(ProgramParameter4fNV): +GLOBL_FN(GL_PREFIX(ProgramParameter4fNV,ProgramParameter4fNV@24)) +GL_PREFIX(ProgramParameter4fNV,ProgramParameter4fNV@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameter4fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameter4fvNV)) -GL_PREFIX(ProgramParameter4fvNV): +GLOBL_FN(GL_PREFIX(ProgramParameter4fvNV,ProgramParameter4fvNV@12)) +GL_PREFIX(ProgramParameter4fvNV,ProgramParameter4fvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameter4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameters4dvNV)) -GL_PREFIX(ProgramParameters4dvNV): +GLOBL_FN(GL_PREFIX(ProgramParameters4dvNV,ProgramParameters4dvNV@16)) +GL_PREFIX(ProgramParameters4dvNV,ProgramParameters4dvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameters4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramParameters4fvNV)) -GL_PREFIX(ProgramParameters4fvNV): +GLOBL_FN(GL_PREFIX(ProgramParameters4fvNV,ProgramParameters4fvNV@16)) +GL_PREFIX(ProgramParameters4fvNV,ProgramParameters4fvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramParameters4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RequestResidentProgramsNV)) -GL_PREFIX(RequestResidentProgramsNV): +GLOBL_FN(GL_PREFIX(RequestResidentProgramsNV,RequestResidentProgramsNV@8)) +GL_PREFIX(RequestResidentProgramsNV,RequestResidentProgramsNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RequestResidentProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TrackMatrixNV)) -GL_PREFIX(TrackMatrixNV): +GLOBL_FN(GL_PREFIX(TrackMatrixNV,TrackMatrixNV@16)) +GL_PREFIX(TrackMatrixNV,TrackMatrixNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TrackMatrixNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribPointerNV)) -GL_PREFIX(VertexAttribPointerNV): +GLOBL_FN(GL_PREFIX(VertexAttribPointerNV,VertexAttribPointerNV@20)) +GL_PREFIX(VertexAttribPointerNV,VertexAttribPointerNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribPointerNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1dNV)) -GL_PREFIX(VertexAttrib1dNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1dNV,VertexAttrib1dNV@12)) +GL_PREFIX(VertexAttrib1dNV,VertexAttrib1dNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1dvNV)) -GL_PREFIX(VertexAttrib1dvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1dvNV,VertexAttrib1dvNV@8)) +GL_PREFIX(VertexAttrib1dvNV,VertexAttrib1dvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1fNV)) -GL_PREFIX(VertexAttrib1fNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1fNV,VertexAttrib1fNV@8)) +GL_PREFIX(VertexAttrib1fNV,VertexAttrib1fNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1fvNV)) -GL_PREFIX(VertexAttrib1fvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1fvNV,VertexAttrib1fvNV@8)) +GL_PREFIX(VertexAttrib1fvNV,VertexAttrib1fvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1sNV)) -GL_PREFIX(VertexAttrib1sNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1sNV,VertexAttrib1sNV@8)) +GL_PREFIX(VertexAttrib1sNV,VertexAttrib1sNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1svNV)) -GL_PREFIX(VertexAttrib1svNV): +GLOBL_FN(GL_PREFIX(VertexAttrib1svNV,VertexAttrib1svNV@8)) +GL_PREFIX(VertexAttrib1svNV,VertexAttrib1svNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2dNV)) -GL_PREFIX(VertexAttrib2dNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2dNV,VertexAttrib2dNV@20)) +GL_PREFIX(VertexAttrib2dNV,VertexAttrib2dNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2dvNV)) -GL_PREFIX(VertexAttrib2dvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2dvNV,VertexAttrib2dvNV@8)) +GL_PREFIX(VertexAttrib2dvNV,VertexAttrib2dvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2fNV)) -GL_PREFIX(VertexAttrib2fNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2fNV,VertexAttrib2fNV@12)) +GL_PREFIX(VertexAttrib2fNV,VertexAttrib2fNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2fvNV)) -GL_PREFIX(VertexAttrib2fvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2fvNV,VertexAttrib2fvNV@8)) +GL_PREFIX(VertexAttrib2fvNV,VertexAttrib2fvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2sNV)) -GL_PREFIX(VertexAttrib2sNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2sNV,VertexAttrib2sNV@12)) +GL_PREFIX(VertexAttrib2sNV,VertexAttrib2sNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2svNV)) -GL_PREFIX(VertexAttrib2svNV): +GLOBL_FN(GL_PREFIX(VertexAttrib2svNV,VertexAttrib2svNV@8)) +GL_PREFIX(VertexAttrib2svNV,VertexAttrib2svNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3dNV)) -GL_PREFIX(VertexAttrib3dNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3dNV,VertexAttrib3dNV@28)) +GL_PREFIX(VertexAttrib3dNV,VertexAttrib3dNV@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3dvNV)) -GL_PREFIX(VertexAttrib3dvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3dvNV,VertexAttrib3dvNV@8)) +GL_PREFIX(VertexAttrib3dvNV,VertexAttrib3dvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3fNV)) -GL_PREFIX(VertexAttrib3fNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3fNV,VertexAttrib3fNV@16)) +GL_PREFIX(VertexAttrib3fNV,VertexAttrib3fNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3fvNV)) -GL_PREFIX(VertexAttrib3fvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3fvNV,VertexAttrib3fvNV@8)) +GL_PREFIX(VertexAttrib3fvNV,VertexAttrib3fvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3sNV)) -GL_PREFIX(VertexAttrib3sNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3sNV,VertexAttrib3sNV@16)) +GL_PREFIX(VertexAttrib3sNV,VertexAttrib3sNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3svNV)) -GL_PREFIX(VertexAttrib3svNV): +GLOBL_FN(GL_PREFIX(VertexAttrib3svNV,VertexAttrib3svNV@8)) +GL_PREFIX(VertexAttrib3svNV,VertexAttrib3svNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4dNV)) -GL_PREFIX(VertexAttrib4dNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4dNV,VertexAttrib4dNV@36)) +GL_PREFIX(VertexAttrib4dNV,VertexAttrib4dNV@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4dvNV)) -GL_PREFIX(VertexAttrib4dvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4dvNV,VertexAttrib4dvNV@8)) +GL_PREFIX(VertexAttrib4dvNV,VertexAttrib4dvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4fNV)) -GL_PREFIX(VertexAttrib4fNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4fNV,VertexAttrib4fNV@20)) +GL_PREFIX(VertexAttrib4fNV,VertexAttrib4fNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4fvNV)) -GL_PREFIX(VertexAttrib4fvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4fvNV,VertexAttrib4fvNV@8)) +GL_PREFIX(VertexAttrib4fvNV,VertexAttrib4fvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4sNV)) -GL_PREFIX(VertexAttrib4sNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4sNV,VertexAttrib4sNV@20)) +GL_PREFIX(VertexAttrib4sNV,VertexAttrib4sNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4svNV)) -GL_PREFIX(VertexAttrib4svNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4svNV,VertexAttrib4svNV@8)) +GL_PREFIX(VertexAttrib4svNV,VertexAttrib4svNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4ubNV)) -GL_PREFIX(VertexAttrib4ubNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4ubNV,VertexAttrib4ubNV@20)) +GL_PREFIX(VertexAttrib4ubNV,VertexAttrib4ubNV@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ubNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4ubvNV)) -GL_PREFIX(VertexAttrib4ubvNV): +GLOBL_FN(GL_PREFIX(VertexAttrib4ubvNV,VertexAttrib4ubvNV@8)) +GL_PREFIX(VertexAttrib4ubvNV,VertexAttrib4ubvNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ubvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs1dvNV)) -GL_PREFIX(VertexAttribs1dvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs1dvNV,VertexAttribs1dvNV@12)) +GL_PREFIX(VertexAttribs1dvNV,VertexAttribs1dvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs1dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs1fvNV)) -GL_PREFIX(VertexAttribs1fvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs1fvNV,VertexAttribs1fvNV@12)) +GL_PREFIX(VertexAttribs1fvNV,VertexAttribs1fvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs1fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs1svNV)) -GL_PREFIX(VertexAttribs1svNV): +GLOBL_FN(GL_PREFIX(VertexAttribs1svNV,VertexAttribs1svNV@12)) +GL_PREFIX(VertexAttribs1svNV,VertexAttribs1svNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs1svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs2dvNV)) -GL_PREFIX(VertexAttribs2dvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs2dvNV,VertexAttribs2dvNV@12)) +GL_PREFIX(VertexAttribs2dvNV,VertexAttribs2dvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs2dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs2fvNV)) -GL_PREFIX(VertexAttribs2fvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs2fvNV,VertexAttribs2fvNV@12)) +GL_PREFIX(VertexAttribs2fvNV,VertexAttribs2fvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs2fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs2svNV)) -GL_PREFIX(VertexAttribs2svNV): +GLOBL_FN(GL_PREFIX(VertexAttribs2svNV,VertexAttribs2svNV@12)) +GL_PREFIX(VertexAttribs2svNV,VertexAttribs2svNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs2svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs3dvNV)) -GL_PREFIX(VertexAttribs3dvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs3dvNV,VertexAttribs3dvNV@12)) +GL_PREFIX(VertexAttribs3dvNV,VertexAttribs3dvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs3dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs3fvNV)) -GL_PREFIX(VertexAttribs3fvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs3fvNV,VertexAttribs3fvNV@12)) +GL_PREFIX(VertexAttribs3fvNV,VertexAttribs3fvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs3fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs3svNV)) -GL_PREFIX(VertexAttribs3svNV): +GLOBL_FN(GL_PREFIX(VertexAttribs3svNV,VertexAttribs3svNV@12)) +GL_PREFIX(VertexAttribs3svNV,VertexAttribs3svNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs3svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs4dvNV)) -GL_PREFIX(VertexAttribs4dvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs4dvNV,VertexAttribs4dvNV@12)) +GL_PREFIX(VertexAttribs4dvNV,VertexAttribs4dvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs4fvNV)) -GL_PREFIX(VertexAttribs4fvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs4fvNV,VertexAttribs4fvNV@12)) +GL_PREFIX(VertexAttribs4fvNV,VertexAttribs4fvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs4svNV)) -GL_PREFIX(VertexAttribs4svNV): +GLOBL_FN(GL_PREFIX(VertexAttribs4svNV,VertexAttribs4svNV@12)) +GL_PREFIX(VertexAttribs4svNV,VertexAttribs4svNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs4svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribs4ubvNV)) -GL_PREFIX(VertexAttribs4ubvNV): +GLOBL_FN(GL_PREFIX(VertexAttribs4ubvNV,VertexAttribs4ubvNV@12)) +GL_PREFIX(VertexAttribs4ubvNV,VertexAttribs4ubvNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribs4ubvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameteriNV)) -GL_PREFIX(PointParameteriNV): +GLOBL_FN(GL_PREFIX(PointParameteriNV,PointParameteriNV@8)) +GL_PREFIX(PointParameteriNV,PointParameteriNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameteriNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterivNV)) -GL_PREFIX(PointParameterivNV): +GLOBL_FN(GL_PREFIX(PointParameterivNV,PointParameterivNV@8)) +GL_PREFIX(PointParameterivNV,PointParameterivNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFuncSeparate)) -GL_PREFIX(BlendFuncSeparate): +GLOBL_FN(GL_PREFIX(BlendFuncSeparate,BlendFuncSeparate@16)) +GL_PREFIX(BlendFuncSeparate,BlendFuncSeparate@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordf)) -GL_PREFIX(FogCoordf): +GLOBL_FN(GL_PREFIX(FogCoordf,FogCoordf@4)) +GL_PREFIX(FogCoordf,FogCoordf@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordfv)) -GL_PREFIX(FogCoordfv): +GLOBL_FN(GL_PREFIX(FogCoordfv,FogCoordfv@4)) +GL_PREFIX(FogCoordfv,FogCoordfv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordd)) -GL_PREFIX(FogCoordd): +GLOBL_FN(GL_PREFIX(FogCoordd,FogCoordd@8)) +GL_PREFIX(FogCoordd,FogCoordd@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoorddv)) -GL_PREFIX(FogCoorddv): +GLOBL_FN(GL_PREFIX(FogCoorddv,FogCoorddv@4)) +GL_PREFIX(FogCoorddv,FogCoorddv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FogCoordPointer)) -GL_PREFIX(FogCoordPointer): +GLOBL_FN(GL_PREFIX(FogCoordPointer,FogCoordPointer@12)) +GL_PREFIX(FogCoordPointer,FogCoordPointer@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiDrawArrays)) -GL_PREFIX(MultiDrawArrays): +GLOBL_FN(GL_PREFIX(MultiDrawArrays,MultiDrawArrays@16)) +GL_PREFIX(MultiDrawArrays,MultiDrawArrays@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiDrawElements)) -GL_PREFIX(MultiDrawElements): +GLOBL_FN(GL_PREFIX(MultiDrawElements,MultiDrawElements@20)) +GL_PREFIX(MultiDrawElements,MultiDrawElements@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterf)) -GL_PREFIX(PointParameterf): +GLOBL_FN(GL_PREFIX(PointParameterf,PointParameterf@8)) +GL_PREFIX(PointParameterf,PointParameterf@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfv)) -GL_PREFIX(PointParameterfv): +GLOBL_FN(GL_PREFIX(PointParameterfv,PointParameterfv@8)) +GL_PREFIX(PointParameterfv,PointParameterfv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameteri)) -GL_PREFIX(PointParameteri): +GLOBL_FN(GL_PREFIX(PointParameteri,PointParameteri@8)) +GL_PREFIX(PointParameteri,PointParameteri@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameteriNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameteriv)) -GL_PREFIX(PointParameteriv): +GLOBL_FN(GL_PREFIX(PointParameteriv,PointParameteriv@8)) +GL_PREFIX(PointParameteriv,PointParameteriv@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3b)) -GL_PREFIX(SecondaryColor3b): +GLOBL_FN(GL_PREFIX(SecondaryColor3b,SecondaryColor3b@12)) +GL_PREFIX(SecondaryColor3b,SecondaryColor3b@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3bv)) -GL_PREFIX(SecondaryColor3bv): +GLOBL_FN(GL_PREFIX(SecondaryColor3bv,SecondaryColor3bv@4)) +GL_PREFIX(SecondaryColor3bv,SecondaryColor3bv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3d)) -GL_PREFIX(SecondaryColor3d): +GLOBL_FN(GL_PREFIX(SecondaryColor3d,SecondaryColor3d@24)) +GL_PREFIX(SecondaryColor3d,SecondaryColor3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3dv)) -GL_PREFIX(SecondaryColor3dv): +GLOBL_FN(GL_PREFIX(SecondaryColor3dv,SecondaryColor3dv@4)) +GL_PREFIX(SecondaryColor3dv,SecondaryColor3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3f)) -GL_PREFIX(SecondaryColor3f): +GLOBL_FN(GL_PREFIX(SecondaryColor3f,SecondaryColor3f@12)) +GL_PREFIX(SecondaryColor3f,SecondaryColor3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3fv)) -GL_PREFIX(SecondaryColor3fv): +GLOBL_FN(GL_PREFIX(SecondaryColor3fv,SecondaryColor3fv@4)) +GL_PREFIX(SecondaryColor3fv,SecondaryColor3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3i)) -GL_PREFIX(SecondaryColor3i): +GLOBL_FN(GL_PREFIX(SecondaryColor3i,SecondaryColor3i@12)) +GL_PREFIX(SecondaryColor3i,SecondaryColor3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3iv)) -GL_PREFIX(SecondaryColor3iv): +GLOBL_FN(GL_PREFIX(SecondaryColor3iv,SecondaryColor3iv@4)) +GL_PREFIX(SecondaryColor3iv,SecondaryColor3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3s)) -GL_PREFIX(SecondaryColor3s): +GLOBL_FN(GL_PREFIX(SecondaryColor3s,SecondaryColor3s@12)) +GL_PREFIX(SecondaryColor3s,SecondaryColor3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3sv)) -GL_PREFIX(SecondaryColor3sv): +GLOBL_FN(GL_PREFIX(SecondaryColor3sv,SecondaryColor3sv@4)) +GL_PREFIX(SecondaryColor3sv,SecondaryColor3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ub)) -GL_PREFIX(SecondaryColor3ub): +GLOBL_FN(GL_PREFIX(SecondaryColor3ub,SecondaryColor3ub@12)) +GL_PREFIX(SecondaryColor3ub,SecondaryColor3ub@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ubv)) -GL_PREFIX(SecondaryColor3ubv): +GLOBL_FN(GL_PREFIX(SecondaryColor3ubv,SecondaryColor3ubv@4)) +GL_PREFIX(SecondaryColor3ubv,SecondaryColor3ubv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3ui)) -GL_PREFIX(SecondaryColor3ui): +GLOBL_FN(GL_PREFIX(SecondaryColor3ui,SecondaryColor3ui@12)) +GL_PREFIX(SecondaryColor3ui,SecondaryColor3ui@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3uiv)) -GL_PREFIX(SecondaryColor3uiv): +GLOBL_FN(GL_PREFIX(SecondaryColor3uiv,SecondaryColor3uiv@4)) +GL_PREFIX(SecondaryColor3uiv,SecondaryColor3uiv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3us)) -GL_PREFIX(SecondaryColor3us): +GLOBL_FN(GL_PREFIX(SecondaryColor3us,SecondaryColor3us@12)) +GL_PREFIX(SecondaryColor3us,SecondaryColor3us@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColor3usv)) -GL_PREFIX(SecondaryColor3usv): +GLOBL_FN(GL_PREFIX(SecondaryColor3usv,SecondaryColor3usv@4)) +GL_PREFIX(SecondaryColor3usv,SecondaryColor3usv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SecondaryColorPointer)) -GL_PREFIX(SecondaryColorPointer): +GLOBL_FN(GL_PREFIX(SecondaryColorPointer,SecondaryColorPointer@16)) +GL_PREFIX(SecondaryColorPointer,SecondaryColorPointer@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2d)) -GL_PREFIX(WindowPos2d): +GLOBL_FN(GL_PREFIX(WindowPos2d,WindowPos2d@16)) +GL_PREFIX(WindowPos2d,WindowPos2d@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dv)) -GL_PREFIX(WindowPos2dv): +GLOBL_FN(GL_PREFIX(WindowPos2dv,WindowPos2dv@4)) +GL_PREFIX(WindowPos2dv,WindowPos2dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2f)) -GL_PREFIX(WindowPos2f): +GLOBL_FN(GL_PREFIX(WindowPos2f,WindowPos2f@8)) +GL_PREFIX(WindowPos2f,WindowPos2f@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fv)) -GL_PREFIX(WindowPos2fv): +GLOBL_FN(GL_PREFIX(WindowPos2fv,WindowPos2fv@4)) +GL_PREFIX(WindowPos2fv,WindowPos2fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2i)) -GL_PREFIX(WindowPos2i): +GLOBL_FN(GL_PREFIX(WindowPos2i,WindowPos2i@8)) +GL_PREFIX(WindowPos2i,WindowPos2i@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2iv)) -GL_PREFIX(WindowPos2iv): +GLOBL_FN(GL_PREFIX(WindowPos2iv,WindowPos2iv@4)) +GL_PREFIX(WindowPos2iv,WindowPos2iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2s)) -GL_PREFIX(WindowPos2s): +GLOBL_FN(GL_PREFIX(WindowPos2s,WindowPos2s@8)) +GL_PREFIX(WindowPos2s,WindowPos2s@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2sv)) -GL_PREFIX(WindowPos2sv): +GLOBL_FN(GL_PREFIX(WindowPos2sv,WindowPos2sv@4)) +GL_PREFIX(WindowPos2sv,WindowPos2sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3d)) -GL_PREFIX(WindowPos3d): +GLOBL_FN(GL_PREFIX(WindowPos3d,WindowPos3d@24)) +GL_PREFIX(WindowPos3d,WindowPos3d@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dv)) -GL_PREFIX(WindowPos3dv): +GLOBL_FN(GL_PREFIX(WindowPos3dv,WindowPos3dv@4)) +GL_PREFIX(WindowPos3dv,WindowPos3dv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3f)) -GL_PREFIX(WindowPos3f): +GLOBL_FN(GL_PREFIX(WindowPos3f,WindowPos3f@12)) +GL_PREFIX(WindowPos3f,WindowPos3f@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fv)) -GL_PREFIX(WindowPos3fv): +GLOBL_FN(GL_PREFIX(WindowPos3fv,WindowPos3fv@4)) +GL_PREFIX(WindowPos3fv,WindowPos3fv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3i)) -GL_PREFIX(WindowPos3i): +GLOBL_FN(GL_PREFIX(WindowPos3i,WindowPos3i@12)) +GL_PREFIX(WindowPos3i,WindowPos3i@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3iv)) -GL_PREFIX(WindowPos3iv): +GLOBL_FN(GL_PREFIX(WindowPos3iv,WindowPos3iv@4)) +GL_PREFIX(WindowPos3iv,WindowPos3iv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3s)) -GL_PREFIX(WindowPos3s): +GLOBL_FN(GL_PREFIX(WindowPos3s,WindowPos3s@12)) +GL_PREFIX(WindowPos3s,WindowPos3s@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3sv)) -GL_PREFIX(WindowPos3sv): +GLOBL_FN(GL_PREFIX(WindowPos3sv,WindowPos3sv@4)) +GL_PREFIX(WindowPos3sv,WindowPos3sv@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ActiveStencilFaceEXT)) -GL_PREFIX(ActiveStencilFaceEXT): +GLOBL_FN(GL_PREFIX(ActiveStencilFaceEXT,ActiveStencilFaceEXT@4)) +GL_PREFIX(ActiveStencilFaceEXT,ActiveStencilFaceEXT@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ActiveStencilFaceEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteFencesNV)) -GL_PREFIX(DeleteFencesNV): +GLOBL_FN(GL_PREFIX(DeleteFencesNV,DeleteFencesNV@8)) +GL_PREFIX(DeleteFencesNV,DeleteFencesNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteFencesNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenFencesNV)) -GL_PREFIX(GenFencesNV): +GLOBL_FN(GL_PREFIX(GenFencesNV,GenFencesNV@8)) +GL_PREFIX(GenFencesNV,GenFencesNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenFencesNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsFenceNV)) -GL_PREFIX(IsFenceNV): +GLOBL_FN(GL_PREFIX(IsFenceNV,IsFenceNV@4)) +GL_PREFIX(IsFenceNV,IsFenceNV@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TestFenceNV)) -GL_PREFIX(TestFenceNV): +GLOBL_FN(GL_PREFIX(TestFenceNV,TestFenceNV@4)) +GL_PREFIX(TestFenceNV,TestFenceNV@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TestFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFenceivNV)) -GL_PREFIX(GetFenceivNV): +GLOBL_FN(GL_PREFIX(GetFenceivNV,GetFenceivNV@12)) +GL_PREFIX(GetFenceivNV,GetFenceivNV@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFenceivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FinishFenceNV)) -GL_PREFIX(FinishFenceNV): +GLOBL_FN(GL_PREFIX(FinishFenceNV,FinishFenceNV@4)) +GL_PREFIX(FinishFenceNV,FinishFenceNV@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FinishFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SetFenceNV)) -GL_PREFIX(SetFenceNV): +GLOBL_FN(GL_PREFIX(SetFenceNV,SetFenceNV@8)) +GL_PREFIX(SetFenceNV,SetFenceNV@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SetFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1sARB)) -GL_PREFIX(VertexAttrib1sARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1sARB,VertexAttrib1sARB@8)) +GL_PREFIX(VertexAttrib1sARB,VertexAttrib1sARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1fARB)) -GL_PREFIX(VertexAttrib1fARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1fARB,VertexAttrib1fARB@8)) +GL_PREFIX(VertexAttrib1fARB,VertexAttrib1fARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1dARB)) -GL_PREFIX(VertexAttrib1dARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1dARB,VertexAttrib1dARB@12)) +GL_PREFIX(VertexAttrib1dARB,VertexAttrib1dARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2sARB)) -GL_PREFIX(VertexAttrib2sARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2sARB,VertexAttrib2sARB@12)) +GL_PREFIX(VertexAttrib2sARB,VertexAttrib2sARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2fARB)) -GL_PREFIX(VertexAttrib2fARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2fARB,VertexAttrib2fARB@12)) +GL_PREFIX(VertexAttrib2fARB,VertexAttrib2fARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2dARB)) -GL_PREFIX(VertexAttrib2dARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2dARB,VertexAttrib2dARB@20)) +GL_PREFIX(VertexAttrib2dARB,VertexAttrib2dARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3sARB)) -GL_PREFIX(VertexAttrib3sARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3sARB,VertexAttrib3sARB@16)) +GL_PREFIX(VertexAttrib3sARB,VertexAttrib3sARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3fARB)) -GL_PREFIX(VertexAttrib3fARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3fARB,VertexAttrib3fARB@16)) +GL_PREFIX(VertexAttrib3fARB,VertexAttrib3fARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3dARB)) -GL_PREFIX(VertexAttrib3dARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3dARB,VertexAttrib3dARB@28)) +GL_PREFIX(VertexAttrib3dARB,VertexAttrib3dARB@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4sARB)) -GL_PREFIX(VertexAttrib4sARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4sARB,VertexAttrib4sARB@20)) +GL_PREFIX(VertexAttrib4sARB,VertexAttrib4sARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4sNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4fARB)) -GL_PREFIX(VertexAttrib4fARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4fARB,VertexAttrib4fARB@20)) +GL_PREFIX(VertexAttrib4fARB,VertexAttrib4fARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4dARB)) -GL_PREFIX(VertexAttrib4dARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4dARB,VertexAttrib4dARB@36)) +GL_PREFIX(VertexAttrib4dARB,VertexAttrib4dARB@36): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NubARB)) -GL_PREFIX(VertexAttrib4NubARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NubARB,VertexAttrib4NubARB@20)) +GL_PREFIX(VertexAttrib4NubARB,VertexAttrib4NubARB@20): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ubNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1svARB)) -GL_PREFIX(VertexAttrib1svARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1svARB,VertexAttrib1svARB@8)) +GL_PREFIX(VertexAttrib1svARB,VertexAttrib1svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1fvARB)) -GL_PREFIX(VertexAttrib1fvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1fvARB,VertexAttrib1fvARB@8)) +GL_PREFIX(VertexAttrib1fvARB,VertexAttrib1fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib1dvARB)) -GL_PREFIX(VertexAttrib1dvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib1dvARB,VertexAttrib1dvARB@8)) +GL_PREFIX(VertexAttrib1dvARB,VertexAttrib1dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib1dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2svARB)) -GL_PREFIX(VertexAttrib2svARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2svARB,VertexAttrib2svARB@8)) +GL_PREFIX(VertexAttrib2svARB,VertexAttrib2svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2fvARB)) -GL_PREFIX(VertexAttrib2fvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2fvARB,VertexAttrib2fvARB@8)) +GL_PREFIX(VertexAttrib2fvARB,VertexAttrib2fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib2dvARB)) -GL_PREFIX(VertexAttrib2dvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib2dvARB,VertexAttrib2dvARB@8)) +GL_PREFIX(VertexAttrib2dvARB,VertexAttrib2dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib2dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3svARB)) -GL_PREFIX(VertexAttrib3svARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3svARB,VertexAttrib3svARB@8)) +GL_PREFIX(VertexAttrib3svARB,VertexAttrib3svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3fvARB)) -GL_PREFIX(VertexAttrib3fvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3fvARB,VertexAttrib3fvARB@8)) +GL_PREFIX(VertexAttrib3fvARB,VertexAttrib3fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib3dvARB)) -GL_PREFIX(VertexAttrib3dvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib3dvARB,VertexAttrib3dvARB@8)) +GL_PREFIX(VertexAttrib3dvARB,VertexAttrib3dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib3dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4bvARB)) -GL_PREFIX(VertexAttrib4bvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4bvARB,VertexAttrib4bvARB@8)) +GL_PREFIX(VertexAttrib4bvARB,VertexAttrib4bvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4bvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4svARB)) -GL_PREFIX(VertexAttrib4svARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4svARB,VertexAttrib4svARB@8)) +GL_PREFIX(VertexAttrib4svARB,VertexAttrib4svARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4svNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4ivARB)) -GL_PREFIX(VertexAttrib4ivARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4ivARB,VertexAttrib4ivARB@8)) +GL_PREFIX(VertexAttrib4ivARB,VertexAttrib4ivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4ubvARB)) -GL_PREFIX(VertexAttrib4ubvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4ubvARB,VertexAttrib4ubvARB@8)) +GL_PREFIX(VertexAttrib4ubvARB,VertexAttrib4ubvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ubvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4usvARB)) -GL_PREFIX(VertexAttrib4usvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4usvARB,VertexAttrib4usvARB@8)) +GL_PREFIX(VertexAttrib4usvARB,VertexAttrib4usvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4usvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4uivARB)) -GL_PREFIX(VertexAttrib4uivARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4uivARB,VertexAttrib4uivARB@8)) +GL_PREFIX(VertexAttrib4uivARB,VertexAttrib4uivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4uivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4fvARB)) -GL_PREFIX(VertexAttrib4fvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4fvARB,VertexAttrib4fvARB@8)) +GL_PREFIX(VertexAttrib4fvARB,VertexAttrib4fvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4dvARB)) -GL_PREFIX(VertexAttrib4dvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4dvARB,VertexAttrib4dvARB@8)) +GL_PREFIX(VertexAttrib4dvARB,VertexAttrib4dvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NbvARB)) -GL_PREFIX(VertexAttrib4NbvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NbvARB,VertexAttrib4NbvARB@8)) +GL_PREFIX(VertexAttrib4NbvARB,VertexAttrib4NbvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4NbvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NsvARB)) -GL_PREFIX(VertexAttrib4NsvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NsvARB,VertexAttrib4NsvARB@8)) +GL_PREFIX(VertexAttrib4NsvARB,VertexAttrib4NsvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4NsvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NivARB)) -GL_PREFIX(VertexAttrib4NivARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NivARB,VertexAttrib4NivARB@8)) +GL_PREFIX(VertexAttrib4NivARB,VertexAttrib4NivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4NivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NubvARB)) -GL_PREFIX(VertexAttrib4NubvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NubvARB,VertexAttrib4NubvARB@8)) +GL_PREFIX(VertexAttrib4NubvARB,VertexAttrib4NubvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4ubvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NusvARB)) -GL_PREFIX(VertexAttrib4NusvARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NusvARB,VertexAttrib4NusvARB@8)) +GL_PREFIX(VertexAttrib4NusvARB,VertexAttrib4NusvARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4NusvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttrib4NuivARB)) -GL_PREFIX(VertexAttrib4NuivARB): +GLOBL_FN(GL_PREFIX(VertexAttrib4NuivARB,VertexAttrib4NuivARB@8)) +GL_PREFIX(VertexAttrib4NuivARB,VertexAttrib4NuivARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttrib4NuivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexAttribPointerARB)) -GL_PREFIX(VertexAttribPointerARB): +GLOBL_FN(GL_PREFIX(VertexAttribPointerARB,VertexAttribPointerARB@24)) +GL_PREFIX(VertexAttribPointerARB,VertexAttribPointerARB@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexAttribPointerARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EnableVertexAttribArrayARB)) -GL_PREFIX(EnableVertexAttribArrayARB): +GLOBL_FN(GL_PREFIX(EnableVertexAttribArrayARB,EnableVertexAttribArrayARB@4)) +GL_PREFIX(EnableVertexAttribArrayARB,EnableVertexAttribArrayARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EnableVertexAttribArrayARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DisableVertexAttribArrayARB)) -GL_PREFIX(DisableVertexAttribArrayARB): +GLOBL_FN(GL_PREFIX(DisableVertexAttribArrayARB,DisableVertexAttribArrayARB@4)) +GL_PREFIX(DisableVertexAttribArrayARB,DisableVertexAttribArrayARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DisableVertexAttribArrayARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramStringARB)) -GL_PREFIX(ProgramStringARB): +GLOBL_FN(GL_PREFIX(ProgramStringARB,ProgramStringARB@16)) +GL_PREFIX(ProgramStringARB,ProgramStringARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramStringARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindProgramARB)) -GL_PREFIX(BindProgramARB): +GLOBL_FN(GL_PREFIX(BindProgramARB,BindProgramARB@8)) +GL_PREFIX(BindProgramARB,BindProgramARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteProgramsARB)) -GL_PREFIX(DeleteProgramsARB): +GLOBL_FN(GL_PREFIX(DeleteProgramsARB,DeleteProgramsARB@8)) +GL_PREFIX(DeleteProgramsARB,DeleteProgramsARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenProgramsARB)) -GL_PREFIX(GenProgramsARB): +GLOBL_FN(GL_PREFIX(GenProgramsARB,GenProgramsARB@8)) +GL_PREFIX(GenProgramsARB,GenProgramsARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsProgramARB)) -GL_PREFIX(IsProgramARB): +GLOBL_FN(GL_PREFIX(IsProgramARB,IsProgramARB@4)) +GL_PREFIX(IsProgramARB,IsProgramARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramEnvParameter4dARB)) -GL_PREFIX(ProgramEnvParameter4dARB): +GLOBL_FN(GL_PREFIX(ProgramEnvParameter4dARB,ProgramEnvParameter4dARB@40)) +GL_PREFIX(ProgramEnvParameter4dARB,ProgramEnvParameter4dARB@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramEnvParameter4dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramEnvParameter4dvARB)) -GL_PREFIX(ProgramEnvParameter4dvARB): +GLOBL_FN(GL_PREFIX(ProgramEnvParameter4dvARB,ProgramEnvParameter4dvARB@12)) +GL_PREFIX(ProgramEnvParameter4dvARB,ProgramEnvParameter4dvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramEnvParameter4dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramEnvParameter4fARB)) -GL_PREFIX(ProgramEnvParameter4fARB): +GLOBL_FN(GL_PREFIX(ProgramEnvParameter4fARB,ProgramEnvParameter4fARB@24)) +GL_PREFIX(ProgramEnvParameter4fARB,ProgramEnvParameter4fARB@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramEnvParameter4fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramEnvParameter4fvARB)) -GL_PREFIX(ProgramEnvParameter4fvARB): +GLOBL_FN(GL_PREFIX(ProgramEnvParameter4fvARB,ProgramEnvParameter4fvARB@12)) +GL_PREFIX(ProgramEnvParameter4fvARB,ProgramEnvParameter4fvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramEnvParameter4fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramLocalParameter4dARB)) -GL_PREFIX(ProgramLocalParameter4dARB): +GLOBL_FN(GL_PREFIX(ProgramLocalParameter4dARB,ProgramLocalParameter4dARB@40)) +GL_PREFIX(ProgramLocalParameter4dARB,ProgramLocalParameter4dARB@40): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramLocalParameter4dARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramLocalParameter4dvARB)) -GL_PREFIX(ProgramLocalParameter4dvARB): +GLOBL_FN(GL_PREFIX(ProgramLocalParameter4dvARB,ProgramLocalParameter4dvARB@12)) +GL_PREFIX(ProgramLocalParameter4dvARB,ProgramLocalParameter4dvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramLocalParameter4dvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramLocalParameter4fARB)) -GL_PREFIX(ProgramLocalParameter4fARB): +GLOBL_FN(GL_PREFIX(ProgramLocalParameter4fARB,ProgramLocalParameter4fARB@24)) +GL_PREFIX(ProgramLocalParameter4fARB,ProgramLocalParameter4fARB@24): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramLocalParameter4fARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramLocalParameter4fvARB)) -GL_PREFIX(ProgramLocalParameter4fvARB): +GLOBL_FN(GL_PREFIX(ProgramLocalParameter4fvARB,ProgramLocalParameter4fvARB@12)) +GL_PREFIX(ProgramLocalParameter4fvARB,ProgramLocalParameter4fvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramLocalParameter4fvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramEnvParameterdvARB)) -GL_PREFIX(GetProgramEnvParameterdvARB): +GLOBL_FN(GL_PREFIX(GetProgramEnvParameterdvARB,GetProgramEnvParameterdvARB@12)) +GL_PREFIX(GetProgramEnvParameterdvARB,GetProgramEnvParameterdvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramEnvParameterdvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramEnvParameterfvARB)) -GL_PREFIX(GetProgramEnvParameterfvARB): +GLOBL_FN(GL_PREFIX(GetProgramEnvParameterfvARB,GetProgramEnvParameterfvARB@12)) +GL_PREFIX(GetProgramEnvParameterfvARB,GetProgramEnvParameterfvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramEnvParameterfvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramLocalParameterdvARB)) -GL_PREFIX(GetProgramLocalParameterdvARB): +GLOBL_FN(GL_PREFIX(GetProgramLocalParameterdvARB,GetProgramLocalParameterdvARB@12)) +GL_PREFIX(GetProgramLocalParameterdvARB,GetProgramLocalParameterdvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramLocalParameterdvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramLocalParameterfvARB)) -GL_PREFIX(GetProgramLocalParameterfvARB): +GLOBL_FN(GL_PREFIX(GetProgramLocalParameterfvARB,GetProgramLocalParameterfvARB@12)) +GL_PREFIX(GetProgramLocalParameterfvARB,GetProgramLocalParameterfvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramLocalParameterfvARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramivARB)) -GL_PREFIX(GetProgramivARB): +GLOBL_FN(GL_PREFIX(GetProgramivARB,GetProgramivARB@12)) +GL_PREFIX(GetProgramivARB,GetProgramivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramStringARB)) -GL_PREFIX(GetProgramStringARB): +GLOBL_FN(GL_PREFIX(GetProgramStringARB,GetProgramStringARB@12)) +GL_PREFIX(GetProgramStringARB,GetProgramStringARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramStringARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribdvARB)) -GL_PREFIX(GetVertexAttribdvARB): +GLOBL_FN(GL_PREFIX(GetVertexAttribdvARB,GetVertexAttribdvARB@12)) +GL_PREFIX(GetVertexAttribdvARB,GetVertexAttribdvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribfvARB)) -GL_PREFIX(GetVertexAttribfvARB): +GLOBL_FN(GL_PREFIX(GetVertexAttribfvARB,GetVertexAttribfvARB@12)) +GL_PREFIX(GetVertexAttribfvARB,GetVertexAttribfvARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribivARB)) -GL_PREFIX(GetVertexAttribivARB): +GLOBL_FN(GL_PREFIX(GetVertexAttribivARB,GetVertexAttribivARB@12)) +GL_PREFIX(GetVertexAttribivARB,GetVertexAttribivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetVertexAttribPointervARB)) -GL_PREFIX(GetVertexAttribPointervARB): +GLOBL_FN(GL_PREFIX(GetVertexAttribPointervARB,GetVertexAttribPointervARB@12)) +GL_PREFIX(GetVertexAttribPointervARB,GetVertexAttribPointervARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetVertexAttribPointervNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramNamedParameter4fNV)) -GL_PREFIX(ProgramNamedParameter4fNV): +GLOBL_FN(GL_PREFIX(ProgramNamedParameter4fNV,ProgramNamedParameter4fNV@28)) +GL_PREFIX(ProgramNamedParameter4fNV,ProgramNamedParameter4fNV@28): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramNamedParameter4fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramNamedParameter4dNV)) -GL_PREFIX(ProgramNamedParameter4dNV): +GLOBL_FN(GL_PREFIX(ProgramNamedParameter4dNV,ProgramNamedParameter4dNV@44)) +GL_PREFIX(ProgramNamedParameter4dNV,ProgramNamedParameter4dNV@44): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramNamedParameter4dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramNamedParameter4fvNV)) -GL_PREFIX(ProgramNamedParameter4fvNV): +GLOBL_FN(GL_PREFIX(ProgramNamedParameter4fvNV,ProgramNamedParameter4fvNV@16)) +GL_PREFIX(ProgramNamedParameter4fvNV,ProgramNamedParameter4fvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramNamedParameter4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ProgramNamedParameter4dvNV)) -GL_PREFIX(ProgramNamedParameter4dvNV): +GLOBL_FN(GL_PREFIX(ProgramNamedParameter4dvNV,ProgramNamedParameter4dvNV@16)) +GL_PREFIX(ProgramNamedParameter4dvNV,ProgramNamedParameter4dvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ProgramNamedParameter4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramNamedParameterfvNV)) -GL_PREFIX(GetProgramNamedParameterfvNV): +GLOBL_FN(GL_PREFIX(GetProgramNamedParameterfvNV,GetProgramNamedParameterfvNV@16)) +GL_PREFIX(GetProgramNamedParameterfvNV,GetProgramNamedParameterfvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramNamedParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetProgramNamedParameterdvNV)) -GL_PREFIX(GetProgramNamedParameterdvNV): +GLOBL_FN(GL_PREFIX(GetProgramNamedParameterdvNV,GetProgramNamedParameterdvNV@16)) +GL_PREFIX(GetProgramNamedParameterdvNV,GetProgramNamedParameterdvNV@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetProgramNamedParameterdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindBufferARB)) -GL_PREFIX(BindBufferARB): +GLOBL_FN(GL_PREFIX(BindBufferARB,BindBufferARB@8)) +GL_PREFIX(BindBufferARB,BindBufferARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindBufferARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BufferDataARB)) -GL_PREFIX(BufferDataARB): +GLOBL_FN(GL_PREFIX(BufferDataARB,BufferDataARB@16)) +GL_PREFIX(BufferDataARB,BufferDataARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BufferDataARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BufferSubDataARB)) -GL_PREFIX(BufferSubDataARB): +GLOBL_FN(GL_PREFIX(BufferSubDataARB,BufferSubDataARB@16)) +GL_PREFIX(BufferSubDataARB,BufferSubDataARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BufferSubDataARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteBuffersARB)) -GL_PREFIX(DeleteBuffersARB): +GLOBL_FN(GL_PREFIX(DeleteBuffersARB,DeleteBuffersARB@8)) +GL_PREFIX(DeleteBuffersARB,DeleteBuffersARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteBuffersARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenBuffersARB)) -GL_PREFIX(GenBuffersARB): +GLOBL_FN(GL_PREFIX(GenBuffersARB,GenBuffersARB@8)) +GL_PREFIX(GenBuffersARB,GenBuffersARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenBuffersARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBufferParameterivARB)) -GL_PREFIX(GetBufferParameterivARB): +GLOBL_FN(GL_PREFIX(GetBufferParameterivARB,GetBufferParameterivARB@12)) +GL_PREFIX(GetBufferParameterivARB,GetBufferParameterivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetBufferParameterivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBufferPointervARB)) -GL_PREFIX(GetBufferPointervARB): +GLOBL_FN(GL_PREFIX(GetBufferPointervARB,GetBufferPointervARB@12)) +GL_PREFIX(GetBufferPointervARB,GetBufferPointervARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetBufferPointervARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBufferSubDataARB)) -GL_PREFIX(GetBufferSubDataARB): +GLOBL_FN(GL_PREFIX(GetBufferSubDataARB,GetBufferSubDataARB@16)) +GL_PREFIX(GetBufferSubDataARB,GetBufferSubDataARB@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetBufferSubDataARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsBufferARB)) -GL_PREFIX(IsBufferARB): +GLOBL_FN(GL_PREFIX(IsBufferARB,IsBufferARB@4)) +GL_PREFIX(IsBufferARB,IsBufferARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsBufferARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapBufferARB)) -GL_PREFIX(MapBufferARB): +GLOBL_FN(GL_PREFIX(MapBufferARB,MapBufferARB@8)) +GL_PREFIX(MapBufferARB,MapBufferARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapBufferARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(UnmapBufferARB)) -GL_PREFIX(UnmapBufferARB): +GLOBL_FN(GL_PREFIX(UnmapBufferARB,UnmapBufferARB@4)) +GL_PREFIX(UnmapBufferARB,UnmapBufferARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_UnmapBufferARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthBoundsEXT)) -GL_PREFIX(DepthBoundsEXT): +GLOBL_FN(GL_PREFIX(DepthBoundsEXT,DepthBoundsEXT@16)) +GL_PREFIX(DepthBoundsEXT,DepthBoundsEXT@16): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthBoundsEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenQueriesARB)) -GL_PREFIX(GenQueriesARB): +GLOBL_FN(GL_PREFIX(GenQueriesARB,GenQueriesARB@8)) +GL_PREFIX(GenQueriesARB,GenQueriesARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenQueriesARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteQueriesARB)) -GL_PREFIX(DeleteQueriesARB): +GLOBL_FN(GL_PREFIX(DeleteQueriesARB,DeleteQueriesARB@8)) +GL_PREFIX(DeleteQueriesARB,DeleteQueriesARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteQueriesARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsQueryARB)) -GL_PREFIX(IsQueryARB): +GLOBL_FN(GL_PREFIX(IsQueryARB,IsQueryARB@4)) +GL_PREFIX(IsQueryARB,IsQueryARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsQueryARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BeginQueryARB)) -GL_PREFIX(BeginQueryARB): +GLOBL_FN(GL_PREFIX(BeginQueryARB,BeginQueryARB@8)) +GL_PREFIX(BeginQueryARB,BeginQueryARB@8): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BeginQueryARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EndQueryARB)) -GL_PREFIX(EndQueryARB): +GLOBL_FN(GL_PREFIX(EndQueryARB,EndQueryARB@4)) +GL_PREFIX(EndQueryARB,EndQueryARB@4): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EndQueryARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetQueryivARB)) -GL_PREFIX(GetQueryivARB): +GLOBL_FN(GL_PREFIX(GetQueryivARB,GetQueryivARB@12)) +GL_PREFIX(GetQueryivARB,GetQueryivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetQueryivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetQueryObjectivARB)) -GL_PREFIX(GetQueryObjectivARB): +GLOBL_FN(GL_PREFIX(GetQueryObjectivARB,GetQueryObjectivARB@12)) +GL_PREFIX(GetQueryObjectivARB,GetQueryObjectivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetQueryObjectivARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetQueryObjectuivARB)) -GL_PREFIX(GetQueryObjectuivARB): +GLOBL_FN(GL_PREFIX(GetQueryObjectuivARB,GetQueryObjectuivARB@12)) +GL_PREFIX(GetQueryObjectuivARB,GetQueryObjectuivARB@12): MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetQueryObjectuivARB)) diff --git a/src/mesa/x86/sse.c b/src/mesa/x86/sse.c index 8e995c80c3f..e2b48626c4a 100644 --- a/src/mesa/x86/sse.c +++ b/src/mesa/x86/sse.c @@ -1,4 +1,4 @@ -/* $Id: sse.c,v 1.3 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: sse.c,v 1.3.14.1 2003/11/21 15:49:46 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -48,13 +48,13 @@ DECLARE_XFORM_GROUP( sse, 3 ) #if 1 /* Some functions are not written in SSE-assembly, because the fpu ones are faster */ -extern void _mesa_sse_transform_normals_no_rot( NORM_ARGS ); -extern void _mesa_sse_transform_rescale_normals( NORM_ARGS ); -extern void _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_normals_no_rot( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); -extern void _mesa_sse_transform_points4_general( XFORM_ARGS ); -extern void _mesa_sse_transform_points4_3d( XFORM_ARGS ); -extern void _mesa_sse_transform_points4_identity( XFORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_points4_general( XFORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_points4_3d( XFORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_points4_identity( XFORM_ARGS ); #else DECLARE_NORM_GROUP( sse ) #endif |