summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup_line.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2015-12-03 01:18:14 +0100
committerRoland Scheidegger <sroland@vmware.com>2015-12-04 03:42:19 +0100
commitddaf8d7b10c57cc44ed0d69554e54b3573007315 (patch)
treea5cd040ddd62163e61ac788adff87bc54f8c0c9e /src/gallium/drivers/llvmpipe/lp_setup_line.c
parent83e65ca8314ab2cee65ff169d0ae296ee9cd2c5e (diff)
downloadexternal_mesa3d-ddaf8d7b10c57cc44ed0d69554e54b3573007315.zip
external_mesa3d-ddaf8d7b10c57cc44ed0d69554e54b3573007315.tar.gz
external_mesa3d-ddaf8d7b10c57cc44ed0d69554e54b3573007315.tar.bz2
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 <brianp@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.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index a190254..fac1cd6 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);