From 06d7648f116b031882ad7ec90c10a8d9ebc83f27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 3 May 2020 19:38:51 -0400 Subject: [PATCH] radeonsi: move nir_shader_compiler_options into si_screen so that they can be different depending on the GPU (for 16-bit support) Reviewed-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/gallium/drivers/radeonsi/si_get.c | 57 ++++++++++++++------------ src/gallium/drivers/radeonsi/si_pipe.h | 1 + 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 45ccfaa964e..059bd8d00e8 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -450,37 +450,13 @@ static int si_get_shader_param(struct pipe_screen *pscreen, enum pipe_shader_typ return 0; } -static const struct nir_shader_compiler_options nir_options = { - .lower_scmp = true, - .lower_flrp32 = true, - .lower_flrp64 = true, - .lower_fsat = true, - .lower_fdiv = true, - .lower_bitfield_insert_to_bitfield_select = true, - .lower_bitfield_extract = true, - .lower_sub = true, - .fuse_ffma = true, - .lower_fmod = true, - .lower_pack_snorm_4x8 = true, - .lower_pack_unorm_4x8 = true, - .lower_unpack_snorm_2x16 = true, - .lower_unpack_snorm_4x8 = true, - .lower_unpack_unorm_2x16 = true, - .lower_unpack_unorm_4x8 = true, - .lower_extract_byte = true, - .lower_extract_word = true, - .lower_rotate = true, - .lower_to_scalar = true, - .optimize_sample_mask_in = true, - .max_unroll_iterations = 32, - .use_interpolated_input_intrinsics = true, -}; - static const void *si_get_compiler_options(struct pipe_screen *screen, enum pipe_shader_ir ir, enum pipe_shader_type shader) { + struct si_screen *sscreen = (struct si_screen *)screen; + assert(ir == PIPE_SHADER_IR_NIR); - return &nir_options; + return &sscreen->nir_options; } static void si_get_driver_uuid(struct pipe_screen *pscreen, char *uuid) @@ -951,4 +927,31 @@ void si_init_screen_get_functions(struct si_screen *sscreen) } si_init_renderer_string(sscreen); + + const struct nir_shader_compiler_options nir_options = { + .lower_scmp = true, + .lower_flrp32 = true, + .lower_flrp64 = true, + .lower_fsat = true, + .lower_fdiv = true, + .lower_bitfield_insert_to_bitfield_select = true, + .lower_bitfield_extract = true, + .lower_sub = true, + .fuse_ffma = true, + .lower_fmod = true, + .lower_pack_snorm_4x8 = true, + .lower_pack_unorm_4x8 = true, + .lower_unpack_snorm_2x16 = true, + .lower_unpack_snorm_4x8 = true, + .lower_unpack_unorm_2x16 = true, + .lower_unpack_unorm_4x8 = true, + .lower_extract_byte = true, + .lower_extract_word = true, + .lower_rotate = true, + .lower_to_scalar = true, + .optimize_sample_mask_in = true, + .max_unroll_iterations = 32, + .use_interpolated_input_intrinsics = true, + }; + sscreen->nir_options = nir_options; } diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index cbef8667e9d..94103919fd4 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -490,6 +490,7 @@ struct si_screen { struct disk_cache *disk_shader_cache; struct radeon_info info; + struct nir_shader_compiler_options nir_options; uint64_t debug_flags; char renderer_string[183]; -- 2.30.2