blob: aef516690ae03db606d871e518f50ca800740d05 [file] [log] [blame]
Brian Paul02c03ef2002-06-18 16:53:46 +00001/* $Id: enable.c,v 1.67 2002/06/18 16:53:46 brianp Exp $ */
jtgafb833d1999-08-19 00:55:39 +00002
3/*
4 * Mesa 3-D graphics library
Brian Paul8e6d3052002-01-11 17:26:54 +00005 * Version: 4.1
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00006 *
Brian Paul8e6d3052002-01-11 17:26:54 +00007 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00008 *
jtgafb833d1999-08-19 00:55:39 +00009 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000015 *
jtgafb833d1999-08-19 00:55:39 +000016 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000018 *
jtgafb833d1999-08-19 00:55:39 +000019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28#ifdef PC_HEADER
29#include "all.h"
30#else
Brian Paulfbd8f211999-11-11 01:22:25 +000031#include "glheader.h"
jtgafb833d1999-08-19 00:55:39 +000032#include "context.h"
33#include "enable.h"
34#include "light.h"
35#include "macros.h"
jtgafb833d1999-08-19 00:55:39 +000036#include "mmath.h"
37#include "simple_list.h"
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000038#include "mtypes.h"
jtgafb833d1999-08-19 00:55:39 +000039#include "enums.h"
Keith Whitwell23caf202000-11-16 21:05:34 +000040#include "math/m_matrix.h"
41#include "math/m_xform.h"
jtgafb833d1999-08-19 00:55:39 +000042#endif
43
44
Brian Paul02c03ef2002-06-18 16:53:46 +000045#define CHECK_EXTENSION(EXTNAME, CAP) \
Brian Paul86b84272001-12-14 02:50:01 +000046 if (!ctx->Extensions.EXTNAME) { \
Brian Paul02c03ef2002-06-18 16:53:46 +000047 char s[100]; \
48 sprintf(s, "gl%sClientState(0x%x)", state ? "Enable" : "Disable", CAP);\
49 _mesa_error(ctx, GL_INVALID_ENUM, s); \
Brian Paul86b84272001-12-14 02:50:01 +000050 return; \
51 }
52
53
54
Keith Whitwellcab974c2000-12-26 05:09:27 +000055static void
56client_state( GLcontext *ctx, GLenum cap, GLboolean state )
57{
58 GLuint flag;
Brian Paul8e6d3052002-01-11 17:26:54 +000059 GLuint *var;
Keith Whitwellcab974c2000-12-26 05:09:27 +000060
61 switch (cap) {
Brian Paul86b84272001-12-14 02:50:01 +000062 case GL_VERTEX_ARRAY:
63 var = &ctx->Array.Vertex.Enabled;
64 flag = _NEW_ARRAY_VERTEX;
65 break;
66 case GL_NORMAL_ARRAY:
67 var = &ctx->Array.Normal.Enabled;
68 flag = _NEW_ARRAY_NORMAL;
69 break;
70 case GL_COLOR_ARRAY:
71 var = &ctx->Array.Color.Enabled;
72 flag = _NEW_ARRAY_COLOR0;
73 break;
74 case GL_INDEX_ARRAY:
75 var = &ctx->Array.Index.Enabled;
76 flag = _NEW_ARRAY_INDEX;
77 break;
78 case GL_TEXTURE_COORD_ARRAY:
79 var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
80 flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
81 break;
82 case GL_EDGE_FLAG_ARRAY:
83 var = &ctx->Array.EdgeFlag.Enabled;
84 flag = _NEW_ARRAY_EDGEFLAG;
85 break;
86 case GL_FOG_COORDINATE_ARRAY_EXT:
87 var = &ctx->Array.FogCoord.Enabled;
88 flag = _NEW_ARRAY_FOGCOORD;
89 break;
90 case GL_SECONDARY_COLOR_ARRAY_EXT:
91 var = &ctx->Array.SecondaryColor.Enabled;
92 flag = _NEW_ARRAY_COLOR1;
93 break;
94
95 /* GL_NV_vertex_program */
96 case GL_VERTEX_ATTRIB_ARRAY0_NV:
97 case GL_VERTEX_ATTRIB_ARRAY1_NV:
98 case GL_VERTEX_ATTRIB_ARRAY2_NV:
99 case GL_VERTEX_ATTRIB_ARRAY3_NV:
100 case GL_VERTEX_ATTRIB_ARRAY4_NV:
101 case GL_VERTEX_ATTRIB_ARRAY5_NV:
102 case GL_VERTEX_ATTRIB_ARRAY6_NV:
103 case GL_VERTEX_ATTRIB_ARRAY7_NV:
104 case GL_VERTEX_ATTRIB_ARRAY8_NV:
105 case GL_VERTEX_ATTRIB_ARRAY9_NV:
106 case GL_VERTEX_ATTRIB_ARRAY10_NV:
107 case GL_VERTEX_ATTRIB_ARRAY11_NV:
108 case GL_VERTEX_ATTRIB_ARRAY12_NV:
109 case GL_VERTEX_ATTRIB_ARRAY13_NV:
110 case GL_VERTEX_ATTRIB_ARRAY14_NV:
111 case GL_VERTEX_ATTRIB_ARRAY15_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000112 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000113 {
114 GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
115 var = &ctx->Array.VertexAttrib[n].Enabled;
Brian Paulb7752722002-04-21 18:49:18 +0000116 flag = _NEW_ARRAY_ATTRIB(n);
Brian Paul86b84272001-12-14 02:50:01 +0000117 }
118 break;
119 default:
Brian Paul02c03ef2002-06-18 16:53:46 +0000120 {
121 char s[100];
122 sprintf(s, "glEnable/DisableClientState(0x%x)", cap);
123 _mesa_error( ctx, GL_INVALID_ENUM, s);
124 }
Brian Paul86b84272001-12-14 02:50:01 +0000125 return;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000126 }
127
Alan Hourihane68c48df2002-04-19 08:38:23 +0000128 if (*var == state)
Keith Whitwellcab974c2000-12-26 05:09:27 +0000129 return;
130
131 FLUSH_VERTICES(ctx, _NEW_ARRAY);
132 ctx->Array.NewState |= flag;
133 *var = state;
134
Gareth Hughes22144ab2001-03-12 00:48:37 +0000135 if (state)
Keith Whitwellcab974c2000-12-26 05:09:27 +0000136 ctx->Array._Enabled |= flag;
137 else
138 ctx->Array._Enabled &= ~flag;
139
140 if (ctx->Driver.Enable) {
141 (*ctx->Driver.Enable)( ctx, cap, state );
142 }
143}
144
145
146
147void
148_mesa_EnableClientState( GLenum cap )
149{
150 GET_CURRENT_CONTEXT(ctx);
151 ASSERT_OUTSIDE_BEGIN_END(ctx);
152 client_state( ctx, cap, GL_TRUE );
153}
154
155
156
157void
158_mesa_DisableClientState( GLenum cap )
159{
160 GET_CURRENT_CONTEXT(ctx);
161 ASSERT_OUTSIDE_BEGIN_END(ctx);
162 client_state( ctx, cap, GL_FALSE );
163}
164
jtgafb833d1999-08-19 00:55:39 +0000165
Brian Paul86b84272001-12-14 02:50:01 +0000166#undef CHECK_EXTENSION
Brian Paul02c03ef2002-06-18 16:53:46 +0000167#define CHECK_EXTENSION(EXTNAME, CAP) \
168 if (!ctx->Extensions.EXTNAME) { \
169 char s[100]; \
170 sprintf(s, "gl%s(0x%x)", state ? "Enable" : "Disable", CAP); \
171 _mesa_error(ctx, GL_INVALID_ENUM, s); \
172 return; \
Brian Paul86b84272001-12-14 02:50:01 +0000173 }
174
175
jtgafb833d1999-08-19 00:55:39 +0000176/*
177 * Perform glEnable and glDisable calls.
178 */
Brian Paulfbd8f211999-11-11 01:22:25 +0000179void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
jtgafb833d1999-08-19 00:55:39 +0000180{
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000181 if (MESA_VERBOSE & VERBOSE_API)
Brian Paul4753d602002-06-15 02:38:15 +0000182 _mesa_debug(ctx, "%s %s (newstate is %x)\n",
Brian Paul9a33a112002-06-13 04:28:29 +0000183 state ? "glEnable" : "glDisable",
184 _mesa_lookup_enum_by_nr(cap),
185 ctx->NewState);
jtgafb833d1999-08-19 00:55:39 +0000186
187 switch (cap) {
Brian Paul86b84272001-12-14 02:50:01 +0000188 case GL_ALPHA_TEST:
189 if (ctx->Color.AlphaEnabled == state)
190 return;
191 FLUSH_VERTICES(ctx, _NEW_COLOR);
192 ctx->Color.AlphaEnabled = state;
193 break;
194 case GL_AUTO_NORMAL:
195 if (ctx->Eval.AutoNormal == state)
196 return;
197 FLUSH_VERTICES(ctx, _NEW_EVAL);
198 ctx->Eval.AutoNormal = state;
199 break;
200 case GL_BLEND:
201 if (ctx->Color.BlendEnabled == state)
202 return;
203 FLUSH_VERTICES(ctx, _NEW_COLOR);
204 ctx->Color.BlendEnabled = state;
205 /* The following needed to accomodate 1.0 RGB logic op blending */
206 ctx->Color.ColorLogicOpEnabled =
207 (ctx->Color.BlendEquation == GL_LOGIC_OP && state);
208 break;
209 case GL_CLIP_PLANE0:
210 case GL_CLIP_PLANE1:
211 case GL_CLIP_PLANE2:
212 case GL_CLIP_PLANE3:
213 case GL_CLIP_PLANE4:
214 case GL_CLIP_PLANE5:
215 {
Brian Paul103bc0f2002-03-29 17:27:59 +0000216 const GLuint p = cap - GL_CLIP_PLANE0;
jtgafb833d1999-08-19 00:55:39 +0000217
Brian Pauldb07de02002-04-19 00:23:08 +0000218 if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p))
Brian Paul86b84272001-12-14 02:50:01 +0000219 return;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000220
Brian Paul86b84272001-12-14 02:50:01 +0000221 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
jtgafb833d1999-08-19 00:55:39 +0000222
Brian Paul86b84272001-12-14 02:50:01 +0000223 if (state) {
Brian Paul103bc0f2002-03-29 17:27:59 +0000224 ctx->Transform.ClipPlanesEnabled |= (1 << p);
Keith Whitwellcab974c2000-12-26 05:09:27 +0000225
Brian Paul103bc0f2002-03-29 17:27:59 +0000226 if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
Brian Paul30f51ae2001-12-18 04:06:44 +0000227 _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
Gareth Hughes22144ab2001-03-12 00:48:37 +0000228
Brian Paul86b84272001-12-14 02:50:01 +0000229 /* This derived state also calculated in clip.c and
230 * from _mesa_update_state() on changes to EyeUserPlane
231 * and ctx->ProjectionMatrix respectively.
232 */
233 _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
234 ctx->Transform.EyeUserPlane[p],
Brian Paul30f51ae2001-12-18 04:06:44 +0000235 ctx->ProjectionMatrixStack.Top->inv );
Brian Paul86b84272001-12-14 02:50:01 +0000236 }
Brian Paulf66de792002-03-28 22:45:45 +0000237 else {
Brian Paul103bc0f2002-03-29 17:27:59 +0000238 ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
Brian Paulf66de792002-03-28 22:45:45 +0000239 }
Brian Paul86b84272001-12-14 02:50:01 +0000240 }
241 break;
242 case GL_COLOR_MATERIAL:
243 if (ctx->Light.ColorMaterialEnabled == state)
244 return;
245 FLUSH_VERTICES(ctx, _NEW_LIGHT);
246 ctx->Light.ColorMaterialEnabled = state;
247 if (state) {
248 FLUSH_CURRENT(ctx, 0);
249 _mesa_update_color_material( ctx,
250 ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
251 }
252 break;
253 case GL_CULL_FACE:
254 if (ctx->Polygon.CullFlag == state)
255 return;
256 FLUSH_VERTICES(ctx, _NEW_POLYGON);
257 ctx->Polygon.CullFlag = state;
258 break;
259 case GL_DEPTH_TEST:
260 if (state && ctx->Visual.depthBits==0) {
261 _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
262 return;
263 }
264 if (ctx->Depth.Test==state)
265 return;
266 FLUSH_VERTICES(ctx, _NEW_DEPTH);
267 ctx->Depth.Test = state;
268 break;
269 case GL_DITHER:
270 if (ctx->NoDither) {
271 state = GL_FALSE; /* MESA_NO_DITHER env var */
272 }
273 if (ctx->Color.DitherFlag==state)
274 return;
275 FLUSH_VERTICES(ctx, _NEW_COLOR);
276 ctx->Color.DitherFlag = state;
277 break;
278 case GL_FOG:
279 if (ctx->Fog.Enabled==state)
280 return;
281 FLUSH_VERTICES(ctx, _NEW_FOG);
282 ctx->Fog.Enabled = state;
283 break;
284 case GL_HISTOGRAM:
Brian Paul02c03ef2002-06-18 16:53:46 +0000285 CHECK_EXTENSION(EXT_histogram, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000286 if (ctx->Pixel.HistogramEnabled == state)
287 return;
288 FLUSH_VERTICES(ctx, _NEW_PIXEL);
289 ctx->Pixel.HistogramEnabled = state;
290 break;
291 case GL_LIGHT0:
292 case GL_LIGHT1:
293 case GL_LIGHT2:
294 case GL_LIGHT3:
295 case GL_LIGHT4:
296 case GL_LIGHT5:
297 case GL_LIGHT6:
298 case GL_LIGHT7:
299 if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
300 return;
301 FLUSH_VERTICES(ctx, _NEW_LIGHT);
302 ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
303 if (state) {
304 insert_at_tail(&ctx->Light.EnabledList,
305 &ctx->Light.Light[cap-GL_LIGHT0]);
306 }
307 else {
308 remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
309 }
310 break;
311 case GL_LIGHTING:
312 if (ctx->Light.Enabled == state)
313 return;
314 FLUSH_VERTICES(ctx, _NEW_LIGHT);
315 ctx->Light.Enabled = state;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000316
Keith Whitwell0cb28412002-02-13 00:53:19 +0000317 if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
318 ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
319 else
320 ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
321
Brian Paul86b84272001-12-14 02:50:01 +0000322 if ((ctx->Light.Enabled &&
323 ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
324 || ctx->Fog.ColorSumEnabled)
325 ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
326 else
327 ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
328
329 break;
330 case GL_LINE_SMOOTH:
331 if (ctx->Line.SmoothFlag == state)
332 return;
333 FLUSH_VERTICES(ctx, _NEW_LINE);
334 ctx->Line.SmoothFlag = state;
335 ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
336 break;
337 case GL_LINE_STIPPLE:
338 if (ctx->Line.StippleFlag == state)
339 return;
340 FLUSH_VERTICES(ctx, _NEW_LINE);
341 ctx->Line.StippleFlag = state;
342 ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
343 break;
344 case GL_INDEX_LOGIC_OP:
345 if (ctx->Color.IndexLogicOpEnabled == state)
346 return;
347 FLUSH_VERTICES(ctx, _NEW_COLOR);
348 ctx->Color.IndexLogicOpEnabled = state;
349 break;
350 case GL_COLOR_LOGIC_OP:
351 if (ctx->Color.ColorLogicOpEnabled == state)
352 return;
353 FLUSH_VERTICES(ctx, _NEW_COLOR);
354 ctx->Color.ColorLogicOpEnabled = state;
355 break;
356 case GL_MAP1_COLOR_4:
357 if (ctx->Eval.Map1Color4 == state)
358 return;
359 FLUSH_VERTICES(ctx, _NEW_EVAL);
360 ctx->Eval.Map1Color4 = state;
361 break;
362 case GL_MAP1_INDEX:
363 if (ctx->Eval.Map1Index == state)
364 return;
365 FLUSH_VERTICES(ctx, _NEW_EVAL);
366 ctx->Eval.Map1Index = state;
367 break;
368 case GL_MAP1_NORMAL:
369 if (ctx->Eval.Map1Normal == state)
370 return;
371 FLUSH_VERTICES(ctx, _NEW_EVAL);
372 ctx->Eval.Map1Normal = state;
373 break;
374 case GL_MAP1_TEXTURE_COORD_1:
375 if (ctx->Eval.Map1TextureCoord1 == state)
376 return;
377 FLUSH_VERTICES(ctx, _NEW_EVAL);
378 ctx->Eval.Map1TextureCoord1 = state;
379 break;
380 case GL_MAP1_TEXTURE_COORD_2:
381 if (ctx->Eval.Map1TextureCoord2 == state)
382 return;
383 FLUSH_VERTICES(ctx, _NEW_EVAL);
384 ctx->Eval.Map1TextureCoord2 = state;
385 break;
386 case GL_MAP1_TEXTURE_COORD_3:
387 if (ctx->Eval.Map1TextureCoord3 == state)
388 return;
389 FLUSH_VERTICES(ctx, _NEW_EVAL);
390 ctx->Eval.Map1TextureCoord3 = state;
391 break;
392 case GL_MAP1_TEXTURE_COORD_4:
393 if (ctx->Eval.Map1TextureCoord4 == state)
394 return;
395 FLUSH_VERTICES(ctx, _NEW_EVAL);
396 ctx->Eval.Map1TextureCoord4 = state;
397 break;
398 case GL_MAP1_VERTEX_3:
399 if (ctx->Eval.Map1Vertex3 == state)
400 return;
401 FLUSH_VERTICES(ctx, _NEW_EVAL);
402 ctx->Eval.Map1Vertex3 = state;
403 break;
404 case GL_MAP1_VERTEX_4:
405 if (ctx->Eval.Map1Vertex4 == state)
406 return;
407 FLUSH_VERTICES(ctx, _NEW_EVAL);
408 ctx->Eval.Map1Vertex4 = state;
409 break;
410 case GL_MAP2_COLOR_4:
411 if (ctx->Eval.Map2Color4 == state)
412 return;
413 FLUSH_VERTICES(ctx, _NEW_EVAL);
414 ctx->Eval.Map2Color4 = state;
415 break;
416 case GL_MAP2_INDEX:
417 if (ctx->Eval.Map2Index == state)
418 return;
419 FLUSH_VERTICES(ctx, _NEW_EVAL);
420 ctx->Eval.Map2Index = state;
421 break;
422 case GL_MAP2_NORMAL:
423 if (ctx->Eval.Map2Normal == state)
424 return;
425 FLUSH_VERTICES(ctx, _NEW_EVAL);
426 ctx->Eval.Map2Normal = state;
427 break;
428 case GL_MAP2_TEXTURE_COORD_1:
429 if (ctx->Eval.Map2TextureCoord1 == state)
430 return;
431 FLUSH_VERTICES(ctx, _NEW_EVAL);
432 ctx->Eval.Map2TextureCoord1 = state;
433 break;
434 case GL_MAP2_TEXTURE_COORD_2:
435 if (ctx->Eval.Map2TextureCoord2 == state)
436 return;
437 FLUSH_VERTICES(ctx, _NEW_EVAL);
438 ctx->Eval.Map2TextureCoord2 = state;
439 break;
440 case GL_MAP2_TEXTURE_COORD_3:
441 if (ctx->Eval.Map2TextureCoord3 == state)
442 return;
443 FLUSH_VERTICES(ctx, _NEW_EVAL);
444 ctx->Eval.Map2TextureCoord3 = state;
445 break;
446 case GL_MAP2_TEXTURE_COORD_4:
447 if (ctx->Eval.Map2TextureCoord4 == state)
448 return;
449 FLUSH_VERTICES(ctx, _NEW_EVAL);
450 ctx->Eval.Map2TextureCoord4 = state;
451 break;
452 case GL_MAP2_VERTEX_3:
453 if (ctx->Eval.Map2Vertex3 == state)
454 return;
455 FLUSH_VERTICES(ctx, _NEW_EVAL);
456 ctx->Eval.Map2Vertex3 = state;
457 break;
458 case GL_MAP2_VERTEX_4:
459 if (ctx->Eval.Map2Vertex4 == state)
460 return;
461 FLUSH_VERTICES(ctx, _NEW_EVAL);
462 ctx->Eval.Map2Vertex4 = state;
463 break;
464 case GL_MINMAX:
465 if (ctx->Pixel.MinMaxEnabled == state)
466 return;
467 FLUSH_VERTICES(ctx, _NEW_PIXEL);
468 ctx->Pixel.MinMaxEnabled = state;
469 break;
470 case GL_NORMALIZE:
471 if (ctx->Transform.Normalize == state)
472 return;
473 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
474 ctx->Transform.Normalize = state;
475 break;
476 case GL_POINT_SMOOTH:
477 if (ctx->Point.SmoothFlag==state)
478 return;
479 FLUSH_VERTICES(ctx, _NEW_POINT);
480 ctx->Point.SmoothFlag = state;
481 ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
482 break;
483 case GL_POLYGON_SMOOTH:
484 if (ctx->Polygon.SmoothFlag==state)
485 return;
486 FLUSH_VERTICES(ctx, _NEW_POLYGON);
487 ctx->Polygon.SmoothFlag = state;
488 ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
489 break;
490 case GL_POLYGON_STIPPLE:
491 if (ctx->Polygon.StippleFlag==state)
492 return;
493 FLUSH_VERTICES(ctx, _NEW_POLYGON);
494 ctx->Polygon.StippleFlag = state;
495 ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
496 break;
497 case GL_POLYGON_OFFSET_POINT:
498 if (ctx->Polygon.OffsetPoint==state)
499 return;
500 FLUSH_VERTICES(ctx, _NEW_POLYGON);
501 ctx->Polygon.OffsetPoint = state;
502 break;
503 case GL_POLYGON_OFFSET_LINE:
504 if (ctx->Polygon.OffsetLine==state)
505 return;
506 FLUSH_VERTICES(ctx, _NEW_POLYGON);
507 ctx->Polygon.OffsetLine = state;
508 break;
509 case GL_POLYGON_OFFSET_FILL:
510 /*case GL_POLYGON_OFFSET_EXT:*/
511 if (ctx->Polygon.OffsetFill==state)
512 return;
513 FLUSH_VERTICES(ctx, _NEW_POLYGON);
514 ctx->Polygon.OffsetFill = state;
515 break;
516 case GL_RESCALE_NORMAL_EXT:
517 if (ctx->Transform.RescaleNormals == state)
518 return;
519 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
520 ctx->Transform.RescaleNormals = state;
521 break;
522 case GL_SCISSOR_TEST:
523 if (ctx->Scissor.Enabled==state)
524 return;
525 FLUSH_VERTICES(ctx, _NEW_SCISSOR);
526 ctx->Scissor.Enabled = state;
527 break;
528 case GL_SHARED_TEXTURE_PALETTE_EXT:
529 if (ctx->Texture.SharedPalette == state)
530 return;
531 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
532 ctx->Texture.SharedPalette = state;
533 break;
534 case GL_STENCIL_TEST:
535 if (state && ctx->Visual.stencilBits==0) {
536 _mesa_warning(ctx,
537 "glEnable(GL_STENCIL_TEST) but no stencil buffer");
538 return;
539 }
540 if (ctx->Stencil.Enabled==state)
541 return;
542 FLUSH_VERTICES(ctx, _NEW_STENCIL);
543 ctx->Stencil.Enabled = state;
544 break;
545 case GL_TEXTURE_1D: {
546 const GLuint curr = ctx->Texture.CurrentUnit;
547 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000548 GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000549 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000550 newenabled |= TEXTURE_1D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000551 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
552 return;
553 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
554 texUnit->Enabled = newenabled;
555 break;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000556 }
Brian Paul86b84272001-12-14 02:50:01 +0000557 case GL_TEXTURE_2D: {
558 const GLuint curr = ctx->Texture.CurrentUnit;
559 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000560 GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000561 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000562 newenabled |= TEXTURE_2D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000563 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
564 return;
565 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
566 texUnit->Enabled = newenabled;
567 break;
568 }
569 case GL_TEXTURE_3D: {
570 const GLuint curr = ctx->Texture.CurrentUnit;
571 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000572 GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000573 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000574 newenabled |= TEXTURE_3D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000575 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
576 return;
577 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
578 texUnit->Enabled = newenabled;
579 break;
580 }
581 case GL_TEXTURE_GEN_Q: {
582 GLuint unit = ctx->Texture.CurrentUnit;
583 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
584 GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
585 if (state)
586 newenabled |= Q_BIT;
587 if (texUnit->TexGenEnabled == newenabled)
588 return;
589 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
590 texUnit->TexGenEnabled = newenabled;
591 break;
592 }
593 case GL_TEXTURE_GEN_R: {
594 GLuint unit = ctx->Texture.CurrentUnit;
595 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
596 GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
597 if (state)
598 newenabled |= R_BIT;
599 if (texUnit->TexGenEnabled == newenabled)
600 return;
601 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
602 texUnit->TexGenEnabled = newenabled;
603 break;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000604 }
605 break;
Brian Paul86b84272001-12-14 02:50:01 +0000606 case GL_TEXTURE_GEN_S: {
607 GLuint unit = ctx->Texture.CurrentUnit;
608 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
609 GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
610 if (state)
611 newenabled |= S_BIT;
612 if (texUnit->TexGenEnabled == newenabled)
613 return;
614 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
615 texUnit->TexGenEnabled = newenabled;
616 break;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000617 }
618 break;
Brian Paul86b84272001-12-14 02:50:01 +0000619 case GL_TEXTURE_GEN_T: {
620 GLuint unit = ctx->Texture.CurrentUnit;
621 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
622 GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
623 if (state)
624 newenabled |= T_BIT;
625 if (texUnit->TexGenEnabled == newenabled)
626 return;
627 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
628 texUnit->TexGenEnabled = newenabled;
629 break;
630 }
631 break;
Keith Whitwell46b09882001-02-16 18:14:41 +0000632
Brian Paul86b84272001-12-14 02:50:01 +0000633 /*
634 * CLIENT STATE!!!
635 */
636 case GL_VERTEX_ARRAY:
637 case GL_NORMAL_ARRAY:
638 case GL_COLOR_ARRAY:
639 case GL_INDEX_ARRAY:
640 case GL_TEXTURE_COORD_ARRAY:
641 case GL_EDGE_FLAG_ARRAY:
642 case GL_FOG_COORDINATE_ARRAY_EXT:
643 case GL_SECONDARY_COLOR_ARRAY_EXT:
644 client_state( ctx, cap, state );
645 return;
jtgafb833d1999-08-19 00:55:39 +0000646
Brian Paul1b2ff692000-03-11 23:23:26 +0000647 /* GL_HP_occlusion_test */
Brian Paul86b84272001-12-14 02:50:01 +0000648 case GL_OCCLUSION_TEST_HP:
Brian Paul02c03ef2002-06-18 16:53:46 +0000649 CHECK_EXTENSION(HP_occlusion_test, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000650 if (ctx->Depth.OcclusionTest == state)
651 return;
652 FLUSH_VERTICES(ctx, _NEW_DEPTH);
653 ctx->Depth.OcclusionTest = state;
654 if (state)
655 ctx->OcclusionResult = ctx->OcclusionResultSaved;
656 else
657 ctx->OcclusionResultSaved = ctx->OcclusionResult;
658 break;
Brian Paul1b2ff692000-03-11 23:23:26 +0000659
Brian Paul2b2e9252000-04-07 16:27:26 +0000660 /* GL_SGIS_pixel_texture */
Brian Paul86b84272001-12-14 02:50:01 +0000661 case GL_PIXEL_TEXTURE_SGIS:
Brian Paul02c03ef2002-06-18 16:53:46 +0000662 CHECK_EXTENSION(SGIS_pixel_texture, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000663 if (ctx->Pixel.PixelTextureEnabled == state)
664 return;
665 FLUSH_VERTICES(ctx, _NEW_PIXEL);
666 ctx->Pixel.PixelTextureEnabled = state;
667 break;
Brian Paul2b2e9252000-04-07 16:27:26 +0000668
669 /* GL_SGIX_pixel_texture */
Brian Paul86b84272001-12-14 02:50:01 +0000670 case GL_PIXEL_TEX_GEN_SGIX:
Brian Paul02c03ef2002-06-18 16:53:46 +0000671 CHECK_EXTENSION(SGIX_pixel_texture, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000672 if (ctx->Pixel.PixelTextureEnabled == state)
673 return;
674 FLUSH_VERTICES(ctx, _NEW_PIXEL);
675 ctx->Pixel.PixelTextureEnabled = state;
676 break;
Brian Paul2b2e9252000-04-07 16:27:26 +0000677
Brian Paul13811372000-04-12 00:27:37 +0000678 /* GL_SGI_color_table */
Brian Paul86b84272001-12-14 02:50:01 +0000679 case GL_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000680 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000681 if (ctx->Pixel.ColorTableEnabled == state)
682 return;
683 FLUSH_VERTICES(ctx, _NEW_PIXEL);
684 ctx->Pixel.ColorTableEnabled = state;
685 break;
686 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000687 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000688 if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
689 return;
690 FLUSH_VERTICES(ctx, _NEW_PIXEL);
691 ctx->Pixel.PostConvolutionColorTableEnabled = state;
692 break;
693 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000694 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000695 if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
696 return;
697 FLUSH_VERTICES(ctx, _NEW_PIXEL);
698 ctx->Pixel.PostColorMatrixColorTableEnabled = state;
699 break;
Brian Paul13811372000-04-12 00:27:37 +0000700
Brian Paul82b02f02000-05-07 20:37:40 +0000701 /* GL_EXT_convolution */
Brian Paul86b84272001-12-14 02:50:01 +0000702 case GL_CONVOLUTION_1D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000703 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000704 if (ctx->Pixel.Convolution1DEnabled == state)
705 return;
706 FLUSH_VERTICES(ctx, _NEW_PIXEL);
707 ctx->Pixel.Convolution1DEnabled = state;
708 break;
709 case GL_CONVOLUTION_2D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000710 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000711 if (ctx->Pixel.Convolution2DEnabled == state)
712 return;
713 FLUSH_VERTICES(ctx, _NEW_PIXEL);
714 ctx->Pixel.Convolution2DEnabled = state;
715 break;
716 case GL_SEPARABLE_2D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000717 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000718 if (ctx->Pixel.Separable2DEnabled == state)
719 return;
720 FLUSH_VERTICES(ctx, _NEW_PIXEL);
721 ctx->Pixel.Separable2DEnabled = state;
722 break;
Brian Paul82b02f02000-05-07 20:37:40 +0000723
Brian Paul86fc3702000-05-22 16:33:20 +0000724 /* GL_ARB_texture_cube_map */
Brian Paul86b84272001-12-14 02:50:01 +0000725 case GL_TEXTURE_CUBE_MAP_ARB:
726 {
727 const GLuint curr = ctx->Texture.CurrentUnit;
728 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000729 GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT;
Brian Paul02c03ef2002-06-18 16:53:46 +0000730 CHECK_EXTENSION(ARB_texture_cube_map, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000731 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000732 newenabled |= TEXTURE_CUBE_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000733 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
734 return;
735 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
736 texUnit->Enabled = newenabled;
737 }
738 break;
739
Keith Whitwellfe5d67d2000-10-27 16:44:40 +0000740 /* GL_EXT_secondary_color */
Brian Paul86b84272001-12-14 02:50:01 +0000741 case GL_COLOR_SUM_EXT:
Brian Paul02c03ef2002-06-18 16:53:46 +0000742 CHECK_EXTENSION(EXT_secondary_color, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000743 if (ctx->Fog.ColorSumEnabled == state)
744 return;
745 FLUSH_VERTICES(ctx, _NEW_FOG);
746 ctx->Fog.ColorSumEnabled = state;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000747
Brian Paul86b84272001-12-14 02:50:01 +0000748 if ((ctx->Light.Enabled &&
749 ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
750 || ctx->Fog.ColorSumEnabled)
751 ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
752 else
753 ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
Keith Whitwell46b09882001-02-16 18:14:41 +0000754
Brian Paul86b84272001-12-14 02:50:01 +0000755 break;
Brian Paul06d05af2000-12-08 00:20:15 +0000756
Brian Paul736fcbe2001-05-29 15:23:48 +0000757 /* GL_ARB_multisample */
Brian Paul86b84272001-12-14 02:50:01 +0000758 case GL_MULTISAMPLE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000759 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000760 if (ctx->Multisample.Enabled == state)
761 return;
762 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
763 ctx->Multisample.Enabled = state;
764 break;
765 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000766 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000767 if (ctx->Multisample.SampleAlphaToCoverage == state)
768 return;
769 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
770 ctx->Multisample.SampleAlphaToCoverage = state;
771 break;
772 case GL_SAMPLE_ALPHA_TO_ONE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000773 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000774 if (ctx->Multisample.SampleAlphaToOne == state)
775 return;
776 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
777 ctx->Multisample.SampleAlphaToOne = state;
778 break;
779 case GL_SAMPLE_COVERAGE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000780 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000781 if (ctx->Multisample.SampleCoverage == state)
782 return;
783 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
784 ctx->Multisample.SampleCoverage = state;
785 break;
786 case GL_SAMPLE_COVERAGE_INVERT_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000787 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000788 if (ctx->Multisample.SampleCoverageInvert == state)
789 return;
790 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
791 ctx->Multisample.SampleCoverageInvert = state;
792 break;
Brian Paul8c2f6c52001-06-26 01:32:48 +0000793
794 /* GL_IBM_rasterpos_clip */
Brian Paul86b84272001-12-14 02:50:01 +0000795 case GL_RASTER_POSITION_UNCLIPPED_IBM:
Brian Paul02c03ef2002-06-18 16:53:46 +0000796 CHECK_EXTENSION(IBM_rasterpos_clip, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000797 if (ctx->Transform.RasterPositionUnclipped == state)
798 return;
799 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
800 ctx->Transform.RasterPositionUnclipped = state;
801 break;
Brian Paul736fcbe2001-05-29 15:23:48 +0000802
Brian Paul6c408b42002-05-27 17:04:52 +0000803 /* GL_NV_point_sprite */
804 case GL_POINT_SPRITE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000805 CHECK_EXTENSION(NV_point_sprite, cap);
Brian Paul6c408b42002-05-27 17:04:52 +0000806 if (ctx->Point.PointSprite == state)
Brian Paul86b84272001-12-14 02:50:01 +0000807 return;
808 FLUSH_VERTICES(ctx, _NEW_POINT);
Brian Paul6c408b42002-05-27 17:04:52 +0000809 ctx->Point.PointSprite = state;
Brian Paul86b84272001-12-14 02:50:01 +0000810 break;
Keith Whitwellfe5d67d2000-10-27 16:44:40 +0000811
Brian Paul86b84272001-12-14 02:50:01 +0000812 /* GL_NV_vertex_program */
813 case GL_VERTEX_PROGRAM_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000814 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000815 if (ctx->VertexProgram.Enabled == state)
816 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000817 FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */
Brian Paul86b84272001-12-14 02:50:01 +0000818 ctx->VertexProgram.Enabled = state;
819 break;
820 case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000821 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000822 if (ctx->VertexProgram.PointSizeEnabled == state)
823 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000824 FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM);
Brian Paul86b84272001-12-14 02:50:01 +0000825 ctx->VertexProgram.PointSizeEnabled = state;
826 break;
827 case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000828 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000829 if (ctx->VertexProgram.TwoSideEnabled == state)
830 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000831 FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */
Brian Paul86b84272001-12-14 02:50:01 +0000832 ctx->VertexProgram.TwoSideEnabled = state;
833 break;
834 case GL_MAP1_VERTEX_ATTRIB0_4_NV:
835 case GL_MAP1_VERTEX_ATTRIB1_4_NV:
836 case GL_MAP1_VERTEX_ATTRIB2_4_NV:
837 case GL_MAP1_VERTEX_ATTRIB3_4_NV:
838 case GL_MAP1_VERTEX_ATTRIB4_4_NV:
839 case GL_MAP1_VERTEX_ATTRIB5_4_NV:
840 case GL_MAP1_VERTEX_ATTRIB6_4_NV:
841 case GL_MAP1_VERTEX_ATTRIB7_4_NV:
842 case GL_MAP1_VERTEX_ATTRIB8_4_NV:
843 case GL_MAP1_VERTEX_ATTRIB9_4_NV:
844 case GL_MAP1_VERTEX_ATTRIB10_4_NV:
845 case GL_MAP1_VERTEX_ATTRIB11_4_NV:
846 case GL_MAP1_VERTEX_ATTRIB12_4_NV:
847 case GL_MAP1_VERTEX_ATTRIB13_4_NV:
848 case GL_MAP1_VERTEX_ATTRIB14_4_NV:
849 case GL_MAP1_VERTEX_ATTRIB15_4_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000850 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paulbc42c192002-01-05 21:53:20 +0000851 {
852 const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
853 FLUSH_VERTICES(ctx, _NEW_EVAL);
854 ctx->Eval.Map1Attrib[map] = state;
855 }
Brian Paul86b84272001-12-14 02:50:01 +0000856 break;
857 case GL_MAP2_VERTEX_ATTRIB0_4_NV:
858 case GL_MAP2_VERTEX_ATTRIB1_4_NV:
859 case GL_MAP2_VERTEX_ATTRIB2_4_NV:
860 case GL_MAP2_VERTEX_ATTRIB3_4_NV:
861 case GL_MAP2_VERTEX_ATTRIB4_4_NV:
862 case GL_MAP2_VERTEX_ATTRIB5_4_NV:
863 case GL_MAP2_VERTEX_ATTRIB6_4_NV:
864 case GL_MAP2_VERTEX_ATTRIB7_4_NV:
865 case GL_MAP2_VERTEX_ATTRIB8_4_NV:
866 case GL_MAP2_VERTEX_ATTRIB9_4_NV:
867 case GL_MAP2_VERTEX_ATTRIB10_4_NV:
868 case GL_MAP2_VERTEX_ATTRIB11_4_NV:
869 case GL_MAP2_VERTEX_ATTRIB12_4_NV:
870 case GL_MAP2_VERTEX_ATTRIB13_4_NV:
871 case GL_MAP2_VERTEX_ATTRIB14_4_NV:
872 case GL_MAP2_VERTEX_ATTRIB15_4_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000873 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paulbc42c192002-01-05 21:53:20 +0000874 {
875 const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
876 FLUSH_VERTICES(ctx, _NEW_EVAL);
877 ctx->Eval.Map2Attrib[map] = state;
878 }
Brian Paul86b84272001-12-14 02:50:01 +0000879 break;
880
Brian Paul8afe7de2002-06-15 03:03:06 +0000881 /* GL_NV_texture_rectangle */
882 case GL_TEXTURE_RECTANGLE_NV:
883 {
884 const GLuint curr = ctx->Texture.CurrentUnit;
885 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
886 GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT;
Brian Paul02c03ef2002-06-18 16:53:46 +0000887 CHECK_EXTENSION(NV_texture_rectangle, cap);
Brian Paul8afe7de2002-06-15 03:03:06 +0000888 if (state)
889 newenabled |= TEXTURE_RECT_BIT;
890 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
891 return;
892 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
893 texUnit->Enabled = newenabled;
894 }
895 break;
896
Brian Paul86b84272001-12-14 02:50:01 +0000897 default:
Brian Paul02c03ef2002-06-18 16:53:46 +0000898 {
899 char s[100];
900 sprintf(s, "%s(0x%x)", state ? "glEnable" : "glDisable", cap);
901 _mesa_error(ctx, GL_INVALID_ENUM, s);
902 }
Brian Paul86b84272001-12-14 02:50:01 +0000903 return;
jtgafb833d1999-08-19 00:55:39 +0000904 }
905
906 if (ctx->Driver.Enable) {
907 (*ctx->Driver.Enable)( ctx, cap, state );
908 }
909}
910
911
Brian Paulfbd8f211999-11-11 01:22:25 +0000912void
913_mesa_Enable( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000914{
Brian Paulfbd8f211999-11-11 01:22:25 +0000915 GET_CURRENT_CONTEXT(ctx);
Keith Whitwell376d0222000-12-27 22:52:45 +0000916 ASSERT_OUTSIDE_BEGIN_END(ctx);
917
Brian Paulfbd8f211999-11-11 01:22:25 +0000918 _mesa_set_enable( ctx, cap, GL_TRUE );
jtgafb833d1999-08-19 00:55:39 +0000919}
920
921
Brian Paulfbd8f211999-11-11 01:22:25 +0000922void
923_mesa_Disable( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000924{
Brian Paulfbd8f211999-11-11 01:22:25 +0000925 GET_CURRENT_CONTEXT(ctx);
Keith Whitwell376d0222000-12-27 22:52:45 +0000926 ASSERT_OUTSIDE_BEGIN_END(ctx);
927
Brian Paulfbd8f211999-11-11 01:22:25 +0000928 _mesa_set_enable( ctx, cap, GL_FALSE );
jtgafb833d1999-08-19 00:55:39 +0000929}
930
931
Brian Paul86b84272001-12-14 02:50:01 +0000932#undef CHECK_EXTENSION
933#define CHECK_EXTENSION(EXTNAME) \
934 if (!ctx->Extensions.EXTNAME) { \
935 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \
936 return GL_FALSE; \
937 }
938
jtgafb833d1999-08-19 00:55:39 +0000939
Brian Paulfbd8f211999-11-11 01:22:25 +0000940GLboolean
941_mesa_IsEnabled( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000942{
Brian Paulfbd8f211999-11-11 01:22:25 +0000943 GET_CURRENT_CONTEXT(ctx);
jtgafb833d1999-08-19 00:55:39 +0000944 switch (cap) {
945 case GL_ALPHA_TEST:
946 return ctx->Color.AlphaEnabled;
947 case GL_AUTO_NORMAL:
948 return ctx->Eval.AutoNormal;
949 case GL_BLEND:
950 return ctx->Color.BlendEnabled;
951 case GL_CLIP_PLANE0:
952 case GL_CLIP_PLANE1:
953 case GL_CLIP_PLANE2:
954 case GL_CLIP_PLANE3:
955 case GL_CLIP_PLANE4:
956 case GL_CLIP_PLANE5:
Brian Paul103bc0f2002-03-29 17:27:59 +0000957 return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
jtgafb833d1999-08-19 00:55:39 +0000958 case GL_COLOR_MATERIAL:
959 return ctx->Light.ColorMaterialEnabled;
960 case GL_CULL_FACE:
961 return ctx->Polygon.CullFlag;
962 case GL_DEPTH_TEST:
963 return ctx->Depth.Test;
964 case GL_DITHER:
965 return ctx->Color.DitherFlag;
966 case GL_FOG:
967 return ctx->Fog.Enabled;
968 case GL_LIGHTING:
969 return ctx->Light.Enabled;
970 case GL_LIGHT0:
971 case GL_LIGHT1:
972 case GL_LIGHT2:
973 case GL_LIGHT3:
974 case GL_LIGHT4:
975 case GL_LIGHT5:
976 case GL_LIGHT6:
977 case GL_LIGHT7:
978 return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
979 case GL_LINE_SMOOTH:
980 return ctx->Line.SmoothFlag;
981 case GL_LINE_STIPPLE:
982 return ctx->Line.StippleFlag;
983 case GL_INDEX_LOGIC_OP:
984 return ctx->Color.IndexLogicOpEnabled;
985 case GL_COLOR_LOGIC_OP:
986 return ctx->Color.ColorLogicOpEnabled;
987 case GL_MAP1_COLOR_4:
988 return ctx->Eval.Map1Color4;
989 case GL_MAP1_INDEX:
990 return ctx->Eval.Map1Index;
991 case GL_MAP1_NORMAL:
992 return ctx->Eval.Map1Normal;
993 case GL_MAP1_TEXTURE_COORD_1:
994 return ctx->Eval.Map1TextureCoord1;
995 case GL_MAP1_TEXTURE_COORD_2:
996 return ctx->Eval.Map1TextureCoord2;
997 case GL_MAP1_TEXTURE_COORD_3:
998 return ctx->Eval.Map1TextureCoord3;
999 case GL_MAP1_TEXTURE_COORD_4:
1000 return ctx->Eval.Map1TextureCoord4;
1001 case GL_MAP1_VERTEX_3:
1002 return ctx->Eval.Map1Vertex3;
1003 case GL_MAP1_VERTEX_4:
1004 return ctx->Eval.Map1Vertex4;
1005 case GL_MAP2_COLOR_4:
1006 return ctx->Eval.Map2Color4;
1007 case GL_MAP2_INDEX:
1008 return ctx->Eval.Map2Index;
1009 case GL_MAP2_NORMAL:
1010 return ctx->Eval.Map2Normal;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00001011 case GL_MAP2_TEXTURE_COORD_1:
jtgafb833d1999-08-19 00:55:39 +00001012 return ctx->Eval.Map2TextureCoord1;
1013 case GL_MAP2_TEXTURE_COORD_2:
1014 return ctx->Eval.Map2TextureCoord2;
1015 case GL_MAP2_TEXTURE_COORD_3:
1016 return ctx->Eval.Map2TextureCoord3;
1017 case GL_MAP2_TEXTURE_COORD_4:
1018 return ctx->Eval.Map2TextureCoord4;
1019 case GL_MAP2_VERTEX_3:
1020 return ctx->Eval.Map2Vertex3;
1021 case GL_MAP2_VERTEX_4:
1022 return ctx->Eval.Map2Vertex4;
1023 case GL_NORMALIZE:
1024 return ctx->Transform.Normalize;
1025 case GL_POINT_SMOOTH:
1026 return ctx->Point.SmoothFlag;
1027 case GL_POLYGON_SMOOTH:
1028 return ctx->Polygon.SmoothFlag;
1029 case GL_POLYGON_STIPPLE:
1030 return ctx->Polygon.StippleFlag;
1031 case GL_POLYGON_OFFSET_POINT:
1032 return ctx->Polygon.OffsetPoint;
1033 case GL_POLYGON_OFFSET_LINE:
1034 return ctx->Polygon.OffsetLine;
1035 case GL_POLYGON_OFFSET_FILL:
1036 /*case GL_POLYGON_OFFSET_EXT:*/
1037 return ctx->Polygon.OffsetFill;
1038 case GL_RESCALE_NORMAL_EXT:
1039 return ctx->Transform.RescaleNormals;
1040 case GL_SCISSOR_TEST:
1041 return ctx->Scissor.Enabled;
1042 case GL_SHARED_TEXTURE_PALETTE_EXT:
1043 return ctx->Texture.SharedPalette;
1044 case GL_STENCIL_TEST:
1045 return ctx->Stencil.Enabled;
1046 case GL_TEXTURE_1D:
1047 {
Brian Paul86b84272001-12-14 02:50:01 +00001048 const struct gl_texture_unit *texUnit;
1049 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001050 return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001051 }
1052 case GL_TEXTURE_2D:
1053 {
Brian Paul86b84272001-12-14 02:50:01 +00001054 const struct gl_texture_unit *texUnit;
1055 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001056 return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001057 }
1058 case GL_TEXTURE_3D:
1059 {
Brian Paul86b84272001-12-14 02:50:01 +00001060 const struct gl_texture_unit *texUnit;
1061 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001062 return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001063 }
1064 case GL_TEXTURE_GEN_Q:
1065 {
Brian Paul86b84272001-12-14 02:50:01 +00001066 const struct gl_texture_unit *texUnit;
1067 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001068 return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
1069 }
1070 case GL_TEXTURE_GEN_R:
1071 {
Brian Paul86b84272001-12-14 02:50:01 +00001072 const struct gl_texture_unit *texUnit;
1073 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001074 return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
1075 }
1076 case GL_TEXTURE_GEN_S:
1077 {
Brian Paul86b84272001-12-14 02:50:01 +00001078 const struct gl_texture_unit *texUnit;
1079 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001080 return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
1081 }
1082 case GL_TEXTURE_GEN_T:
1083 {
Brian Paul86b84272001-12-14 02:50:01 +00001084 const struct gl_texture_unit *texUnit;
1085 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001086 return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
1087 }
1088
1089 /*
1090 * CLIENT STATE!!!
1091 */
1092 case GL_VERTEX_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001093 return (ctx->Array.Vertex.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001094 case GL_NORMAL_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001095 return (ctx->Array.Normal.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001096 case GL_COLOR_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001097 return (ctx->Array.Color.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001098 case GL_INDEX_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001099 return (ctx->Array.Index.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001100 case GL_TEXTURE_COORD_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001101 return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001102 case GL_EDGE_FLAG_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001103 return (ctx->Array.EdgeFlag.Enabled != 0);
Brian Paul6ee7a022002-01-22 18:40:46 +00001104 case GL_FOG_COORDINATE_ARRAY_EXT:
1105 CHECK_EXTENSION(EXT_fog_coord);
1106 return (ctx->Array.FogCoord.Enabled != 0);
1107 case GL_SECONDARY_COLOR_ARRAY_EXT:
1108 CHECK_EXTENSION(EXT_secondary_color);
1109 return (ctx->Array.SecondaryColor.Enabled != 0);
Brian Paul1b2ff692000-03-11 23:23:26 +00001110
Brian Paul86b84272001-12-14 02:50:01 +00001111 /* GL_EXT_histogram */
1112 case GL_HISTOGRAM:
1113 CHECK_EXTENSION(EXT_histogram);
1114 return ctx->Pixel.HistogramEnabled;
1115 case GL_MINMAX:
1116 CHECK_EXTENSION(EXT_histogram);
1117 return ctx->Pixel.MinMaxEnabled;
1118
Brian Paul1b2ff692000-03-11 23:23:26 +00001119 /* GL_HP_occlusion_test */
1120 case GL_OCCLUSION_TEST_HP:
Brian Paul86b84272001-12-14 02:50:01 +00001121 CHECK_EXTENSION(HP_occlusion_test);
1122 return ctx->Depth.OcclusionTest;
Brian Paul1b2ff692000-03-11 23:23:26 +00001123
Brian Paul2b2e9252000-04-07 16:27:26 +00001124 /* GL_SGIS_pixel_texture */
1125 case GL_PIXEL_TEXTURE_SGIS:
Brian Paul86b84272001-12-14 02:50:01 +00001126 CHECK_EXTENSION(SGIS_pixel_texture);
Brian Paul2b2e9252000-04-07 16:27:26 +00001127 return ctx->Pixel.PixelTextureEnabled;
Brian Paul2b2e9252000-04-07 16:27:26 +00001128
1129 /* GL_SGIX_pixel_texture */
1130 case GL_PIXEL_TEX_GEN_SGIX:
Brian Paul86b84272001-12-14 02:50:01 +00001131 CHECK_EXTENSION(SGIX_pixel_texture);
Brian Paul2b2e9252000-04-07 16:27:26 +00001132 return ctx->Pixel.PixelTextureEnabled;
Brian Paul13811372000-04-12 00:27:37 +00001133
1134 /* GL_SGI_color_table */
1135 case GL_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001136 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001137 return ctx->Pixel.ColorTableEnabled;
1138 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001139 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001140 return ctx->Pixel.PostConvolutionColorTableEnabled;
1141 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001142 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001143 return ctx->Pixel.PostColorMatrixColorTableEnabled;
Brian Paul2b2e9252000-04-07 16:27:26 +00001144
Brian Paul82b02f02000-05-07 20:37:40 +00001145 /* GL_EXT_convolution */
1146 case GL_CONVOLUTION_1D:
Brian Paul86b84272001-12-14 02:50:01 +00001147 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001148 return ctx->Pixel.Convolution1DEnabled;
1149 case GL_CONVOLUTION_2D:
Brian Paul86b84272001-12-14 02:50:01 +00001150 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001151 return ctx->Pixel.Convolution2DEnabled;
1152 case GL_SEPARABLE_2D:
Brian Paul86b84272001-12-14 02:50:01 +00001153 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001154 return ctx->Pixel.Separable2DEnabled;
1155
Brian Paul86fc3702000-05-22 16:33:20 +00001156 /* GL_ARB_texture_cube_map */
1157 case GL_TEXTURE_CUBE_MAP_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001158 CHECK_EXTENSION(ARB_texture_cube_map);
1159 {
1160 const struct gl_texture_unit *texUnit;
1161 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001162 return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
Brian Paul86fc3702000-05-22 16:33:20 +00001163 }
Brian Paul86fc3702000-05-22 16:33:20 +00001164
Brian Paul736fcbe2001-05-29 15:23:48 +00001165 /* GL_ARB_multisample */
1166 case GL_MULTISAMPLE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001167 CHECK_EXTENSION(ARB_multisample);
1168 return ctx->Multisample.Enabled;
Brian Paul736fcbe2001-05-29 15:23:48 +00001169 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001170 CHECK_EXTENSION(ARB_multisample);
1171 return ctx->Multisample.SampleAlphaToCoverage;
Brian Paul736fcbe2001-05-29 15:23:48 +00001172 case GL_SAMPLE_ALPHA_TO_ONE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001173 CHECK_EXTENSION(ARB_multisample);
1174 return ctx->Multisample.SampleAlphaToOne;
Brian Paul736fcbe2001-05-29 15:23:48 +00001175 case GL_SAMPLE_COVERAGE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001176 CHECK_EXTENSION(ARB_multisample);
1177 return ctx->Multisample.SampleCoverage;
Brian Paul736fcbe2001-05-29 15:23:48 +00001178 case GL_SAMPLE_COVERAGE_INVERT_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001179 CHECK_EXTENSION(ARB_multisample);
1180 return ctx->Multisample.SampleCoverageInvert;
Brian Paul736fcbe2001-05-29 15:23:48 +00001181
Brian Paul8c2f6c52001-06-26 01:32:48 +00001182 /* GL_IBM_rasterpos_clip */
1183 case GL_RASTER_POSITION_UNCLIPPED_IBM:
Brian Paul86b84272001-12-14 02:50:01 +00001184 CHECK_EXTENSION(IBM_rasterpos_clip);
1185 return ctx->Transform.RasterPositionUnclipped;
Brian Paul8c2f6c52001-06-26 01:32:48 +00001186
Brian Paul6c408b42002-05-27 17:04:52 +00001187 /* GL_NV_point_sprite */
1188 case GL_POINT_SPRITE_NV:
1189 return ctx->Point.PointSprite;
Brian Paul06d05af2000-12-08 00:20:15 +00001190
Brian Paul86b84272001-12-14 02:50:01 +00001191 /* GL_NV_vertex_program */
1192 case GL_VERTEX_PROGRAM_NV:
1193 CHECK_EXTENSION(NV_vertex_program);
1194 return ctx->VertexProgram.Enabled;
1195 case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
1196 CHECK_EXTENSION(NV_vertex_program);
1197 return ctx->VertexProgram.PointSizeEnabled;
1198 case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
1199 CHECK_EXTENSION(NV_vertex_program);
1200 return ctx->VertexProgram.TwoSideEnabled;
1201 case GL_VERTEX_ATTRIB_ARRAY0_NV:
1202 case GL_VERTEX_ATTRIB_ARRAY1_NV:
1203 case GL_VERTEX_ATTRIB_ARRAY2_NV:
1204 case GL_VERTEX_ATTRIB_ARRAY3_NV:
1205 case GL_VERTEX_ATTRIB_ARRAY4_NV:
1206 case GL_VERTEX_ATTRIB_ARRAY5_NV:
1207 case GL_VERTEX_ATTRIB_ARRAY6_NV:
1208 case GL_VERTEX_ATTRIB_ARRAY7_NV:
1209 case GL_VERTEX_ATTRIB_ARRAY8_NV:
1210 case GL_VERTEX_ATTRIB_ARRAY9_NV:
1211 case GL_VERTEX_ATTRIB_ARRAY10_NV:
1212 case GL_VERTEX_ATTRIB_ARRAY11_NV:
1213 case GL_VERTEX_ATTRIB_ARRAY12_NV:
1214 case GL_VERTEX_ATTRIB_ARRAY13_NV:
1215 case GL_VERTEX_ATTRIB_ARRAY14_NV:
1216 case GL_VERTEX_ATTRIB_ARRAY15_NV:
1217 CHECK_EXTENSION(NV_vertex_program);
1218 {
1219 GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
Brian Paul8e6d3052002-01-11 17:26:54 +00001220 return (ctx->Array.VertexAttrib[n].Enabled != 0);
Brian Paul86b84272001-12-14 02:50:01 +00001221 }
1222 case GL_MAP1_VERTEX_ATTRIB0_4_NV:
1223 case GL_MAP1_VERTEX_ATTRIB1_4_NV:
1224 case GL_MAP1_VERTEX_ATTRIB2_4_NV:
1225 case GL_MAP1_VERTEX_ATTRIB3_4_NV:
1226 case GL_MAP1_VERTEX_ATTRIB4_4_NV:
1227 case GL_MAP1_VERTEX_ATTRIB5_4_NV:
1228 case GL_MAP1_VERTEX_ATTRIB6_4_NV:
1229 case GL_MAP1_VERTEX_ATTRIB7_4_NV:
1230 case GL_MAP1_VERTEX_ATTRIB8_4_NV:
1231 case GL_MAP1_VERTEX_ATTRIB9_4_NV:
1232 case GL_MAP1_VERTEX_ATTRIB10_4_NV:
1233 case GL_MAP1_VERTEX_ATTRIB11_4_NV:
1234 case GL_MAP1_VERTEX_ATTRIB12_4_NV:
1235 case GL_MAP1_VERTEX_ATTRIB13_4_NV:
1236 case GL_MAP1_VERTEX_ATTRIB14_4_NV:
1237 case GL_MAP1_VERTEX_ATTRIB15_4_NV:
1238 CHECK_EXTENSION(NV_vertex_program);
Brian Paulbc42c192002-01-05 21:53:20 +00001239 {
1240 const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
1241 return ctx->Eval.Map1Attrib[map];
1242 }
Brian Paul86b84272001-12-14 02:50:01 +00001243 case GL_MAP2_VERTEX_ATTRIB0_4_NV:
1244 case GL_MAP2_VERTEX_ATTRIB1_4_NV:
1245 case GL_MAP2_VERTEX_ATTRIB2_4_NV:
1246 case GL_MAP2_VERTEX_ATTRIB3_4_NV:
1247 case GL_MAP2_VERTEX_ATTRIB4_4_NV:
1248 case GL_MAP2_VERTEX_ATTRIB5_4_NV:
1249 case GL_MAP2_VERTEX_ATTRIB6_4_NV:
1250 case GL_MAP2_VERTEX_ATTRIB7_4_NV:
1251 case GL_MAP2_VERTEX_ATTRIB8_4_NV:
1252 case GL_MAP2_VERTEX_ATTRIB9_4_NV:
1253 case GL_MAP2_VERTEX_ATTRIB10_4_NV:
1254 case GL_MAP2_VERTEX_ATTRIB11_4_NV:
1255 case GL_MAP2_VERTEX_ATTRIB12_4_NV:
1256 case GL_MAP2_VERTEX_ATTRIB13_4_NV:
1257 case GL_MAP2_VERTEX_ATTRIB14_4_NV:
1258 case GL_MAP2_VERTEX_ATTRIB15_4_NV:
1259 CHECK_EXTENSION(NV_vertex_program);
Brian Paulbc42c192002-01-05 21:53:20 +00001260 {
1261 const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
1262 return ctx->Eval.Map2Attrib[map];
1263 }
Brian Paul86b84272001-12-14 02:50:01 +00001264
Brian Paul8afe7de2002-06-15 03:03:06 +00001265 /* GL_NV_texture_rectangle */
1266 case GL_TEXTURE_RECTANGLE_NV:
1267 CHECK_EXTENSION(NV_texture_rectangle);
1268 {
1269 const struct gl_texture_unit *texUnit;
1270 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1271 return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE;
1272 }
1273
jtgafb833d1999-08-19 00:55:39 +00001274 default:
Brian Paul02c03ef2002-06-18 16:53:46 +00001275 {
1276 char s[100];
1277 sprintf(s, "glIsEnabled(0x%x)", (int) cap);
1278 _mesa_error( ctx, GL_INVALID_ENUM, s );
1279 }
jtgafb833d1999-08-19 00:55:39 +00001280 return GL_FALSE;
1281 }
1282}