Mesa (master): nir/validate: Allow 32-bit boolean load/store intrinsics

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 01:50:35 UTC 2019


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sat Mar  9 15:05:25 2019 -0600

nir/validate: Allow 32-bit boolean load/store intrinsics

With UBOs and SSBOs we have boolean types but they're actually 32-bit
values.  Make the validator a little less strict so that we can do a
32-bit load/store on boolean types.  We're about to add a lowering pass
called gl_nir_lower_buffers which will lower boolean load/store
operations to 32-bit and insert i2b and b2i instructions to convert
to/from 1-bit booleans.  We want that to be legal.

Reviewed-by: Kristian H. Kristensen <hoegsberg at chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>

---

 src/compiler/nir/nir_validate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index febb0a55f6d..3a3c232d370 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -525,6 +525,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
       validate_assert(state, instr->num_components ==
                              glsl_get_vector_elements(src->type));
       dest_bit_size = glsl_get_bit_size(src->type);
+      /* Also allow 32-bit boolean load operations */
+      if (glsl_type_is_boolean(src->type))
+         dest_bit_size |= 32;
       break;
    }
 
@@ -534,6 +537,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
       validate_assert(state, instr->num_components ==
                              glsl_get_vector_elements(dst->type));
       src_bit_sizes[1] = glsl_get_bit_size(dst->type);
+      /* Also allow 32-bit boolean store operations */
+      if (glsl_type_is_boolean(dst->type))
+         src_bit_sizes[1] |= 32;
       validate_assert(state, (dst->mode & (nir_var_shader_in |
                                            nir_var_uniform)) == 0);
       validate_assert(state, (nir_intrinsic_write_mask(instr) & ~((1 << instr->num_components) - 1)) == 0);




More information about the mesa-commit mailing list