Mark Carey
2007-Oct-25 09:35 UTC
[Nouveau] [patch] [renouveau] 1/1 fix detection of GL_ARB_draw_buffers in test_framebuffer_object
Further to comments in http://people.freedesktop.org/~marcheu/irclogs/nouveau-2007-10-20 between 11:30 and 13:51, chowmeined confirmation in http://people.freedesktop.org/~marcheu/irclogs/nouveau-2007-10-21 at 10:16 of the same behaviour on a second 0322. It appears that 10de0322 supports GL_EXT_framebuffer_object but does not support ARB_draw_buffers, accordingly the current fragment program in renouveau test.c::test_ext_framebuffer_object() causes OpenGL error 1282, 502, INVALID_OPERATION at call to ProgramStringARB on line 4595, http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt section 3.11.1 suggests this is due to the illegal token in the fragment program (fp). The example code in http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt between lines 417 and 429 suggest a method for determining which character in the fragment program caused the error; GLint errorPos; regl.GetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos); Error appears to be firstly `OPTION ARB_draw_buffers;` and secondly the use of `MOV result.color[%d], fragment.color;` when without GL_ARB_draw_buffers a syntactically correct line woudl read `MOV result.color, fragment.color;`. Furthermore due to incorrect detection of nr_bufs line 4614 or 4615 causes a similar error when the draw buffers test attempts to use a draw buffer which does not exist on the hardware. Perusing http://oss.sgi.com/projects/ogl-sample/registry/ARB/draw_buffers.txt when querying the number of supported draw buffers one should call GetIntegerv specifying MAX_DRAW_BUFFERS_ARB (0x8824) not GL_MAX_COLOR_ATTACHMENTS_EXT as currently performed on line 4566. Attached patch; 1. Defines the constant MAX_DRAW_BUFFERS_ARB (in test.c, which header should this go into? does it really matter for renouveau?) 2. Correctly uses MAX_DRAW_BUFFERS_ARB to determine the number of draw buffers present (http://oss.sgi.com/projects/ogl-sample/registry/ARB/draw_buffers.txt suggests that OpenGL 1.5 MAX_DRAW_BUFFERS_ARB will always return a minimum value of 1, will renouveau ever be run on OpenGL<1.5?) 3. Adds a line to `card_10de-xxxx_test_ext_framebuffer_object.txt` when GL_ARB_draw_buffers is not supported 4. Modifies the fp in the case when MAX_DRAW_BUFFERS_ARB == 1 and GL_ARB_draw_buffers is not supported 5. Draw buffer test now runs without error (due to 2) Patch applied to a fresh checkout of renouveau on both 0322 (GL_EXT_framebuffer_object) and 0393 (GL_EXT_framebuffer_object + GL_ARB_draw_buffers) compiled and tested without error. Please review and consider applying the attached patch. Regards, Mark Carey -------------- next part -------------- A non-text attachment was scrubbed... Name: 0322-fix-test-framebuffer-object.patch Type: text/x-diff Size: 2152 bytes Desc: not available Url : http://lists.freedesktop.org/archives/nouveau/attachments/20071025/08652e44/attachment.patch