intel/compiler: Handle all indirect lowering choices in brw_nir.c
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 14 Jul 2020 20:19:59 +0000 (15:19 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 3 Sep 2020 14:26:49 +0000 (14:26 +0000)
Since everything flows through NIR and we're doing all of our indirect
deref lowering there now, there's no reason to keep making those
decisions in brw_compiler and stuffing them in the GLSL compiler
structs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5909>

src/intel/compiler/brw_compiler.c
src/intel/compiler/brw_nir.c

index a5b90e9b3c9e00b4db2c4f8eb7844bb923b5f3a6..4393e5dcd2a170df39d054bce4f1fa61d1751f5f 100644 (file)
@@ -162,13 +162,13 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
       compiler->glsl_compiler_options[i].MaxIfDepth =
          devinfo->gen < 6 ? 16 : UINT_MAX;
 
-      compiler->glsl_compiler_options[i].EmitNoIndirectInput = true;
+      /* We handle this in NIR */
+      compiler->glsl_compiler_options[i].EmitNoIndirectInput = false;
+      compiler->glsl_compiler_options[i].EmitNoIndirectOutput = false;
       compiler->glsl_compiler_options[i].EmitNoIndirectUniform = false;
+      compiler->glsl_compiler_options[i].EmitNoIndirectTemp = false;
 
       bool is_scalar = compiler->scalar_stage[i];
-
-      compiler->glsl_compiler_options[i].EmitNoIndirectOutput = is_scalar;
-      compiler->glsl_compiler_options[i].EmitNoIndirectTemp = is_scalar;
       compiler->glsl_compiler_options[i].OptimizeForAOS = !is_scalar;
 
       struct nir_shader_compiler_options *nir_options =
@@ -199,13 +199,6 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
       compiler->glsl_compiler_options[i].ClampBlockIndicesToArrayBounds = true;
    }
 
-   compiler->glsl_compiler_options[MESA_SHADER_TESS_CTRL].EmitNoIndirectInput = false;
-   compiler->glsl_compiler_options[MESA_SHADER_TESS_EVAL].EmitNoIndirectInput = false;
-   compiler->glsl_compiler_options[MESA_SHADER_TESS_CTRL].EmitNoIndirectOutput = false;
-
-   if (compiler->scalar_stage[MESA_SHADER_GEOMETRY])
-      compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].EmitNoIndirectInput = false;
-
    return compiler;
 }
 
index 4f1b56289c7cd2b73b44f02508e2ae5016b65931..ea71eb499e12af7242eba68faf76204e36e3157e 100644 (file)
@@ -472,13 +472,29 @@ static nir_variable_mode
 brw_nir_no_indirect_mask(const struct brw_compiler *compiler,
                          gl_shader_stage stage)
 {
+   const bool is_scalar = compiler->scalar_stage[stage];
    nir_variable_mode indirect_mask = 0;
 
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput)
+   switch (stage) {
+   case MESA_SHADER_VERTEX:
+   case MESA_SHADER_FRAGMENT:
       indirect_mask |= nir_var_shader_in;
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)
+      break;
+
+   case MESA_SHADER_GEOMETRY:
+      if (!is_scalar)
+         indirect_mask |= nir_var_shader_in;
+      break;
+
+   default:
+      /* Everything else can handle indirect inputs */
+      break;
+   }
+
+   if (is_scalar && stage != MESA_SHADER_TESS_CTRL)
       indirect_mask |= nir_var_shader_out;
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
+
+   if (is_scalar)
       indirect_mask |= nir_var_function_temp;
 
    return indirect_mask;