nir/lower_samplers: Use the nir_instr_rewrite_src function
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 14 Nov 2014 17:46:48 +0000 (09:46 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:19:01 +0000 (07:19 -0800)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_lower_samplers.cpp

index e10456db2302d6b9896cb6a0c35f3c7e39498eec..347c84adc9beb089d62f2d0297e6bd988e039226 100644 (file)
@@ -124,7 +124,16 @@ lower_sampler(nir_tex_instr *instr, struct gl_shader_program *shader_program,
 {
    if (instr->sampler) {
       instr->sampler_index = get_sampler_index(instr->sampler, shader_program,
-                                             prog);
+                                               prog);
+      nir_src empty_src;
+      memset(&empty_src, 0, sizeof empty_src);
+      for (nir_deref *deref = &instr->sampler->deref; deref; deref = deref->child) {
+         if (deref->deref_type == nir_deref_type_array) {
+            nir_deref_array *arr = nir_deref_as_array(deref);
+            nir_instr_rewrite_src(&instr->instr, &arr->indirect, empty_src);
+         }
+      }
+
       instr->sampler = NULL;
    }
 }