[Mesa-dev] [PATCH] softpipe: fix incorrect front-facing value.

Morgan Armand morgan.devel at gmail.com
Thu Nov 10 13:17:41 PST 2011


Because the type of the facing attribute is unsigned, the whole computation was
done in the unsigned range.

Fixes fbo-fragcoord2, glsl1-gl_FrontFacing var (2) and glsl-fs-frontfacing tests.

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

diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 779b8c4..cf19696 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -128,7 +128,7 @@ exec_run( const struct sp_fragment_shader_variant *var,
                     &machine->QuadPos);

    /* convert 0 to 1.0 and 1 to -1.0 */
-   machine->Face = (float) (quad->input.facing * -2 + 1);
+   machine->Face = (float) ((signed)quad->input.facing * -2 + 1);

    quad->inout.mask &= tgsi_exec_machine_run( machine );
    if (quad->inout.mask == 0)
-- 
1.7.7.1.msysgit.0



More information about the mesa-dev mailing list