Lines Matching refs:ctx
56 GET_CURRENT_CONTEXT(ctx);
57 ASSERT_OUTSIDE_BEGIN_END(ctx);
60 _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
63 _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" );
67 if (ctx->Polygon.CullFaceMode == mode)
70 FLUSH_VERTICES(ctx, _NEW_POLYGON);
71 ctx->Polygon.CullFaceMode = mode;
73 if (ctx->Driver.CullFace)
74 ctx->Driver.CullFace( ctx, mode );
92 GET_CURRENT_CONTEXT(ctx);
93 ASSERT_OUTSIDE_BEGIN_END(ctx);
96 _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
99 _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
103 if (ctx->Polygon.FrontFace == mode)
106 FLUSH_VERTICES(ctx, _NEW_POLYGON);
107 ctx->Polygon.FrontFace = mode;
109 ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
111 if (ctx->Driver.FrontFace)
112 ctx->Driver.FrontFace( ctx, mode );
131 GET_CURRENT_CONTEXT(ctx);
132 ASSERT_OUTSIDE_BEGIN_END(ctx);
135 _mesa_debug(ctx, "glPolygonMode %s %s\n",
140 _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
146 if (ctx->API == API_OPENGL_CORE) {
147 _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
150 if (ctx->Polygon.FrontMode == mode)
152 FLUSH_VERTICES(ctx, _NEW_POLYGON);
153 ctx->Polygon.FrontMode = mode;
156 if (ctx->Polygon.FrontMode == mode &&
157 ctx->Polygon.BackMode == mode)
159 FLUSH_VERTICES(ctx, _NEW_POLYGON);
160 ctx->Polygon.FrontMode = mode;
161 ctx->Polygon.BackMode = mode;
164 if (ctx->API == API_OPENGL_CORE) {
165 _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
168 if (ctx->Polygon.BackMode == mode)
170 FLUSH_VERTICES(ctx, _NEW_POLYGON);
171 ctx->Polygon.BackMode = mode;
174 _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
178 if (ctx->Polygon.FrontMode == GL_FILL && ctx->Polygon.BackMode == GL_FILL)
179 ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
181 ctx->_TriangleCaps |= DD_TRI_UNFILLED;
183 if (ctx->Driver.PolygonMode)
184 ctx->Driver.PolygonMode(ctx, face, mode);
191 * This routine updates the ctx->Polygon.Stipple state.
198 * ctx->Driver.PolygonStipple(). We'll have to update all the DRI drivers
202 _mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern)
204 pattern = _mesa_map_validate_pbo_source(ctx, 2,
205 &ctx->Unpack, 32, 32, 1,
212 _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
214 _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
224 GET_CURRENT_CONTEXT(ctx);
225 ASSERT_OUTSIDE_BEGIN_END(ctx);
228 _mesa_debug(ctx, "glPolygonStipple\n");
230 FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
232 _mesa_polygon_stipple(ctx, pattern);
234 if (ctx->Driver.PolygonStipple)
235 ctx->Driver.PolygonStipple(ctx, pattern);
245 GET_CURRENT_CONTEXT(ctx);
246 ASSERT_OUTSIDE_BEGIN_END(ctx);
249 _mesa_debug(ctx, "glGetPolygonStipple\n");
251 dest = _mesa_map_validate_pbo_dest(ctx, 2,
252 &ctx->Pack, 32, 32, 1,
258 _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack);
260 _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
274 GET_CURRENT_CONTEXT(ctx);
275 ASSERT_OUTSIDE_BEGIN_END(ctx);
278 _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
280 if (ctx->Polygon.OffsetFactor == factor &&
281 ctx->Polygon.OffsetUnits == units)
284 FLUSH_VERTICES(ctx, _NEW_POLYGON);
285 ctx->Polygon.OffsetFactor = factor;
286 ctx->Polygon.OffsetUnits = units;
288 if (ctx->Driver.PolygonOffset)
289 ctx->Driver.PolygonOffset( ctx, factor, units );
296 GET_CURRENT_CONTEXT(ctx);
298 _mesa_PolygonOffset(factor, bias * ctx->DrawBuffer->_DepthMaxF );
311 * \param ctx GL context.
316 void _mesa_init_polygon( struct gl_context * ctx )
319 ctx->Polygon.CullFlag = GL_FALSE;
320 ctx->Polygon.CullFaceMode = GL_BACK;
321 ctx->Polygon.FrontFace = GL_CCW;
322 ctx->Polygon._FrontBit = 0;
323 ctx->Polygon.FrontMode = GL_FILL;
324 ctx->Polygon.BackMode = GL_FILL;
325 ctx->Polygon.SmoothFlag = GL_FALSE;
326 ctx->Polygon.StippleFlag = GL_FALSE;
327 ctx->Polygon.OffsetFactor = 0.0F;
328 ctx->Polygon.OffsetUnits = 0.0F;
329 ctx->Polygon.OffsetPoint = GL_FALSE;
330 ctx->Polygon.OffsetLine = GL_FALSE;
331 ctx->Polygon.OffsetFill = GL_FALSE;
335 memset( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) );