[Mesa-dev] [Bug 44217] New: vertex attribute 0 inconsistencies.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Dec 28 04:34:16 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=44217

             Bug #: 44217
           Summary: vertex attribute 0 inconsistencies.
    Classification: Unclassified
           Product: Mesa
           Version: git
          Platform: x86-64 (AMD64)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
        AssignedTo: mesa-dev at lists.freedesktop.org
        ReportedBy: bill at taniwha.org


I was having a lot of trouble using glVertexAttrib4f to set the vertex color in
my shader, and I traced it down to it being due to the shader linker assigning
attribute 0 to my vcolor attribute.

There seem to be several problems related with vertex attribute 0:
The api test in get_current_attrib() is gles2 only, not gl3 as well (this may
be a misunderstanding on my part).
There are no api tests in VertexAttrib4fARB and friends (at least check for for
GLES2, please)
Most importantly: the shader linker is assigning attribute 0.
Interestingly, attribute 0 works perfectly well if an array is used on it.

I noticed the problem because when my vcolor attribute was assigned 0, it was
never set and thus everything was rendered black.

vertex shader
--8<--
uniform mat4 mvp_mat;
attribute vec4 vertex;
attribute vec4 vcolor;

varying vec4 color;
varying vec2 st;

void
main (void)
{
    gl_Position = mvp_mat * vec4 (vertex.xy, 0.0, 1.0);
    st = vertex.zw;
    color = vcolor;
}
--8<--

fragment shader
--8<--
uniform sampler2D   texture;
uniform sampler2D   palette;
varying vec4 color;
varying vec2 st;

void
main (void)
{
    float       pix;

    pix = texture2D (texture, st).r;
    if (pix == 1.0)
        discard;
    gl_FragColor = texture2D (palette, vec2 (pix, 0.5)) * color;
}
--8<--

full source can be had from git://git.quakeforge.net/gitroot/quake/quakeforge
glsl branch. However, this has the workaround for the problem (vertex and
vcolor declaration order swapped in the vertex shader)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the mesa-dev mailing list