glMultiDrawArraysIndirect usage

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

glMultiDrawArraysIndirect usage

luca.moretto
Hello everyone!

I'm having some problems using the glMultiDrawArraysIndirect draw function.

I have a buffer bound to GL_DRAW_INDIRECT_BUFFER containing the correct draw commands.
If i use the glDrawArraysIndirect function passing 0 or another buffer offset, it works.

However, when I try the Multi version of the function, I'm not able to make it work.
Instead of a long "indirect" offset argument, the Multi function takes a Buffer argument.
I tried different approaches, but without success:
- passing null as buffer (to have a 0 offset in the GL_DRAW_INDIRECT_BUFFER): the whole machine crashes

- passing a ByteBuffer with four bytes all initialized to 0 (also in this case to have a 0 offset): the function causes GL_INVALID_OPERATION

- passing an IntBuffer with one integer initialized to 0: the function causes GL_INVALID_OPERATION again.

In native OpenGL, passing NULL as the "indirect" pointer works fine. However, in JOGL I'm not able to achieve the same result.

Just some more information: I'm using the GL4 interface and my graphics card supports OpenGL 4.3.

Can anybody help me?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

gouessej
Administrator
Hi

In the meantime, until we understand what's wrong, you can use the workaround mentioned in the documentation:
http://www.opengl.org/sdk/docs/man/xhtml/glMultiDrawArraysIndirect.xml

If stride is zero, null should be accepted.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

luca.moretto
Hi, and thanks for your answer.

You're right, I made a mistake. null is actually accepted and treated as a 0 offset in the bound buffer.

However I would like to understand if and how it is possible to specify a different offset. Whatever value I pass in the "indirect" buffer argument it gives me GL_INVALID_OPERATION.

Anyway, if I don't have any buffer bound to GL_DRAW_INDIRECT_BUFFER and I pass to the function a buffer argument which directly contains the drawing command structures, then it works fine. The problem appears only when a buffer is bound to GL_DRAW_INDIRECT_BUFFER, in which case the "indirect" argument should be interpreted as an offset in the bound buffer.
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

eban
We are facing the same problem here.
Sound like there is a missing entry point:

glMultiDrawArraysIndirect(int mode, int type, long indirect_offset, int drawcount, int stride)
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

Sven Gothel
Administrator
On 02/01/2014 12:10 AM, eban [via jogamp] wrote:
> We are facing the same problem here.
> Sound like there is a missing entry point:
>
> glMultiDrawArraysIndirect(int mode, int type, long indirect_offset, int
> drawcount, int stride)
>
>
"If a buffer is bound to the GL_DRAW_INDIRECT_BUFFER binding at the time
 of a call to glMultiDrawArraysIndirect, indirect
 is interpreted as an offset, in basic machine units, into that buffer and the
parameter"

Yes, it is missing. And this might also be a requirement for core profiles,
where CPU sourced buffers are not allowed ?!

Please file a bug report and copy/paste the information - thank you!

~Sven



signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

Sven Gothel
Administrator
In reply to this post by eban
On 02/06/2014 11:44 AM, Sven Gothel wrote:

> On 02/01/2014 12:10 AM, eban [via jogamp] wrote:
>> We are facing the same problem here.
>> Sound like there is a missing entry point:
>>
>> glMultiDrawArraysIndirect(int mode, int type, long indirect_offset, int
>> drawcount, int stride)
>>
>>
> "If a buffer is bound to the GL_DRAW_INDIRECT_BUFFER binding at the time
>  of a call to glMultiDrawArraysIndirect, indirect
>  is interpreted as an offset, in basic machine units, into that buffer and the
> parameter"
>
> Yes, it is missing. And this might also be a requirement for core profiles,
> where CPU sourced buffers are not allowed ?!
>
> Please file a bug report and copy/paste the information - thank you!
>
> ~Sven
>
>
If anybody can provide a unit test - that would be great.
  <https://jogamp.org/bugzilla/show_bug.cgi?id=974>

~Sven


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

eban
Thanks, in which release will it be included ?
Reply | Threaded
Open this post in threaded view
|

Re: glMultiDrawArraysIndirect usage

Sven Gothel
Administrator
On 02/21/2014 05:16 PM, eban [via jogamp] wrote:
> Thanks, in which release will it be included ?
>

Next 2.1.5 ..

~Sven


signature.asc (894 bytes) Download Attachment