diff options
author | Tomoaki Kawada <i@yvt.jp> | 2019-06-01 18:54:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-02 13:50:50 +0300 |
commit | 62fe7e9a9d0e211bc2ad4cdfedb2489c5f899133 (patch) | |
tree | caa21887fa80485937012a17edcea8126ae7482e /source/blender/gpu/intern/gpu_context.cpp | |
parent | 2a5dc454f63a4c3442d0ff0715cbd3d135bb5ca7 (diff) |
GPU: support default framebuffer with ID not equal to 0
Diffstat (limited to 'source/blender/gpu/intern/gpu_context.cpp')
-rw-r--r-- | source/blender/gpu/intern/gpu_context.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_context.cpp b/source/blender/gpu/intern/gpu_context.cpp index 4bfc44327c2..a0e03e61d5d 100644 --- a/source/blender/gpu/intern/gpu_context.cpp +++ b/source/blender/gpu/intern/gpu_context.cpp @@ -64,6 +64,7 @@ static std::mutex orphans_mutex; struct GPUContext { GLuint default_vao; + GLuint default_framebuffer; GPUFrameBuffer *current_fbo; std::unordered_set<GPUBatch *> batches; /* Batches that have VAOs from this context */ #ifdef DEBUG @@ -137,11 +138,12 @@ static void orphans_clear(GPUContext *ctx) orphans_mutex.unlock(); } -GPUContext *GPU_context_create(void) +GPUContext *GPU_context_create(GLuint default_framebuffer) { /* BLI_assert(thread_is_main()); */ GPUContext *ctx = new GPUContext; glGenVertexArrays(1, &ctx->default_vao); + ctx->default_framebuffer = default_framebuffer; GPU_context_active_set(ctx); return ctx; } @@ -201,6 +203,14 @@ GLuint GPU_vao_default(void) return active_ctx->default_vao; } +GLuint GPU_framebuffer_default(void) +{ + BLI_assert(active_ctx); /* need at least an active context */ + BLI_assert(pthread_equal( + pthread_self(), active_ctx->thread)); /* context has been activated by another thread! */ + return active_ctx->default_framebuffer; +} + GLuint GPU_vao_alloc(void) { GLuint new_vao_id = 0; |