From: Jason Ekstrand Date: Fri, 6 Nov 2015 22:49:15 +0000 (-0800) Subject: nir/spirv: Add a helper for determining if a block is externally visable X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ba281e794fbc215adfedd44b73a628cdf39a513;p=mesa.git nir/spirv: Add a helper for determining if a block is externally visable --- diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 7c9567dd8b7..fc85c19a7a7 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -1199,6 +1199,14 @@ static nir_ssa_def *vtn_vector_extract_dynamic(struct vtn_builder *b, nir_ssa_def *src, nir_ssa_def *index); +static bool +variable_is_external_block(nir_variable *var) +{ + return var->interface_type && + (var->data.mode == nir_var_uniform || + var->data.mode == nir_var_shader_storage); +} + static struct vtn_ssa_value * vtn_variable_load(struct vtn_builder *b, nir_deref_var *src, struct vtn_type *src_type) @@ -1206,7 +1214,7 @@ vtn_variable_load(struct vtn_builder *b, nir_deref_var *src, nir_deref *src_tail = get_deref_tail(src); struct vtn_ssa_value *val; - if (src->var->interface_type && src->var->data.mode == nir_var_uniform) + if (variable_is_external_block(src->var)) val = vtn_block_load(b, src, src_type, src_tail); else val = _vtn_variable_load(b, src, src_tail); @@ -1549,7 +1557,8 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, * actually access the variable, so we need to keep around the original * type of the variable. */ - if (base->var->interface_type && base->var->data.mode == nir_var_uniform) + + if (variable_is_external_block(base->var)) val->deref_type = vtn_value(b, w[3], vtn_value_type_deref)->deref_type; else val->deref_type = deref_type;