draw: fix stippling of fractional lines
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 11 Aug 2021 14:53:11 +0000 (16:53 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Aug 2021 09:44:16 +0000 (09:44 +0000)
commitd37aa08f61169f498ec5dd01f740d7bd3ff421bf
tree79aafa0fd5c3c21ecf523cd488cbe95811a9c079
parenta3d400a01640dce3325d10b529349cdbc59d38f4
draw: fix stippling of fractional lines

The OpenGL 4.6 specification, section 14.5.2.1 (Line Stipple) says:

> The masking is achieved using three parameters: the 16-bit line
> stipple p, the line repeat count r, and an integer stipple counter s.

This is pretty clear that the stipple counter shouldn't carry fractional
parts. But we also don't really do anything useful with the fractional
part anyway, apart from skewing the third or later line-segments

Properly carrying over the fractional parts as the Vulkan specification
allows for rectangular lines is trickier than this and would require us
to use a shorter output-line at the start of the following
line-segments.

But let's just do what the OpenGL specification describes, and the
Vulkan specification allows for now.

This, combined with the following patch for the vulkan CTS makes the
last two rasterization-tests pass for me:

https://github.com/KhronosGroup/VK-GL-CTS/pull/279

Fixes the "spec/!opengl 1.1/linestipple/line strip" piglit-test.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12327>
src/gallium/auxiliary/draw/draw_pipe_stipple.c
src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt