glsl/nir: fetch the type for images from the deref instruction
authorKarol Herbst <kherbst@redhat.com>
Thu, 28 Mar 2019 22:47:07 +0000 (23:47 +0100)
committerKarol Herbst <kherbst@redhat.com>
Fri, 12 Apr 2019 07:02:59 +0000 (09:02 +0200)
fixes retrieving the sampler type for bindless images stored inside structs.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/glsl_to_nir.cpp

index 89edaa41d27fc9e9e41a09f2cdf06c3561f29907..6c42bd9f5ac334a255e87d54ffd5b1a861493248 100644 (file)
@@ -1208,10 +1208,10 @@ nir_visitor::visit(ir_call *ir)
          /* Set the image variable dereference. */
          exec_node *param = ir->actual_parameters.get_head();
          ir_dereference *image = (ir_dereference *)param;
-         const glsl_type *type =
-            image->variable_referenced()->type->without_array();
+         nir_deref_instr *deref = evaluate_deref(image);
+         const glsl_type *type = deref->type;
 
-         instr->src[0] = nir_src_for_ssa(&evaluate_deref(image)->dest.ssa);
+         instr->src[0] = nir_src_for_ssa(&deref->dest.ssa);
          param = param->get_next();
 
          /* Set the intrinsic destination. */