microsoft/spirv2dxil: Add a debug option

So we can dump NIR shaders.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16221>
This commit is contained in:
Boris Brezillon 2022-06-07 01:57:59 -07:00 committed by Marge Bot
parent 447d448513
commit 9368641c3f
1 changed files with 7 additions and 3 deletions

View File

@ -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;