From 39af6c27f58df4da3325b843dadb1608181b83bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 15 Jan 2018 16:54:24 +0100 Subject: [PATCH] DRW: Change framebuffer texture creation. Instead of creating non temp textures only at framebuffer creation, we create them and bind them if their pointer is NULL. This should simplify the framebuffers creation code. --- source/blender/draw/intern/draw_manager.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 5d8f604e86b..ae7712a36c3 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2329,6 +2329,7 @@ void DRW_framebuffer_init( for (int i = 0; i < textures_len; ++i) { int channels; bool is_depth; + bool create_tex = false; DRWFboTexture fbotex = textures[i]; bool is_temp = (fbotex.flag & DRW_TEX_TEMP) != 0; @@ -2341,16 +2342,18 @@ void DRW_framebuffer_init( *fbotex.tex = GPU_viewport_texture_pool_query( DST.viewport, engine_type, width, height, channels, gpu_format); } - else if (create_fb) { + else { *fbotex.tex = GPU_texture_create_2D_custom( width, height, channels, gpu_format, NULL, NULL); + create_tex = true; } } - if (create_fb) { - if (!is_depth) { - ++color_attachment; - } + if (!is_depth) { + ++color_attachment; + } + + if (create_fb || create_tex) { drw_texture_set_parameters(*fbotex.tex, fbotex.flag); GPU_framebuffer_texture_attach(*fb, *fbotex.tex, color_attachment, 0); }