Mesa (main): microsoft/spirv2dxil: Add a debug option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 15:57:26 UTC 2022


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Tue Jun  7 01:57:59 2022 -0700

microsoft/spirv2dxil: Add a debug option

So we can dump NIR shaders.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16221>

---

 src/microsoft/spirv_to_dxil/spirv2dxil.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/microsoft/spirv_to_dxil/spirv2dxil.c b/src/microsoft/spirv_to_dxil/spirv2dxil.c
index ded6bcbf406..e590034be95 100644
--- a/src/microsoft/spirv_to_dxil/spirv2dxil.c
+++ b/src/microsoft/spirv_to_dxil/spirv2dxil.c
@@ -69,17 +69,18 @@ main(int argc, char **argv)
    char *entry_point = "main";
    char *output_file = "";
    int ch;
-   bool validate = false;
+   bool validate = false, debug = false;
    
    static struct option long_options[] = {
       {"stage", required_argument, 0, 's'},
       {"entry", required_argument, 0, 'e'},
       {"output", required_argument, 0, 'o'},
       {"validate", no_argument, 0, 'v'},
+      {"debug", no_argument, 0, 'd'},
       {0, 0, 0, 0}};
 
 
-   while ((ch = getopt_long(argc, argv, "s:e:o:v", long_options, NULL)) !=
+   while ((ch = getopt_long(argc, argv, "s:e:o:vd", long_options, NULL)) !=
           -1) {
       switch(ch)
       {
@@ -99,6 +100,9 @@ main(int argc, char **argv)
       case 'v':
          validate = true;
          break;
+      case 'd':
+         debug = true;
+         break;
       default:
          fprintf(stderr, "Unrecognized option.\n");
          return 1;
@@ -136,7 +140,7 @@ main(int argc, char **argv)
    conf.zero_based_vertex_instance_id = true;
 
    struct dxil_spirv_debug_options dbg_opts = {
-      .dump_nir = false,
+      .dump_nir = debug,
    };
 
    struct dxil_spirv_object obj;



More information about the mesa-commit mailing list