Lines Matching refs:var

38 get_variable_io_mask(nir_variable *var, gl_shader_stage stage)  in get_variable_io_mask()  argument
40 if (var->data.location < 0) in get_variable_io_mask()
43 unsigned location = var->data.patch ? in get_variable_io_mask()
44 var->data.location - VARYING_SLOT_PATCH0 : var->data.location; in get_variable_io_mask()
46 assert(var->data.mode == nir_var_shader_in || in get_variable_io_mask()
47 var->data.mode == nir_var_shader_out || in get_variable_io_mask()
48 var->data.mode == nir_var_system_value); in get_variable_io_mask()
49 assert(var->data.location >= 0); in get_variable_io_mask()
51 const struct glsl_type *type = var->type; in get_variable_io_mask()
52 if (nir_is_per_vertex_io(var, stage)) { in get_variable_io_mask()
74 intrin_instr->variables[0]->var->data.mode == in tcs_add_output_reads()
77 nir_variable *var = intrin_instr->variables[0]->var; in tcs_add_output_reads() local
78 if (var->data.patch) { in tcs_add_output_reads()
79 patches_read[var->data.location_frac] |= in tcs_add_output_reads()
80 get_variable_io_mask(intrin_instr->variables[0]->var, in tcs_add_output_reads()
83 read[var->data.location_frac] |= in tcs_add_output_reads()
84 get_variable_io_mask(intrin_instr->variables[0]->var, in tcs_add_output_reads()
102 nir_foreach_variable_safe(var, var_list) { in remove_unused_io_vars()
103 if (var->data.patch) in remove_unused_io_vars()
108 if (var->data.location < VARYING_SLOT_VAR0 && var->data.location >= 0) in remove_unused_io_vars()
111 if (var->data.always_active_io) in remove_unused_io_vars()
114 uint64_t other_stage = used[var->data.location_frac]; in remove_unused_io_vars()
116 if (!(other_stage & get_variable_io_mask(var, shader->info.stage))) { in remove_unused_io_vars()
118 var->data.location = 0; in remove_unused_io_vars()
119 var->data.mode = nir_var_global; in remove_unused_io_vars()
121 exec_node_remove(&var->node); in remove_unused_io_vars()
122 exec_list_push_tail(&shader->globals, &var->node); in remove_unused_io_vars()
140 nir_foreach_variable(var, &producer->outputs) { in nir_remove_unused_varyings()
141 if (var->data.patch) { in nir_remove_unused_varyings()
142 patches_written[var->data.location_frac] |= in nir_remove_unused_varyings()
143 get_variable_io_mask(var, producer->info.stage); in nir_remove_unused_varyings()
145 written[var->data.location_frac] |= in nir_remove_unused_varyings()
146 get_variable_io_mask(var, producer->info.stage); in nir_remove_unused_varyings()
150 nir_foreach_variable(var, &consumer->inputs) { in nir_remove_unused_varyings()
151 if (var->data.patch) { in nir_remove_unused_varyings()
152 patches_read[var->data.location_frac] |= in nir_remove_unused_varyings()
153 get_variable_io_mask(var, consumer->info.stage); in nir_remove_unused_varyings()
155 read[var->data.location_frac] |= in nir_remove_unused_varyings()
156 get_variable_io_mask(var, consumer->info.stage); in nir_remove_unused_varyings()
178 get_interp_type(nir_variable *var, bool default_to_smooth_interp) in get_interp_type() argument
180 if (var->data.interpolation != INTERP_MODE_NONE) in get_interp_type()
181 return var->data.interpolation; in get_interp_type()
193 get_interp_loc(nir_variable *var) in get_interp_loc() argument
195 if (var->data.sample) in get_interp_loc()
197 else if (var->data.centroid) in get_interp_loc()
211 nir_foreach_variable_safe(var, var_list) { in get_slot_component_masks_and_interp_types()
212 assert(var->data.location >= 0); in get_slot_component_masks_and_interp_types()
217 if (var->data.location >= VARYING_SLOT_VAR0 && in get_slot_component_masks_and_interp_types()
218 var->data.location - VARYING_SLOT_VAR0 < 32) { in get_slot_component_masks_and_interp_types()
220 const struct glsl_type *type = var->type; in get_slot_component_masks_and_interp_types()
221 if (nir_is_per_vertex_io(var, stage)) { in get_slot_component_masks_and_interp_types()
226 unsigned location = var->data.location - VARYING_SLOT_VAR0; in get_slot_component_masks_and_interp_types()
235 get_interp_type(var, default_to_smooth_interp); in get_slot_component_masks_and_interp_types()
236 interp_loc[location + i] = get_interp_loc(var); in get_slot_component_masks_and_interp_types()
242 unsigned num_comps = 4 - var->data.location_frac; in get_slot_component_masks_and_interp_types()
246 assert(var->data.location_frac == 0 || in get_slot_component_masks_and_interp_types()
247 var->data.location_frac == 2); in get_slot_component_masks_and_interp_types()
251 ((1 << num_comps) - 1) << var->data.location_frac; in get_slot_component_masks_and_interp_types()
255 ((1 << elements) - 1) << var->data.location_frac; in get_slot_component_masks_and_interp_types()
279 nir_foreach_variable(var, var_list) { in remap_slots_and_components()
280 assert(var->data.location >= 0); in remap_slots_and_components()
283 if (var->data.location >= VARYING_SLOT_VAR0 && in remap_slots_and_components()
284 var->data.location - VARYING_SLOT_VAR0 < 32) { in remap_slots_and_components()
285 assert(var->data.location - VARYING_SLOT_VAR0 < 32); in remap_slots_and_components()
286 assert(remap[var->data.location - VARYING_SLOT_VAR0] >= 0); in remap_slots_and_components()
288 const struct glsl_type *type = var->type; in remap_slots_and_components()
289 if (nir_is_per_vertex_io(var, stage)) { in remap_slots_and_components()
298 unsigned location = var->data.location - VARYING_SLOT_VAR0; in remap_slots_and_components()
299 struct varying_loc *new_loc = &remap[location][var->data.location_frac]; in remap_slots_and_components()
301 uint64_t slots = (((uint64_t)1 << num_slots) - 1) << var->data.location; in remap_slots_and_components()
309 var->data.location = new_loc->location; in remap_slots_and_components()
310 var->data.location_frac = new_loc->component; in remap_slots_and_components()
313 if (var->data.always_active_io) { in remap_slots_and_components()
321 *slots_used & (((uint64_t)1 << num_slots) - 1) << var->data.location; in remap_slots_and_components()
326 *out_slots_read & (((uint64_t)1 << num_slots) - 1) << var->data.location; in remap_slots_and_components()
332 slots_used_tmp |= (uint64_t)1 << (var->data.location + i); in remap_slots_and_components()
335 out_slots_read_tmp |= (uint64_t)1 << (var->data.location + i); in remap_slots_and_components()
364 nir_foreach_variable(var, input_list) { in compact_components()
369 if (var->data.location >= VARYING_SLOT_VAR0 && in compact_components()
370 var->data.location - VARYING_SLOT_VAR0 < 32) { in compact_components()
373 if (var->data.always_active_io) in compact_components()
376 const struct glsl_type *type = var->type; in compact_components()
377 if (nir_is_per_vertex_io(var, consumer->info.stage)) { in compact_components()
399 unsigned location = var->data.location - VARYING_SLOT_VAR0; in compact_components()
408 uint8_t interp = get_interp_type(var, default_to_smooth_interp); in compact_components()
414 (var->data.location_frac == 0 || in compact_components()
415 cursor_used_comps & ((1 << (var->data.location_frac)) - 1))) in compact_components()
429 if (interp_loc[cursor[interp]] != get_interp_loc(var)) in compact_components()
445 remap[location][var->data.location_frac].component = i; in compact_components()
446 remap[location][var->data.location_frac].location = in compact_components()
452 if (comps[location] & 1 << var->data.location_frac) { in compact_components()
453 comps[location] ^= 1 << var->data.location_frac; in compact_components()