Added MaxClipPlanes and MaxLights to gl_constants struct so T&L
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 27 Nov 2000 18:22:13 +0000 (18:22 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 27 Nov 2000 18:22:13 +0000 (18:22 +0000)
drivers can report non-default numbers of lights and clip planes.

src/mesa/main/clip.c
src/mesa/main/context.c
src/mesa/main/get.c
src/mesa/main/light.c
src/mesa/main/mtypes.h
src/mesa/main/rastpos.c
src/mesa/main/state.c

index 0dc3651..131f3b6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: clip.c,v 1.17 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: clip.c,v 1.18 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -59,7 +59,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");
 
    p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
-   if (p<0 || p>=MAX_CLIP_PLANES) {
+   if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
       gl_error( ctx, GL_INVALID_ENUM, "glClipPlane" );
       return;
    }
@@ -114,7 +114,7 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
 
 
    p = (GLint) (plane - GL_CLIP_PLANE0);
-   if (p<0 || p>=MAX_CLIP_PLANES) {
+   if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
       gl_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" );
       return;
    }
index 3fdeb28..504de6e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.109 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: context.c,v 1.110 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -759,6 +759,8 @@ init_attrib_groups( GLcontext *ctx )
    ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
    ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
    ctx->Const.NumCompressedTextureFormats = 0;
+   ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
+   ctx->Const.MaxLights = MAX_LIGHTS;
 
    /* Modelview matrix */
    _math_matrix_ctr( &ctx->ModelView );
index 21b9a0f..012290a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.43 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: get.c,v 1.44 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -551,7 +551,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          *params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH);
          break;
       case GL_MAX_CLIP_PLANES:
-        *params = INT_TO_BOOL(MAX_CLIP_PLANES);
+        *params = INT_TO_BOOL(ctx->Const.MaxClipPlanes);
         break;
       case GL_MAX_ELEMENTS_VERTICES:  /* GL_VERSION_1_2 */
          *params = INT_TO_BOOL(VB_MAX);
@@ -563,7 +563,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
         *params = INT_TO_BOOL(MAX_EVAL_ORDER);
         break;
       case GL_MAX_LIGHTS:
-        *params = INT_TO_BOOL(MAX_LIGHTS);
+        *params = INT_TO_BOOL(ctx->Const.MaxLights);
         break;
       case GL_MAX_LIST_NESTING:
         *params = INT_TO_BOOL(MAX_LIST_NESTING);
@@ -1749,7 +1749,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
          *params = (GLdouble) MAX_CLIENT_ATTRIB_STACK_DEPTH;
          break;
       case GL_MAX_CLIP_PLANES:
-        *params = (GLdouble) MAX_CLIP_PLANES;
+        *params = (GLdouble) ctx->Const.MaxClipPlanes;
         break;
       case GL_MAX_ELEMENTS_VERTICES:  /* GL_VERSION_1_2 */
          *params = (GLdouble) VB_MAX;
@@ -1761,7 +1761,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
         *params = (GLdouble) MAX_EVAL_ORDER;
         break;
       case GL_MAX_LIGHTS:
-        *params = (GLdouble) MAX_LIGHTS;
+        *params = (GLdouble) ctx->Const.MaxLights;
         break;
       case GL_MAX_LIST_NESTING:
         *params = (GLdouble) MAX_LIST_NESTING;
@@ -2948,7 +2948,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          *params = (GLfloat) MAX_CLIENT_ATTRIB_STACK_DEPTH;
          break;
       case GL_MAX_CLIP_PLANES:
-        *params = (GLfloat) MAX_CLIP_PLANES;
+        *params = (GLfloat) ctx->Const.MaxClipPlanes;
         break;
       case GL_MAX_ELEMENTS_VERTICES:  /* GL_VERSION_1_2 */
          *params = (GLfloat) VB_MAX;
@@ -2960,7 +2960,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
         *params = (GLfloat) MAX_EVAL_ORDER;
         break;
       case GL_MAX_LIGHTS:
-        *params = (GLfloat) MAX_LIGHTS;
+        *params = (GLfloat) ctx->Const.MaxLights;
         break;
       case GL_MAX_LIST_NESTING:
         *params = (GLfloat) MAX_LIST_NESTING;
@@ -4123,7 +4123,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          *params = (GLint) MAX_CLIENT_ATTRIB_STACK_DEPTH;
          break;
       case GL_MAX_CLIP_PLANES:
-         *params = (GLint) MAX_CLIP_PLANES;
+         *params = (GLint) ctx->Const.MaxClipPlanes;
          break;
       case GL_MAX_ELEMENTS_VERTICES:  /* GL_VERSION_1_2 */
          *params = VB_MAX;
@@ -4135,7 +4135,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
         *params = (GLint) MAX_EVAL_ORDER;
         break;
       case GL_MAX_LIGHTS:
-         *params = (GLint) MAX_LIGHTS;
+         *params = (GLint) ctx->Const.MaxLights;
          break;
       case GL_MAX_LIST_NESTING:
          *params = (GLint) MAX_LIST_NESTING;
index 07571cd..4f8bdd2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.29 2000/11/24 15:21:59 keithw Exp $ */
+/* $Id: light.c,v 1.30 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -96,7 +96,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
 
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight");
 
-   if (i < 0 || i >= MAX_LIGHTS) {
+   if (i < 0 || i >= ctx->Const.MaxLights) {
       gl_error( ctx, GL_INVALID_ENUM, "glLight" );
       return;
    }
@@ -240,7 +240,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
 
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
 
-   if (l<0 || l>=MAX_LIGHTS) {
+   if (l < 0 || l >= ctx->Const.MaxLights) {
       gl_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
       return;
    }
@@ -292,7 +292,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
 
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
 
-   if (l<0 || l>=MAX_LIGHTS) {
+   if (l < 0 || l >= ctx->Const.MaxLights) {
       gl_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
       return;
    }
index e18bdda..41c1000 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.2 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: mtypes.h,v 1.3 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -1165,6 +1165,8 @@ struct gl_constants {
    GLuint MaxConvolutionHeight;
    GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */
    GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS];
+   GLuint MaxClipPlanes;
+   GLuint MaxLights;
 };
 
 
index 9f6a493..2865e7e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rastpos.c,v 1.16 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: rastpos.c,v 1.17 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -74,7 +74,7 @@ static GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] )
 {
    GLuint p;
 
-   for (p=0;p<MAX_CLIP_PLANES;p++) {
+   for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
       if (ctx->Transform.ClipEnabled[p]) {
         GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
                     + v[1] * ctx->Transform._ClipUserPlane[p][1]
index c0c9e98..0dbf481 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.48 2000/11/24 10:25:06 keithw Exp $ */
+/* $Id: state.c,v 1.49 2000/11/27 18:22:13 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -638,7 +638,7 @@ update_projection( GLcontext *ctx )
     */
    if (ctx->Transform._AnyClip) {
       GLuint p;
-      for (p = 0 ; p < MAX_CLIP_PLANES ; p++) {
+      for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
         if (ctx->Transform.ClipEnabled[p]) {
            gl_transform_vector( ctx->Transform._ClipUserPlane[p],
                                 ctx->Transform.EyeUserPlane[p],