GPUViewport: Fix offscreen multisample syncing.

This commit is contained in:
Clément Foucault 2018-03-14 12:55:19 +01:00
parent b4209b138f
commit 3530ee2949
2 changed files with 13 additions and 10 deletions

View File

@ -334,10 +334,6 @@ static void eevee_draw_background(void *vedata)
EEVEE_volumes_free_smoke_textures();
if (DRW_state_is_image_render()) {
MULTISAMPLE_SYNC_ENABLE(dfbl);
}
stl->g_data->view_updated = false;
}

View File

@ -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;
}
}