#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
         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)
         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;
 
 #include <inttypes.h>
 #include "util/format/u_format.h"
 #include "util/crc32.h"
+#include "util/u_helpers.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/ralloc.h"
                 if (c->stage == QSTAGE_FRAG) {
                         if (var->data.location == VARYING_SLOT_POS) {
                                 emit_fragcoord_input(c, loc);
-                        } else if (var->data.location == VARYING_SLOT_PNTC ||
-                                   (var->data.location >= VARYING_SLOT_VAR0 &&
-                                    (c->fs_key->point_sprite_mask &
-                                     (1 << (var->data.location -
-                                            VARYING_SLOT_VAR0))))) {
+                        } else if (util_varying_is_point_coord(var->data.location,
+                                                               c->fs_key->point_sprite_mask)) {
                                 c->inputs[loc * 4 + 0] = c->point_x;
                                 c->inputs[loc * 4 + 1] = c->point_y;
                         } else {
 
         case PIPE_CAP_TEXTURE_MULTISAMPLE:
         case PIPE_CAP_TEXTURE_SWIZZLE:
         case PIPE_CAP_TEXTURE_BARRIER:
+        case PIPE_CAP_TGSI_TEXCOORD:
                 return 1;
 
         case PIPE_CAP_NATIVE_FENCE_FD: