Mesa (main): i915g: Fix backface stencil when front_ccw is set.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 12 18:26:56 UTC 2021


Module: Mesa
Branch: main
Commit: 54210c685f6ca8ffcb3445348a2ad3ca3513af1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=54210c685f6ca8ffcb3445348a2ad3ca3513af1d

Author: Emma Anholt <emma at anholt.net>
Date:   Sat Jul  3 22:12:21 2021 -0700

i915g: Fix backface stencil when front_ccw is set.

If we're doing separate front/back stencil ops, then in the absence of a
hardware bit for setting front_ccw (which you can already see from how we
manage cull face) we need to flip front/back stencil register settings.

Closes: #4974, #4975
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11706>

---

 .../drivers/i915/ci/deqp-i915-g33-fails.txt        | 294 ---------------------
 .../drivers/i915/ci/piglit-i915-g33-fails.txt      |   1 -
 src/gallium/drivers/i915/i915_context.h            |  19 +-
 src/gallium/drivers/i915/i915_state.c              | 108 +++++---
 src/gallium/drivers/i915/i915_state_dynamic.c      |  28 +-
 src/gallium/drivers/i915/i915_state_immediate.c    |   8 +-
 6 files changed, 111 insertions(+), 347 deletions(-)

diff --git a/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt b/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
index 8493bab444a..43822f6cb5c 100644
--- a/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
@@ -18,300 +18,6 @@ dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail
 dEQP-GLES2.functional.clipping.triangle_vertex.clip_two.clip_neg_y_neg_z_and_neg_x_neg_y_pos_z,Fail
 dEQP-GLES2.functional.clipping.triangle_vertex.clip_two.clip_pos_y_pos_z_and_neg_x_neg_y_neg_z,Fail
 dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb10_a2,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.0,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.1,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.10,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.11,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.12,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.13,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.14,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.15,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.16,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.17,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.18,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.19,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.2,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.20,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.21,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.22,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.23,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.24,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.3,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.4,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.5,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.6,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.7,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.8,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.random.9,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_always_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_equal_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_gequal_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_greater_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_lequal_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_less_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_never_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_always,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_equal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_gequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_greater,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_lequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_less,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_never,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_depth_notequal,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_notequal_no_depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.both,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.depth,Fail
-dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.stencil,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.0,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.1,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.10,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.11,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.12,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.13,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.14,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.15,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.16,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.17,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.18,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.19,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.2,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.20,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.21,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.22,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.23,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.24,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.25,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.26,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.27,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.28,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.29,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.3,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.31,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.32,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.33,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.34,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.35,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.36,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.37,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.38,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.39,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.4,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.40,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.41,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.42,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.43,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.44,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.45,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.46,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.47,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.49,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.5,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.50,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.51,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.52,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.54,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.55,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.56,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.57,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.58,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.59,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.6,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.60,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.61,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.62,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.63,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.64,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.65,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.66,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.67,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.68,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.69,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.70,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.71,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.72,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.73,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.74,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.75,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.76,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.77,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.78,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.79,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.8,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.80,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.81,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.82,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.83,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.84,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.85,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.86,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.87,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.88,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.9,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.90,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.91,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.92,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.93,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.94,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.95,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.96,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.97,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.98,Fail
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.99,Fail
-dEQP-GLES2.functional.fragment_ops.random.0,Fail
-dEQP-GLES2.functional.fragment_ops.random.1,Fail
-dEQP-GLES2.functional.fragment_ops.random.10,Fail
-dEQP-GLES2.functional.fragment_ops.random.11,Fail
-dEQP-GLES2.functional.fragment_ops.random.12,Fail
-dEQP-GLES2.functional.fragment_ops.random.13,Fail
-dEQP-GLES2.functional.fragment_ops.random.14,Fail
-dEQP-GLES2.functional.fragment_ops.random.15,Fail
-dEQP-GLES2.functional.fragment_ops.random.16,Fail
-dEQP-GLES2.functional.fragment_ops.random.17,Fail
-dEQP-GLES2.functional.fragment_ops.random.18,Fail
-dEQP-GLES2.functional.fragment_ops.random.19,Fail
-dEQP-GLES2.functional.fragment_ops.random.2,Fail
-dEQP-GLES2.functional.fragment_ops.random.20,Fail
-dEQP-GLES2.functional.fragment_ops.random.21,Fail
-dEQP-GLES2.functional.fragment_ops.random.22,Fail
-dEQP-GLES2.functional.fragment_ops.random.23,Fail
-dEQP-GLES2.functional.fragment_ops.random.24,Fail
-dEQP-GLES2.functional.fragment_ops.random.25,Fail
-dEQP-GLES2.functional.fragment_ops.random.26,Fail
-dEQP-GLES2.functional.fragment_ops.random.27,Fail
-dEQP-GLES2.functional.fragment_ops.random.28,Fail
-dEQP-GLES2.functional.fragment_ops.random.29,Fail
-dEQP-GLES2.functional.fragment_ops.random.3,Fail
-dEQP-GLES2.functional.fragment_ops.random.30,Fail
-dEQP-GLES2.functional.fragment_ops.random.31,Fail
-dEQP-GLES2.functional.fragment_ops.random.32,Fail
-dEQP-GLES2.functional.fragment_ops.random.33,Fail
-dEQP-GLES2.functional.fragment_ops.random.34,Fail
-dEQP-GLES2.functional.fragment_ops.random.35,Fail
-dEQP-GLES2.functional.fragment_ops.random.36,Fail
-dEQP-GLES2.functional.fragment_ops.random.37,Fail
-dEQP-GLES2.functional.fragment_ops.random.38,Fail
-dEQP-GLES2.functional.fragment_ops.random.39,Fail
-dEQP-GLES2.functional.fragment_ops.random.4,Fail
-dEQP-GLES2.functional.fragment_ops.random.40,Fail
-dEQP-GLES2.functional.fragment_ops.random.41,Fail
-dEQP-GLES2.functional.fragment_ops.random.42,Fail
-dEQP-GLES2.functional.fragment_ops.random.43,Fail
-dEQP-GLES2.functional.fragment_ops.random.44,Fail
-dEQP-GLES2.functional.fragment_ops.random.45,Fail
-dEQP-GLES2.functional.fragment_ops.random.46,Fail
-dEQP-GLES2.functional.fragment_ops.random.47,Fail
-dEQP-GLES2.functional.fragment_ops.random.48,Fail
-dEQP-GLES2.functional.fragment_ops.random.49,Fail
-dEQP-GLES2.functional.fragment_ops.random.5,Fail
-dEQP-GLES2.functional.fragment_ops.random.50,Fail
-dEQP-GLES2.functional.fragment_ops.random.51,Fail
-dEQP-GLES2.functional.fragment_ops.random.52,Fail
-dEQP-GLES2.functional.fragment_ops.random.53,Fail
-dEQP-GLES2.functional.fragment_ops.random.54,Fail
-dEQP-GLES2.functional.fragment_ops.random.55,Fail
-dEQP-GLES2.functional.fragment_ops.random.56,Fail
-dEQP-GLES2.functional.fragment_ops.random.57,Fail
-dEQP-GLES2.functional.fragment_ops.random.58,Fail
-dEQP-GLES2.functional.fragment_ops.random.59,Fail
-dEQP-GLES2.functional.fragment_ops.random.6,Fail
-dEQP-GLES2.functional.fragment_ops.random.60,Fail
-dEQP-GLES2.functional.fragment_ops.random.61,Fail
-dEQP-GLES2.functional.fragment_ops.random.62,Fail
-dEQP-GLES2.functional.fragment_ops.random.63,Fail
-dEQP-GLES2.functional.fragment_ops.random.64,Fail
-dEQP-GLES2.functional.fragment_ops.random.66,Fail
-dEQP-GLES2.functional.fragment_ops.random.67,Fail
-dEQP-GLES2.functional.fragment_ops.random.68,Fail
-dEQP-GLES2.functional.fragment_ops.random.69,Fail
-dEQP-GLES2.functional.fragment_ops.random.7,Fail
-dEQP-GLES2.functional.fragment_ops.random.70,Fail
-dEQP-GLES2.functional.fragment_ops.random.71,Fail
-dEQP-GLES2.functional.fragment_ops.random.72,Fail
-dEQP-GLES2.functional.fragment_ops.random.73,Fail
-dEQP-GLES2.functional.fragment_ops.random.74,Fail
-dEQP-GLES2.functional.fragment_ops.random.75,Fail
-dEQP-GLES2.functional.fragment_ops.random.76,Fail
-dEQP-GLES2.functional.fragment_ops.random.77,Fail
-dEQP-GLES2.functional.fragment_ops.random.78,Fail
-dEQP-GLES2.functional.fragment_ops.random.79,Fail
-dEQP-GLES2.functional.fragment_ops.random.8,Fail
-dEQP-GLES2.functional.fragment_ops.random.80,Fail
-dEQP-GLES2.functional.fragment_ops.random.81,Fail
-dEQP-GLES2.functional.fragment_ops.random.82,Fail
-dEQP-GLES2.functional.fragment_ops.random.83,Fail
-dEQP-GLES2.functional.fragment_ops.random.84,Fail
-dEQP-GLES2.functional.fragment_ops.random.85,Fail
-dEQP-GLES2.functional.fragment_ops.random.86,Fail
-dEQP-GLES2.functional.fragment_ops.random.87,Fail
-dEQP-GLES2.functional.fragment_ops.random.88,Fail
-dEQP-GLES2.functional.fragment_ops.random.89,Fail
-dEQP-GLES2.functional.fragment_ops.random.9,Fail
-dEQP-GLES2.functional.fragment_ops.random.90,Fail
-dEQP-GLES2.functional.fragment_ops.random.91,Fail
-dEQP-GLES2.functional.fragment_ops.random.92,Fail
-dEQP-GLES2.functional.fragment_ops.random.93,Fail
-dEQP-GLES2.functional.fragment_ops.random.94,Fail
-dEQP-GLES2.functional.fragment_ops.random.95,Fail
-dEQP-GLES2.functional.fragment_ops.random.96,Fail
-dEQP-GLES2.functional.fragment_ops.random.97,Fail
-dEQP-GLES2.functional.fragment_ops.random.98,Fail
-dEQP-GLES2.functional.fragment_ops.random.99,Fail
 dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose,Fail
 dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level_array_compressed,Fail
 dEQP-GLES2.functional.polygon_offset.default_displacement_with_units,Fail
