[Mesa-dev] [PATCH 00/13] Fix gl_VertexID on i965

Ian Romanick idr at freedesktop.org
Mon Aug 4 20:17:13 PDT 2014


On 08/03/2014 11:07 PM, Kenneth Graunke wrote:
> On Sunday, June 22, 2014 03:59:01 AM Marek Olšák wrote:
>> That's right. A uniform won't work with ARB_draw_indirect unless
>> you lower it to direct draws, which would be very bad if it was
>> applied to all drivers.
>> 
>> Radeonsi indeed supports BaseVertex and BaseInstance as system
>> values in the vertex shader. Well, vertex fetching has to be done
>> in the vertex shader on that hardware, so the system values are
>> kinda required there.
>> 
>> Marek
> 
> FWIW, I've thrown together some patches for i965 which make
> gl_BaseVertex available as a system value, which I think is the right
> thing to do.  I've tested the indirect draw case, and it seems to
> work fine.

Yeah, I like your approach.  Patch 12 in my original series causes
regressions in a couple piglit tests... which I somehow did not see
before.  It looks like your series regressions some geometry shader
tests.  glsl-1.50-geometry-primitive-types looks like the geometry
shader is getting a floating point value for the vertex ID:

Testing GL_LINES(1 vertices)
Testing GL_LINES(2 vertices)
  Expected vertex IDs: 1 2
  Actual vertex IDs:   -1082130431 1065353218
Testing GL_LINES(3 vertices)
  Expected vertex IDs: 1 2
  Actual vertex IDs:   -1082130431 1065353218
Testing GL_LINES(4 vertices)
  Expected vertex IDs: 1 2 3 4
  Actual vertex IDs:   -1082130431 1065353218 1065353219 -1082130428

-1082130431 is 0xbf800001, which is the bit encoding of -1.0.
1065353218 is the bit encoding of 1.0.  So... there's something fishy
there. :)

I did some clean up on the branch and pushed it to basevertex-v6.  I
squashed your HAX commit into the original commit for the lowering pass,
and I removed the commit that added the fake uniform.

I think your approach will allow us to implement most of
GL_ARB_shader_draw_parameters without much difficulty.  We'll get
gl_BaseVertex and gl_BaseInstance... gl_DrawID seems a bit harder.

> basevertex-v5 of my tree.  It needs cleaning up and testing, but the
> hard part is in place.  It mostly reuses Ian's existing GLSL IR
> lowering pass, too.
> 
> --Ken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140804/95c4e1f3/attachment.sig>


More information about the mesa-dev mailing list