diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-29 02:13:54 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-30 14:11:02 +0300 |
commit | f3a65a1b4aa3c7da221acdbeee20afb7ebe3b221 (patch) | |
tree | 1b7b8c90ef0ecb891b35c8fa89cf25873035d784 /source/blender/windowmanager | |
parent | 0850afb34e21c073eb2a4c7475eeab2684f30e43 (diff) |
GPUFrameBuffer: GL backend isolation
This is related to the Vulkan port T68990.
This is a full cleanup of the Framebuffer module and a separation
of OpenGL related functions.
There is some changes with how the default framebuffers are handled.
Now the default framebuffers are individually wrapped inside special
GLFrameBuffers. This make it easier to keep track of the currently bound
framebuffer state and have some specificity for operations on these
framebuffers.
Another change is dropping the optimisation of only configuring the
changed attachements during framebuffers update. This does not give
any benefits and add some complexity to the code. This might be brought
back if it has a performance impact on some systems.
This also adds support for naming framebuffers but it is currently not
used.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_surface.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 12 |
3 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 6c9bba0791c..a5dfc9893a5 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -826,13 +826,11 @@ static void wm_draw_window(bContext *C, wmWindow *win) } else if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { /* For pageflip we simply draw to both back buffers. */ - GPU_backbuffer_bind(GPU_BACKBUFFER_LEFT); - wm_draw_window_onscreen(C, win, 0); - GPU_backbuffer_bind(GPU_BACKBUFFER_RIGHT); wm_draw_window_onscreen(C, win, 1); - GPU_backbuffer_bind(GPU_BACKBUFFER); + GPU_backbuffer_bind(GPU_BACKBUFFER_LEFT); + wm_draw_window_onscreen(C, win, 0); } else if (ELEM(win->stereo3d_format->display_mode, S3D_DISPLAY_ANAGLYPH, S3D_DISPLAY_INTERLACE)) { /* For anaglyph and interlace, we draw individual regions with diff --git a/source/blender/windowmanager/intern/wm_surface.c b/source/blender/windowmanager/intern/wm_surface.c index 9948434d340..e8cb5d9cd7d 100644 --- a/source/blender/windowmanager/intern/wm_surface.c +++ b/source/blender/windowmanager/intern/wm_surface.c @@ -84,7 +84,7 @@ void wm_surface_set_drawable(wmSurface *surface, bool activate) void wm_surface_make_drawable(wmSurface *surface) { - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); if (surface != g_drawable) { wm_surface_clear_drawable(); @@ -95,7 +95,7 @@ void wm_surface_make_drawable(wmSurface *surface) void wm_surface_reset_drawable(void) { BLI_assert(BLI_thread_is_main()); - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); if (g_drawable) { wm_surface_clear_drawable(); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 69c08427c4a..4c5b7194b0a 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1115,7 +1115,7 @@ void wm_window_clear_drawable(wmWindowManager *wm) void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) { - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); if (win != wm->windrawable && win->ghostwin) { // win->lmbut = 0; /* keeps hanging when mousepressed while other window opened */ @@ -1136,7 +1136,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) void wm_window_reset_drawable(void) { BLI_assert(BLI_thread_is_main()); - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); wmWindowManager *wm = G_MAIN->wm.first; if (wm == NULL) { @@ -2487,25 +2487,25 @@ void *WM_opengl_context_create(void) * So we should call this function only on the main thread. */ BLI_assert(BLI_thread_is_main()); - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); return GHOST_CreateOpenGLContext(g_system); } void WM_opengl_context_dispose(void *context) { - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); GHOST_DisposeOpenGLContext(g_system, (GHOST_ContextHandle)context); } void WM_opengl_context_activate(void *context) { - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); GHOST_ActivateOpenGLContext((GHOST_ContextHandle)context); } void WM_opengl_context_release(void *context) { - BLI_assert(GPU_framebuffer_active_get() == NULL); + BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); GHOST_ReleaseOpenGLContext((GHOST_ContextHandle)context); } |