• Home
  • Raw
  • Download

Lines Matching refs:opts

101 static bool parse_cmdline(int argc, char *argv[], struct compiler_opts *opts)  in parse_cmdline()  argument
112 opts->dump_c_array = true; in parse_cmdline()
116 if (opts->entry) in parse_cmdline()
119 opts->entry = optarg; in parse_cmdline()
123 if (opts->file) in parse_cmdline()
126 opts->file = optarg; in parse_cmdline()
130 opts->dump_nir = true; in parse_cmdline()
134 if (opts->out_file) in parse_cmdline()
137 opts->out_file = optarg; in parse_cmdline()
141 opts->dump_rogue = true; in parse_cmdline()
145 if (opts->stage != MESA_SHADER_NONE) in parse_cmdline()
149 opts->stage = MESA_SHADER_FRAGMENT; in parse_cmdline()
151 opts->stage = MESA_SHADER_VERTEX; in parse_cmdline()
167 if (opts->stage == MESA_SHADER_NONE || !opts->file) { in parse_cmdline()
175 if (!opts->out_file) in parse_cmdline()
176 opts->out_file = "out.bin"; in parse_cmdline()
178 if (!opts->entry) in parse_cmdline()
179 opts->entry = "main"; in parse_cmdline()
188 struct compiler_opts opts = { .stage = MESA_SHADER_NONE, 0 }; in main() local
205 if (!parse_cmdline(argc, argv, &opts)) in main()
209 input_data = os_read_file(opts.file, &input_size); in main()
211 fprintf(stderr, "Failed to read file \"%s\".\n", opts.file); in main()
229 ctx->nir[opts.stage] = rogue_spirv_to_nir(ctx, in main()
230 opts.stage, in main()
231 opts.entry, in main()
236 if (!ctx->nir[opts.stage]) { in main()
242 if (opts.dump_nir) in main()
243 nir_print_shader(ctx->nir[opts.stage], stdout); in main()
246 ctx->rogue[opts.stage] = rogue_nir_to_rogue(ctx, ctx->nir[opts.stage]); in main()
247 if (!ctx->rogue[opts.stage]) { in main()
253 if (opts.dump_rogue) in main()
254 rogue_dump_shader(ctx->rogue[opts.stage], stdout); in main()
257 ctx->binary[opts.stage] = rogue_to_binary(ctx, ctx->rogue[opts.stage]); in main()
258 if (!ctx->binary[opts.stage]) { in main()
264 if (opts.dump_c_array) { in main()
265 printf("uint8_t shader_bytes[%zu] = {", ctx->binary[opts.stage]->size); in main()
266 for (size_t u = 0U; u < ctx->binary[opts.stage]->size; ++u) { in main()
270 printf("0x%02x, ", ctx->binary[opts.stage]->data[u]); in main()
276 fp = fopen(opts.out_file, "wb"); in main()
278 fprintf(stderr, "Failed to open output file \"%s\".\n", opts.out_file); in main()
282 bytes_written = fwrite(ctx->binary[opts.stage]->data, in main()
284 ctx->binary[opts.stage]->size, in main()
286 if (bytes_written != ctx->binary[opts.stage]->size) { in main()
290 opts.out_file, in main()
292 ctx->binary[opts.stage]->size); in main()