Fix: crash when creating GPU texture from image fails

This commit is contained in:
Brecht Van Lommel 2021-04-29 18:28:25 +02:00
parent f0eda57392
commit b4f0d52473
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #87982, Crash when switching render slots while render is in progress
1 changed files with 14 additions and 10 deletions

View File

@ -408,17 +408,19 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
store_premultiplied,
limit_gl_texture_size);
GPU_texture_wrap_mode(*tex, true, false);
if (*tex) {
GPU_texture_wrap_mode(*tex, true, false);
if (GPU_mipmap_enabled()) {
GPU_texture_generate_mipmap(*tex);
if (ima) {
ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE;
if (GPU_mipmap_enabled()) {
GPU_texture_generate_mipmap(*tex);
if (ima) {
ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE;
}
GPU_texture_mipmap_mode(*tex, true, true);
}
else {
GPU_texture_mipmap_mode(*tex, false, true);
}
GPU_texture_mipmap_mode(*tex, true, true);
}
else {
GPU_texture_mipmap_mode(*tex, false, true);
}
}
@ -427,7 +429,9 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
BKE_image_release_ibuf(ima, ibuf_intern, NULL);
}
GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y);
if (*tex) {
GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y);
}
return *tex;
}