From 9368641c3f4c1bd861fa6cfc00f5f6c3503c0eed Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Tue, 7 Jun 2022 01:57:59 -0700 Subject: [PATCH] microsoft/spirv2dxil: Add a debug option So we can dump NIR shaders. Reviewed-by: Jesse Natalie Part-of: --- 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;