summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_program.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-05-17 15:30:59 -0700
committerEric Anholt <[email protected]>2016-05-17 18:07:39 -0700
commit62087cb9b80c271139370a242841def40cfdabae (patch)
tree338753d68aed0a51377efb01ab26055c16f96deb /src/gallium/drivers/vc4/vc4_program.c
parent0700e4c0c79771a69ceb5f269f684650265ea900 (diff)
vc4: Switch to using nir_load_front_face.
This will be generated by glsl_to_nir, and it turns out that this is a more code-efficient path than the floating point math, anyway. No change on shader-db, but drops an instruction in piglit's glsl-fs-frontfacing.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 34420aaa975..0a7bcb0374c 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1387,10 +1387,6 @@ 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_FACE) {
- c->inputs[loc * 4 + 0] =
- qir_ITOF(c, qir_reg(QFILE_FRAG_REV_FLAG,
- 0));
} else if (var->data.location >= VARYING_SLOT_VAR0 &&
(c->fs_key->point_sprite_mask &
(1 << (var->data.location -
@@ -1546,6 +1542,15 @@ ntq_emit_intrinsic(struct vc4_compile *c, nir_intrinsic_instr *instr)
*dest = qir_uniform(c, QUNIFORM_SAMPLE_MASK, 0);
break;
+ case nir_intrinsic_load_front_face:
+ /* The register contains 0 (front) or 1 (back), and we need to
+ * turn it into a NIR bool where true means front.
+ */
+ *dest = qir_ADD(c,
+ qir_uniform_ui(c, -1),
+ qir_reg(QFILE_FRAG_REV_FLAG, 0));
+ break;
+
case nir_intrinsic_load_input:
assert(instr->num_components == 1);
const_offset = nir_src_as_const_value(instr->src[0]);