diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-03-14 14:55:19 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-03-14 14:55:19 +0300 |
commit | 3530ee2949bf9d95e1e40cc06086ed4ff755299d (patch) | |
tree | ab5d1f942c4c3337250e5513520926d563f54d7c /source/blender/gpu | |
parent | b4209b138f6bda863009568bf8dc19eb5cf8361c (diff) |
GPUViewport: Fix offscreen multisample syncing.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 42dfe59389d..d123368f6ff 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -153,15 +153,22 @@ GPUViewport *GPU_viewport_create_from_offscreen(struct GPUOffScreen *ofs) */ void GPU_viewport_clear_from_offscreen(GPUViewport *viewport) { - if (viewport->fbl->multisample_fb) { - viewport->fbl->multisample_fb = NULL; - viewport->txl->multisample_color = NULL; - viewport->txl->multisample_depth = NULL; + DefaultFramebufferList *dfbl = viewport->fbl; + DefaultTextureList *dtxl = viewport->txl; + + if (dfbl->multisample_fb) { + /* GPUViewport expect the final result to be in default_fb but + * GPUOffscreen wants it in its multisample_fb, so we sync it back. */ + GPU_framebuffer_blit(dfbl->default_fb, 0, dfbl->multisample_fb, 0, false, false); + GPU_framebuffer_blit(dfbl->default_fb, 0, dfbl->multisample_fb, 0, true, false); + dfbl->multisample_fb = NULL; + dtxl->multisample_color = NULL; + dtxl->multisample_depth = NULL; } else { viewport->fbl->default_fb = NULL; - viewport->txl->color = NULL; - viewport->txl->depth = NULL; + dtxl->color = NULL; + dtxl->depth = NULL; } } |