From 6d9b45171d78b0f4a22324a77431679263b35ad8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 May 2019 17:06:47 -0700 Subject: [PATCH] freedreno: Remove the ir3_tgsi_to_nir() helper function. It was more of a hindrance, as it pretended that we could compile in the driver with a missing screen. Reviewed-by: Rob Clark Tested-by: Eduardo Lima Mitev --- .../drivers/freedreno/ir3/ir3_cmdline.c | 5 ++++- .../drivers/freedreno/ir3/ir3_gallium.c | 18 ++---------------- .../drivers/freedreno/ir3/ir3_gallium.h | 3 --- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 1481c08df14..d45f5afec8b 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -33,6 +33,7 @@ #include #include +#include "nir/tgsi_to_nir.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_text.h" #include "tgsi/tgsi_dump.h" @@ -452,6 +453,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) { @@ -468,7 +471,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, NULL); + 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); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index e605e531ecb..98db2bfa75c 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -133,7 +133,7 @@ ir3_shader_create(struct ir3_compiler *compiler, if (ir3_shader_debug & IR3_DBG_DISASM) { tgsi_dump(cso->tokens, 0); } - nir = ir3_tgsi_to_nir(compiler, cso->tokens, screen); + nir = tgsi_to_nir(cso->tokens, screen); } struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir); @@ -170,7 +170,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, if (ir3_shader_debug & IR3_DBG_DISASM) { tgsi_dump(cso->prog, 0); } - nir = ir3_tgsi_to_nir(compiler, cso->prog, screen); + nir = tgsi_to_nir(cso->prog, screen); } struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir); @@ -178,20 +178,6 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, return shader; } -struct nir_shader * -ir3_tgsi_to_nir(struct ir3_compiler *compiler, - const struct tgsi_token *tokens, - struct pipe_screen *screen) -{ - if (!screen) { - const nir_shader_compiler_options *options = - ir3_get_compiler_options(compiler); - return tgsi_to_nir_noscreen(tokens, options); - } - - return tgsi_to_nir(tokens, screen); -} - /* This has to reach into the fd_context a bit more than the rest of * ir3, but it needs to be aligned with the compiler, so both agree * on which const regs hold what. And the logic is identical between diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h index 74f03e651ff..902a5c3a18c 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h @@ -43,9 +43,6 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key, bool binning_pass, struct pipe_debug_callback *debug); -struct nir_shader * ir3_tgsi_to_nir(struct ir3_compiler *compiler, - const struct tgsi_token *tokens, - struct pipe_screen *screen); struct fd_ringbuffer; struct fd_context; -- 2.30.2