summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-05-15 15:53:12 -0400
committerRob Clark <[email protected]>2017-05-23 12:26:34 -0400
commit6f65a1a211929875fb0cff56e876a7497f95252a (patch)
treeb163bf2fec1ae3fcd44149334223db60ef286f79
parent5f6c034f82ccc37a0fe2739ee7ebe20ec248c889 (diff)
nir/lower-atomics-to-ssbo: remove atomic_uint arrays too
Maybe there is a better way to do this. But by the time we get to assigning uniform locs, we want the atomic_uint's to all be gone, otherwise we assert in st_glsl_attrib_type_size(). Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/compiler/nir/nir_lower_atomics_to_ssbo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
index 23583fde373..fd6eefb1fd0 100644
--- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -163,6 +163,14 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
return true;
}
+static bool
+is_atomic_uint(const struct glsl_type *type)
+{
+ if (glsl_get_base_type(type) == GLSL_TYPE_ARRAY)
+ return is_atomic_uint(glsl_get_array_element(type));
+ return glsl_get_base_type(type) == GLSL_TYPE_ATOMIC_UINT;
+}
+
bool
nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset)
{
@@ -189,7 +197,7 @@ nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset)
/* replace atomic_uint uniforms with ssbo's: */
unsigned replaced = 0;
nir_foreach_variable_safe(var, &shader->uniforms) {
- if (glsl_get_base_type(var->type) == GLSL_TYPE_ATOMIC_UINT) {
+ if (is_atomic_uint(var->type)) {
exec_node_remove(&var->node);
if (replaced & (1 << var->data.binding))