[Bf-blender-cvs] [ea571ddc29e] master: Fix T101969: Crash when using large texture with nonstandard colorspace

Lukas Stockner noreply at git.blender.org
Sat Oct 22 03:31:51 CEST 2022


Commit: ea571ddc29e4e7be441a9b58bef50190a4a35c04
Author: Lukas Stockner
Date:   Sat Oct 22 02:51:52 2022 +0200
Branches: master
https://developer.blender.org/rBea571ddc29e4e7be441a9b58bef50190a4a35c04

Fix T101969: Crash when using large texture with nonstandard colorspace

When the image colorspace is not data, linear or sRGB, the image will
be converted to float (and colorspace-converted) during loading.

However, if it also needs to be rescaled (due to exceeding the GPU
texture size limit), the resizing assumed that it's still a byte
texture.

===================================================================

M	source/blender/imbuf/intern/util_gpu.c

===================================================================

diff --git a/source/blender/imbuf/intern/util_gpu.c b/source/blender/imbuf/intern/util_gpu.c
index dd509677d8d..5ed6b2b9843 100644
--- a/source/blender/imbuf/intern/util_gpu.c
+++ b/source/blender/imbuf/intern/util_gpu.c
@@ -174,6 +174,7 @@ static void *imb_gpu_get_data(const ImBuf *ibuf,
       /* Other colorspace, store as float texture to avoid precision loss. */
       data_rect = MEM_mallocN(sizeof(float[4]) * ibuf->x * ibuf->y, __func__);
       *r_freedata = freedata = true;
+      is_float_rect = true;
 
       if (data_rect == NULL) {
         return NULL;



More information about the Bf-blender-cvs mailing list