-/* $Id: blend.c,v 1.16 2000/06/29 22:06:22 brianp Exp $ */
+/* $Id: blend.c,v 1.17 2000/08/30 18:21:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
switch (mode) {
case GL_MIN_EXT:
case GL_MAX_EXT:
- case GL_LOGIC_OP:
case GL_FUNC_ADD_EXT:
+ if (ctx->Extensions.HaveBlendMinmax) {
+ ctx->Color.BlendEquation = mode;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
+ return;
+ }
+ case GL_LOGIC_OP:
+ ctx->Color.BlendEquation = mode;
+ break;
case GL_FUNC_SUBTRACT_EXT:
case GL_FUNC_REVERSE_SUBTRACT_EXT:
- ctx->Color.BlendEquation = mode;
+ if (ctx->Extensions.HaveBlendSubtract) {
+ ctx->Color.BlendEquation = mode;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
+ return;
+ }
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glBlendEquation" );
-/* $Id: enable.c,v 1.22 2000/08/21 14:22:24 brianp Exp $ */
+/* $Id: enable.c,v 1.23 2000/08/30 18:21:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
break;
case GL_HISTOGRAM:
- ctx->Pixel.HistogramEnabled = state;
+ if (ctx->Extensions.HaveHistogram) {
+ ctx->Pixel.HistogramEnabled = state;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
case GL_LIGHT0:
case GL_LIGHT1:
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
- if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state)
- {
+ if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) {
ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
if (state) {
case GL_FOG:
return ctx->Fog.Enabled;
case GL_HISTOGRAM:
- return ctx->Pixel.HistogramEnabled;
+ if (ctx->Extensions.HaveHistogram) {
+ return ctx->Pixel.HistogramEnabled;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
case GL_LIGHTING:
return ctx->Light.Enabled;
case GL_LIGHT0:
-/* $Id: extensions.c,v 1.33 2000/08/29 23:31:23 brianp Exp $ */
+/* $Id: extensions.c,v 1.34 2000/08/30 18:21:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ ALWAYS_ENABLED, "GL_EXT_polygon_offset" },
{ ALWAYS_ENABLED, "GL_EXT_rescale_normal" },
{ DEFAULT_ON, "GL_EXT_shared_texture_palette" },
- { ALWAYS_ENABLED, "GL_EXT_stencil_wrap" },
+ { DEFAULT_ON, "GL_EXT_stencil_wrap" },
{ DEFAULT_ON, "GL_EXT_texture3D" },
{ DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" },
- { DEFAULT_OFF, "GL_EXT_texture_env" },
{ DEFAULT_ON, "GL_EXT_texture_env_add" },
{ DEFAULT_OFF, "GL_EXT_texture_env_combine" },
{ ALWAYS_ENABLED, "GL_EXT_texture_object" },
update_extension_flags( GLcontext *ctx )
{
/* Update flags */
+ ctx->Extensions.HaveBlendMinmax = gl_extension_is_enabled(ctx, "GL_EXT_blend_minmax") || gl_extension_is_enabled(ctx, "GL_ARB_imaging");
+ ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square");
+ ctx->Extensions.HaveBlendSubtract = gl_extension_is_enabled(ctx, "GL_EXT_blend_subtract") || gl_extension_is_enabled(ctx, "GL_ARB_imaging");
+ ctx->Extensions.HaveHistogram = gl_extension_is_enabled(ctx, "GL_EXT_histogram") || gl_extension_is_enabled(ctx, "GL_ARB_imaging");
+ ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test");
+ ctx->Extensions.HaveStencilWrap = gl_extension_is_enabled(ctx, "GL_EXT_stencil_wrap");
ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
ctx->Extensions.HaveTextureEnvCombine = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_combine");
- ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
- ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test");
ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map");
ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression");
- ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc");
ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1");
- ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square");
+ ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc");
+ ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
}
-/* $Id: get.c,v 1.31 2000/08/08 16:15:14 brianp Exp $ */
+/* $Id: get.c,v 1.32 2000/08/30 18:21:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale);
break;
case GL_HISTOGRAM:
- *params = ctx->Pixel.HistogramEnabled;
+ if (ctx->Extensions.HaveHistogram) {
+ *params = ctx->Pixel.HistogramEnabled;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
break;
case GL_INDEX_BITS:
*params = INT_TO_BOOL( ctx->Visual->IndexBits );
*params = (GLdouble) ctx->Pixel.GreenScale;
break;
case GL_HISTOGRAM:
- *params = (GLdouble) ctx->Pixel.HistogramEnabled;
+ if (ctx->Extensions.HaveHistogram) {
+ *params = (GLdouble) ctx->Pixel.HistogramEnabled;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
break;
case GL_INDEX_BITS:
*params = (GLdouble) ctx->Visual->IndexBits;
*params = (GLfloat) ctx->Pixel.GreenScale;
break;
case GL_HISTOGRAM:
- *params = (GLfloat) ctx->Pixel.HistogramEnabled;
+ if (ctx->Extensions.HaveHistogram) {
+ *params = (GLfloat) ctx->Pixel.HistogramEnabled;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
break;
case GL_INDEX_BITS:
*params = (GLfloat) ctx->Visual->IndexBits;
*params = (GLint) ctx->Pixel.GreenScale;
break;
case GL_HISTOGRAM:
- *params = (GLint) ctx->Pixel.HistogramEnabled;
+ if (ctx->Extensions.HaveHistogram) {
+ *params = (GLint) ctx->Pixel.HistogramEnabled;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
break;
case GL_INDEX_BITS:
*params = (GLint) ctx->Visual->IndexBits;
-/* $Id: stencil.c,v 1.16 2000/04/11 21:26:57 brianp Exp $ */
+/* $Id: stencil.c,v 1.17 2000/08/30 18:23:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
void
-_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
+_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp");
case GL_INCR:
case GL_DECR:
case GL_INVERT:
- case GL_INCR_WRAP_EXT:
- case GL_DECR_WRAP_EXT:
ctx->Stencil.FailFunc = fail;
break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.HaveStencilWrap) {
+ ctx->Stencil.FailFunc = fail;
+ break;
+ }
+ /* FALL-THROUGH */
default:
- gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" );
+ gl_error(ctx, GL_INVALID_ENUM, "glStencilOp");
return;
}
switch (zfail) {
case GL_INCR:
case GL_DECR:
case GL_INVERT:
- case GL_INCR_WRAP_EXT:
- case GL_DECR_WRAP_EXT:
ctx->Stencil.ZFailFunc = zfail;
break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.HaveStencilWrap) {
+ ctx->Stencil.ZFailFunc = zfail;
+ break;
+ }
+ /* FALL-THROUGH */
default:
- gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" );
+ gl_error(ctx, GL_INVALID_ENUM, "glStencilOp");
return;
}
switch (zpass) {
case GL_INCR:
case GL_DECR:
case GL_INVERT:
- case GL_INCR_WRAP_EXT:
- case GL_DECR_WRAP_EXT:
ctx->Stencil.ZPassFunc = zpass;
break;
+ case GL_INCR_WRAP_EXT:
+ case GL_DECR_WRAP_EXT:
+ if (ctx->Extensions.HaveStencilWrap) {
+ ctx->Stencil.ZPassFunc = zpass;
+ break;
+ }
+ /* FALL-THROUGH */
default:
- gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" );
+ gl_error(ctx, GL_INVALID_ENUM, "glStencilOp");
return;
}
if (ctx->Driver.StencilOp) {
- (*ctx->Driver.StencilOp)( ctx, fail, zfail, zpass );
+ (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass);
}
}