nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- if (intr->intrinsic == nir_intrinsic_load_deref) {
+
+ switch (intr->intrinsic) {
+ case nir_intrinsic_load_deref: {
nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
nir_variable *var = nir_deref_instr_get_variable(deref);
assert(deref->deref_type == nir_deref_type_var);
lower_texcoord(state, intr);
}
+ break;
+ }
+
+ case nir_intrinsic_load_color0:
+ lower_color(state, intr);
+ break;
+
+ case nir_intrinsic_load_interpolated_input:
+ case nir_intrinsic_load_input: {
+ /* The intrinsic doesn't carry the variable. We need to find it
+ * manually.
+ */
+ nir_foreach_variable(var, &state->b.shader->inputs) {
+ if ((var->data.driver_location == nir_intrinsic_base(intr)) &&
+ (nir_intrinsic_component(intr) >= var->data.location_frac &&
+ nir_intrinsic_component(intr) <
+ (var->data.location_frac + glsl_get_components(var->type))))
+ lower_texcoord(state, intr);
+ }
+ break;
+ }
+ default:
+ break;
}
}
}