summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2019-12-03 14:46:56 -0800
committerEric Anholt <eric@anholt.net>2020-06-29 09:07:19 -0700
commita60e8dfdc5d6302db6b79325572b020d55e426d9 (patch)
treea1725fc6130bacd2ccb2f2fde96d49384294e88b
parent64cb81a3a4ad0b2c794a276ca22c7fd39a1856a8 (diff)
vc4: Enable PIPE_CAP_TGSI_TEXCOORD.
Dave wants to drop the !TEXCOORD path from NIR, and it's easy enough to do. Untested. Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2952>
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_io.c16
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c8
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.c1
3 files changed, 7 insertions, 18 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
index c82d9981225..39ecfb6e50c 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -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;
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 4bf7e367213..b06bd89963c 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -25,6 +25,7 @@
#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"
@@ -1608,11 +1609,8 @@ ntq_setup_inputs(struct vc4_compile *c)
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 {
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index cd3c6f56dd7..f4fae386fd8 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -148,6 +148,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
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: