Module: Mesa
Branch: master
Commit: 05ecb6780ca37439bcd567fe1376404b8a378491
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05ecb6780ca37439bcd567fe1376404b8a378491

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Apr  7 12:56:49 2021 -0400

zink: emit WorkgroupSize when not using ExecutionModeLocalSize

the system_values_read bit might not be set if the value isn't read or is
DCE, but it still needs to be emitted

probably.

fixes #4591

Reviewed-by: Witold Baryluk <[email protected]>
Tested-by: Witold Baryluk <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10079>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 8 ++++----
 src/gallium/drivers/zink/zink_program.c              | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c 
b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index a1c446be16f..79ab5d50eb5 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -3645,14 +3645,14 @@ nir_to_spirv(struct nir_shader *s, const struct 
zink_so_info *so_info)
                                            s->info.gs.vertices_out);
       break;
    case MESA_SHADER_COMPUTE:
+      if (s->info.cs.shared_size)
+         create_shared_block(&ctx, s->info.cs.shared_size);
+
       if (s->info.cs.local_size[0] || s->info.cs.local_size[1] || 
s->info.cs.local_size[2])
          spirv_builder_emit_exec_mode_literal3(&ctx.builder, entry_point, 
SpvExecutionModeLocalSize,
                                                
(uint32_t[3]){(uint32_t)s->info.cs.local_size[0], 
(uint32_t)s->info.cs.local_size[1],
                                                
(uint32_t)s->info.cs.local_size[2]});
-      if (s->info.cs.shared_size)
-         create_shared_block(&ctx, s->info.cs.shared_size);
-
-      if (BITSET_TEST(s->info.system_values_read, 
SYSTEM_VALUE_LOCAL_GROUP_SIZE)) {
+      else {
          SpvId sizes[3];
          uint32_t ids[] = {ZINK_WORKGROUP_SIZE_X, ZINK_WORKGROUP_SIZE_Y, 
ZINK_WORKGROUP_SIZE_Z};
          const char *names[] = {"x", "y", "z"};
diff --git a/src/gallium/drivers/zink/zink_program.c 
b/src/gallium/drivers/zink/zink_program.c
index 527d575de76..da368c3316f 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -603,7 +603,9 @@ void
 zink_program_update_compute_pipeline_state(struct zink_context *ctx, struct 
zink_compute_program *comp, const uint block[3])
 {
    struct zink_shader *zs = comp->shader;
-   bool use_local_size = BITSET_TEST(zs->nir->info.system_values_read, 
SYSTEM_VALUE_LOCAL_GROUP_SIZE);
+   bool use_local_size = !(zs->nir->info.cs.local_size[0] ||
+                           zs->nir->info.cs.local_size[1] ||
+                           zs->nir->info.cs.local_size[2]);
    if (ctx->compute_pipeline_state.use_local_size != use_local_size)
       ctx->compute_pipeline_state.dirty = true;
    ctx->compute_pipeline_state.use_local_size = use_local_size;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to