Lines Matching refs:ctx
127 apply_stencil_op(const struct gl_context *ctx, GLenum oper, GLuint face,
131 const GLubyte ref = ctx->Stencil.Ref[face];
132 const GLubyte wrtmask = ctx->Stencil.WriteMask[face];
169 _mesa_problem(ctx, "Bad stencil op in apply_stencil_op");
210 do_stencil_test(struct gl_context *ctx, GLuint face, GLuint n,
213 SWcontext *swrast = SWRAST_CONTEXT(ctx);
217 const GLuint valueMask = ctx->Stencil.ValueMask[face];
218 const GLubyte ref = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
230 switch (ctx->Stencil.Function[face]) {
257 _mesa_problem(ctx, "Bad stencil func in gl_stencil_span");
261 if (ctx->Stencil.FailFunc[face] != GL_KEEP) {
262 apply_stencil_op(ctx, ctx->Stencil.FailFunc[face], face, n, stencil,
292 get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
326 put_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
349 _swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span)
351 SWcontext *swrast = SWRAST_CONTEXT(ctx);
352 struct gl_framebuffer *fb = ctx->DrawBuffer;
356 const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace;
364 get_s8_values(ctx, rb, count, span->array->x, span->array->y,
380 if (!do_stencil_test(ctx, face, count, stencilBuf, mask, stencilStride)) {
385 put_s8_values(ctx, rb, count, span->array->x, span->array->y,
395 if (ctx->Depth.Test == GL_FALSE ||
396 ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer == NULL) {
400 apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, count,
407 SWcontext *swrast = SWRAST_CONTEXT(ctx);
416 _swrast_depth_test_span(ctx, span);
421 if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) {
422 apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face,
425 if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) {
426 apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face,
433 put_s8_values(ctx, rb, count, span->array->x, span->array->y,
453 _swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
493 _swrast_write_stencil_span(struct gl_context *ctx, GLint n, GLint x, GLint y,
496 SWcontext *swrast = SWRAST_CONTEXT(ctx);
497 struct gl_framebuffer *fb = ctx->DrawBuffer;
500 const GLuint stencilMask = ctx->Stencil.WriteMask[0];
549 _swrast_clear_stencil_buffer(struct gl_context *ctx)
552 ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
553 const GLubyte stencilBits = ctx->DrawBuffer->Visual.stencilBits;
554 const GLuint writeMask = ctx->Stencil.WriteMask[0];
565 x = ctx->DrawBuffer->_Xmin;
566 y = ctx->DrawBuffer->_Ymin;
567 width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
568 height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
580 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height,
583 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glClear(stencil)");
590 GLubyte clear = ctx->Stencil.Clear & writeMask & 0xff;
617 GLuint clear = (ctx->Stencil.Clear & writeMask & 0xff) << 24;
630 GLuint clear = ctx->Stencil.Clear & writeMask & 0xff;
642 _mesa_problem(ctx, "Unexpected stencil buffer format %s"
647 ctx->Driver.UnmapRenderbuffer(ctx, rb);