}
}
+static void
+record_images_used(struct shader_info *info,
+ nir_deref_instr *deref)
+{
+ nir_variable *var = nir_deref_instr_get_variable(deref);
+
+ /* Structs have been lowered already, so get_aoa_size is sufficient. */
+ const unsigned size =
+ glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1;
+ unsigned mask = ((1ull << MAX2(size, 1)) - 1) << var->data.binding;
+
+ info->images_used |= mask;
+}
+
+
static nir_deref_instr *
lower_deref(nir_builder *b, struct lower_samplers_as_deref_state *state,
nir_deref_instr *deref)
b->cursor = nir_before_instr(&instr->instr);
nir_deref_instr *deref =
lower_deref(b, state, nir_src_as_deref(instr->src[0]));
+
+ record_images_used(&state->shader->info, deref);
+
/* don't lower bindless: */
if (!deref)
return false;
/** Bitfield of which textures are used by texelFetch() */
uint32_t textures_used_by_txf;
+ /** Bitfield of which images are used */
+ uint32_t images_used;
+
/* SPV_KHR_float_controls: execution mode for floating point ops */
uint16_t float_controls_execution_mode;