Quit orphaning and use dynamic buffers.
This commit is contained in:
parent
3b21e1610a
commit
1b9ce54100
@ -551,14 +551,14 @@ rk_batch_t rk_create_batch(
|
||||
if (rk_MultiDrawElementsIndirect) {
|
||||
glGenBuffers(1, &batch->commands_buffer);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, batch->commands_buffer);
|
||||
glBufferData(GL_DRAW_INDIRECT_BUFFER, batch->commands_size, nullptr, GL_STREAM_DRAW);
|
||||
glBufferData(GL_DRAW_INDIRECT_BUFFER, batch->commands_size, nullptr, GL_DYNAMIC_DRAW);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);
|
||||
}
|
||||
if (nparams) {
|
||||
glBindVertexArray(vertices->array);
|
||||
glGenBuffers(1, &batch->params_array);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, batch->params_array);
|
||||
glBufferData(GL_ARRAY_BUFFER, batch->packed_size, nullptr, GL_STREAM_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, batch->packed_size, nullptr, GL_DYNAMIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
rk_parameter const * param = batch->params;
|
||||
unsigned binding = RK_PARAMS_BINDING_BASE;
|
||||
@ -794,12 +794,10 @@ void rk_draw_batch(
|
||||
unsigned const ncommands = rk_batch_build_commands(batch, ninstances, meshes);
|
||||
if (rk_MultiDrawElementsIndirect) {
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, batch.commands_buffer);
|
||||
glBufferData(GL_DRAW_INDIRECT_BUFFER, batch.commands_size, nullptr, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_DRAW_INDIRECT_BUFFER, 0, ncommands * sizeof(rk_command), batch.commands);
|
||||
}
|
||||
if (batch.nparams && params) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, batch.params_array);
|
||||
glBufferData(GL_ARRAY_BUFFER, batch.packed_size, nullptr, GL_STREAM_DRAW);
|
||||
rk_batch_pack(batch, ninstances, params);
|
||||
}
|
||||
if (rk_DrawElementsInstancedBaseInstance) {
|
||||
|
Loading…
Reference in New Issue
Block a user