mesa/src/compiler/nir
Rhys Perry 1e00748a53 nir/fold_16bit_tex_image: skip tex instructions with backend1
This will be used for RADV/ACO in the future, and I don't want to and
don't have to deal with 16-bit.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22636>
2023-05-25 16:29:16 +00:00
..
tests nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
meson.build nir: Add pass to lower image atomics 2023-05-22 14:33:13 +00:00
nir.c nir: Drop stale comments 2023-05-24 17:30:03 +00:00
nir.h nir: Add pass to lower image atomics 2023-05-22 14:33:13 +00:00
nir_algebraic.py nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_builder.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_builder.h nir: add nir_fsub_imm 2023-05-25 06:59:25 +00:00
nir_builder_opcodes_h.py nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_builtin_builder.c nir: use more nir_fmul_imm 2023-05-25 06:59:24 +00:00
nir_builtin_builder.h nir: make nir_fisnan helper exact 2023-04-10 17:42:24 +00:00
nir_clone.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_constant_expressions.h
nir_constant_expressions.py nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_control_flow.c nir: Use nir_foreach_phi(_safe) 2023-05-12 14:02:23 +00:00
nir_control_flow.h nir: create nir_push_continue() and related helpers 2023-02-21 10:41:11 +00:00
nir_control_flow_private.h
nir_conversion_builder.h nir: Use nir_type_convert instead of nir_type_conversion_op 2022-12-14 06:23:21 +00:00
nir_convert_ycbcr.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_deref.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_deref.h
nir_divergence_analysis.c nir: Add image_texel_address intrinsics 2023-05-22 14:33:13 +00:00
nir_dominance.c
nir_format_convert.h nir: use more nir_fadd_imm 2023-05-25 06:59:24 +00:00
nir_from_ssa.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_gather_info.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_gather_ssa_types.c
nir_gather_xfb_info.c nir: remove an obsolete comment from nir_gather_xfb_info_from_intrinsics 2023-04-19 21:42:11 +00:00
nir_group_loads.c nir: add image fragment mask load intrinsic 2022-12-19 09:22:11 +08:00
nir_gs_count_vertices.c
nir_inline_functions.c nir/inline_functions: Handle halting functions. 2021-08-13 21:18:13 +00:00
nir_inline_helpers.h
nir_inline_uniforms.c nir/inline_uniforms: Handle num_components > 1 2023-05-15 14:15:02 +00:00
nir_instr_set.c nir: Do not consider phis with incompatible dests equal 2022-12-11 22:13:32 +00:00
nir_instr_set.h nir: use a single set during CSE 2021-06-15 17:57:07 +00:00
nir_intrinsics.py nir: Add image_texel_address intrinsics 2023-05-22 14:33:13 +00:00
nir_intrinsics_c.py python: drop explicit output_encoding='utf-8' in mako templates 2021-08-14 21:44:32 +00:00
nir_intrinsics_h.py python: drop explicit output_encoding='utf-8' in mako templates 2021-08-14 21:44:32 +00:00
nir_intrinsics_indices_h.py nir: add transform feedback info into nir_intrinsic_store_output 2022-03-01 21:59:55 +00:00
nir_linking_helpers.c nir: fix nir_link_varying_precision 2022-12-06 02:00:36 +00:00
nir_liveness.c nir: Use nir_foreach_phi(_safe) 2023-05-12 14:02:23 +00:00
nir_loop_analyze.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_loop_analyze.h nir: update nir_is_supported_terminator_condition() 2022-09-08 01:01:14 +00:00
nir_lower_alpha_test.c nir/lower_alpha_test: rzalloc state slots 2023-04-18 22:40:16 +00:00
nir_lower_alu.c nir: Use nir_type_convert instead of nir_type_conversion_op 2022-12-14 06:23:21 +00:00
nir_lower_alu_width.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_amul.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_array_deref_of_vec.c
nir_lower_atomics_to_ssbo.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_bit_size.c nir: Assert that we don't shrink bit-sizes in nir_lower_bit_size() 2023-05-19 22:44:37 +00:00
nir_lower_bitmap.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_blend.c nir/lower_blend: Enable per-sample shading 2023-04-11 04:16:32 +00:00
nir_lower_blend.h nir/lower_blend: Consume dual stores 2023-02-26 17:35:08 -05:00
nir_lower_bool_to_bitsize.c nir: Remove 2nd argument from nir_before_src 2023-04-07 23:48:03 +00:00
nir_lower_bool_to_float.c nir: Eliminate nir_op_f2b 2023-02-03 22:39:57 +00:00
nir_lower_bool_to_int32.c nir: Eliminate nir_op_f2b 2023-02-03 22:39:57 +00:00
nir_lower_cl_images.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_clamp_color_outputs.c nir: use nir_shader_instructions_pass in nir_lower_clamp_color_outputs 2022-09-26 11:13:03 +00:00
nir_lower_clip.c nir/lower_clip: Only emit 1 discard 2023-02-06 02:50:20 +00:00
nir_lower_clip_cull_distance_arrays.c nir: handle per-view clip/cull distances 2022-01-11 22:45:23 +00:00
nir_lower_clip_disable.c nir: use nir_shader_instructions_pass in nir_lower_clip_disable 2022-09-26 11:13:03 +00:00
nir_lower_clip_halfz.c nir: use nir_shader_instructions_pass in nir_lower_clip_halfz 2022-09-26 11:13:03 +00:00
nir_lower_const_arrays_to_uniforms.c nir: Add an options parameter to deref_instr_has_complex_use 2022-06-24 19:21:26 +00:00
nir_lower_continue_constructs.c nir/lower_continue_targets: only repair SSA when necessary 2023-02-21 10:41:11 +00:00
nir_lower_convert_alu_types.c
nir_lower_discard_if.c nir: Make nir_lower_discard_if() handle demotes and terminates, too. 2022-08-31 18:26:19 +00:00
nir_lower_discard_or_demote.c nir/lower_discard_or_demote: Fix metadata 2021-10-08 23:24:49 +00:00
nir_lower_double_ops.c nir: use more nir_ffma_imm variants 2023-05-25 06:59:25 +00:00
nir_lower_drawpixels.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_fb_read.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_flatshade.c
nir_lower_flrp.c util/vector: make util_vector_init harder to misuse 2021-10-08 00:15:11 +00:00
nir_lower_fp16_conv.c nir/lower_fp16_casts: Fix SSA dominance 2023-05-07 09:57:29 +00:00
nir_lower_fragcolor.c nir/lower_fragcolor: Avoid redundant load_output 2021-06-09 02:58:08 +00:00
nir_lower_fragcoord_wtrans.c nir_lower_fragcoord_wtrans: Support Vulkan shaders 2023-01-10 04:25:26 +00:00
nir_lower_frexp.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_lower_global_vars_to_local.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_lower_goto_ifs.c
nir_lower_gs_intrinsics.c nir: use nir_metadata_none instead of its value 2022-09-26 11:13:03 +00:00
nir_lower_helper_writes.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_idiv.c nir/builder: Add rounding mode parameter to nir_type_convert 2022-12-14 06:23:21 +00:00
nir_lower_image.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_image_atomics_to_global.c nir: Add pass to lower image atomics 2023-05-22 14:33:13 +00:00
nir_lower_indirect_derefs.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_input_attachments.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_int64.c nir: Add find_lsb lowering to nir_lower_int64. 2023-05-19 22:44:37 +00:00
nir_lower_int_to_float.c nir/lower_int_to_float: Add support for i32csel opcodes 2023-01-12 23:01:05 +00:00
nir_lower_interpolation.c nir: use nir_shader_instructions_pass in nir_lower_interpolation 2022-09-26 11:13:03 +00:00
nir_lower_io.c nir/lower_io: don't renumber VS inputs when not called from a linker 2023-05-18 07:03:47 +00:00
nir_lower_io_arrays_to_elements.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_io_to_scalar.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_io_to_temporaries.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_io_to_vector.c nir/lower_io_to_vector: initialize base 2023-05-04 03:44:00 +00:00
nir_lower_is_helper_invocation.c nir/nir_lower_is_helper_invocation: Lower helper invocation if required 2022-12-20 11:06:52 +00:00
nir_lower_load_const_to_scalar.c
nir_lower_locals_to_regs.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_mediump.c nir/fold_16bit_tex_image: skip tex instructions with backend1 2023-05-25 16:29:16 +00:00
nir_lower_mem_access_bit_sizes.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_memcpy.c nir/builder: Drop nir_i2i and nir_u2u in favor of nir_x2xN 2022-12-01 01:10:12 +00:00
nir_lower_memory_model.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_multiview.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_non_uniform_access.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_lower_packing.c nir: intel/compiler: Add and use nir_op_pack_32_4x8_split 2021-08-18 22:03:37 +00:00
nir_lower_passthrough_edgeflags.c nir: Add helpers for lazy var creation. 2023-05-16 18:57:28 +00:00
nir_lower_patch_vertices.c nir: remove nir_state_slot::swizzle 2023-04-26 05:51:39 +00:00
nir_lower_phis_to_scalar.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_pntc_ytransform.c nir: remove nir_state_slot::swizzle 2023-04-26 05:51:39 +00:00
nir_lower_point_size.c nir/lower_point_size: Use shader_instructions_pass 2023-03-11 16:42:36 +00:00
nir_lower_point_size_mov.c nir: Add helpers for lazy var creation. 2023-05-16 18:57:28 +00:00
nir_lower_point_smooth.c nir: handle output beeing written to deref in nir_lower_point_smooth 2023-03-09 04:38:24 +00:00
nir_lower_poly_line_smooth.c nir: lower smooth lines conditionally using the new intrinsic 2023-05-22 07:58:34 +00:00
nir_lower_printf.c nir/lower_printf: Produce unified atomic 2023-05-16 22:36:21 +00:00
nir_lower_readonly_images_to_tex.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_regs_to_ssa.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_returns.c nir: add assertions that loops don't have a Continue Construct 2023-02-21 10:41:11 +00:00
nir_lower_samplers.c nir: use nir_shader_instructions_pass in nir_lower_samplers 2022-09-26 11:13:03 +00:00
nir_lower_scratch.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_lower_shader_calls.c nir/lower_shader_calls: Remat derefs earlier 2023-05-16 18:24:17 +00:00
nir_lower_single_sampled.c nir: Add a pass for lowering shaders to single-sampled 2022-07-13 20:28:42 +00:00
nir_lower_ssbo.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_subgroups.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_system_values.c nir: Drop unused argument from nir_ssa_dest_init_for_type 2023-05-17 23:46:16 +00:00
nir_lower_sysvals_to_varyings.c nir: Add a nir_sysvals_to_varyings() helper 2021-10-07 19:45:35 +00:00
nir_lower_task_shader.c nir/lower_task_shader: Drop legacy atomics 2023-05-16 22:36:21 +00:00
nir_lower_tex.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_tex_shadow.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_texcoord_replace.c nir: use nir_fsub_imm 2023-05-25 06:59:25 +00:00
nir_lower_texcoord_replace_late.c nir: Add a late texcoord replacement pass 2023-02-03 15:03:06 +00:00
nir_lower_to_source_mods.c nir/nir_lower_to_source_mods: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:37 +00:00
nir_lower_two_sided_color.c nir: Add helpers for lazy var creation. 2023-05-16 18:57:28 +00:00
nir_lower_ubo_vec4.c nir: Use nir_test_mask instead of i2b(iand) 2022-06-30 18:00:32 +00:00
nir_lower_undef_to_zero.c
nir_lower_uniforms_to_ubo.c nir/nir_lower_uniforms_to_ubo: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:37 +00:00
nir_lower_var_copies.c nir/nir_lower_var_copies: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:37 +00:00
nir_lower_variable_initializers.c nir/lower_variable_initializers: implement non-scoped barrier path 2022-08-31 07:25:00 +02:00
nir_lower_vars_to_ssa.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_lower_vec3_to_vec4.c nir/nir_lower_vec3_to_vec4: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:37 +00:00
nir_lower_vec_to_movs.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_lower_viewport_transform.c nir/nir_lower_viewport_transform: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:36 +00:00
nir_lower_wpos_center.c nir/nir_lower_wpos_center: Use the nir_shader_instructions_pass() helper 2023-04-22 23:35:36 +00:00
nir_lower_wpos_ytransform.c nir: remove nir_state_slot::swizzle 2023-04-26 05:51:39 +00:00
nir_lower_wrmasks.c
nir_metadata.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_mod_analysis.c nir: add nir_mod_analysis & its tests 2023-01-31 13:50:08 +00:00
nir_move_vec_src_uses_to_dest.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_normalize_cubemap_coords.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_opcodes.py nir: Make ALU descriptions machine-readable 2023-05-12 12:11:38 +00:00
nir_opcodes_c.py nir: Eliminate nir_op_f2b 2023-02-03 22:39:57 +00:00
nir_opcodes_h.py python: drop python2 support 2021-08-14 21:44:32 +00:00
nir_opt_access.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_opt_algebraic.py nir/algebraic: Undistribute fsat from fmax 2023-03-29 23:48:19 +00:00
nir_opt_barriers.c nir/opt_barriers: Add a default callback 2023-05-24 17:30:03 +00:00
nir_opt_combine_stores.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_opt_comparison_pre.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_opt_conditional_discard.c nir: Use nir_foreach_phi(_safe) 2023-05-12 14:02:23 +00:00
nir_opt_constant_folding.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_opt_copy_prop_vars.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_opt_copy_propagate.c nir: Use nir_src_rewrite_ssa 2023-04-07 23:48:03 +00:00
nir_opt_cse.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_opt_dce.c nir: add assertions that loops don't have a Continue Construct 2023-02-21 10:41:11 +00:00
nir_opt_dead_cf.c nir: Use nir_foreach_phi(_safe) 2023-05-12 14:02:23 +00:00
nir_opt_dead_write_vars.c nir: Add lowered vendor independent raytracing intrinsics. 2021-06-21 21:23:51 +00:00
nir_opt_find_array_copies.c
nir_opt_fragdepth.c nir: extend nir_opt_fragdepth to handle lowered IO 2023-04-19 21:42:11 +00:00
nir_opt_gcm.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_opt_idiv_const.c nir/builder: Rework the boolean conversion helpers 2022-12-01 01:10:12 +00:00
nir_opt_if.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_opt_intrinsics.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_opt_large_constants.c nir: Add an options parameter to deref_instr_has_complex_use 2022-06-24 19:21:26 +00:00
nir_opt_load_store_vectorize.c nir/opt_load_store_vectorize: Reclaim ATOMIC 2023-05-16 22:36:22 +00:00
nir_opt_loop_unroll.c nir/opt_loop_unroll: Avoid list_length 2023-04-07 23:48:03 +00:00
nir_opt_memcpy.c nir/opt_memcpy: Add another case for function_temp 2022-06-24 19:21:26 +00:00
nir_opt_move.c nir/nir_opt_move: fix ALWAYS_INLINE compiler error 2023-01-13 14:23:35 +00:00
nir_opt_move_discards_to_top.c nir: Add a discard optimization pass 2021-05-19 18:04:44 +00:00
nir_opt_non_uniform_access.c nir: Drop legacy atomics in simple cases 2023-05-16 22:36:21 +00:00
nir_opt_offsets.c nir/nir_opt_offsets: Prevent offsets going above max 2022-12-02 15:04:52 +00:00
nir_opt_peephole_select.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_opt_phi_precision.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_opt_preamble.c nir/opt_preamble: Consider load_preamble as movable 2023-01-31 17:02:34 +00:00
nir_opt_ray_queries.c nir/opt_ray_queries: Don't use list_length 2023-04-07 23:48:03 +00:00
nir_opt_rematerialize_compares.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_opt_remove_phis.c nir: Use nir_foreach_phi(_safe) 2023-05-12 14:02:23 +00:00
nir_opt_shrink_stores.c nir/builder: Add a nir_trim_vector helper 2022-05-11 14:47:33 +00:00
nir_opt_shrink_vectors.c nir: shrink phi nodes in nir_opt_shrink_vectors 2023-02-10 09:06:25 +00:00
nir_opt_sink.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_opt_trivial_continues.c nir: add assertions that loops don't have a Continue Construct 2023-02-21 10:41:11 +00:00
nir_opt_undef.c nir/opt_undef: add a pass to clean up 64bit undefs 2022-09-27 18:38:25 +00:00
nir_opt_uniform_atomics.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_opt_vectorize.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_passthrough_gs.c nir: make var arrays large enough in nir_create_passthrough_gs 2023-05-15 11:04:41 +00:00
nir_passthrough_tcs.c nir: Add helpers for lazy var creation. 2023-05-16 18:57:28 +00:00
nir_phi_builder.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_phi_builder.h
nir_print.c nir: Add unified atomics 2023-05-12 20:39:46 +00:00
nir_propagate_invariant.c nir: preserve all metadata when nir_propagate_invariant doesn't make progress 2021-10-05 10:02:54 +00:00
nir_range_analysis.c nir: Fix use of alloca() without #include c99_alloca.h 2023-03-29 16:56:42 +00:00
nir_range_analysis.h nir: Add missing includes 2022-12-06 20:17:58 +00:00
nir_remove_dead_variables.c
nir_remove_tex_shadow.c nir: Propagate the type sampler type change to the used variable. 2023-05-24 07:48:18 +00:00
nir_repair_ssa.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_scale_fdiv.c nir_scale_fdiv: Respect vector swizzles 2022-11-15 03:05:13 +00:00
nir_schedule.c nir: add load_shared2_amd and store_shared2_amd 2022-04-13 23:08:07 +00:00
nir_schedule.h nir/schedule: allow drivers to decide about instruction latency 2022-03-09 15:53:04 +00:00
nir_search.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_search.h nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_search_helpers.h nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
nir_serialize.c nir: Fix serializing pointer initializers. 2023-05-23 11:40:48 +00:00
nir_serialize.h
nir_split_64bit_vec3_and_vec4.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_split_per_member_structs.c nir: use nir_shader_instructions_pass in nir_split_per_member_structs 2022-09-26 11:13:03 +00:00
nir_split_var_copies.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_split_vars.c nir/split_vars: Handle ray hit attributes 2022-12-09 07:07:10 +00:00
nir_sweep.c nir: add assertions that loops don't have a Continue Construct 2023-02-21 10:41:11 +00:00
nir_to_lcssa.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
nir_validate.c nir/validate: Drop legacy atomics 2023-05-16 22:36:22 +00:00
nir_vla.h
nir_vulkan.h vulkan,nir: Refactor ycbcr conversion state into a struct 2023-02-06 18:36:29 +00:00
nir_worklist.c nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_worklist.h nir: Drop a bunch of Authors tags 2023-03-26 00:16:25 +00:00
nir_xfb_info.h nir/xfb_info: nir_gather_xfb_info_from_intrinsics update nir xfb_info 2023-01-18 05:30:14 +00:00
README

