Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/GPU_index_buffer.h
| Show All 19 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup gpu | * \ingroup gpu | ||||
| * | * | ||||
| * GPU index buffer | * GPU index buffer | ||||
| */ | */ | ||||
| #pragma once | #pragma once | ||||
| #include "BLI_listbase.h" | |||||
| #include "BLI_threads.h" | |||||
| #include "GPU_primitive.h" | #include "GPU_primitive.h" | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| /** Opaque type hiding blender::gpu::IndexBuf. */ | /** Opaque type hiding blender::gpu::IndexBuf. */ | ||||
| typedef struct GPUIndexBuf GPUIndexBuf; | typedef struct GPUIndexBuf GPUIndexBuf; | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| uint32_t *GPU_indexbuf_unmap(const GPUIndexBuf *elem, const uint32_t *mapped_buffer); | uint32_t *GPU_indexbuf_unmap(const GPUIndexBuf *elem, const uint32_t *mapped_buffer); | ||||
| void GPU_indexbuf_discard(GPUIndexBuf *elem); | void GPU_indexbuf_discard(GPUIndexBuf *elem); | ||||
| bool GPU_indexbuf_is_init(GPUIndexBuf *elem); | bool GPU_indexbuf_is_init(GPUIndexBuf *elem); | ||||
| int GPU_indexbuf_primitive_len(GPUPrimType prim_type); | int GPU_indexbuf_primitive_len(GPUPrimType prim_type); | ||||
| /* Multi-Thread Utils */ | |||||
| typedef struct GPUIndexBufBuilderAsync { | |||||
| uint slot; | |||||
| uint32_t thread_local_id; | |||||
| ThreadMutex mutex; | |||||
| ListBase builder_cpy_list; /* GPUIndexBufBuilderLink. */ | |||||
| GPUIndexBufBuilder builder; | |||||
| } GPUIndexBufBuilderAsync; | |||||
| void GPU_indexbuf_async_init_ex(GPUIndexBufBuilderAsync *builder_async, | |||||
| GPUPrimType prim_type, | |||||
| uint index_len, | |||||
| uint vertex_len); | |||||
| void GPU_indexbuf_async_init(GPUIndexBufBuilderAsync *builder_async, | |||||
| GPUPrimType prim_type, | |||||
| uint prim_len, | |||||
| uint vertex_len); | |||||
| void GPU_indexbuf_async_set_point_vert(GPUIndexBufBuilderAsync *builder_async, uint elem, uint v1); | |||||
| void GPU_indexbuf_async_set_line_verts(GPUIndexBufBuilderAsync *builder_async, | |||||
| uint elem, | |||||
| uint v1, | |||||
| uint v2); | |||||
| void GPU_indexbuf_async_set_tri_verts( | |||||
| GPUIndexBufBuilderAsync *builder_async, uint elem, uint v1, uint v2, uint v3); | |||||
| void GPU_indexbuf_async_set_point_restart(GPUIndexBufBuilderAsync *builder_async, uint elem); | |||||
| void GPU_indexbuf_async_set_line_restart(GPUIndexBufBuilderAsync *builder_async, uint elem); | |||||
| void GPU_indexbuf_async_set_tri_restart(GPUIndexBufBuilderAsync *builder_async, uint elem); | |||||
| void GPU_indexbuf_async_build_in_place(GPUIndexBufBuilderAsync *builder_async, GPUIndexBuf *elem); | |||||
| /* Macros */ | /* Macros */ | ||||
| #define GPU_INDEXBUF_DISCARD_SAFE(elem) \ | #define GPU_INDEXBUF_DISCARD_SAFE(elem) \ | ||||
| do { \ | do { \ | ||||
| if (elem != NULL) { \ | if (elem != NULL) { \ | ||||
| GPU_indexbuf_discard(elem); \ | GPU_indexbuf_discard(elem); \ | ||||
| elem = NULL; \ | elem = NULL; \ | ||||
| } \ | } \ | ||||
| } while (0) | } while (0) | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||