83using VertBufPtr = std::unique_ptr<gpu::VertBuf, gpu::VertBufDeleter>;
115 int handle_refcount_ = 1;
121 template<
typename FormatT>
144 buf->data<
T>().slice(0,
data.size()).copy_from(
data);
186 return size_t(this->vertex_alloc) * this->format.
stride;
192 return size_t(this->vertex_len) * this->format.
stride;
203 if (handle_refcount_ == 0) {
258#define GPU_vertbuf_init_with_format(verts, format) \
259 GPU_vertbuf_init_with_format_ex(verts, format, GPU_USAGE_STATIC)
356#define GPU_VERTBUF_DISCARD_SAFE(verts) \
358 if (verts != nullptr) { \
359 GPU_vertbuf_discard(verts); \
MINLINE uint ceil_to_multiple_u(uint a, uint b)
#define ENUM_OPERATORS(_type, _max)
void GPU_vertbuf_attr_get_raw_data(blender::gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
void GPU_vertbuf_attr_fill_stride(blender::gpu::VertBuf *, uint a_idx, uint stride, const void *data)
blender::gpu::VertBuf * GPU_vertbuf_create_on_device(const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_init_build_on_device(blender::gpu::VertBuf &verts, const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_vert_set(blender::gpu::VertBuf *verts, uint v_idx, const void *data)
void GPU_vertbuf_handle_ref_remove(blender::gpu::VertBuf *verts)
void GPU_vertbuf_use(blender::gpu::VertBuf *)
void GPU_vertbuf_data_resize(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_attr_fill(blender::gpu::VertBuf *, uint a_idx, const void *data)
blender::gpu::VertBuf * GPU_vertbuf_create_with_format_ex(const GPUVertFormat &format, GPUUsageType usage)
void GPU_vertbuf_tag_dirty(blender::gpu::VertBuf *verts)
void GPU_vertbuf_handle_ref_add(blender::gpu::VertBuf *verts)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_data_len_set(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_attr_set(blender::gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
@ GPU_VERTBUF_DATA_UPLOADED
void GPU_vertbuf_wrap_handle(blender::gpu::VertBuf *verts, uint64_t handle)
void GPU_vertbuf_read(const blender::gpu::VertBuf *verts, void *data)
uint GPU_vertbuf_get_memory_usage()
GPUVertBufStatus GPU_vertbuf_get_status(const blender::gpu::VertBuf *verts)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_clear(blender::gpu::VertBuf *verts)
const GPUVertFormat * GPU_vertbuf_get_format(const blender::gpu::VertBuf *verts)
GPU_INLINE uint GPU_vertbuf_raw_used(const GPUVertBufRaw *a)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_bind_as_ssbo(blender::gpu::VertBuf *verts, int binding)
void GPU_vertbuf_update_sub(blender::gpu::VertBuf *verts, uint start, uint len, const void *data)
void GPU_vertbuf_init_with_format_ex(blender::gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
void GPU_vertbuf_bind_as_texture(blender::gpu::VertBuf *verts, int binding)
uint GPU_vertbuf_get_vertex_len(const blender::gpu::VertBuf *verts)
void GPU_vertbuf_discard(blender::gpu::VertBuf *)
@ GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY
uint GPU_vertbuf_get_vertex_alloc(const blender::gpu::VertBuf *verts)
BMesh const char void * data
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
constexpr MutableSpan< NewT > cast() const
void operator()(VertBuf *vbo)
static VertBufPtr device_only(uint size)
virtual void read(void *data) const =0
virtual void wrap_handle(uint64_t handle)=0
size_t size_used_get() const
static VertBufPtr from_varray(const VArray< T > &array)
size_t size_alloc_get() const
static VertBufPtr from_size(const int size, GPUUsageType usage=GPU_USAGE_STATIC)
virtual void bind_as_ssbo(uint binding)=0
static VertBufPtr from_span(const Span< T > data)
static size_t memory_usage
GPUUsageType extended_usage_
void resize(uint vert_len)
virtual void upload_data()=0
static VertBufPtr from_size_with_format(const int size, GPUUsageType usage=GPU_USAGE_STATIC)
void allocate(uint vert_len)
GPUUsageType get_usage_type() const
virtual void resize_data()=0
virtual void bind_as_texture(uint binding)=0
virtual void release_data()=0
virtual void acquire_data()=0
virtual void update_sub(uint start, uint len, const void *data)=0
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
unsigned char * data_init
unsigned char * _data_end