nir, intel: Move use_scoped_memory_barrier to nir_options
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 11 Jan 2020 00:25:02 +0000 (16:25 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Feb 2020 19:12:11 +0000 (19:12 +0000)
This option will be used later by GLSL, so move to a common struct.

Because nir_options is filled in the compiler instead of the Vulkan
driver, fix that up.  GLSL will ignore that for now.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3913>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3913>

src/compiler/nir/nir.h
src/compiler/spirv/nir_spirv.h
src/compiler/spirv/spirv_to_nir.c
src/intel/compiler/brw_compiler.c
src/intel/vulkan/anv_pipeline.c

index 9591285f28f397c3fb7214f5061eb4567f1372ef..1547bf0c6417bf2e21b8f386fa55e340b2ab1cba 100644 (file)
@@ -2921,6 +2921,11 @@ typedef struct nir_shader_compiler_options {
     */
    bool has_imul24;
 
+   /* Whether to generate only scoped_memory_barrier intrinsics instead of the
+    * set of memory barrier intrinsics based on GLSL.
+    */
+   bool use_scoped_memory_barrier;
+
    /**
     * Is this the Intel vec4 backend?
     *
index 81175ebf022365120718cbce23d46e609a9d1f58..37fbf351bc9b9a7133034a81b04ad86f01edb190 100644 (file)
@@ -67,11 +67,6 @@ struct spirv_to_nir_options {
     */
    bool frag_coord_is_sysval;
 
-   /* Whether to generate only scoped_memory_barrier intrinsics instead of the
-    * set of memory barrier intrinsics based on GLSL.
-    */
-   bool use_scoped_memory_barrier;
-
    struct spirv_supported_capabilities caps;
 
    /* Address format for various kinds of pointers. */
index fa39116804353121010fdcf9d6149e005d0355bd..5ee75877e8b10f9f2d583e17d4cd3f951899bc68 100644 (file)
@@ -3576,7 +3576,7 @@ void
 vtn_emit_memory_barrier(struct vtn_builder *b, SpvScope scope,
                         SpvMemorySemanticsMask semantics)
 {
-   if (b->options->use_scoped_memory_barrier) {
+   if (b->shader->options->use_scoped_memory_barrier) {
       vtn_emit_scoped_memory_barrier(b, scope, semantics);
       return;
    }
index 3d0bec30dcf1f8cf8816fd8fc5d92a667b875b46..20f32b552c08afeca24123b2eddebe30fe765c49 100644 (file)
@@ -47,7 +47,8 @@
    .vectorize_io = true,                                                      \
    .use_interpolated_input_intrinsics = true,                                 \
    .vertex_id_zero_based = true,                                              \
-   .lower_base_vertex = true
+   .lower_base_vertex = true,                                                 \
+   .use_scoped_memory_barrier = true
 
 #define COMMON_SCALAR_OPTIONS                                                 \
    .lower_to_scalar = true,                                                   \
index 2dbb2eac0a7345fc91589f25d1912868946461c8..e6bd5f903f8eecb35838a00e102644daf3ee95d9 100644 (file)
@@ -160,7 +160,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
    };
    struct spirv_to_nir_options spirv_options = {
       .frag_coord_is_sysval = true,
-      .use_scoped_memory_barrier = true,
       .caps = {
          .demote_to_helper_invocation = true,
          .derivative_group = true,