24 MEM_SAFE_DELETE(
data_);
51 MEM_SAFE_DELETE(
data_);
64 glGenBuffers(1, &vbo_id_);
67 glBindBuffer(GL_ARRAY_BUFFER, vbo_id_);
78 glBufferSubData(GL_ARRAY_BUFFER, 0, vbo_size_,
data_);
83 MEM_SAFE_DELETE(
data_);
94 glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, vbo_id_);
106 if (buffer_texture_ ==
nullptr) {
115 void *
result = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY);
117 glUnmapBuffer(GL_ARRAY_BUFFER);
125 vbo_id_ =
uint(handle);
130bool GLVertBuf::is_active()
const
135 int active_vbo_id = 0;
136 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &active_vbo_id);
137 return vbo_id_ == active_vbo_id;
142 glBufferSubData(GL_ARRAY_BUFFER, start,
len,
data);
146 uint source_first_vertex,
147 uint dest_first_vertex,
152 "Copy source range exceeds the source vertex buffer bounds");
154 "Copy destination range exceeds the vertex buffer bounds");
156 BLI_assert_msg(vbo_id_,
"GPU_vertbuf_use() not called on this buffer");
157 BLI_assert_msg(src.vbo_id_,
"GPU_vertbuf_use() not called on the source buffer");
159 const size_t src_offset = size_t(source_first_vertex) * src.
format.
stride;
160 const size_t dst_offset = size_t(dest_first_vertex) *
format.
stride;
164 glCopyNamedBufferSubData(src.vbo_id_, vbo_id_, src_offset, dst_offset, copy_size);
167 glBindBuffer(GL_COPY_READ_BUFFER, src.vbo_id_);
168 glBindBuffer(GL_COPY_WRITE_BUFFER, vbo_id_);
170 GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, src_offset, dst_offset, copy_size);
171 glBindBuffer(GL_COPY_READ_BUFFER, 0);
172 glBindBuffer(GL_COPY_WRITE_BUFFER, 0);
#define GPU_TEXTURE_FREE_SAFE(texture)
#define BLI_assert_msg(a, msg)
#define MEM_realloc_uninitialized(vmemh, len)
uint16_t bound_ssbo_slots
static void buffer_free(GLuint buf_id)
static bool direct_state_access_support
void bind_as_texture(uint binding) override
void read(void *data) const override
void upload_data() override
void bind_as_ssbo(uint binding) override
void wrap_handle(uint64_t handle) override
void resize_data() override
void update_sub(uint start, uint len, const void *data) override
void acquire_data() override
void copy_sub(VertBuf &source_buf, uint source_first_vertex, uint dest_first_vertex, uint vertex_len) override
Copy from part of source vertex buffer into the vertex buffer.
void release_data() override
size_t size_used_get() const
size_t size_alloc_get() const
static size_t memory_usage
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
GLenum to_gl(eGPUDataFormat format)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b)
gpu::Texture * GPU_texture_create_from_vertbuf(const char *name, gpu::VertBuf *vertex_buf)
@ GPU_VERTBUF_DATA_UPLOADED
void GPU_texture_bind(gpu::Texture *texture, int unit)