Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 1 | /* $Id: enable.c,v 1.67 2002/06/18 16:53:46 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 | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 47 | char s[100]; \ |
| 48 | sprintf(s, "gl%sClientState(0x%x)", state ? "Enable" : "Disable", CAP);\ |
| 49 | _mesa_error(ctx, GL_INVALID_ENUM, s); \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 50 | return; \ |
| 51 | } |
| 52 | |
| 53 | |
| 54 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 55 | static void |
| 56 | client_state( GLcontext *ctx, GLenum cap, GLboolean state ) |
| 57 | { |
| 58 | GLuint flag; |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 59 | GLuint *var; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 60 | |
| 61 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 62 | case GL_VERTEX_ARRAY: |
| 63 | var = &ctx->Array.Vertex.Enabled; |
| 64 | flag = _NEW_ARRAY_VERTEX; |
| 65 | break; |
| 66 | case GL_NORMAL_ARRAY: |
| 67 | var = &ctx->Array.Normal.Enabled; |
| 68 | flag = _NEW_ARRAY_NORMAL; |
| 69 | break; |
| 70 | case GL_COLOR_ARRAY: |
| 71 | var = &ctx->Array.Color.Enabled; |
| 72 | flag = _NEW_ARRAY_COLOR0; |
| 73 | break; |
| 74 | case GL_INDEX_ARRAY: |
| 75 | var = &ctx->Array.Index.Enabled; |
| 76 | flag = _NEW_ARRAY_INDEX; |
| 77 | break; |
| 78 | case GL_TEXTURE_COORD_ARRAY: |
| 79 | var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; |
| 80 | flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); |
| 81 | break; |
| 82 | case GL_EDGE_FLAG_ARRAY: |
| 83 | var = &ctx->Array.EdgeFlag.Enabled; |
| 84 | flag = _NEW_ARRAY_EDGEFLAG; |
| 85 | break; |
| 86 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 87 | var = &ctx->Array.FogCoord.Enabled; |
| 88 | flag = _NEW_ARRAY_FOGCOORD; |
| 89 | break; |
| 90 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 91 | var = &ctx->Array.SecondaryColor.Enabled; |
| 92 | flag = _NEW_ARRAY_COLOR1; |
| 93 | break; |
| 94 | |
| 95 | /* GL_NV_vertex_program */ |
| 96 | case GL_VERTEX_ATTRIB_ARRAY0_NV: |
| 97 | case GL_VERTEX_ATTRIB_ARRAY1_NV: |
| 98 | case GL_VERTEX_ATTRIB_ARRAY2_NV: |
| 99 | case GL_VERTEX_ATTRIB_ARRAY3_NV: |
| 100 | case GL_VERTEX_ATTRIB_ARRAY4_NV: |
| 101 | case GL_VERTEX_ATTRIB_ARRAY5_NV: |
| 102 | case GL_VERTEX_ATTRIB_ARRAY6_NV: |
| 103 | case GL_VERTEX_ATTRIB_ARRAY7_NV: |
| 104 | case GL_VERTEX_ATTRIB_ARRAY8_NV: |
| 105 | case GL_VERTEX_ATTRIB_ARRAY9_NV: |
| 106 | case GL_VERTEX_ATTRIB_ARRAY10_NV: |
| 107 | case GL_VERTEX_ATTRIB_ARRAY11_NV: |
| 108 | case GL_VERTEX_ATTRIB_ARRAY12_NV: |
| 109 | case GL_VERTEX_ATTRIB_ARRAY13_NV: |
| 110 | case GL_VERTEX_ATTRIB_ARRAY14_NV: |
| 111 | case GL_VERTEX_ATTRIB_ARRAY15_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 112 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 113 | { |
| 114 | GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
| 115 | var = &ctx->Array.VertexAttrib[n].Enabled; |
Brian Paul | b775272 | 2002-04-21 18:49:18 +0000 | [diff] [blame] | 116 | flag = _NEW_ARRAY_ATTRIB(n); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 117 | } |
| 118 | break; |
| 119 | default: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 120 | { |
| 121 | char s[100]; |
| 122 | sprintf(s, "glEnable/DisableClientState(0x%x)", cap); |
| 123 | _mesa_error( ctx, GL_INVALID_ENUM, s); |
| 124 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 125 | return; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Alan Hourihane | 68c48df | 2002-04-19 08:38:23 +0000 | [diff] [blame] | 128 | if (*var == state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 129 | return; |
| 130 | |
| 131 | FLUSH_VERTICES(ctx, _NEW_ARRAY); |
| 132 | ctx->Array.NewState |= flag; |
| 133 | *var = state; |
| 134 | |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 135 | if (state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 136 | ctx->Array._Enabled |= flag; |
| 137 | else |
| 138 | ctx->Array._Enabled &= ~flag; |
| 139 | |
| 140 | if (ctx->Driver.Enable) { |
| 141 | (*ctx->Driver.Enable)( ctx, cap, state ); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | |
| 146 | |
| 147 | void |
| 148 | _mesa_EnableClientState( GLenum cap ) |
| 149 | { |
| 150 | GET_CURRENT_CONTEXT(ctx); |
| 151 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 152 | client_state( ctx, cap, GL_TRUE ); |
| 153 | } |
| 154 | |
| 155 | |
| 156 | |
| 157 | void |
| 158 | _mesa_DisableClientState( GLenum cap ) |
| 159 | { |
| 160 | GET_CURRENT_CONTEXT(ctx); |
| 161 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 162 | client_state( ctx, cap, GL_FALSE ); |
| 163 | } |
| 164 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 165 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 166 | #undef CHECK_EXTENSION |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 167 | #define CHECK_EXTENSION(EXTNAME, CAP) \ |
| 168 | if (!ctx->Extensions.EXTNAME) { \ |
| 169 | char s[100]; \ |
| 170 | sprintf(s, "gl%s(0x%x)", state ? "Enable" : "Disable", CAP); \ |
| 171 | _mesa_error(ctx, GL_INVALID_ENUM, s); \ |
| 172 | return; \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 176 | /* |
| 177 | * Perform glEnable and glDisable calls. |
| 178 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 179 | void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 180 | { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 181 | if (MESA_VERBOSE & VERBOSE_API) |
Brian Paul | 4753d60 | 2002-06-15 02:38:15 +0000 | [diff] [blame] | 182 | _mesa_debug(ctx, "%s %s (newstate is %x)\n", |
Brian Paul | 9a33a11 | 2002-06-13 04:28:29 +0000 | [diff] [blame] | 183 | state ? "glEnable" : "glDisable", |
| 184 | _mesa_lookup_enum_by_nr(cap), |
| 185 | ctx->NewState); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 186 | |
| 187 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 188 | case GL_ALPHA_TEST: |
| 189 | if (ctx->Color.AlphaEnabled == state) |
| 190 | return; |
| 191 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 192 | ctx->Color.AlphaEnabled = state; |
| 193 | break; |
| 194 | case GL_AUTO_NORMAL: |
| 195 | if (ctx->Eval.AutoNormal == state) |
| 196 | return; |
| 197 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 198 | ctx->Eval.AutoNormal = state; |
| 199 | break; |
| 200 | case GL_BLEND: |
| 201 | if (ctx->Color.BlendEnabled == state) |
| 202 | return; |
| 203 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 204 | ctx->Color.BlendEnabled = state; |
| 205 | /* The following needed to accomodate 1.0 RGB logic op blending */ |
| 206 | ctx->Color.ColorLogicOpEnabled = |
| 207 | (ctx->Color.BlendEquation == GL_LOGIC_OP && state); |
| 208 | break; |
| 209 | case GL_CLIP_PLANE0: |
| 210 | case GL_CLIP_PLANE1: |
| 211 | case GL_CLIP_PLANE2: |
| 212 | case GL_CLIP_PLANE3: |
| 213 | case GL_CLIP_PLANE4: |
| 214 | case GL_CLIP_PLANE5: |
| 215 | { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 216 | const GLuint p = cap - GL_CLIP_PLANE0; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 217 | |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 218 | if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 219 | return; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 220 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 221 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 222 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 223 | if (state) { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 224 | ctx->Transform.ClipPlanesEnabled |= (1 << p); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 225 | |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 226 | if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) |
Brian Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 227 | _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 228 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 229 | /* This derived state also calculated in clip.c and |
| 230 | * from _mesa_update_state() on changes to EyeUserPlane |
| 231 | * and ctx->ProjectionMatrix respectively. |
| 232 | */ |
| 233 | _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], |
| 234 | ctx->Transform.EyeUserPlane[p], |
Brian Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 235 | ctx->ProjectionMatrixStack.Top->inv ); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 236 | } |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 237 | else { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 238 | ctx->Transform.ClipPlanesEnabled &= ~(1 << p); |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 239 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 240 | } |
| 241 | break; |
| 242 | case GL_COLOR_MATERIAL: |
| 243 | if (ctx->Light.ColorMaterialEnabled == state) |
| 244 | return; |
| 245 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
| 246 | ctx->Light.ColorMaterialEnabled = state; |
| 247 | if (state) { |
| 248 | FLUSH_CURRENT(ctx, 0); |
| 249 | _mesa_update_color_material( ctx, |
| 250 | ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
| 251 | } |
| 252 | break; |
| 253 | case GL_CULL_FACE: |
| 254 | if (ctx->Polygon.CullFlag == state) |
| 255 | return; |
| 256 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 257 | ctx->Polygon.CullFlag = state; |
| 258 | break; |
| 259 | case GL_DEPTH_TEST: |
| 260 | if (state && ctx->Visual.depthBits==0) { |
| 261 | _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); |
| 262 | return; |
| 263 | } |
| 264 | if (ctx->Depth.Test==state) |
| 265 | return; |
| 266 | FLUSH_VERTICES(ctx, _NEW_DEPTH); |
| 267 | ctx->Depth.Test = state; |
| 268 | break; |
| 269 | case GL_DITHER: |
| 270 | if (ctx->NoDither) { |
| 271 | state = GL_FALSE; /* MESA_NO_DITHER env var */ |
| 272 | } |
| 273 | if (ctx->Color.DitherFlag==state) |
| 274 | return; |
| 275 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 276 | ctx->Color.DitherFlag = state; |
| 277 | break; |
| 278 | case GL_FOG: |
| 279 | if (ctx->Fog.Enabled==state) |
| 280 | return; |
| 281 | FLUSH_VERTICES(ctx, _NEW_FOG); |
| 282 | ctx->Fog.Enabled = state; |
| 283 | break; |
| 284 | case GL_HISTOGRAM: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 285 | CHECK_EXTENSION(EXT_histogram, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 286 | if (ctx->Pixel.HistogramEnabled == state) |
| 287 | return; |
| 288 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 289 | ctx->Pixel.HistogramEnabled = state; |
| 290 | break; |
| 291 | case GL_LIGHT0: |
| 292 | case GL_LIGHT1: |
| 293 | case GL_LIGHT2: |
| 294 | case GL_LIGHT3: |
| 295 | case GL_LIGHT4: |
| 296 | case GL_LIGHT5: |
| 297 | case GL_LIGHT6: |
| 298 | case GL_LIGHT7: |
| 299 | if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) |
| 300 | return; |
| 301 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
| 302 | ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; |
| 303 | if (state) { |
| 304 | insert_at_tail(&ctx->Light.EnabledList, |
| 305 | &ctx->Light.Light[cap-GL_LIGHT0]); |
| 306 | } |
| 307 | else { |
| 308 | remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); |
| 309 | } |
| 310 | break; |
| 311 | case GL_LIGHTING: |
| 312 | if (ctx->Light.Enabled == state) |
| 313 | return; |
| 314 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
| 315 | ctx->Light.Enabled = state; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 316 | |
Keith Whitwell | 0cb2841 | 2002-02-13 00:53:19 +0000 | [diff] [blame] | 317 | if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) |
| 318 | ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; |
| 319 | else |
| 320 | ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; |
| 321 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 322 | if ((ctx->Light.Enabled && |
| 323 | ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) |
| 324 | || ctx->Fog.ColorSumEnabled) |
| 325 | ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; |
| 326 | else |
| 327 | ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; |
| 328 | |
| 329 | break; |
| 330 | case GL_LINE_SMOOTH: |
| 331 | if (ctx->Line.SmoothFlag == state) |
| 332 | return; |
| 333 | FLUSH_VERTICES(ctx, _NEW_LINE); |
| 334 | ctx->Line.SmoothFlag = state; |
| 335 | ctx->_TriangleCaps ^= DD_LINE_SMOOTH; |
| 336 | break; |
| 337 | case GL_LINE_STIPPLE: |
| 338 | if (ctx->Line.StippleFlag == state) |
| 339 | return; |
| 340 | FLUSH_VERTICES(ctx, _NEW_LINE); |
| 341 | ctx->Line.StippleFlag = state; |
| 342 | ctx->_TriangleCaps ^= DD_LINE_STIPPLE; |
| 343 | break; |
| 344 | case GL_INDEX_LOGIC_OP: |
| 345 | if (ctx->Color.IndexLogicOpEnabled == state) |
| 346 | return; |
| 347 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 348 | ctx->Color.IndexLogicOpEnabled = state; |
| 349 | break; |
| 350 | case GL_COLOR_LOGIC_OP: |
| 351 | if (ctx->Color.ColorLogicOpEnabled == state) |
| 352 | return; |
| 353 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 354 | ctx->Color.ColorLogicOpEnabled = state; |
| 355 | break; |
| 356 | case GL_MAP1_COLOR_4: |
| 357 | if (ctx->Eval.Map1Color4 == state) |
| 358 | return; |
| 359 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 360 | ctx->Eval.Map1Color4 = state; |
| 361 | break; |
| 362 | case GL_MAP1_INDEX: |
| 363 | if (ctx->Eval.Map1Index == state) |
| 364 | return; |
| 365 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 366 | ctx->Eval.Map1Index = state; |
| 367 | break; |
| 368 | case GL_MAP1_NORMAL: |
| 369 | if (ctx->Eval.Map1Normal == state) |
| 370 | return; |
| 371 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 372 | ctx->Eval.Map1Normal = state; |
| 373 | break; |
| 374 | case GL_MAP1_TEXTURE_COORD_1: |
| 375 | if (ctx->Eval.Map1TextureCoord1 == state) |
| 376 | return; |
| 377 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 378 | ctx->Eval.Map1TextureCoord1 = state; |
| 379 | break; |
| 380 | case GL_MAP1_TEXTURE_COORD_2: |
| 381 | if (ctx->Eval.Map1TextureCoord2 == state) |
| 382 | return; |
| 383 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 384 | ctx->Eval.Map1TextureCoord2 = state; |
| 385 | break; |
| 386 | case GL_MAP1_TEXTURE_COORD_3: |
| 387 | if (ctx->Eval.Map1TextureCoord3 == state) |
| 388 | return; |
| 389 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 390 | ctx->Eval.Map1TextureCoord3 = state; |
| 391 | break; |
| 392 | case GL_MAP1_TEXTURE_COORD_4: |
| 393 | if (ctx->Eval.Map1TextureCoord4 == state) |
| 394 | return; |
| 395 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 396 | ctx->Eval.Map1TextureCoord4 = state; |
| 397 | break; |
| 398 | case GL_MAP1_VERTEX_3: |
| 399 | if (ctx->Eval.Map1Vertex3 == state) |
| 400 | return; |
| 401 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 402 | ctx->Eval.Map1Vertex3 = state; |
| 403 | break; |
| 404 | case GL_MAP1_VERTEX_4: |
| 405 | if (ctx->Eval.Map1Vertex4 == state) |
| 406 | return; |
| 407 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 408 | ctx->Eval.Map1Vertex4 = state; |
| 409 | break; |
| 410 | case GL_MAP2_COLOR_4: |
| 411 | if (ctx->Eval.Map2Color4 == state) |
| 412 | return; |
| 413 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 414 | ctx->Eval.Map2Color4 = state; |
| 415 | break; |
| 416 | case GL_MAP2_INDEX: |
| 417 | if (ctx->Eval.Map2Index == state) |
| 418 | return; |
| 419 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 420 | ctx->Eval.Map2Index = state; |
| 421 | break; |
| 422 | case GL_MAP2_NORMAL: |
| 423 | if (ctx->Eval.Map2Normal == state) |
| 424 | return; |
| 425 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 426 | ctx->Eval.Map2Normal = state; |
| 427 | break; |
| 428 | case GL_MAP2_TEXTURE_COORD_1: |
| 429 | if (ctx->Eval.Map2TextureCoord1 == state) |
| 430 | return; |
| 431 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 432 | ctx->Eval.Map2TextureCoord1 = state; |
| 433 | break; |
| 434 | case GL_MAP2_TEXTURE_COORD_2: |
| 435 | if (ctx->Eval.Map2TextureCoord2 == state) |
| 436 | return; |
| 437 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 438 | ctx->Eval.Map2TextureCoord2 = state; |
| 439 | break; |
| 440 | case GL_MAP2_TEXTURE_COORD_3: |
| 441 | if (ctx->Eval.Map2TextureCoord3 == state) |
| 442 | return; |
| 443 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 444 | ctx->Eval.Map2TextureCoord3 = state; |
| 445 | break; |
| 446 | case GL_MAP2_TEXTURE_COORD_4: |
| 447 | if (ctx->Eval.Map2TextureCoord4 == state) |
| 448 | return; |
| 449 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 450 | ctx->Eval.Map2TextureCoord4 = state; |
| 451 | break; |
| 452 | case GL_MAP2_VERTEX_3: |
| 453 | if (ctx->Eval.Map2Vertex3 == state) |
| 454 | return; |
| 455 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 456 | ctx->Eval.Map2Vertex3 = state; |
| 457 | break; |
| 458 | case GL_MAP2_VERTEX_4: |
| 459 | if (ctx->Eval.Map2Vertex4 == state) |
| 460 | return; |
| 461 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 462 | ctx->Eval.Map2Vertex4 = state; |
| 463 | break; |
| 464 | case GL_MINMAX: |
| 465 | if (ctx->Pixel.MinMaxEnabled == state) |
| 466 | return; |
| 467 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 468 | ctx->Pixel.MinMaxEnabled = state; |
| 469 | break; |
| 470 | case GL_NORMALIZE: |
| 471 | if (ctx->Transform.Normalize == state) |
| 472 | return; |
| 473 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 474 | ctx->Transform.Normalize = state; |
| 475 | break; |
| 476 | case GL_POINT_SMOOTH: |
| 477 | if (ctx->Point.SmoothFlag==state) |
| 478 | return; |
| 479 | FLUSH_VERTICES(ctx, _NEW_POINT); |
| 480 | ctx->Point.SmoothFlag = state; |
| 481 | ctx->_TriangleCaps ^= DD_POINT_SMOOTH; |
| 482 | break; |
| 483 | case GL_POLYGON_SMOOTH: |
| 484 | if (ctx->Polygon.SmoothFlag==state) |
| 485 | return; |
| 486 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 487 | ctx->Polygon.SmoothFlag = state; |
| 488 | ctx->_TriangleCaps ^= DD_TRI_SMOOTH; |
| 489 | break; |
| 490 | case GL_POLYGON_STIPPLE: |
| 491 | if (ctx->Polygon.StippleFlag==state) |
| 492 | return; |
| 493 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 494 | ctx->Polygon.StippleFlag = state; |
| 495 | ctx->_TriangleCaps ^= DD_TRI_STIPPLE; |
| 496 | break; |
| 497 | case GL_POLYGON_OFFSET_POINT: |
| 498 | if (ctx->Polygon.OffsetPoint==state) |
| 499 | return; |
| 500 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 501 | ctx->Polygon.OffsetPoint = state; |
| 502 | break; |
| 503 | case GL_POLYGON_OFFSET_LINE: |
| 504 | if (ctx->Polygon.OffsetLine==state) |
| 505 | return; |
| 506 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 507 | ctx->Polygon.OffsetLine = state; |
| 508 | break; |
| 509 | case GL_POLYGON_OFFSET_FILL: |
| 510 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 511 | if (ctx->Polygon.OffsetFill==state) |
| 512 | return; |
| 513 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 514 | ctx->Polygon.OffsetFill = state; |
| 515 | break; |
| 516 | case GL_RESCALE_NORMAL_EXT: |
| 517 | if (ctx->Transform.RescaleNormals == state) |
| 518 | return; |
| 519 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 520 | ctx->Transform.RescaleNormals = state; |
| 521 | break; |
| 522 | case GL_SCISSOR_TEST: |
| 523 | if (ctx->Scissor.Enabled==state) |
| 524 | return; |
| 525 | FLUSH_VERTICES(ctx, _NEW_SCISSOR); |
| 526 | ctx->Scissor.Enabled = state; |
| 527 | break; |
| 528 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 529 | if (ctx->Texture.SharedPalette == state) |
| 530 | return; |
| 531 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 532 | ctx->Texture.SharedPalette = state; |
| 533 | break; |
| 534 | case GL_STENCIL_TEST: |
| 535 | if (state && ctx->Visual.stencilBits==0) { |
| 536 | _mesa_warning(ctx, |
| 537 | "glEnable(GL_STENCIL_TEST) but no stencil buffer"); |
| 538 | return; |
| 539 | } |
| 540 | if (ctx->Stencil.Enabled==state) |
| 541 | return; |
| 542 | FLUSH_VERTICES(ctx, _NEW_STENCIL); |
| 543 | ctx->Stencil.Enabled = state; |
| 544 | break; |
| 545 | case GL_TEXTURE_1D: { |
| 546 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 547 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 548 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 549 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 550 | newenabled |= TEXTURE_1D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 551 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 552 | return; |
| 553 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 554 | texUnit->Enabled = newenabled; |
| 555 | break; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 556 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 557 | case GL_TEXTURE_2D: { |
| 558 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 559 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 560 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 561 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 562 | newenabled |= TEXTURE_2D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 563 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 564 | return; |
| 565 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 566 | texUnit->Enabled = newenabled; |
| 567 | break; |
| 568 | } |
| 569 | case GL_TEXTURE_3D: { |
| 570 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 571 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 572 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 573 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 574 | newenabled |= TEXTURE_3D_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 575 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 576 | return; |
| 577 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 578 | texUnit->Enabled = newenabled; |
| 579 | break; |
| 580 | } |
| 581 | case GL_TEXTURE_GEN_Q: { |
| 582 | GLuint unit = ctx->Texture.CurrentUnit; |
| 583 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 584 | GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; |
| 585 | if (state) |
| 586 | newenabled |= Q_BIT; |
| 587 | if (texUnit->TexGenEnabled == newenabled) |
| 588 | return; |
| 589 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 590 | texUnit->TexGenEnabled = newenabled; |
| 591 | break; |
| 592 | } |
| 593 | case GL_TEXTURE_GEN_R: { |
| 594 | GLuint unit = ctx->Texture.CurrentUnit; |
| 595 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 596 | GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; |
| 597 | if (state) |
| 598 | newenabled |= R_BIT; |
| 599 | if (texUnit->TexGenEnabled == newenabled) |
| 600 | return; |
| 601 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 602 | texUnit->TexGenEnabled = newenabled; |
| 603 | break; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 604 | } |
| 605 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 606 | case GL_TEXTURE_GEN_S: { |
| 607 | GLuint unit = ctx->Texture.CurrentUnit; |
| 608 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 609 | GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; |
| 610 | if (state) |
| 611 | newenabled |= S_BIT; |
| 612 | if (texUnit->TexGenEnabled == newenabled) |
| 613 | return; |
| 614 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 615 | texUnit->TexGenEnabled = newenabled; |
| 616 | break; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 617 | } |
| 618 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 619 | case GL_TEXTURE_GEN_T: { |
| 620 | GLuint unit = ctx->Texture.CurrentUnit; |
| 621 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 622 | GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; |
| 623 | if (state) |
| 624 | newenabled |= T_BIT; |
| 625 | if (texUnit->TexGenEnabled == newenabled) |
| 626 | return; |
| 627 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 628 | texUnit->TexGenEnabled = newenabled; |
| 629 | break; |
| 630 | } |
| 631 | break; |
Keith Whitwell | 46b0988 | 2001-02-16 18:14:41 +0000 | [diff] [blame] | 632 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 633 | /* |
| 634 | * CLIENT STATE!!! |
| 635 | */ |
| 636 | case GL_VERTEX_ARRAY: |
| 637 | case GL_NORMAL_ARRAY: |
| 638 | case GL_COLOR_ARRAY: |
| 639 | case GL_INDEX_ARRAY: |
| 640 | case GL_TEXTURE_COORD_ARRAY: |
| 641 | case GL_EDGE_FLAG_ARRAY: |
| 642 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 643 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 644 | client_state( ctx, cap, state ); |
| 645 | return; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 646 | |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 647 | /* GL_HP_occlusion_test */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 648 | case GL_OCCLUSION_TEST_HP: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 649 | CHECK_EXTENSION(HP_occlusion_test, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 650 | if (ctx->Depth.OcclusionTest == state) |
| 651 | return; |
| 652 | FLUSH_VERTICES(ctx, _NEW_DEPTH); |
| 653 | ctx->Depth.OcclusionTest = state; |
| 654 | if (state) |
| 655 | ctx->OcclusionResult = ctx->OcclusionResultSaved; |
| 656 | else |
| 657 | ctx->OcclusionResultSaved = ctx->OcclusionResult; |
| 658 | break; |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 659 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 660 | /* GL_SGIS_pixel_texture */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 661 | case GL_PIXEL_TEXTURE_SGIS: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 662 | CHECK_EXTENSION(SGIS_pixel_texture, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 663 | if (ctx->Pixel.PixelTextureEnabled == state) |
| 664 | return; |
| 665 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 666 | ctx->Pixel.PixelTextureEnabled = state; |
| 667 | break; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 668 | |
| 669 | /* GL_SGIX_pixel_texture */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 670 | case GL_PIXEL_TEX_GEN_SGIX: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 671 | CHECK_EXTENSION(SGIX_pixel_texture, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 672 | if (ctx->Pixel.PixelTextureEnabled == state) |
| 673 | return; |
| 674 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 675 | ctx->Pixel.PixelTextureEnabled = state; |
| 676 | break; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 677 | |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 678 | /* GL_SGI_color_table */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 679 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 680 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 681 | if (ctx->Pixel.ColorTableEnabled == state) |
| 682 | return; |
| 683 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 684 | ctx->Pixel.ColorTableEnabled = state; |
| 685 | break; |
| 686 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 687 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 688 | if (ctx->Pixel.PostConvolutionColorTableEnabled == state) |
| 689 | return; |
| 690 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 691 | ctx->Pixel.PostConvolutionColorTableEnabled = state; |
| 692 | break; |
| 693 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 694 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 695 | if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) |
| 696 | return; |
| 697 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 698 | ctx->Pixel.PostColorMatrixColorTableEnabled = state; |
| 699 | break; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 700 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 701 | /* GL_EXT_convolution */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 702 | case GL_CONVOLUTION_1D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 703 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 704 | if (ctx->Pixel.Convolution1DEnabled == state) |
| 705 | return; |
| 706 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 707 | ctx->Pixel.Convolution1DEnabled = state; |
| 708 | break; |
| 709 | case GL_CONVOLUTION_2D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 710 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 711 | if (ctx->Pixel.Convolution2DEnabled == state) |
| 712 | return; |
| 713 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 714 | ctx->Pixel.Convolution2DEnabled = state; |
| 715 | break; |
| 716 | case GL_SEPARABLE_2D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 717 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 718 | if (ctx->Pixel.Separable2DEnabled == state) |
| 719 | return; |
| 720 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 721 | ctx->Pixel.Separable2DEnabled = state; |
| 722 | break; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 723 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 724 | /* GL_ARB_texture_cube_map */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 725 | case GL_TEXTURE_CUBE_MAP_ARB: |
| 726 | { |
| 727 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 728 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 729 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 730 | CHECK_EXTENSION(ARB_texture_cube_map, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 731 | if (state) |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 732 | newenabled |= TEXTURE_CUBE_BIT; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 733 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 734 | return; |
| 735 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 736 | texUnit->Enabled = newenabled; |
| 737 | } |
| 738 | break; |
| 739 | |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 740 | /* GL_EXT_secondary_color */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 741 | case GL_COLOR_SUM_EXT: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 742 | CHECK_EXTENSION(EXT_secondary_color, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 743 | if (ctx->Fog.ColorSumEnabled == state) |
| 744 | return; |
| 745 | FLUSH_VERTICES(ctx, _NEW_FOG); |
| 746 | ctx->Fog.ColorSumEnabled = state; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 747 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 748 | if ((ctx->Light.Enabled && |
| 749 | ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) |
| 750 | || ctx->Fog.ColorSumEnabled) |
| 751 | ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; |
| 752 | else |
| 753 | ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; |
Keith Whitwell | 46b0988 | 2001-02-16 18:14:41 +0000 | [diff] [blame] | 754 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 755 | break; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 756 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 757 | /* GL_ARB_multisample */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 758 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 759 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 760 | if (ctx->Multisample.Enabled == state) |
| 761 | return; |
| 762 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 763 | ctx->Multisample.Enabled = state; |
| 764 | break; |
| 765 | case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 766 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 767 | if (ctx->Multisample.SampleAlphaToCoverage == state) |
| 768 | return; |
| 769 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 770 | ctx->Multisample.SampleAlphaToCoverage = state; |
| 771 | break; |
| 772 | case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 773 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 774 | if (ctx->Multisample.SampleAlphaToOne == state) |
| 775 | return; |
| 776 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 777 | ctx->Multisample.SampleAlphaToOne = state; |
| 778 | break; |
| 779 | case GL_SAMPLE_COVERAGE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 780 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 781 | if (ctx->Multisample.SampleCoverage == state) |
| 782 | return; |
| 783 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 784 | ctx->Multisample.SampleCoverage = state; |
| 785 | break; |
| 786 | case GL_SAMPLE_COVERAGE_INVERT_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 787 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 788 | if (ctx->Multisample.SampleCoverageInvert == state) |
| 789 | return; |
| 790 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 791 | ctx->Multisample.SampleCoverageInvert = state; |
| 792 | break; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 793 | |
| 794 | /* GL_IBM_rasterpos_clip */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 795 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 796 | CHECK_EXTENSION(IBM_rasterpos_clip, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 797 | if (ctx->Transform.RasterPositionUnclipped == state) |
| 798 | return; |
| 799 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 800 | ctx->Transform.RasterPositionUnclipped = state; |
| 801 | break; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 802 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 803 | /* GL_NV_point_sprite */ |
| 804 | case GL_POINT_SPRITE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 805 | CHECK_EXTENSION(NV_point_sprite, cap); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 806 | if (ctx->Point.PointSprite == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 807 | return; |
| 808 | FLUSH_VERTICES(ctx, _NEW_POINT); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 809 | ctx->Point.PointSprite = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 810 | break; |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 811 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 812 | /* GL_NV_vertex_program */ |
| 813 | case GL_VERTEX_PROGRAM_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 814 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 815 | if (ctx->VertexProgram.Enabled == state) |
| 816 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 817 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 818 | ctx->VertexProgram.Enabled = state; |
| 819 | break; |
| 820 | case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 821 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 822 | if (ctx->VertexProgram.PointSizeEnabled == state) |
| 823 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 824 | FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 825 | ctx->VertexProgram.PointSizeEnabled = state; |
| 826 | break; |
| 827 | case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 828 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 829 | if (ctx->VertexProgram.TwoSideEnabled == state) |
| 830 | return; |
Brian Paul | 571a1ac | 2002-01-06 20:39:03 +0000 | [diff] [blame] | 831 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 832 | ctx->VertexProgram.TwoSideEnabled = state; |
| 833 | break; |
| 834 | case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
| 835 | case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
| 836 | case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
| 837 | case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
| 838 | case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
| 839 | case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
| 840 | case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
| 841 | case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
| 842 | case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
| 843 | case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
| 844 | case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
| 845 | case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
| 846 | case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
| 847 | case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
| 848 | case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
| 849 | case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 850 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 851 | { |
| 852 | const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
| 853 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 854 | ctx->Eval.Map1Attrib[map] = state; |
| 855 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 856 | break; |
| 857 | case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
| 858 | case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
| 859 | case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
| 860 | case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
| 861 | case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
| 862 | case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
| 863 | case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
| 864 | case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
| 865 | case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
| 866 | case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
| 867 | case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
| 868 | case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
| 869 | case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
| 870 | case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
| 871 | case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
| 872 | case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 873 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 874 | { |
| 875 | const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
| 876 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 877 | ctx->Eval.Map2Attrib[map] = state; |
| 878 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 879 | break; |
| 880 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 881 | /* GL_NV_texture_rectangle */ |
| 882 | case GL_TEXTURE_RECTANGLE_NV: |
| 883 | { |
| 884 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 885 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
| 886 | GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 887 | CHECK_EXTENSION(NV_texture_rectangle, cap); |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 888 | if (state) |
| 889 | newenabled |= TEXTURE_RECT_BIT; |
| 890 | if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 891 | return; |
| 892 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 893 | texUnit->Enabled = newenabled; |
| 894 | } |
| 895 | break; |
| 896 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 897 | default: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 898 | { |
| 899 | char s[100]; |
| 900 | sprintf(s, "%s(0x%x)", state ? "glEnable" : "glDisable", cap); |
| 901 | _mesa_error(ctx, GL_INVALID_ENUM, s); |
| 902 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 903 | return; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | if (ctx->Driver.Enable) { |
| 907 | (*ctx->Driver.Enable)( ctx, cap, state ); |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 912 | void |
| 913 | _mesa_Enable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 914 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 915 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 916 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 917 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 918 | _mesa_set_enable( ctx, cap, GL_TRUE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 919 | } |
| 920 | |
| 921 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 922 | void |
| 923 | _mesa_Disable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 924 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 925 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 926 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 927 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 928 | _mesa_set_enable( ctx, cap, GL_FALSE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 932 | #undef CHECK_EXTENSION |
| 933 | #define CHECK_EXTENSION(EXTNAME) \ |
| 934 | if (!ctx->Extensions.EXTNAME) { \ |
| 935 | _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ |
| 936 | return GL_FALSE; \ |
| 937 | } |
| 938 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 939 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 940 | GLboolean |
| 941 | _mesa_IsEnabled( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 942 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 943 | GET_CURRENT_CONTEXT(ctx); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 944 | switch (cap) { |
| 945 | case GL_ALPHA_TEST: |
| 946 | return ctx->Color.AlphaEnabled; |
| 947 | case GL_AUTO_NORMAL: |
| 948 | return ctx->Eval.AutoNormal; |
| 949 | case GL_BLEND: |
| 950 | return ctx->Color.BlendEnabled; |
| 951 | case GL_CLIP_PLANE0: |
| 952 | case GL_CLIP_PLANE1: |
| 953 | case GL_CLIP_PLANE2: |
| 954 | case GL_CLIP_PLANE3: |
| 955 | case GL_CLIP_PLANE4: |
| 956 | case GL_CLIP_PLANE5: |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 957 | return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 958 | case GL_COLOR_MATERIAL: |
| 959 | return ctx->Light.ColorMaterialEnabled; |
| 960 | case GL_CULL_FACE: |
| 961 | return ctx->Polygon.CullFlag; |
| 962 | case GL_DEPTH_TEST: |
| 963 | return ctx->Depth.Test; |
| 964 | case GL_DITHER: |
| 965 | return ctx->Color.DitherFlag; |
| 966 | case GL_FOG: |
| 967 | return ctx->Fog.Enabled; |
| 968 | case GL_LIGHTING: |
| 969 | return ctx->Light.Enabled; |
| 970 | case GL_LIGHT0: |
| 971 | case GL_LIGHT1: |
| 972 | case GL_LIGHT2: |
| 973 | case GL_LIGHT3: |
| 974 | case GL_LIGHT4: |
| 975 | case GL_LIGHT5: |
| 976 | case GL_LIGHT6: |
| 977 | case GL_LIGHT7: |
| 978 | return ctx->Light.Light[cap-GL_LIGHT0].Enabled; |
| 979 | case GL_LINE_SMOOTH: |
| 980 | return ctx->Line.SmoothFlag; |
| 981 | case GL_LINE_STIPPLE: |
| 982 | return ctx->Line.StippleFlag; |
| 983 | case GL_INDEX_LOGIC_OP: |
| 984 | return ctx->Color.IndexLogicOpEnabled; |
| 985 | case GL_COLOR_LOGIC_OP: |
| 986 | return ctx->Color.ColorLogicOpEnabled; |
| 987 | case GL_MAP1_COLOR_4: |
| 988 | return ctx->Eval.Map1Color4; |
| 989 | case GL_MAP1_INDEX: |
| 990 | return ctx->Eval.Map1Index; |
| 991 | case GL_MAP1_NORMAL: |
| 992 | return ctx->Eval.Map1Normal; |
| 993 | case GL_MAP1_TEXTURE_COORD_1: |
| 994 | return ctx->Eval.Map1TextureCoord1; |
| 995 | case GL_MAP1_TEXTURE_COORD_2: |
| 996 | return ctx->Eval.Map1TextureCoord2; |
| 997 | case GL_MAP1_TEXTURE_COORD_3: |
| 998 | return ctx->Eval.Map1TextureCoord3; |
| 999 | case GL_MAP1_TEXTURE_COORD_4: |
| 1000 | return ctx->Eval.Map1TextureCoord4; |
| 1001 | case GL_MAP1_VERTEX_3: |
| 1002 | return ctx->Eval.Map1Vertex3; |
| 1003 | case GL_MAP1_VERTEX_4: |
| 1004 | return ctx->Eval.Map1Vertex4; |
| 1005 | case GL_MAP2_COLOR_4: |
| 1006 | return ctx->Eval.Map2Color4; |
| 1007 | case GL_MAP2_INDEX: |
| 1008 | return ctx->Eval.Map2Index; |
| 1009 | case GL_MAP2_NORMAL: |
| 1010 | return ctx->Eval.Map2Normal; |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 1011 | case GL_MAP2_TEXTURE_COORD_1: |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1012 | return ctx->Eval.Map2TextureCoord1; |
| 1013 | case GL_MAP2_TEXTURE_COORD_2: |
| 1014 | return ctx->Eval.Map2TextureCoord2; |
| 1015 | case GL_MAP2_TEXTURE_COORD_3: |
| 1016 | return ctx->Eval.Map2TextureCoord3; |
| 1017 | case GL_MAP2_TEXTURE_COORD_4: |
| 1018 | return ctx->Eval.Map2TextureCoord4; |
| 1019 | case GL_MAP2_VERTEX_3: |
| 1020 | return ctx->Eval.Map2Vertex3; |
| 1021 | case GL_MAP2_VERTEX_4: |
| 1022 | return ctx->Eval.Map2Vertex4; |
| 1023 | case GL_NORMALIZE: |
| 1024 | return ctx->Transform.Normalize; |
| 1025 | case GL_POINT_SMOOTH: |
| 1026 | return ctx->Point.SmoothFlag; |
| 1027 | case GL_POLYGON_SMOOTH: |
| 1028 | return ctx->Polygon.SmoothFlag; |
| 1029 | case GL_POLYGON_STIPPLE: |
| 1030 | return ctx->Polygon.StippleFlag; |
| 1031 | case GL_POLYGON_OFFSET_POINT: |
| 1032 | return ctx->Polygon.OffsetPoint; |
| 1033 | case GL_POLYGON_OFFSET_LINE: |
| 1034 | return ctx->Polygon.OffsetLine; |
| 1035 | case GL_POLYGON_OFFSET_FILL: |
| 1036 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 1037 | return ctx->Polygon.OffsetFill; |
| 1038 | case GL_RESCALE_NORMAL_EXT: |
| 1039 | return ctx->Transform.RescaleNormals; |
| 1040 | case GL_SCISSOR_TEST: |
| 1041 | return ctx->Scissor.Enabled; |
| 1042 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 1043 | return ctx->Texture.SharedPalette; |
| 1044 | case GL_STENCIL_TEST: |
| 1045 | return ctx->Stencil.Enabled; |
| 1046 | case GL_TEXTURE_1D: |
| 1047 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1048 | const struct gl_texture_unit *texUnit; |
| 1049 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1050 | return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1051 | } |
| 1052 | case GL_TEXTURE_2D: |
| 1053 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1054 | const struct gl_texture_unit *texUnit; |
| 1055 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1056 | return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1057 | } |
| 1058 | case GL_TEXTURE_3D: |
| 1059 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1060 | const struct gl_texture_unit *texUnit; |
| 1061 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1062 | return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1063 | } |
| 1064 | case GL_TEXTURE_GEN_Q: |
| 1065 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1066 | const struct gl_texture_unit *texUnit; |
| 1067 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1068 | return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
| 1069 | } |
| 1070 | case GL_TEXTURE_GEN_R: |
| 1071 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1072 | const struct gl_texture_unit *texUnit; |
| 1073 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1074 | return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
| 1075 | } |
| 1076 | case GL_TEXTURE_GEN_S: |
| 1077 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1078 | const struct gl_texture_unit *texUnit; |
| 1079 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1080 | return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
| 1081 | } |
| 1082 | case GL_TEXTURE_GEN_T: |
| 1083 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1084 | const struct gl_texture_unit *texUnit; |
| 1085 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1086 | return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
| 1087 | } |
| 1088 | |
| 1089 | /* |
| 1090 | * CLIENT STATE!!! |
| 1091 | */ |
| 1092 | case GL_VERTEX_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1093 | return (ctx->Array.Vertex.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1094 | case GL_NORMAL_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1095 | return (ctx->Array.Normal.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1096 | case GL_COLOR_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1097 | return (ctx->Array.Color.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1098 | case GL_INDEX_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1099 | return (ctx->Array.Index.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1100 | case GL_TEXTURE_COORD_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1101 | return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1102 | case GL_EDGE_FLAG_ARRAY: |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1103 | return (ctx->Array.EdgeFlag.Enabled != 0); |
Brian Paul | 6ee7a02 | 2002-01-22 18:40:46 +0000 | [diff] [blame] | 1104 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 1105 | CHECK_EXTENSION(EXT_fog_coord); |
| 1106 | return (ctx->Array.FogCoord.Enabled != 0); |
| 1107 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 1108 | CHECK_EXTENSION(EXT_secondary_color); |
| 1109 | return (ctx->Array.SecondaryColor.Enabled != 0); |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1110 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1111 | /* GL_EXT_histogram */ |
| 1112 | case GL_HISTOGRAM: |
| 1113 | CHECK_EXTENSION(EXT_histogram); |
| 1114 | return ctx->Pixel.HistogramEnabled; |
| 1115 | case GL_MINMAX: |
| 1116 | CHECK_EXTENSION(EXT_histogram); |
| 1117 | return ctx->Pixel.MinMaxEnabled; |
| 1118 | |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1119 | /* GL_HP_occlusion_test */ |
| 1120 | case GL_OCCLUSION_TEST_HP: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1121 | CHECK_EXTENSION(HP_occlusion_test); |
| 1122 | return ctx->Depth.OcclusionTest; |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1123 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1124 | /* GL_SGIS_pixel_texture */ |
| 1125 | case GL_PIXEL_TEXTURE_SGIS: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1126 | CHECK_EXTENSION(SGIS_pixel_texture); |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1127 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1128 | |
| 1129 | /* GL_SGIX_pixel_texture */ |
| 1130 | case GL_PIXEL_TEX_GEN_SGIX: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1131 | CHECK_EXTENSION(SGIX_pixel_texture); |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1132 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1133 | |
| 1134 | /* GL_SGI_color_table */ |
| 1135 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1136 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1137 | return ctx->Pixel.ColorTableEnabled; |
| 1138 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1139 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1140 | return ctx->Pixel.PostConvolutionColorTableEnabled; |
| 1141 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1142 | CHECK_EXTENSION(SGI_color_table); |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1143 | return ctx->Pixel.PostColorMatrixColorTableEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1144 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1145 | /* GL_EXT_convolution */ |
| 1146 | case GL_CONVOLUTION_1D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1147 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1148 | return ctx->Pixel.Convolution1DEnabled; |
| 1149 | case GL_CONVOLUTION_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1150 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1151 | return ctx->Pixel.Convolution2DEnabled; |
| 1152 | case GL_SEPARABLE_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1153 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1154 | return ctx->Pixel.Separable2DEnabled; |
| 1155 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1156 | /* GL_ARB_texture_cube_map */ |
| 1157 | case GL_TEXTURE_CUBE_MAP_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1158 | CHECK_EXTENSION(ARB_texture_cube_map); |
| 1159 | { |
| 1160 | const struct gl_texture_unit *texUnit; |
| 1161 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1162 | return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1163 | } |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1164 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1165 | /* GL_ARB_multisample */ |
| 1166 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1167 | CHECK_EXTENSION(ARB_multisample); |
| 1168 | return ctx->Multisample.Enabled; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1169 | case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1170 | CHECK_EXTENSION(ARB_multisample); |
| 1171 | return ctx->Multisample.SampleAlphaToCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1172 | case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1173 | CHECK_EXTENSION(ARB_multisample); |
| 1174 | return ctx->Multisample.SampleAlphaToOne; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1175 | case GL_SAMPLE_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1176 | CHECK_EXTENSION(ARB_multisample); |
| 1177 | return ctx->Multisample.SampleCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1178 | case GL_SAMPLE_COVERAGE_INVERT_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1179 | CHECK_EXTENSION(ARB_multisample); |
| 1180 | return ctx->Multisample.SampleCoverageInvert; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1181 | |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1182 | /* GL_IBM_rasterpos_clip */ |
| 1183 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1184 | CHECK_EXTENSION(IBM_rasterpos_clip); |
| 1185 | return ctx->Transform.RasterPositionUnclipped; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1186 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 1187 | /* GL_NV_point_sprite */ |
| 1188 | case GL_POINT_SPRITE_NV: |
| 1189 | return ctx->Point.PointSprite; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 1190 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1191 | /* GL_NV_vertex_program */ |
| 1192 | case GL_VERTEX_PROGRAM_NV: |
| 1193 | CHECK_EXTENSION(NV_vertex_program); |
| 1194 | return ctx->VertexProgram.Enabled; |
| 1195 | case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
| 1196 | CHECK_EXTENSION(NV_vertex_program); |
| 1197 | return ctx->VertexProgram.PointSizeEnabled; |
| 1198 | case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
| 1199 | CHECK_EXTENSION(NV_vertex_program); |
| 1200 | return ctx->VertexProgram.TwoSideEnabled; |
| 1201 | case GL_VERTEX_ATTRIB_ARRAY0_NV: |
| 1202 | case GL_VERTEX_ATTRIB_ARRAY1_NV: |
| 1203 | case GL_VERTEX_ATTRIB_ARRAY2_NV: |
| 1204 | case GL_VERTEX_ATTRIB_ARRAY3_NV: |
| 1205 | case GL_VERTEX_ATTRIB_ARRAY4_NV: |
| 1206 | case GL_VERTEX_ATTRIB_ARRAY5_NV: |
| 1207 | case GL_VERTEX_ATTRIB_ARRAY6_NV: |
| 1208 | case GL_VERTEX_ATTRIB_ARRAY7_NV: |
| 1209 | case GL_VERTEX_ATTRIB_ARRAY8_NV: |
| 1210 | case GL_VERTEX_ATTRIB_ARRAY9_NV: |
| 1211 | case GL_VERTEX_ATTRIB_ARRAY10_NV: |
| 1212 | case GL_VERTEX_ATTRIB_ARRAY11_NV: |
| 1213 | case GL_VERTEX_ATTRIB_ARRAY12_NV: |
| 1214 | case GL_VERTEX_ATTRIB_ARRAY13_NV: |
| 1215 | case GL_VERTEX_ATTRIB_ARRAY14_NV: |
| 1216 | case GL_VERTEX_ATTRIB_ARRAY15_NV: |
| 1217 | CHECK_EXTENSION(NV_vertex_program); |
| 1218 | { |
| 1219 | GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
Brian Paul | 8e6d305 | 2002-01-11 17:26:54 +0000 | [diff] [blame] | 1220 | return (ctx->Array.VertexAttrib[n].Enabled != 0); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1221 | } |
| 1222 | case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
| 1223 | case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
| 1224 | case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
| 1225 | case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
| 1226 | case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
| 1227 | case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
| 1228 | case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
| 1229 | case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
| 1230 | case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
| 1231 | case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
| 1232 | case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
| 1233 | case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
| 1234 | case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
| 1235 | case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
| 1236 | case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
| 1237 | case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
| 1238 | CHECK_EXTENSION(NV_vertex_program); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1239 | { |
| 1240 | const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
| 1241 | return ctx->Eval.Map1Attrib[map]; |
| 1242 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1243 | case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
| 1244 | case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
| 1245 | case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
| 1246 | case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
| 1247 | case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
| 1248 | case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
| 1249 | case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
| 1250 | case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
| 1251 | case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
| 1252 | case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
| 1253 | case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
| 1254 | case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
| 1255 | case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
| 1256 | case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
| 1257 | case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
| 1258 | case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
| 1259 | CHECK_EXTENSION(NV_vertex_program); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1260 | { |
| 1261 | const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
| 1262 | return ctx->Eval.Map2Attrib[map]; |
| 1263 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1264 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1265 | /* GL_NV_texture_rectangle */ |
| 1266 | case GL_TEXTURE_RECTANGLE_NV: |
| 1267 | CHECK_EXTENSION(NV_texture_rectangle); |
| 1268 | { |
| 1269 | const struct gl_texture_unit *texUnit; |
| 1270 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 1271 | return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; |
| 1272 | } |
| 1273 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1274 | default: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 1275 | { |
| 1276 | char s[100]; |
| 1277 | sprintf(s, "glIsEnabled(0x%x)", (int) cap); |
| 1278 | _mesa_error( ctx, GL_INVALID_ENUM, s ); |
| 1279 | } |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1280 | return GL_FALSE; |
| 1281 | } |
| 1282 | } |