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/intern/gpu_context.cpp')
-rw-r--r--source/blender/gpu/intern/gpu_context.cpp12
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;