| Brian Paul | 72ef753 | 2000-11-27 18:59:09 +0000 | [diff] [blame] | 1 | /* $Id: enable.c,v 1.35 2000/11/27 18:59:09 brianp Exp $ */ |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Mesa 3-D graphics library |
| Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 5 | * Version: 3.5 |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 6 | * |
| Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 7 | * Copyright (C) 1999-2000 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 | |
| 41 | #include "math/m_matrix.h" |
| 42 | #include "math/m_xform.h" |
| 43 | |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
| 46 | |
| 47 | |
| 48 | /* |
| 49 | * Perform glEnable and glDisable calls. |
| 50 | */ |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 51 | void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 52 | { |
| 53 | ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" ); |
| 54 | |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 55 | if (MESA_VERBOSE & VERBOSE_API) |
| 56 | fprintf(stderr, "%s %s (newstate is %x)\n", |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 57 | state ? "glEnable" : "glDisable", |
| 58 | gl_lookup_enum_by_nr(cap), |
| 59 | ctx->NewState); |
| 60 | |
| 61 | switch (cap) { |
| 62 | case GL_ALPHA_TEST: |
| 63 | if (ctx->Color.AlphaEnabled!=state) { |
| 64 | ctx->Color.AlphaEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 65 | ctx->NewState |= _NEW_COLOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 66 | } |
| 67 | break; |
| 68 | case GL_AUTO_NORMAL: |
| 69 | ctx->Eval.AutoNormal = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 70 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 71 | break; |
| 72 | case GL_BLEND: |
| 73 | if (ctx->Color.BlendEnabled!=state) { |
| 74 | ctx->Color.BlendEnabled = state; |
| 75 | /* The following needed to accomodate 1.0 RGB logic op blending */ |
| 76 | if (ctx->Color.BlendEquation==GL_LOGIC_OP && state) { |
| 77 | ctx->Color.ColorLogicOpEnabled = GL_TRUE; |
| 78 | } |
| 79 | else { |
| 80 | ctx->Color.ColorLogicOpEnabled = GL_FALSE; |
| 81 | } |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 82 | ctx->NewState |= _NEW_COLOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 83 | } |
| 84 | break; |
| 85 | case GL_CLIP_PLANE0: |
| 86 | case GL_CLIP_PLANE1: |
| 87 | case GL_CLIP_PLANE2: |
| 88 | case GL_CLIP_PLANE3: |
| 89 | case GL_CLIP_PLANE4: |
| 90 | case GL_CLIP_PLANE5: |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 91 | if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 92 | { |
| 93 | GLuint p = cap-GL_CLIP_PLANE0; |
| 94 | |
| 95 | ctx->Transform.ClipEnabled[p] = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 96 | ctx->NewState |= _NEW_TRANSFORM; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 97 | |
| 98 | if (state) { |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 99 | ctx->_Enabled |= ENABLE_USERCLIP; |
| 100 | ctx->Transform._AnyClip++; |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 101 | |
| Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 102 | if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { |
| Keith Whitwell | ad2ac21 | 2000-11-24 10:25:05 +0000 | [diff] [blame] | 103 | _math_matrix_analyse( &ctx->ProjectionMatrix ); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 104 | } |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 105 | |
| Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 106 | /* This derived state also calculated in clip.c and |
| 107 | * from gl_update_state() on changes to EyeUserPlane |
| 108 | * and ctx->ProjectionMatrix respectively. |
| 109 | */ |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 110 | gl_transform_vector( ctx->Transform._ClipUserPlane[p], |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 111 | ctx->Transform.EyeUserPlane[p], |
| 112 | ctx->ProjectionMatrix.inv ); |
| 113 | } else { |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 114 | if (--ctx->Transform._AnyClip == 0) |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 115 | ctx->_Enabled &= ~ENABLE_USERCLIP; |
| 116 | } |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 117 | } |
| 118 | break; |
| 119 | case GL_COLOR_MATERIAL: |
| 120 | if (ctx->Light.ColorMaterialEnabled!=state) { |
| Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 121 | ctx->Light.ColorMaterialEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 122 | ctx->NewState |= _NEW_LIGHT; |
| Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 123 | |
| 124 | if (state) { |
| 125 | FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); |
| Brian Paul | 1930053 | 2000-10-29 19:02:23 +0000 | [diff] [blame] | 126 | gl_update_color_material( ctx, ctx->Current.Color ); |
| Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 127 | } |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 128 | } |
| 129 | break; |
| 130 | case GL_CULL_FACE: |
| 131 | if (ctx->Polygon.CullFlag!=state) { |
| 132 | ctx->Polygon.CullFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 133 | /* ctx->_TriangleCaps ^= DD_TRI_CULL; */ |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 134 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 135 | } |
| 136 | break; |
| 137 | case GL_DEPTH_TEST: |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 138 | if (state && ctx->Visual.DepthBits==0) { |
| 139 | _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 140 | return; |
| 141 | } |
| 142 | if (ctx->Depth.Test!=state) { |
| 143 | ctx->Depth.Test = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 144 | ctx->NewState |= _NEW_DEPTH; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 145 | } |
| 146 | break; |
| 147 | case GL_DITHER: |
| 148 | if (ctx->NoDither) { |
| 149 | /* MESA_NO_DITHER env var */ |
| 150 | state = GL_FALSE; |
| 151 | } |
| 152 | if (ctx->Color.DitherFlag!=state) { |
| 153 | ctx->Color.DitherFlag = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 154 | ctx->NewState |= _NEW_COLOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 155 | } |
| 156 | break; |
| 157 | case GL_FOG: |
| 158 | if (ctx->Fog.Enabled!=state) { |
| 159 | ctx->Fog.Enabled = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 160 | ctx->_Enabled ^= ENABLE_FOG; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 161 | ctx->NewState |= _NEW_FOG; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 162 | } |
| 163 | break; |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 164 | case GL_HISTOGRAM: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 165 | if (ctx->Extensions.EXT_histogram) { |
| Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 166 | ctx->Pixel.HistogramEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 167 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 168 | } |
| 169 | else { |
| 170 | gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); |
| 171 | return; |
| 172 | } |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 173 | break; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 174 | case GL_LIGHT0: |
| 175 | case GL_LIGHT1: |
| 176 | case GL_LIGHT2: |
| 177 | case GL_LIGHT3: |
| 178 | case GL_LIGHT4: |
| 179 | case GL_LIGHT5: |
| 180 | case GL_LIGHT6: |
| 181 | case GL_LIGHT7: |
| Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 182 | if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) { |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 183 | ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 184 | if (state) { |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 185 | insert_at_tail(&ctx->Light.EnabledList, |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 186 | &ctx->Light.Light[cap-GL_LIGHT0]); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 187 | } |
| Brian Paul | 72ef753 | 2000-11-27 18:59:09 +0000 | [diff] [blame] | 188 | else { |
| 189 | remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); |
| 190 | } |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 191 | ctx->NewState |= _NEW_LIGHT; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 192 | } |
| 193 | break; |
| 194 | case GL_LIGHTING: |
| 195 | if (ctx->Light.Enabled!=state) { |
| 196 | ctx->Light.Enabled = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 197 | ctx->_Enabled &= ~ENABLE_LIGHT; |
| Brian Paul | 2c318aa | 1999-10-20 22:16:45 +0000 | [diff] [blame] | 198 | if (state) |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 199 | ctx->_Enabled |= ENABLE_LIGHT; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 200 | ctx->NewState |= _NEW_LIGHT; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 201 | } |
| 202 | break; |
| 203 | case GL_LINE_SMOOTH: |
| 204 | if (ctx->Line.SmoothFlag!=state) { |
| 205 | ctx->Line.SmoothFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 206 | ctx->_TriangleCaps ^= DD_LINE_SMOOTH; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 207 | ctx->NewState |= _NEW_LINE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 208 | } |
| 209 | break; |
| 210 | case GL_LINE_STIPPLE: |
| 211 | if (ctx->Line.StippleFlag!=state) { |
| 212 | ctx->Line.StippleFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 213 | ctx->_TriangleCaps ^= DD_LINE_STIPPLE; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 214 | ctx->NewState |= _NEW_LINE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 215 | } |
| 216 | break; |
| 217 | case GL_INDEX_LOGIC_OP: |
| 218 | if (ctx->Color.IndexLogicOpEnabled!=state) { |
| 219 | ctx->Color.IndexLogicOpEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 220 | ctx->NewState |= _NEW_COLOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 221 | } |
| 222 | break; |
| 223 | case GL_COLOR_LOGIC_OP: |
| 224 | if (ctx->Color.ColorLogicOpEnabled!=state) { |
| 225 | ctx->Color.ColorLogicOpEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 226 | ctx->NewState |= _NEW_COLOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 227 | } |
| 228 | break; |
| 229 | case GL_MAP1_COLOR_4: |
| 230 | ctx->Eval.Map1Color4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 231 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 232 | break; |
| 233 | case GL_MAP1_INDEX: |
| 234 | ctx->Eval.Map1Index = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 235 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 236 | break; |
| 237 | case GL_MAP1_NORMAL: |
| 238 | ctx->Eval.Map1Normal = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 239 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 240 | break; |
| 241 | case GL_MAP1_TEXTURE_COORD_1: |
| 242 | ctx->Eval.Map1TextureCoord1 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 243 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 244 | break; |
| 245 | case GL_MAP1_TEXTURE_COORD_2: |
| 246 | ctx->Eval.Map1TextureCoord2 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 247 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 248 | break; |
| 249 | case GL_MAP1_TEXTURE_COORD_3: |
| 250 | ctx->Eval.Map1TextureCoord3 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 251 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 252 | break; |
| 253 | case GL_MAP1_TEXTURE_COORD_4: |
| 254 | ctx->Eval.Map1TextureCoord4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 255 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 256 | break; |
| 257 | case GL_MAP1_VERTEX_3: |
| 258 | ctx->Eval.Map1Vertex3 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 259 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 260 | break; |
| 261 | case GL_MAP1_VERTEX_4: |
| 262 | ctx->Eval.Map1Vertex4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 263 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 264 | break; |
| 265 | case GL_MAP2_COLOR_4: |
| 266 | ctx->Eval.Map2Color4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 267 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 268 | break; |
| 269 | case GL_MAP2_INDEX: |
| 270 | ctx->Eval.Map2Index = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 271 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 272 | break; |
| 273 | case GL_MAP2_NORMAL: |
| 274 | ctx->Eval.Map2Normal = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 275 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 276 | break; |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 277 | case GL_MAP2_TEXTURE_COORD_1: |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 278 | ctx->Eval.Map2TextureCoord1 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 279 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 280 | break; |
| 281 | case GL_MAP2_TEXTURE_COORD_2: |
| 282 | ctx->Eval.Map2TextureCoord2 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 283 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 284 | break; |
| 285 | case GL_MAP2_TEXTURE_COORD_3: |
| 286 | ctx->Eval.Map2TextureCoord3 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 287 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 288 | break; |
| 289 | case GL_MAP2_TEXTURE_COORD_4: |
| 290 | ctx->Eval.Map2TextureCoord4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 291 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 292 | break; |
| 293 | case GL_MAP2_VERTEX_3: |
| 294 | ctx->Eval.Map2Vertex3 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 295 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 296 | break; |
| 297 | case GL_MAP2_VERTEX_4: |
| 298 | ctx->Eval.Map2Vertex4 = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 299 | ctx->NewState |= _NEW_EVAL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 300 | break; |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 301 | case GL_MINMAX: |
| 302 | ctx->Pixel.MinMaxEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 303 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 304 | break; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 305 | case GL_NORMALIZE: |
| 306 | if (ctx->Transform.Normalize != state) { |
| 307 | ctx->Transform.Normalize = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 308 | ctx->NewState |= _NEW_TRANSFORM; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 309 | ctx->_Enabled ^= ENABLE_NORMALIZE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 310 | } |
| 311 | break; |
| 312 | case GL_POINT_SMOOTH: |
| 313 | if (ctx->Point.SmoothFlag!=state) { |
| 314 | ctx->Point.SmoothFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 315 | ctx->_TriangleCaps ^= DD_POINT_SMOOTH; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 316 | ctx->NewState |= _NEW_POINT; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 317 | } |
| 318 | break; |
| 319 | case GL_POLYGON_SMOOTH: |
| 320 | if (ctx->Polygon.SmoothFlag!=state) { |
| 321 | ctx->Polygon.SmoothFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 322 | ctx->_TriangleCaps ^= DD_TRI_SMOOTH; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 323 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 324 | } |
| 325 | break; |
| 326 | case GL_POLYGON_STIPPLE: |
| 327 | if (ctx->Polygon.StippleFlag!=state) { |
| 328 | ctx->Polygon.StippleFlag = state; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 329 | ctx->_TriangleCaps ^= DD_TRI_STIPPLE; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 330 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 331 | } |
| 332 | break; |
| 333 | case GL_POLYGON_OFFSET_POINT: |
| 334 | if (ctx->Polygon.OffsetPoint!=state) { |
| 335 | ctx->Polygon.OffsetPoint = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 336 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 337 | } |
| 338 | break; |
| 339 | case GL_POLYGON_OFFSET_LINE: |
| 340 | if (ctx->Polygon.OffsetLine!=state) { |
| 341 | ctx->Polygon.OffsetLine = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 342 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 343 | } |
| 344 | break; |
| 345 | case GL_POLYGON_OFFSET_FILL: |
| 346 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 347 | if (ctx->Polygon.OffsetFill!=state) { |
| 348 | ctx->Polygon.OffsetFill = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 349 | ctx->NewState |= _NEW_POLYGON; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 350 | } |
| 351 | break; |
| 352 | case GL_RESCALE_NORMAL_EXT: |
| 353 | if (ctx->Transform.RescaleNormals != state) { |
| 354 | ctx->Transform.RescaleNormals = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 355 | ctx->NewState |= _NEW_TRANSFORM; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 356 | ctx->_Enabled ^= ENABLE_RESCALE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 357 | } |
| 358 | break; |
| 359 | case GL_SCISSOR_TEST: |
| 360 | if (ctx->Scissor.Enabled!=state) { |
| 361 | ctx->Scissor.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 362 | ctx->NewState |= _NEW_SCISSOR; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 363 | } |
| 364 | break; |
| 365 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 366 | ctx->Texture.SharedPalette = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 367 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 368 | break; |
| 369 | case GL_STENCIL_TEST: |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 370 | if (state && ctx->Visual.StencilBits==0) { |
| 371 | _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 372 | return; |
| 373 | } |
| 374 | if (ctx->Stencil.Enabled!=state) { |
| 375 | ctx->Stencil.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 376 | ctx->NewState |= _NEW_STENCIL; |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 377 | ctx->_TriangleCaps ^= DD_STENCIL; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 378 | } |
| 379 | break; |
| 380 | case GL_TEXTURE_1D: |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 381 | if (ctx->Visual.RGBAflag) { |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 382 | const GLuint curr = ctx->Texture.CurrentUnit; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 383 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 384 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 385 | if (state) { |
| 386 | texUnit->Enabled |= TEXTURE0_1D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 387 | } |
| 388 | else { |
| 389 | texUnit->Enabled &= ~TEXTURE0_1D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 390 | } |
| 391 | } |
| 392 | break; |
| 393 | case GL_TEXTURE_2D: |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 394 | if (ctx->Visual.RGBAflag) { |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 395 | const GLuint curr = ctx->Texture.CurrentUnit; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 396 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 397 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 398 | if (state) { |
| 399 | texUnit->Enabled |= TEXTURE0_2D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 400 | } |
| 401 | else { |
| 402 | texUnit->Enabled &= ~TEXTURE0_2D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 403 | } |
| 404 | } |
| 405 | break; |
| 406 | case GL_TEXTURE_3D: |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 407 | if (ctx->Visual.RGBAflag) { |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 408 | const GLuint curr = ctx->Texture.CurrentUnit; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 409 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 410 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 411 | if (state) { |
| 412 | texUnit->Enabled |= TEXTURE0_3D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 413 | } |
| 414 | else { |
| 415 | texUnit->Enabled &= ~TEXTURE0_3D; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 416 | } |
| 417 | } |
| 418 | break; |
| 419 | case GL_TEXTURE_GEN_Q: |
| 420 | { |
| 421 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 422 | if (state) |
| 423 | texUnit->TexGenEnabled |= Q_BIT; |
| 424 | else |
| 425 | texUnit->TexGenEnabled &= ~Q_BIT; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 426 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 427 | } |
| 428 | break; |
| 429 | case GL_TEXTURE_GEN_R: |
| 430 | { |
| 431 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 432 | if (state) |
| 433 | texUnit->TexGenEnabled |= R_BIT; |
| 434 | else |
| 435 | texUnit->TexGenEnabled &= ~R_BIT; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 436 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 437 | } |
| 438 | break; |
| 439 | case GL_TEXTURE_GEN_S: |
| 440 | { |
| 441 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 442 | if (state) |
| 443 | texUnit->TexGenEnabled |= S_BIT; |
| 444 | else |
| 445 | texUnit->TexGenEnabled &= ~S_BIT; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 446 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 447 | } |
| 448 | break; |
| 449 | case GL_TEXTURE_GEN_T: |
| 450 | { |
| 451 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 452 | if (state) |
| 453 | texUnit->TexGenEnabled |= T_BIT; |
| 454 | else |
| 455 | texUnit->TexGenEnabled &= ~T_BIT; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 456 | ctx->NewState |= _NEW_TEXTURE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 457 | } |
| 458 | break; |
| 459 | |
| 460 | /* |
| 461 | * CLIENT STATE!!! |
| 462 | */ |
| 463 | case GL_VERTEX_ARRAY: |
| 464 | ctx->Array.Vertex.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 465 | ctx->NewState |= _NEW_ARRAY; |
| 466 | break; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 467 | case GL_NORMAL_ARRAY: |
| 468 | ctx->Array.Normal.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 469 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 470 | break; |
| 471 | case GL_COLOR_ARRAY: |
| 472 | ctx->Array.Color.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 473 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 474 | break; |
| 475 | case GL_INDEX_ARRAY: |
| 476 | ctx->Array.Index.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 477 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 478 | break; |
| 479 | case GL_TEXTURE_COORD_ARRAY: |
| Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 480 | ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 481 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 482 | break; |
| 483 | case GL_EDGE_FLAG_ARRAY: |
| 484 | ctx->Array.EdgeFlag.Enabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 485 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 486 | break; |
| 487 | |
| Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 488 | /* GL_HP_occlusion_test */ |
| 489 | case GL_OCCLUSION_TEST_HP: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 490 | if (ctx->Extensions.HP_occlusion_test) { |
| Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 491 | ctx->Depth.OcclusionTest = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 492 | ctx->NewState |= _NEW_DEPTH; |
| Brian Paul | 7e67fb4 | 2000-04-04 15:14:10 +0000 | [diff] [blame] | 493 | if (state) |
| 494 | ctx->OcclusionResult = ctx->OcclusionResultSaved; |
| 495 | else |
| 496 | ctx->OcclusionResultSaved = ctx->OcclusionResult; |
| Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 497 | } |
| 498 | else { |
| 499 | gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); |
| 500 | return; |
| 501 | } |
| 502 | break; |
| 503 | |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 504 | /* GL_SGIS_pixel_texture */ |
| 505 | case GL_PIXEL_TEXTURE_SGIS: |
| Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 506 | /* XXX check for extension */ |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 507 | ctx->Pixel.PixelTextureEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 508 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 509 | break; |
| 510 | |
| 511 | /* GL_SGIX_pixel_texture */ |
| 512 | case GL_PIXEL_TEX_GEN_SGIX: |
| Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 513 | /* XXX check for extension */ |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 514 | ctx->Pixel.PixelTextureEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 515 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 516 | break; |
| 517 | |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 518 | /* GL_SGI_color_table */ |
| 519 | case GL_COLOR_TABLE_SGI: |
| Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 520 | /* XXX check for extension */ |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 521 | ctx->Pixel.ColorTableEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 522 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 523 | break; |
| 524 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
| 525 | ctx->Pixel.PostConvolutionColorTableEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 526 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 527 | break; |
| 528 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
| 529 | ctx->Pixel.PostColorMatrixColorTableEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 530 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 531 | break; |
| 532 | |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 533 | /* GL_EXT_convolution */ |
| 534 | case GL_CONVOLUTION_1D: |
| Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 535 | /* XXX check for extension */ |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 536 | ctx->Pixel.Convolution1DEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 537 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 538 | break; |
| 539 | case GL_CONVOLUTION_2D: |
| 540 | ctx->Pixel.Convolution2DEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 541 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 542 | break; |
| 543 | case GL_SEPARABLE_2D: |
| 544 | ctx->Pixel.Separable2DEnabled = state; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 545 | ctx->NewState |= _NEW_PIXEL; |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 546 | break; |
| 547 | |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 548 | /* GL_ARB_texture_cube_map */ |
| 549 | case GL_TEXTURE_CUBE_MAP_ARB: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 550 | if (ctx->Extensions.ARB_texture_cube_map) { |
| Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 551 | if (ctx->Visual.RGBAflag) { |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 552 | const GLuint curr = ctx->Texture.CurrentUnit; |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 553 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 554 | ctx->NewState |= _NEW_TEXTURE; |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 555 | if (state) { |
| 556 | texUnit->Enabled |= TEXTURE0_CUBE; |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 557 | } |
| 558 | else { |
| 559 | texUnit->Enabled &= ~TEXTURE0_CUBE; |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 560 | } |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 561 | } |
| 562 | } |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 563 | else { |
| Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 564 | gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 565 | return; |
| 566 | } |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 567 | break; |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 568 | |
| Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 569 | /* GL_EXT_secondary_color */ |
| 570 | case GL_COLOR_SUM_EXT: |
| 571 | ctx->Fog.ColorSumEnabled = state; |
| 572 | if (state) |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 573 | SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); |
| Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 574 | else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) |
| Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 575 | CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 576 | ctx->NewState |= _NEW_FOG; |
| Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 577 | break; |
| 578 | |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 579 | default: |
| Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 580 | gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 581 | return; |
| 582 | } |
| 583 | |
| 584 | if (ctx->Driver.Enable) { |
| 585 | (*ctx->Driver.Enable)( ctx, cap, state ); |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | |
| 590 | |
| 591 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 592 | void |
| 593 | _mesa_Enable( GLenum cap ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 594 | { |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 595 | GET_CURRENT_CONTEXT(ctx); |
| 596 | _mesa_set_enable( ctx, cap, GL_TRUE ); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 597 | } |
| 598 | |
| 599 | |
| 600 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 601 | void |
| 602 | _mesa_Disable( GLenum cap ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 603 | { |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 604 | GET_CURRENT_CONTEXT(ctx); |
| 605 | _mesa_set_enable( ctx, cap, GL_FALSE ); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | |
| 609 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 610 | GLboolean |
| 611 | _mesa_IsEnabled( GLenum cap ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 612 | { |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 613 | GET_CURRENT_CONTEXT(ctx); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 614 | switch (cap) { |
| 615 | case GL_ALPHA_TEST: |
| 616 | return ctx->Color.AlphaEnabled; |
| 617 | case GL_AUTO_NORMAL: |
| 618 | return ctx->Eval.AutoNormal; |
| 619 | case GL_BLEND: |
| 620 | return ctx->Color.BlendEnabled; |
| 621 | case GL_CLIP_PLANE0: |
| 622 | case GL_CLIP_PLANE1: |
| 623 | case GL_CLIP_PLANE2: |
| 624 | case GL_CLIP_PLANE3: |
| 625 | case GL_CLIP_PLANE4: |
| 626 | case GL_CLIP_PLANE5: |
| 627 | return ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0]; |
| 628 | case GL_COLOR_MATERIAL: |
| 629 | return ctx->Light.ColorMaterialEnabled; |
| 630 | case GL_CULL_FACE: |
| 631 | return ctx->Polygon.CullFlag; |
| 632 | case GL_DEPTH_TEST: |
| 633 | return ctx->Depth.Test; |
| 634 | case GL_DITHER: |
| 635 | return ctx->Color.DitherFlag; |
| 636 | case GL_FOG: |
| 637 | return ctx->Fog.Enabled; |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 638 | case GL_HISTOGRAM: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 639 | if (ctx->Extensions.EXT_histogram) { |
| Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 640 | return ctx->Pixel.HistogramEnabled; |
| 641 | } |
| 642 | else { |
| 643 | gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); |
| 644 | return GL_FALSE; |
| 645 | } |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 646 | case GL_LIGHTING: |
| 647 | return ctx->Light.Enabled; |
| 648 | case GL_LIGHT0: |
| 649 | case GL_LIGHT1: |
| 650 | case GL_LIGHT2: |
| 651 | case GL_LIGHT3: |
| 652 | case GL_LIGHT4: |
| 653 | case GL_LIGHT5: |
| 654 | case GL_LIGHT6: |
| 655 | case GL_LIGHT7: |
| 656 | return ctx->Light.Light[cap-GL_LIGHT0].Enabled; |
| 657 | case GL_LINE_SMOOTH: |
| 658 | return ctx->Line.SmoothFlag; |
| 659 | case GL_LINE_STIPPLE: |
| 660 | return ctx->Line.StippleFlag; |
| 661 | case GL_INDEX_LOGIC_OP: |
| 662 | return ctx->Color.IndexLogicOpEnabled; |
| 663 | case GL_COLOR_LOGIC_OP: |
| 664 | return ctx->Color.ColorLogicOpEnabled; |
| 665 | case GL_MAP1_COLOR_4: |
| 666 | return ctx->Eval.Map1Color4; |
| 667 | case GL_MAP1_INDEX: |
| 668 | return ctx->Eval.Map1Index; |
| 669 | case GL_MAP1_NORMAL: |
| 670 | return ctx->Eval.Map1Normal; |
| 671 | case GL_MAP1_TEXTURE_COORD_1: |
| 672 | return ctx->Eval.Map1TextureCoord1; |
| 673 | case GL_MAP1_TEXTURE_COORD_2: |
| 674 | return ctx->Eval.Map1TextureCoord2; |
| 675 | case GL_MAP1_TEXTURE_COORD_3: |
| 676 | return ctx->Eval.Map1TextureCoord3; |
| 677 | case GL_MAP1_TEXTURE_COORD_4: |
| 678 | return ctx->Eval.Map1TextureCoord4; |
| 679 | case GL_MAP1_VERTEX_3: |
| 680 | return ctx->Eval.Map1Vertex3; |
| 681 | case GL_MAP1_VERTEX_4: |
| 682 | return ctx->Eval.Map1Vertex4; |
| 683 | case GL_MAP2_COLOR_4: |
| 684 | return ctx->Eval.Map2Color4; |
| 685 | case GL_MAP2_INDEX: |
| 686 | return ctx->Eval.Map2Index; |
| 687 | case GL_MAP2_NORMAL: |
| 688 | return ctx->Eval.Map2Normal; |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 689 | case GL_MAP2_TEXTURE_COORD_1: |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 690 | return ctx->Eval.Map2TextureCoord1; |
| 691 | case GL_MAP2_TEXTURE_COORD_2: |
| 692 | return ctx->Eval.Map2TextureCoord2; |
| 693 | case GL_MAP2_TEXTURE_COORD_3: |
| 694 | return ctx->Eval.Map2TextureCoord3; |
| 695 | case GL_MAP2_TEXTURE_COORD_4: |
| 696 | return ctx->Eval.Map2TextureCoord4; |
| 697 | case GL_MAP2_VERTEX_3: |
| 698 | return ctx->Eval.Map2Vertex3; |
| 699 | case GL_MAP2_VERTEX_4: |
| 700 | return ctx->Eval.Map2Vertex4; |
| Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 701 | case GL_MINMAX: |
| 702 | return ctx->Pixel.MinMaxEnabled; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 703 | case GL_NORMALIZE: |
| 704 | return ctx->Transform.Normalize; |
| 705 | case GL_POINT_SMOOTH: |
| 706 | return ctx->Point.SmoothFlag; |
| 707 | case GL_POLYGON_SMOOTH: |
| 708 | return ctx->Polygon.SmoothFlag; |
| 709 | case GL_POLYGON_STIPPLE: |
| 710 | return ctx->Polygon.StippleFlag; |
| 711 | case GL_POLYGON_OFFSET_POINT: |
| 712 | return ctx->Polygon.OffsetPoint; |
| 713 | case GL_POLYGON_OFFSET_LINE: |
| 714 | return ctx->Polygon.OffsetLine; |
| 715 | case GL_POLYGON_OFFSET_FILL: |
| 716 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 717 | return ctx->Polygon.OffsetFill; |
| 718 | case GL_RESCALE_NORMAL_EXT: |
| 719 | return ctx->Transform.RescaleNormals; |
| 720 | case GL_SCISSOR_TEST: |
| 721 | return ctx->Scissor.Enabled; |
| 722 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 723 | return ctx->Texture.SharedPalette; |
| 724 | case GL_STENCIL_TEST: |
| 725 | return ctx->Stencil.Enabled; |
| 726 | case GL_TEXTURE_1D: |
| 727 | { |
| 728 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 729 | return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE; |
| 730 | } |
| 731 | case GL_TEXTURE_2D: |
| 732 | { |
| 733 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 734 | return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE; |
| 735 | } |
| 736 | case GL_TEXTURE_3D: |
| 737 | { |
| 738 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| Brian Paul | 65b5e1e | 1999-08-19 13:24:27 +0000 | [diff] [blame] | 739 | return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 740 | } |
| 741 | case GL_TEXTURE_GEN_Q: |
| 742 | { |
| 743 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 744 | return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
| 745 | } |
| 746 | case GL_TEXTURE_GEN_R: |
| 747 | { |
| 748 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 749 | return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
| 750 | } |
| 751 | case GL_TEXTURE_GEN_S: |
| 752 | { |
| 753 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 754 | return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
| 755 | } |
| 756 | case GL_TEXTURE_GEN_T: |
| 757 | { |
| 758 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 759 | return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
| 760 | } |
| 761 | |
| 762 | /* |
| 763 | * CLIENT STATE!!! |
| 764 | */ |
| 765 | case GL_VERTEX_ARRAY: |
| 766 | return ctx->Array.Vertex.Enabled; |
| 767 | case GL_NORMAL_ARRAY: |
| 768 | return ctx->Array.Normal.Enabled; |
| 769 | case GL_COLOR_ARRAY: |
| 770 | return ctx->Array.Color.Enabled; |
| 771 | case GL_INDEX_ARRAY: |
| 772 | return ctx->Array.Index.Enabled; |
| 773 | case GL_TEXTURE_COORD_ARRAY: |
| Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 774 | return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 775 | case GL_EDGE_FLAG_ARRAY: |
| 776 | return ctx->Array.EdgeFlag.Enabled; |
| Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 777 | |
| 778 | /* GL_HP_occlusion_test */ |
| 779 | case GL_OCCLUSION_TEST_HP: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 780 | if (ctx->Extensions.HP_occlusion_test) { |
| Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 781 | return ctx->Depth.OcclusionTest; |
| 782 | } |
| 783 | else { |
| 784 | gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); |
| 785 | return GL_FALSE; |
| 786 | } |
| 787 | |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 788 | /* GL_SGIS_pixel_texture */ |
| 789 | case GL_PIXEL_TEXTURE_SGIS: |
| 790 | return ctx->Pixel.PixelTextureEnabled; |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 791 | |
| 792 | /* GL_SGIX_pixel_texture */ |
| 793 | case GL_PIXEL_TEX_GEN_SGIX: |
| 794 | return ctx->Pixel.PixelTextureEnabled; |
| Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 795 | |
| 796 | /* GL_SGI_color_table */ |
| 797 | case GL_COLOR_TABLE_SGI: |
| 798 | return ctx->Pixel.ColorTableEnabled; |
| 799 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
| 800 | return ctx->Pixel.PostConvolutionColorTableEnabled; |
| 801 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
| 802 | return ctx->Pixel.PostColorMatrixColorTableEnabled; |
| Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 803 | |
| Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 804 | /* GL_EXT_convolution */ |
| 805 | case GL_CONVOLUTION_1D: |
| 806 | return ctx->Pixel.Convolution1DEnabled; |
| 807 | case GL_CONVOLUTION_2D: |
| 808 | return ctx->Pixel.Convolution2DEnabled; |
| 809 | case GL_SEPARABLE_2D: |
| 810 | return ctx->Pixel.Separable2DEnabled; |
| 811 | |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 812 | /* GL_ARB_texture_cube_map */ |
| 813 | case GL_TEXTURE_CUBE_MAP_ARB: |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 814 | if (ctx->Extensions.ARB_texture_cube_map) { |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 815 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 816 | return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 817 | } |
| Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 818 | else { |
| 819 | gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); |
| 820 | return GL_FALSE; |
| 821 | } |
| Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 822 | |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 823 | default: |
| 824 | gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); |
| 825 | return GL_FALSE; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | |
| 830 | |
| 831 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 832 | static void |
| 833 | client_state( GLcontext *ctx, GLenum cap, GLboolean state ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 834 | { |
| Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 835 | ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, |
| 836 | (state |
| 837 | ? "glEnableClientState" |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 838 | : "glDisableClientState") ); |
| 839 | |
| 840 | switch (cap) { |
| 841 | case GL_VERTEX_ARRAY: |
| 842 | ctx->Array.Vertex.Enabled = state; |
| 843 | break; |
| 844 | case GL_NORMAL_ARRAY: |
| 845 | ctx->Array.Normal.Enabled = state; |
| 846 | break; |
| 847 | case GL_COLOR_ARRAY: |
| 848 | ctx->Array.Color.Enabled = state; |
| 849 | break; |
| 850 | case GL_INDEX_ARRAY: |
| 851 | ctx->Array.Index.Enabled = state; |
| 852 | break; |
| 853 | case GL_TEXTURE_COORD_ARRAY: |
| Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 854 | ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 855 | break; |
| 856 | case GL_EDGE_FLAG_ARRAY: |
| 857 | ctx->Array.EdgeFlag.Enabled = state; |
| 858 | break; |
| Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 859 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 860 | ctx->Array.FogCoord.Enabled = state; |
| 861 | break; |
| 862 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 863 | ctx->Array.SecondaryColor.Enabled = state; |
| 864 | break; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 865 | default: |
| 866 | gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); |
| 867 | } |
| 868 | |
| Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 869 | ctx->NewState |= _NEW_ARRAY; |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | |
| 873 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 874 | void |
| 875 | _mesa_EnableClientState( GLenum cap ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 876 | { |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 877 | GET_CURRENT_CONTEXT(ctx); |
| 878 | client_state( ctx, cap, GL_TRUE ); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 879 | } |
| 880 | |
| 881 | |
| 882 | |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 883 | void |
| 884 | _mesa_DisableClientState( GLenum cap ) |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 885 | { |
| Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 886 | GET_CURRENT_CONTEXT(ctx); |
| 887 | client_state( ctx, cap, GL_FALSE ); |
| jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 888 | } |
| 889 | |