diff options
author | Brian Paul <[email protected]> | 2002-06-18 16:53:46 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-06-18 16:53:46 +0000 |
commit | 02c03ef6b4762adf33b73528c9fd672ef4697763 (patch) | |
tree | 1f498ae3e1a8e6f96d85326f29f6160a8d5ecb05 /src/mesa/main/enable.c | |
parent | f92298623872d0e67749479886a445918347fde5 (diff) |
Moved GL_PROGRAM_ERROR_POSITION_NV state (it's not per-program).
Finished all glGet* queries for GL_NV_vertex_program.
Improved error reporting in glEnable/Disable/Get, etc.
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r-- | src/mesa/main/enable.c | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index eb031e8d669..aef516690ae 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.66 2002/06/15 03:03:07 brianp Exp $ */ +/* $Id: enable.c,v 1.67 2002/06/18 16:53:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -42,10 +42,11 @@ #endif -#define CHECK_EXTENSION(EXTNAME) \ +#define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, \ - state ? "glEnableClientState": "glDisableClientState"); \ + char s[100]; \ + sprintf(s, "gl%sClientState(0x%x)", state ? "Enable" : "Disable", CAP);\ + _mesa_error(ctx, GL_INVALID_ENUM, s); \ return; \ } @@ -108,7 +109,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_VERTEX_ATTRIB_ARRAY13_NV: case GL_VERTEX_ATTRIB_ARRAY14_NV: case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; var = &ctx->Array.VertexAttrib[n].Enabled; @@ -116,7 +117,11 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) } break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); + { + char s[100]; + sprintf(s, "glEnable/DisableClientState(0x%x)", cap); + _mesa_error( ctx, GL_INVALID_ENUM, s); + } return; } @@ -159,11 +164,12 @@ _mesa_DisableClientState( GLenum cap ) #undef CHECK_EXTENSION -#define CHECK_EXTENSION(EXTNAME) \ - if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, \ - state ? "glEnable": "glDisable"); \ - return; \ +#define CHECK_EXTENSION(EXTNAME, CAP) \ + if (!ctx->Extensions.EXTNAME) { \ + char s[100]; \ + sprintf(s, "gl%s(0x%x)", state ? "Enable" : "Disable", CAP); \ + _mesa_error(ctx, GL_INVALID_ENUM, s); \ + return; \ } @@ -276,7 +282,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Fog.Enabled = state; break; case GL_HISTOGRAM: - CHECK_EXTENSION(EXT_histogram); + CHECK_EXTENSION(EXT_histogram, cap); if (ctx->Pixel.HistogramEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); @@ -640,7 +646,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - CHECK_EXTENSION(HP_occlusion_test); + CHECK_EXTENSION(HP_occlusion_test, cap); if (ctx->Depth.OcclusionTest == state) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); @@ -653,7 +659,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: - CHECK_EXTENSION(SGIS_pixel_texture); + CHECK_EXTENSION(SGIS_pixel_texture, cap); if (ctx->Pixel.PixelTextureEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); @@ -662,7 +668,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: - CHECK_EXTENSION(SGIX_pixel_texture); + CHECK_EXTENSION(SGIX_pixel_texture, cap); if (ctx->Pixel.PixelTextureEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); @@ -671,21 +677,21 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); + CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.ColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.ColorTableEnabled = state; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); + CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.PostConvolutionColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionColorTableEnabled = state; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); + CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); @@ -694,21 +700,21 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: - CHECK_EXTENSION(EXT_convolution); + CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Convolution1DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.Convolution1DEnabled = state; break; case GL_CONVOLUTION_2D: - CHECK_EXTENSION(EXT_convolution); + CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Convolution2DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.Convolution2DEnabled = state; break; case GL_SEPARABLE_2D: - CHECK_EXTENSION(EXT_convolution); + CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Separable2DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); @@ -721,7 +727,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; - CHECK_EXTENSION(ARB_texture_cube_map); + CHECK_EXTENSION(ARB_texture_cube_map, cap); if (state) newenabled |= TEXTURE_CUBE_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) @@ -733,7 +739,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: - CHECK_EXTENSION(EXT_secondary_color); + CHECK_EXTENSION(EXT_secondary_color, cap); if (ctx->Fog.ColorSumEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_FOG); @@ -750,35 +756,35 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - CHECK_EXTENSION(ARB_multisample); + CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.Enabled = state; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - CHECK_EXTENSION(ARB_multisample); + CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleAlphaToCoverage == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToCoverage = state; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - CHECK_EXTENSION(ARB_multisample); + CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleAlphaToOne == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToOne = state; break; case GL_SAMPLE_COVERAGE_ARB: - CHECK_EXTENSION(ARB_multisample); + CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleCoverage == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleCoverage = state; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - CHECK_EXTENSION(ARB_multisample); + CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleCoverageInvert == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); @@ -787,7 +793,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXTENSION(IBM_rasterpos_clip); + CHECK_EXTENSION(IBM_rasterpos_clip, cap); if (ctx->Transform.RasterPositionUnclipped == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); @@ -796,7 +802,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_NV_point_sprite */ case GL_POINT_SPRITE_NV: - CHECK_EXTENSION(NV_point_sprite); + CHECK_EXTENSION(NV_point_sprite, cap); if (ctx->Point.PointSprite == state) return; FLUSH_VERTICES(ctx, _NEW_POINT); @@ -805,21 +811,21 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_NV_vertex_program */ case GL_VERTEX_PROGRAM_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); if (ctx->VertexProgram.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */ ctx->VertexProgram.Enabled = state; break; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); if (ctx->VertexProgram.PointSizeEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM); ctx->VertexProgram.PointSizeEnabled = state; break; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); if (ctx->VertexProgram.TwoSideEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */ @@ -841,7 +847,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_MAP1_VERTEX_ATTRIB13_4_NV: case GL_MAP1_VERTEX_ATTRIB14_4_NV: case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); { const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); FLUSH_VERTICES(ctx, _NEW_EVAL); @@ -864,7 +870,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_MAP2_VERTEX_ATTRIB13_4_NV: case GL_MAP2_VERTEX_ATTRIB14_4_NV: case GL_MAP2_VERTEX_ATTRIB15_4_NV: - CHECK_EXTENSION(NV_vertex_program); + CHECK_EXTENSION(NV_vertex_program, cap); { const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); FLUSH_VERTICES(ctx, _NEW_EVAL); @@ -878,7 +884,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; - CHECK_EXTENSION(NV_texture_rectangle); + CHECK_EXTENSION(NV_texture_rectangle, cap); if (state) newenabled |= TEXTURE_RECT_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) @@ -889,7 +895,11 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) break; default: - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + { + char s[100]; + sprintf(s, "%s(0x%x)", state ? "glEnable" : "glDisable", cap); + _mesa_error(ctx, GL_INVALID_ENUM, s); + } return; } @@ -1262,7 +1272,11 @@ _mesa_IsEnabled( GLenum cap ) } default: - _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); + { + char s[100]; + sprintf(s, "glIsEnabled(0x%x)", (int) cap); + _mesa_error( ctx, GL_INVALID_ENUM, s ); + } return GL_FALSE; } } |