compiler: add INTERP_MODE_COLOR for radeonsi
[mesa.git] / src / compiler / spirv / spirv_to_nir.c
index d39f2a0d4f1ad8a8ae1d068fd4ee82bfb2e73457..12699ce5d6da1b09c19635051fb82577e16e3421 100644 (file)
@@ -324,11 +324,12 @@ vtn_get_image(struct vtn_builder *b, uint32_t value_id)
 
 static void
 vtn_push_image(struct vtn_builder *b, uint32_t value_id,
-               nir_deref_instr *deref)
+               nir_deref_instr *deref, bool propagate_non_uniform)
 {
    struct vtn_type *type = vtn_get_value_type(b, value_id);
    vtn_assert(type->base_type == vtn_base_type_image);
-   vtn_push_nir_ssa(b, value_id, &deref->dest.ssa);
+   struct vtn_value *value = vtn_push_nir_ssa(b, value_id, &deref->dest.ssa);
+   value->propagated_non_uniform = propagate_non_uniform;
 }
 
 static nir_deref_instr *
@@ -349,11 +350,13 @@ vtn_sampled_image_to_nir_ssa(struct vtn_builder *b,
 
 static void
 vtn_push_sampled_image(struct vtn_builder *b, uint32_t value_id,
-                       struct vtn_sampled_image si)
+                       struct vtn_sampled_image si, bool propagate_non_uniform)
 {
    struct vtn_type *type = vtn_get_value_type(b, value_id);
    vtn_assert(type->base_type == vtn_base_type_sampled_image);
-   vtn_push_nir_ssa(b, value_id, vtn_sampled_image_to_nir_ssa(b, si));
+   struct vtn_value *value = vtn_push_nir_ssa(b, value_id,
+                                              vtn_sampled_image_to_nir_ssa(b, si));
+   value->propagated_non_uniform = propagate_non_uniform;
 }
 
 static struct vtn_sampled_image
@@ -2490,11 +2493,23 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
          .image = vtn_get_image(b, w[3]),
          .sampler = vtn_get_sampler(b, w[4]),
       };
-      vtn_push_sampled_image(b, w[2], si);
+
+      enum gl_access_qualifier access = 0;
+      vtn_foreach_decoration(b, vtn_untyped_value(b, w[3]),
+                             non_uniform_decoration_cb, &access);
+      vtn_foreach_decoration(b, vtn_untyped_value(b, w[4]),
+                             non_uniform_decoration_cb, &access);
+
+      vtn_push_sampled_image(b, w[2], si, access & ACCESS_NON_UNIFORM);
       return;
    } else if (opcode == SpvOpImage) {
       struct vtn_sampled_image si = vtn_get_sampled_image(b, w[3]);
-      vtn_push_image(b, w[2], si.image);
+
+      enum gl_access_qualifier access = 0;
+      vtn_foreach_decoration(b, vtn_untyped_value(b, w[3]),
+                             non_uniform_decoration_cb, &access);
+
+      vtn_push_image(b, w[2], si.image, access & ACCESS_NON_UNIFORM);
       return;
    }
 
@@ -2816,6 +2831,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    enum gl_access_qualifier access = 0;
    vtn_foreach_decoration(b, sampled_val, non_uniform_decoration_cb, &access);
 
+   if (sampled_val->propagated_non_uniform)
+      access |= ACCESS_NON_UNIFORM;
+
    if (image && (access & ACCESS_NON_UNIFORM))
       instr->texture_non_uniform = true;