summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-09-30 14:19:25 -0700
committerEric Anholt <eric@anholt.net>2014-10-01 17:03:35 -0700
commit1bf2d17a60d112c7ca8da7ab0b539991df96a93d (patch)
tree128ce72704bb02b8434e587823ac9077dafcfaf2
parent0c8c7d32f0e7ab691225e9630fc2ff20a25c0175 (diff)
vc4: Add support for TGSI_OPCODE_CLAMP.
This will be used by the shared LIT lowering code.
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 6dc42ac3e32..804a1dc2097 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -812,6 +812,17 @@ tgsi_to_qir_cos(struct vc4_compile *c,
return sum;
}
+static struct qreg
+tgsi_to_qir_clamp(struct vc4_compile *c,
+ struct tgsi_full_instruction *tgsi_inst,
+ enum qop op, struct qreg *src, int i)
+{
+ return qir_FMAX(c, qir_FMIN(c,
+ src[0 * 4 + i],
+ src[2 * 4 + i]),
+ src[1 * 4 + i]);
+}
+
static void
emit_vertex_input(struct vc4_compile *c, int attr)
{
@@ -1062,6 +1073,7 @@ emit_tgsi_instruction(struct vc4_compile *c,
[TGSI_OPCODE_FLR] = { 0, tgsi_to_qir_flr },
[TGSI_OPCODE_SIN] = { 0, tgsi_to_qir_sin },
[TGSI_OPCODE_COS] = { 0, tgsi_to_qir_cos },
+ [TGSI_OPCODE_CLAMP] = { 0, tgsi_to_qir_clamp },
};
static int asdf = 0;
uint32_t tgsi_op = tgsi_inst->Instruction.Opcode;