nir/lower_io: Separate driver_location and base offset for uniforms
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 18 Aug 2015 18:20:40 +0000 (11:20 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 25 Aug 2015 17:18:27 +0000 (10:18 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir_lower_io.c

index 15a4edc90a983b5e2bbe59dc71c82057842a5865..70645b652467ef1ce22b4c6b266e72684ccf383f 100644 (file)
@@ -244,9 +244,14 @@ nir_lower_io_block(nir_block *block, void *void_state)
          nir_src indirect;
          unsigned offset = get_io_offset(intrin->variables[0],
                                          &intrin->instr, &indirect, state);
-         offset += intrin->variables[0]->var->data.driver_location;
 
-         load->const_index[0] = offset;
+         unsigned location = intrin->variables[0]->var->data.driver_location;
+         if (mode == nir_var_uniform) {
+            load->const_index[0] = location;
+            load->const_index[1] = offset;
+         } else {
+            load->const_index[0] = location + offset;
+         }
 
          if (has_indirect)
             load->src[0] = indirect;