Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file enable.c |
| 3 | * Enable/disable/query GL capabilities. |
| 4 | */ |
| 5 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 6 | /* |
| 7 | * Mesa 3-D graphics library |
Brian | 454043c | 2007-12-03 14:14:16 -0700 | [diff] [blame] | 8 | * Version: 7.0.3 |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 9 | * |
Brian | 454043c | 2007-12-03 14:14:16 -0700 | [diff] [blame] | 10 | * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 11 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 12 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 13 | * copy of this software and associated documentation files (the "Software"), |
| 14 | * to deal in the Software without restriction, including without limitation |
| 15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 16 | * and/or sell copies of the Software, and to permit persons to whom the |
| 17 | * Software is furnished to do so, subject to the following conditions: |
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 above copyright notice and this permission notice shall be included |
| 20 | * in all copies or substantial portions of the Software. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 21 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 23 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 25 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 26 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 28 | */ |
| 29 | |
| 30 | |
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 "simple_list.h" |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 37 | #include "mtypes.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 38 | #include "enums.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 39 | #include "math/m_matrix.h" |
| 40 | #include "math/m_xform.h" |
Krzysztof Czurylo | 6f4fd3a | 2008-08-21 15:01:20 -0700 | [diff] [blame] | 41 | #include "api_arrayelt.h" |
Brian Paul | 3c63452 | 2002-10-24 23:57:19 +0000 | [diff] [blame] | 42 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 43 | |
| 44 | |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 45 | #define CHECK_EXTENSION(EXTNAME, CAP) \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 46 | if (!ctx->Extensions.EXTNAME) { \ |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 47 | _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ |
| 48 | state ? "Enable" : "Disable", CAP); \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 49 | return; \ |
| 50 | } |
| 51 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 52 | |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 53 | /** |
| 54 | * Helper to enable/disable client-side state. |
| 55 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 56 | static void |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 57 | client_state(GLcontext *ctx, GLenum cap, GLboolean state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 58 | { |
| 59 | GLuint flag; |
Keith Whitwell | 99efde4 | 2006-10-30 16:44:13 +0000 | [diff] [blame] | 60 | GLboolean *var; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 61 | |
| 62 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 63 | case GL_VERTEX_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 64 | var = &ctx->Array.ArrayObj->Vertex.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 65 | flag = _NEW_ARRAY_VERTEX; |
| 66 | break; |
| 67 | case GL_NORMAL_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 68 | var = &ctx->Array.ArrayObj->Normal.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 69 | flag = _NEW_ARRAY_NORMAL; |
| 70 | break; |
| 71 | case GL_COLOR_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 72 | var = &ctx->Array.ArrayObj->Color.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 73 | flag = _NEW_ARRAY_COLOR0; |
| 74 | break; |
| 75 | case GL_INDEX_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 76 | var = &ctx->Array.ArrayObj->Index.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 77 | flag = _NEW_ARRAY_INDEX; |
| 78 | break; |
| 79 | case GL_TEXTURE_COORD_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 80 | var = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 81 | flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); |
| 82 | break; |
| 83 | case GL_EDGE_FLAG_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 84 | var = &ctx->Array.ArrayObj->EdgeFlag.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 85 | flag = _NEW_ARRAY_EDGEFLAG; |
| 86 | break; |
| 87 | case GL_FOG_COORDINATE_ARRAY_EXT: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 88 | var = &ctx->Array.ArrayObj->FogCoord.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 89 | flag = _NEW_ARRAY_FOGCOORD; |
| 90 | break; |
| 91 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 92 | var = &ctx->Array.ArrayObj->SecondaryColor.Enabled; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 93 | flag = _NEW_ARRAY_COLOR1; |
| 94 | break; |
| 95 | |
Brian Paul | 1cf2c8a | 2008-06-25 08:45:14 -0600 | [diff] [blame^] | 96 | #if FEATURE_point_size_array |
| 97 | case GL_POINT_SIZE_ARRAY_OES: |
| 98 | var = &ctx->Array.ArrayObj->PointSize.Enabled; |
| 99 | flag = _NEW_ARRAY_POINT_SIZE; |
| 100 | break; |
| 101 | #endif |
| 102 | |
Brian Paul | 8dfc5b9 | 2002-10-16 17:57:51 +0000 | [diff] [blame] | 103 | #if FEATURE_NV_vertex_program |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 104 | case GL_VERTEX_ATTRIB_ARRAY0_NV: |
| 105 | case GL_VERTEX_ATTRIB_ARRAY1_NV: |
| 106 | case GL_VERTEX_ATTRIB_ARRAY2_NV: |
| 107 | case GL_VERTEX_ATTRIB_ARRAY3_NV: |
| 108 | case GL_VERTEX_ATTRIB_ARRAY4_NV: |
| 109 | case GL_VERTEX_ATTRIB_ARRAY5_NV: |
| 110 | case GL_VERTEX_ATTRIB_ARRAY6_NV: |
| 111 | case GL_VERTEX_ATTRIB_ARRAY7_NV: |
| 112 | case GL_VERTEX_ATTRIB_ARRAY8_NV: |
| 113 | case GL_VERTEX_ATTRIB_ARRAY9_NV: |
| 114 | case GL_VERTEX_ATTRIB_ARRAY10_NV: |
| 115 | case GL_VERTEX_ATTRIB_ARRAY11_NV: |
| 116 | case GL_VERTEX_ATTRIB_ARRAY12_NV: |
| 117 | case GL_VERTEX_ATTRIB_ARRAY13_NV: |
| 118 | case GL_VERTEX_ATTRIB_ARRAY14_NV: |
| 119 | case GL_VERTEX_ATTRIB_ARRAY15_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 120 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 121 | { |
| 122 | GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 123 | var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled; |
Brian Paul | b775272 | 2002-04-21 18:49:18 +0000 | [diff] [blame] | 124 | flag = _NEW_ARRAY_ATTRIB(n); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 125 | } |
| 126 | break; |
Brian Paul | 8dfc5b9 | 2002-10-16 17:57:51 +0000 | [diff] [blame] | 127 | #endif /* FEATURE_NV_vertex_program */ |
| 128 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 129 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 130 | _mesa_error( ctx, GL_INVALID_ENUM, |
| 131 | "glEnable/DisableClientState(0x%x)", cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 132 | return; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Alan Hourihane | 68c48df | 2002-04-19 08:38:23 +0000 | [diff] [blame] | 135 | if (*var == state) |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 136 | return; |
| 137 | |
| 138 | FLUSH_VERTICES(ctx, _NEW_ARRAY); |
| 139 | ctx->Array.NewState |= flag; |
Krzysztof Czurylo | 6f4fd3a | 2008-08-21 15:01:20 -0700 | [diff] [blame] | 140 | |
| 141 | _ae_invalidate_state(ctx, _NEW_ARRAY); |
| 142 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 143 | *var = state; |
| 144 | |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 145 | if (state) |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 146 | ctx->Array.ArrayObj->_Enabled |= flag; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 147 | else |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 148 | ctx->Array.ArrayObj->_Enabled &= ~flag; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 149 | |
| 150 | if (ctx->Driver.Enable) { |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 151 | ctx->Driver.Enable( ctx, cap, state ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 152 | } |
| 153 | } |
| 154 | |
| 155 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 156 | /** |
| 157 | * Enable GL capability. |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 158 | * \param cap state to enable/disable. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 159 | * |
| 160 | * Get's the current context, assures that we're outside glBegin()/glEnd() and |
| 161 | * calls client_state(). |
| 162 | */ |
Kendall Bennett | c40d1dd | 2003-10-21 22:22:17 +0000 | [diff] [blame] | 163 | void GLAPIENTRY |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 164 | _mesa_EnableClientState( GLenum cap ) |
| 165 | { |
| 166 | GET_CURRENT_CONTEXT(ctx); |
| 167 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 168 | client_state( ctx, cap, GL_TRUE ); |
| 169 | } |
| 170 | |
| 171 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 172 | /** |
| 173 | * Disable GL capability. |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 174 | * \param cap state to enable/disable. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 175 | * |
| 176 | * Get's the current context, assures that we're outside glBegin()/glEnd() and |
| 177 | * calls client_state(). |
| 178 | */ |
Kendall Bennett | c40d1dd | 2003-10-21 22:22:17 +0000 | [diff] [blame] | 179 | void GLAPIENTRY |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 180 | _mesa_DisableClientState( GLenum cap ) |
| 181 | { |
| 182 | GET_CURRENT_CONTEXT(ctx); |
| 183 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 184 | client_state( ctx, cap, GL_FALSE ); |
| 185 | } |
| 186 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 187 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 188 | #undef CHECK_EXTENSION |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 189 | #define CHECK_EXTENSION(EXTNAME, CAP) \ |
| 190 | if (!ctx->Extensions.EXTNAME) { \ |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 191 | _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ |
| 192 | state ? "Enable" : "Disable", CAP); \ |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 193 | return; \ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Brian Paul | efb2ade | 2004-08-18 18:45:25 +0000 | [diff] [blame] | 196 | #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \ |
| 197 | if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ |
| 198 | _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ |
| 199 | state ? "Enable" : "Disable", CAP); \ |
| 200 | return; \ |
| 201 | } |
| 202 | |
| 203 | |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 204 | /** |
| 205 | * Helper function to enable or disable a texture target. |
| 206 | */ |
| 207 | static GLboolean |
Ian Romanick | c9e723e | 2007-05-10 08:20:04 -0700 | [diff] [blame] | 208 | enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit) |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 209 | { |
| 210 | const GLuint curr = ctx->Texture.CurrentUnit; |
| 211 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Ian Romanick | 64a6a50 | 2007-05-10 15:00:41 -0700 | [diff] [blame] | 212 | const GLuint newenabled = (!state) |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 213 | ? (texUnit->Enabled & ~bit) : (texUnit->Enabled | bit); |
| 214 | |
| 215 | if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) |
| 216 | return GL_FALSE; |
| 217 | |
| 218 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 219 | texUnit->Enabled = newenabled; |
| 220 | return GL_TRUE; |
| 221 | } |
| 222 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 223 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 224 | /** |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 225 | * Helper function to enable or disable state. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 226 | * |
| 227 | * \param ctx GL context. |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 228 | * \param cap the state to enable/disable |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 229 | * \param state whether to enable or disable the specified capability. |
| 230 | * |
| 231 | * Updates the current context and flushes the vertices as needed. For |
| 232 | * capabilities associated with extensions it verifies that those extensions |
| 233 | * are effectivly present before updating. Notifies the driver via |
| 234 | * dd_function_table::Enable. |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 235 | */ |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 236 | void |
| 237 | _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 238 | { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 239 | if (MESA_VERBOSE & VERBOSE_API) |
Brian Paul | 4753d60 | 2002-06-15 02:38:15 +0000 | [diff] [blame] | 240 | _mesa_debug(ctx, "%s %s (newstate is %x)\n", |
Brian Paul | 9a33a11 | 2002-06-13 04:28:29 +0000 | [diff] [blame] | 241 | state ? "glEnable" : "glDisable", |
| 242 | _mesa_lookup_enum_by_nr(cap), |
| 243 | ctx->NewState); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 244 | |
| 245 | switch (cap) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 246 | case GL_ALPHA_TEST: |
| 247 | if (ctx->Color.AlphaEnabled == state) |
| 248 | return; |
| 249 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 250 | ctx->Color.AlphaEnabled = state; |
| 251 | break; |
| 252 | case GL_AUTO_NORMAL: |
| 253 | if (ctx->Eval.AutoNormal == state) |
| 254 | return; |
| 255 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 256 | ctx->Eval.AutoNormal = state; |
| 257 | break; |
| 258 | case GL_BLEND: |
| 259 | if (ctx->Color.BlendEnabled == state) |
| 260 | return; |
| 261 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 262 | ctx->Color.BlendEnabled = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 263 | break; |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 264 | #if FEATURE_userclip |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 265 | case GL_CLIP_PLANE0: |
| 266 | case GL_CLIP_PLANE1: |
| 267 | case GL_CLIP_PLANE2: |
| 268 | case GL_CLIP_PLANE3: |
| 269 | case GL_CLIP_PLANE4: |
| 270 | case GL_CLIP_PLANE5: |
| 271 | { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 272 | const GLuint p = cap - GL_CLIP_PLANE0; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 273 | |
Brian Paul | db07de0 | 2002-04-19 00:23:08 +0000 | [diff] [blame] | 274 | if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 275 | return; |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 276 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 277 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 278 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 279 | if (state) { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 280 | ctx->Transform.ClipPlanesEnabled |= (1 << p); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 281 | |
Brian Paul | 049e320 | 2005-06-30 14:22:23 +0000 | [diff] [blame] | 282 | if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) |
Brian Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 283 | _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 284 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 285 | /* This derived state also calculated in clip.c and |
| 286 | * from _mesa_update_state() on changes to EyeUserPlane |
| 287 | * and ctx->ProjectionMatrix respectively. |
| 288 | */ |
| 289 | _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], |
| 290 | ctx->Transform.EyeUserPlane[p], |
Brian Paul | 30f51ae | 2001-12-18 04:06:44 +0000 | [diff] [blame] | 291 | ctx->ProjectionMatrixStack.Top->inv ); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 292 | } |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 293 | else { |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 294 | ctx->Transform.ClipPlanesEnabled &= ~(1 << p); |
Brian Paul | f66de79 | 2002-03-28 22:45:45 +0000 | [diff] [blame] | 295 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 296 | } |
| 297 | break; |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 298 | #endif |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 299 | case GL_COLOR_MATERIAL: |
| 300 | if (ctx->Light.ColorMaterialEnabled == state) |
| 301 | return; |
| 302 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
Brian Paul | d40f9fa | 2003-03-21 13:18:33 +0000 | [diff] [blame] | 303 | FLUSH_CURRENT(ctx, 0); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 304 | ctx->Light.ColorMaterialEnabled = state; |
| 305 | if (state) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 306 | _mesa_update_color_material( ctx, |
| 307 | ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
| 308 | } |
| 309 | break; |
| 310 | case GL_CULL_FACE: |
| 311 | if (ctx->Polygon.CullFlag == state) |
| 312 | return; |
| 313 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 314 | ctx->Polygon.CullFlag = state; |
| 315 | break; |
Keith Whitwell | 352d4db | 2004-05-10 18:16:03 +0000 | [diff] [blame] | 316 | case GL_CULL_VERTEX_EXT: |
| 317 | CHECK_EXTENSION(EXT_cull_vertex, cap); |
| 318 | if (ctx->Transform.CullVertexFlag == state) |
| 319 | return; |
| 320 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 321 | ctx->Transform.CullVertexFlag = state; |
| 322 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 323 | case GL_DEPTH_TEST: |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 324 | if (state && ctx->DrawBuffer->Visual.depthBits == 0) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 325 | _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); |
| 326 | return; |
| 327 | } |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 328 | if (ctx->Depth.Test == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 329 | return; |
| 330 | FLUSH_VERTICES(ctx, _NEW_DEPTH); |
| 331 | ctx->Depth.Test = state; |
| 332 | break; |
| 333 | case GL_DITHER: |
| 334 | if (ctx->NoDither) { |
| 335 | state = GL_FALSE; /* MESA_NO_DITHER env var */ |
| 336 | } |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 337 | if (ctx->Color.DitherFlag == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 338 | return; |
| 339 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 340 | ctx->Color.DitherFlag = state; |
| 341 | break; |
| 342 | case GL_FOG: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 343 | if (ctx->Fog.Enabled == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 344 | return; |
| 345 | FLUSH_VERTICES(ctx, _NEW_FOG); |
| 346 | ctx->Fog.Enabled = state; |
| 347 | break; |
| 348 | case GL_HISTOGRAM: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 349 | CHECK_EXTENSION(EXT_histogram, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 350 | if (ctx->Pixel.HistogramEnabled == state) |
| 351 | return; |
| 352 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 353 | ctx->Pixel.HistogramEnabled = state; |
| 354 | break; |
| 355 | case GL_LIGHT0: |
| 356 | case GL_LIGHT1: |
| 357 | case GL_LIGHT2: |
| 358 | case GL_LIGHT3: |
| 359 | case GL_LIGHT4: |
| 360 | case GL_LIGHT5: |
| 361 | case GL_LIGHT6: |
| 362 | case GL_LIGHT7: |
| 363 | if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) |
| 364 | return; |
| 365 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
| 366 | ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; |
| 367 | if (state) { |
| 368 | insert_at_tail(&ctx->Light.EnabledList, |
| 369 | &ctx->Light.Light[cap-GL_LIGHT0]); |
| 370 | } |
| 371 | else { |
| 372 | remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); |
| 373 | } |
| 374 | break; |
| 375 | case GL_LIGHTING: |
| 376 | if (ctx->Light.Enabled == state) |
| 377 | return; |
Brian | 454043c | 2007-12-03 14:14:16 -0700 | [diff] [blame] | 378 | FLUSH_VERTICES(ctx, _NEW_LIGHT); |
| 379 | ctx->Light.Enabled = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 380 | if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) |
| 381 | ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; |
| 382 | else |
| 383 | ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 384 | break; |
| 385 | case GL_LINE_SMOOTH: |
| 386 | if (ctx->Line.SmoothFlag == state) |
| 387 | return; |
| 388 | FLUSH_VERTICES(ctx, _NEW_LINE); |
| 389 | ctx->Line.SmoothFlag = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 390 | ctx->_TriangleCaps ^= DD_LINE_SMOOTH; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 391 | break; |
| 392 | case GL_LINE_STIPPLE: |
| 393 | if (ctx->Line.StippleFlag == state) |
| 394 | return; |
| 395 | FLUSH_VERTICES(ctx, _NEW_LINE); |
| 396 | ctx->Line.StippleFlag = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 397 | ctx->_TriangleCaps ^= DD_LINE_STIPPLE; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 398 | break; |
| 399 | case GL_INDEX_LOGIC_OP: |
| 400 | if (ctx->Color.IndexLogicOpEnabled == state) |
| 401 | return; |
| 402 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 403 | ctx->Color.IndexLogicOpEnabled = state; |
| 404 | break; |
| 405 | case GL_COLOR_LOGIC_OP: |
| 406 | if (ctx->Color.ColorLogicOpEnabled == state) |
| 407 | return; |
| 408 | FLUSH_VERTICES(ctx, _NEW_COLOR); |
| 409 | ctx->Color.ColorLogicOpEnabled = state; |
| 410 | break; |
| 411 | case GL_MAP1_COLOR_4: |
| 412 | if (ctx->Eval.Map1Color4 == state) |
| 413 | return; |
| 414 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 415 | ctx->Eval.Map1Color4 = state; |
| 416 | break; |
| 417 | case GL_MAP1_INDEX: |
| 418 | if (ctx->Eval.Map1Index == state) |
| 419 | return; |
| 420 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 421 | ctx->Eval.Map1Index = state; |
| 422 | break; |
| 423 | case GL_MAP1_NORMAL: |
| 424 | if (ctx->Eval.Map1Normal == state) |
| 425 | return; |
| 426 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 427 | ctx->Eval.Map1Normal = state; |
| 428 | break; |
| 429 | case GL_MAP1_TEXTURE_COORD_1: |
| 430 | if (ctx->Eval.Map1TextureCoord1 == state) |
| 431 | return; |
| 432 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 433 | ctx->Eval.Map1TextureCoord1 = state; |
| 434 | break; |
| 435 | case GL_MAP1_TEXTURE_COORD_2: |
| 436 | if (ctx->Eval.Map1TextureCoord2 == state) |
| 437 | return; |
| 438 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 439 | ctx->Eval.Map1TextureCoord2 = state; |
| 440 | break; |
| 441 | case GL_MAP1_TEXTURE_COORD_3: |
| 442 | if (ctx->Eval.Map1TextureCoord3 == state) |
| 443 | return; |
| 444 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 445 | ctx->Eval.Map1TextureCoord3 = state; |
| 446 | break; |
| 447 | case GL_MAP1_TEXTURE_COORD_4: |
| 448 | if (ctx->Eval.Map1TextureCoord4 == state) |
| 449 | return; |
| 450 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 451 | ctx->Eval.Map1TextureCoord4 = state; |
| 452 | break; |
| 453 | case GL_MAP1_VERTEX_3: |
| 454 | if (ctx->Eval.Map1Vertex3 == state) |
| 455 | return; |
| 456 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 457 | ctx->Eval.Map1Vertex3 = state; |
| 458 | break; |
| 459 | case GL_MAP1_VERTEX_4: |
| 460 | if (ctx->Eval.Map1Vertex4 == state) |
| 461 | return; |
| 462 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 463 | ctx->Eval.Map1Vertex4 = state; |
| 464 | break; |
| 465 | case GL_MAP2_COLOR_4: |
| 466 | if (ctx->Eval.Map2Color4 == state) |
| 467 | return; |
| 468 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 469 | ctx->Eval.Map2Color4 = state; |
| 470 | break; |
| 471 | case GL_MAP2_INDEX: |
| 472 | if (ctx->Eval.Map2Index == state) |
| 473 | return; |
| 474 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 475 | ctx->Eval.Map2Index = state; |
| 476 | break; |
| 477 | case GL_MAP2_NORMAL: |
| 478 | if (ctx->Eval.Map2Normal == state) |
| 479 | return; |
| 480 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 481 | ctx->Eval.Map2Normal = state; |
| 482 | break; |
| 483 | case GL_MAP2_TEXTURE_COORD_1: |
| 484 | if (ctx->Eval.Map2TextureCoord1 == state) |
| 485 | return; |
| 486 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 487 | ctx->Eval.Map2TextureCoord1 = state; |
| 488 | break; |
| 489 | case GL_MAP2_TEXTURE_COORD_2: |
| 490 | if (ctx->Eval.Map2TextureCoord2 == state) |
| 491 | return; |
| 492 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 493 | ctx->Eval.Map2TextureCoord2 = state; |
| 494 | break; |
| 495 | case GL_MAP2_TEXTURE_COORD_3: |
| 496 | if (ctx->Eval.Map2TextureCoord3 == state) |
| 497 | return; |
| 498 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 499 | ctx->Eval.Map2TextureCoord3 = state; |
| 500 | break; |
| 501 | case GL_MAP2_TEXTURE_COORD_4: |
| 502 | if (ctx->Eval.Map2TextureCoord4 == state) |
| 503 | return; |
| 504 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 505 | ctx->Eval.Map2TextureCoord4 = state; |
| 506 | break; |
| 507 | case GL_MAP2_VERTEX_3: |
| 508 | if (ctx->Eval.Map2Vertex3 == state) |
| 509 | return; |
| 510 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 511 | ctx->Eval.Map2Vertex3 = state; |
| 512 | break; |
| 513 | case GL_MAP2_VERTEX_4: |
| 514 | if (ctx->Eval.Map2Vertex4 == state) |
| 515 | return; |
| 516 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 517 | ctx->Eval.Map2Vertex4 = state; |
| 518 | break; |
| 519 | case GL_MINMAX: |
| 520 | if (ctx->Pixel.MinMaxEnabled == state) |
| 521 | return; |
| 522 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 523 | ctx->Pixel.MinMaxEnabled = state; |
| 524 | break; |
| 525 | case GL_NORMALIZE: |
| 526 | if (ctx->Transform.Normalize == state) |
| 527 | return; |
| 528 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 529 | ctx->Transform.Normalize = state; |
| 530 | break; |
| 531 | case GL_POINT_SMOOTH: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 532 | if (ctx->Point.SmoothFlag == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 533 | return; |
| 534 | FLUSH_VERTICES(ctx, _NEW_POINT); |
| 535 | ctx->Point.SmoothFlag = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 536 | ctx->_TriangleCaps ^= DD_POINT_SMOOTH; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 537 | break; |
| 538 | case GL_POLYGON_SMOOTH: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 539 | if (ctx->Polygon.SmoothFlag == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 540 | return; |
| 541 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 542 | ctx->Polygon.SmoothFlag = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 543 | ctx->_TriangleCaps ^= DD_TRI_SMOOTH; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 544 | break; |
| 545 | case GL_POLYGON_STIPPLE: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 546 | if (ctx->Polygon.StippleFlag == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 547 | return; |
| 548 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 549 | ctx->Polygon.StippleFlag = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 550 | ctx->_TriangleCaps ^= DD_TRI_STIPPLE; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 551 | break; |
| 552 | case GL_POLYGON_OFFSET_POINT: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 553 | if (ctx->Polygon.OffsetPoint == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 554 | return; |
| 555 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 556 | ctx->Polygon.OffsetPoint = state; |
| 557 | break; |
| 558 | case GL_POLYGON_OFFSET_LINE: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 559 | if (ctx->Polygon.OffsetLine == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 560 | return; |
| 561 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 562 | ctx->Polygon.OffsetLine = state; |
| 563 | break; |
| 564 | case GL_POLYGON_OFFSET_FILL: |
| 565 | /*case GL_POLYGON_OFFSET_EXT:*/ |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 566 | if (ctx->Polygon.OffsetFill == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 567 | return; |
| 568 | FLUSH_VERTICES(ctx, _NEW_POLYGON); |
| 569 | ctx->Polygon.OffsetFill = state; |
| 570 | break; |
| 571 | case GL_RESCALE_NORMAL_EXT: |
| 572 | if (ctx->Transform.RescaleNormals == state) |
| 573 | return; |
| 574 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 575 | ctx->Transform.RescaleNormals = state; |
| 576 | break; |
| 577 | case GL_SCISSOR_TEST: |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 578 | if (ctx->Scissor.Enabled == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 579 | return; |
| 580 | FLUSH_VERTICES(ctx, _NEW_SCISSOR); |
| 581 | ctx->Scissor.Enabled = state; |
| 582 | break; |
| 583 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 584 | if (ctx->Texture.SharedPalette == state) |
| 585 | return; |
| 586 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 587 | ctx->Texture.SharedPalette = state; |
| 588 | break; |
| 589 | case GL_STENCIL_TEST: |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 590 | if (state && ctx->DrawBuffer->Visual.stencilBits == 0) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 591 | _mesa_warning(ctx, |
| 592 | "glEnable(GL_STENCIL_TEST) but no stencil buffer"); |
| 593 | return; |
| 594 | } |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 595 | if (ctx->Stencil.Enabled == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 596 | return; |
| 597 | FLUSH_VERTICES(ctx, _NEW_STENCIL); |
| 598 | ctx->Stencil.Enabled = state; |
| 599 | break; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 600 | case GL_TEXTURE_1D: |
| 601 | if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 602 | return; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 603 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 604 | break; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 605 | case GL_TEXTURE_2D: |
| 606 | if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 607 | return; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 608 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 609 | break; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 610 | case GL_TEXTURE_3D: |
| 611 | if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 612 | return; |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 613 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 614 | break; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 615 | case GL_TEXTURE_GEN_Q: { |
| 616 | GLuint unit = ctx->Texture.CurrentUnit; |
| 617 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 618 | GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; |
| 619 | if (state) |
| 620 | newenabled |= Q_BIT; |
| 621 | if (texUnit->TexGenEnabled == newenabled) |
| 622 | return; |
| 623 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 624 | texUnit->TexGenEnabled = newenabled; |
| 625 | break; |
| 626 | } |
| 627 | case GL_TEXTURE_GEN_R: { |
| 628 | GLuint unit = ctx->Texture.CurrentUnit; |
| 629 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 630 | GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; |
| 631 | if (state) |
| 632 | newenabled |= R_BIT; |
| 633 | if (texUnit->TexGenEnabled == newenabled) |
| 634 | return; |
| 635 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 636 | texUnit->TexGenEnabled = newenabled; |
| 637 | break; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 638 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 639 | case GL_TEXTURE_GEN_S: { |
| 640 | GLuint unit = ctx->Texture.CurrentUnit; |
| 641 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 642 | GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; |
| 643 | if (state) |
| 644 | newenabled |= S_BIT; |
| 645 | if (texUnit->TexGenEnabled == newenabled) |
| 646 | return; |
| 647 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 648 | texUnit->TexGenEnabled = newenabled; |
| 649 | break; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 650 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 651 | case GL_TEXTURE_GEN_T: { |
| 652 | GLuint unit = ctx->Texture.CurrentUnit; |
| 653 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
| 654 | GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; |
| 655 | if (state) |
| 656 | newenabled |= T_BIT; |
| 657 | if (texUnit->TexGenEnabled == newenabled) |
| 658 | return; |
| 659 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
| 660 | texUnit->TexGenEnabled = newenabled; |
| 661 | break; |
| 662 | } |
Keith Whitwell | 46b0988 | 2001-02-16 18:14:41 +0000 | [diff] [blame] | 663 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 664 | /* |
| 665 | * CLIENT STATE!!! |
| 666 | */ |
| 667 | case GL_VERTEX_ARRAY: |
| 668 | case GL_NORMAL_ARRAY: |
| 669 | case GL_COLOR_ARRAY: |
| 670 | case GL_INDEX_ARRAY: |
| 671 | case GL_TEXTURE_COORD_ARRAY: |
| 672 | case GL_EDGE_FLAG_ARRAY: |
| 673 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 674 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
Brian Paul | 1cf2c8a | 2008-06-25 08:45:14 -0600 | [diff] [blame^] | 675 | case GL_POINT_SIZE_ARRAY_OES: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 676 | client_state( ctx, cap, state ); |
| 677 | return; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 678 | |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 679 | /* GL_SGI_color_table */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 680 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 681 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 682 | if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 683 | return; |
| 684 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 685 | ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 686 | break; |
| 687 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 688 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 689 | if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 690 | return; |
| 691 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 692 | ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 693 | break; |
| 694 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 695 | CHECK_EXTENSION(SGI_color_table, cap); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 696 | if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 697 | return; |
| 698 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 699 | ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 700 | break; |
Brian Paul | 418ac00 | 2003-01-21 21:47:45 +0000 | [diff] [blame] | 701 | case GL_TEXTURE_COLOR_TABLE_SGI: |
| 702 | CHECK_EXTENSION(SGI_texture_color_table, cap); |
Brian Paul | 45b47d0 | 2003-01-26 14:37:15 +0000 | [diff] [blame] | 703 | if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state) |
Brian Paul | 418ac00 | 2003-01-21 21:47:45 +0000 | [diff] [blame] | 704 | return; |
| 705 | FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
Brian Paul | 45b47d0 | 2003-01-26 14:37:15 +0000 | [diff] [blame] | 706 | ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state; |
Brian Paul | 418ac00 | 2003-01-21 21:47:45 +0000 | [diff] [blame] | 707 | break; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 708 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 709 | /* GL_EXT_convolution */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 710 | case GL_CONVOLUTION_1D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 711 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 712 | if (ctx->Pixel.Convolution1DEnabled == state) |
| 713 | return; |
| 714 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 715 | ctx->Pixel.Convolution1DEnabled = state; |
| 716 | break; |
| 717 | case GL_CONVOLUTION_2D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 718 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 719 | if (ctx->Pixel.Convolution2DEnabled == state) |
| 720 | return; |
| 721 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 722 | ctx->Pixel.Convolution2DEnabled = state; |
| 723 | break; |
| 724 | case GL_SEPARABLE_2D: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 725 | CHECK_EXTENSION(EXT_convolution, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 726 | if (ctx->Pixel.Separable2DEnabled == state) |
| 727 | return; |
| 728 | FLUSH_VERTICES(ctx, _NEW_PIXEL); |
| 729 | ctx->Pixel.Separable2DEnabled = state; |
| 730 | break; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 731 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 732 | /* GL_ARB_texture_cube_map */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 733 | case GL_TEXTURE_CUBE_MAP_ARB: |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 734 | CHECK_EXTENSION(ARB_texture_cube_map, cap); |
| 735 | if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) { |
| 736 | return; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 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: |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 742 | CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, 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; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 747 | break; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 748 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 749 | /* GL_ARB_multisample */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 750 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 751 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 752 | if (ctx->Multisample.Enabled == state) |
| 753 | return; |
| 754 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 755 | ctx->Multisample.Enabled = state; |
| 756 | break; |
| 757 | case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 758 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 759 | if (ctx->Multisample.SampleAlphaToCoverage == state) |
| 760 | return; |
| 761 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 762 | ctx->Multisample.SampleAlphaToCoverage = state; |
| 763 | break; |
| 764 | case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 765 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 766 | if (ctx->Multisample.SampleAlphaToOne == state) |
| 767 | return; |
| 768 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 769 | ctx->Multisample.SampleAlphaToOne = state; |
| 770 | break; |
| 771 | case GL_SAMPLE_COVERAGE_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 772 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 773 | if (ctx->Multisample.SampleCoverage == state) |
| 774 | return; |
| 775 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 776 | ctx->Multisample.SampleCoverage = state; |
| 777 | break; |
| 778 | case GL_SAMPLE_COVERAGE_INVERT_ARB: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 779 | CHECK_EXTENSION(ARB_multisample, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 780 | if (ctx->Multisample.SampleCoverageInvert == state) |
| 781 | return; |
| 782 | FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
| 783 | ctx->Multisample.SampleCoverageInvert = state; |
| 784 | break; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 785 | |
| 786 | /* GL_IBM_rasterpos_clip */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 787 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 788 | CHECK_EXTENSION(IBM_rasterpos_clip, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 789 | if (ctx->Transform.RasterPositionUnclipped == state) |
| 790 | return; |
| 791 | FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
| 792 | ctx->Transform.RasterPositionUnclipped = state; |
| 793 | break; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 794 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 795 | /* GL_NV_point_sprite */ |
| 796 | case GL_POINT_SPRITE_NV: |
Ian Romanick | 6373672 | 2003-08-23 00:12:46 +0000 | [diff] [blame] | 797 | CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 798 | if (ctx->Point.PointSprite == state) |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 799 | return; |
| 800 | FLUSH_VERTICES(ctx, _NEW_POINT); |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 801 | ctx->Point.PointSprite = state; |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 802 | break; |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 803 | |
Roland Scheidegger | 93da673 | 2006-03-01 23:11:14 +0000 | [diff] [blame] | 804 | #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program |
Roland Scheidegger | e1e03b3 | 2006-03-03 15:03:04 +0000 | [diff] [blame] | 805 | case GL_VERTEX_PROGRAM_ARB: |
| 806 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 807 | if (ctx->VertexProgram.Enabled == state) |
| 808 | return; |
Keith Whitwell | 3abf746 | 2004-01-23 14:46:27 +0000 | [diff] [blame] | 809 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 810 | ctx->VertexProgram.Enabled = state; |
| 811 | break; |
Roland Scheidegger | e1e03b3 | 2006-03-03 15:03:04 +0000 | [diff] [blame] | 812 | case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: |
| 813 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 814 | if (ctx->VertexProgram.PointSizeEnabled == state) |
| 815 | return; |
Keith Whitwell | 3abf746 | 2004-01-23 14:46:27 +0000 | [diff] [blame] | 816 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 817 | ctx->VertexProgram.PointSizeEnabled = state; |
| 818 | break; |
Roland Scheidegger | e1e03b3 | 2006-03-03 15:03:04 +0000 | [diff] [blame] | 819 | case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: |
| 820 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 821 | if (ctx->VertexProgram.TwoSideEnabled == state) |
| 822 | return; |
Keith Whitwell | 3abf746 | 2004-01-23 14:46:27 +0000 | [diff] [blame] | 823 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 824 | ctx->VertexProgram.TwoSideEnabled = state; |
| 825 | break; |
Roland Scheidegger | 93da673 | 2006-03-01 23:11:14 +0000 | [diff] [blame] | 826 | #endif |
| 827 | #if FEATURE_NV_vertex_program |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 828 | case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
| 829 | case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
| 830 | case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
| 831 | case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
| 832 | case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
| 833 | case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
| 834 | case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
| 835 | case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
| 836 | case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
| 837 | case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
| 838 | case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
| 839 | case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
| 840 | case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
| 841 | case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
| 842 | case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
| 843 | case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 844 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 845 | { |
| 846 | const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
| 847 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 848 | ctx->Eval.Map1Attrib[map] = state; |
| 849 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 850 | break; |
| 851 | case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
| 852 | case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
| 853 | case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
| 854 | case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
| 855 | case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
| 856 | case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
| 857 | case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
| 858 | case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
| 859 | case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
| 860 | case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
| 861 | case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
| 862 | case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
| 863 | case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
| 864 | case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
| 865 | case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
| 866 | case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
Brian Paul | 02c03ef | 2002-06-18 16:53:46 +0000 | [diff] [blame] | 867 | CHECK_EXTENSION(NV_vertex_program, cap); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 868 | { |
| 869 | const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
| 870 | FLUSH_VERTICES(ctx, _NEW_EVAL); |
| 871 | ctx->Eval.Map2Attrib[map] = state; |
| 872 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 873 | break; |
Brian Paul | 8dfc5b9 | 2002-10-16 17:57:51 +0000 | [diff] [blame] | 874 | #endif /* FEATURE_NV_vertex_program */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 875 | |
Brian Paul | 610d599 | 2003-01-14 04:55:45 +0000 | [diff] [blame] | 876 | #if FEATURE_NV_fragment_program |
| 877 | case GL_FRAGMENT_PROGRAM_NV: |
| 878 | CHECK_EXTENSION(NV_fragment_program, cap); |
| 879 | if (ctx->FragmentProgram.Enabled == state) |
| 880 | return; |
Keith Whitwell | 3abf746 | 2004-01-23 14:46:27 +0000 | [diff] [blame] | 881 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
Brian Paul | 610d599 | 2003-01-14 04:55:45 +0000 | [diff] [blame] | 882 | ctx->FragmentProgram.Enabled = state; |
| 883 | break; |
| 884 | #endif /* FEATURE_NV_fragment_program */ |
| 885 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 886 | /* GL_NV_texture_rectangle */ |
| 887 | case GL_TEXTURE_RECTANGLE_NV: |
Brian Paul | 5f60a0b | 2002-09-06 02:56:08 +0000 | [diff] [blame] | 888 | CHECK_EXTENSION(NV_texture_rectangle, cap); |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 889 | if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) { |
| 890 | return; |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 891 | } |
| 892 | break; |
| 893 | |
Brian Paul | 5f60a0b | 2002-09-06 02:56:08 +0000 | [diff] [blame] | 894 | /* GL_EXT_stencil_two_side */ |
| 895 | case GL_STENCIL_TEST_TWO_SIDE_EXT: |
| 896 | CHECK_EXTENSION(EXT_stencil_two_side, cap); |
| 897 | if (ctx->Stencil.TestTwoSide == state) |
| 898 | return; |
| 899 | FLUSH_VERTICES(ctx, _NEW_STENCIL); |
| 900 | ctx->Stencil.TestTwoSide = state; |
Brian | ed6d5ff | 2007-09-27 10:24:17 -0600 | [diff] [blame] | 901 | if (state) |
| 902 | ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL; |
| 903 | else |
| 904 | ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL; |
Brian Paul | 5f60a0b | 2002-09-06 02:56:08 +0000 | [diff] [blame] | 905 | break; |
| 906 | |
Brian Paul | 77eec61 | 2003-04-18 01:56:11 +0000 | [diff] [blame] | 907 | #if FEATURE_ARB_fragment_program |
| 908 | case GL_FRAGMENT_PROGRAM_ARB: |
| 909 | CHECK_EXTENSION(ARB_fragment_program, cap); |
| 910 | if (ctx->FragmentProgram.Enabled == state) |
| 911 | return; |
Keith Whitwell | 3abf746 | 2004-01-23 14:46:27 +0000 | [diff] [blame] | 912 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
Brian Paul | 77eec61 | 2003-04-18 01:56:11 +0000 | [diff] [blame] | 913 | ctx->FragmentProgram.Enabled = state; |
| 914 | break; |
| 915 | #endif /* FEATURE_ARB_fragment_program */ |
| 916 | |
Brian Paul | e5b244f | 2003-04-21 15:02:17 +0000 | [diff] [blame] | 917 | /* GL_EXT_depth_bounds_test */ |
| 918 | case GL_DEPTH_BOUNDS_TEST_EXT: |
| 919 | CHECK_EXTENSION(EXT_depth_bounds_test, cap); |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 920 | if (state && ctx->DrawBuffer->Visual.depthBits == 0) { |
Brian Paul | e5b244f | 2003-04-21 15:02:17 +0000 | [diff] [blame] | 921 | _mesa_warning(ctx, |
| 922 | "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer"); |
| 923 | return; |
| 924 | } |
| 925 | if (ctx->Depth.BoundsTest == state) |
| 926 | return; |
| 927 | FLUSH_VERTICES(ctx, _NEW_DEPTH); |
| 928 | ctx->Depth.BoundsTest = state; |
| 929 | break; |
| 930 | |
Brian Paul | 08ff059 | 2003-07-21 04:22:40 +0000 | [diff] [blame] | 931 | /* GL_MESA_program_debug */ |
| 932 | case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: |
| 933 | CHECK_EXTENSION(MESA_program_debug, cap); |
| 934 | ctx->FragmentProgram.CallbackEnabled = state; |
| 935 | break; |
| 936 | case GL_VERTEX_PROGRAM_CALLBACK_MESA: |
| 937 | CHECK_EXTENSION(MESA_program_debug, cap); |
| 938 | ctx->VertexProgram.CallbackEnabled = state; |
| 939 | break; |
| 940 | |
Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 941 | #if FEATURE_ATI_fragment_shader |
| 942 | case GL_FRAGMENT_SHADER_ATI: |
| 943 | CHECK_EXTENSION(ATI_fragment_shader, cap); |
| 944 | if (ctx->ATIFragmentShader.Enabled == state) |
| 945 | return; |
| 946 | FLUSH_VERTICES(ctx, _NEW_PROGRAM); |
| 947 | ctx->ATIFragmentShader.Enabled = state; |
| 948 | break; |
| 949 | #endif |
Ian Romanick | bb372f1 | 2007-05-16 15:34:22 -0700 | [diff] [blame] | 950 | |
| 951 | /* GL_MESA_texture_array */ |
| 952 | case GL_TEXTURE_1D_ARRAY_EXT: |
| 953 | CHECK_EXTENSION(MESA_texture_array, cap); |
| 954 | if (!enable_texture(ctx, state, TEXTURE_1D_ARRAY_BIT)) { |
| 955 | return; |
| 956 | } |
| 957 | break; |
| 958 | |
| 959 | case GL_TEXTURE_2D_ARRAY_EXT: |
| 960 | CHECK_EXTENSION(MESA_texture_array, cap); |
| 961 | if (!enable_texture(ctx, state, TEXTURE_2D_ARRAY_BIT)) { |
| 962 | return; |
| 963 | } |
| 964 | break; |
| 965 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 966 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 967 | _mesa_error(ctx, GL_INVALID_ENUM, |
| 968 | "%s(0x%x)", state ? "glEnable" : "glDisable", cap); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 969 | return; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | if (ctx->Driver.Enable) { |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 973 | ctx->Driver.Enable( ctx, cap, state ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 974 | } |
| 975 | } |
| 976 | |
| 977 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 978 | /** |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 979 | * Enable GL capability. Called by glEnable() |
| 980 | * \param cap state to enable. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 981 | */ |
Kendall Bennett | c40d1dd | 2003-10-21 22:22:17 +0000 | [diff] [blame] | 982 | void GLAPIENTRY |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 983 | _mesa_Enable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 984 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 985 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 986 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 987 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 988 | _mesa_set_enable( ctx, cap, GL_TRUE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 989 | } |
| 990 | |
| 991 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 992 | /** |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 993 | * Disable GL capability. Called by glDisable() |
| 994 | * \param cap state to disable. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 995 | */ |
Kendall Bennett | c40d1dd | 2003-10-21 22:22:17 +0000 | [diff] [blame] | 996 | void GLAPIENTRY |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 997 | _mesa_Disable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 998 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 999 | GET_CURRENT_CONTEXT(ctx); |
Keith Whitwell | 376d022 | 2000-12-27 22:52:45 +0000 | [diff] [blame] | 1000 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
| 1001 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 1002 | _mesa_set_enable( ctx, cap, GL_FALSE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1003 | } |
| 1004 | |
| 1005 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1006 | #undef CHECK_EXTENSION |
| 1007 | #define CHECK_EXTENSION(EXTNAME) \ |
| 1008 | if (!ctx->Extensions.EXTNAME) { \ |
| 1009 | _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ |
| 1010 | return GL_FALSE; \ |
| 1011 | } |
| 1012 | |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1013 | #undef CHECK_EXTENSION2 |
| 1014 | #define CHECK_EXTENSION2(EXT1, EXT2) \ |
| 1015 | if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ |
| 1016 | _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ |
| 1017 | return GL_FALSE; \ |
| 1018 | } |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1019 | |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 1020 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1021 | /** |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1022 | * Helper function to determine whether a texture target is enabled. |
| 1023 | */ |
| 1024 | static GLboolean |
Ian Romanick | c9e723e | 2007-05-10 08:20:04 -0700 | [diff] [blame] | 1025 | is_texture_enabled(GLcontext *ctx, GLbitfield bit) |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1026 | { |
| 1027 | const struct gl_texture_unit *const texUnit = |
| 1028 | &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 1029 | return (texUnit->Enabled & bit) ? GL_TRUE : GL_FALSE; |
| 1030 | } |
| 1031 | |
| 1032 | |
| 1033 | /** |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 1034 | * Return simple enable/disable state. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1035 | * |
Brian | 8dcfcad7 | 2006-12-13 15:31:14 -0700 | [diff] [blame] | 1036 | * \param cap state variable to query. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1037 | * |
| 1038 | * Returns the state of the specified capability from the current GL context. |
| 1039 | * For the capabilities associated with extensions verifies that those |
| 1040 | * extensions are effectively present before reporting. |
| 1041 | */ |
Kendall Bennett | c40d1dd | 2003-10-21 22:22:17 +0000 | [diff] [blame] | 1042 | GLboolean GLAPIENTRY |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 1043 | _mesa_IsEnabled( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1044 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 1045 | GET_CURRENT_CONTEXT(ctx); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1046 | switch (cap) { |
| 1047 | case GL_ALPHA_TEST: |
| 1048 | return ctx->Color.AlphaEnabled; |
| 1049 | case GL_AUTO_NORMAL: |
| 1050 | return ctx->Eval.AutoNormal; |
| 1051 | case GL_BLEND: |
| 1052 | return ctx->Color.BlendEnabled; |
| 1053 | case GL_CLIP_PLANE0: |
| 1054 | case GL_CLIP_PLANE1: |
| 1055 | case GL_CLIP_PLANE2: |
| 1056 | case GL_CLIP_PLANE3: |
| 1057 | case GL_CLIP_PLANE4: |
| 1058 | case GL_CLIP_PLANE5: |
Brian Paul | 103bc0f | 2002-03-29 17:27:59 +0000 | [diff] [blame] | 1059 | return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1060 | case GL_COLOR_MATERIAL: |
| 1061 | return ctx->Light.ColorMaterialEnabled; |
| 1062 | case GL_CULL_FACE: |
| 1063 | return ctx->Polygon.CullFlag; |
| 1064 | case GL_DEPTH_TEST: |
| 1065 | return ctx->Depth.Test; |
| 1066 | case GL_DITHER: |
| 1067 | return ctx->Color.DitherFlag; |
| 1068 | case GL_FOG: |
| 1069 | return ctx->Fog.Enabled; |
| 1070 | case GL_LIGHTING: |
| 1071 | return ctx->Light.Enabled; |
| 1072 | case GL_LIGHT0: |
| 1073 | case GL_LIGHT1: |
| 1074 | case GL_LIGHT2: |
| 1075 | case GL_LIGHT3: |
| 1076 | case GL_LIGHT4: |
| 1077 | case GL_LIGHT5: |
| 1078 | case GL_LIGHT6: |
| 1079 | case GL_LIGHT7: |
| 1080 | return ctx->Light.Light[cap-GL_LIGHT0].Enabled; |
| 1081 | case GL_LINE_SMOOTH: |
| 1082 | return ctx->Line.SmoothFlag; |
| 1083 | case GL_LINE_STIPPLE: |
| 1084 | return ctx->Line.StippleFlag; |
| 1085 | case GL_INDEX_LOGIC_OP: |
| 1086 | return ctx->Color.IndexLogicOpEnabled; |
| 1087 | case GL_COLOR_LOGIC_OP: |
| 1088 | return ctx->Color.ColorLogicOpEnabled; |
| 1089 | case GL_MAP1_COLOR_4: |
| 1090 | return ctx->Eval.Map1Color4; |
| 1091 | case GL_MAP1_INDEX: |
| 1092 | return ctx->Eval.Map1Index; |
| 1093 | case GL_MAP1_NORMAL: |
| 1094 | return ctx->Eval.Map1Normal; |
| 1095 | case GL_MAP1_TEXTURE_COORD_1: |
| 1096 | return ctx->Eval.Map1TextureCoord1; |
| 1097 | case GL_MAP1_TEXTURE_COORD_2: |
| 1098 | return ctx->Eval.Map1TextureCoord2; |
| 1099 | case GL_MAP1_TEXTURE_COORD_3: |
| 1100 | return ctx->Eval.Map1TextureCoord3; |
| 1101 | case GL_MAP1_TEXTURE_COORD_4: |
| 1102 | return ctx->Eval.Map1TextureCoord4; |
| 1103 | case GL_MAP1_VERTEX_3: |
| 1104 | return ctx->Eval.Map1Vertex3; |
| 1105 | case GL_MAP1_VERTEX_4: |
| 1106 | return ctx->Eval.Map1Vertex4; |
| 1107 | case GL_MAP2_COLOR_4: |
| 1108 | return ctx->Eval.Map2Color4; |
| 1109 | case GL_MAP2_INDEX: |
| 1110 | return ctx->Eval.Map2Index; |
| 1111 | case GL_MAP2_NORMAL: |
| 1112 | return ctx->Eval.Map2Normal; |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 1113 | case GL_MAP2_TEXTURE_COORD_1: |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1114 | return ctx->Eval.Map2TextureCoord1; |
| 1115 | case GL_MAP2_TEXTURE_COORD_2: |
| 1116 | return ctx->Eval.Map2TextureCoord2; |
| 1117 | case GL_MAP2_TEXTURE_COORD_3: |
| 1118 | return ctx->Eval.Map2TextureCoord3; |
| 1119 | case GL_MAP2_TEXTURE_COORD_4: |
| 1120 | return ctx->Eval.Map2TextureCoord4; |
| 1121 | case GL_MAP2_VERTEX_3: |
| 1122 | return ctx->Eval.Map2Vertex3; |
| 1123 | case GL_MAP2_VERTEX_4: |
| 1124 | return ctx->Eval.Map2Vertex4; |
| 1125 | case GL_NORMALIZE: |
| 1126 | return ctx->Transform.Normalize; |
| 1127 | case GL_POINT_SMOOTH: |
| 1128 | return ctx->Point.SmoothFlag; |
| 1129 | case GL_POLYGON_SMOOTH: |
| 1130 | return ctx->Polygon.SmoothFlag; |
| 1131 | case GL_POLYGON_STIPPLE: |
| 1132 | return ctx->Polygon.StippleFlag; |
| 1133 | case GL_POLYGON_OFFSET_POINT: |
| 1134 | return ctx->Polygon.OffsetPoint; |
| 1135 | case GL_POLYGON_OFFSET_LINE: |
| 1136 | return ctx->Polygon.OffsetLine; |
| 1137 | case GL_POLYGON_OFFSET_FILL: |
| 1138 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 1139 | return ctx->Polygon.OffsetFill; |
| 1140 | case GL_RESCALE_NORMAL_EXT: |
| 1141 | return ctx->Transform.RescaleNormals; |
| 1142 | case GL_SCISSOR_TEST: |
| 1143 | return ctx->Scissor.Enabled; |
| 1144 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 1145 | return ctx->Texture.SharedPalette; |
| 1146 | case GL_STENCIL_TEST: |
| 1147 | return ctx->Stencil.Enabled; |
| 1148 | case GL_TEXTURE_1D: |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1149 | return is_texture_enabled(ctx, TEXTURE_1D_BIT); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1150 | case GL_TEXTURE_2D: |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1151 | return is_texture_enabled(ctx, TEXTURE_2D_BIT); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1152 | case GL_TEXTURE_3D: |
Ian Romanick | c9e723e | 2007-05-10 08:20:04 -0700 | [diff] [blame] | 1153 | return is_texture_enabled(ctx, TEXTURE_3D_BIT); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1154 | case GL_TEXTURE_GEN_Q: |
| 1155 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1156 | const struct gl_texture_unit *texUnit; |
| 1157 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1158 | return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
| 1159 | } |
| 1160 | case GL_TEXTURE_GEN_R: |
| 1161 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1162 | const struct gl_texture_unit *texUnit; |
| 1163 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1164 | return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
| 1165 | } |
| 1166 | case GL_TEXTURE_GEN_S: |
| 1167 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1168 | const struct gl_texture_unit *texUnit; |
| 1169 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1170 | return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
| 1171 | } |
| 1172 | case GL_TEXTURE_GEN_T: |
| 1173 | { |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1174 | const struct gl_texture_unit *texUnit; |
| 1175 | texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1176 | return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
| 1177 | } |
| 1178 | |
| 1179 | /* |
| 1180 | * CLIENT STATE!!! |
| 1181 | */ |
| 1182 | case GL_VERTEX_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1183 | return (ctx->Array.ArrayObj->Vertex.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1184 | case GL_NORMAL_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1185 | return (ctx->Array.ArrayObj->Normal.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1186 | case GL_COLOR_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1187 | return (ctx->Array.ArrayObj->Color.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1188 | case GL_INDEX_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1189 | return (ctx->Array.ArrayObj->Index.Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1190 | case GL_TEXTURE_COORD_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1191 | return (ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled != 0); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1192 | case GL_EDGE_FLAG_ARRAY: |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1193 | return (ctx->Array.ArrayObj->EdgeFlag.Enabled != 0); |
Brian Paul | 6ee7a02 | 2002-01-22 18:40:46 +0000 | [diff] [blame] | 1194 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 1195 | CHECK_EXTENSION(EXT_fog_coord); |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1196 | return (ctx->Array.ArrayObj->FogCoord.Enabled != 0); |
Brian Paul | 6ee7a02 | 2002-01-22 18:40:46 +0000 | [diff] [blame] | 1197 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 1198 | CHECK_EXTENSION(EXT_secondary_color); |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1199 | return (ctx->Array.ArrayObj->SecondaryColor.Enabled != 0); |
Brian Paul | 1cf2c8a | 2008-06-25 08:45:14 -0600 | [diff] [blame^] | 1200 | #if FEATURE_point_size_array |
| 1201 | case GL_POINT_SIZE_ARRAY_OES: |
| 1202 | return (ctx->Array.ArrayObj->PointSize.Enabled != 0); |
| 1203 | #endif |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 1204 | |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1205 | /* GL_EXT_histogram */ |
| 1206 | case GL_HISTOGRAM: |
| 1207 | CHECK_EXTENSION(EXT_histogram); |
| 1208 | return ctx->Pixel.HistogramEnabled; |
| 1209 | case GL_MINMAX: |
| 1210 | CHECK_EXTENSION(EXT_histogram); |
| 1211 | return ctx->Pixel.MinMaxEnabled; |
| 1212 | |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1213 | /* GL_SGI_color_table */ |
| 1214 | case GL_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1215 | CHECK_EXTENSION(SGI_color_table); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 1216 | return ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1217 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1218 | CHECK_EXTENSION(SGI_color_table); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 1219 | return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 1220 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1221 | CHECK_EXTENSION(SGI_color_table); |
Brian | 7573b58 | 2007-03-16 09:36:12 -0600 | [diff] [blame] | 1222 | return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 1223 | |
Brian Paul | 45b47d0 | 2003-01-26 14:37:15 +0000 | [diff] [blame] | 1224 | /* GL_SGI_texture_color_table */ |
| 1225 | case GL_TEXTURE_COLOR_TABLE_SGI: |
| 1226 | CHECK_EXTENSION(SGI_texture_color_table); |
| 1227 | return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; |
| 1228 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1229 | /* GL_EXT_convolution */ |
| 1230 | case GL_CONVOLUTION_1D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1231 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1232 | return ctx->Pixel.Convolution1DEnabled; |
| 1233 | case GL_CONVOLUTION_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1234 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1235 | return ctx->Pixel.Convolution2DEnabled; |
| 1236 | case GL_SEPARABLE_2D: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1237 | CHECK_EXTENSION(EXT_convolution); |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 1238 | return ctx->Pixel.Separable2DEnabled; |
| 1239 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1240 | /* GL_ARB_texture_cube_map */ |
| 1241 | case GL_TEXTURE_CUBE_MAP_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1242 | CHECK_EXTENSION(ARB_texture_cube_map); |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1243 | return is_texture_enabled(ctx, TEXTURE_CUBE_BIT); |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 1244 | |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1245 | /* GL_EXT_secondary_color */ |
| 1246 | case GL_COLOR_SUM_EXT: |
| 1247 | CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program); |
| 1248 | return ctx->Fog.ColorSumEnabled; |
| 1249 | |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1250 | /* GL_ARB_multisample */ |
| 1251 | case GL_MULTISAMPLE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1252 | CHECK_EXTENSION(ARB_multisample); |
| 1253 | return ctx->Multisample.Enabled; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1254 | case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1255 | CHECK_EXTENSION(ARB_multisample); |
| 1256 | return ctx->Multisample.SampleAlphaToCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1257 | case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1258 | CHECK_EXTENSION(ARB_multisample); |
| 1259 | return ctx->Multisample.SampleAlphaToOne; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1260 | case GL_SAMPLE_COVERAGE_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1261 | CHECK_EXTENSION(ARB_multisample); |
| 1262 | return ctx->Multisample.SampleCoverage; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1263 | case GL_SAMPLE_COVERAGE_INVERT_ARB: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1264 | CHECK_EXTENSION(ARB_multisample); |
| 1265 | return ctx->Multisample.SampleCoverageInvert; |
Brian Paul | 736fcbe | 2001-05-29 15:23:48 +0000 | [diff] [blame] | 1266 | |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1267 | /* GL_IBM_rasterpos_clip */ |
| 1268 | case GL_RASTER_POSITION_UNCLIPPED_IBM: |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1269 | CHECK_EXTENSION(IBM_rasterpos_clip); |
| 1270 | return ctx->Transform.RasterPositionUnclipped; |
Brian Paul | 8c2f6c5 | 2001-06-26 01:32:48 +0000 | [diff] [blame] | 1271 | |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 1272 | /* GL_NV_point_sprite */ |
| 1273 | case GL_POINT_SPRITE_NV: |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1274 | CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite) |
Brian Paul | 6c408b4 | 2002-05-27 17:04:52 +0000 | [diff] [blame] | 1275 | return ctx->Point.PointSprite; |
Brian Paul | 06d05af | 2000-12-08 00:20:15 +0000 | [diff] [blame] | 1276 | |
Roland Scheidegger | 93da673 | 2006-03-01 23:11:14 +0000 | [diff] [blame] | 1277 | #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1278 | case GL_VERTEX_PROGRAM_ARB: |
| 1279 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1280 | return ctx->VertexProgram.Enabled; |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1281 | case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: |
| 1282 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1283 | return ctx->VertexProgram.PointSizeEnabled; |
Roland Scheidegger | da16813 | 2006-03-02 12:06:57 +0000 | [diff] [blame] | 1284 | case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: |
| 1285 | CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1286 | return ctx->VertexProgram.TwoSideEnabled; |
Roland Scheidegger | 93da673 | 2006-03-01 23:11:14 +0000 | [diff] [blame] | 1287 | #endif |
| 1288 | #if FEATURE_NV_vertex_program |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1289 | case GL_VERTEX_ATTRIB_ARRAY0_NV: |
| 1290 | case GL_VERTEX_ATTRIB_ARRAY1_NV: |
| 1291 | case GL_VERTEX_ATTRIB_ARRAY2_NV: |
| 1292 | case GL_VERTEX_ATTRIB_ARRAY3_NV: |
| 1293 | case GL_VERTEX_ATTRIB_ARRAY4_NV: |
| 1294 | case GL_VERTEX_ATTRIB_ARRAY5_NV: |
| 1295 | case GL_VERTEX_ATTRIB_ARRAY6_NV: |
| 1296 | case GL_VERTEX_ATTRIB_ARRAY7_NV: |
| 1297 | case GL_VERTEX_ATTRIB_ARRAY8_NV: |
| 1298 | case GL_VERTEX_ATTRIB_ARRAY9_NV: |
| 1299 | case GL_VERTEX_ATTRIB_ARRAY10_NV: |
| 1300 | case GL_VERTEX_ATTRIB_ARRAY11_NV: |
| 1301 | case GL_VERTEX_ATTRIB_ARRAY12_NV: |
| 1302 | case GL_VERTEX_ATTRIB_ARRAY13_NV: |
| 1303 | case GL_VERTEX_ATTRIB_ARRAY14_NV: |
| 1304 | case GL_VERTEX_ATTRIB_ARRAY15_NV: |
| 1305 | CHECK_EXTENSION(NV_vertex_program); |
| 1306 | { |
| 1307 | GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
Ian Romanick | ee34e6e | 2006-06-12 16:26:29 +0000 | [diff] [blame] | 1308 | return (ctx->Array.ArrayObj->VertexAttrib[n].Enabled != 0); |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1309 | } |
| 1310 | case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
| 1311 | case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
| 1312 | case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
| 1313 | case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
| 1314 | case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
| 1315 | case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
| 1316 | case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
| 1317 | case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
| 1318 | case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
| 1319 | case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
| 1320 | case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
| 1321 | case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
| 1322 | case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
| 1323 | case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
| 1324 | case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
| 1325 | case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
| 1326 | CHECK_EXTENSION(NV_vertex_program); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1327 | { |
| 1328 | const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
| 1329 | return ctx->Eval.Map1Attrib[map]; |
| 1330 | } |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1331 | case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
| 1332 | case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
| 1333 | case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
| 1334 | case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
| 1335 | case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
| 1336 | case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
| 1337 | case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
| 1338 | case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
| 1339 | case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
| 1340 | case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
| 1341 | case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
| 1342 | case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
| 1343 | case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
| 1344 | case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
| 1345 | case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
| 1346 | case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
| 1347 | CHECK_EXTENSION(NV_vertex_program); |
Brian Paul | bc42c19 | 2002-01-05 21:53:20 +0000 | [diff] [blame] | 1348 | { |
| 1349 | const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
| 1350 | return ctx->Eval.Map2Attrib[map]; |
| 1351 | } |
Brian Paul | 8dfc5b9 | 2002-10-16 17:57:51 +0000 | [diff] [blame] | 1352 | #endif /* FEATURE_NV_vertex_program */ |
Brian Paul | 86b8427 | 2001-12-14 02:50:01 +0000 | [diff] [blame] | 1353 | |
Brian Paul | 610d599 | 2003-01-14 04:55:45 +0000 | [diff] [blame] | 1354 | #if FEATURE_NV_fragment_program |
| 1355 | case GL_FRAGMENT_PROGRAM_NV: |
| 1356 | CHECK_EXTENSION(NV_fragment_program); |
| 1357 | return ctx->FragmentProgram.Enabled; |
| 1358 | #endif /* FEATURE_NV_fragment_program */ |
| 1359 | |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1360 | /* GL_NV_texture_rectangle */ |
| 1361 | case GL_TEXTURE_RECTANGLE_NV: |
| 1362 | CHECK_EXTENSION(NV_texture_rectangle); |
Ian Romanick | 58dacc8 | 2007-05-09 21:45:27 -0700 | [diff] [blame] | 1363 | return is_texture_enabled(ctx, TEXTURE_RECT_BIT); |
Brian Paul | 8afe7de | 2002-06-15 03:03:06 +0000 | [diff] [blame] | 1364 | |
Brian Paul | 5f60a0b | 2002-09-06 02:56:08 +0000 | [diff] [blame] | 1365 | /* GL_EXT_stencil_two_side */ |
| 1366 | case GL_STENCIL_TEST_TWO_SIDE_EXT: |
| 1367 | CHECK_EXTENSION(EXT_stencil_two_side); |
| 1368 | return ctx->Stencil.TestTwoSide; |
| 1369 | |
Brian Paul | 77eec61 | 2003-04-18 01:56:11 +0000 | [diff] [blame] | 1370 | #if FEATURE_ARB_fragment_program |
| 1371 | case GL_FRAGMENT_PROGRAM_ARB: |
| 1372 | return ctx->FragmentProgram.Enabled; |
| 1373 | #endif /* FEATURE_ARB_fragment_program */ |
| 1374 | |
Brian Paul | e5b244f | 2003-04-21 15:02:17 +0000 | [diff] [blame] | 1375 | /* GL_EXT_depth_bounds_test */ |
| 1376 | case GL_DEPTH_BOUNDS_TEST_EXT: |
| 1377 | CHECK_EXTENSION(EXT_depth_bounds_test); |
| 1378 | return ctx->Depth.BoundsTest; |
| 1379 | |
Brian Paul | 08ff059 | 2003-07-21 04:22:40 +0000 | [diff] [blame] | 1380 | /* GL_MESA_program_debug */ |
| 1381 | case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: |
| 1382 | CHECK_EXTENSION(MESA_program_debug); |
| 1383 | return ctx->FragmentProgram.CallbackEnabled; |
| 1384 | case GL_VERTEX_PROGRAM_CALLBACK_MESA: |
| 1385 | CHECK_EXTENSION(MESA_program_debug); |
| 1386 | return ctx->VertexProgram.CallbackEnabled; |
Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 1387 | #if FEATURE_ATI_fragment_shader |
| 1388 | case GL_FRAGMENT_SHADER_ATI: |
| 1389 | CHECK_EXTENSION(ATI_fragment_shader); |
| 1390 | return ctx->ATIFragmentShader.Enabled; |
| 1391 | #endif /* FEATURE_ATI_fragment_shader */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1392 | default: |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 1393 | _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1394 | return GL_FALSE; |
| 1395 | } |
| 1396 | } |