[Mesa-dev] [PATCH 2/2] nir/lower-atomics-to-ssbo: remove atomic_uint arrays too

Rob Clark robdclark at gmail.com
Mon May 15 20:06:38 UTC 2017


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 <robdclark at gmail.com>
---
Are there any other cases?  If atomic_uint is an opaque type, I'm not
sure how it could appear in a struct..

 src/compiler/nir/nir_lower_atomics_to_ssbo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
index cd69de2..fd8e84f 100644
--- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -189,7 +189,9 @@ 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 ((glsl_get_base_type(var->type) == GLSL_TYPE_ATOMIC_UINT) ||
+             ((glsl_get_base_type(var->type) == GLSL_TYPE_ARRAY) &&
+              (glsl_get_base_type(glsl_get_array_element(var->type)) == GLSL_TYPE_ATOMIC_UINT))) {
             exec_node_remove(&var->node);
 
             if (replaced & (1 << var->data.binding))
-- 
2.9.3



More information about the mesa-dev mailing list