summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qir.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-05 14:24:29 -0700
committerEric Anholt <[email protected]>2014-08-11 14:47:54 -0700
commite63598aecb5d1cc2a20b8db1ef85790e301f4241 (patch)
tree68820ed5b8b2e61a97f5ce1eac2c495ca1ea922d /src/gallium/drivers/vc4/vc4_qir.h
parentd34fbdda120b2b0e0a33a4a18fa112e58f8a2f4a (diff)
vc4: Add support for gl_FragCoord.
This isn't passing all tests (glsl-fs-fragcoord-zw-ortho, for example), but it does get a bunch more tests passing. v2: Rebase on helpers change.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index 5d1f088ee37..7d9806268fe 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -74,6 +74,11 @@ enum qop {
QOP_TLB_COLOR_WRITE,
QOP_VARY_ADD_C,
+ QOP_FRAG_X,
+ QOP_FRAG_Y,
+ QOP_FRAG_Z,
+ QOP_FRAG_RCP_W,
+
/** Texture x coordinate parameter write */
QOP_TEX_S,
/** Texture y coordinate parameter write */
@@ -204,6 +209,15 @@ bool qir_opt_algebraic(struct qcompile *c);
bool qir_opt_copy_propagation(struct qcompile *c);
bool qir_opt_dead_code(struct qcompile *c);
+#define QIR_ALU0(name) \
+static inline struct qreg \
+qir_##name(struct qcompile *c) \
+{ \
+ struct qreg t = qir_get_temp(c); \
+ qir_emit(c, qir_inst(QOP_##name, t, c->undef, c->undef)); \
+ return t; \
+}
+
#define QIR_ALU1(name) \
static inline struct qreg \
qir_##name(struct qcompile *c, struct qreg a) \
@@ -257,6 +271,10 @@ QIR_NODST_2(TEX_S)
QIR_NODST_2(TEX_T)
QIR_NODST_2(TEX_R)
QIR_NODST_2(TEX_B)
+QIR_ALU0(FRAG_X)
+QIR_ALU0(FRAG_Y)
+QIR_ALU0(FRAG_Z)
+QIR_ALU0(FRAG_RCP_W)
static inline struct qreg
qir_CMP(struct qcompile *c, struct qreg cmp, struct qreg a, struct qreg b)