Commit fdf3d862 by Philipp Adolf

Rename local variables in runShader

parent f8223e1f
......@@ -287,22 +287,22 @@ void Subdivision::runShader(Input input, Tables &tables) {
edgeShader->bind();
// Create an input buffer and set it to the value of offset
GLuint indicesID;
f->glGenBuffers(1, &indicesID);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, indicesID);
GLuint edge_indices_handle;
f->glGenBuffers(1, &edge_indices_handle);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, edge_indices_handle);
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->glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferID);
GLuint output_handle;
f->glGenBuffers(1, &output_handle);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, output_handle);
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);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, edge_indices_handle);
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, output_handle);
// Run the shader
f->glDispatchCompute(tables.edge_indices.size() / 4, 1, 1);
......@@ -316,7 +316,7 @@ void Subdivision::runShader(Input input, Tables &tables) {
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, 0);
// Map the output buffer so we can read the results
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferID);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, output_handle);
Vertex *ptr;
ptr = (Vertex *) f->glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY);
for (int i = 0; i < tables.edge_indices.size() / 4; i++) {
......@@ -325,8 +325,8 @@ void Subdivision::runShader(Input input, Tables &tables) {
f->glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
// Delete the buffers the free the resources
f->glDeleteBuffers(1, &indicesID);
f->glDeleteBuffers(1, &bufferID);
f->glDeleteBuffers(1, &edge_indices_handle);
f->glDeleteBuffers(1, &output_handle);
edgeShader->release();
}
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