summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup_line.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-07-31 07:34:49 -0400
committerZack Rusin <zackr@vmware.com>2013-08-02 20:11:18 -0400
commitd6b3a193d4d525c5048ebf793e6a63fd98f92d64 (patch)
tree03fa602befb47cfa29efad7bc1c85e1ec645e92a /src/gallium/drivers/llvmpipe/lp_setup_line.c
parent05487ef88ded5fea0b1de7bc08d44846648d1ce2 (diff)
downloadexternal_mesa3d-d6b3a193d4d525c5048ebf793e6a63fd98f92d64.zip
external_mesa3d-d6b3a193d4d525c5048ebf793e6a63fd98f92d64.tar.gz
external_mesa3d-d6b3a193d4d525c5048ebf793e6a63fd98f92d64.tar.bz2
draw: inject frontface info into wireframe outputs
Draw module can decompose primitives into wireframe models, which is a fancy word for 'lines', unfortunately that decomposition means that we weren't able to preserve the original front-face info which could be derived from the original primitives (lines don't have a 'face'). To fix it allow draw module to inject a fake face semantic into outputs from which the backends can figure out the original frontfacing info of the primitives. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index bfed59c..3b16163 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -37,6 +37,7 @@
#include "lp_state_fs.h"
#include "lp_state_setup.h"
#include "lp_context.h"
+#include "draw/draw_context.h"
#define NUM_CHANNELS 4
@@ -45,6 +46,7 @@ struct lp_line_info {
float dx;
float dy;
float oneoverarea;
+ boolean frontfacing;
const float (*v1)[4];
const float (*v2)[4];
@@ -214,7 +216,8 @@ static void setup_line_coefficients( struct lp_setup_context *setup,
case LP_INTERP_FACING:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(setup, info, slot+1, 1.0, i);
+ constant_coef(setup, info, slot+1,
+ info->frontfacing ? 1.0f : -1.0f, i);
break;
default:
@@ -613,15 +616,22 @@ try_setup_line( struct lp_setup_context *setup,
plane[2].dcdx = y[2] - y[3];
plane[3].dcdx = y[3] - y[0];
+ if (draw_will_inject_frontface(lp_context->draw) &&
+ setup->face_slot > 0) {
+ line->inputs.frontfacing = v1[setup->face_slot][0];
+ } else {
+ line->inputs.frontfacing = TRUE;
+ }
+
/* Setup parameter interpolants:
*/
info.a0 = GET_A0(&line->inputs);
info.dadx = GET_DADX(&line->inputs);
info.dady = GET_DADY(&line->inputs);
+ info.frontfacing = line->inputs.frontfacing;
setup_line_coefficients(setup, &info);
- line->inputs.frontfacing = TRUE;
line->inputs.disable = FALSE;
line->inputs.opaque = FALSE;
line->inputs.layer = layer;