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.
This commit is contained in:
2019-01-22 16:30:17 +01:00
parent 3fb72a5432
commit aae2bf7735
2 changed files with 12 additions and 0 deletions

View File

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