[Mesa-dev] vertex shader that processes 0 vertex data

Ian Romanick idr at freedesktop.org
Wed Sep 1 08:38:43 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Airlie wrote:
> I was looking at glsl-vs-point-size in piglit today and it doesn't
> work on gallium.
> 
> void main()
> {
>         gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
>         gl_PointSize = 16.0;
>         gl_FrontColor = vec4(1.0, 1.0, 1.0, 1.0);
> }

Prior to OpenGL version 3.2, IIRC, the vertex shader must be given
either generic attribute 0 or gl_Vertex.  Some language was changed to
allow vertex shaders to operate without consuming any attributes, but
without that there is no way to provoke a vertex without position data.
 Note that the shader itself doesn't have to use the data (i.e., it
doesn't have to use gl_Vertex), but the application has to provide it.

> Since the vertex shader doesn't have any declared inputs,
> 
> we work out the vp in gallium and then in st_draw.c:st_draw_vbo we hit
> 
>    if (num_vbuffers == 0 || num_velements == 0)
>       return;
> 
> Any ideas on what should happen here?

If attribute 0 or GL_VERTEX_ARRAY are not enabled or glVertex is not
called, nothing should be drawn.  The pseduocode for ArrayElement in
section 2.8 of the OpenGL 3.0 spec makes this pretty clear.  The change
in 3.1 isn't explicit.  It's implied by the lack of dependence in
sections 2.7 and 2.8 on attribute 0.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx+c4AACgkQX1gOwKyEAw95LQCgj/q9xa5v//g2/lH2JAMn9oVf
s8kAn2fJuUEQtFFp76npmW+9b/xqBl8J
=7zFU
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list