diff options
author | Brian Paul <brianp@vmware.com> | 2010-04-20 11:43:58 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-04-20 11:44:01 -0600 |
commit | db4ccc004a96255f3ad0dc26467f2243a133c24b (patch) | |
tree | 1783c640ef63a8549ce22c03b4106d56c4a626ec /src | |
parent | ab065b933bde4fd1079f0d37a4571cdfd1619407 (diff) |
llvmpipe: fix incorrect front-facing value for fragment shader
The TGSI convention is +1 for front-facing, -1 for back-facing
Fixes glean glsl1 gl_FrontFacing tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index a95053444bf..f8a58165733 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -163,12 +163,17 @@ setup_fragcoord_coef(struct lp_setup_context *setup, } +/** + * Setup the fragment input attribute with the front-facing value. + * \param frontface is the triangle front facing? + */ static void setup_facing_coef( struct lp_setup_context *setup, struct lp_rast_triangle *tri, unsigned slot, boolean frontface ) { - constant_coef( setup, tri, slot, 1.0f - frontface, 0 ); + /* convert TRUE to 1.0 and FALSE to -1.0 */ + constant_coef( setup, tri, slot, 2.0f * frontface - 1.0f, 0 ); constant_coef( setup, tri, slot, 0.0f, 1 ); /* wasted */ constant_coef( setup, tri, slot, 0.0f, 2 ); /* wasted */ constant_coef( setup, tri, slot, 0.0f, 3 ); /* wasted */ |