34 #define KEEP_SINGLE_COPY 1
36 #define RESTART_INDEX 0xFFFFFFFF
64 assert(verts_per_prim != -1);
72 assert(builder->
data !=
nullptr);
74 assert(v <= builder->max_allowed_index);
82 assert(builder->
data !=
nullptr);
110 assert(
v1 !=
v2 &&
v2 != v3 && v3 !=
v1);
134 builder->
data[elem++] =
v1;
148 builder->
data[idx++] =
v1;
149 builder->
data[idx++] =
v2;
164 builder->
data[idx++] =
v1;
165 builder->
data[idx++] =
v2;
166 builder->
data[idx++] = v3;
229 #if GPU_TRACK_INDEX_RANGE
232 uint min_index, max_index;
233 uint range = this->index_range(&min_index, &max_index);
237 if (range <= 0xFFFF) {
239 this->squeeze_indices_short(min_index, max_index);
269 const uint value = uint_idx[i];
273 if (value < min_value) {
276 else if (value > max_value) {
286 return max_value - min_value;
289 void IndexBuf::squeeze_indices_short(
uint min_idx,
uint max_idx)
296 if (max_idx >= 0xFFFF) {
299 ushort_idx[i] = (
uint16_t)
MIN2(0xFFFF, uint_idx[i] - min_idx);
305 ushort_idx[i] = (
uint16_t)(uint_idx[i]);
320 return wrap(GPUBackend::get()->indexbuf_alloc());
343 builder->
data =
nullptr;
361 return unwrap(elem)->is_init();
struct GPUIndexBuf GPUIndexBuf
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
void init(uint indices_len, uint32_t *indices)
GPUIndexBufType index_type_
void init_subrange(IndexBuf *elem_src, uint start, uint length)
void GPU_indexbuf_set_point_vert(GPUIndexBufBuilder *builder, uint elem, uint v1)
int GPU_indexbuf_primitive_len(GPUPrimType prim_type)
void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *builder, uint v)
void GPU_indexbuf_set_point_restart(GPUIndexBufBuilder *builder, uint elem)
GPUIndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *builder)
GPUIndexBuf * GPU_indexbuf_create_subrange(GPUIndexBuf *elem_src, uint start, uint length)
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)
void GPU_indexbuf_set_line_restart(GPUIndexBufBuilder *builder, uint elem)
void GPU_indexbuf_add_line_adj_verts(GPUIndexBufBuilder *builder, uint v1, uint v2, uint v3, uint v4)
void GPU_indexbuf_set_tri_restart(GPUIndexBufBuilder *builder, uint elem)
void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *builder)
GPUIndexBuf * GPU_indexbuf_calloc(void)
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *builder, GPUIndexBuf *elem)
void GPU_indexbuf_create_subrange_in_place(GPUIndexBuf *elem, GPUIndexBuf *elem_src, uint start, uint length)
void GPU_indexbuf_discard(GPUIndexBuf *elem)
void GPU_indexbuf_add_point_vert(GPUIndexBufBuilder *builder, uint v)
void GPU_indexbuf_init_ex(GPUIndexBufBuilder *builder, GPUPrimType prim_type, uint index_len, uint vertex_len)
bool GPU_indexbuf_is_init(GPUIndexBuf *elem)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *builder, uint v1, uint v2, uint v3)
void GPU_indexbuf_init(GPUIndexBufBuilder *builder, GPUPrimType prim_type, uint prim_len, uint vertex_len)
void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder *builder, uint v1, uint v2)
void *(* MEM_callocN)(size_t len, const char *str)
static GPUContext * wrap(Context *ctx)
static Context * unwrap(GPUContext *ctx)
static int indices_per_primitive(GPUPrimType prim_type)