mesa/st/nir: assign driver_location for images
authorRob Clark <robdclark@gmail.com>
Fri, 3 Nov 2017 16:47:51 +0000 (12:47 -0400)
committerRob Clark <robdclark@gmail.com>
Sun, 12 Nov 2017 17:28:59 +0000 (12:28 -0500)
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 1912da2404a3546a5250c36dbdec0fce101fe804..dd4b05d7b9786f9c39c83e2b021b12a9b545f42b 100644 (file)
@@ -176,6 +176,7 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
 {
    int max = 0;
    int shaderidx = 0;
+   int imageidx = 0;
 
    nir_foreach_variable(uniform, uniform_list) {
       int loc;
@@ -188,10 +189,13 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
           uniform->interface_type != NULL)
          continue;
 
-      if (uniform->type->is_sampler()) {
+      if (uniform->type->is_sampler() || uniform->type->is_image()) {
          unsigned val = 0;
          bool found = shader_program->UniformHash->get(val, uniform->name);
-         loc = shaderidx++;
+         if (uniform->type->is_sampler())
+            loc = shaderidx++;
+         else
+            loc = imageidx++;
          assert(found);
          (void) found; /* silence unused var warning */
          /* this ensure that nir_lower_samplers looks at the correct