diff options
author | Eric Anholt <[email protected]> | 2016-05-17 15:30:59 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2016-05-17 18:07:39 -0700 |
commit | 62087cb9b80c271139370a242841def40cfdabae (patch) | |
tree | 338753d68aed0a51377efb01ab26055c16f96deb /src/gallium/drivers/vc4/vc4_nir_lower_io.c | |
parent | 0700e4c0c79771a69ceb5f269f684650265ea900 (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_nir_lower_io.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_io.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index 261c00dc449..2b4ad9c5ea6 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -274,11 +274,15 @@ vc4_nir_lower_fs_input(struct vc4_compile *c, nir_builder *b, } if (input_var->data.location == VARYING_SLOT_FACE) { - dests[0] = nir_fsub(b, - nir_imm_float(b, 1.0), - nir_fmul(b, - nir_i2f(b, dests[0]), - nir_imm_float(b, 2.0))); + /* TGSI-to-NIR's front face. Convert to using the system + * value boolean instead. + */ + nir_ssa_def *face = + nir_load_system_value(b, + nir_intrinsic_load_front_face, + 0); + dests[0] = nir_bcsel(b, face, nir_imm_float(b, 1.0), + nir_imm_float(b, -1.0)); dests[1] = nir_imm_float(b, 0.0); dests[2] = nir_imm_float(b, 0.0); dests[3] = nir_imm_float(b, 1.0); |