Debian Codegraph @

src/panfrost/compiler/midgard/midgard_compile.h

raw
1 /*
2 * Copyright (C) 2018-2019 Alyssa Rosenzweig
3 * Copyright (C) 2019-2020 Collabora, Ltd.
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef __MIDGARD_H_
8 #define __MIDGARD_H_
9
10 #include "compiler/nir/nir.h"
11 #include "panfrost/compiler/pan_compiler.h"
12 #include "util/u_dynarray.h"
13
14 void midgard_preprocess_nir(nir_shader *nir, uint64_t gpu_id);
15 void midgard_postprocess_nir(nir_shader *nir, uint64_t gpu_id);
16 void midgard_lower_texture_nir(nir_shader *nir, uint64_t gpu_id);
17
18 bool midgard_will_dump_shaders(void);
19
20 void midgard_compile_shader_nir(nir_shader *nir,
21 const struct pan_compile_inputs *inputs,
22 struct util_dynarray *binary,
23 struct pan_shader_info *info);
24
25 /* NIR options are shared between the standalone compiler and the online
26 * compiler. Defining it here is the simplest, though maybe not the Right
27 * solution. */
28
29 static const nir_shader_compiler_options midgard_nir_options = {
30 .lower_ffma16 = true,
31 .lower_ffma32 = true,
32 .lower_ffma64 = true,
33 .lower_scmp = true,
34 .lower_flrp16 = true,
35 .lower_flrp32 = true,
36 .lower_flrp64 = true,
37 .lower_ffract = true,
38 .lower_fmod = true,
39 .lower_fdiv = true,
40 .lower_ineg = true,
41 .lower_isign = true,
42 .lower_fpow = true,
43 .lower_find_lsb = true,
44 .lower_ifind_msb = true,
45 .lower_fdph = true,
46 .lower_fisnormal = true,
47 .lower_hadd = true,
48 .lower_uadd_carry = true,
49 .lower_usub_borrow = true,
50
51 /* TODO: We have native ops to help here, which we'll want to look into
52 * eventually */
53 .lower_fsign = true,
54
55 .lower_bit_count = true,
56 .lower_bitfield_reverse = true,
57 .lower_bitfield_insert = true,
58 .lower_bitfield_extract = true,
59 .lower_bitfield_extract8 = true,
60 .lower_bitfield_extract16 = true,
61 .lower_extract_byte = true,
62 .lower_extract_word = true,
63 .lower_insert_byte = true,
64 .lower_insert_word = true,
65
66 .lower_pack_half_2x16 = true,
67 .lower_pack_unorm_2x16 = true,
68 .lower_pack_snorm_2x16 = true,
69 .lower_pack_unorm_4x8 = true,
70 .lower_pack_snorm_4x8 = true,
71 .lower_unpack_half_2x16 = true,
72 .lower_unpack_unorm_2x16 = true,
73 .lower_unpack_snorm_2x16 = true,
74 .lower_unpack_unorm_4x8 = true,
75 .lower_unpack_snorm_4x8 = true,
76 .lower_pack_split = true,
77 .lower_pack_64_2x32_split = true,
78 .lower_unpack_64_2x32_split = true,
79 .lower_int64_options = nir_lower_imul_2x32_64,
80
81 .lower_doubles_options = nir_lower_dmod,
82
83 .lower_uniforms_to_ubo = true,
84 .has_fsub = true,
85 .has_isub = true,
86
87 .has_cs_global_id = true,
88 .lower_cs_local_index_to_id = true,
89 .max_unroll_iterations = 32,
90 .max_samples = 16,
91 .force_indirect_unrolling =
92 (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
93 .force_indirect_unrolling_sampler = true,
94 .support_indirect_inputs = BITFIELD_BIT(MESA_SHADER_TESS_CTRL) |
95 BITFIELD_BIT(MESA_SHADER_TESS_EVAL) |
96 BITFIELD_BIT(MESA_SHADER_FRAGMENT),
97 };
98
99 #endif