diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-21 21:29:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-08-17 15:48:48 +0300 |
commit | 0e6dcde771b8cc4ce0ebc7c693bac487a480ef0b (patch) | |
tree | 951320c3850dbeb517f4e7a122976d8e2627f1a3 | |
parent | ff18606235ccde0359bf76f838d52b0b8bedf509 (diff) |
GPU: Fix flush range and uninitialized buffer_id
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 98ad37e496e..5fc7a885a92 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -776,12 +776,9 @@ struct GPUDrawList { GPUDrawList *GPU_draw_list_create(int length) { - GPUDrawList *list = MEM_mallocN(sizeof(GPUDrawList), "GPUDrawList"); + GPUDrawList *list = MEM_callocN(sizeof(GPUDrawList), "GPUDrawList"); /* Alloc the biggest possible command list which is indexed. */ list->buffer_size = sizeof(GPUDrawCommandIndexed) * length; - list->cmd_len = 0; - list->cmd_offset = 0; - list->commands = NULL; if (USE_MULTI_DRAW_INDIRECT) { list->buffer_id = GPU_buf_alloc(); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, list->buffer_id); @@ -881,7 +878,7 @@ void GPU_draw_list_submit(GPUDrawList *list) GLenum prim = batch->gl_prim_type; glBindBuffer(GL_DRAW_INDIRECT_BUFFER, list->buffer_id); - glFlushMappedBufferRange(GL_DRAW_INDIRECT_BUFFER, offset, bytes_used); + glFlushMappedBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, bytes_used); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); list->commands = NULL; /* Unmapped */ |