diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c index e0b8447adb1..64cf6a92a11 100644 --- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c +++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c @@ -23,6 +23,7 @@ #include "spirv_to_dxil.h" #include "nir_to_dxil.h" +#include "dxil_nir.h" #include "shader_enums.h" #include "spirv/nir_spirv.h" #include "util/blob.h" @@ -73,6 +74,31 @@ spirv_to_dxil(const uint32_t *words, size_t word_count, exec_node_remove(&func->node); } assert(exec_list_length(&nir->functions) == 1); + + NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays); + NIR_PASS_V(nir, nir_lower_io_to_temporaries, entrypoint->impl, true, true); + NIR_PASS_V(nir, nir_split_var_copies); + NIR_PASS_V(nir, nir_lower_var_copies); + + { + bool progress; + do + { + progress = false; + NIR_PASS(progress, nir, nir_copy_prop); + NIR_PASS(progress, nir, nir_opt_copy_prop_vars); + NIR_PASS(progress, nir, nir_opt_deref); + NIR_PASS(progress, nir, nir_opt_dce); + NIR_PASS(progress, nir, nir_opt_undef); + NIR_PASS(progress, nir, nir_opt_constant_folding); + NIR_PASS(progress, nir, nir_opt_cse); + NIR_PASS(progress, nir, nir_lower_vars_to_ssa); + NIR_PASS(progress, nir, nir_opt_algebraic); + } while (progress); + } + + NIR_PASS_V(nir, dxil_nir_split_clip_cull_distance); + struct nir_to_dxil_options opts = {0}; struct blob dxil_blob;