diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-07-19 16:48:13 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-07-19 17:13:15 +0300 |
commit | 5037dd8abdf9335e998141336d4e15f81580c491 (patch) | |
tree | 0f6a1df0db24e27c3dbef47cf858132f0b975a66 /source/blender/gpu/intern/gpu_element.c | |
parent | 3882d0943b33c42d1dbe67d10d2432c0e7191959 (diff) |
GPU: Add GC to FBOs and UBOs and centralize all GCs
GPUFrameBuffers were being free when no context was attached or in the
wrong gl context. This make sure this does not happen again.
You can now safely free any gl resource from any thread (well as long as
it's not used anymore!).
Diffstat (limited to 'source/blender/gpu/intern/gpu_element.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_element.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_element.c b/source/blender/gpu/intern/gpu_element.c index 9abfed2db05..901e09443d1 100644 --- a/source/blender/gpu/intern/gpu_element.c +++ b/source/blender/gpu/intern/gpu_element.c @@ -30,7 +30,8 @@ */ #include "GPU_element.h" -#include "GPU_buffer_id.h" + +#include "gpu_context_private.h" #include <stdlib.h> @@ -279,7 +280,7 @@ void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *builder, GPUIndexBuf *elem) #endif if (elem->vbo_id == 0) { - elem->vbo_id = GPU_buf_id_alloc(); + elem->vbo_id = GPU_buf_alloc(); } /* send data to GPU */ /* GL_ELEMENT_ARRAY_BUFFER changes the state of the last VAO bound, @@ -302,7 +303,7 @@ void GPU_indexbuf_use(GPUIndexBuf *elem) void GPU_indexbuf_discard(GPUIndexBuf *elem) { if (elem->vbo_id) { - GPU_buf_id_free(elem->vbo_id); + GPU_buf_free(elem->vbo_id); } free(elem); } |