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:
authorClément Foucault <foucault.clem@gmail.com>2020-08-06 05:30:38 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-08 02:15:28 +0300
commit0ccf3f89d2e2389d433d1ab682ad04310a9b19ae (patch)
tree4670325763c47478f86f29de394e3de933943f1d /source/blender
parent0255f1e0225d2eebfd39a9c16d9be299857b9efc (diff)
GPU: Move ghost default framebuffer getter to context creation
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/CMakeLists.txt1
-rw-r--r--source/blender/gpu/GPU_context.h2
-rw-r--r--source/blender/gpu/intern/gpu_context.cc12
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c3
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
5 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 3ea18f72166..4e9b4a5b313 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -42,6 +42,7 @@ set(INC
../nodes
../nodes/intern
+ ../../../intern/ghost
../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/mantaflow/extern
diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index 4f0edaf3ac8..0d9e1014803 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -35,7 +35,7 @@ extern "C" {
typedef struct GPUContext GPUContext;
-GPUContext *GPU_context_create(GLuint default_framebuffer);
+GPUContext *GPU_context_create(void *ghost_window);
void GPU_context_discard(GPUContext *);
void GPU_context_active_set(GPUContext *);
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index e6356580ea3..c3c0863f6cd 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -34,6 +34,8 @@
#include "GPU_context.h"
#include "GPU_framebuffer.h"
+#include "GHOST_C-api.h"
+
#include "gpu_batch_private.h"
#include "gpu_context_private.h"
#include "gpu_matrix_private.h"
@@ -138,12 +140,18 @@ static void orphans_clear(GPUContext *ctx)
orphans_mutex.unlock();
}
-GPUContext *GPU_context_create(GLuint default_framebuffer)
+GPUContext *GPU_context_create(void *ghost_window)
{
/* BLI_assert(thread_is_main()); */
GPUContext *ctx = new GPUContext;
glGenVertexArrays(1, &ctx->default_vao);
- ctx->default_framebuffer = default_framebuffer;
+ if (ghost_window != NULL) {
+ ctx->default_framebuffer = GHOST_GetDefaultOpenGLFramebuffer((GHOST_WindowHandle)ghost_window);
+ }
+ else {
+ ctx->default_framebuffer = 0;
+ }
+
ctx->matrix_state = GPU_matrix_state_create();
GPU_context_active_set(ctx);
return ctx;
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index d0a70596957..a0a21fadbbb 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -1293,8 +1293,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
// GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
/* initialize OpenGL immediate mode */
- GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(g_WS.ghost_window);
- g_WS.gpu_context = GPU_context_create(default_fb);
+ g_WS.gpu_context = GPU_context_create(g_WS.ghost_window);
GPU_init();
immActivate();
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index e0dcd746aea..47afa343394 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -615,8 +615,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm,
if (ghostwin) {
GHOST_RectangleHandle bounds;
- GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(ghostwin);
- win->gpuctx = GPU_context_create(default_fb);
+ win->gpuctx = GPU_context_create(ghostwin);
/* needed so we can detect the graphics card below */
GPU_init();