diff options
author | Roland Scheidegger <[email protected]> | 2015-12-03 01:18:14 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2015-12-04 03:42:19 +0100 |
commit | ddaf8d7b10c57cc44ed0d69554e54b3573007315 (patch) | |
tree | a5cd040ddd62163e61ac788adff87bc54f8c0c9e | |
parent | 83e65ca8314ab2cee65ff169d0ae296ee9cd2c5e (diff) |
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 <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_line.c | 25 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 24 |
2 files changed, 32 insertions, 17 deletions
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); diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 98a9d4bc28b..2c9d43fb040 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -276,6 +276,7 @@ do_triangle_ccw(struct lp_setup_context *setup, int nr_planes = 3; unsigned viewport_index = 0; unsigned layer = 0; + const float (*pv)[4]; /* Area should always be positive here */ assert(position->area > 0); @@ -283,21 +284,28 @@ do_triangle_ccw(struct lp_setup_context *setup, if (0) lp_setup_print_triangle(setup, v0, v1, v2); - if (setup->scissor_test) { - nr_planes = 7; - if (setup->viewport_index_slot > 0) { - unsigned *udata = (unsigned*)v0[setup->viewport_index_slot]; - viewport_index = lp_clamp_viewport_idx(*udata); - } + if (setup->flatshade_first) { + pv = v0; } else { - nr_planes = 3; + 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 = 7; + } + else { + nr_planes = 3; + } + /* Bounding rectangle (in pixels) */ { /* Yes this is necessary to accurately calculate bounding boxes |