diff --git a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
index 8ff87db8e4a..53a82aaf178 100644
--- a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
@@ -144,7 +144,6 @@ spec@!opengl 1.4 at tex-miplevel-selection,Fail
 spec@!opengl 1.4 at tex-miplevel-selection-lod,Fail
 spec@!opengl 1.4 at tex-miplevel-selection-lod-bias,Fail
 spec@!opengl 1.5 at depth-tex-compare,Fail
-spec@!opengl 2.0 at gl-2.0-two-sided-stencil,Fail
 spec@!opengl 2.0 at max-samplers,Fail
 spec@!opengl 2.0 at max-samplers border,Fail
 spec@!opengl 2.0 at occlusion-query-discard,Fail
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 3ff19ba7798..0256a440283 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -38,6 +38,7 @@
 
 #include "util/slab.h"
 #include "util/u_blitter.h"
+#include "i915_reg.h"
 
 struct i915_winsys;
 struct i915_winsys_buffer;
@@ -182,9 +183,12 @@ struct i915_blend_state {
 };
 
 struct i915_depth_stencil_state {
-   unsigned stencil_modes4;
-   unsigned bfo[2];
-   unsigned stencil_LIS5;
+   unsigned stencil_modes4_cw;
+   unsigned stencil_modes4_ccw;
+   unsigned bfo_cw[2];
+   unsigned bfo_ccw[2];
+   unsigned stencil_LIS5_cw;
+   unsigned stencil_LIS5_ccw;
    unsigned depth_LIS6;
 };
 
