Skip to content

intel: Implement gl_VertexID directly on Gen11+

Kenneth Graunke requested to merge kwg/mesa:icl-vertexid into main

A new 3DSTATE_VF::VertexID Offset Enable field allows us to ask the hardware to implicitly add Base Vertex Location for indexed draws or Start Vertex Location for sequential draws to the vertex ID value.

This matches OpenGL semantics, allowing us to implement gl_VertexID with the hardware SGV directly, without having to lower it to a shader addition of a zero-based vertex ID and a FirstVertex system value.

This also removes the need to upload FirstVertex into a buffer and an extra VERTEX_BUFFER_STATE to push it into the shader (unless the shader uses gl_BaseVertex).

Merge request reports