Skip to content

Draft: zink: emulate gs input rotation

Antonino Maniscalco requested to merge antonino/mesa:gs_fix into main

It looks like on most drivers, both opengl's provoking mode and the vulkan extention will not just change which vertex is picked when using flat shading, but also the way triangles are extracted from strips and fans and passed to the geometry shader. The following example demonstrates this behavior, it is present on radv/radeonsi and llvmpipe/lavapipe but not on Intel GPUs.

The behavior observed is the following:

  • when provoking vertex mode is set to first triangles are extracted from strips with the following indices: 0, 1, 2 1, 3, 2 2, 3, 4

This is consistent with the spec and across drivers. However when pv mode is last the behavior becomes inconsistent:

  • on amd/llvm 0, 1, 2 2, 1, 3 2, 3, 4
  • on intel 0, 1, 2 1, 3, 2 2, 3, 4

So basically on amd/llvm odd triangles are rotated so that their provoking vertex appears as the last one whereas on intel it appears in the middle.

The vulkan spec specifies Intel's behavior though it doesn't talk explicitly about geometry shaders.

Now the last patch emulates this behavior, however since it isn't documented either in the OpenGL or the Vulkan specification it's not clear whether it should be left as it is. This inconsistency between drivers also affects nir_create_passthrough_gs which so far as assumed amd/llvm's behavior.

Edited by Antonino Maniscalco

Merge request reports