" -p, --platform <name> Specify the target platform name.\n"
" --prefix <prefix> Prefix for variable names in generated C code.\n"
" -g, --out <filename> Specify the output filename.\n"
+" -s, --spv <filename> Specify the output filename for spirv.\n"
, exec_name);
}
{"prefix", required_argument, 0, OPT_PREFIX},
{"in", required_argument, 0, 'i'},
{"out", required_argument, 0, 'o'},
+ {"spv", required_argument, 0, 's'},
{0, 0, 0, 0}
};
- char *entry_point = NULL, *platform = NULL, *outfile = NULL, *prefix = NULL;
+ char *entry_point = NULL, *platform = NULL, *outfile = NULL, *spv_outfile = NULL, *prefix = NULL;
struct util_dynarray clang_args;
struct util_dynarray input_files;
struct util_dynarray spirv_objs;
util_dynarray_init(&spirv_ptr_objs, mem_ctx);
int ch;
- while ((ch = getopt_long(argc, argv, "he:p:o:", long_options, NULL)) != -1)
+ while ((ch = getopt_long(argc, argv, "he:p:s:o:", long_options, NULL)) != -1)
{
switch (ch)
{
case 'o':
outfile = optarg;
break;
+ case 's':
+ spv_outfile = optarg;
+ break;
case OPT_PREFIX:
prefix = optarg;
break;
return 1;
}
+ if (spv_outfile) {
+ FILE *fp = fopen(spv_outfile, "w");
+ fwrite(final_spirv.data, final_spirv.size, 1, fp);
+ fclose(fp);
+ }
+
struct clc_parsed_spirv parsed_spirv_data;
if (!clc_parse_spirv(&final_spirv, &logger, &parsed_spirv_data)) {
ralloc_free(mem_ctx);