[Mesa-dev] [Bug 61907] New: Indirect rendering of multi-texture vertex arrays broken

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Mar 6 07:29:45 PST 2013


          Priority: medium
            Bug ID: 61907
          Assignee: mesa-dev at lists.freedesktop.org
           Summary: Indirect rendering of multi-texture vertex arrays
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: cjmmail10-bz at yahoo.co.uk
          Hardware: All
            Status: NEW
           Version: 9.1
         Component: GLX
           Product: Mesa

Created attachment 76023
  --> https://bugs.freedesktop.org/attachment.cgi?id=76023&action=edit
Updated files with fixes for mesa src/glx

Indirect rendering of multi-texture vertex arrays is currently
broken with three separate bugs in src/glx, which I have attempted to fix
in the attached files.

Bug 1:  For each indirect context the indirect vertex array state must be
initialised by __glXInitVertexArrayState in indirect_vertex_array.c.  As
noted in the routine header it requires that the glx context has been setup
prior to the call, in order to test the server version and extensions.

Currently __glXInitVertexArrayState is called from indirect_bind_context
in indirect_glx.c, as follows:

   state = gc->client_state_private;
   if (state->array_state == NULL) {

But, the gc context is not yet usable at this stage, so the server queries
fail, and __glXInitVertexArrayState is called without the server version
and extension information it needs.  This breaks multi-texturing as
glXInitVertexArrayState doesn't get GL_MAX_TEXTURE_UNITS.  It probably also
breaks setup of other arrays: fog, secondary colour, vertex attributes.

To fix this I have moved the call to __glXInitVertexArrayState to the end
of MakeContextCurrent in glxcurrent.c, where the glx context is usable.

Bug 2.  There are a couple of typos in the op codes in
__indirect_glTexCoordPointer in indirect_vertex_array.c, resulting in the
wrong command op code being sent.  I have corrected them.

Bug 3.  There is no draw arrays protocol support for multi-texture
coordinate arrays, so it is implemented by sending batches of immediate
mode commands from emit_element_none in indirect_vertex_array.c.  This
sends the target texture unit (which has been previously setup in the
array_state header field), followed by the texture coordinates.  But for
GL_DOUBLE coordinates the texture unit must be sent *after* the texture
coordinates. This is documented in the glx protocol description, and can
also be seen in the indirect.c immediate mode commands generated from
gl_API.xml. Sending the target texture unit in the wrong place can crash
the remote X server.

To fix this required some more extensive changes to indirect_vertex_array.c
and indirect_vertex_array_priv.h, in order to remove the texture unit value
out of the array_state "header" field, and send it separately.

The modified files from src/glx are attached.  The are based on the
latest git master branch as of 6 March 2013.

I encountered these bugs with glDrawArrays/glDrawElements calls from an
OpenSceneGraph application. I have tested the fixes on Linux x86_64,
displaying on a remote Linux X server and also on a commercial Microsoft
Windows X server.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130306/c39577cb/attachment-0001.html>

More information about the mesa-dev mailing list