Lines Matching full:nir
10 * \brief NIR-specific functions.
13 #include "nir/nir_builder.h"
19 /** Base/common SPIR-V to NIR options. */
24 /** Base/common NIR options. */
34 * \brief Sets up device/core-specific SPIR-V to NIR options.
37 * \param[out] spirv_options SPIR-V to NIR options.
49 * \brief Sets up device/core-specific NIR options.
52 * \param[out] nir_options NIR options.
64 * \brief Runs pre-processing passes on a NIR shader.
67 * \param[in,out] nir NIR shader.
69 void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir) in pco_preprocess_nir() argument
71 if (nir->info.internal) in pco_preprocess_nir()
72 NIR_PASS(_, nir, nir_lower_returns); in pco_preprocess_nir()
74 NIR_PASS(_, nir, nir_lower_global_vars_to_local); in pco_preprocess_nir()
75 NIR_PASS(_, nir, nir_lower_vars_to_ssa); in pco_preprocess_nir()
76 NIR_PASS(_, nir, nir_split_var_copies); in pco_preprocess_nir()
77 NIR_PASS(_, nir, nir_lower_var_copies); in pco_preprocess_nir()
78 NIR_PASS(_, nir, nir_split_per_member_structs); in pco_preprocess_nir()
80 nir, in pco_preprocess_nir()
84 nir, in pco_preprocess_nir()
88 nir, in pco_preprocess_nir()
94 nir, in pco_preprocess_nir()
98 NIR_PASS(_, nir, nir_opt_dce); in pco_preprocess_nir()
100 if (pco_should_print_nir(nir)) { in pco_preprocess_nir()
102 nir_print_shader(nir, stdout); in pco_preprocess_nir()
163 * \brief Lowers a NIR shader.
166 * \param[in,out] nir NIR shader.
169 void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data) in pco_lower_nir() argument
172 nir, in pco_lower_nir()
178 NIR_PASS(_, nir, nir_opt_dce); in pco_lower_nir()
179 NIR_PASS(_, nir, nir_opt_constant_folding); in pco_lower_nir()
181 nir, in pco_lower_nir()
185 if (nir->info.stage == MESA_SHADER_FRAGMENT) { in pco_lower_nir()
186 NIR_PASS(_, nir, pco_nir_pfo, &data->fs); in pco_lower_nir()
187 } else if (nir->info.stage == MESA_SHADER_VERTEX) { in pco_lower_nir()
188 NIR_PASS(_, nir, pco_nir_pvi, &data->vs); in pco_lower_nir()
193 nir, in pco_lower_nir()
199 NIR_PASS(_, nir, nir_lower_vars_to_ssa); in pco_lower_nir()
200 NIR_PASS(_, nir, nir_opt_copy_prop_vars); in pco_lower_nir()
201 NIR_PASS(_, nir, nir_opt_dead_write_vars); in pco_lower_nir()
202 NIR_PASS(_, nir, nir_opt_combine_stores, nir_var_all); in pco_lower_nir()
205 NIR_PASS(_, nir, nir_lower_alu); in pco_lower_nir()
206 NIR_PASS(_, nir, nir_lower_pack); in pco_lower_nir()
207 NIR_PASS(_, nir, nir_opt_algebraic); in pco_lower_nir()
211 NIR_PASS(progress, nir, nir_opt_algebraic_late); in pco_lower_nir()
212 NIR_PASS(_, nir, nir_opt_constant_folding); in pco_lower_nir()
213 NIR_PASS(_, nir, nir_lower_load_const_to_scalar); in pco_lower_nir()
214 NIR_PASS(_, nir, nir_copy_prop); in pco_lower_nir()
215 NIR_PASS(_, nir, nir_opt_dce); in pco_lower_nir()
216 NIR_PASS(_, nir, nir_opt_cse); in pco_lower_nir()
221 if (nir->info.stage != MESA_SHADER_FRAGMENT) in pco_lower_nir()
224 NIR_PASS(_, nir, nir_opt_vectorize_io, vec_modes); in pco_lower_nir()
231 if (nir->info.stage == MESA_SHADER_FRAGMENT) { in pco_lower_nir()
233 nir, in pco_lower_nir()
240 NIR_PASS(_, nir, nir_lower_alu_to_scalar, NULL, NULL); in pco_lower_nir()
245 NIR_PASS(progress, nir, nir_copy_prop); in pco_lower_nir()
246 NIR_PASS(progress, nir, nir_opt_dce); in pco_lower_nir()
247 NIR_PASS(progress, nir, nir_opt_cse); in pco_lower_nir()
248 NIR_PASS(progress, nir, nir_opt_constant_folding); in pco_lower_nir()
249 NIR_PASS(progress, nir, nir_opt_undef); in pco_lower_nir()
252 if (pco_should_print_nir(nir)) { in pco_lower_nir()
254 nir_print_shader(nir, stdout); in pco_lower_nir()
261 * \param[in] b NIR builder.
262 * \param[in] intr NIR intrinsic instruction.
292 * \param[in] nir NIR shader.
295 static void gather_fs_data(nir_shader *nir, pco_data *data) in gather_fs_data() argument
297 nir_shader_intrinsics_pass(nir, gather_fs_data_pass, nir_metadata_all, data); in gather_fs_data()
301 nir_foreach_shader_in_variable (var, nir) { in gather_fs_data()
314 * \param[in] nir NIR shader.
317 static void gather_data(nir_shader *nir, pco_data *data) in gather_data() argument
319 switch (nir->info.stage) { in gather_data()
321 return gather_fs_data(nir, data); in gather_data()
333 * \brief Runs post-processing passes on a NIR shader.
336 * \param[in,out] nir NIR shader.
339 void pco_postprocess_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data) in pco_postprocess_nir() argument
341 NIR_PASS(_, nir, nir_move_vec_src_uses_to_dest, false); in pco_postprocess_nir()
344 nir_foreach_function_with_impl (_, impl, nir) { in pco_postprocess_nir()
350 nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); in pco_postprocess_nir()
352 gather_data(nir, data); in pco_postprocess_nir()
354 if (pco_should_print_nir(nir)) { in pco_postprocess_nir()
356 nir_print_shader(nir, stdout); in pco_postprocess_nir()
361 * \brief Performs linking optimizations on consecutive NIR shader stages.
364 * \param[in,out] producer NIR producer shader.
365 * \param[in,out] consumer NIR consumer shader.
398 * \brief Performs reverse linking optimizations on consecutive NIR shader
402 * \param[in,out] producer NIR producer shader.
403 * \param[in,out] consumer NIR consumer shader.