glsl: reset next_image_index count for each shader stage
authorTimothy Arceri <tarceri@itsqueeze.com>
Sun, 9 Feb 2020 22:19:44 +0000 (09:19 +1100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Feb 2020 23:48:46 +0000 (23:48 +0000)
This fixes the image index calculation in the nir linker. We need
to reset the counter to 0 for each shader stage not each program.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3992>

src/compiler/glsl/gl_nir_link_uniforms.c

index 7249829c564197936b2a21028f6366036b10cf9e..8c55b9a2dc1c829850114862504d081c74182003 100644 (file)
@@ -245,9 +245,9 @@ struct nir_link_uniforms_state {
    unsigned num_values;
    unsigned max_uniform_location;
    unsigned next_sampler_index;
-   unsigned next_image_index;
 
    /* per-shader stage */
+   unsigned next_image_index;
    unsigned num_shader_samplers;
    unsigned num_shader_images;
    unsigned num_shader_uniform_components;
@@ -706,6 +706,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
       nir_shader *nir = sh->Program->nir;
       assert(nir);
 
+      state.next_image_index = 0;
       state.num_shader_samplers = 0;
       state.num_shader_images = 0;
       state.num_shader_uniform_components = 0;