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_texture.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_texture.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 028d1fe1a8f..93ef6fca485 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -994,6 +994,7 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap) GPUTexture *GPU_texture_create_1D( int w, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { + BLI_assert(w > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, 0, 0, 1, pixels, tex_format, data_format, 0, false, err_out); } @@ -1001,6 +1002,7 @@ GPUTexture *GPU_texture_create_1D( GPUTexture *GPU_texture_create_1D_array( int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { + BLI_assert(w > 0 && h > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 1, pixels, tex_format, data_format, 0, false, err_out); } @@ -1008,6 +1010,7 @@ GPUTexture *GPU_texture_create_1D_array( GPUTexture *GPU_texture_create_2D( int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { + BLI_assert(w > 0 && h > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, 0, false, err_out); } @@ -1015,6 +1018,7 @@ GPUTexture *GPU_texture_create_2D( GPUTexture *GPU_texture_create_2D_multisample( int w, int h, eGPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256]) { + BLI_assert(w > 0 && h > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, samples, false, err_out); } @@ -1022,6 +1026,7 @@ GPUTexture *GPU_texture_create_2D_multisample( GPUTexture *GPU_texture_create_2D_array( int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { + BLI_assert(w > 0 && h > 0 && d > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, d, 2, pixels, tex_format, data_format, 0, false, err_out); } @@ -1029,6 +1034,7 @@ GPUTexture *GPU_texture_create_2D_array( GPUTexture *GPU_texture_create_3D( int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { + BLI_assert(w > 0 && h > 0 && d > 0); eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, d, 3, pixels, tex_format, data_format, 0, true, err_out); } @@ -1036,6 +1042,7 @@ GPUTexture *GPU_texture_create_3D( GPUTexture *GPU_texture_create_cube( int w, eGPUTextureFormat tex_format, const float *fpixels, char err_out[256]) { + BLI_assert(w > 0); const float *fpixels_px, *fpixels_py, *fpixels_pz, *fpixels_nx, *fpixels_ny, *fpixels_nz; const int channels = gpu_get_component_count(tex_format); |