PDA

View Full Version : GPU Write to GL_DRAW_INDIRECT_BUFFER



Christoph.LGDV
03-09-2016, 01:11 AM
Hi, I want to setup an indirect draw command via compute shader.

basically Copy an existing buffer to a temporary and then use the temporary for drawing.


According to my naive understanding, I bind both via bindbufferbase(GL_DRAW_INDIRECT_BUFFER,...).

That does not work, obviously.

Question is: How can I write to GL_DRAW_INDIRECT_BUFFER from GPU?

Best Regards

Christoph.LGDV
03-09-2016, 01:17 AM
5 Minutes later I tried binding it as GL_SHADER_STORAGE_BUFFER and it works.

Awesome!

skynet
03-09-2016, 11:48 AM
Don't forget glMemoryBarrier(GL_COMMAND_BARRIER_BIT) before using the buffer for indirect commands.