Added MaxClipPlanes and MaxLights to gl_constants struct so T&L

drivers can report non-default numbers of lights and clip planes.
This commit is contained in:
Brian Paul
2000-11-27 18:22:13 +00:00
parent 50478ded80
commit a864432fb4
7 changed files with 26 additions and 22 deletions

View 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 * Mesa 3-D graphics library
@@ -59,7 +59,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");
p = (GLint) plane - (GLint) GL_CLIP_PLANE0; 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" ); gl_error( ctx, GL_INVALID_ENUM, "glClipPlane" );
return; return;
} }
@@ -114,7 +114,7 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
p = (GLint) (plane - GL_CLIP_PLANE0); 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" ); gl_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" );
return; return;
} }

View 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 * Mesa 3-D graphics library
@@ -759,6 +759,8 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
ctx->Const.NumCompressedTextureFormats = 0; ctx->Const.NumCompressedTextureFormats = 0;
ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
ctx->Const.MaxLights = MAX_LIGHTS;
/* Modelview matrix */ /* Modelview matrix */
_math_matrix_ctr( &ctx->ModelView ); _math_matrix_ctr( &ctx->ModelView );

View 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 * Mesa 3-D graphics library
@@ -551,7 +551,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH); *params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH);
break; break;
case GL_MAX_CLIP_PLANES: case GL_MAX_CLIP_PLANES:
*params = INT_TO_BOOL(MAX_CLIP_PLANES); *params = INT_TO_BOOL(ctx->Const.MaxClipPlanes);
break; break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
*params = INT_TO_BOOL(VB_MAX); *params = INT_TO_BOOL(VB_MAX);
@@ -563,7 +563,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(MAX_EVAL_ORDER); *params = INT_TO_BOOL(MAX_EVAL_ORDER);
break; break;
case GL_MAX_LIGHTS: case GL_MAX_LIGHTS:
*params = INT_TO_BOOL(MAX_LIGHTS); *params = INT_TO_BOOL(ctx->Const.MaxLights);
break; break;
case GL_MAX_LIST_NESTING: case GL_MAX_LIST_NESTING:
*params = INT_TO_BOOL(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; *params = (GLdouble) MAX_CLIENT_ATTRIB_STACK_DEPTH;
break; break;
case GL_MAX_CLIP_PLANES: case GL_MAX_CLIP_PLANES:
*params = (GLdouble) MAX_CLIP_PLANES; *params = (GLdouble) ctx->Const.MaxClipPlanes;
break; break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
*params = (GLdouble) VB_MAX; *params = (GLdouble) VB_MAX;
@@ -1761,7 +1761,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) MAX_EVAL_ORDER; *params = (GLdouble) MAX_EVAL_ORDER;
break; break;
case GL_MAX_LIGHTS: case GL_MAX_LIGHTS:
*params = (GLdouble) MAX_LIGHTS; *params = (GLdouble) ctx->Const.MaxLights;
break; break;
case GL_MAX_LIST_NESTING: case GL_MAX_LIST_NESTING:
*params = (GLdouble) 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; *params = (GLfloat) MAX_CLIENT_ATTRIB_STACK_DEPTH;
break; break;
case GL_MAX_CLIP_PLANES: case GL_MAX_CLIP_PLANES:
*params = (GLfloat) MAX_CLIP_PLANES; *params = (GLfloat) ctx->Const.MaxClipPlanes;
break; break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
*params = (GLfloat) VB_MAX; *params = (GLfloat) VB_MAX;
@@ -2960,7 +2960,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) MAX_EVAL_ORDER; *params = (GLfloat) MAX_EVAL_ORDER;
break; break;
case GL_MAX_LIGHTS: case GL_MAX_LIGHTS:
*params = (GLfloat) MAX_LIGHTS; *params = (GLfloat) ctx->Const.MaxLights;
break; break;
case GL_MAX_LIST_NESTING: case GL_MAX_LIST_NESTING:
*params = (GLfloat) 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; *params = (GLint) MAX_CLIENT_ATTRIB_STACK_DEPTH;
break; break;
case GL_MAX_CLIP_PLANES: case GL_MAX_CLIP_PLANES:
*params = (GLint) MAX_CLIP_PLANES; *params = (GLint) ctx->Const.MaxClipPlanes;
break; break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
*params = VB_MAX; *params = VB_MAX;
@@ -4135,7 +4135,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) MAX_EVAL_ORDER; *params = (GLint) MAX_EVAL_ORDER;
break; break;
case GL_MAX_LIGHTS: case GL_MAX_LIGHTS:
*params = (GLint) MAX_LIGHTS; *params = (GLint) ctx->Const.MaxLights;
break; break;
case GL_MAX_LIST_NESTING: case GL_MAX_LIST_NESTING:
*params = (GLint) MAX_LIST_NESTING; *params = (GLint) MAX_LIST_NESTING;

View 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 * 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"); 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" ); gl_error( ctx, GL_INVALID_ENUM, "glLight" );
return; return;
} }
@@ -240,7 +240,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); 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" ); gl_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
return; return;
} }
@@ -292,7 +292,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); 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" ); gl_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
return; return;
} }

View 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 * Mesa 3-D graphics library
@@ -1165,6 +1165,8 @@ struct gl_constants {
GLuint MaxConvolutionHeight; GLuint MaxConvolutionHeight;
GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */ GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */
GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS]; GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS];
GLuint MaxClipPlanes;
GLuint MaxLights;
}; };

View 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 * Mesa 3-D graphics library
@@ -74,7 +74,7 @@ static GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] )
{ {
GLuint p; GLuint p;
for (p=0;p<MAX_CLIP_PLANES;p++) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
if (ctx->Transform.ClipEnabled[p]) { if (ctx->Transform.ClipEnabled[p]) {
GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+ v[1] * ctx->Transform._ClipUserPlane[p][1] + v[1] * ctx->Transform._ClipUserPlane[p][1]

View 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 * Mesa 3-D graphics library
@@ -638,7 +638,7 @@ update_projection( GLcontext *ctx )
*/ */
if (ctx->Transform._AnyClip) { if (ctx->Transform._AnyClip) {
GLuint p; GLuint p;
for (p = 0 ; p < MAX_CLIP_PLANES ; p++) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
if (ctx->Transform.ClipEnabled[p]) { if (ctx->Transform.ClipEnabled[p]) {
gl_transform_vector( ctx->Transform._ClipUserPlane[p], gl_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p], ctx->Transform.EyeUserPlane[p],