diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-22 02:49:53 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-22 02:49:53 +0000 |
commit | d264279e28002d81821c883795911844a4c01a2c (patch) | |
tree | b0481616eda55b543a0dc1487d096c3239885c41 /lib/mesa/src/gallium/drivers/freedreno/ir3 | |
parent | fdcc03929065b5bf5dd93553db219ea3e05c8c34 (diff) |
Merge Mesa 19.2.8
Diffstat (limited to 'lib/mesa/src/gallium/drivers/freedreno/ir3')
-rw-r--r-- | lib/mesa/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/mesa/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/lib/mesa/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 364e62b30..246bafdf4 100644 --- a/lib/mesa/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/lib/mesa/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -33,6 +33,7 @@ #include <stdio.h> #include <err.h> +#include "nir/tgsi_to_nir.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_text.h" #include "tgsi/tgsi_dump.h" @@ -43,12 +44,16 @@ #include "ir3/instr-a3xx.h" #include "ir3/ir3.h" +#include "main/mtypes.h" + #include "compiler/glsl/standalone.h" #include "compiler/glsl/glsl_to_nir.h" #include "compiler/glsl/gl_nir.h" #include "compiler/nir_types.h" #include "compiler/spirv/nir_spirv.h" +#include "pipe/p_context.h" + static void dump_info(struct ir3_shader_variant *so, const char *str) { uint32_t *bin; @@ -108,12 +113,13 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage) struct gl_shader_program *prog; const nir_shader_compiler_options *nir_options = ir3_get_compiler_options(compiler); + static struct gl_context local_ctx; - prog = standalone_compile_shader(&options, num_files, files); + prog = standalone_compile_shader(&options, num_files, files, &local_ctx); if (!prog) errx(1, "couldn't parse `%s'", files[0]); - nir_shader *nir = glsl_to_nir(prog, stage, nir_options); + nir_shader *nir = glsl_to_nir(&local_ctx, prog, stage, nir_options); /* required NIR passes: */ if (nir_options->lower_all_io_to_temps || @@ -176,6 +182,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage) ir3_glsl_type_size); NIR_PASS_V(nir, nir_lower_system_values); + NIR_PASS_V(nir, nir_lower_frexp); NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, 0); NIR_PASS_V(nir, gl_nir_lower_samplers, prog); @@ -229,27 +236,26 @@ load_spirv(const char *filename, const char *entry, gl_shader_stage stage) .int64 = true, .variable_pointers = true, }, - .lower_workgroup_access_to_offsets = true, .lower_ubo_ssbo_access_to_offsets = true, .debug = { .func = debug_func, } }; - nir_function *entry_point; + nir_shader *nir; void *buf; size_t size; read_file(filename, &buf, &size); - entry_point = spirv_to_nir(buf, size / 4, + nir = spirv_to_nir(buf, size / 4, NULL, 0, /* spec_entries */ stage, entry, &spirv_options, ir3_get_compiler_options(compiler)); - nir_print_shader(entry_point->shader, stdout); + nir_print_shader(nir, stdout); - return entry_point->shader; + return nir; } static void print_usage(void) @@ -446,6 +452,8 @@ int main(int argc, char **argv) if (s.from_tgsi) { struct tgsi_token toks[65536]; + const nir_shader_compiler_options *nir_options = + ir3_get_compiler_options(compiler); ret = read_file(filenames[0], &ptr, &size); if (ret) { @@ -462,7 +470,7 @@ int main(int argc, char **argv) if (ir3_shader_debug & IR3_DBG_OPTMSGS) tgsi_dump(toks, 0); - nir = ir3_tgsi_to_nir(compiler, toks); + nir = tgsi_to_nir_noscreen(toks, nir_options); NIR_PASS_V(nir, nir_lower_global_vars_to_local); } else if (from_spirv) { nir = load_spirv(filenames[0], entry, stage); @@ -481,7 +489,9 @@ int main(int argc, char **argv) } s.compiler = compiler; - s.nir = ir3_optimize_nir(&s, nir, NULL); + s.nir = nir; + + ir3_optimize_nir(&s, nir, NULL); v.key = key; v.shader = &s; |