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:
Diffstat (limited to 'source/blender/gpu/GPU_index_buffer.h')
-rw-r--r--source/blender/gpu/GPU_index_buffer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_index_buffer.h b/source/blender/gpu/GPU_index_buffer.h
index 4e8d854c7ce..03d60c60b4b 100644
--- a/source/blender/gpu/GPU_index_buffer.h
+++ b/source/blender/gpu/GPU_index_buffer.h
@@ -44,6 +44,7 @@ typedef struct GPUIndexBufBuilder {
uint index_max;
GPUPrimType prim_type;
uint32_t *data;
+ const struct GPUIndexBufBuilder *parent;
} GPUIndexBufBuilder;
/* supports all primitive types. */
@@ -53,6 +54,19 @@ void GPU_indexbuf_init_ex(GPUIndexBufBuilder *, GPUPrimType, uint index_len, uin
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len);
GPUIndexBuf *GPU_indexbuf_build_on_device(uint index_len);
+/*
+ * Thread safe sub builders.
+ *
+ * Note that `GPU_indexbuf_subbuilder_init` and `GPU_indexbuf_subbuilder_finish` are not thread
+ * safe and should be called when no threads are active. The pattern is to create a subbuilder for
+ * each thread/task. Each thread/task would update their sub builder. When all thread are completed
+ * the sub-builders can then be merged back to the parent builder.
+ */
+void GPU_indexbuf_subbuilder_init(const GPUIndexBufBuilder *parent_builder,
+ GPUIndexBufBuilder *sub_builder);
+void GPU_indexbuf_subbuilder_finish(GPUIndexBufBuilder *builder,
+ const GPUIndexBufBuilder *parent_builder);
+
void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v);
void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *);