anv: always allocate a vertex element with vertexid or instanceid
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 31 Jan 2017 12:41:32 +0000 (12:41 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 2 Feb 2017 01:32:58 +0000 (01:32 +0000)
commit543d5db4e250a48e976a529b5e45047d5c53ab80
tree05dbfdbc36f54ca30f434a3d2d0431ced08feb4d
parent289aef771df79726b5463b2d6d22bb8531846ec1
anv: always allocate a vertex element with vertexid or instanceid

Up to now on Gen8+ we only allocated a vertex element for
gl_InstanceIndex or gl_VertexIndex when a vertex shader uses
gl_BaseInstanceARB or gl_BaseVertexARB. This is because we would
configure the VF_SGVS packet to make the VF unit write the
gl_InstanceIndex & gl_VertexIndex values right behind the values
computed from the vertex buffers.

In the next commit we will also write the gl_DrawIDARB value. Our
backend expects to pull the gl_DrawIDARB value from the element
following the element containing gl_InstanceIndex, gl_VertexIndex,
gl_BaseInstanceARB and gl_BaseVertexARB (see
vec4_vs_visitor::setup_attributes). Therefore we need to allocate an
element for the SGVS elements as long as at least one of the SGVS
element is read by the shader. Otherwise our shader will use a
gl_DrawIDARB value pulled from the URB one element too far (most
likely garbage).

v2: Fix my english (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/genX_pipeline.c