From 282bacab4a80e06d1c7f19bf092952599ac9b5f5 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Mon, 8 Apr 2019 00:34:14 +0200 Subject: [PATCH] nir: Add access qualifiers on load_ubo intrinsic. 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 --- src/compiler/nir/nir_intrinsics.py | 2 +- src/compiler/spirv/vtn_variables.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 9b307b34c75..219d1783f5d 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -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 } diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 91329567335..54d41c2de47 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -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); } -- 2.30.2