Mesa (master): softpipe: setup machine->Face without a conditional

Brian Paul brianp at kemper.freedesktop.org
Tue Dec 1 11:27:18 PST 2009


Module: Mesa
Branch: master
Commit: e0399fddf2efd556ece8b81078368e6ab388c3b7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0399fddf2efd556ece8b81078368e6ab388c3b7

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Nov 30 09:21:49 2009 -0700

softpipe: setup machine->Face without a conditional

---

 src/gallium/drivers/softpipe/sp_fs_exec.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index a8999ed..27fa126 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -127,11 +127,8 @@ exec_run( const struct sp_fragment_shader *base,
                     (float)quad->input.x0, (float)quad->input.y0, 
                     &machine->QuadPos);
 
-   if (quad->input.facing) {
-      machine->Face = -1.0f;
-   } else {
-      machine->Face = 1.0f;
-   }
+   /* convert 0 to 1.0 and 1 to -1.0 */
+   machine->Face = (float) (quad->input.facing * -2 + 1);
 
    quad->inout.mask &= tgsi_exec_machine_run( machine );
    if (quad->inout.mask == 0)



More information about the mesa-commit mailing list