Mesa (staging/22.0): mesa/st: add special casing for pointsize constant updating during validate

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 06:28:26 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 4062cbbdd05685218ad696a413e12aaaee25425a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4062cbbdd05685218ad696a413e12aaaee25425a

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Mar 24 21:45:32 2022 -0400

mesa/st: add special casing for pointsize constant updating during validate

the previous method of using affected_states to trigger constant updates
was ineffectual in the scenario where a ubo pointsize was needed on
the first time a non-precompiled shader was used after being the not-last
vertex stage:

* have vs+gs -> gs precompiles with pointsize lowering -> gs constants get updated
* remove gs -> vs was precompiled without pointsize lowering -> vs constants broken

now just do a quick check as in st_atom_shader.c and set the flag manually to
ensure the update is done correctly every time

cc: mesa-stable

fixes #6207

fixes (radv):
KHR-GL46.texture_cube_map_array.image_op_fragment_sh
KHR-GL46.texture_cube_map_array.sampling
KHR-GL46.texture_cube_map_array.texture_size_fragment_sh
KHR-GL46.constant_expressions*

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15570>
(cherry picked from commit eaf3c72a8371a0a83261b1b1e1b0d68147314a99)

Conflicts:
	src/gallium/drivers/zink/ci/zink-radv-fails.txt
	src/mesa/state_tracker/st_program.c

---

 .pick_status.json                   |  2 +-
 src/mesa/state_tracker/st_atom.c    | 24 ++++++++++++++++++++++++
 src/mesa/state_tracker/st_program.c | 15 ---------------
 3 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a6f877c2cc2..59c42d2f199 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -8356,7 +8356,7 @@
         "description": "mesa/st: add special casing for pointsize constant updating during validate",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": null
     },
     {
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index ee6e47b9793..0b7b5ffd4dd 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -178,6 +178,18 @@ static void check_attrib_edgeflag(struct st_context *st)
    st_update_edgeflags(st, _mesa_draw_edge_flag_array_enabled(st->ctx));
 }
 
+static void check_pointsize(struct st_context *st)
+{
+   if (st->ctx->VertexProgram.PointSizeEnabled)
+      return;
+   if (st->ctx->GeometryProgram._Current)
+      st->dirty |= ST_NEW_GS_CONSTANTS;
+   else if (st->ctx->TessEvalProgram._Current)
+      st->dirty |= ST_NEW_TES_CONSTANTS;
+   else
+      st->dirty |= ST_NEW_VS_CONSTANTS;
+}
+
 
 /***********************************************************************
  * Update all derived state:
@@ -207,6 +219,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
          check_program_state(st);
          st->gfx_shaders_may_be_dirty = false;
       }
+      if (st->lower_point_size &&
+          (st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
+         check_pointsize(st);
 
       st_manager_validate_framebuffers(st);
 
@@ -217,6 +232,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
       break;
 
    case ST_PIPELINE_CLEAR:
+      if (st->lower_point_size &&
+          (st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
+         check_pointsize(st);
       st_manager_validate_framebuffers(st);
       pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK;
       break;
@@ -226,12 +244,18 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
          check_program_state(st);
          st->gfx_shaders_may_be_dirty = false;
       }
+      if (st->lower_point_size &&
+          (st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
+         check_pointsize(st);
 
       st_manager_validate_framebuffers(st);
       pipeline_mask = ST_PIPELINE_META_STATE_MASK;
       break;
 
    case ST_PIPELINE_UPDATE_FRAMEBUFFER:
+      if (st->lower_point_size &&
+          (st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
+         check_pointsize(st);
       st_manager_validate_framebuffers(st);
       pipeline_mask = ST_PIPELINE_UPDATE_FB_STATE_MASK;
       break;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index d3985a44c71..8f802b2a09d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -798,21 +798,6 @@ st_create_common_variant(struct st_context *st,
             _mesa_add_state_reference(params, point_size_state);
             NIR_PASS_V(state.ir.nir, nir_lower_point_size_mov,
                        point_size_state);
-
-            switch (prog->info.stage) {
-            case MESA_SHADER_VERTEX:
-               prog->affected_states |= ST_NEW_VS_CONSTANTS;
-               break;
-            case MESA_SHADER_TESS_EVAL:
-               prog->affected_states |= ST_NEW_TES_CONSTANTS;
-               break;
-            case MESA_SHADER_GEOMETRY:
-               prog->affected_states |= ST_NEW_GS_CONSTANTS;
-               break;
-            default:
-               unreachable("bad shader stage");
-            }
-
             finalize = true;
          }
       }



More information about the mesa-commit mailing list