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>2019-07-14 17:49:44 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-08-14 20:05:26 +0300
commit9c010c44f4201ab114b3facc69d0343525a1779f (patch)
tree744271becd24cead6c900e4f023d8c0bfa6138b6 /source/blender/gpu/GPU_element.h
parent45a45f7d66211e82a3a3288782ad9523e8fdc516 (diff)
Mesh Batch Cache: Refactor + Multithread
For clarity sake, the batch cache now uses exclusively per Loop attributes. While this is a bit of a waste of VRAM (for the few case where per vert attribs are enough) it reduces the complexity and amount of overall VBO to update in general situations. This patch also makes the VertexBuffers filling multithreaded. This make the update of dense meshes a bit faster. The main bottleneck is the IndexBuffers update which cannot be multithreaded efficiently (have to increment a counter and/or do a final sorting pass). We introduce the concept of "extract" functions/step. All extract functions are executed in one thread each and if possible, using multiple thread for looping over all elements. Reviewed By: brecht Differential Revision: http://developer.blender.org/D5424
Diffstat (limited to 'source/blender/gpu/GPU_element.h')
-rw-r--r--source/blender/gpu/GPU_element.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h
index 4ac89d2658b..75caf4cbd6a 100644
--- a/source/blender/gpu/GPU_element.h
+++ b/source/blender/gpu/GPU_element.h
@@ -36,14 +36,19 @@ typedef enum {
} GPUIndexBufType;
typedef struct GPUIndexBuf {
+ uint index_start;
uint index_len;
+ bool is_subrange;
#if GPU_TRACK_INDEX_RANGE
GPUIndexBufType index_type;
uint32_t gl_index_type;
uint base_index;
#endif
uint32_t ibo_id; /* 0 indicates not yet sent to VRAM */
- void *data; /* non-NULL indicates not yet sent to VRAM */
+ union {
+ void *data; /* non-NULL indicates not yet sent to VRAM */
+ struct GPUIndexBuf *src; /* if is_subrange is true, this is the source buffer. */
+ };
} GPUIndexBuf;
void GPU_indexbuf_use(GPUIndexBuf *);
@@ -71,9 +76,21 @@ void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder *, uint v1, uint v2);
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3);
void GPU_indexbuf_add_line_adj_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3, uint v4);
+void GPU_indexbuf_set_point_vert(GPUIndexBufBuilder *builder, uint elem, uint v1);
+void GPU_indexbuf_set_line_verts(GPUIndexBufBuilder *builder, uint elem, uint v1, uint v2);
+void GPU_indexbuf_set_tri_verts(GPUIndexBufBuilder *builder, uint elem, uint v1, uint v2, uint v3);
+
+/* Skip primitive rendering at the given index. */
+void GPU_indexbuf_set_point_restart(GPUIndexBufBuilder *builder, uint elem);
+void GPU_indexbuf_set_line_restart(GPUIndexBufBuilder *builder, uint elem);
+void GPU_indexbuf_set_tri_restart(GPUIndexBufBuilder *builder, uint elem);
+
GPUIndexBuf *GPU_indexbuf_build(GPUIndexBufBuilder *);
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, GPUIndexBuf *);
+/* Create a subrange of an existing indexbuffer. */
+GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *ibo, uint start, uint length);
+
void GPU_indexbuf_discard(GPUIndexBuf *);
int GPU_indexbuf_primitive_len(GPUPrimType prim_type);