From 965c2688657016cc313baac8b26de5141d5684c0 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 17 Aug 2020 11:53:47 -0500 Subject: [PATCH] nir/lower_io: Use the variable mode for load_scratch_base_ptr checks Reviewed-by: Eric Anholt Reviewed-by: Jesse Natalie Part-of: --- src/compiler/nir/nir_lower_io.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 1dc2a2d1bfd..ed4daaa3c40 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1185,12 +1185,16 @@ nir_explicit_io_address_from_deref(nir_builder *b, nir_deref_instr *deref, assert(deref->dest.is_ssa); switch (deref->deref_type) { case nir_deref_type_var: - assert(deref->mode & (nir_var_uniform | nir_var_mem_shared | - nir_var_shader_temp | nir_var_function_temp)); + assert(deref->var->data.mode & (nir_var_uniform | + nir_var_mem_shared | + nir_var_shader_temp | + nir_var_function_temp)); if (addr_format_is_global(addr_format)) { - assert(nir_var_shader_temp | nir_var_function_temp); + assert(deref->var->data.mode == nir_var_shader_temp || + deref->var->data.mode == nir_var_function_temp); + bool is_function = deref->var->data.mode == nir_var_function_temp; base_addr = - nir_load_scratch_base_ptr(b, !(deref->mode & nir_var_shader_temp), + nir_load_scratch_base_ptr(b, is_function, nir_address_format_num_components(addr_format), nir_address_format_bit_size(addr_format)); return build_addr_iadd_imm(b, base_addr, addr_format, -- 2.30.2