New IR, or NIR, is an IR for Mesa intended to sit below GLSL IR and Mesa IR.
Its design inherits from the various IRs that Mesa has used in the past, as
well as Direct3D assembly, and it includes a few new ideas as well. It is a
flat (in terms of using instructions instead of expressions), typeless IR,
similar to TGSI and Mesa IR.  It also supports SSA (although it doesn't require
it).

Variables
=========

NIR includes support for source-level GLSL variables through a structure mostly
copied from GLSL IR. These will be used for linking and conversion from GLSL IR
(and later, from an AST), but for the most part, they will be lowered to
registers (see below) and loads/stores.

Registers
=========

Registers are light-weight; they consist of a structure that only contains its
size, its index for liveness analysis, and an optional name for debugging. In
addition, registers can be local to a function or global to the entire shader;
the latter will be used in ARB_shader_subroutine for passing parameters and
getting return values from subroutines. Registers can also be an array, in which
case they can be accessed indirectly. Each ALU instruction (add, subtract, etc.)
works directly with registers or SSA values (see below).

SSA
========

Everywhere a register can be loaded/stored, an SSA value can be used instead.
The only exception is that arrays/indirect addressing are not supported with
SSA; although research has been done on extensions of SSA to arrays before, it's
usually for the purpose of parallelization (which we're not interested in), and
adds some overhead in the form of adding copies or extra arrays (which is much
more expensive than introducing copies between non-array registers). SSA uses
point directly to their corresponding definition, which in turn points to the
instruction it is part of. This creates an implicit use-def chain and avoids the
need for an external structure for each SSA register.

Functions
=========

Support for function calls is mostly similar to GLSL IR. Each shader contains a
list of functions, and each function has a list of overloads. Each overload
contains a list of parameters, and may contain an implementation which specifies
the variables that correspond to the parameters and return value. Inlining a
function, assuming it has a single return point, is as simple as copying its
instructions, registers, and local variables into the target function and then
inserting copies to and from the new parameters as appropriate. After functions
are inlined and any non-subroutine functions are deleted, parameters and return
variables will be converted to global variables and then global registers. We
don't do this lowering earlier (i.e. the fortranizer idea) for a few reasons:

- If we want to do optimizations before link time, we need to have the function
signature available during link-time.

- If we do any inlining before link time, then we might wind up with the
inlined function and the non-inlined function using the same global
variables/registers which would preclude optimization.

Intrinsics
=========

Any operation (other than function calls and textures) which touches a variable
or is not referentially transparent is represented by an intrinsic. Intrinsics
are similar to the idea of a "builtin function," i.e. a function declaration
whose implementation is provided by the backend, except they are more powerful
in the following ways:

- They can also load and store registers when appropriate, which limits the
number of variables needed in later stages of the IR while obviating the need
for a separate load/store variable instruction.

- Intrinsics can be marked as side-effect free, which permits them to be
treated like any other instruction when it comes to optimizations. This allows
load intrinsics to be represented as intrinsics while still being optimized
away by dead code elimination, common subexpression elimination, etc.

Intrinsics are used for:

- Atomic operations
- Memory barriers
- Subroutine calls
- Geometry shader emitVertex and endPrimitive
- Loading and storing variables (before lowering)
- Loading and storing uniforms, shader inputs and outputs, etc (after lowering)
- Copying variables (cases where in GLSL the destination is a structure or
array)
- The kitchen sink
- ...

Textures
=========

Unfortunately, there are far too many texture operations to represent each one
of them with an intrinsic, so there's a special texture instruction similar to
the GLSL IR one. The biggest difference is that, while the texture instruction
has a sampler dereference field used just like in GLSL IR, this gets lowered to
a texture unit index (with a possible indirect offset) while the type
information of the original sampler is kept around for backends. Also, all the
non-constant sources are stored in a single array to make it easier for
optimization passes to iterate over all the sources.

Control Flow
=========

Like in GLSL IR, control flow consists of a tree of "control flow nodes", which
include if statements and loops, and jump instructions (break, continue, and
return). Unlike GLSL IR, though, the leaves of the tree aren't statements but
basic blocks. Each basic block also keeps track of its successors and
predecessors, and function implementations keep track of the beginning basic
block (the first basic block of the function) and the ending basic block (a fake
basic block that every return statement points to). Together, these elements
make up the control flow graph, in this case a redundant piece of information on
top of the control flow tree that will be used by almost all the optimizations.
There are helper functions to add and remove control flow nodes that also update
the control flow graph, and so usually it doesn't need to be touched by passes
that modify control flow nodes.