[Mesa-dev] [PATCH 078/133] nir/lower_samplers: Use the nir_instr_rewrite_src function

Jason Ekstrand jason at jlekstrand.net
Mon Dec 15 22:11:23 PST 2014


---
 src/glsl/nir/nir_lower_samplers.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_lower_samplers.cpp b/src/glsl/nir/nir_lower_samplers.cpp
index e10456d..347c84a 100644
--- a/src/glsl/nir/nir_lower_samplers.cpp
+++ b/src/glsl/nir/nir_lower_samplers.cpp
@@ -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;
    }
 }
-- 
2.2.0



More information about the mesa-dev mailing list