diff options
author | Brian Paul <[email protected]> | 2010-04-18 09:46:25 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-04-18 10:02:11 -0600 |
commit | 10e4ec448e8011e8d446d83fc8bd61c7ba2d74be (patch) | |
tree | 27003aca721c84be2a45349f6c4abe622c6c7833 /src | |
parent | 6756c07b66164a2f8c769ad5725b95115eb7a6e6 (diff) |
softpipe: fix computation of fragment[FACE] attribute
In TGSI, front facing is +1 and back-facing is -1. We were computing
this attribute as +1 and 0 before. However, the value isn't actually
used anywhere because we machine->Face attribute overrides it in
tgsi_exec.c. That could be changed, removing some special-case code...
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_setup.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 61be55cdd3d..7e2b5802ec9 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -387,6 +387,7 @@ setup_sort_vertices(struct setup_context *setup, /* We need to know if this is a front or back-facing triangle for: * - the GLSL gl_FrontFacing fragment attribute (bool) * - two-sided stencil test + * 0 = front-facing, 1 = back-facing */ setup->facing = ((det > 0.0) ^ @@ -664,7 +665,8 @@ setup_tri_coefficients(struct setup_context *setup) } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; + /* convert 0 to 1.0 and 1 to -1.0 */ + setup->coef[fragSlot].a0[0] = setup->facing * -2.0f + 1.0f; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } @@ -1019,7 +1021,8 @@ setup_line_coefficients(struct setup_context *setup, } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; + /* convert 0 to 1.0 and 1 to -1.0 */ + setup->coef[fragSlot].a0[0] = setup->facing * -2.0f + 1.0f; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } @@ -1265,7 +1268,8 @@ sp_setup_point(struct setup_context *setup, } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; + /* convert 0 to 1.0 and 1 to -1.0 */ + setup->coef[fragSlot].a0[0] = setup->facing * -2.0f + 1.0f; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } |