[Bf-blender-cvs] [0e6dcde771b] tmp-drw-callbatching: GPU: Fix flush range and uninitialized buffer_id

Clément Foucault noreply at git.blender.org
Sat Aug 17 14:50:39 CEST 2019


Commit: 0e6dcde771b8cc4ce0ebc7c693bac487a480ef0b
Author: Clément Foucault
Date:   Fri Jun 21 20:29:57 2019 +0200
Branches: tmp-drw-callbatching
https://developer.blender.org/rB0e6dcde771b8cc4ce0ebc7c693bac487a480ef0b

GPU: Fix flush range and uninitialized buffer_id

===================================================================

M	source/blender/gpu/intern/gpu_batch.c

===================================================================

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 */



More information about the Bf-blender-cvs mailing list