PDA

View Full Version : Subroutines buffers



rodrigoloc
06-15-2014, 11:34 AM
I don't know if it is implemented or not, but let's start with the problem.
Like indirect drawing and indirect dispatch I think there should be an extension for passing subroutine uniforms from a buffer instead of from the CPU memory. The API could be like this:


GLuint nSubroutineBuffer;
glGenBuffers(1, &nSubroutineBuffer);


// Handle nSubroutineBuffer like any other buffer.


// In draw routine:
glBindBuffer(GL_SUBROUTINE_BUFFER, nSubroutineBuffer);
glUniformSubroutinesuiv​(<shader type>​, <count>​, (const GLuint *)(<offset>));
glDraw*();

glBindBuffer(GL_SUBROUTINE_BUFFER, 0);
glUniformSubroutinesuiv(<shader type>, <count>, <indices>);
glDraw*();