nir: Add access qualifiers on load_ubo intrinsic.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 7 Apr 2019 22:34:14 +0000 (00:34 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 10 Apr 2019 00:04:04 +0000 (02:04 +0200)
Otherwise nir_lower_non_uniform_access crashes when it tries
to get the access of a load_ubo.

Fixes: 8ed583fe523 "spirv: Handle the NonUniformEXT decoration"
Fixes: e50ab2c0f23 "nir: Add access flags to deref and SSBO atomics"
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/compiler/nir/nir_intrinsics.py
src/compiler/spirv/vtn_variables.c

index 9b307b34c75b183ba0f46d0e5b094bbc49d99422..219d1783f5d8d26d0483bd5f2f240c6d4a651d7b 100644 (file)
@@ -618,7 +618,7 @@ def load(name, num_srcs, indices=[], flags=[]):
 # src[] = { offset }. const_index[] = { base, range }
 load("uniform", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
 # src[] = { buffer_index, offset }. const_index[] = { align_mul, align_offset }
-load("ubo", 2, [ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE, CAN_REORDER])
+load("ubo", 2, [ACCESS, ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE, CAN_REORDER])
 # src[] = { offset }. const_index[] = { base, component }
 load("input", 1, [BASE, COMPONENT], [CAN_ELIMINATE, CAN_REORDER])
 # src[] = { vertex, offset }. const_index[] = { base, component }
index 913295673357912f7df530dcd577540650d3b9a1..54d41c2de47e49d7e0985639ecfbccd143b9bd04 100644 (file)
@@ -783,7 +783,8 @@ _vtn_load_store_tail(struct vtn_builder *b, nir_intrinsic_op op, bool load,
       nir_intrinsic_set_range(instr, access_size);
    }
 
-   if (op == nir_intrinsic_load_ssbo ||
+   if (op == nir_intrinsic_load_ubo ||
+       op == nir_intrinsic_load_ssbo ||
        op == nir_intrinsic_store_ssbo) {
       nir_intrinsic_set_access(instr, access);
    }