Bug 15670

Summary: glMultiDrawElements() not implemented
Product: Mesa Reporter: Pierre Beyssac <mesa-bugzilla>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED INVALID QA Contact:
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: FreeBSD   
Whiteboard:
i915 platform: i915 features:
Attachments: Output of glxinfo
Test case source code
Test case console output
New test case
Add GL_EXT_multi_draw_arrays to the Radeon R300 driver.
Add GL_EXT_multi_draw_arrays to the Radeon R200 driver

Description Pierre Beyssac 2008-04-23 02:15:34 UTC
A call to glMultiDrawElements() displays the following:

Mesa 7.0.1 implementation error: User called no-op dispatch function (an unsupported extension function?)
Please report at bugzilla.freedesktop.org

Note: from the diffs it looks like the bug is still present in 7.0.3, but I have no way to check this at the moment.
Comment 1 Brian Paul 2008-04-23 07:34:02 UTC
I modified a test program to use glMultiDrawElements() and it worked as expected with 7.0.3.

What driver are you using?

Could you try with 7.0.3 and/or provide a small test case?

Comment 2 Pierre Beyssac 2008-04-23 10:50:55 UTC
Created attachment 16134 [details]
Output of glxinfo
Comment 3 Pierre Beyssac 2008-04-23 10:51:27 UTC
Created attachment 16135 [details]
Test case source code
Comment 4 Pierre Beyssac 2008-04-23 10:52:21 UTC
Created attachment 16136 [details]
Test case console output
Comment 5 Pierre Beyssac 2008-04-23 10:53:44 UTC
I've made a quick & dirty update to Mesa 7.0.3, and I still get the same message.
I'm running Xorg 7.3.1, xorg-server-1.4_8 with dri, on FreeBSD 8, with a Radeon
card (9200 series, r300-based).
 
See attached test case source code, its output, and the output of glxinfo.
Comment 6 Brian Paul 2008-04-23 15:10:30 UTC
Your parameters to glMultiDrawElements() are incorrect.  

If you replace:
   glMultiDrawElements(GL_TRIANGLE_STRIP, tsci, tsfi, tsin);

with:
   glMultiDrawElements(GL_TRIANGLE_STRIP, tsci, GL_UNSIGNED_SHORT, tsfi, tsin);

You should get closer to success.  Also, the type of tsci should be GLsizei.

If you add #define GL_GLEXT_PROTOTYPES at the top of your code and compile with warning flags such as -pedantic -ansi -Wall you'll be more likely to find problems like this.
Comment 7 Pierre Beyssac 2008-04-23 15:57:33 UTC
Wow. Thanks Brian for the good advice, I'll need to go hide under a stone for some time :).

However, the missing GL_UNSIGNED_SHORT was in the original code, I made a cut-and-paste error when writing the test case. After fixing the code as you suggest, I still get the same "Mesa 7.0.3 implementation error" message. New updated code is attached. Maybe I'm still doing something stupid, but I can't figure out what it is.
Comment 8 Pierre Beyssac 2008-04-23 15:58:08 UTC
Created attachment 16141 [details]
New test case

Updated test case, compiles without warning using "cc -pedantic -ansi -Wall -I/usr/local/include -L/usr/local/lib -lGL -lglut multi.c".
Comment 9 Brian Paul 2008-04-23 17:32:36 UTC
I don't have an R200 to test with but I think the problem is the GL_EXT_multi_draw_arrays feature is not supported by the driver.

It's not listed in glxinfo and it's not supported in GL 1.3 (which is what you have).

It should be easy to enable this extension in the driver though.  Basically duplicate the code seen in another driver, like i965:

i965/intel_context.c:#define need_GL_EXT_multi_draw_arrays
i965/intel_context.c:    { "GL_EXT_multi_draw_arrays",          GL_EXT_multi_draw_arrays_functions },

If you do this, please attach the patch.
Comment 10 Pierre Beyssac 2008-04-24 05:33:25 UTC
Created attachment 16154 [details] [review]
Add GL_EXT_multi_draw_arrays to the Radeon R300 driver.

Here's a tested patch for the R300 driver. Oddly enough, it doesn't seem to work within display lists, but I'll have to investigate whether this is another pilot error on my part.

Radeon patch will follow once I get the time to test it on my R200 card.
Comment 11 Pierre Beyssac 2008-04-24 15:15:35 UTC
Created attachment 16166 [details] [review]
Add GL_EXT_multi_draw_arrays to the Radeon R200 driver

Here's the same patch as before, for the R200 driver. It's been tested. I'll issue a separate bug report for the display list weirdness.
Comment 12 Brian Paul 2008-04-24 15:32:22 UTC
I've committed the r200/r300 patches to git.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.