nir: Allow SSBOs and global to alias
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Jan 2019 22:47:46 +0000 (16:47 -0600)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 26 Jan 2019 19:41:50 +0000 (13:41 -0600)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/nir/nir_deref.c

index 513e824..2f5fda6 100644 (file)
@@ -293,7 +293,12 @@ nir_fixup_deref_modes(nir_shader *shader)
 static bool
 modes_may_alias(nir_variable_mode a, nir_variable_mode b)
 {
-   /* Two pointers can only alias if they have the same mode.
+   /* Generic pointers can alias with SSBOs */
+   if ((a == nir_var_mem_ssbo || a == nir_var_mem_global) &&
+       (b == nir_var_mem_ssbo || b == nir_var_mem_global))
+      return true;
+
+   /* In the general case, pointers can only alias if they have the same mode.
     *
     * NOTE: In future, with things like OpenCL generic pointers, this may not
     * be true and will have to be re-evaluated.  However, with graphics only,