radeonsi: move nir_shader_compiler_options into si_screen
authorMarek Olšák <marek.olsak@amd.com>
Sun, 3 May 2020 23:38:51 +0000 (19:38 -0400)
committerVivek Pandya <vivekvpandya@gmail.com>
Mon, 7 Sep 2020 15:55:15 +0000 (21:25 +0530)
so that they can be different depending on the GPU (for 16-bit support)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

src/gallium/drivers/radeonsi/si_get.c
src/gallium/drivers/radeonsi/si_pipe.h

index 45ccfaa964ec461077cb10a1592cd59f134f7fa5..059bd8d00e84622b16355747b34793bd0fcc1755 100644 (file)
@@ -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;
 }
index cbef8667e9de9c79a5ede8ae72d504eca80f0c03..94103919fd4232e992b224900d56276f554e8252 100644 (file)
@@ -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];