OSDN Git Service

i965: Expose gl_BaseVertex via a vertex attribute.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 8 Aug 2014 03:59:56 +0000 (20:59 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 10 Sep 2014 18:05:08 +0000 (11:05 -0700)
commitfbb353bc13a8924f9c6cd8c2572d299e3c4b9162
tree1a46b2f76f6c9d8125d832663138e26447487173
parent87b10c4a7161905e3a9dc2b2ddc77fbf6908ebd5
i965: Expose gl_BaseVertex via a vertex attribute.

Now that we have the data available, we need to expose it to the
shaders.  We can reuse the same vertex element that we use for
gl_VertexID, but we need to back it by an actual vertex buffer.

A hardware restriction requires that vertex attributes coming from a
buffer (STORE_SRC) must come before any other types (i.e. STORE_0).
So, we have to make gl_BaseVertex be the .x component of the vertex
attribute.  This means moving gl_VertexID to a different component.

I chose to move gl_VertexID and gl_InstanceID to the .z and .w
components, respectively, to make room for gl_BaseInstance in the .y
component (which would also come from a buffer, and therefore be
STORE_SRC).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_draw_upload.c
src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
src/mesa/drivers/dri/i965/gen8_draw_upload.c