Lines Matching defs:nir
31 #include "nir/nir_builder.h"
36 #include "nir/nir_xfb_info.h"
128 set_image_access(struct lvp_pipeline *pipeline, nir_shader *nir,
139 value += get_set_layout(pipeline->layout, s)->stage[nir->info.stage].image_count;
141 value += binding->stage[nir->info.stage].image_index;
146 pipeline->access[nir->info.stage].images_read |= mask;
148 pipeline->access[nir->info.stage].images_written |= mask;
152 set_buffer_access(struct lvp_pipeline *pipeline, nir_shader *nir,
161 var = nir_get_binding_variable(nir, b);
173 value += get_set_layout(pipeline->layout, s)->stage[nir->info.stage].shader_buffer_count;
175 value += binding->stage[nir->info.stage].shader_buffer_index;
179 pipeline->access[nir->info.stage].buffers_written |= mask;
183 scan_intrinsic(struct lvp_pipeline *pipeline, nir_shader *nir, nir_intrinsic_instr *instr)
190 set_image_access(pipeline, nir, instr, true, false);
193 set_image_access(pipeline, nir, instr, false, true);
206 set_image_access(pipeline, nir, instr, true, true);
223 set_buffer_access(pipeline, nir, instr);
230 scan_pipeline_info(struct lvp_pipeline *pipeline, nir_shader *nir)
232 nir_foreach_function(function, nir) {
237 scan_intrinsic(pipeline, nir, nir_instr_as_intrinsic(instr));
262 remove_scoped_barriers(nir_shader *nir, bool is_compute)
264 return nir_shader_instructions_pass(nir, remove_scoped_barriers_impl, nir_metadata_dominance, (void*)is_compute);
285 lower_demote(nir_shader *nir)
287 return nir_shader_instructions_pass(nir, lower_demote_impl, nir_metadata_dominance, NULL);
324 optimize(nir_shader *nir)
330 NIR_PASS(progress, nir, nir_lower_flrp, 32|64, true);
331 NIR_PASS(progress, nir, nir_split_array_vars, nir_var_function_temp);
332 NIR_PASS(progress, nir, nir_shrink_vec_array_vars, nir_var_function_temp);
333 NIR_PASS(progress, nir, nir_opt_deref);
334 NIR_PASS(progress, nir, nir_lower_vars_to_ssa);
336 NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
338 NIR_PASS(progress, nir, nir_copy_prop);
339 NIR_PASS(progress, nir, nir_opt_dce);
340 NIR_PASS(progress, nir, nir_opt_peephole_select, 8, true, true);
342 NIR_PASS(progress, nir, nir_opt_algebraic);
343 NIR_PASS(progress, nir, nir_opt_constant_folding);
345 NIR_PASS(progress, nir, nir_opt_remove_phis);
347 NIR_PASS(trivial_continues, nir, nir_opt_trivial_continues);
354 NIR_PASS(progress, nir, nir_copy_prop);
355 NIR_PASS(progress, nir, nir_opt_dce);
356 NIR_PASS(progress, nir, nir_opt_remove_phis);
358 NIR_PASS(progress, nir, nir_opt_if, nir_opt_if_aggressive_last_continue | nir_opt_if_optimize_phi_true_false);
359 NIR_PASS(progress, nir, nir_opt_dead_cf);
360 NIR_PASS(progress, nir, nir_opt_conditional_discard);
361 NIR_PASS(progress, nir, nir_opt_remove_phis);
362 NIR_PASS(progress, nir, nir_opt_cse);
363 NIR_PASS(progress, nir, nir_opt_undef);
365 NIR_PASS(progress, nir, nir_opt_deref);
366 NIR_PASS(progress, nir, nir_lower_alu_to_scalar, NULL, NULL);
367 NIR_PASS(progress, nir, nir_opt_loop_unroll);
368 NIR_PASS(progress, nir, lvp_nir_fixup_indirect_tex);
373 lvp_shader_optimize(nir_shader *nir)
375 optimize(nir);
376 NIR_PASS_V(nir, nir_lower_var_copies);
377 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
378 NIR_PASS_V(nir, nir_opt_dce);
379 nir_sweep(nir);
390 nir_shader *nir;
440 NULL, &nir);
444 if (nir->info.stage != MESA_SHADER_TESS_CTRL)
445 NIR_PASS_V(nir, remove_scoped_barriers, nir->info.stage == MESA_SHADER_COMPUTE);
451 NIR_PASS_V(nir, nir_lower_sysvals_to_varyings, &sysvals_to_varyings);
457 NIR_PASS_V(nir, nir_lower_subgroups, &subgroup_opts);
460 lvp_lower_input_attachments(nir, false);
461 NIR_PASS_V(nir, nir_lower_is_helper_invocation);
462 NIR_PASS_V(nir, lower_demote);
463 NIR_PASS_V(nir, nir_lower_system_values);
464 NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
466 NIR_PASS_V(nir, nir_remove_dead_variables,
469 scan_pipeline_info(pipeline, nir);
471 optimize(nir);
472 lvp_lower_pipeline_layout(pipeline->device, pipeline->layout, nir);
474 NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, true);
475 NIR_PASS_V(nir, nir_split_var_copies);
476 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
478 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_push_const,
481 NIR_PASS_V(nir, nir_lower_explicit_io,
485 NIR_PASS_V(nir, nir_lower_explicit_io,
489 if (nir->info.stage == MESA_SHADER_COMPUTE) {
490 NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, nir_var_mem_shared, shared_var_info);
491 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_shared, nir_address_format_32bit_offset);
494 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_shader_temp, NULL);
496 if (nir->info.stage == MESA_SHADER_VERTEX ||
497 nir->info.stage == MESA_SHADER_GEOMETRY) {
498 NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
499 } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
500 NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, true);
509 NIR_PASS_V(nir, nir_fold_16bit_tex_image, &fold_16bit_options);
511 lvp_shader_optimize(nir);
513 nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
515 if (nir->info.stage != MESA_SHADER_VERTEX)
516 nir_assign_io_var_locations(nir, nir_var_shader_in, &nir->num_inputs, nir->info.stage);
518 nir->num_inputs = util_last_bit64(nir->info.inputs_read);
519 nir_foreach_shader_in_variable(var, nir) {
523 nir_assign_io_var_locations(nir, nir_var_shader_out, &nir->num_outputs,
524 nir->info.stage);
526 nir_function_impl *impl = nir_shader_get_entrypoint(nir);
528 pipeline->inlines[stage].must_inline = lvp_find_inlinable_uniforms(pipeline, nir);
529 pipeline->pipeline_nir[stage] = nir;
614 lvp_pipeline_compile_stage(struct lvp_pipeline *pipeline, nir_shader *nir)
617 if (nir->info.stage == MESA_SHADER_COMPUTE) {
619 shstate.prog = nir;
621 shstate.req_local_mem = nir->info.shared_size;
626 shstate.ir.nir = nir;
627 if (nir->info.stage == pipeline->last_vertex)
630 switch (nir->info.stage) {
650 lvp_pipeline_compile(struct lvp_pipeline *pipeline, nir_shader *nir)
653 device->physical_device->pscreen->finalize_nir(device->physical_device->pscreen, nir);
654 return lvp_pipeline_compile_stage(pipeline, nir);
903 shstate.ir.nir = nir_shader_clone(NULL, pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]);