Home | History | Annotate | Download | only in swrast

Lines Matching refs:Stencil

39 /* Stencil Logic:
41 IF stencil test fails THEN
42 Apply fail-op to stencil value
46 Apply zfail-op to stencil value
49 Apply zpass-op to stencil value
57 * Compute/return the offset of the stencil value in a pixel.
58 * For example, if the format is Z24+S8, the position of the stencil bits
83 /** Clamp the stencil value to [0, 255] */
100 GLubyte s = stencil[j]; \
102 stencil[j] = (GLubyte) (NEW_VAL); \
109 GLubyte s = stencil[j]; \
110 stencil[j] = (GLubyte) ((invmask & s) | (wrtmask & (NEW_VAL))); \
117 * Apply the given stencil operator to the array of stencil values.
118 * Don't touch stencil[i] if mask[i] is zero.
119 * @param n number of stencil values
120 * @param oper the stencil buffer operator
122 * @param stencil array of stencil values (in/out)
124 * @param stride stride between stencil values
128 GLuint n, GLubyte stencil[], const GLubyte mask[],
131 const GLubyte ref = ctx->Stencil.Ref[face];
132 const GLubyte wrtmask = ctx->Stencil.WriteMask[face];
141 /* replace stencil buf values with zero */
145 /* replace stencil buf values with ref value */
149 /* increment stencil buf values, with clamping */
153 /* increment stencil buf values, with clamping */
157 /* increment stencil buf values, without clamping */
161 /* increment stencil buf values, without clamping */
165 /* replace stencil buf values with inverted value */
169 _mesa_problem(ctx, "Bad stencil op in apply_stencil_op");
178 s = (GLubyte) (stencil[j] & valueMask); \
180 /* stencil pass */ \
184 /* stencil fail */ \
197 * Apply stencil test to an array of stencil values (before depth buffering).
199 * the stencil values.
203 * @param stencil array of [n] stencil values (in/out)
204 * @param mask array [n] of flag: 0=skip the pixel, 1=stencil the pixel,
205 * values are set to zero where the stencil test fails.
206 * @param stride stride between stencil values
211 GLubyte stencil[], GLubyte mask[], GLint stride)
217 const GLuint valueMask = ctx->Stencil.ValueMask[face];
218 const GLubyte ref = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
222 * Perform stencil test. The results of this operation are stored
225 * the stencil fail operator is to be applied
227 * the stencil fail operator is not to be applied
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,
289 * Get 8-bit stencil values from random locations in the stencil buffer.
294 GLubyte stencil[])
305 stencil[i] = *(map + y[i] * rowStride + x[i]);
315 _mesa_unpack_ubyte_stencil_row(rb->Format, 1, src, &stencil[i]);
323 * Put 8-bit stencil values at random locations into the stencil buffer.
328 const GLubyte stencil[])
338 pack_stencil(&stencil[i], dst);
356 const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace;
363 /* read stencil values from random locations */
369 /* Processing a horizontal run of pixels. Since stencil is always
377 * Apply the stencil test to the fragments.
378 * failMask[i] is 1 if the stencil test failed.
381 /* all fragments failed the stencil test, we're done. */
384 /* need to write the updated stencil values back to the buffer */
392 * Some fragments passed the stencil test, apply depth test to them
393 * and apply Zpass and Zfail stencil ops.
398 * No depth buffer, just apply zpass stencil function to active pixels.
400 apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, count,
405 * Perform depth buffering, then apply zpass or zfail stencil function.
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,
431 /* Write updated stencil values back into hardware stencil buffer */
446 * Return a span of stencil values from the stencil buffer.
450 * Output: stencil - the array of stencil values
454 GLint n, GLint x, GLint y, GLubyte stencil[])
468 stencil += dx;
479 _mesa_unpack_ubyte_stencil_row(rb->Format, n, src, stencil);
485 * Write a span of stencil values to the stencil buffer. This function
486 * applies the stencil write mask when needed.
490 * stencil - the array of stencil values
494 const GLubyte stencil[] )
500 const GLuint stencilMask = ctx->Stencil.WriteMask[0];
512 stencil += dx;
533 = (stencil[i] & stencilMask) | (destVals[i] & ~stencilMask);
538 _mesa_pack_ubyte_stencil_row(rb->Format, n, stencil, stencilBuf);
545 * Clear the stencil buffer. If the buffer is a combined
546 * depth+stencil buffer, only the stencil bits will be touched.
554 const GLuint writeMask = ctx->Stencil.WriteMask[0];
572 /* need to mask stencil values */
576 /* combined depth+stencil, need to mask Z values */
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"