[Mesa-dev] gl_ViewportIndex/EmitVertex semantics question
Ilia Mirkin
imirkin at alum.mit.edu
Mon Feb 3 18:19:19 CET 2014
Hi Ian, mesa-dev,
I've been trying to implement ARB_viewport_array support on nv50, with
little success. Christoph pointed out that if I write the
gl_ViewportIndex value before each emit (rather than once at the top,
as the piglit tests do it), everything magically starts working.
I glanced at http://www.opengl.org/sdk/docs/manglsl/xhtml/gl_ViewportIndex.xml
which is a bit inconclusive: "The viewport index used will come from
one of the vertices in the primitive being shaded. However, which
vertex the viewport index comes from is implementation-defined, and so
it is recommended to use the same viewport index for all vertices of a
primitive." And there's various text about how if it's unset, it's
undefined. But it's unclear what "set" means -- does it become unset
after an EmitVertex() call or not?
Actually Christoph just pointed out that EmitVertex says: "Emit the
current values of output variables to the current output primitive. On
return from this call, the values of output variables are undefined."
So I guess the piglit tests should change?
Could someone with actual understanding of GLSL/etc take a look and
let me know whether I need to register gl_ViewportIndex (and, in all
probability, gl_Layer) writes and then write the registered value on
every EmitVertex in the driver, or whether the piglit tests should be
changed? (An observation is that I did _not_ need to move the 'color'
out into the loop in render-scissor, just gl_ViewportIndex -- but that
could be an abberation of the nvidia geometry program execution
logic.)
Thanks,
-ilia
More information about the mesa-dev
mailing list