diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-15 18:54:24 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-16 20:22:24 +0300 |
commit | 39af6c27f58df4da3325b843dadb1608181b83bb (patch) | |
tree | feefabd05f0d2b6c0a6f8a9d366bbe16b14700ab | |
parent | d9eb17b18e3c613ffbf00d04717cc6eae09d1410 (diff) |
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.
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 13 |
1 files 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); } |