diff options
author | Zack Rusin <[email protected]> | 2013-07-31 07:34:49 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-08-02 20:11:18 -0400 |
commit | d6b3a193d4d525c5048ebf793e6a63fd98f92d64 (patch) | |
tree | 03fa602befb47cfa29efad7bc1c85e1ec645e92a /src/gallium/drivers/llvmpipe/lp_setup_point.c | |
parent | 05487ef88ded5fea0b1de7bc08d44846648d1ce2 (diff) |
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 <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_point.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_point.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 868a9a904b7..cbcc8d4f2f3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -38,6 +38,7 @@ #include "lp_state_setup.h" #include "lp_context.h" #include "tgsi/tgsi_scan.h" +#include "draw/draw_context.h" #define NUM_CHANNELS 4 @@ -51,6 +52,8 @@ struct point_info { float (*a0)[4]; float (*dadx)[4]; float (*dady)[4]; + + boolean frontfacing; }; @@ -276,7 +279,8 @@ setup_point_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: @@ -384,6 +388,13 @@ try_setup_point( struct lp_setup_context *setup, lp_context->pipeline_statistics.c_primitives++; } + if (draw_will_inject_frontface(lp_context->draw) && + setup->face_slot > 0) { + point->inputs.frontfacing = v0[setup->face_slot][0]; + } else { + point->inputs.frontfacing = TRUE; + } + info.v0 = v0; info.dx01 = 0; info.dx12 = fixed_width; @@ -392,12 +403,12 @@ try_setup_point( struct lp_setup_context *setup, info.a0 = GET_A0(&point->inputs); info.dadx = GET_DADX(&point->inputs); info.dady = GET_DADY(&point->inputs); + info.frontfacing = point->inputs.frontfacing; /* Setup parameter interpolants: */ setup_point_coefficients(setup, &info); - point->inputs.frontfacing = TRUE; point->inputs.disable = FALSE; point->inputs.opaque = FALSE; point->inputs.layer = layer; |