aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-11-27 18:22:13 +0000
committerBrian Paul <[email protected]>2000-11-27 18:22:13 +0000
commita864432fb4333dfbbe669554de7485d8426e1c38 (patch)
treeda0b272a0784a1f830e15a529778c1021a65628b /src
parent50478ded80fe04ab384b702723f227f53516212c (diff)
Added MaxClipPlanes and MaxLights to gl_constants struct so T&L
drivers can report non-default numbers of lights and clip planes.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/clip.c6
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/get.c18
-rw-r--r--src/mesa/main/light.c8
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/rastpos.c4
-rw-r--r--src/mesa/main/state.c4
7 files changed, 26 insertions, 22 deletions
diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c
index 0dc365131de..131f3b60331 100644
--- a/src/mesa/main/clip.c
+++ b/src/mesa/main/clip.c
@@ -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;
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 3fdeb28dd3d..504de6e5874 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -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 );
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 21b9a0f0feb..012290a44a5 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -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;
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 07571cd9656..4f8bdd2ce1b 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -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;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e18bdda81be..41c1000c1d2 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -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;
};
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 9f6a49330d6..2865e7e0d49 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -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]
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index c0c9e98e5fb..0dbf48163d9 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -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],