[Mesa-dev] [PATCH v2 12/23] glsl: Validate vertex emission in geometry shaders.
Kenneth Graunke
kenneth at whitecape.org
Tue Jun 24 07:21:01 PDT 2014
On Friday, June 20, 2014 08:51:14 AM Iago Toral wrote:
> On Wed, 2014-06-18 at 13:38 -0700, Ian Romanick wrote:
> > On 06/18/2014 02:51 AM, Iago Toral Quiroga wrote:
> (...)
> > > + /* From the ARB_gpu_shader5 spec:
> > > + *
> > > + * "Multiple vertex streams are supported only if the output
primitive
> > > + * type is declared to be "points". A program will fail to
link if it
> > > + * contains a geometry shader calling EmitStreamVertex() or
> > > + * EndStreamPrimitive() if its output primitive type is not
"points".
> > > + *
> > > + * However, in the same spec:
> > > + *
> > > + * "The function EmitVertex() is equivalent to calling
EmitStreamVertex()
> > > + * with <stream> set to zero."
> > > + *
> > > + * And:
> > > + *
> > > + * "The function EndPrimitive() is equivalent to calling
> > > + * EndStreamPrimitive() with <stream> set to zero."
> > > + *
> > > + * Since we can call EmitVertex() and EndPrimitive() when we
output
> > > + * primitives other than points, calling EmitStreamVertex(0) or
> > > + * EmitEndPrimitive(0) should not produce errors. This it also
what Nvidia
> > > + * does. Currently we only set prog->Geom.UsesStreams to TRUE
when
> > > + * EmitStreamVertex() or EmitEndPrimitive() are called with a
non-zero
> > > + * stream.
> >
> > Does AMD also behave this way? If so, I can submit a spec bug to make
> > these explicitly legal. Otherwise, I think we should not allow it. We
> > probably ought to check Apple and the Intel Windows driver too...
>
> I could test this on the proprietary AMD Linux driver:
>
> A geometry shader with output triangle_strip using EmitStreamVertex(0)
> and EmitEndPrimitive(0) works fine: no link errors, correct output.
>
> A geometry shader with output triangle_strip using EmitStreamVertex(1)
> does not produce a link error (which is wrong by the spec) and produces
> incorrect output (blank screen).
>
> A geometry shader with output triangle_strip using EmitStreamVertex(0)
> that also calls EmitStreamPrimitive(1) does not produce a link error
> (which is wrong by the spec) and produces correct output (the end stream
> primitive on stream 1 is really a no-op since there are no vertices
> emitted on that stream).
>
> So I'd say that AMD is not respecting the spec too much here, but it
> looks like using EmitStreamVertex(0) or EndStreamPrimitive(0) with
> output types other than points works on both Nvidia and AMD proprietary
> drivers in the end.
>
> So Ian, what do you think we should do?
>
> Iago
For what it's worth, AMD also supports writing lines and triangles to multiple
streams, not just points:
http://www.opengl.org/registry/specs/AMD/transform_feedback3_lines_triangles.txt
--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140624/46d173d6/attachment-0001.sig>
More information about the mesa-dev
mailing list