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

Author: Andreas Baierl <[email protected]>
Date:   Thu Nov 19 16:38:11 2020 +0100

lima: Fix glFrontFace handling

Bit 12 of render->aux1 is GL_CCW/GL_CW. For GL_CCW (default of glFrontFace) we 
have
to set that bit active.

This is not what the blob does and what the original reverse engineering 
documentation
says. The blob sets this value inverted and does some bogus negation of the 
fragment
shaders gl_FrontFacing variable instead.

Anyway, doing it this way does not cause regressions but fixes
dEQP-GLES2.functional.shaders.builtin_variable.frontfacing and 4 piglit tests.

Reviewed-by: Vasily Khoruzhick <[email protected]>
Signed-off-by: Andreas Baierl <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7690>

---

 src/gallium/drivers/lima/ci/deqp-lima-fails.txt | 1 -
 src/gallium/drivers/lima/lima_draw.c            | 5 ++++-
 src/gallium/drivers/lima/lima_parser.c          | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/lima/ci/deqp-lima-fails.txt 
b/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
index 215b5807f08..4232bffe760 100644
--- a/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
+++ b/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
@@ -30,7 +30,6 @@ 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.write_mask.stencil,Fail
-dEQP-GLES2.functional.shaders.builtin_variable.frontfacing,Fail
 
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_loop_read_vertex,Fail
 
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_read_vertex,Fail
 
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_static_loop_read_vertex,Fail
diff --git a/src/gallium/drivers/lima/lima_draw.c 
b/src/gallium/drivers/lima/lima_draw.c
index 120148a9e2c..8c706518683 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -721,7 +721,10 @@ lima_pack_render_state(struct lima_context *ctx, const 
struct pipe_draw_info *in
    render->textures_address = 0x00000000;
 
    render->aux0 = (ctx->vs->state.varying_stride >> 3);
-   render->aux1 = 0x00001000;
+   render->aux1 = 0x00000000;
+   if (ctx->rasterizer->base.front_ccw)
+      render->aux1 = 0x00001000;
+
    if (ctx->blend->base.dither)
       render->aux1 |= 0x00002000;
 
diff --git a/src/gallium/drivers/lima/lima_parser.c 
b/src/gallium/drivers/lima/lima_parser.c
index 3f98069be43..89eb26e4606 100644
--- a/src/gallium/drivers/lima/lima_parser.c
+++ b/src/gallium/drivers/lima/lima_parser.c
@@ -641,6 +641,12 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t 
*helper)
       fprintf(fp, ": ");
       if ((*value & 0x00002000) == 0x00002000)
          fprintf(fp, "blend->base.dither true, ");
+
+      if ((*value & 0x00001000) == 0x00001000)
+         fprintf(fp, "glFrontFace(GL_CCW), ");
+      else
+         fprintf(fp, "glFrontFace(GL_CW), ");
+
       if ((*value & 0x00010000) == 0x00010000)
          fprintf(fp, "ctx->const_buffer[PIPE_SHADER_FRAGMENT].buffer true ");
       fprintf(fp, "*/\n");

Reply via email to