Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 1 | /* $Id: enable.c,v 1.68 2002/06/29 19:48:15 brianp Exp $ */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Mesa 3-D graphics library |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 5 | * Version: 4.1 |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 6 | * |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 7 | * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 8 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 9 | * 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 Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 15 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 16 | * The above copyright notice and this permission notice shall be included |
| 17 | * in all copies or substantial portions of the Software. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 18 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 19 | * 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 Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 31 | #include "glheader.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 32 | #include "context.h" |
| 33 | #include "enable.h" |
| 34 | #include "light.h" |
| 35 | #include "macros.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 36 | #include "mmath.h" |
| 37 | #include "simple_list.h" |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 38 | #include "mtypes.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 39 | #include "enums.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 40 | #include "math/m_matrix.h" |
| 41 | #include "math/m_xform.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 42 | #endif |
| 43 | |
| 44 | |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 45 | #define CHECK_EXTENSION(EXTNAME, CAP) \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 46 | if (!ctx->Extensions.EXTNAME) { \ |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 47 | _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ |
| 48 | state ? "Enable" : "Disable", CAP); \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 49 | return; \ |
| 50 | } |
| 51 | |
| 52 | |
| 53 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 54 | static void |
| 55 | client_state( GLcontext *ctx, GLenum cap, GLboolean state ) |
| 56 | { |
| 57 | GLuint flag; |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 58 | GLuint *var; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 59 | |
| 60 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 61 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 111 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 112 | { |
| 113 | GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
| 114 | var = &ctx->Array.VertexAttrib[n].Enabled; |
Brian Paul | b775272 | 2002-04-21 18:49:18 +0000 | [diff] [blame] | 115 | flag = _NEW_ARRAY_ATTRIB(n); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 116 | } |
| 117 | break; |
| 118 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 119 | _mesa_error( ctx, GL_INVALID_ENUM, |
| 120 | "glEnable/DisableClientState(0x%x)", cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 121 | return; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 122 | } |
| 123 | |
Alan Hourihane | 68c48df | 2002-04-19 08:38:23 +0000 | [diff] [blame] | 124 | if (*var == state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 125 | return; |
| 126 | |
| 127 | FLUSH_VERTICES(ctx, _NEW_ARRAY); |
| 128 | ctx->Array.NewState |= flag; |
| 129 | *var = state; |
| 130 | |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 131 | if (state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 132 | 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 | |
| 143 | void |
| 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 | |
| 153 | void |
| 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 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 161 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 162 | #undef CHECK_EXTENSION |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 163 | #define CHECK_EXTENSION(EXTNAME, CAP) \ |
| 164 | if (!ctx->Extensions.EXTNAME) { \ |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 165 | _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ |
| 166 | state ? "Enable" : "Disable", CAP); \ |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 167 | return; \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 171 | /* |
| 172 | * Perform glEnable and glDisable calls. |
| 173 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 174 | void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 175 | { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 176 | if (MESA_VERBOSE & VERBOSE_API) |
Brian Paul | 4753d60 | 2002-06-15 02:38:15 +0000 | [diff] [blame] | 177 | _mesa_debug(ctx, "%s %s (newstate is %x)\n", |
Brian Paul | 9a33a11 | 2002-06-13 04:28:29 +0000 | [diff] [blame] | 178 | state ? "glEnable" : "glDisable", |
| 179 | _mesa_lookup_enum_by_nr(cap), |
| 180 | ctx->NewState); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 181 | |
| 182 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 183 | 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 Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 211 | const GLuint p = cap - GL_CLIP_PLANE0; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 212 | |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 213 | if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 214 | return; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 215 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 216 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 217 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 218 | if (state) { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 219 | ctx->Transform.ClipPlanesEnabled |= (1 << p); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 220 | |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 221 | if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) |
Brian Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 222 | _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 223 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 224 | /* 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 Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 230 | ctx->ProjectionMatrixStack.Top->inv ); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 231 | } |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 232 | else { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 233 | ctx->Transform.ClipPlanesEnabled &= ~(1 << p); |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 234 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 235 | } |
| 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 280 | CHECK_EXTENSION(EXT_histogram, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 281 | 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 Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 311 | |
Keith Whitwell | 0cb2841 | 2002-02-13 00:53:19 +0000 | [diff] [blame] | 312 | 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 Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 317 | 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 Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 543 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 544 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 545 | newenabled |= TEXTURE_1D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 546 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 547 | return; |
| 548 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 549 | texUnit->Enabled = newenabled; |
| 550 | break; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 551 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 552 | case GL_TEXTURE_2D: { |
| 553 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 554 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 555 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 556 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 557 | newenabled |= TEXTURE_2D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 558 | 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 Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 567 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 568 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 569 | newenabled |= TEXTURE_3D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 570 | 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 Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 599 | } |
| 600 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 601 | 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 Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 612 | } |
| 613 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 614 | 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 Whitwell | 46b0988 | 2001-02-16 18:14:41 +0000 | [diff] [blame] | 627 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 628 | /* |
| 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; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 641 | |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 642 | /* GL_HP_occlusion_test */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 643 | case GL_OCCLUSION_TEST_HP: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 644 | CHECK_EXTENSION(HP_occlusion_test, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 645 | 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 Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 654 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 655 | /* GL_SGIS_pixel_texture */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 656 | case GL_PIXEL_TEXTURE_SGIS: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 657 | CHECK_EXTENSION(SGIS_pixel_texture, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 658 | if (ctx->Pixel.PixelTextureEnabled == state) |
| 659 | return; |
| 660 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 661 | ctx->Pixel.PixelTextureEnabled = state; |
| 662 | break; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 663 | |
| 664 | /* GL_SGIX_pixel_texture */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 665 | case GL_PIXEL_TEX_GEN_SGIX: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 666 | CHECK_EXTENSION(SGIX_pixel_texture, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 667 | if (ctx->Pixel.PixelTextureEnabled == state) |
| 668 | return; |
| 669 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 670 | ctx->Pixel.PixelTextureEnabled = state; |
| 671 | break; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 672 | |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 673 | /* GL_SGI_color_table */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 674 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 675 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 676 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 682 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 683 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 689 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 690 | if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) |
| 691 | return; |
| 692 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 693 | ctx->Pixel.PostColorMatrixColorTableEnabled = state; |
| 694 | break; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 695 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 696 | /* GL_EXT_convolution */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 697 | case GL_CONVOLUTION_1D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 698 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 699 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 705 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 706 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 712 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 713 | if (ctx->Pixel.Separable2DEnabled == state) |
| 714 | return; |
| 715 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 716 | ctx->Pixel.Separable2DEnabled = state; |
| 717 | break; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 718 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 719 | /* GL_ARB_texture_cube_map */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 720 | 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 Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 724 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 725 | CHECK_EXTENSION(ARB_texture_cube_map, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 726 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 727 | newenabled |= TEXTURE_CUBE_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 728 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 729 | return; |
| 730 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 731 | texUnit->Enabled = newenabled; |
| 732 | } |
| 733 | break; |
| 734 | |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 735 | /* GL_EXT_secondary_color */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 736 | case GL_COLOR_SUM_EXT: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 737 | CHECK_EXTENSION(EXT_secondary_color, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 738 | if (ctx->Fog.ColorSumEnabled == state) |
| 739 | return; |
| 740 | FLUSH_VERTICES(ctx, _NEW_FOG); |
| 741 | ctx->Fog.ColorSumEnabled = state; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 742 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 743 | 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 Whitwell | 46b0988 | 2001-02-16 18:14:41 +0000 | [diff] [blame] | 749 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 750 | break; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 751 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 752 | /* GL_ARB_multisample */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 753 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 754 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 755 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 761 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 762 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 768 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 769 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 775 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 776 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 782 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 783 | if (ctx->Multisample.SampleCoverageInvert == state) |
| 784 | return; |
| 785 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 786 | ctx->Multisample.SampleCoverageInvert = state; |
| 787 | break; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 788 | |
| 789 | /* GL_IBM_rasterpos_clip */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 790 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 791 | CHECK_EXTENSION(IBM_rasterpos_clip, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 792 | if (ctx->Transform.RasterPositionUnclipped == state) |
| 793 | return; |
| 794 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 795 | ctx->Transform.RasterPositionUnclipped = state; |
| 796 | break; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 797 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 798 | /* GL_NV_point_sprite */ |
| 799 | case GL_POINT_SPRITE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 800 | CHECK_EXTENSION(NV_point_sprite, cap); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 801 | if (ctx->Point.PointSprite == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 802 | return; |
| 803 | FLUSH_VERTICES(ctx, _NEW_POINT); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 804 | ctx->Point.PointSprite = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 805 | break; |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 806 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 807 | /* GL_NV_vertex_program */ |
| 808 | case GL_VERTEX_PROGRAM_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 809 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 810 | if (ctx->VertexProgram.Enabled == state) |
| 811 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 812 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 813 | ctx->VertexProgram.Enabled = state; |
| 814 | break; |
| 815 | case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 816 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 817 | if (ctx->VertexProgram.PointSizeEnabled == state) |
| 818 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 819 | FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 820 | ctx->VertexProgram.PointSizeEnabled = state; |
| 821 | break; |
| 822 | case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 823 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 824 | if (ctx->VertexProgram.TwoSideEnabled == state) |
| 825 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 826 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 827 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 845 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 846 | { |
| 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 Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 851 | 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 868 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 869 | { |
| 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 Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 874 | break; |
| 875 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 876 | /* 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 Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 882 | CHECK_EXTENSION(NV_texture_rectangle, cap); |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 883 | 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 Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 892 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 893 | _mesa_error(ctx, GL_INVALID_ENUM, |
| 894 | "%s(0x%x)", state ? "glEnable" : "glDisable", cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 895 | return; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 896 | } |
| 897 | |
| 898 | if (ctx->Driver.Enable) { |
| 899 | (*ctx->Driver.Enable)( ctx, cap, state ); |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 904 | void |
| 905 | _mesa_Enable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 906 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 907 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 908 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 909 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 910 | _mesa_set_enable( ctx, cap, GL_TRUE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 911 | } |
| 912 | |
| 913 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 914 | void |
| 915 | _mesa_Disable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 916 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 917 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 918 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 919 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 920 | _mesa_set_enable( ctx, cap, GL_FALSE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 924 | #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 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 931 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 932 | GLboolean |
| 933 | _mesa_IsEnabled( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 934 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 935 | GET_CURRENT_CONTEXT(ctx); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 936 | 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 Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 949 | return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 950 | 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 Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 1003 | case GL_MAP2_TEXTURE_COORD_1: |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1004 | 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 Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1040 | const struct gl_texture_unit *texUnit; |
| 1041 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1042 | return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1043 | } |
| 1044 | case GL_TEXTURE_2D: |
| 1045 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1046 | const struct gl_texture_unit *texUnit; |
| 1047 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1048 | return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1049 | } |
| 1050 | case GL_TEXTURE_3D: |
| 1051 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1052 | const struct gl_texture_unit *texUnit; |
| 1053 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1054 | return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1055 | } |
| 1056 | case GL_TEXTURE_GEN_Q: |
| 1057 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1058 | const struct gl_texture_unit *texUnit; |
| 1059 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1060 | return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
| 1061 | } |
| 1062 | case GL_TEXTURE_GEN_R: |
| 1063 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1064 | const struct gl_texture_unit *texUnit; |
| 1065 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1066 | return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
| 1067 | } |
| 1068 | case GL_TEXTURE_GEN_S: |
| 1069 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1070 | const struct gl_texture_unit *texUnit; |
| 1071 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1072 | return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
| 1073 | } |
| 1074 | case GL_TEXTURE_GEN_T: |
| 1075 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1076 | const struct gl_texture_unit *texUnit; |
| 1077 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1078 | return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
| 1079 | } |
| 1080 | |
| 1081 | /* |
| 1082 | * CLIENT STATE!!! |
| 1083 | */ |
| 1084 | case GL_VERTEX_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1085 | return (ctx->Array.Vertex.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1086 | case GL_NORMAL_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1087 | return (ctx->Array.Normal.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1088 | case GL_COLOR_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1089 | return (ctx->Array.Color.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1090 | case GL_INDEX_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1091 | return (ctx->Array.Index.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1092 | case GL_TEXTURE_COORD_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1093 | return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1094 | case GL_EDGE_FLAG_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1095 | return (ctx->Array.EdgeFlag.Enabled != 0); |
Brian Paul | 6ee7a02 | 2002-01-22 18:40:46 +0000 | [diff] [blame] | 1096 | 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 Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1102 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1103 | /* 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 Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1111 | /* GL_HP_occlusion_test */ |
| 1112 | case GL_OCCLUSION_TEST_HP: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1113 | CHECK_EXTENSION(HP_occlusion_test); |
| 1114 | return ctx->Depth.OcclusionTest; |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1115 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1116 | /* GL_SGIS_pixel_texture */ |
| 1117 | case GL_PIXEL_TEXTURE_SGIS: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1118 | CHECK_EXTENSION(SGIS_pixel_texture); |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1119 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1120 | |
| 1121 | /* GL_SGIX_pixel_texture */ |
| 1122 | case GL_PIXEL_TEX_GEN_SGIX: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1123 | CHECK_EXTENSION(SGIX_pixel_texture); |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1124 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1125 | |
| 1126 | /* GL_SGI_color_table */ |
| 1127 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1128 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1129 | return ctx->Pixel.ColorTableEnabled; |
| 1130 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1131 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1132 | return ctx->Pixel.PostConvolutionColorTableEnabled; |
| 1133 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1134 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1135 | return ctx->Pixel.PostColorMatrixColorTableEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1136 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1137 | /* GL_EXT_convolution */ |
| 1138 | case GL_CONVOLUTION_1D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1139 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1140 | return ctx->Pixel.Convolution1DEnabled; |
| 1141 | case GL_CONVOLUTION_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1142 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1143 | return ctx->Pixel.Convolution2DEnabled; |
| 1144 | case GL_SEPARABLE_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1145 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1146 | return ctx->Pixel.Separable2DEnabled; |
| 1147 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1148 | /* GL_ARB_texture_cube_map */ |
| 1149 | case GL_TEXTURE_CUBE_MAP_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1150 | CHECK_EXTENSION(ARB_texture_cube_map); |
| 1151 | { |
| 1152 | const struct gl_texture_unit *texUnit; |
| 1153 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1154 | return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1155 | } |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1156 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1157 | /* GL_ARB_multisample */ |
| 1158 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1159 | CHECK_EXTENSION(ARB_multisample); |
| 1160 | return ctx->Multisample.Enabled; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1161 | case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1162 | CHECK_EXTENSION(ARB_multisample); |
| 1163 | return ctx->Multisample.SampleAlphaToCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1164 | case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1165 | CHECK_EXTENSION(ARB_multisample); |
| 1166 | return ctx->Multisample.SampleAlphaToOne; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1167 | case GL_SAMPLE_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1168 | CHECK_EXTENSION(ARB_multisample); |
| 1169 | return ctx->Multisample.SampleCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1170 | case GL_SAMPLE_COVERAGE_INVERT_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1171 | CHECK_EXTENSION(ARB_multisample); |
| 1172 | return ctx->Multisample.SampleCoverageInvert; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1173 | |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1174 | /* GL_IBM_rasterpos_clip */ |
| 1175 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1176 | CHECK_EXTENSION(IBM_rasterpos_clip); |
| 1177 | return ctx->Transform.RasterPositionUnclipped; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1178 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 1179 | /* GL_NV_point_sprite */ |
| 1180 | case GL_POINT_SPRITE_NV: |
| 1181 | return ctx->Point.PointSprite; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 1182 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1183 | /* 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 Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1212 | return (ctx->Array.VertexAttrib[n].Enabled != 0); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1213 | } |
| 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 Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1231 | { |
| 1232 | const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
| 1233 | return ctx->Eval.Map1Attrib[map]; |
| 1234 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1235 | 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 Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1252 | { |
| 1253 | const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
| 1254 | return ctx->Eval.Map2Attrib[map]; |
| 1255 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1256 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1257 | /* 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 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1266 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame^] | 1267 | _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1268 | return GL_FALSE; |
| 1269 | } |
| 1270 | } |