vc4: Enable PIPE_CAP_TGSI_TEXCOORD.
[mesa.git] / src / gallium / drivers / vc4 / vc4_nir_lower_io.c
index c82d99812259bf18d69038f88c2d2321350ed4e3..39ecfb6e50c3d5f81728eb6dddd1a8a11e4fde89 100644 (file)
@@ -24,6 +24,7 @@
 #include "vc4_qir.h"
 #include "compiler/nir/nir_builder.h"
 #include "util/format/u_format.h"
+#include "util/u_helpers.h"
 
 /**
  * Walks the NIR generated by TGSI-to-NIR or GLSL-to-NIR to lower its io
@@ -225,17 +226,6 @@ vc4_nir_lower_vertex_attr(struct vc4_compile *c, nir_builder *b,
         replace_intrinsic_with_vec(b, intr, dests);
 }
 
-static bool
-is_point_sprite(struct vc4_compile *c, nir_variable *var)
-{
-        if (var->data.location < VARYING_SLOT_VAR0 ||
-            var->data.location > VARYING_SLOT_VAR31)
-                return false;
-
-        return (c->fs_key->point_sprite_mask &
-                (1 << (var->data.location - VARYING_SLOT_VAR0)));
-}
-
 static void
 vc4_nir_lower_fs_input(struct vc4_compile *c, nir_builder *b,
                        nir_intrinsic_instr *intr)
@@ -261,8 +251,8 @@ vc4_nir_lower_fs_input(struct vc4_compile *c, nir_builder *b,
         int comp = nir_intrinsic_component(intr);
 
         /* Lower away point coordinates, and fix up PNTC. */
-        if (is_point_sprite(c, input_var) ||
-            input_var->data.location == VARYING_SLOT_PNTC) {
+        if (util_varying_is_point_coord(input_var->data.location,
+                                        c->fs_key->point_sprite_mask)) {
                 assert(intr->num_components == 1);
 
                 nir_ssa_def *result = &intr->dest.ssa;