nir/lower_io: Use the variable mode for load_scratch_base_ptr checks

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379>
This commit is contained in:
Jason Ekstrand 2020-08-17 11:53:47 -05:00 committed by Marge Bot
parent ff124e3fe3
commit 965c268865
1 changed files with 8 additions and 4 deletions

View File

@ -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,