Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/opengl/gl_vertex_buffer.cc')
-rw-r--r--source/blender/gpu/opengl/gl_vertex_buffer.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/gpu/opengl/gl_vertex_buffer.cc b/source/blender/gpu/opengl/gl_vertex_buffer.cc
index a724c94775e..a56d5269fde 100644
--- a/source/blender/gpu/opengl/gl_vertex_buffer.cc
+++ b/source/blender/gpu/opengl/gl_vertex_buffer.cc
@@ -27,19 +27,19 @@
namespace blender::gpu {
-void GLVertBuf::acquire_data(void)
+void GLVertBuf::acquire_data()
{
/* Discard previous data if any. */
MEM_SAFE_FREE(data);
data = (uchar *)MEM_mallocN(sizeof(uchar) * this->size_alloc_get(), __func__);
}
-void GLVertBuf::resize_data(void)
+void GLVertBuf::resize_data()
{
data = (uchar *)MEM_reallocN(data, sizeof(uchar) * this->size_alloc_get());
}
-void GLVertBuf::release_data(void)
+void GLVertBuf::release_data()
{
if (vbo_id_ != 0) {
GLContext::buf_free(vbo_id_);
@@ -52,7 +52,7 @@ void GLVertBuf::release_data(void)
void GLVertBuf::duplicate_data(VertBuf *dst_)
{
- BLI_assert(GLContext::get() != NULL);
+ BLI_assert(GLContext::get() != nullptr);
GLVertBuf *src = this;
GLVertBuf *dst = static_cast<GLVertBuf *>(dst_);
@@ -61,7 +61,7 @@ void GLVertBuf::duplicate_data(VertBuf *dst_)
glGenBuffers(1, &dst->vbo_id_);
glBindBuffer(GL_COPY_WRITE_BUFFER, dst->vbo_id_);
- glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, NULL, to_gl(dst->usage_));
+ glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, nullptr, to_gl(dst->usage_));
glBindBuffer(GL_COPY_READ_BUFFER, src->vbo_id_);
@@ -75,14 +75,14 @@ void GLVertBuf::duplicate_data(VertBuf *dst_)
}
}
-void GLVertBuf::upload_data(void)
+void GLVertBuf::upload_data()
{
this->bind();
}
-void GLVertBuf::bind(void)
+void GLVertBuf::bind()
{
- BLI_assert(GLContext::get() != NULL);
+ BLI_assert(GLContext::get() != nullptr);
if (vbo_id_ == 0) {
glGenBuffers(1, &vbo_id_);
@@ -93,7 +93,7 @@ void GLVertBuf::bind(void)
if (flag & GPU_VERTBUF_DATA_DIRTY) {
vbo_size_ = this->size_used_get();
/* Orphan the vbo to avoid sync then upload data. */
- glBufferData(GL_ARRAY_BUFFER, vbo_size_, NULL, to_gl(usage_));
+ glBufferData(GL_ARRAY_BUFFER, vbo_size_, nullptr, to_gl(usage_));
glBufferSubData(GL_ARRAY_BUFFER, 0, vbo_size_, data);
memory_usage += vbo_size_;
@@ -106,4 +106,9 @@ void GLVertBuf::bind(void)
}
}
-} // namespace blender::gpu \ No newline at end of file
+void GLVertBuf::update_sub(uint start, uint len, void *data)
+{
+ glBufferSubData(GL_ARRAY_BUFFER, start, len, data);
+}
+
+} // namespace blender::gpu