forked from bartvdbraak/blender
GPU: Move ghost default framebuffer getter to context creation
This commit is contained in:
parent
0255f1e022
commit
0ccf3f89d2
@ -330,8 +330,7 @@ MainWindow *mainwindow_new(MultiTestApp *app)
|
|||||||
if (win) {
|
if (win) {
|
||||||
MainWindow *mw = MEM_callocN(sizeof(*mw), "mainwindow_new");
|
MainWindow *mw = MEM_callocN(sizeof(*mw), "mainwindow_new");
|
||||||
|
|
||||||
GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(win);
|
mw->gpu_context = GPU_context_create(win);
|
||||||
mw->gpu_context = GPU_context_create(default_fb);
|
|
||||||
GPU_init();
|
GPU_init();
|
||||||
|
|
||||||
mw->app = app;
|
mw->app = app;
|
||||||
@ -587,8 +586,7 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app)
|
|||||||
if (win) {
|
if (win) {
|
||||||
LoggerWindow *lw = MEM_callocN(sizeof(*lw), "loggerwindow_new");
|
LoggerWindow *lw = MEM_callocN(sizeof(*lw), "loggerwindow_new");
|
||||||
|
|
||||||
GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(win);
|
lw->gpu_context = GPU_context_create(win);
|
||||||
lw->gpu_context = GPU_context_create(default_fb);
|
|
||||||
GPU_init();
|
GPU_init();
|
||||||
|
|
||||||
int bbox[2][2];
|
int bbox[2][2];
|
||||||
@ -788,8 +786,7 @@ ExtraWindow *extrawindow_new(MultiTestApp *app)
|
|||||||
if (win) {
|
if (win) {
|
||||||
ExtraWindow *ew = MEM_callocN(sizeof(*ew), "mainwindow_new");
|
ExtraWindow *ew = MEM_callocN(sizeof(*ew), "mainwindow_new");
|
||||||
|
|
||||||
GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(win);
|
ew->gpu_context = GPU_context_create(win);
|
||||||
ew->gpu_context = GPU_context_create(default_fb);
|
|
||||||
GPU_init();
|
GPU_init();
|
||||||
|
|
||||||
ew->app = app;
|
ew->app = app;
|
||||||
|
@ -42,6 +42,7 @@ set(INC
|
|||||||
../nodes
|
../nodes
|
||||||
../nodes/intern
|
../nodes/intern
|
||||||
|
|
||||||
|
../../../intern/ghost
|
||||||
../../../intern/glew-mx
|
../../../intern/glew-mx
|
||||||
../../../intern/guardedalloc
|
../../../intern/guardedalloc
|
||||||
../../../intern/mantaflow/extern
|
../../../intern/mantaflow/extern
|
||||||
|
@ -35,7 +35,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct GPUContext GPUContext;
|
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_discard(GPUContext *);
|
||||||
|
|
||||||
void GPU_context_active_set(GPUContext *);
|
void GPU_context_active_set(GPUContext *);
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#include "GPU_context.h"
|
#include "GPU_context.h"
|
||||||
#include "GPU_framebuffer.h"
|
#include "GPU_framebuffer.h"
|
||||||
|
|
||||||
|
#include "GHOST_C-api.h"
|
||||||
|
|
||||||
#include "gpu_batch_private.h"
|
#include "gpu_batch_private.h"
|
||||||
#include "gpu_context_private.h"
|
#include "gpu_context_private.h"
|
||||||
#include "gpu_matrix_private.h"
|
#include "gpu_matrix_private.h"
|
||||||
@ -138,12 +140,18 @@ static void orphans_clear(GPUContext *ctx)
|
|||||||
orphans_mutex.unlock();
|
orphans_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUContext *GPU_context_create(GLuint default_framebuffer)
|
GPUContext *GPU_context_create(void *ghost_window)
|
||||||
{
|
{
|
||||||
/* BLI_assert(thread_is_main()); */
|
/* BLI_assert(thread_is_main()); */
|
||||||
GPUContext *ctx = new GPUContext;
|
GPUContext *ctx = new GPUContext;
|
||||||
glGenVertexArrays(1, &ctx->default_vao);
|
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();
|
ctx->matrix_state = GPU_matrix_state_create();
|
||||||
GPU_context_active_set(ctx);
|
GPU_context_active_set(ctx);
|
||||||
return ctx;
|
return ctx;
|
||||||
|
@ -1293,8 +1293,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
|||||||
// GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
|
// GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
|
||||||
|
|
||||||
/* initialize OpenGL immediate mode */
|
/* initialize OpenGL immediate mode */
|
||||||
GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(g_WS.ghost_window);
|
g_WS.gpu_context = GPU_context_create(g_WS.ghost_window);
|
||||||
g_WS.gpu_context = GPU_context_create(default_fb);
|
|
||||||
GPU_init();
|
GPU_init();
|
||||||
immActivate();
|
immActivate();
|
||||||
|
|
||||||
|
@ -615,8 +615,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm,
|
|||||||
if (ghostwin) {
|
if (ghostwin) {
|
||||||
GHOST_RectangleHandle bounds;
|
GHOST_RectangleHandle bounds;
|
||||||
|
|
||||||
GLuint default_fb = GHOST_GetDefaultOpenGLFramebuffer(ghostwin);
|
win->gpuctx = GPU_context_create(ghostwin);
|
||||||
win->gpuctx = GPU_context_create(default_fb);
|
|
||||||
|
|
||||||
/* needed so we can detect the graphics card below */
|
/* needed so we can detect the graphics card below */
|
||||||
GPU_init();
|
GPU_init();
|
||||||
|
Loading…
Reference in New Issue
Block a user