58 dst->buffer_texture_ =
nullptr;
60 if (src->vbo_id_ != 0) {
63 glGenBuffers(1, &dst->vbo_id_);
64 glBindBuffer(GL_COPY_WRITE_BUFFER, dst->vbo_id_);
65 glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_,
nullptr,
to_gl(dst->
usage_));
67 glBindBuffer(GL_COPY_READ_BUFFER, src->vbo_id_);
69 glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, dst->vbo_size_);
74 if (
data_ !=
nullptr) {
89 glGenBuffers(1, &vbo_id_);
92 glBindBuffer(GL_ARRAY_BUFFER, vbo_id_);
102 glBufferSubData(GL_ARRAY_BUFFER, 0, vbo_size_,
data_);
109 flag &= ~GPU_VERTBUF_DATA_DIRTY;
118 glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, vbo_id_);
130 if (buffer_texture_ ==
nullptr) {
139 void *result = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY);
141 glUnmapBuffer(GL_ARRAY_BUFFER);
149 vbo_id_ =
uint(handle);
154bool GLVertBuf::is_active()
const
159 int active_vbo_id = 0;
160 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &active_vbo_id);
161 return vbo_id_ == active_vbo_id;
166 glBufferSubData(GL_ARRAY_BUFFER, start,
len, data);
MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b)
void GPU_texture_bind(GPUTexture *texture, int unit)
GPUTexture * GPU_texture_create_from_vertbuf(const char *name, blender::gpu::VertBuf *vertex_buf)
#define GPU_TEXTURE_FREE_SAFE(texture)
@ GPU_VERTBUF_DATA_UPLOADED
#define MEM_reallocN(vmemh, len)
static void buf_free(GLuint buf_id)
uint16_t bound_ssbo_slots
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 duplicate_data(VertBuf *dst) override
void resize_data() override
void update_sub(uint start, uint len, const void *data) override
void acquire_data() override
void release_data() override
size_t size_used_get() const
size_t size_alloc_get() const
static size_t memory_usage
void *(* MEM_mallocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
static GLenum to_gl(const GPUAttachmentType type)
unsigned __int64 uint64_t