From ddaf8d7b10c57cc44ed0d69554e54b3573007315 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 3 Dec 2015 01:18:14 +0100 Subject: llvmpipe: use provoking vertex for layer/viewport d3d10 actually requires using provoking (first) vertex. GL is happy with any vertex (as long as we say it's undefined in the corresponding queries). Up to now we actually used vertex 0 for viewport index, and vertex 1 for layer (for tris), which really didn't make sense (probably a typo). Also,$ since we reorder vertices of clockwise triangle, that actually meant we used a different vertex depending if the traingle was cw or ccw (still ok by gl). However, it should be consistent with what draw (clip) does, and using provoking vertex seems like the sensible choice (draw clip will be fixed next as it is totally broken there). While here, also use the correct viewport always even when not needed in setup (we pass it down to jit fragment shader it might be needed there for getting correct near/far depth values). No piglit changes. Reviewed-by: Brian Paul Reviewed-by: Jose Fonseca --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index a190254d9df..fac1cd61d77 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -311,6 +311,7 @@ try_setup_line( struct lp_setup_context *setup, float y2diff; float dx, dy; float area; + const float (*pv)[4]; boolean draw_start; boolean draw_end; @@ -320,22 +321,28 @@ try_setup_line( struct lp_setup_context *setup, if (0) print_line(setup, v1, v2); - if (setup->scissor_test) { - nr_planes = 8; - if (setup->viewport_index_slot > 0) { - unsigned *udata = (unsigned*)v1[setup->viewport_index_slot]; - viewport_index = lp_clamp_viewport_idx(*udata); - } + if (setup->flatshade_first) { + pv = v1; } else { - nr_planes = 4; + pv = v2; + } + if (setup->viewport_index_slot > 0) { + unsigned *udata = (unsigned*)pv[setup->viewport_index_slot]; + viewport_index = lp_clamp_viewport_idx(*udata); } - if (setup->layer_slot > 0) { - layer = *(unsigned*)v1[setup->layer_slot]; + layer = *(unsigned*)pv[setup->layer_slot]; layer = MIN2(layer, scene->fb_max_layer); } + if (setup->scissor_test) { + nr_planes = 8; + } + else { + nr_planes = 4; + } + dx = v1[0][0] - v2[0][0]; dy = v1[0][1] - v2[0][1]; area = (dx * dx + dy * dy); -- cgit v1.2.3