info->tcs.outputs_written |= (mask << param);
}
-static void get_deref_offset(nir_deref_var *deref, unsigned *const_out)
-{
- nir_deref *tail = &deref->deref;
- unsigned const_offset = 0;
-
- if (deref->var->data.compact) {
- assert(tail->child->deref_type == nir_deref_type_array);
- assert(glsl_type_is_scalar(glsl_without_array(deref->var->type)));
-
- nir_deref_array *deref_array = nir_deref_as_array(tail->child);
- /* We always lower indirect dereferences for "compact" array vars. */
- assert(deref_array->deref_array_type == nir_deref_array_type_direct);
-
- *const_out = deref_array->base_offset;
- return;
- }
-
- while (tail->child != NULL) {
- const struct glsl_type *parent_type = tail->type;
- tail = tail->child;
-
- if (tail->deref_type == nir_deref_type_array) {
- nir_deref_array *deref_array = nir_deref_as_array(tail);
- unsigned size = glsl_count_attribute_slots(tail->type, false);
-
- const_offset += size * deref_array->base_offset;
- } else if (tail->deref_type == nir_deref_type_struct) {
- nir_deref_struct *deref_struct = nir_deref_as_struct(tail);
-
- for (unsigned i = 0; i < deref_struct->index; i++) {
- const struct glsl_type *ft = glsl_get_struct_field(parent_type, i);
- const_offset += glsl_count_attribute_slots(ft, false);
- }
- } else
- unreachable("unsupported deref type");
- }
-
- *const_out = const_offset;
-}
-
static void
-get_deref_instr_offset(nir_deref_instr *instr,
- unsigned *const_out)
+get_deref_offset(nir_deref_instr *instr,
+ unsigned *const_out)
{
nir_variable *var = nir_deref_instr_get_variable(instr);
nir_deref_path path;
}
static void
-gather_intrinsic_load_var_info(const nir_shader *nir,
+gather_intrinsic_load_deref_info(const nir_shader *nir,
const nir_intrinsic_instr *instr,
struct radv_shader_info *info)
{
switch (nir->info.stage) {
case MESA_SHADER_VERTEX: {
- nir_variable *var = instr->intrinsic == nir_intrinsic_load_var ? instr->variables[0]->var :
- nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
+ nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
if (var->data.mode == nir_var_shader_in) {
unsigned idx = var->data.location;
}
static void
-gather_intrinsic_store_var_info(const nir_shader *nir,
+gather_intrinsic_store_deref_info(const nir_shader *nir,
const nir_intrinsic_instr *instr,
struct radv_shader_info *info)
{
- nir_variable *var = instr->intrinsic == nir_intrinsic_store_var ? instr->variables[0]->var :
- nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
+ nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
if (var->data.mode == nir_var_shader_out) {
unsigned attrib_count = glsl_count_attribute_slots(var->type, false);
unsigned comp = var->data.location_frac;
unsigned const_offset = 0;
- if (instr->intrinsic == nir_intrinsic_store_var)
- get_deref_offset(instr->variables[0], &const_offset);
- else
- get_deref_instr_offset(nir_instr_as_deref(instr->src[0].ssa->parent_instr), &const_offset);
+ get_deref_offset(nir_instr_as_deref(instr->src[0].ssa->parent_instr), &const_offset);
switch (nir->info.stage) {
case MESA_SHADER_VERTEX:
struct radv_shader_info *info)
{
switch (instr->intrinsic) {
- case nir_intrinsic_interp_var_at_sample:
case nir_intrinsic_interp_deref_at_sample:
info->ps.needs_sample_positions = true;
break;
case nir_intrinsic_vulkan_resource_index:
info->desc_set_used_mask |= (1 << nir_intrinsic_desc_set(instr));
break;
- case nir_intrinsic_image_var_load:
- case nir_intrinsic_image_var_store:
- case nir_intrinsic_image_var_atomic_add:
- case nir_intrinsic_image_var_atomic_min:
- case nir_intrinsic_image_var_atomic_max:
- case nir_intrinsic_image_var_atomic_and:
- case nir_intrinsic_image_var_atomic_or:
- case nir_intrinsic_image_var_atomic_xor:
- case nir_intrinsic_image_var_atomic_exchange:
- case nir_intrinsic_image_var_atomic_comp_swap:
- case nir_intrinsic_image_var_size: {
- const struct glsl_type *type = glsl_without_array(instr->variables[0]->var->type);
-
- enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
- if (dim == GLSL_SAMPLER_DIM_SUBPASS ||
- dim == GLSL_SAMPLER_DIM_SUBPASS_MS) {
- info->ps.layer_input = true;
- info->ps.uses_input_attachments = true;
- }
- mark_sampler_desc(instr->variables[0]->var, info);
-
- if (nir_intrinsic_image_var_store ||
- nir_intrinsic_image_var_atomic_add ||
- nir_intrinsic_image_var_atomic_min ||
- nir_intrinsic_image_var_atomic_max ||
- nir_intrinsic_image_var_atomic_and ||
- nir_intrinsic_image_var_atomic_or ||
- nir_intrinsic_image_var_atomic_xor ||
- nir_intrinsic_image_var_atomic_exchange ||
- nir_intrinsic_image_var_atomic_comp_swap) {
- if (nir->info.stage == MESA_SHADER_FRAGMENT)
- info->ps.writes_memory = true;
- }
- break;
- }
case nir_intrinsic_image_deref_load:
case nir_intrinsic_image_deref_store:
case nir_intrinsic_image_deref_atomic_add:
if (nir->info.stage == MESA_SHADER_FRAGMENT)
info->ps.writes_memory = true;
break;
- case nir_intrinsic_load_var:
case nir_intrinsic_load_deref:
- gather_intrinsic_load_var_info(nir, instr, info);
+ gather_intrinsic_load_deref_info(nir, instr, info);
break;
- case nir_intrinsic_store_var:
case nir_intrinsic_store_deref:
- gather_intrinsic_store_var_info(nir, instr, info);
+ gather_intrinsic_store_deref_info(nir, instr, info);
break;
default:
break;
break;
}
}
-
- if (instr->sampler)
- mark_sampler_desc(instr->sampler->var, info);
- if (instr->texture)
- mark_sampler_desc(instr->texture->var, info);
}
static void