Module: Mesa
Branch: master
Commit: 4fe0339941d8fa44a55ed3deb34e0ec5e529615a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fe0339941d8fa44a55ed3deb34e0ec5e529615a

Author: Gert Wollny <[email protected]>
Date:   Fri Feb 26 21:11:44 2021 +0100

r600: unify nir shader options evaluation

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330>

---

 src/gallium/drivers/r600/r600_pipe_common.c | 96 +++++++++++------------------
 src/gallium/drivers/r600/r600_pipe_common.h |  4 ++
 2 files changed, 40 insertions(+), 60 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe_common.c 
b/src/gallium/drivers/r600/r600_pipe_common.c
index d8918806d95..02a1165b809 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -27,7 +27,6 @@
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "tgsi/tgsi_parse.h"
-#include "compiler/nir/nir.h"
 #include "util/list.h"
 #include "util/u_draw_quad.h"
 #include "util/u_memory.h"
@@ -1170,70 +1169,16 @@ struct pipe_resource 
*r600_resource_create_common(struct pipe_screen *screen,
        }
 }
 
-const struct nir_shader_compiler_options r600_nir_fs_options = {
-       .fuse_ffma16 = true,
-       .fuse_ffma32 = true,
-       .fuse_ffma64 = true,
-       .lower_scmp = true,
-       .lower_flrp32 = true,
-       .lower_flrp64 = true,
-       .lower_fpow = true,
-       .lower_fdiv = true,
-        .lower_isign = true,
-        .lower_fsign = true,
-       .lower_fmod = true,
-       .lower_doubles_options = nir_lower_fp64_full_software,
-       .lower_int64_options = ~0,
-       .lower_extract_byte = true,
-       .lower_extract_word = true,
-        .lower_rotate = true,
-       .max_unroll_iterations = 32,
-       .lower_interpolate_at = true,
-       .vectorize_io = true,
-       .has_umad24 = true,
-       .has_umul24 = true,
-       .use_interpolated_input_intrinsics = true,
-       .has_fsub = true,
-       .has_isub = true,
-       .lower_iabs = true,
-};
-
-const struct nir_shader_compiler_options r600_nir_options = {
-       .fuse_ffma16 = true,
-       .fuse_ffma32 = true,
-       .fuse_ffma64 = true,
-       .lower_scmp = true,
-       .lower_flrp32 = true,
-       .lower_flrp64 = true,
-       .lower_fpow = true,
-       .lower_fdiv = true,
-       .lower_fmod = true,
-       .lower_doubles_options = nir_lower_fp64_full_software,
-       .lower_int64_options = ~0,
-       .lower_extract_byte = true,
-       .lower_extract_word = true,
-        .lower_rotate = true,
-       .max_unroll_iterations = 32,
-       .vectorize_io = true,
-       .has_umad24 = true,
-       .has_umul24 = true,
-       .has_fsub = true,
-       .has_isub = true,
-       .lower_iabs = true,
-       .lower_isign = true,
-};
-
-
 static const void *
 r600_get_compiler_options(struct pipe_screen *screen,
                          enum pipe_shader_ir ir,
                          enum pipe_shader_type shader)
 {
-       assert(ir == PIPE_SHADER_IR_NIR);
-       if (shader == PIPE_SHADER_FRAGMENT)
-          return &r600_nir_fs_options;
-       else
-          return &r600_nir_options;
+       assert(ir == PIPE_SHADER_IR_NIR);
+
+       struct r600_common_screen *rscreen = (struct r600_common_screen 
*)screen;
+
+       return &rscreen->nir_options;
 }
 
 bool r600_common_screen_init(struct r600_common_screen *rscreen,
@@ -1355,6 +1300,37 @@ bool r600_common_screen_init(struct r600_common_screen 
*rscreen,
                printf("enabled_rb_mask = 0x%x\n", 
rscreen->info.enabled_rb_mask);
                printf("max_alignment = %u\n", 
(unsigned)rscreen->info.max_alignment);
        }
+
+       const struct nir_shader_compiler_options nir_options = {
+               .fuse_ffma16 = true,
+               .fuse_ffma32 = true,
+               .fuse_ffma64 = true,
+               .lower_scmp = true, /* TODO: Should be checked */
+               .lower_flrp32 = true,
+               .lower_flrp64 = true,
+               .lower_fpow = true,
+               .lower_fdiv = true,
+               .lower_isign = true,
+               .lower_fsign = true,
+               .lower_fmod = true,
+               .lower_doubles_options = nir_lower_fp64_full_software,
+               .lower_int64_options = ~0,
+               .lower_extract_byte = true,
+               .lower_extract_word = true,
+               .lower_rotate = true,
+               .max_unroll_iterations = 32,
+               .lower_interpolate_at = true,
+               .vectorize_io = true,
+               .has_umad24 = true,
+               .has_umul24 = true,
+               .use_interpolated_input_intrinsics = true,
+               .has_fsub = true,
+               .has_isub = true,
+               .lower_iabs = true,
+       };
+
+       rscreen->nir_options = nir_options;
+
        return true;
 }
 
diff --git a/src/gallium/drivers/r600/r600_pipe_common.h 
b/src/gallium/drivers/r600/r600_pipe_common.h
index d8f1f9625af..b55a27d63f0 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.h
+++ b/src/gallium/drivers/r600/r600_pipe_common.h
@@ -45,6 +45,8 @@
 #include "util/u_transfer.h"
 #include "util/u_threaded_context.h"
 
+#include "compiler/nir/nir.h"
+
 struct u_log_context;
 #define ATI_VENDOR_ID 0x1002
 
@@ -404,6 +406,8 @@ struct r600_common_screen {
                 */
                unsigned compute_to_L2;
        } barrier_flags;
+
+        struct nir_shader_compiler_options nir_options;
 };
 
 /* This encapsulates a state or an operation which can emitted into the GPU

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to