<div dir="ltr">This seems reasonable.  However, I'd like to ask that you land patch 5 ASAP and wait a little while on landing this one.  Having a at least couple weeks with the rename but without adding back in nir_var_global with a different meaning will increase the liklihood that merge conflicts will result in compile errors rather than weird silent failures.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 12:27 PM Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>><br>
---<br>
 src/compiler/nir/nir.c             | 4 ++++<br>
 src/compiler/nir/nir.h             | 1 +<br>
 src/compiler/nir/nir_print.c       | 2 ++<br>
 src/compiler/spirv/vtn_private.h   | 1 +<br>
 src/compiler/spirv/vtn_variables.c | 4 ++++<br>
 5 files changed, 12 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c<br>
index 45c4a3e8375..7f16200015f 100644<br>
--- a/src/compiler/nir/nir.c<br>
+++ b/src/compiler/nir/nir.c<br>
@@ -129,6 +129,10 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)<br>
       assert(!"nir_shader_add_variable cannot be used for local variables");<br>
       break;<br>
<br>
+   case nir_var_global:<br>
+      assert(!"nir_shader_add_variable cannot be used for global memory");<br>
+      break;<br>
+<br>
    case nir_var_private:<br>
       exec_list_push_tail(&shader->globals, &var->node);<br>
       break;<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 30d22fb9d7d..e9f8f15d387 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -103,6 +103,7 @@ typedef enum {<br>
    nir_var_shader_storage  = (1 << 5),<br>
    nir_var_system_value    = (1 << 6),<br>
    nir_var_shared          = (1 << 8),<br>
+   nir_var_global          = (1 << 9),<br>
    nir_var_all             = ~0,<br>
 } nir_variable_mode;<br>
<br>
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c<br>
index 1d409b1da7b..f509c92e0cd 100644<br>
--- a/src/compiler/nir/nir_print.c<br>
+++ b/src/compiler/nir/nir_print.c<br>
@@ -413,6 +413,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)<br>
       return want_local_global_mode ? "private" : "";<br>
    case nir_var_function:<br>
       return want_local_global_mode ? "function" : "";<br>
+   case nir_var_global:<br>
+      return want_local_global_mode ? "global" : "";<br>
    default:<br>
       return "";<br>
    }<br>
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h<br>
index b84ac2cf0b4..e380d8e82ff 100644<br>
--- a/src/compiler/spirv/vtn_private.h<br>
+++ b/src/compiler/spirv/vtn_private.h<br>
@@ -417,6 +417,7 @@ enum vtn_variable_mode {<br>
    vtn_variable_mode_ssbo,<br>
    vtn_variable_mode_push_constant,<br>
    vtn_variable_mode_workgroup,<br>
+   vtn_variable_mode_cross_workgroup,<br>
    vtn_variable_mode_input,<br>
    vtn_variable_mode_output,<br>
 };<br>
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c<br>
index b911b114b70..5bf407eb8a7 100644<br>
--- a/src/compiler/spirv/vtn_variables.c<br>
+++ b/src/compiler/spirv/vtn_variables.c<br>
@@ -1582,6 +1582,9 @@ vtn_storage_class_to_mode(struct vtn_builder *b,<br>
       nir_mode = nir_var_uniform;<br>
       break;<br>
    case SpvStorageClassCrossWorkgroup:<br>
+      mode = vtn_variable_mode_cross_workgroup;<br>
+      nir_mode = nir_var_global;<br>
+      break;<br>
    case SpvStorageClassGeneric:<br>
    default:<br>
       vtn_fail("Unhandled variable storage class");<br>
@@ -1841,6 +1844,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,<br>
    case vtn_variable_mode_ubo:<br>
    case vtn_variable_mode_ssbo:<br>
    case vtn_variable_mode_push_constant:<br>
+   case vtn_variable_mode_cross_workgroup:<br>
       /* These don't need actual variables. */<br>
       break;<br>
    }<br>
-- <br>
2.19.2<br>
<br>
</blockquote></div>