Mesa (master): nir/spirv: Force 32-bit for UBO and SSBO Booleans

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 16 03:36:47 UTC 2018


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Tue Nov 13 10:07:31 2018 -0600

nir/spirv: Force 32-bit for UBO and SSBO Booleans

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

---

 src/compiler/spirv/vtn_variables.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 586dcc5b99..e1e2c8c26b 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -623,6 +623,13 @@ _vtn_load_store_tail(struct vtn_builder *b, nir_intrinsic_op op, bool load,
    nir_intrinsic_instr *instr = nir_intrinsic_instr_create(b->nb.shader, op);
    instr->num_components = glsl_get_vector_elements(type);
 
+   /* Booleans usually shouldn't show up in external memory in SPIR-V.
+    * However, they do for certain older GLSLang versions and can for shared
+    * memory when we lower access chains internally.
+    */
+   const unsigned data_bit_size = glsl_type_is_boolean(type) ? 32 :
+                                  glsl_get_bit_size(type);
+
    int src = 0;
    if (!load) {
       nir_intrinsic_set_write_mask(instr, (1 << instr->num_components) - 1);
@@ -654,8 +661,7 @@ _vtn_load_store_tail(struct vtn_builder *b, nir_intrinsic_op op, bool load,
 
    if (load) {
       nir_ssa_dest_init(&instr->instr, &instr->dest,
-                        instr->num_components,
-                        glsl_get_bit_size(type), NULL);
+                        instr->num_components, data_bit_size, NULL);
       (*inout)->def = &instr->dest.ssa;
    }
 




More information about the mesa-commit mailing list