Lines Matching refs:stencil
30 * Depth/stencil testing to LLVM IR translation.
32 * To be done accurately/efficiently the depth/stencil test must be done with
33 * the same type/format of the depth/stencil buffer, which implies massaging
35 * type/format for depth/stencil values internally and only convert when
40 * processing unit is a quad (2x2 pixel block) we store the depth/stencil
88 * Do the stencil test comparison (compare FB stencil values against ref value).
89 * This will be used twice when generating two-sided stencil code.
90 * \param stencil the front/back stencil state
91 * \param stencilRef the stencil reference value, replicated as a vector
92 * \param stencilVals vector of stencil values from framebuffer
97 const struct pipe_stencil_state *stencil,
117 assert(stencil->enabled);
119 if (stencil->valuemask != stencilMax) {
121 LLVMValueRef valuemask = lp_build_const_int_vec(bld->gallivm, type, stencil->valuemask);
127 res = lp_build_cmp(bld, stencil->func, stencilRef, stencilVals);
134 * Do the one or two-sided stencil test comparison.
141 const struct pipe_stencil_state stencil[2],
148 assert(stencil[0].enabled);
151 res = lp_build_stencil_test_single(bld, &stencil[0],
154 if (stencil[1].enabled && front_facing != NULL) {
158 back_res = lp_build_stencil_test_single(bld, &stencil[1],
169 * Apply the stencil operator (add/sub/keep/etc) to the given vector
170 * of stencil values.
171 * \return new stencil values vector
175 const struct pipe_stencil_state *stencil,
191 stencil_op = stencil->fail_op;
194 stencil_op = stencil->zfail_op;
197 stencil_op = stencil->zpass_op;
236 assert(0 && "bad stencil op mode");
245 * Do the one or two-sided stencil test op/update.
249 const struct pipe_stencil_state stencil[2],
260 assert(stencil[0].enabled);
263 res = lp_build_stencil_op_single(bld, &stencil[0], op,
266 if (stencil[1].enabled && front_facing != NULL) {
270 back_res = lp_build_stencil_op_single(bld, &stencil[1], op,
276 if (stencil[0].writemask != 0xff ||
277 (stencil[1].enabled && front_facing != NULL && stencil[1].writemask != 0xff)) {
278 /* mask &= stencil[0].writemask */
280 stencil[0].writemask);
281 if (stencil[1].enabled && stencil[1].writemask != stencil[0].writemask && front_facing != NULL) {
283 stencil[1].writemask);
302 * Return a type appropriate for depth/stencil testing.
398 * to put the stencil bits in the least significant position.
521 * Generate code for performing depth and/or stencil tests.
525 * \param stencil the front/back stencil state
526 * \param type the data type of the fragment depth/stencil values
527 * \param format_desc description of the depth/stencil surface
529 * \param stencil_refs the front/back stencil ref values (scalar)
530 * \param z_src the incoming depth/stencil values (n 2x2 quad values, float32)
531 * \param zs_dst_ptr pointer to depth/stencil values in framebuffer
537 const struct pipe_stencil_state stencil[2],
583 /* FIXME: for non-float depth/stencil might generate better code
585 * For stencil we'd almost certainly want to pack to 8xi16 values,
597 assert(depth->enabled || stencil[0].enabled);
603 if (stencil[0].enabled) {
629 /* Setup build context for stencil vals */
633 /* Load current z/stencil value from z/stencil buffer */
642 /* Compute and apply the Z/stencil bitmasks and shifts.
687 if (stencil[0].enabled) {
702 /* convert scalar stencil refs into vectors */
706 s_pass_mask = lp_build_stencil_test(&s_bld, stencil,
710 /* apply stencil-fail operator */
713 stencil_vals = lp_build_stencil_op(&s_bld, stencil, S_FAIL_OP,
760 if (!stencil[0].enabled) {
762 * if stencil is disabled because we still need to update the stencil
779 /* mask off bits that failed stencil test */
790 if (stencil[0].enabled) {
791 /* update stencil buffer values according to z pass/fail result */
796 stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_FAIL_OP,
802 stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
808 /* No depth test: apply Z-pass operator to stencil buffer values which
809 * passed the stencil test.
812 stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
826 /* Finally, merge/store the z/stencil values */
828 (stencil[0].enabled && stencil[0].writemask)) {
843 if (depth->enabled && stencil[0].enabled)