blob: 140358b463a64140446719f3f28b4f1d7deb4ffe [file] [log] [blame]
Brian Paul4e9676f2002-06-29 19:48:15 +00001/* $Id: enable.c,v 1.68 2002/06/29 19:48:15 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 Paul4e9676f2002-06-29 19:48:15 +000047 _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \
48 state ? "Enable" : "Disable", CAP); \
Brian Paul86b84272001-12-14 02:50:01 +000049 return; \
50 }
51
52
53
Keith Whitwellcab974c2000-12-26 05:09:27 +000054static void
55client_state( GLcontext *ctx, GLenum cap, GLboolean state )
56{
57 GLuint flag;
Brian Paul8e6d3052002-01-11 17:26:54 +000058 GLuint *var;
Keith Whitwellcab974c2000-12-26 05:09:27 +000059
60 switch (cap) {
Brian Paul86b84272001-12-14 02:50:01 +000061 case GL_VERTEX_ARRAY:
62 var = &ctx->Array.Vertex.Enabled;
63 flag = _NEW_ARRAY_VERTEX;
64 break;
65 case GL_NORMAL_ARRAY:
66 var = &ctx->Array.Normal.Enabled;
67 flag = _NEW_ARRAY_NORMAL;
68 break;
69 case GL_COLOR_ARRAY:
70 var = &ctx->Array.Color.Enabled;
71 flag = _NEW_ARRAY_COLOR0;
72 break;
73 case GL_INDEX_ARRAY:
74 var = &ctx->Array.Index.Enabled;
75 flag = _NEW_ARRAY_INDEX;
76 break;
77 case GL_TEXTURE_COORD_ARRAY:
78 var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
79 flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
80 break;
81 case GL_EDGE_FLAG_ARRAY:
82 var = &ctx->Array.EdgeFlag.Enabled;
83 flag = _NEW_ARRAY_EDGEFLAG;
84 break;
85 case GL_FOG_COORDINATE_ARRAY_EXT:
86 var = &ctx->Array.FogCoord.Enabled;
87 flag = _NEW_ARRAY_FOGCOORD;
88 break;
89 case GL_SECONDARY_COLOR_ARRAY_EXT:
90 var = &ctx->Array.SecondaryColor.Enabled;
91 flag = _NEW_ARRAY_COLOR1;
92 break;
93
94 /* GL_NV_vertex_program */
95 case GL_VERTEX_ATTRIB_ARRAY0_NV:
96 case GL_VERTEX_ATTRIB_ARRAY1_NV:
97 case GL_VERTEX_ATTRIB_ARRAY2_NV:
98 case GL_VERTEX_ATTRIB_ARRAY3_NV:
99 case GL_VERTEX_ATTRIB_ARRAY4_NV:
100 case GL_VERTEX_ATTRIB_ARRAY5_NV:
101 case GL_VERTEX_ATTRIB_ARRAY6_NV:
102 case GL_VERTEX_ATTRIB_ARRAY7_NV:
103 case GL_VERTEX_ATTRIB_ARRAY8_NV:
104 case GL_VERTEX_ATTRIB_ARRAY9_NV:
105 case GL_VERTEX_ATTRIB_ARRAY10_NV:
106 case GL_VERTEX_ATTRIB_ARRAY11_NV:
107 case GL_VERTEX_ATTRIB_ARRAY12_NV:
108 case GL_VERTEX_ATTRIB_ARRAY13_NV:
109 case GL_VERTEX_ATTRIB_ARRAY14_NV:
110 case GL_VERTEX_ATTRIB_ARRAY15_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000111 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000112 {
113 GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
114 var = &ctx->Array.VertexAttrib[n].Enabled;
Brian Paulb7752722002-04-21 18:49:18 +0000115 flag = _NEW_ARRAY_ATTRIB(n);
Brian Paul86b84272001-12-14 02:50:01 +0000116 }
117 break;
118 default:
Brian Paul4e9676f2002-06-29 19:48:15 +0000119 _mesa_error( ctx, GL_INVALID_ENUM,
120 "glEnable/DisableClientState(0x%x)", cap);
Brian Paul86b84272001-12-14 02:50:01 +0000121 return;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000122 }
123
Alan Hourihane68c48df2002-04-19 08:38:23 +0000124 if (*var == state)
Keith Whitwellcab974c2000-12-26 05:09:27 +0000125 return;
126
127 FLUSH_VERTICES(ctx, _NEW_ARRAY);
128 ctx->Array.NewState |= flag;
129 *var = state;
130
Gareth Hughes22144ab2001-03-12 00:48:37 +0000131 if (state)
Keith Whitwellcab974c2000-12-26 05:09:27 +0000132 ctx->Array._Enabled |= flag;
133 else
134 ctx->Array._Enabled &= ~flag;
135
136 if (ctx->Driver.Enable) {
137 (*ctx->Driver.Enable)( ctx, cap, state );
138 }
139}
140
141
142
143void
144_mesa_EnableClientState( GLenum cap )
145{
146 GET_CURRENT_CONTEXT(ctx);
147 ASSERT_OUTSIDE_BEGIN_END(ctx);
148 client_state( ctx, cap, GL_TRUE );
149}
150
151
152
153void
154_mesa_DisableClientState( GLenum cap )
155{
156 GET_CURRENT_CONTEXT(ctx);
157 ASSERT_OUTSIDE_BEGIN_END(ctx);
158 client_state( ctx, cap, GL_FALSE );
159}
160
jtgafb833d1999-08-19 00:55:39 +0000161
Brian Paul86b84272001-12-14 02:50:01 +0000162#undef CHECK_EXTENSION
Brian Paul02c03ef2002-06-18 16:53:46 +0000163#define CHECK_EXTENSION(EXTNAME, CAP) \
164 if (!ctx->Extensions.EXTNAME) { \
Brian Paul4e9676f2002-06-29 19:48:15 +0000165 _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \
166 state ? "Enable" : "Disable", CAP); \
Brian Paul02c03ef2002-06-18 16:53:46 +0000167 return; \
Brian Paul86b84272001-12-14 02:50:01 +0000168 }
169
170
jtgafb833d1999-08-19 00:55:39 +0000171/*
172 * Perform glEnable and glDisable calls.
173 */
Brian Paulfbd8f211999-11-11 01:22:25 +0000174void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
jtgafb833d1999-08-19 00:55:39 +0000175{
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000176 if (MESA_VERBOSE & VERBOSE_API)
Brian Paul4753d602002-06-15 02:38:15 +0000177 _mesa_debug(ctx, "%s %s (newstate is %x)\n",
Brian Paul9a33a112002-06-13 04:28:29 +0000178 state ? "glEnable" : "glDisable",
179 _mesa_lookup_enum_by_nr(cap),
180 ctx->NewState);
jtgafb833d1999-08-19 00:55:39 +0000181
182 switch (cap) {
Brian Paul86b84272001-12-14 02:50:01 +0000183 case GL_ALPHA_TEST:
184 if (ctx->Color.AlphaEnabled == state)
185 return;
186 FLUSH_VERTICES(ctx, _NEW_COLOR);
187 ctx->Color.AlphaEnabled = state;
188 break;
189 case GL_AUTO_NORMAL:
190 if (ctx->Eval.AutoNormal == state)
191 return;
192 FLUSH_VERTICES(ctx, _NEW_EVAL);
193 ctx->Eval.AutoNormal = state;
194 break;
195 case GL_BLEND:
196 if (ctx->Color.BlendEnabled == state)
197 return;
198 FLUSH_VERTICES(ctx, _NEW_COLOR);
199 ctx->Color.BlendEnabled = state;
200 /* The following needed to accomodate 1.0 RGB logic op blending */
201 ctx->Color.ColorLogicOpEnabled =
202 (ctx->Color.BlendEquation == GL_LOGIC_OP && state);
203 break;
204 case GL_CLIP_PLANE0:
205 case GL_CLIP_PLANE1:
206 case GL_CLIP_PLANE2:
207 case GL_CLIP_PLANE3:
208 case GL_CLIP_PLANE4:
209 case GL_CLIP_PLANE5:
210 {
Brian Paul103bc0f2002-03-29 17:27:59 +0000211 const GLuint p = cap - GL_CLIP_PLANE0;
jtgafb833d1999-08-19 00:55:39 +0000212
Brian Pauldb07de02002-04-19 00:23:08 +0000213 if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p))
Brian Paul86b84272001-12-14 02:50:01 +0000214 return;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000215
Brian Paul86b84272001-12-14 02:50:01 +0000216 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
jtgafb833d1999-08-19 00:55:39 +0000217
Brian Paul86b84272001-12-14 02:50:01 +0000218 if (state) {
Brian Paul103bc0f2002-03-29 17:27:59 +0000219 ctx->Transform.ClipPlanesEnabled |= (1 << p);
Keith Whitwellcab974c2000-12-26 05:09:27 +0000220
Brian Paul103bc0f2002-03-29 17:27:59 +0000221 if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
Brian Paul30f51ae2001-12-18 04:06:44 +0000222 _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
Gareth Hughes22144ab2001-03-12 00:48:37 +0000223
Brian Paul86b84272001-12-14 02:50:01 +0000224 /* This derived state also calculated in clip.c and
225 * from _mesa_update_state() on changes to EyeUserPlane
226 * and ctx->ProjectionMatrix respectively.
227 */
228 _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
229 ctx->Transform.EyeUserPlane[p],
Brian Paul30f51ae2001-12-18 04:06:44 +0000230 ctx->ProjectionMatrixStack.Top->inv );
Brian Paul86b84272001-12-14 02:50:01 +0000231 }
Brian Paulf66de792002-03-28 22:45:45 +0000232 else {
Brian Paul103bc0f2002-03-29 17:27:59 +0000233 ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
Brian Paulf66de792002-03-28 22:45:45 +0000234 }
Brian Paul86b84272001-12-14 02:50:01 +0000235 }
236 break;
237 case GL_COLOR_MATERIAL:
238 if (ctx->Light.ColorMaterialEnabled == state)
239 return;
240 FLUSH_VERTICES(ctx, _NEW_LIGHT);
241 ctx->Light.ColorMaterialEnabled = state;
242 if (state) {
243 FLUSH_CURRENT(ctx, 0);
244 _mesa_update_color_material( ctx,
245 ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
246 }
247 break;
248 case GL_CULL_FACE:
249 if (ctx->Polygon.CullFlag == state)
250 return;
251 FLUSH_VERTICES(ctx, _NEW_POLYGON);
252 ctx->Polygon.CullFlag = state;
253 break;
254 case GL_DEPTH_TEST:
255 if (state && ctx->Visual.depthBits==0) {
256 _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
257 return;
258 }
259 if (ctx->Depth.Test==state)
260 return;
261 FLUSH_VERTICES(ctx, _NEW_DEPTH);
262 ctx->Depth.Test = state;
263 break;
264 case GL_DITHER:
265 if (ctx->NoDither) {
266 state = GL_FALSE; /* MESA_NO_DITHER env var */
267 }
268 if (ctx->Color.DitherFlag==state)
269 return;
270 FLUSH_VERTICES(ctx, _NEW_COLOR);
271 ctx->Color.DitherFlag = state;
272 break;
273 case GL_FOG:
274 if (ctx->Fog.Enabled==state)
275 return;
276 FLUSH_VERTICES(ctx, _NEW_FOG);
277 ctx->Fog.Enabled = state;
278 break;
279 case GL_HISTOGRAM:
Brian Paul02c03ef2002-06-18 16:53:46 +0000280 CHECK_EXTENSION(EXT_histogram, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000281 if (ctx->Pixel.HistogramEnabled == state)
282 return;
283 FLUSH_VERTICES(ctx, _NEW_PIXEL);
284 ctx->Pixel.HistogramEnabled = state;
285 break;
286 case GL_LIGHT0:
287 case GL_LIGHT1:
288 case GL_LIGHT2:
289 case GL_LIGHT3:
290 case GL_LIGHT4:
291 case GL_LIGHT5:
292 case GL_LIGHT6:
293 case GL_LIGHT7:
294 if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
295 return;
296 FLUSH_VERTICES(ctx, _NEW_LIGHT);
297 ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
298 if (state) {
299 insert_at_tail(&ctx->Light.EnabledList,
300 &ctx->Light.Light[cap-GL_LIGHT0]);
301 }
302 else {
303 remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
304 }
305 break;
306 case GL_LIGHTING:
307 if (ctx->Light.Enabled == state)
308 return;
309 FLUSH_VERTICES(ctx, _NEW_LIGHT);
310 ctx->Light.Enabled = state;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000311
Keith Whitwell0cb28412002-02-13 00:53:19 +0000312 if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
313 ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
314 else
315 ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
316
Brian Paul86b84272001-12-14 02:50:01 +0000317 if ((ctx->Light.Enabled &&
318 ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
319 || ctx->Fog.ColorSumEnabled)
320 ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
321 else
322 ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
323
324 break;
325 case GL_LINE_SMOOTH:
326 if (ctx->Line.SmoothFlag == state)
327 return;
328 FLUSH_VERTICES(ctx, _NEW_LINE);
329 ctx->Line.SmoothFlag = state;
330 ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
331 break;
332 case GL_LINE_STIPPLE:
333 if (ctx->Line.StippleFlag == state)
334 return;
335 FLUSH_VERTICES(ctx, _NEW_LINE);
336 ctx->Line.StippleFlag = state;
337 ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
338 break;
339 case GL_INDEX_LOGIC_OP:
340 if (ctx->Color.IndexLogicOpEnabled == state)
341 return;
342 FLUSH_VERTICES(ctx, _NEW_COLOR);
343 ctx->Color.IndexLogicOpEnabled = state;
344 break;
345 case GL_COLOR_LOGIC_OP:
346 if (ctx->Color.ColorLogicOpEnabled == state)
347 return;
348 FLUSH_VERTICES(ctx, _NEW_COLOR);
349 ctx->Color.ColorLogicOpEnabled = state;
350 break;
351 case GL_MAP1_COLOR_4:
352 if (ctx->Eval.Map1Color4 == state)
353 return;
354 FLUSH_VERTICES(ctx, _NEW_EVAL);
355 ctx->Eval.Map1Color4 = state;
356 break;
357 case GL_MAP1_INDEX:
358 if (ctx->Eval.Map1Index == state)
359 return;
360 FLUSH_VERTICES(ctx, _NEW_EVAL);
361 ctx->Eval.Map1Index = state;
362 break;
363 case GL_MAP1_NORMAL:
364 if (ctx->Eval.Map1Normal == state)
365 return;
366 FLUSH_VERTICES(ctx, _NEW_EVAL);
367 ctx->Eval.Map1Normal = state;
368 break;
369 case GL_MAP1_TEXTURE_COORD_1:
370 if (ctx->Eval.Map1TextureCoord1 == state)
371 return;
372 FLUSH_VERTICES(ctx, _NEW_EVAL);
373 ctx->Eval.Map1TextureCoord1 = state;
374 break;
375 case GL_MAP1_TEXTURE_COORD_2:
376 if (ctx->Eval.Map1TextureCoord2 == state)
377 return;
378 FLUSH_VERTICES(ctx, _NEW_EVAL);
379 ctx->Eval.Map1TextureCoord2 = state;
380 break;
381 case GL_MAP1_TEXTURE_COORD_3:
382 if (ctx->Eval.Map1TextureCoord3 == state)
383 return;
384 FLUSH_VERTICES(ctx, _NEW_EVAL);
385 ctx->Eval.Map1TextureCoord3 = state;
386 break;
387 case GL_MAP1_TEXTURE_COORD_4:
388 if (ctx->Eval.Map1TextureCoord4 == state)
389 return;
390 FLUSH_VERTICES(ctx, _NEW_EVAL);
391 ctx->Eval.Map1TextureCoord4 = state;
392 break;
393 case GL_MAP1_VERTEX_3:
394 if (ctx->Eval.Map1Vertex3 == state)
395 return;
396 FLUSH_VERTICES(ctx, _NEW_EVAL);
397 ctx->Eval.Map1Vertex3 = state;
398 break;
399 case GL_MAP1_VERTEX_4:
400 if (ctx->Eval.Map1Vertex4 == state)
401 return;
402 FLUSH_VERTICES(ctx, _NEW_EVAL);
403 ctx->Eval.Map1Vertex4 = state;
404 break;
405 case GL_MAP2_COLOR_4:
406 if (ctx->Eval.Map2Color4 == state)
407 return;
408 FLUSH_VERTICES(ctx, _NEW_EVAL);
409 ctx->Eval.Map2Color4 = state;
410 break;
411 case GL_MAP2_INDEX:
412 if (ctx->Eval.Map2Index == state)
413 return;
414 FLUSH_VERTICES(ctx, _NEW_EVAL);
415 ctx->Eval.Map2Index = state;
416 break;
417 case GL_MAP2_NORMAL:
418 if (ctx->Eval.Map2Normal == state)
419 return;
420 FLUSH_VERTICES(ctx, _NEW_EVAL);
421 ctx->Eval.Map2Normal = state;
422 break;
423 case GL_MAP2_TEXTURE_COORD_1:
424 if (ctx->Eval.Map2TextureCoord1 == state)
425 return;
426 FLUSH_VERTICES(ctx, _NEW_EVAL);
427 ctx->Eval.Map2TextureCoord1 = state;
428 break;
429 case GL_MAP2_TEXTURE_COORD_2:
430 if (ctx->Eval.Map2TextureCoord2 == state)
431 return;
432 FLUSH_VERTICES(ctx, _NEW_EVAL);
433 ctx->Eval.Map2TextureCoord2 = state;
434 break;
435 case GL_MAP2_TEXTURE_COORD_3:
436 if (ctx->Eval.Map2TextureCoord3 == state)
437 return;
438 FLUSH_VERTICES(ctx, _NEW_EVAL);
439 ctx->Eval.Map2TextureCoord3 = state;
440 break;
441 case GL_MAP2_TEXTURE_COORD_4:
442 if (ctx->Eval.Map2TextureCoord4 == state)
443 return;
444 FLUSH_VERTICES(ctx, _NEW_EVAL);
445 ctx->Eval.Map2TextureCoord4 = state;
446 break;
447 case GL_MAP2_VERTEX_3:
448 if (ctx->Eval.Map2Vertex3 == state)
449 return;
450 FLUSH_VERTICES(ctx, _NEW_EVAL);
451 ctx->Eval.Map2Vertex3 = state;
452 break;
453 case GL_MAP2_VERTEX_4:
454 if (ctx->Eval.Map2Vertex4 == state)
455 return;
456 FLUSH_VERTICES(ctx, _NEW_EVAL);
457 ctx->Eval.Map2Vertex4 = state;
458 break;
459 case GL_MINMAX:
460 if (ctx->Pixel.MinMaxEnabled == state)
461 return;
462 FLUSH_VERTICES(ctx, _NEW_PIXEL);
463 ctx->Pixel.MinMaxEnabled = state;
464 break;
465 case GL_NORMALIZE:
466 if (ctx->Transform.Normalize == state)
467 return;
468 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
469 ctx->Transform.Normalize = state;
470 break;
471 case GL_POINT_SMOOTH:
472 if (ctx->Point.SmoothFlag==state)
473 return;
474 FLUSH_VERTICES(ctx, _NEW_POINT);
475 ctx->Point.SmoothFlag = state;
476 ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
477 break;
478 case GL_POLYGON_SMOOTH:
479 if (ctx->Polygon.SmoothFlag==state)
480 return;
481 FLUSH_VERTICES(ctx, _NEW_POLYGON);
482 ctx->Polygon.SmoothFlag = state;
483 ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
484 break;
485 case GL_POLYGON_STIPPLE:
486 if (ctx->Polygon.StippleFlag==state)
487 return;
488 FLUSH_VERTICES(ctx, _NEW_POLYGON);
489 ctx->Polygon.StippleFlag = state;
490 ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
491 break;
492 case GL_POLYGON_OFFSET_POINT:
493 if (ctx->Polygon.OffsetPoint==state)
494 return;
495 FLUSH_VERTICES(ctx, _NEW_POLYGON);
496 ctx->Polygon.OffsetPoint = state;
497 break;
498 case GL_POLYGON_OFFSET_LINE:
499 if (ctx->Polygon.OffsetLine==state)
500 return;
501 FLUSH_VERTICES(ctx, _NEW_POLYGON);
502 ctx->Polygon.OffsetLine = state;
503 break;
504 case GL_POLYGON_OFFSET_FILL:
505 /*case GL_POLYGON_OFFSET_EXT:*/
506 if (ctx->Polygon.OffsetFill==state)
507 return;
508 FLUSH_VERTICES(ctx, _NEW_POLYGON);
509 ctx->Polygon.OffsetFill = state;
510 break;
511 case GL_RESCALE_NORMAL_EXT:
512 if (ctx->Transform.RescaleNormals == state)
513 return;
514 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
515 ctx->Transform.RescaleNormals = state;
516 break;
517 case GL_SCISSOR_TEST:
518 if (ctx->Scissor.Enabled==state)
519 return;
520 FLUSH_VERTICES(ctx, _NEW_SCISSOR);
521 ctx->Scissor.Enabled = state;
522 break;
523 case GL_SHARED_TEXTURE_PALETTE_EXT:
524 if (ctx->Texture.SharedPalette == state)
525 return;
526 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
527 ctx->Texture.SharedPalette = state;
528 break;
529 case GL_STENCIL_TEST:
530 if (state && ctx->Visual.stencilBits==0) {
531 _mesa_warning(ctx,
532 "glEnable(GL_STENCIL_TEST) but no stencil buffer");
533 return;
534 }
535 if (ctx->Stencil.Enabled==state)
536 return;
537 FLUSH_VERTICES(ctx, _NEW_STENCIL);
538 ctx->Stencil.Enabled = state;
539 break;
540 case GL_TEXTURE_1D: {
541 const GLuint curr = ctx->Texture.CurrentUnit;
542 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000543 GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000544 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000545 newenabled |= TEXTURE_1D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000546 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
547 return;
548 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
549 texUnit->Enabled = newenabled;
550 break;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000551 }
Brian Paul86b84272001-12-14 02:50:01 +0000552 case GL_TEXTURE_2D: {
553 const GLuint curr = ctx->Texture.CurrentUnit;
554 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000555 GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000556 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000557 newenabled |= TEXTURE_2D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000558 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
559 return;
560 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
561 texUnit->Enabled = newenabled;
562 break;
563 }
564 case GL_TEXTURE_3D: {
565 const GLuint curr = ctx->Texture.CurrentUnit;
566 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000567 GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000568 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000569 newenabled |= TEXTURE_3D_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000570 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
571 return;
572 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
573 texUnit->Enabled = newenabled;
574 break;
575 }
576 case GL_TEXTURE_GEN_Q: {
577 GLuint unit = ctx->Texture.CurrentUnit;
578 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
579 GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
580 if (state)
581 newenabled |= Q_BIT;
582 if (texUnit->TexGenEnabled == newenabled)
583 return;
584 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
585 texUnit->TexGenEnabled = newenabled;
586 break;
587 }
588 case GL_TEXTURE_GEN_R: {
589 GLuint unit = ctx->Texture.CurrentUnit;
590 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
591 GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
592 if (state)
593 newenabled |= R_BIT;
594 if (texUnit->TexGenEnabled == newenabled)
595 return;
596 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
597 texUnit->TexGenEnabled = newenabled;
598 break;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000599 }
600 break;
Brian Paul86b84272001-12-14 02:50:01 +0000601 case GL_TEXTURE_GEN_S: {
602 GLuint unit = ctx->Texture.CurrentUnit;
603 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
604 GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
605 if (state)
606 newenabled |= S_BIT;
607 if (texUnit->TexGenEnabled == newenabled)
608 return;
609 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
610 texUnit->TexGenEnabled = newenabled;
611 break;
Keith Whitwellcab974c2000-12-26 05:09:27 +0000612 }
613 break;
Brian Paul86b84272001-12-14 02:50:01 +0000614 case GL_TEXTURE_GEN_T: {
615 GLuint unit = ctx->Texture.CurrentUnit;
616 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
617 GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
618 if (state)
619 newenabled |= T_BIT;
620 if (texUnit->TexGenEnabled == newenabled)
621 return;
622 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
623 texUnit->TexGenEnabled = newenabled;
624 break;
625 }
626 break;
Keith Whitwell46b09882001-02-16 18:14:41 +0000627
Brian Paul86b84272001-12-14 02:50:01 +0000628 /*
629 * CLIENT STATE!!!
630 */
631 case GL_VERTEX_ARRAY:
632 case GL_NORMAL_ARRAY:
633 case GL_COLOR_ARRAY:
634 case GL_INDEX_ARRAY:
635 case GL_TEXTURE_COORD_ARRAY:
636 case GL_EDGE_FLAG_ARRAY:
637 case GL_FOG_COORDINATE_ARRAY_EXT:
638 case GL_SECONDARY_COLOR_ARRAY_EXT:
639 client_state( ctx, cap, state );
640 return;
jtgafb833d1999-08-19 00:55:39 +0000641
Brian Paul1b2ff692000-03-11 23:23:26 +0000642 /* GL_HP_occlusion_test */
Brian Paul86b84272001-12-14 02:50:01 +0000643 case GL_OCCLUSION_TEST_HP:
Brian Paul02c03ef2002-06-18 16:53:46 +0000644 CHECK_EXTENSION(HP_occlusion_test, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000645 if (ctx->Depth.OcclusionTest == state)
646 return;
647 FLUSH_VERTICES(ctx, _NEW_DEPTH);
648 ctx->Depth.OcclusionTest = state;
649 if (state)
650 ctx->OcclusionResult = ctx->OcclusionResultSaved;
651 else
652 ctx->OcclusionResultSaved = ctx->OcclusionResult;
653 break;
Brian Paul1b2ff692000-03-11 23:23:26 +0000654
Brian Paul2b2e9252000-04-07 16:27:26 +0000655 /* GL_SGIS_pixel_texture */
Brian Paul86b84272001-12-14 02:50:01 +0000656 case GL_PIXEL_TEXTURE_SGIS:
Brian Paul02c03ef2002-06-18 16:53:46 +0000657 CHECK_EXTENSION(SGIS_pixel_texture, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000658 if (ctx->Pixel.PixelTextureEnabled == state)
659 return;
660 FLUSH_VERTICES(ctx, _NEW_PIXEL);
661 ctx->Pixel.PixelTextureEnabled = state;
662 break;
Brian Paul2b2e9252000-04-07 16:27:26 +0000663
664 /* GL_SGIX_pixel_texture */
Brian Paul86b84272001-12-14 02:50:01 +0000665 case GL_PIXEL_TEX_GEN_SGIX:
Brian Paul02c03ef2002-06-18 16:53:46 +0000666 CHECK_EXTENSION(SGIX_pixel_texture, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000667 if (ctx->Pixel.PixelTextureEnabled == state)
668 return;
669 FLUSH_VERTICES(ctx, _NEW_PIXEL);
670 ctx->Pixel.PixelTextureEnabled = state;
671 break;
Brian Paul2b2e9252000-04-07 16:27:26 +0000672
Brian Paul13811372000-04-12 00:27:37 +0000673 /* GL_SGI_color_table */
Brian Paul86b84272001-12-14 02:50:01 +0000674 case GL_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000675 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000676 if (ctx->Pixel.ColorTableEnabled == state)
677 return;
678 FLUSH_VERTICES(ctx, _NEW_PIXEL);
679 ctx->Pixel.ColorTableEnabled = state;
680 break;
681 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000682 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000683 if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
684 return;
685 FLUSH_VERTICES(ctx, _NEW_PIXEL);
686 ctx->Pixel.PostConvolutionColorTableEnabled = state;
687 break;
688 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
Brian Paul02c03ef2002-06-18 16:53:46 +0000689 CHECK_EXTENSION(SGI_color_table, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000690 if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
691 return;
692 FLUSH_VERTICES(ctx, _NEW_PIXEL);
693 ctx->Pixel.PostColorMatrixColorTableEnabled = state;
694 break;
Brian Paul13811372000-04-12 00:27:37 +0000695
Brian Paul82b02f02000-05-07 20:37:40 +0000696 /* GL_EXT_convolution */
Brian Paul86b84272001-12-14 02:50:01 +0000697 case GL_CONVOLUTION_1D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000698 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000699 if (ctx->Pixel.Convolution1DEnabled == state)
700 return;
701 FLUSH_VERTICES(ctx, _NEW_PIXEL);
702 ctx->Pixel.Convolution1DEnabled = state;
703 break;
704 case GL_CONVOLUTION_2D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000705 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000706 if (ctx->Pixel.Convolution2DEnabled == state)
707 return;
708 FLUSH_VERTICES(ctx, _NEW_PIXEL);
709 ctx->Pixel.Convolution2DEnabled = state;
710 break;
711 case GL_SEPARABLE_2D:
Brian Paul02c03ef2002-06-18 16:53:46 +0000712 CHECK_EXTENSION(EXT_convolution, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000713 if (ctx->Pixel.Separable2DEnabled == state)
714 return;
715 FLUSH_VERTICES(ctx, _NEW_PIXEL);
716 ctx->Pixel.Separable2DEnabled = state;
717 break;
Brian Paul82b02f02000-05-07 20:37:40 +0000718
Brian Paul86fc3702000-05-22 16:33:20 +0000719 /* GL_ARB_texture_cube_map */
Brian Paul86b84272001-12-14 02:50:01 +0000720 case GL_TEXTURE_CUBE_MAP_ARB:
721 {
722 const GLuint curr = ctx->Texture.CurrentUnit;
723 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
Brian Paul8afe7de2002-06-15 03:03:06 +0000724 GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT;
Brian Paul02c03ef2002-06-18 16:53:46 +0000725 CHECK_EXTENSION(ARB_texture_cube_map, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000726 if (state)
Brian Paul8afe7de2002-06-15 03:03:06 +0000727 newenabled |= TEXTURE_CUBE_BIT;
Brian Paul86b84272001-12-14 02:50:01 +0000728 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
729 return;
730 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
731 texUnit->Enabled = newenabled;
732 }
733 break;
734
Keith Whitwellfe5d67d2000-10-27 16:44:40 +0000735 /* GL_EXT_secondary_color */
Brian Paul86b84272001-12-14 02:50:01 +0000736 case GL_COLOR_SUM_EXT:
Brian Paul02c03ef2002-06-18 16:53:46 +0000737 CHECK_EXTENSION(EXT_secondary_color, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000738 if (ctx->Fog.ColorSumEnabled == state)
739 return;
740 FLUSH_VERTICES(ctx, _NEW_FOG);
741 ctx->Fog.ColorSumEnabled = state;
Gareth Hughes22144ab2001-03-12 00:48:37 +0000742
Brian Paul86b84272001-12-14 02:50:01 +0000743 if ((ctx->Light.Enabled &&
744 ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
745 || ctx->Fog.ColorSumEnabled)
746 ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
747 else
748 ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
Keith Whitwell46b09882001-02-16 18:14:41 +0000749
Brian Paul86b84272001-12-14 02:50:01 +0000750 break;
Brian Paul06d05af2000-12-08 00:20:15 +0000751
Brian Paul736fcbe2001-05-29 15:23:48 +0000752 /* GL_ARB_multisample */
Brian Paul86b84272001-12-14 02:50:01 +0000753 case GL_MULTISAMPLE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000754 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000755 if (ctx->Multisample.Enabled == state)
756 return;
757 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
758 ctx->Multisample.Enabled = state;
759 break;
760 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000761 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000762 if (ctx->Multisample.SampleAlphaToCoverage == state)
763 return;
764 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
765 ctx->Multisample.SampleAlphaToCoverage = state;
766 break;
767 case GL_SAMPLE_ALPHA_TO_ONE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000768 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000769 if (ctx->Multisample.SampleAlphaToOne == state)
770 return;
771 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
772 ctx->Multisample.SampleAlphaToOne = state;
773 break;
774 case GL_SAMPLE_COVERAGE_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000775 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000776 if (ctx->Multisample.SampleCoverage == state)
777 return;
778 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
779 ctx->Multisample.SampleCoverage = state;
780 break;
781 case GL_SAMPLE_COVERAGE_INVERT_ARB:
Brian Paul02c03ef2002-06-18 16:53:46 +0000782 CHECK_EXTENSION(ARB_multisample, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000783 if (ctx->Multisample.SampleCoverageInvert == state)
784 return;
785 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
786 ctx->Multisample.SampleCoverageInvert = state;
787 break;
Brian Paul8c2f6c52001-06-26 01:32:48 +0000788
789 /* GL_IBM_rasterpos_clip */
Brian Paul86b84272001-12-14 02:50:01 +0000790 case GL_RASTER_POSITION_UNCLIPPED_IBM:
Brian Paul02c03ef2002-06-18 16:53:46 +0000791 CHECK_EXTENSION(IBM_rasterpos_clip, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000792 if (ctx->Transform.RasterPositionUnclipped == state)
793 return;
794 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
795 ctx->Transform.RasterPositionUnclipped = state;
796 break;
Brian Paul736fcbe2001-05-29 15:23:48 +0000797
Brian Paul6c408b42002-05-27 17:04:52 +0000798 /* GL_NV_point_sprite */
799 case GL_POINT_SPRITE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000800 CHECK_EXTENSION(NV_point_sprite, cap);
Brian Paul6c408b42002-05-27 17:04:52 +0000801 if (ctx->Point.PointSprite == state)
Brian Paul86b84272001-12-14 02:50:01 +0000802 return;
803 FLUSH_VERTICES(ctx, _NEW_POINT);
Brian Paul6c408b42002-05-27 17:04:52 +0000804 ctx->Point.PointSprite = state;
Brian Paul86b84272001-12-14 02:50:01 +0000805 break;
Keith Whitwellfe5d67d2000-10-27 16:44:40 +0000806
Brian Paul86b84272001-12-14 02:50:01 +0000807 /* GL_NV_vertex_program */
808 case GL_VERTEX_PROGRAM_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000809 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000810 if (ctx->VertexProgram.Enabled == state)
811 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000812 FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */
Brian Paul86b84272001-12-14 02:50:01 +0000813 ctx->VertexProgram.Enabled = state;
814 break;
815 case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000816 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000817 if (ctx->VertexProgram.PointSizeEnabled == state)
818 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000819 FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM);
Brian Paul86b84272001-12-14 02:50:01 +0000820 ctx->VertexProgram.PointSizeEnabled = state;
821 break;
822 case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000823 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paul86b84272001-12-14 02:50:01 +0000824 if (ctx->VertexProgram.TwoSideEnabled == state)
825 return;
Brian Paul571a1ac2002-01-06 20:39:03 +0000826 FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */
Brian Paul86b84272001-12-14 02:50:01 +0000827 ctx->VertexProgram.TwoSideEnabled = state;
828 break;
829 case GL_MAP1_VERTEX_ATTRIB0_4_NV:
830 case GL_MAP1_VERTEX_ATTRIB1_4_NV:
831 case GL_MAP1_VERTEX_ATTRIB2_4_NV:
832 case GL_MAP1_VERTEX_ATTRIB3_4_NV:
833 case GL_MAP1_VERTEX_ATTRIB4_4_NV:
834 case GL_MAP1_VERTEX_ATTRIB5_4_NV:
835 case GL_MAP1_VERTEX_ATTRIB6_4_NV:
836 case GL_MAP1_VERTEX_ATTRIB7_4_NV:
837 case GL_MAP1_VERTEX_ATTRIB8_4_NV:
838 case GL_MAP1_VERTEX_ATTRIB9_4_NV:
839 case GL_MAP1_VERTEX_ATTRIB10_4_NV:
840 case GL_MAP1_VERTEX_ATTRIB11_4_NV:
841 case GL_MAP1_VERTEX_ATTRIB12_4_NV:
842 case GL_MAP1_VERTEX_ATTRIB13_4_NV:
843 case GL_MAP1_VERTEX_ATTRIB14_4_NV:
844 case GL_MAP1_VERTEX_ATTRIB15_4_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000845 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paulbc42c192002-01-05 21:53:20 +0000846 {
847 const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
848 FLUSH_VERTICES(ctx, _NEW_EVAL);
849 ctx->Eval.Map1Attrib[map] = state;
850 }
Brian Paul86b84272001-12-14 02:50:01 +0000851 break;
852 case GL_MAP2_VERTEX_ATTRIB0_4_NV:
853 case GL_MAP2_VERTEX_ATTRIB1_4_NV:
854 case GL_MAP2_VERTEX_ATTRIB2_4_NV:
855 case GL_MAP2_VERTEX_ATTRIB3_4_NV:
856 case GL_MAP2_VERTEX_ATTRIB4_4_NV:
857 case GL_MAP2_VERTEX_ATTRIB5_4_NV:
858 case GL_MAP2_VERTEX_ATTRIB6_4_NV:
859 case GL_MAP2_VERTEX_ATTRIB7_4_NV:
860 case GL_MAP2_VERTEX_ATTRIB8_4_NV:
861 case GL_MAP2_VERTEX_ATTRIB9_4_NV:
862 case GL_MAP2_VERTEX_ATTRIB10_4_NV:
863 case GL_MAP2_VERTEX_ATTRIB11_4_NV:
864 case GL_MAP2_VERTEX_ATTRIB12_4_NV:
865 case GL_MAP2_VERTEX_ATTRIB13_4_NV:
866 case GL_MAP2_VERTEX_ATTRIB14_4_NV:
867 case GL_MAP2_VERTEX_ATTRIB15_4_NV:
Brian Paul02c03ef2002-06-18 16:53:46 +0000868 CHECK_EXTENSION(NV_vertex_program, cap);
Brian Paulbc42c192002-01-05 21:53:20 +0000869 {
870 const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
871 FLUSH_VERTICES(ctx, _NEW_EVAL);
872 ctx->Eval.Map2Attrib[map] = state;
873 }
Brian Paul86b84272001-12-14 02:50:01 +0000874 break;
875
Brian Paul8afe7de2002-06-15 03:03:06 +0000876 /* GL_NV_texture_rectangle */
877 case GL_TEXTURE_RECTANGLE_NV:
878 {
879 const GLuint curr = ctx->Texture.CurrentUnit;
880 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
881 GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT;
Brian Paul02c03ef2002-06-18 16:53:46 +0000882 CHECK_EXTENSION(NV_texture_rectangle, cap);
Brian Paul8afe7de2002-06-15 03:03:06 +0000883 if (state)
884 newenabled |= TEXTURE_RECT_BIT;
885 if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
886 return;
887 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
888 texUnit->Enabled = newenabled;
889 }
890 break;
891
Brian Paul86b84272001-12-14 02:50:01 +0000892 default:
Brian Paul4e9676f2002-06-29 19:48:15 +0000893 _mesa_error(ctx, GL_INVALID_ENUM,
894 "%s(0x%x)", state ? "glEnable" : "glDisable", cap);
Brian Paul86b84272001-12-14 02:50:01 +0000895 return;
jtgafb833d1999-08-19 00:55:39 +0000896 }
897
898 if (ctx->Driver.Enable) {
899 (*ctx->Driver.Enable)( ctx, cap, state );
900 }
901}
902
903
Brian Paulfbd8f211999-11-11 01:22:25 +0000904void
905_mesa_Enable( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000906{
Brian Paulfbd8f211999-11-11 01:22:25 +0000907 GET_CURRENT_CONTEXT(ctx);
Keith Whitwell376d0222000-12-27 22:52:45 +0000908 ASSERT_OUTSIDE_BEGIN_END(ctx);
909
Brian Paulfbd8f211999-11-11 01:22:25 +0000910 _mesa_set_enable( ctx, cap, GL_TRUE );
jtgafb833d1999-08-19 00:55:39 +0000911}
912
913
Brian Paulfbd8f211999-11-11 01:22:25 +0000914void
915_mesa_Disable( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000916{
Brian Paulfbd8f211999-11-11 01:22:25 +0000917 GET_CURRENT_CONTEXT(ctx);
Keith Whitwell376d0222000-12-27 22:52:45 +0000918 ASSERT_OUTSIDE_BEGIN_END(ctx);
919
Brian Paulfbd8f211999-11-11 01:22:25 +0000920 _mesa_set_enable( ctx, cap, GL_FALSE );
jtgafb833d1999-08-19 00:55:39 +0000921}
922
923
Brian Paul86b84272001-12-14 02:50:01 +0000924#undef CHECK_EXTENSION
925#define CHECK_EXTENSION(EXTNAME) \
926 if (!ctx->Extensions.EXTNAME) { \
927 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \
928 return GL_FALSE; \
929 }
930
jtgafb833d1999-08-19 00:55:39 +0000931
Brian Paulfbd8f211999-11-11 01:22:25 +0000932GLboolean
933_mesa_IsEnabled( GLenum cap )
jtgafb833d1999-08-19 00:55:39 +0000934{
Brian Paulfbd8f211999-11-11 01:22:25 +0000935 GET_CURRENT_CONTEXT(ctx);
jtgafb833d1999-08-19 00:55:39 +0000936 switch (cap) {
937 case GL_ALPHA_TEST:
938 return ctx->Color.AlphaEnabled;
939 case GL_AUTO_NORMAL:
940 return ctx->Eval.AutoNormal;
941 case GL_BLEND:
942 return ctx->Color.BlendEnabled;
943 case GL_CLIP_PLANE0:
944 case GL_CLIP_PLANE1:
945 case GL_CLIP_PLANE2:
946 case GL_CLIP_PLANE3:
947 case GL_CLIP_PLANE4:
948 case GL_CLIP_PLANE5:
Brian Paul103bc0f2002-03-29 17:27:59 +0000949 return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
jtgafb833d1999-08-19 00:55:39 +0000950 case GL_COLOR_MATERIAL:
951 return ctx->Light.ColorMaterialEnabled;
952 case GL_CULL_FACE:
953 return ctx->Polygon.CullFlag;
954 case GL_DEPTH_TEST:
955 return ctx->Depth.Test;
956 case GL_DITHER:
957 return ctx->Color.DitherFlag;
958 case GL_FOG:
959 return ctx->Fog.Enabled;
960 case GL_LIGHTING:
961 return ctx->Light.Enabled;
962 case GL_LIGHT0:
963 case GL_LIGHT1:
964 case GL_LIGHT2:
965 case GL_LIGHT3:
966 case GL_LIGHT4:
967 case GL_LIGHT5:
968 case GL_LIGHT6:
969 case GL_LIGHT7:
970 return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
971 case GL_LINE_SMOOTH:
972 return ctx->Line.SmoothFlag;
973 case GL_LINE_STIPPLE:
974 return ctx->Line.StippleFlag;
975 case GL_INDEX_LOGIC_OP:
976 return ctx->Color.IndexLogicOpEnabled;
977 case GL_COLOR_LOGIC_OP:
978 return ctx->Color.ColorLogicOpEnabled;
979 case GL_MAP1_COLOR_4:
980 return ctx->Eval.Map1Color4;
981 case GL_MAP1_INDEX:
982 return ctx->Eval.Map1Index;
983 case GL_MAP1_NORMAL:
984 return ctx->Eval.Map1Normal;
985 case GL_MAP1_TEXTURE_COORD_1:
986 return ctx->Eval.Map1TextureCoord1;
987 case GL_MAP1_TEXTURE_COORD_2:
988 return ctx->Eval.Map1TextureCoord2;
989 case GL_MAP1_TEXTURE_COORD_3:
990 return ctx->Eval.Map1TextureCoord3;
991 case GL_MAP1_TEXTURE_COORD_4:
992 return ctx->Eval.Map1TextureCoord4;
993 case GL_MAP1_VERTEX_3:
994 return ctx->Eval.Map1Vertex3;
995 case GL_MAP1_VERTEX_4:
996 return ctx->Eval.Map1Vertex4;
997 case GL_MAP2_COLOR_4:
998 return ctx->Eval.Map2Color4;
999 case GL_MAP2_INDEX:
1000 return ctx->Eval.Map2Index;
1001 case GL_MAP2_NORMAL:
1002 return ctx->Eval.Map2Normal;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00001003 case GL_MAP2_TEXTURE_COORD_1:
jtgafb833d1999-08-19 00:55:39 +00001004 return ctx->Eval.Map2TextureCoord1;
1005 case GL_MAP2_TEXTURE_COORD_2:
1006 return ctx->Eval.Map2TextureCoord2;
1007 case GL_MAP2_TEXTURE_COORD_3:
1008 return ctx->Eval.Map2TextureCoord3;
1009 case GL_MAP2_TEXTURE_COORD_4:
1010 return ctx->Eval.Map2TextureCoord4;
1011 case GL_MAP2_VERTEX_3:
1012 return ctx->Eval.Map2Vertex3;
1013 case GL_MAP2_VERTEX_4:
1014 return ctx->Eval.Map2Vertex4;
1015 case GL_NORMALIZE:
1016 return ctx->Transform.Normalize;
1017 case GL_POINT_SMOOTH:
1018 return ctx->Point.SmoothFlag;
1019 case GL_POLYGON_SMOOTH:
1020 return ctx->Polygon.SmoothFlag;
1021 case GL_POLYGON_STIPPLE:
1022 return ctx->Polygon.StippleFlag;
1023 case GL_POLYGON_OFFSET_POINT:
1024 return ctx->Polygon.OffsetPoint;
1025 case GL_POLYGON_OFFSET_LINE:
1026 return ctx->Polygon.OffsetLine;
1027 case GL_POLYGON_OFFSET_FILL:
1028 /*case GL_POLYGON_OFFSET_EXT:*/
1029 return ctx->Polygon.OffsetFill;
1030 case GL_RESCALE_NORMAL_EXT:
1031 return ctx->Transform.RescaleNormals;
1032 case GL_SCISSOR_TEST:
1033 return ctx->Scissor.Enabled;
1034 case GL_SHARED_TEXTURE_PALETTE_EXT:
1035 return ctx->Texture.SharedPalette;
1036 case GL_STENCIL_TEST:
1037 return ctx->Stencil.Enabled;
1038 case GL_TEXTURE_1D:
1039 {
Brian Paul86b84272001-12-14 02:50:01 +00001040 const struct gl_texture_unit *texUnit;
1041 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001042 return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001043 }
1044 case GL_TEXTURE_2D:
1045 {
Brian Paul86b84272001-12-14 02:50:01 +00001046 const struct gl_texture_unit *texUnit;
1047 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001048 return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001049 }
1050 case GL_TEXTURE_3D:
1051 {
Brian Paul86b84272001-12-14 02:50:01 +00001052 const struct gl_texture_unit *texUnit;
1053 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001054 return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE;
jtgafb833d1999-08-19 00:55:39 +00001055 }
1056 case GL_TEXTURE_GEN_Q:
1057 {
Brian Paul86b84272001-12-14 02:50:01 +00001058 const struct gl_texture_unit *texUnit;
1059 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001060 return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
1061 }
1062 case GL_TEXTURE_GEN_R:
1063 {
Brian Paul86b84272001-12-14 02:50:01 +00001064 const struct gl_texture_unit *texUnit;
1065 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001066 return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
1067 }
1068 case GL_TEXTURE_GEN_S:
1069 {
Brian Paul86b84272001-12-14 02:50:01 +00001070 const struct gl_texture_unit *texUnit;
1071 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001072 return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
1073 }
1074 case GL_TEXTURE_GEN_T:
1075 {
Brian Paul86b84272001-12-14 02:50:01 +00001076 const struct gl_texture_unit *texUnit;
1077 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
jtgafb833d1999-08-19 00:55:39 +00001078 return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
1079 }
1080
1081 /*
1082 * CLIENT STATE!!!
1083 */
1084 case GL_VERTEX_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001085 return (ctx->Array.Vertex.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001086 case GL_NORMAL_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001087 return (ctx->Array.Normal.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001088 case GL_COLOR_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001089 return (ctx->Array.Color.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001090 case GL_INDEX_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001091 return (ctx->Array.Index.Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001092 case GL_TEXTURE_COORD_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001093 return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0);
jtgafb833d1999-08-19 00:55:39 +00001094 case GL_EDGE_FLAG_ARRAY:
Brian Paul8e6d3052002-01-11 17:26:54 +00001095 return (ctx->Array.EdgeFlag.Enabled != 0);
Brian Paul6ee7a022002-01-22 18:40:46 +00001096 case GL_FOG_COORDINATE_ARRAY_EXT:
1097 CHECK_EXTENSION(EXT_fog_coord);
1098 return (ctx->Array.FogCoord.Enabled != 0);
1099 case GL_SECONDARY_COLOR_ARRAY_EXT:
1100 CHECK_EXTENSION(EXT_secondary_color);
1101 return (ctx->Array.SecondaryColor.Enabled != 0);
Brian Paul1b2ff692000-03-11 23:23:26 +00001102
Brian Paul86b84272001-12-14 02:50:01 +00001103 /* GL_EXT_histogram */
1104 case GL_HISTOGRAM:
1105 CHECK_EXTENSION(EXT_histogram);
1106 return ctx->Pixel.HistogramEnabled;
1107 case GL_MINMAX:
1108 CHECK_EXTENSION(EXT_histogram);
1109 return ctx->Pixel.MinMaxEnabled;
1110
Brian Paul1b2ff692000-03-11 23:23:26 +00001111 /* GL_HP_occlusion_test */
1112 case GL_OCCLUSION_TEST_HP:
Brian Paul86b84272001-12-14 02:50:01 +00001113 CHECK_EXTENSION(HP_occlusion_test);
1114 return ctx->Depth.OcclusionTest;
Brian Paul1b2ff692000-03-11 23:23:26 +00001115
Brian Paul2b2e9252000-04-07 16:27:26 +00001116 /* GL_SGIS_pixel_texture */
1117 case GL_PIXEL_TEXTURE_SGIS:
Brian Paul86b84272001-12-14 02:50:01 +00001118 CHECK_EXTENSION(SGIS_pixel_texture);
Brian Paul2b2e9252000-04-07 16:27:26 +00001119 return ctx->Pixel.PixelTextureEnabled;
Brian Paul2b2e9252000-04-07 16:27:26 +00001120
1121 /* GL_SGIX_pixel_texture */
1122 case GL_PIXEL_TEX_GEN_SGIX:
Brian Paul86b84272001-12-14 02:50:01 +00001123 CHECK_EXTENSION(SGIX_pixel_texture);
Brian Paul2b2e9252000-04-07 16:27:26 +00001124 return ctx->Pixel.PixelTextureEnabled;
Brian Paul13811372000-04-12 00:27:37 +00001125
1126 /* GL_SGI_color_table */
1127 case GL_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001128 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001129 return ctx->Pixel.ColorTableEnabled;
1130 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001131 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001132 return ctx->Pixel.PostConvolutionColorTableEnabled;
1133 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
Brian Paul86b84272001-12-14 02:50:01 +00001134 CHECK_EXTENSION(SGI_color_table);
Brian Paul13811372000-04-12 00:27:37 +00001135 return ctx->Pixel.PostColorMatrixColorTableEnabled;
Brian Paul2b2e9252000-04-07 16:27:26 +00001136
Brian Paul82b02f02000-05-07 20:37:40 +00001137 /* GL_EXT_convolution */
1138 case GL_CONVOLUTION_1D:
Brian Paul86b84272001-12-14 02:50:01 +00001139 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001140 return ctx->Pixel.Convolution1DEnabled;
1141 case GL_CONVOLUTION_2D:
Brian Paul86b84272001-12-14 02:50:01 +00001142 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001143 return ctx->Pixel.Convolution2DEnabled;
1144 case GL_SEPARABLE_2D:
Brian Paul86b84272001-12-14 02:50:01 +00001145 CHECK_EXTENSION(EXT_convolution);
Brian Paul82b02f02000-05-07 20:37:40 +00001146 return ctx->Pixel.Separable2DEnabled;
1147
Brian Paul86fc3702000-05-22 16:33:20 +00001148 /* GL_ARB_texture_cube_map */
1149 case GL_TEXTURE_CUBE_MAP_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001150 CHECK_EXTENSION(ARB_texture_cube_map);
1151 {
1152 const struct gl_texture_unit *texUnit;
1153 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
Brian Paul8afe7de2002-06-15 03:03:06 +00001154 return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
Brian Paul86fc3702000-05-22 16:33:20 +00001155 }
Brian Paul86fc3702000-05-22 16:33:20 +00001156
Brian Paul736fcbe2001-05-29 15:23:48 +00001157 /* GL_ARB_multisample */
1158 case GL_MULTISAMPLE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001159 CHECK_EXTENSION(ARB_multisample);
1160 return ctx->Multisample.Enabled;
Brian Paul736fcbe2001-05-29 15:23:48 +00001161 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001162 CHECK_EXTENSION(ARB_multisample);
1163 return ctx->Multisample.SampleAlphaToCoverage;
Brian Paul736fcbe2001-05-29 15:23:48 +00001164 case GL_SAMPLE_ALPHA_TO_ONE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001165 CHECK_EXTENSION(ARB_multisample);
1166 return ctx->Multisample.SampleAlphaToOne;
Brian Paul736fcbe2001-05-29 15:23:48 +00001167 case GL_SAMPLE_COVERAGE_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001168 CHECK_EXTENSION(ARB_multisample);
1169 return ctx->Multisample.SampleCoverage;
Brian Paul736fcbe2001-05-29 15:23:48 +00001170 case GL_SAMPLE_COVERAGE_INVERT_ARB:
Brian Paul86b84272001-12-14 02:50:01 +00001171 CHECK_EXTENSION(ARB_multisample);
1172 return ctx->Multisample.SampleCoverageInvert;
Brian Paul736fcbe2001-05-29 15:23:48 +00001173
Brian Paul8c2f6c52001-06-26 01:32:48 +00001174 /* GL_IBM_rasterpos_clip */
1175 case GL_RASTER_POSITION_UNCLIPPED_IBM:
Brian Paul86b84272001-12-14 02:50:01 +00001176 CHECK_EXTENSION(IBM_rasterpos_clip);
1177 return ctx->Transform.RasterPositionUnclipped;
Brian Paul8c2f6c52001-06-26 01:32:48 +00001178
Brian Paul6c408b42002-05-27 17:04:52 +00001179 /* GL_NV_point_sprite */
1180 case GL_POINT_SPRITE_NV:
1181 return ctx->Point.PointSprite;
Brian Paul06d05af2000-12-08 00:20:15 +00001182
Brian Paul86b84272001-12-14 02:50:01 +00001183 /* GL_NV_vertex_program */
1184 case GL_VERTEX_PROGRAM_NV:
1185 CHECK_EXTENSION(NV_vertex_program);
1186 return ctx->VertexProgram.Enabled;
1187 case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
1188 CHECK_EXTENSION(NV_vertex_program);
1189 return ctx->VertexProgram.PointSizeEnabled;
1190 case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
1191 CHECK_EXTENSION(NV_vertex_program);
1192 return ctx->VertexProgram.TwoSideEnabled;
1193 case GL_VERTEX_ATTRIB_ARRAY0_NV:
1194 case GL_VERTEX_ATTRIB_ARRAY1_NV:
1195 case GL_VERTEX_ATTRIB_ARRAY2_NV:
1196 case GL_VERTEX_ATTRIB_ARRAY3_NV:
1197 case GL_VERTEX_ATTRIB_ARRAY4_NV:
1198 case GL_VERTEX_ATTRIB_ARRAY5_NV:
1199 case GL_VERTEX_ATTRIB_ARRAY6_NV:
1200 case GL_VERTEX_ATTRIB_ARRAY7_NV:
1201 case GL_VERTEX_ATTRIB_ARRAY8_NV:
1202 case GL_VERTEX_ATTRIB_ARRAY9_NV:
1203 case GL_VERTEX_ATTRIB_ARRAY10_NV:
1204 case GL_VERTEX_ATTRIB_ARRAY11_NV:
1205 case GL_VERTEX_ATTRIB_ARRAY12_NV:
1206 case GL_VERTEX_ATTRIB_ARRAY13_NV:
1207 case GL_VERTEX_ATTRIB_ARRAY14_NV:
1208 case GL_VERTEX_ATTRIB_ARRAY15_NV:
1209 CHECK_EXTENSION(NV_vertex_program);
1210 {
1211 GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
Brian Paul8e6d3052002-01-11 17:26:54 +00001212 return (ctx->Array.VertexAttrib[n].Enabled != 0);
Brian Paul86b84272001-12-14 02:50:01 +00001213 }
1214 case GL_MAP1_VERTEX_ATTRIB0_4_NV:
1215 case GL_MAP1_VERTEX_ATTRIB1_4_NV:
1216 case GL_MAP1_VERTEX_ATTRIB2_4_NV:
1217 case GL_MAP1_VERTEX_ATTRIB3_4_NV:
1218 case GL_MAP1_VERTEX_ATTRIB4_4_NV:
1219 case GL_MAP1_VERTEX_ATTRIB5_4_NV:
1220 case GL_MAP1_VERTEX_ATTRIB6_4_NV:
1221 case GL_MAP1_VERTEX_ATTRIB7_4_NV:
1222 case GL_MAP1_VERTEX_ATTRIB8_4_NV:
1223 case GL_MAP1_VERTEX_ATTRIB9_4_NV:
1224 case GL_MAP1_VERTEX_ATTRIB10_4_NV:
1225 case GL_MAP1_VERTEX_ATTRIB11_4_NV:
1226 case GL_MAP1_VERTEX_ATTRIB12_4_NV:
1227 case GL_MAP1_VERTEX_ATTRIB13_4_NV:
1228 case GL_MAP1_VERTEX_ATTRIB14_4_NV:
1229 case GL_MAP1_VERTEX_ATTRIB15_4_NV:
1230 CHECK_EXTENSION(NV_vertex_program);
Brian Paulbc42c192002-01-05 21:53:20 +00001231 {
1232 const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
1233 return ctx->Eval.Map1Attrib[map];
1234 }
Brian Paul86b84272001-12-14 02:50:01 +00001235 case GL_MAP2_VERTEX_ATTRIB0_4_NV:
1236 case GL_MAP2_VERTEX_ATTRIB1_4_NV:
1237 case GL_MAP2_VERTEX_ATTRIB2_4_NV:
1238 case GL_MAP2_VERTEX_ATTRIB3_4_NV:
1239 case GL_MAP2_VERTEX_ATTRIB4_4_NV:
1240 case GL_MAP2_VERTEX_ATTRIB5_4_NV:
1241 case GL_MAP2_VERTEX_ATTRIB6_4_NV:
1242 case GL_MAP2_VERTEX_ATTRIB7_4_NV:
1243 case GL_MAP2_VERTEX_ATTRIB8_4_NV:
1244 case GL_MAP2_VERTEX_ATTRIB9_4_NV:
1245 case GL_MAP2_VERTEX_ATTRIB10_4_NV:
1246 case GL_MAP2_VERTEX_ATTRIB11_4_NV:
1247 case GL_MAP2_VERTEX_ATTRIB12_4_NV:
1248 case GL_MAP2_VERTEX_ATTRIB13_4_NV:
1249 case GL_MAP2_VERTEX_ATTRIB14_4_NV:
1250 case GL_MAP2_VERTEX_ATTRIB15_4_NV:
1251 CHECK_EXTENSION(NV_vertex_program);
Brian Paulbc42c192002-01-05 21:53:20 +00001252 {
1253 const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
1254 return ctx->Eval.Map2Attrib[map];
1255 }
Brian Paul86b84272001-12-14 02:50:01 +00001256
Brian Paul8afe7de2002-06-15 03:03:06 +00001257 /* GL_NV_texture_rectangle */
1258 case GL_TEXTURE_RECTANGLE_NV:
1259 CHECK_EXTENSION(NV_texture_rectangle);
1260 {
1261 const struct gl_texture_unit *texUnit;
1262 texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1263 return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE;
1264 }
1265
jtgafb833d1999-08-19 00:55:39 +00001266 default:
Brian Paul4e9676f2002-06-29 19:48:15 +00001267 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
jtgafb833d1999-08-19 00:55:39 +00001268 return GL_FALSE;
1269 }
1270}