OSDN Git Service

spirv: Make VertexIndex and VertexId both non-zero-based
authorNeil Roberts <nroberts@igalia.com>
Thu, 19 Apr 2018 15:17:41 +0000 (17:17 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Mon, 13 Aug 2018 14:23:36 +0000 (16:23 +0200)
commitbe6f472b2387f508e55ffbe758da8cbea75717d6
tree4fc83e75f858a2f6c6f5f04996bf4fbbae637a19
parent624c00f1a6fd6e09fc5101a735a2c88e098ee675
spirv: Make VertexIndex and VertexId both non-zero-based

GLSL has gl_VertexID which is supposed to be non-zero-based.

SPIR-V has both VertexIndex and VertexId builtins whose meanings are
defined by the APIs.

Vulkan defines VertexIndex as being non-zero-based. In Vulkan VertexId
and InstanceId have no meaning and are pretty much just reserved for
OpenGL at this point.

GL_ARB_spirv removes VertexIndex and defines VertexId to be the same
as gl_VertexId (which is also non-zero-based).

Previously in Mesa it was treating VertexIndex as non-zero-based and
VertexId as zero-based, so it was breaking for GL. This behaviour was
apparently based on Khronos bug 14255. However that bug doesn’t seem
to have made a final decision for VertexId.

Assuming there really is no other definition for VertexId for Vulkan
it seems better to just make them both have the same value.

v2: update comment and commit descriptions, based on Jason Ekstrand
    explanation of the meaning/rationale behind all those builtins
    (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/vtn_variables.c