| # Copyright 2016 Google, LLC |
| # |
| # Permission is hereby granted, free of charge, to any person obtaining a |
| # copy of this software and associated documentation files (the "Software"), |
| # to deal in the Software without restriction, including without limitation |
| # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| # and/or sell copies of the Software, and to permit persons to whom the |
| # Software is furnished to do so, subject to the following conditions: |
| # |
| # The above copyright notice and this permission notice (including the next |
| # paragraph) shall be included in all copies or substantial portions of the |
| # Software. |
| # |
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| # IN THE SOFTWARE. |
| |
| import("../../../mesa.gni") |
| |
| config("nir_public_config") { |
| include_dirs = [ |
| ".", |
| "$target_gen_dir", |
| ] |
| cflags = [ "-Wno-conversion" ] |
| } |
| |
| mesa_source_set("nir") { |
| public_configs = [ ":nir_public_config" ] |
| |
| public_deps = [ ":gen" ] |
| |
| deps = [ |
| ":nir_compiler_workaround", |
| "$mesa_build_root/include:c_compat", |
| "$mesa_build_root/src/compiler/glsl:ir_expression_operation", |
| "$mesa_build_root/src/compiler/spirv", |
| "$mesa_build_root/src/util", |
| ] |
| |
| include_dirs = [ |
| "..", |
| "$mesa_build_root/src/mapi", |
| "$mesa_build_root/src/mesa", |
| ] |
| |
| sources = [ |
| "nir.c", |
| "nir.h", |
| "nir_builder.c", |
| "nir_builder.h", |
| "nir_builtin_builder.c", |
| "nir_builtin_builder.h", |
| "nir_clone.c", |
| "nir_constant_expressions.h", |
| "nir_control_flow.c", |
| "nir_control_flow.h", |
| "nir_control_flow_private.h", |
| "nir_conversion_builder.h", |
| "nir_convert_ycbcr.c", |
| "nir_deref.c", |
| "nir_deref.h", |
| "nir_divergence_analysis.c", |
| "nir_dominance.c", |
| "nir_format_convert.h", |
| "nir_from_ssa.c", |
| "nir_gather_info.c", |
| "nir_gather_ssa_types.c", |
| "nir_gather_xfb_info.c", |
| "nir_group_loads.c", |
| "nir_gs_count_vertices.c", |
| "nir_inline_functions.c", |
| "nir_inline_uniforms.c", |
| "nir_instr_set.c", |
| "nir_instr_set.h", |
| "nir_linking_helpers.c", |
| "nir_liveness.c", |
| "nir_loop_analyze.c", |
| "nir_loop_analyze.h", |
| "nir_lower_alpha_test.c", |
| "nir_lower_alu.c", |
| "nir_lower_alu_width.c", |
| "nir_lower_amul.c", |
| "nir_lower_array_deref_of_vec.c", |
| "nir_lower_atomics_to_ssbo.c", |
| "nir_lower_bit_size.c", |
| "nir_lower_bitmap.c", |
| "nir_lower_blend.c", |
| "nir_lower_bool_to_bitsize.c", |
| "nir_lower_bool_to_float.c", |
| "nir_lower_bool_to_int32.c", |
| "nir_lower_cl_images.c", |
| "nir_lower_clamp_color_outputs.c", |
| "nir_lower_clip.c", |
| "nir_lower_clip_cull_distance_arrays.c", |
| "nir_lower_clip_disable.c", |
| "nir_lower_clip_halfz.c", |
| "nir_lower_const_arrays_to_uniforms.c", |
| "nir_lower_convert_alu_types.c", |
| "nir_lower_discard_if.c", |
| "nir_lower_discard_or_demote.c", |
| "nir_lower_double_ops.c", |
| "nir_lower_drawpixels.c", |
| "nir_lower_fb_read.c", |
| "nir_lower_flatshade.c", |
| "nir_lower_flrp.c", |
| "nir_lower_fp16_conv.c", |
| "nir_lower_fragcolor.c", |
| "nir_lower_fragcoord_wtrans.c", |
| "nir_lower_frexp.c", |
| "nir_lower_global_vars_to_local.c", |
| "nir_lower_goto_ifs.c", |
| "nir_lower_gs_intrinsics.c", |
| "nir_lower_idiv.c", |
| "nir_lower_image.c", |
| "nir_lower_indirect_derefs.c", |
| "nir_lower_input_attachments.c", |
| "nir_lower_int64.c", |
| "nir_lower_int_to_float.c", |
| "nir_lower_interpolation.c", |
| "nir_lower_io.c", |
| "nir_lower_io_arrays_to_elements.c", |
| "nir_lower_io_to_scalar.c", |
| "nir_lower_io_to_temporaries.c", |
| "nir_lower_io_to_vector.c", |
| "nir_lower_is_helper_invocation.c", |
| "nir_lower_load_const_to_scalar.c", |
| "nir_lower_locals_to_regs.c", |
| "nir_lower_mediump.c", |
| "nir_lower_memcpy.c", |
| "nir_lower_memory_model.c", |
| "nir_lower_multiview.c", |
| "nir_lower_non_uniform_access.c", |
| "nir_lower_packing.c", |
| "nir_lower_passthrough_edgeflags.c", |
| "nir_lower_patch_vertices.c", |
| "nir_lower_phis_to_scalar.c", |
| "nir_lower_pntc_ytransform.c", |
| "nir_lower_point_size.c", |
| "nir_lower_point_size_mov.c", |
| "nir_lower_point_smooth.c", |
| "nir_lower_poly_line_smooth.c", |
| "nir_lower_printf.c", |
| "nir_lower_readonly_images_to_tex.c", |
| "nir_lower_regs_to_ssa.c", |
| "nir_lower_returns.c", |
| "nir_lower_samplers.c", |
| "nir_lower_scratch.c", |
| "nir_lower_shader_calls.c", |
| "nir_lower_single_sampled.c", |
| "nir_lower_ssbo.c", |
| "nir_lower_subgroups.c", |
| "nir_lower_system_values.c", |
| "nir_lower_sysvals_to_varyings.c", |
| "nir_lower_task_shader.c", |
| "nir_lower_tex.c", |
| "nir_lower_tex_shadow.c", |
| "nir_lower_texcoord_replace.c", |
| "nir_lower_to_source_mods.c", |
| "nir_lower_two_sided_color.c", |
| "nir_lower_ubo_vec4.c", |
| "nir_lower_undef_to_zero.c", |
| "nir_lower_uniforms_to_ubo.c", |
| "nir_lower_var_copies.c", |
| "nir_lower_variable_initializers.c", |
| "nir_lower_vars_to_ssa.c", |
| "nir_lower_vec3_to_vec4.c", |
| "nir_lower_vec_to_movs.c", |
| "nir_lower_viewport_transform.c", |
| "nir_lower_wpos_center.c", |
| |
| # see ":nir_compiler_workaround" |
| # "nir_lower_wpos_ytransform.c", |
| "nir_lower_wrmasks.c", |
| "nir_metadata.c", |
| "nir_move_vec_src_uses_to_dest.c", |
| "nir_normalize_cubemap_coords.c", |
| "nir_opt_access.c", |
| "nir_opt_barriers.c", |
| "nir_opt_combine_stores.c", |
| "nir_opt_comparison_pre.c", |
| "nir_opt_conditional_discard.c", |
| "nir_opt_constant_folding.c", |
| "nir_opt_copy_prop_vars.c", |
| "nir_opt_copy_propagate.c", |
| "nir_opt_cse.c", |
| "nir_opt_dce.c", |
| "nir_opt_dead_cf.c", |
| "nir_opt_dead_write_vars.c", |
| "nir_opt_find_array_copies.c", |
| "nir_opt_fragdepth.c", |
| "nir_opt_gcm.c", |
| "nir_opt_idiv_const.c", |
| "nir_opt_if.c", |
| "nir_opt_intrinsics.c", |
| "nir_opt_large_constants.c", |
| "nir_opt_load_store_vectorize.c", |
| "nir_opt_loop_unroll.c", |
| "nir_opt_memcpy.c", |
| "nir_opt_move.c", |
| "nir_opt_move_discards_to_top.c", |
| "nir_opt_non_uniform_access.c", |
| "nir_opt_offsets.c", |
| "nir_opt_peephole_select.c", |
| "nir_opt_phi_precision.c", |
| "nir_opt_preamble.c", |
| "nir_opt_ray_queries.c", |
| "nir_opt_rematerialize_compares.c", |
| "nir_opt_remove_phis.c", |
| "nir_opt_shrink_stores.c", |
| "nir_opt_shrink_vectors.c", |
| "nir_opt_sink.c", |
| "nir_opt_trivial_continues.c", |
| "nir_opt_undef.c", |
| "nir_opt_uniform_atomics.c", |
| "nir_opt_vectorize.c", |
| "nir_passthrough_tcs.c", |
| "nir_phi_builder.c", |
| "nir_phi_builder.h", |
| "nir_print.c", |
| "nir_propagate_invariant.c", |
| "nir_range_analysis.c", |
| "nir_range_analysis.h", |
| "nir_remove_dead_variables.c", |
| "nir_repair_ssa.c", |
| "nir_scale_fdiv.c", |
| "nir_schedule.c", |
| "nir_schedule.h", |
| "nir_search.c", |
| "nir_search.h", |
| "nir_search_helpers.h", |
| "nir_serialize.c", |
| "nir_serialize.h", |
| "nir_split_64bit_vec3_and_vec4.c", |
| "nir_split_per_member_structs.c", |
| "nir_split_var_copies.c", |
| "nir_split_vars.c", |
| "nir_sweep.c", |
| "nir_to_lcssa.c", |
| "nir_validate.c", |
| "nir_vla.h", |
| "nir_vulkan.h", |
| "nir_worklist.c", |
| "nir_worklist.h", |
| "nir_xfb_info.h", |
| ] |
| |
| # Suppress warnings the nir code doesn't comply with. |
| configs = [ |
| "//build/config:Wno-unused-but-set-variable", |
| "//build/config:Wno-strict-prototypes", |
| ] |
| } |
| |
| # With -O2 this file causes an infinite loop with clang 3.9.0 |
| mesa_source_set("nir_compiler_workaround") { |
| sources = [ "nir_lower_wpos_ytransform.c" ] |
| |
| cflags_c = [ "-O1" ] |
| |
| include_dirs = [ "$mesa_build_root/src/mesa" ] |
| |
| deps = [ |
| ":gen", |
| "$mesa_build_root/src/util", |
| "$mesa_build_root/src/util/format", |
| ] |
| |
| configs = [ "//build/config:Wno-strict-prototypes" ] |
| } |
| |
| group("nir_headers") { |
| public_configs = [ ":nir_public_config" ] |
| |
| public_deps = [ ":gen" ] |
| } |
| |
| mesa_python_stdout_to_file_action("nir_opcodes") { |
| output = "nir_opcodes.h" |
| script = "nir_opcodes_h.py" |
| sources = [ "nir_opcodes.py" ] |
| libraries = [ "//third_party/mako" ] |
| } |
| |
| mesa_python_stdout_to_file_action("nir_builder_opcodes") { |
| output = "nir_builder_opcodes.h" |
| script = "nir_builder_opcodes_h.py" |
| sources = [ |
| "nir_intrinsics.py", |
| "nir_opcodes.py", |
| ] |
| libraries = [ "//third_party/mako" ] |
| } |
| |
| mesa_python_stdout_to_file_action("nir_constant_expressions") { |
| output = "nir_constant_expressions.c" |
| script = "nir_constant_expressions.py" |
| sources = [ "nir_opcodes.py" ] |
| libraries = [ "//third_party/mako" ] |
| } |
| |
| mesa_python_stdout_to_file_action("nir_opcodes_c") { |
| output = "nir_opcodes.c" |
| script = "nir_opcodes_c.py" |
| sources = [ "nir_opcodes.py" ] |
| libraries = [ "//third_party/mako" ] |
| } |
| |
| mesa_python_stdout_to_file_action("nir_opt_algebraic") { |
| output = "nir_opt_algebraic.c" |
| script = "nir_opt_algebraic.py" |
| sources = [ |
| "nir_algebraic.py", |
| "nir_opcodes.py", |
| ] |
| libraries = [ "//third_party/mako" ] |
| } |
| |
| mesa_python_action("nir_intrinsics_h") { |
| output_name = "nir_intrinsics.h" |
| script = "nir_intrinsics_h.py" |
| |
| outputs = [ "$target_gen_dir/$output_name" ] |
| |
| inputs = [ "nir_intrinsics.py" ] |
| |
| args = [ |
| "--outdir", |
| rebase_path(target_gen_dir, root_build_dir), |
| ] |
| } |
| |
| mesa_python_action("nir_intrinsics_c") { |
| output_name = "nir_intrinsics.c" |
| script = "nir_intrinsics_c.py" |
| |
| outputs = [ "$target_gen_dir/$output_name" ] |
| |
| inputs = [ "nir_intrinsics.py" ] |
| |
| args = [ |
| "--outdir", |
| rebase_path(target_gen_dir, root_build_dir), |
| ] |
| } |
| |
| mesa_python_action("nir_intrinsics_indices_h") { |
| output_name = "nir_intrinsics_indices.h" |
| script = "nir_intrinsics_indices_h.py" |
| |
| outputs = [ "$target_gen_dir/$output_name" ] |
| |
| inputs = [ |
| "$script", |
| "nir_intrinsics.py", |
| ] |
| |
| args = [ |
| "--outdir", |
| rebase_path(target_gen_dir, root_build_dir), |
| ] |
| } |
| |
| config("gen_public_config") { |
| include_dirs = [ target_gen_dir ] |
| cflags = [ "-Wno-conversion" ] |
| } |
| |
| mesa_source_set("gen") { |
| public_configs = [ ":gen_public_config" ] |
| |
| public_deps = [ |
| ":nir_builder_opcodes", |
| ":nir_constant_expressions", |
| ":nir_intrinsics_c", |
| ":nir_intrinsics_h", |
| ":nir_intrinsics_indices_h", |
| ":nir_opcodes", |
| ":nir_opcodes_c", |
| ":nir_opt_algebraic", |
| "$mesa_build_root/src/util", |
| ] |
| |
| include_dirs = [ |
| "$mesa_build_root/src/mesa", |
| "$mesa_build_root/src/mapi", |
| ".", |
| ] |
| |
| sources = [ |
| "$target_gen_dir/nir_constant_expressions.c", |
| "$target_gen_dir/nir_intrinsics.c", |
| "$target_gen_dir/nir_opcodes.c", |
| "$target_gen_dir/nir_opt_algebraic.c", |
| ] |
| |
| deps = [ |
| ":nir_intrinsics_c", |
| ":nir_intrinsics_h", |
| ":nir_opcodes_c", |
| ":nir_opt_algebraic", |
| ] |
| |
| configs = [ "//build/config:Wno-strict-prototypes" ] |
| } |