Home | History | Annotate | Download | only in main

Lines Matching refs:Stencil

27  * \file stencil.c
28 * Stencil operations.
31 * OpenGL 2.0's two-sided stencil feature.
43 * This problem is solved by keeping three sets of stencil state:
54 #include "stencil.h"
97 * Set the clear value for the stencil buffer.
113 if (ctx->Stencil.Clear == (GLuint) s)
117 ctx->Stencil.Clear = (GLuint) s;
122 * Set the function and reference value for stencil testing.
132 * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
159 if (ctx->Stencil.Function[0] == frontfunc &&
160 ctx->Stencil.Function[1] == backfunc &&
161 ctx->Stencil.ValueMask[0] == mask &&
162 ctx->Stencil.ValueMask[1] == mask &&
163 ctx->Stencil.Ref[0] == ref &&
164 ctx->Stencil.Ref[1] == ref)
167 ctx->Stencil.Function[0] = frontfunc;
168 ctx->Stencil.Function[1] = backfunc;
169 ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
170 ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask;
181 * Set the function and reference value for stencil testing.
190 * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
198 const GLint face = ctx->Stencil.ActiveFace;
212 if (ctx->Stencil.Function[face] == func &&
213 ctx->Stencil.ValueMask[face] == mask &&
214 ctx->Stencil.Ref[face] == ref)
217 ctx->Stencil.Function[face] = func;
218 ctx->Stencil.Ref[face] = ref;
219 ctx->Stencil.ValueMask[face] = mask;
224 if (ctx->Driver.StencilFuncSeparate && ctx->Stencil.TestTwoSide) {
230 if (ctx->Stencil.Function[0] == func &&
231 ctx->Stencil.Function[1] == func &&
232 ctx->Stencil.ValueMask[0] == mask &&
233 ctx->Stencil.ValueMask[1] == mask &&
234 ctx->Stencil.Ref[0] == ref &&
235 ctx->Stencil.Ref[1] == ref)
238 ctx->Stencil.Function[0] = ctx->Stencil.Function[1] = func;
239 ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
240 ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask;
243 ((ctx->Stencil.TestTwoSide)
252 * Set the stencil writing mask.
255 * stencil planes.
266 const GLint face = ctx->Stencil.ActiveFace;
276 if (ctx->Stencil.WriteMask[face] == mask)
279 ctx->Stencil.WriteMask[face] = mask;
284 if (ctx->Driver.StencilMaskSeparate && ctx->Stencil.TestTwoSide) {
290 if (ctx->Stencil.WriteMask[0] == mask &&
291 ctx->Stencil.WriteMask[1] == mask)
294 ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
297 ((ctx->Stencil.TestTwoSide)
306 * Set the stencil test actions.
308 * \param fail action to take when stencil test fails.
309 * \param zfail action to take when stencil test passes, but depth test fails.
310 * \param zpass action to take when stencil test passes and the depth test
316 * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
323 const GLint face = ctx->Stencil.ActiveFace;
345 if (ctx->Stencil.ZFailFunc[face] == zfail &&
346 ctx->Stencil.ZPassFunc[face] == zpass &&
347 ctx->Stencil.FailFunc[face] == fail)
350 ctx->Stencil.ZFailFunc[face] = zfail;
351 ctx->Stencil.ZPassFunc[face] = zpass;
352 ctx->Stencil.FailFunc[face] = fail;
357 if (ctx->Driver.StencilOpSeparate && ctx->Stencil.TestTwoSide) {
363 if (ctx->Stencil.ZFailFunc[0] == zfail &&
364 ctx->Stencil.ZFailFunc[1] == zfail &&
365 ctx->Stencil.ZPassFunc[0] == zpass &&
366 ctx->Stencil.ZPassFunc[1] == zpass &&
367 ctx->Stencil.FailFunc[0] == fail &&
368 ctx->Stencil.FailFunc[1] == fail)
371 ctx->Stencil.ZFailFunc[0] = ctx->Stencil.ZFailFunc[1] = zfail;
372 ctx->Stencil.ZPassFunc[0] = ctx->Stencil.ZPassFunc[1] = zpass;
373 ctx->Stencil.FailFunc[0] = ctx->Stencil.FailFunc[1] = fail;
376 ((ctx->Stencil.TestTwoSide)
403 ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 2;
448 if (ctx->Stencil.ZFailFunc[0] != zfail ||
449 ctx->Stencil.ZPassFunc[0] != zpass ||
450 ctx->Stencil.FailFunc[0] != sfail){
452 ctx->Stencil.ZFailFunc[0] = zfail;
453 ctx->Stencil.ZPassFunc[0] = zpass;
454 ctx->Stencil.FailFunc[0] = sfail;
460 if (ctx->Stencil.ZFailFunc[1] != zfail ||
461 ctx->Stencil.ZPassFunc[1] != zpass ||
462 ctx->Stencil.FailFunc[1] != sfail) {
464 ctx->Stencil.ZFailFunc[1] = zfail;
465 ctx->Stencil.ZPassFunc[1] = zpass;
466 ctx->Stencil.FailFunc[1] = sfail;
502 ctx->Stencil.Function[0] = func;
503 ctx->Stencil.Ref[0] = ref;
504 ctx->Stencil.ValueMask[0] = mask;
508 ctx->Stencil.Function[1] = func;
509 ctx->Stencil.Ref[1] = ref;
510 ctx->Stencil.ValueMask[1] = mask;
536 ctx->Stencil.WriteMask[0] = mask;
539 ctx->Stencil.WriteMask[1] = mask;
548 * Update derived stencil state.
553 Stencil._BackFace;
555 ctx->Stencil._Enabled = (ctx->Stencil.Enabled &&
558 ctx->Stencil._TestTwoSide =
559 ctx->Stencil._Enabled &&
560 (ctx->Stencil.Function[0] != ctx->Stencil.Function[face] ||
561 ctx->Stencil.FailFunc[0] != ctx->Stencil.FailFunc[face] ||
562 ctx->Stencil.ZPassFunc[0] != ctx->Stencil.ZPassFunc[face] ||
563 ctx->Stencil.ZFailFunc[0] != ctx->Stencil.ZFailFunc[face] ||
564 ctx->Stencil.Ref[0] != ctx->Stencil.Ref[face] ||
565 ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[face] ||
566 ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[face]);
575 * Initializes __struct gl_contextRec::Stencil attribute group.
580 ctx->Stencil.Enabled = GL_FALSE;
581 ctx->Stencil.TestTwoSide = GL_FALSE;
582 ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 2 = GL_BACK */
583 ctx->Stencil.Function[0] = GL_ALWAYS;
584 ctx->Stencil.Function[1] = GL_ALWAYS;
585 ctx->Stencil.Function[2] = GL_ALWAYS;
586 ctx->Stencil.FailFunc[0] = GL_KEEP;
587 ctx->Stencil.FailFunc[1] = GL_KEEP;
588 ctx->Stencil.FailFunc[2] = GL_KEEP;
589 ctx->Stencil.ZPassFunc[0] = GL_KEEP;
590 ctx->Stencil.ZPassFunc[1] = GL_KEEP;
591 ctx->Stencil.ZPassFunc[2] = GL_KEEP;
592 ctx->Stencil.ZFailFunc[0] = GL_KEEP;
593 ctx->Stencil.ZFailFunc[1] = GL_KEEP;
594 ctx->Stencil.ZFailFunc[2] = GL_KEEP;
595 ctx->Stencil.Ref[0] = 0;
596 ctx->Stencil.Ref[1] = 0;
597 ctx->Stencil.Ref[2] = 0;
598 ctx->Stencil.ValueMask[0] = ~0U;
599 ctx->Stencil.ValueMask[1] = ~0U;
600 ctx->Stencil.ValueMask[2] = ~0U;
601 ctx->Stencil.WriteMask[0] = ~0U;
602 ctx->Stencil.WriteMask[1] = ~0U;
603 ctx->Stencil.WriteMask[2] = ~0U;
604 ctx->Stencil.Clear = 0;
605 ctx->Stencil._BackFace = 1;