From da4c4c0e6785d48b6aa053766e73e80df292ce82 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 26 Aug 2020 12:14:42 -0700 Subject: [PATCH] gallium/ntt: Add default compiler options for non-native-NIR drivers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For using NIR internally in mesa/st, we need some compiler options. This is the options wrote for softpipe, which should be enough for whatever NTT we do. Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/nir/nir_to_tgsi.c | 26 +++++++++++++++++++++++++ src/gallium/auxiliary/nir/nir_to_tgsi.h | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index ce4f5e7aba3..231192792c1 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -2645,3 +2645,29 @@ nir_to_tgsi(struct nir_shader *s, return tgsi_tokens; } + +static const nir_shader_compiler_options nir_to_tgsi_compiler_options = { + .fuse_ffma32 = true, + .fuse_ffma64 = true, + .lower_extract_byte = true, + .lower_extract_word = true, + .lower_fdph = true, + .lower_flrp64 = true, + .lower_fmod = true, + .lower_rotate = true, + .lower_sub = true, + .lower_vector_cmp = true, + .use_interpolated_input_intrinsics = true, +}; + +/* Returns a default compiler options for drivers with only nir-to-tgsi-based + * NIR support. + */ +const void * +nir_to_tgsi_get_compiler_options(struct pipe_screen *pscreen, + enum pipe_shader_ir ir, + unsigned shader) +{ + assert(ir == PIPE_SHADER_IR_NIR); + return &nir_to_tgsi_compiler_options; +} diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.h b/src/gallium/auxiliary/nir/nir_to_tgsi.h index e4cc044b839..73bb0ab896d 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.h +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.h @@ -30,4 +30,9 @@ struct pipe_screen; const void *nir_to_tgsi(struct nir_shader *s, struct pipe_screen *screen); +const void * +nir_to_tgsi_get_compiler_options(struct pipe_screen *pscreen, + enum pipe_shader_ir ir, + unsigned shader); + #endif /* NIR_TO_TGSI_H */