From: Ian Romanick Date: Fri, 30 May 2003 21:37:14 +0000 (+0000) Subject: Added support for NV_light_max_exponent. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=882caa18c6c551cbe60f205795b00a6a5361a986;p=mesa.git Added support for NV_light_max_exponent. --- diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index ff96605f1bb..f15e3b61423 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -1,4 +1,4 @@ -/* $Id: api_noop.c,v 1.12 2003/03/01 01:50:20 brianp Exp $ */ +/* $Id: api_noop.c,v 1.13 2003/05/30 21:37:14 idr Exp $ */ /* * Mesa 3-D graphics library @@ -130,11 +130,11 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) COPY_4FV( mat[1].Emission, params ); } if (bitmask & FRONT_SHININESS_BIT) { - GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess ); mat[0].Shininess = shininess; } if (bitmask & BACK_SHININESS_BIT) { - GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess ); mat[1].Shininess = shininess; } if (bitmask & FRONT_INDEXES_BIT) { diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1101045afd3..798308a8751 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -988,6 +988,8 @@ init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; ctx->Const.MaxLights = MAX_LIGHTS; + ctx->Const.MaxSpotExponent = 128.0; + ctx->Const.MaxShininess = 128.0; #if FEATURE_ARB_vertex_program ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 2f5bc7588f3..ad06bf7687b 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -116,6 +116,7 @@ static struct { { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(MESA_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, + { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, @@ -197,6 +198,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) "GL_MESA_resize_buffers", "GL_MESA_ycbcr_texture", "GL_NV_blend_square", + "GL_NV_light_max_exponent", "GL_NV_point_sprite", "GL_NV_texture_rectangle", "GL_NV_texgen_reflection", diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 999adcc84f8..09895f8090e 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1518,6 +1518,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = FLOAT_TO_BOOL(ctx->Const.MaxShininess); + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = FLOAT_TO_BOOL(ctx->Const.MaxSpotExponent); + break; + #if FEATURE_ARB_vertex_buffer_object case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); @@ -3016,6 +3026,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = (GLdouble) ctx->Const.MaxShininess; + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = (GLdouble) ctx->Const.MaxSpotExponent; + break; + #if FEATURE_ARB_vertex_buffer_object case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname); @@ -4490,6 +4510,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = ctx->Const.MaxShininess; + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = ctx->Const.MaxSpotExponent; + break; + #if FEATURE_ARB_vertex_buffer_object case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); @@ -6002,6 +6032,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = (GLint) ctx->Const.MaxShininess; + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + *params = (GLint) ctx->Const.MaxSpotExponent; + break; + #if FEATURE_ARB_vertex_buffer_object case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index c7fa7018d3f..e1513b88296 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.55 2003/03/01 01:50:21 brianp Exp $ */ +/* $Id: light.c,v 1.56 2003/05/30 21:37:19 idr Exp $ */ /* * Mesa 3-D graphics library @@ -136,7 +136,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) break; } case GL_SPOT_EXPONENT: - if (params[0]<0.0 || params[0]>128.0) { + if (params[0]<0.0 || params[0]>ctx->Const.MaxSpotExponent) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2b7fe01a12e..826f077e355 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1409,6 +1409,8 @@ struct gl_constants { GLuint MaxConvolutionHeight; GLuint MaxClipPlanes; GLuint MaxLights; + GLfloat MaxShininess; /* GL_NV_light_max_exponent */ + GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */ /* GL_ARB_vertex_program */ GLuint MaxVertexProgramInstructions; GLuint MaxVertexProgramAttribs; @@ -1500,6 +1502,7 @@ struct gl_extensions { GLboolean MESA_ycbcr_texture; GLboolean NV_blend_square; GLboolean NV_fragment_program; + GLboolean NV_light_max_exponent; GLboolean NV_point_sprite; GLboolean NV_texture_rectangle; GLboolean NV_texgen_reflection; diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c index cc7f42f3847..9274d6f9be3 100644 --- a/src/mesa/tnl/t_imm_api.c +++ b/src/mesa/tnl/t_imm_api.c @@ -1319,11 +1319,11 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) COPY_4FV( mat[1].Emission, params ); } if (bitmask & FRONT_SHININESS_BIT) { - GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess ); mat[0].Shininess = shininess; } if (bitmask & BACK_SHININESS_BIT) { - GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess ); mat[1].Shininess = shininess; } if (bitmask & FRONT_INDEXES_BIT) {