draw/clip: fix viewport index for geometry shaders
authorDave Airlie <airlied@redhat.com>
Thu, 2 Jul 2020 05:37:16 +0000 (15:37 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 3 Jul 2020 21:19:08 +0000 (07:19 +1000)
commit29ce8060eb0584d619e48c440540adc1f32de76e
treed852ff79865808c560bf22800e6d799488618688
parent3366171d0ac4c1b19b475f7b72e5dae95a091795
draw/clip: fix viewport index for geometry shaders

The old code updated the viewport index on the first vertex in
a primitive, however it was picking the first vertex wrong
when used with geometry shaders.

This code has access to the prim info with the primitive lengths
so instead keep track of when a new primitive starts by tracking
the lengths and updating the viewport index then. The prim info
is only valid after a GS or prim assembly, so enable prim assembly
if a vertex shader ever uses viewport index.

This fixes:
piglit arb_viewport_array-render-viewport-2
KHR-GLES31.core.viewport_array.draw_to_single_layer_with_multiple_viewports,Fail
KHR-GLES31.core.viewport_array.draw_mulitple_viewports_with_single_invocation,Fail
KHR-GLES31.core.viewport_array.draw_multiple_layers,Fail
KHR-GLES31.core.viewport_array.depth_range,Fail

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5489>
.gitlab-ci/piglit/quick_gl.txt
src/gallium/auxiliary/draw/draw_cliptest_tmp.h
src/gallium/auxiliary/draw/draw_prim_assembler.c