Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-03-17 18:58:43 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-17 19:02:07 +0300
commit87d88581aaec4abc4fc326a213dfc0d68c39cb3a (patch)
treedad68bf30f5a96543007b2a9278a1009a77a0d74 /source/blender/draw/intern
parentdd4424821918f2e12d6e61dd265be11c669efeb0 (diff)
GWN: Vertex Buffer refactor.
We now alloc a vbo id on creation and let OpenGL manage its memory directly. We use glMapBuffer to get this memory location. This enables us to reuse and modify any vertex buffer directly without destroying it with its associated Batches. This commit does not really improve performance but will let us implement more optimizations in the future. We can also resize the buffer even if this can be slow if we need to keep the existing data. The addition of the usage hint makes dynamic buffers not a special case anymore, simplifying things a bit.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_instance_data.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c
index 86b2af5080c..ee73a2ba2c6 100644
--- a/source/blender/draw/intern/draw_instance_data.c
+++ b/source/blender/draw/intern/draw_instance_data.c
@@ -156,7 +156,7 @@ void DRW_batching_buffer_request(
}
/* Create the batch. */
bbuf = chunk->bbufs + new_id;
- bbuf->vert = *r_vert = GWN_vertbuf_create_dynamic_with_format(format);
+ bbuf->vert = *r_vert = GWN_vertbuf_create_with_format_ex(format, GWN_USAGE_DYNAMIC);
bbuf->batch = *r_batch = GWN_batch_create_ex(type, bbuf->vert, NULL, 0);
bbuf->format = format;
bbuf->shgroup = shgroup;
@@ -197,7 +197,7 @@ void DRW_instancing_buffer_request(
}
/* Create the batch. */
ibuf = chunk->ibufs + new_id;
- ibuf->vert = *r_vert = GWN_vertbuf_create_dynamic_with_format(format);
+ ibuf->vert = *r_vert = GWN_vertbuf_create_with_format_ex(format, GWN_USAGE_DYNAMIC);
ibuf->batch = *r_batch = GWN_batch_duplicate(instance);
ibuf->format = format;
ibuf->shgroup = shgroup;