diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_image/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 18 | ||||
-rw-r--r-- | source/blender/gpu/GPU_viewport.h | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 12 |
4 files changed, 28 insertions, 8 deletions
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 12de74c6ae7..24ec7a89397 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -23,6 +23,7 @@ set(INC ../../blentranslation ../../bmesh ../../depsgraph + ../../draw ../../gpu ../../imbuf ../../makesdna diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1799fc10c76..ac0dbba1606 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -75,11 +75,10 @@ #include "GPU_batch_presets.h" #include "GPU_framebuffer.h" #include "GPU_viewport.h" -#include "image_intern.h" -/* TODO(fclem) remove bad level calls */ -#include "../draw/DRW_engine.h" -#include "wm_draw.h" +#include "DRW_engine_types.h" + +#include "image_intern.h" /**************************** common state *****************************/ @@ -644,14 +643,17 @@ static void image_main_region_draw(const bContext *C, ARegion *region) float col[3]; GPU_batch_presets_reset(); + GPUViewport *viewport = WM_draw_region_get_viewport(region); + GPUFrameBuffer *framebuffer_default, *framebuffer_overlay; + + framebuffer_default = GPU_viewport_framebuffer_default_get(viewport); + framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport); - GPUViewport *viewport = region->draw_buffer->viewport; - DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); - GPU_framebuffer_bind(fbl->default_fb); + GPU_framebuffer_bind(framebuffer_default); GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f); GPU_clear(GPU_COLOR_BIT); - GPU_framebuffer_bind(fbl->overlay_fb); + GPU_framebuffer_bind(framebuffer_overlay); /* XXX not supported yet, disabling for now */ scene->r.scemode &= ~R_COMP_CROP; diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index 50d265feaad..878e7e3e9a8 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -41,6 +41,8 @@ extern "C" { typedef struct GPUViewport GPUViewport; +struct GPUFrameBuffer; + /* Contains memory pools information */ typedef struct ViewportMemoryPool { struct BLI_memblock *commands; @@ -151,6 +153,9 @@ GPUTexture *GPU_viewport_texture_pool_query( bool GPU_viewport_engines_data_validate(GPUViewport *viewport, void **engine_handle_array); void GPU_viewport_cache_release(GPUViewport *viewport); +struct GPUFrameBuffer *GPU_viewport_framebuffer_default_get(GPUViewport *viewport); +struct GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport); + #ifdef __cplusplus } #endif diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 4d31366f53f..7f133ca626d 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -1036,3 +1036,15 @@ void GPU_viewport_free(GPUViewport *viewport) MEM_freeN(viewport); } + +GPUFrameBuffer *GPU_viewport_framebuffer_default_get(GPUViewport *viewport) +{ + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + return fbl->default_fb; +} + +GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport) +{ + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + return fbl->overlay_fb; +} |