[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:53:41 UTC 2017
On Mon, May 15, 2017 at 4:06 PM, Rob Clark <robdclark at gmail.com> wrote:
> 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..
well, duh, there are also arrays of arrays of atomic_uint..
(but still assuming it cannot involve structs..)
> 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