summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-19 10:53:45 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:54:00 -0700
commit75286c2d083cdbdfb202a93349e567df0441d5f7 (patch)
tree1f94a06a9bb13fadef18039b4ef4de1b8bd863d0 /src/compiler/glsl/glsl_to_nir.cpp
parent36efae1d6647a0495fc368bda9e6d2c14b81f482 (diff)
nir: Use derefs in nir_lower_samplers
We change glsl_to_nir to provide derefs for bot textures and samplers while we're at it. This makes the lowering much easier since we only either replace sources or remove them. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_to_nir.cpp')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index b2dbaf89d44..d3a3fb9b085 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -2010,7 +2010,7 @@ nir_visitor::visit(ir_texture *ir)
num_srcs++;
/* Add one for the texture deref */
- num_srcs += 1;
+ num_srcs += 2;
nir_tex_instr *instr = nir_tex_instr_create(this->shader, num_srcs);
@@ -2039,8 +2039,10 @@ nir_visitor::visit(ir_texture *ir)
nir_deref_instr *sampler_deref = evaluate_deref(ir->sampler);
instr->src[0].src = nir_src_for_ssa(&sampler_deref->dest.ssa);
instr->src[0].src_type = nir_tex_src_texture_deref;
+ instr->src[1].src = nir_src_for_ssa(&sampler_deref->dest.ssa);
+ instr->src[1].src_type = nir_tex_src_sampler_deref;
- unsigned src_number = 1;
+ unsigned src_number = 2;
if (ir->coordinate != NULL) {
instr->coord_components = ir->coordinate->type->vector_elements;