Mesa (main): mesa,glsl,ttn: Set subgroup_size to UNIFORM

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 8 23:15:40 UTC 2022


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

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Thu Jul  7 14:13:54 2022 -0500

mesa,glsl,ttn: Set subgroup_size to UNIFORM

Reviewed-by: Caio Oliveira <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337>

---

 src/compiler/glsl/glsl_to_nir.cpp       | 2 ++
 src/compiler/shader_enums.h             | 6 ++++++
 src/gallium/auxiliary/nir/tgsi_to_nir.c | 2 ++
 src/mesa/main/glspirv.c                 | 1 +
 4 files changed, 11 insertions(+)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 985dce85847..983d89f19b8 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -253,6 +253,8 @@ glsl_to_nir(const struct gl_constants *consts,
    if (shader_prog->Label)
       shader->info.label = ralloc_strdup(shader, shader_prog->Label);
 
+   shader->info.subgroup_size = SUBGROUP_SIZE_UNIFORM;
+
    if (shader->info.stage == MESA_SHADER_FRAGMENT) {
       shader->info.fs.pixel_center_integer = sh->Program->info.fs.pixel_center_integer;
       shader->info.fs.origin_upper_left = sh->Program->info.fs.origin_upper_left;
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index 3edaa96ecf9..8d18a882f7c 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -1223,6 +1223,12 @@ enum PACKED gl_subgroup_size
    /** Actual subgroup size, whatever that happens to be */
    SUBGROUP_SIZE_VARYING = 0,
 
+   /** Subgroup size must appear to be draw or dispatch-uniform
+    *
+    * This is the OpenGL behavior
+    */
+   SUBGROUP_SIZE_UNIFORM,
+
    /** Subgroup size must appear to be the API advertised constant
     *
     * This is the default Vulkan 1.1 behavior
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index a55f4604541..afc56768990 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2323,6 +2323,8 @@ ttn_compile_init(const void *tgsi_tokens,
       c->cap_face_is_sysval = true;
    }
 
+   s->info.subgroup_size = SUBGROUP_SIZE_UNIFORM;
+
    if (s->info.stage == MESA_SHADER_FRAGMENT)
       s->info.fs.untyped_color_outputs = true;
 
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index 8e1282c7a0b..126f53d1cfb 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c
@@ -244,6 +244,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
    const struct spirv_to_nir_options spirv_options = {
       .environment = NIR_SPIRV_OPENGL,
       .use_deref_buffer_array_length = true,
+      .subgroup_size = SUBGROUP_SIZE_UNIFORM,
       .caps = ctx->Const.SpirVCapabilities,
       .ubo_addr_format = nir_address_format_32bit_index_offset,
       .ssbo_addr_format = nir_address_format_32bit_index_offset,



More information about the mesa-commit mailing list