Commit f8223e1f by Philipp Adolf

Move glBindBufferBase calls

parent 78c715fe
......@@ -285,20 +285,25 @@ void Subdivision::runShader(Input input, Tables &tables) {
qDebug()<<"Running compute shader";
edgeShader->bind();
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, input.vb_handle);
// Create an input buffer and set it to the value of offset
GLuint indicesID;
f->glGenBuffers(1, &indicesID);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, indicesID);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, indicesID);
f->glBufferData(GL_SHADER_STORAGE_BUFFER, tables.edge_indices.size() * sizeof(GLuint), tables.edge_indices.data(), GL_DYNAMIC_DRAW);
// Create an output buffer
GLuint bufferID;
f->glGenBuffers(1, &bufferID);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, bufferID);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferID);
f->glBufferData(GL_SHADER_STORAGE_BUFFER, tables.edge_indices.size() * sizeof(Vertex) / 4, NULL, GL_DYNAMIC_DRAW);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, input.vb_handle);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, indicesID);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, bufferID);
// Run the shader
f->glDispatchCompute(tables.edge_indices.size() / 4, 1, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment