Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/opengl/gl_index_buffer.cc
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2020 Blender Foundation. | * The Original Code is Copyright (C) 2020 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup gpu | * \ingroup gpu | ||||
| */ | */ | ||||
| #include "gl_backend.hh" | #include "gl_context.hh" | ||||
| #include "gl_debug.hh" | #include "gl_debug.hh" | ||||
| #include "gl_index_buffer.hh" | #include "gl_index_buffer.hh" | ||||
| namespace blender::gpu { | namespace blender::gpu { | ||||
| GLIndexBuf::~GLIndexBuf() | GLIndexBuf::~GLIndexBuf() | ||||
| { | { | ||||
| GLBackend::get()->buf_free(ibo_id_); | GLContext::buf_free(ibo_id_); | ||||
| } | } | ||||
| void GLIndexBuf::bind(void) | void GLIndexBuf::bind(void) | ||||
| { | { | ||||
| if (is_subrange_) { | if (is_subrange_) { | ||||
| static_cast<GLIndexBuf *>(src_)->bind(); | static_cast<GLIndexBuf *>(src_)->bind(); | ||||
| return; | return; | ||||
| } | } | ||||
| Show All 13 Lines | if (data_ != nullptr) { | ||||
| /* Sends data to GPU. */ | /* Sends data to GPU. */ | ||||
| glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data_, GL_STATIC_DRAW); | glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data_, GL_STATIC_DRAW); | ||||
| /* No need to keep copy of data in system memory. */ | /* No need to keep copy of data in system memory. */ | ||||
| MEM_SAFE_FREE(data_); | MEM_SAFE_FREE(data_); | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::gpu | } // namespace blender::gpu | ||||
| No newline at end of file | No newline at end of file | ||||