https://bugs.freedesktop.org/show_bug.cgi?id=61907
Priority: medium Bug ID: 61907 Assignee: mesa-dev@lists.freedesktop.org Summary: Indirect rendering of multi-texture vertex arrays broken Severity: normal Classification: Unclassified OS: All Reporter: cjmmail10...@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) { glGetString(GL_EXTENSIONS); glGetString(GL_VERSION); __glXInitVertexArrayState(gc); } 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.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev