86using VertBufPtr = std::unique_ptr<gpu::VertBuf, gpu::VertBufDeleter>;
118 int handle_refcount_ = 1;
124 template<
typename FormatT>
189 return size_t(this->vertex_alloc) * this->format.
stride;
195 return size_t(this->vertex_len) * this->format.
stride;
206 if (handle_refcount_ == 0) {
241 uint source_first_vertex,
242 uint dest_first_vertex,
279#define GPU_vertbuf_init_with_format(verts, format) \
280 GPU_vertbuf_init_with_format_ex(verts, format, GPU_USAGE_STATIC)
338 return static_cast<void *
>(
data);
374#define GPU_VERTBUF_DISCARD_SAFE(verts) \
376 if (verts != nullptr) { \
377 GPU_vertbuf_discard(verts); \
#define ENUM_OPERATORS(_enum_type)
unsigned long long int uint64_t
constexpr MutableSpan()=default
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)
virtual void copy_sub(VertBuf &source_buf, uint source_first_vertex, uint dest_first_vertex, uint vertex_len)=0
Copy from part of source vertex buffer into the vertex buffer.
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
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ENUM_OPERATORS(Layer::Flags)
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void GPU_vertbuf_tag_dirty(gpu::VertBuf *verts)
unsigned __int64 uint64_t
GPU_INLINE uint GPU_vertbuf_raw_used(const GPUVertBufRaw *a)
void GPU_vertbuf_bind_as_texture(gpu::VertBuf *verts, int binding)
void GPU_vertbuf_wrap_handle(gpu::VertBuf *verts, uint64_t handle)
void GPU_vertbuf_init_with_format_ex(gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
static gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
gpu::VertBuf * GPU_vertbuf_create_on_device(const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_handle_ref_remove(gpu::VertBuf *verts)
uint GPU_vertbuf_get_memory_usage()
void GPU_vertbuf_read(const gpu::VertBuf *verts, void *data)
void GPU_vertbuf_use(gpu::VertBuf *)
const GPUVertFormat * GPU_vertbuf_get_format(const gpu::VertBuf *verts)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
GPUVertBufStatus GPU_vertbuf_get_status(const gpu::VertBuf *verts)
void GPU_vertbuf_bind_as_ssbo(gpu::VertBuf *verts, int binding)
void GPU_vertbuf_attr_fill_stride(gpu::VertBuf *, uint a_idx, uint stride, const void *data)
BMesh const char void * data
void GPU_vertbuf_attr_set(gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_update_sub(gpu::VertBuf *verts, uint start, uint len, const void *data)
void GPU_vertbuf_handle_ref_add(gpu::VertBuf *verts)
void GPU_vertbuf_clear(gpu::VertBuf *verts)
void GPU_vertbuf_init_build_on_device(gpu::VertBuf &verts, const GPUVertFormat &format, uint v_len)
@ GPU_VERTBUF_DATA_UPLOADED
gpu::VertBuf * GPU_vertbuf_create_with_format_ex(const GPUVertFormat &format, GPUUsageType usage)
void GPU_vertbuf_attr_get_raw_data(gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
void GPU_vertbuf_vert_set(gpu::VertBuf *verts, uint v_idx, const void *data)
void GPU_vertbuf_attr_fill(gpu::VertBuf *, uint a_idx, const void *data)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_data_resize(gpu::VertBuf &verts, uint v_len)
uint GPU_vertbuf_get_vertex_len(const gpu::VertBuf *verts)
MINLINE uint ceil_to_multiple_u(uint a, uint b)
uint GPU_vertbuf_get_vertex_alloc(const gpu::VertBuf *verts)
void GPU_vertbuf_discard(gpu::VertBuf *)
@ GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY
void GPU_vertbuf_data_len_set(gpu::VertBuf &verts, uint v_len)
unsigned char * _data_end
unsigned char * data_init