~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/asahi/compiler/agx_compile.h

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include "util/u_dynarray.h"
11
11
 
12
12
struct agx_varyings_vs {
 
13
   /* The number of user varyings of each type. The varyings must be allocated
 
14
    * in this order ({smooth, flat, linear} × {32, 16}), which may require
 
15
    * remapping.
 
16
    */
 
17
   unsigned num_32_smooth;
 
18
   unsigned num_32_flat;
 
19
   unsigned num_32_linear;
 
20
   unsigned num_16_smooth;
 
21
   unsigned num_16_flat;
 
22
   unsigned num_16_linear;
 
23
 
13
24
   /* The first index used for FP16 varyings. Indices less than this are treated
14
25
    * as FP32. This may require remapping slots to guarantee.
15
26
    */
76
87
   struct agx_varyings_fs fs;
77
88
};
78
89
 
 
90
struct agx_uncompiled_shader_info {
 
91
   uint64_t inputs_flat_shaded;
 
92
   uint64_t inputs_linear_shaded;
 
93
};
 
94
 
79
95
struct agx_shader_info {
80
96
   union agx_varyings varyings;
81
97
 
100
116
   /* Depth layout, never equal to NONE */
101
117
   enum gl_frag_depth_layout depth_layout;
102
118
 
103
 
   /* Is colour output omitted? */
104
 
   bool no_colour_output;
 
119
   /* Based only the compiled shader, should tag writes be disabled? This is set
 
120
    * based on what is outputted. Note if rasterizer discard is used, that needs
 
121
    * to disable tag writes regardless of this flag.
 
122
    */
 
123
   bool tag_write_disable;
105
124
 
106
125
   /* Shader is incompatible with triangle merging */
107
126
   bool disable_tri_merging;
138
157
   AGX_NUM_FORMATS,
139
158
};
140
159
 
 
160
struct agx_vs_shader_key {
 
161
   /* The GPU ABI requires all smooth shaded varyings to come first, then all
 
162
    * flat shaded varyings, then all linear shaded varyings, as written by the
 
163
    * VS. In order to correctly remap the varyings into the right order in the
 
164
    * VS, we need to propagate the mask of flat/linear shaded varyings into the
 
165
    * compiler.
 
166
    */
 
167
   uint64_t outputs_flat_shaded;
 
168
   uint64_t outputs_linear_shaded;
 
169
};
 
170
 
141
171
struct agx_fs_shader_key {
142
172
   /* Normally, access to the tilebuffer must be guarded by appropriate fencing
143
173
    * instructions to ensure correct results in the presence of out-of-order
150
180
    * tilebuffer loads (including blending).
151
181
    */
152
182
   bool ignore_tib_dependencies;
 
183
 
 
184
   /* In a monolithic fragment shader or in a fragment epilogue, the number of
 
185
    * samples in the tilebuffer. In a non-monolithic fragment shader, leave
 
186
    * zero. This is used for the correct lowering of sample_mask instructions,
 
187
    * to ensure that all samples are written out. Can be set conservatively.
 
188
    */
 
189
   unsigned nr_samples;
153
190
};
154
191
 
155
192
struct agx_shader_key {
157
194
   unsigned reserved_preamble;
158
195
 
159
196
   union {
 
197
      struct agx_vs_shader_key vs;
160
198
      struct agx_fs_shader_key fs;
161
199
   };
162
200
};
163
201
 
164
 
void agx_preprocess_nir(nir_shader *nir, bool support_lod_bias);
 
202
void agx_preprocess_nir(nir_shader *nir, bool support_lod_bias,
 
203
                        struct agx_uncompiled_shader_info *out);
 
204
 
 
205
bool agx_nir_lower_discard_zs_emit(nir_shader *s);
165
206
 
166
207
void agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key,
167
208
                            struct util_debug_callback *debug,
176
217
   .lower_flrp32 = true,
177
218
   .lower_fpow = true,
178
219
   .lower_fmod = true,
179
 
   .lower_bitfield_extract_to_shifts = true,
180
220
   .lower_bitfield_insert_to_shifts = true,
181
221
   .lower_ifind_msb = true,
182
222
   .lower_find_lsb = true,
200
240
   .vectorize_io = true,
201
241
   .use_interpolated_input_intrinsics = true,
202
242
   .lower_rotate = true,
203
 
   .has_fsub = true,
204
243
   .has_isub = true,
205
 
   .use_scoped_barrier = true,
 
244
   .support_16bit_alu = true,
206
245
   .max_unroll_iterations = 32,
207
246
   .lower_uniforms_to_ubo = true,
208
247
   .force_indirect_unrolling_sampler = true,