diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-04-20 21:51:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-20 21:57:28 +0300 |
commit | be648680c7542c161cf4709846b88bf6c480e2fe (patch) | |
tree | 26d199a41b2e80dba064cbbd0a3b0b7b7bba0ca2 | |
parent | 6dc50bc25ae96039b9c2a4eba82ea9dad2b42c84 (diff) |
Fix frame-buffer texture creation
- disable depth buffer didn't work.
- push/pop viewport bit was needed.
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index cb23b436fcb..73a1f14b9f6 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -664,11 +664,13 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept ofs->depth = GPU_texture_create_depth_with_stencil_multisample(width, height, samples, err_out); } - if (!ofs->depth || !ofs->color) { + if ((depth && !ofs->depth) || !ofs->color) { GPU_offscreen_free(ofs); return NULL; } - + + gpuPushAttrib(GPU_VIEWPORT_BIT); + GPU_framebuffer_ensure_config(&ofs->fb, { GPU_ATTACHMENT_TEXTURE(ofs->depth), GPU_ATTACHMENT_TEXTURE(ofs->color) @@ -677,11 +679,14 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept /* check validity at the very end! */ if (!GPU_framebuffer_check_valid(ofs->fb, err_out)) { GPU_offscreen_free(ofs); + gpuPopAttrib(); return NULL; } GPU_framebuffer_restore(); + gpuPopAttrib(); + return ofs; } |