@@ -355,6 +359,15 @@ i915_set_flush_dirty(struct i915_context *i915, unsigned flush)
    i915->flush_dirty |= flush;
 }
 
+static inline uint32_t
+i915_stencil_ccw(struct i915_context *i915)
+{
+   /* If we're doing two sided stencil, then front_ccw means we need to reverse
+    * the state for the sides.
+    */
+   return i915->rasterizer->templ.front_ccw &&
+          (i915->depth_stencil->bfo_cw[0] & BFO_STENCIL_TWO_SIDE);
+}
 /***********************************************************************
  * i915_prim_emit.c:
  */
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 1b064c63980..2eb69690731 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -386,6 +386,57 @@ i915_delete_sampler_state(struct pipe_context *pipe, void *sampler)
  * into one file.
  */
 
+static uint32_t
+i915_get_modes4_stencil(const struct pipe_stencil_state *stencil)
+{
+   int testmask = stencil->valuemask & 0xff;
+   int writemask = stencil->writemask & 0xff;
+
+   return (_3DSTATE_MODES_4_CMD | ENABLE_STENCIL_TEST_MASK |
+           STENCIL_TEST_MASK(testmask) | ENABLE_STENCIL_WRITE_MASK |
+           STENCIL_WRITE_MASK(writemask));
+}
+
+static uint32_t
+i915_get_lis5_stencil(const struct pipe_stencil_state *stencil)
+{
+   int test = i915_translate_compare_func(stencil->func);
+   int fop = i915_translate_stencil_op(stencil->fail_op);
+   int dfop = i915_translate_stencil_op(stencil->zfail_op);
+   int dpop = i915_translate_stencil_op(stencil->zpass_op);
+
+   return (S5_STENCIL_TEST_ENABLE | S5_STENCIL_WRITE_ENABLE |
+           (test << S5_STENCIL_TEST_FUNC_SHIFT) |
+           (fop << S5_STENCIL_FAIL_SHIFT) |
+           (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
+           (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
+}
+
+static uint32_t
+i915_get_bfo(const struct pipe_stencil_state *stencil)
+{
+   int test = i915_translate_compare_func(stencil->func);
+   int fop = i915_translate_stencil_op(stencil->fail_op);
+   int dfop = i915_translate_stencil_op(stencil->zfail_op);
+   int dpop = i915_translate_stencil_op(stencil->zpass_op);
+
+   return (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_FUNCS |
+           BFO_ENABLE_STENCIL_TWO_SIDE | BFO_ENABLE_STENCIL_REF |
+           BFO_STENCIL_TWO_SIDE | (test << BFO_STENCIL_TEST_SHIFT) |
+           (fop << BFO_STENCIL_FAIL_SHIFT) |
+           (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) |
+           (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT));
+}
+
+static uint32_t
+i915_get_bfm(const struct pipe_stencil_state *stencil)
+{
+   return (_3DSTATE_BACKFACE_STENCIL_MASKS | BFM_ENABLE_STENCIL_TEST_MASK |
+           BFM_ENABLE_STENCIL_WRITE_MASK |
+           ((stencil->valuemask & 0xff) << BFM_STENCIL_TEST_MASK_SHIFT) |
+           ((stencil->writemask & 0xff) << BFM_STENCIL_WRITE_MASK_SHIFT));
+}
+
 static void *
 i915_create_depth_stencil_state(
    struct pipe_context *pipe,
@@ -394,58 +445,35 @@ i915_create_depth_stencil_state(
    struct i915_depth_stencil_state *cso =
       CALLOC_STRUCT(i915_depth_stencil_state);
 
-   {
-      int testmask = depth_stencil->stencil[0].valuemask & 0xff;
-      int writemask = depth_stencil->stencil[0].writemask & 0xff;
-
-      cso->stencil_modes4 |=
-         (_3DSTATE_MODES_4_CMD | ENABLE_STENCIL_TEST_MASK |
-          STENCIL_TEST_MASK(testmask) | ENABLE_STENCIL_WRITE_MASK |
-          STENCIL_WRITE_MASK(writemask));
-   }
+   cso->stencil_modes4_cw = i915_get_modes4_stencil(&depth_stencil->stencil[0]);
+   cso->stencil_modes4_ccw =
+      i915_get_modes4_stencil(&depth_stencil->stencil[1]);
 
    if (depth_stencil->stencil[0].enabled) {
-      int test = i915_translate_compare_func(depth_stencil->stencil[0].func);
-      int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op);
-      int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op);
-      int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op);
-
-      cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE | S5_STENCIL_WRITE_ENABLE |
-                            (test << S5_STENCIL_TEST_FUNC_SHIFT) |
-                            (fop << S5_STENCIL_FAIL_SHIFT) |
-                            (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
-                            (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
+      cso->stencil_LIS5_cw = i915_get_lis5_stencil(&depth_stencil->stencil[0]);
    }
 
    if (depth_stencil->stencil[1].enabled) {
-      int test = i915_translate_compare_func(depth_stencil->stencil[1].func);
-      int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op);
-      int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
-      int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
-      int tmask = depth_stencil->stencil[1].valuemask & 0xff;
-      int wmask = depth_stencil->stencil[1].writemask & 0xff;
-
-      cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_FUNCS |
-                     BFO_ENABLE_STENCIL_TWO_SIDE | BFO_ENABLE_STENCIL_REF |
-                     BFO_STENCIL_TWO_SIDE | (test << BFO_STENCIL_TEST_SHIFT) |
-                     (fop << BFO_STENCIL_FAIL_SHIFT) |
-                     (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) |
-                     (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT));
-
-      cso->bfo[1] =
-         (_3DSTATE_BACKFACE_STENCIL_MASKS | BFM_ENABLE_STENCIL_TEST_MASK |
-          BFM_ENABLE_STENCIL_WRITE_MASK |
-          (tmask << BFM_STENCIL_TEST_MASK_SHIFT) |
-          (wmask << BFM_STENCIL_WRITE_MASK_SHIFT));
+      cso->bfo_cw[0] = i915_get_bfo(&depth_stencil->stencil[1]);
+      cso->bfo_cw[1] = i915_get_bfm(&depth_stencil->stencil[1]);
+
+      /* Precompute the backface stencil settings if front winding order is
+       * reversed -- HW doesn't have a bit to flip it for us.
+       */
+      cso->stencil_LIS5_ccw = i915_get_lis5_stencil(&depth_stencil->stencil[1]);
+      cso->bfo_ccw[0] = i915_get_bfo(&depth_stencil->stencil[0]);
+      cso->bfo_ccw[1] = i915_get_bfm(&depth_stencil->stencil[0]);
    } else {
       /* This actually disables two-side stencil: The bit set is a
        * modify-enable bit to indicate we are changing the two-side
        * setting.  Then there is a symbolic zero to show that we are
        * setting the flag to zero/off.
        */
-      cso->bfo[0] =
+      cso->bfo_cw[0] = cso->bfo_ccw[0] =
          (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE | 0);
-      cso->bfo[1] = 0;
+      cso->bfo_cw[1] = cso->bfo_ccw[1] = 0;
+
+      cso->stencil_LIS5_ccw = cso->stencil_LIS5_cw;
    }
 
    if (depth_stencil->depth_enabled) {
diff --git a/src/gallium/drivers/i915/i915_state_dynamic.c b/src/gallium/drivers/i915/i915_state_dynamic.c
index 3f6c416c998..bb15a3637b7 100644
--- a/src/gallium/drivers/i915/i915_state_dynamic.c
+++ b/src/gallium/drivers/i915/i915_state_dynamic.c
@@ -79,11 +79,16 @@ set_dynamic_array(struct i915_context *i915, unsigned offset,
 static void
 upload_MODES4(struct i915_context *i915)
 {
+   bool stencil_ccw = i915_stencil_ccw(i915);
+
    unsigned modes4 = 0;
 
    /* I915_NEW_STENCIL
     */
-   modes4 |= i915->depth_stencil->stencil_modes4;
+   if (stencil_ccw)
+      modes4 |= i915->depth_stencil->stencil_modes4_ccw;
+   else
+      modes4 |= i915->depth_stencil->stencil_modes4_cw;
 
    /* I915_NEW_BLEND
     */
@@ -93,27 +98,36 @@ upload_MODES4(struct i915_context *i915)
 }
 
 const struct i915_tracked_state i915_upload_MODES4 = {
-   "MODES4", upload_MODES4, I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL};
+   "MODES4", upload_MODES4,
+   I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL | I915_NEW_RASTERIZER};
 
 /***********************************************************************
  */
 static void
 upload_BFO(struct i915_context *i915)
 {
+   bool stencil_ccw = i915_stencil_ccw(i915);
+
    unsigned bfo[2];
-   bfo[0] = i915->depth_stencil->bfo[0];
-   bfo[1] = i915->depth_stencil->bfo[1];
+   if (stencil_ccw) {
+      bfo[0] = i915->depth_stencil->bfo_ccw[0];
+      bfo[1] = i915->depth_stencil->bfo_ccw[1];
+   } else {
+      bfo[0] = i915->depth_stencil->bfo_cw[0];
+      bfo[1] = i915->depth_stencil->bfo_cw[1];
+   }
    /* I don't get it only allowed to set a ref mask when the enable bit is set?
     */
    if (bfo[0] & BFO_ENABLE_STENCIL_REF) {
-      bfo[0] |= i915->stencil_ref.ref_value[1] << BFO_STENCIL_REF_SHIFT;
+      bfo[0] |= i915->stencil_ref.ref_value[!stencil_ccw]
+                << BFO_STENCIL_REF_SHIFT;
    }
 
    set_dynamic_array(i915, I915_DYNAMIC_BFO_0, bfo, 2);
 }
 
-const struct i915_tracked_state i915_upload_BFO = {"BFO", upload_BFO,
-                                                   I915_NEW_DEPTH_STENCIL};
+const struct i915_tracked_state i915_upload_BFO = {
+   "BFO", upload_BFO, I915_NEW_DEPTH_STENCIL | I915_NEW_RASTERIZER};
 
 /***********************************************************************
  */
diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c
index 396734c007b..886c96e80ab 100644
--- a/src/gallium/drivers/i915/i915_state_immediate.c
+++ b/src/gallium/drivers/i915/i915_state_immediate.c
@@ -113,13 +113,17 @@ static void
 upload_S5(struct i915_context *i915)
 {
    unsigned LIS5 = 0;
+   bool stencil_ccw = i915_stencil_ccw(i915);
 
    /* I915_NEW_DEPTH_STENCIL
     */
-   LIS5 |= i915->depth_stencil->stencil_LIS5;
+   if (stencil_ccw)
+      LIS5 |= i915->depth_stencil->stencil_LIS5_ccw;
+   else
+      LIS5 |= i915->depth_stencil->stencil_LIS5_cw;
    /* hope it's safe to set stencil ref value even if stencil test is disabled?
     */
-   LIS5 |= i915->stencil_ref.ref_value[0] << S5_STENCIL_REF_SHIFT;
+   LIS5 |= i915->stencil_ref.ref_value[stencil_ccw] << S5_STENCIL_REF_SHIFT;
 
    /* I915_NEW_BLEND
     */



More information about the mesa-commit mailing list