diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-01-22 18:30:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-01-25 17:02:30 +0300 |
commit | aae2bf77351103b15e5a97daed7f396a546c001c (patch) | |
tree | 3ae216aa4de18d92c23b9e76203f0e68128331ea /source/blender/gpu/intern/gpu_framebuffer.c | |
parent | 3fb72a5432a722ac036e5b567940ace13e64705d (diff) |
T60745: GPU texture alloc failed when opening Preference Windows
Was generating INVALID_FRAMEBUFFER here instead of failled texture alloc.
Add safety asserts in gpu_texture.c and clamp minimum size to 1 inside
GPU_offscreen_create.
Diffstat (limited to 'source/blender/gpu/intern/gpu_framebuffer.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index b6c8dae2b37..6bb5d668e62 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -792,6 +792,11 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept ofs = MEM_callocN(sizeof(GPUOffScreen), "GPUOffScreen"); + /* Sometimes areas can have 0 height or width and this will + * create a 1D texture which we don't want. */ + height = max_ii(1, height); + width = max_ii(1, width); + ofs->color = GPU_texture_create_2D_multisample( width, height, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL, samples, err_out); |