Mesa (main): d3d12: Move d3d12_nir_lower_vs_vertex_conversion() to a common place

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 18:18:56 UTC 2022


Module: Mesa
Branch: main
Commit: b0b9b500778128d8a3df76d76b2f849ae6725379
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0b9b500778128d8a3df76d76b2f849ae6725379

Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Tue Jun 14 03:09:51 2022 -0700

d3d12: Move d3d12_nir_lower_vs_vertex_conversion() to a common place

So we can re-use it in dozen.

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15955>

---

 src/gallium/drivers/d3d12/d3d12_compiler.cpp                        | 2 +-
 src/gallium/drivers/d3d12/d3d12_nir_passes.h                        | 3 ---
 src/gallium/drivers/d3d12/meson.build                               | 1 -
 src/microsoft/compiler/dxil_nir.h                                   | 1 +
 .../compiler/dxil_nir_lower_vs_vertex_conversion.c}                 | 6 +++---
 src/microsoft/compiler/meson.build                                  | 1 +
 6 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
index d5e677d03ee..0219c6044dc 100644
--- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
@@ -113,7 +113,7 @@ compile_nir(struct d3d12_context *ctx, struct d3d12_shader_selector *sel,
                  screen->base.get_paramf(&screen->base, PIPE_CAPF_MAX_TEXTURE_LOD_BIAS));
 
    if (key->vs.needs_format_emulation)
-      d3d12_nir_lower_vs_vertex_conversion(nir, key->vs.format_conversion);
+      dxil_nir_lower_vs_vertex_conversion(nir, key->vs.format_conversion);
 
    uint32_t num_ubos_before_lower_to_ubo = nir->info.num_ubos;
    uint32_t num_uniforms_before_lower_to_ubo = nir->num_uniforms;
diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.h b/src/gallium/drivers/d3d12/d3d12_nir_passes.h
index 920be9be559..818b12abf31 100644
--- a/src/gallium/drivers/d3d12/d3d12_nir_passes.h
+++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.h
@@ -93,9 +93,6 @@ d3d12_nir_invert_depth(nir_shader *s, unsigned viewport_mask);
 bool
 nir_lower_packed_ubo_loads(struct nir_shader *nir);
 
-bool
-d3d12_nir_lower_vs_vertex_conversion(nir_shader *s, enum pipe_format target_formats[]);
-
 void
 d3d12_lower_primitive_id(nir_shader *shader);
 
diff --git a/src/gallium/drivers/d3d12/meson.build b/src/gallium/drivers/d3d12/meson.build
index cfe33bcadc3..9c961d323e4 100644
--- a/src/gallium/drivers/d3d12/meson.build
+++ b/src/gallium/drivers/d3d12/meson.build
@@ -35,7 +35,6 @@ files_libd3d12 = files(
   'd3d12_gs_variant.cpp',
   'd3d12_lower_image_casts.c',
   'd3d12_lower_point_sprite.c',
-  'd3d12_nir_lower_vs_vertex_conversion.c',
   'd3d12_nir_passes.c',
   'd3d12_pipeline_state.cpp',
   'd3d12_query.cpp',
diff --git a/src/microsoft/compiler/dxil_nir.h b/src/microsoft/compiler/dxil_nir.h
index 1d271347966..a7fbf13d7f3 100644
--- a/src/microsoft/compiler/dxil_nir.h
+++ b/src/microsoft/compiler/dxil_nir.h
@@ -53,6 +53,7 @@ bool dxil_nir_lower_system_values(nir_shader *shader);
 bool dxil_nir_split_typed_samplers(nir_shader *shader);
 bool dxil_nir_lower_bool_input(struct nir_shader *s);
 bool dxil_nir_lower_sysval_to_load_input(nir_shader *s, nir_variable **sysval_vars);
+bool dxil_nir_lower_vs_vertex_conversion(nir_shader *s, enum pipe_format target_formats[]);
 
 nir_ssa_def *
 build_load_ubo_dxil(nir_builder *b, nir_ssa_def *buffer,
diff --git a/src/gallium/drivers/d3d12/d3d12_nir_lower_vs_vertex_conversion.c b/src/microsoft/compiler/dxil_nir_lower_vs_vertex_conversion.c
similarity index 97%
rename from src/gallium/drivers/d3d12/d3d12_nir_lower_vs_vertex_conversion.c
rename to src/microsoft/compiler/dxil_nir_lower_vs_vertex_conversion.c
index 101912227a8..6c14ae10404 100644
--- a/src/gallium/drivers/d3d12/d3d12_nir_lower_vs_vertex_conversion.c
+++ b/src/microsoft/compiler/dxil_nir_lower_vs_vertex_conversion.c
@@ -21,7 +21,7 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "d3d12_nir_passes.h"
+#include "dxil_nir.h"
 
 #include "nir_builder.h"
 #include "nir_builtin_builder.h"
@@ -147,8 +147,8 @@ lower_vs_vertex_conversion_impl(nir_builder *b, nir_instr *instr, void *options)
  * or PIPE_FORMAT_NONE if no conversion is needed
  */
 bool
-d3d12_nir_lower_vs_vertex_conversion(nir_shader *s,
-                                     enum pipe_format target_formats[])
+dxil_nir_lower_vs_vertex_conversion(nir_shader *s,
+                                    enum pipe_format target_formats[])
 {
    assert(s->info.stage == MESA_SHADER_VERTEX);
 
diff --git a/src/microsoft/compiler/meson.build b/src/microsoft/compiler/meson.build
index f96b47562c0..5f4e3432d4c 100644
--- a/src/microsoft/compiler/meson.build
+++ b/src/microsoft/compiler/meson.build
@@ -29,6 +29,7 @@ files_libdxil_compiler = files(
   'dxil_nir.c',
   'dxil_nir_lower_int_cubemaps.c',
   'dxil_nir_lower_int_samplers.c',
+  'dxil_nir_lower_vs_vertex_conversion.c',
   'dxil_signature.c',
   'dxil_nir_tess.c',
   'nir_to_dxil.c',



More information about the mesa-commit mailing list