diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 318e162b5f1..5411657976e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6032,7 +6032,7 @@ static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTe if (lctex->data) { BLO_read_data_address(reader, &lctex->data); - if (BLO_read_requires_endian_switch(reader)) { + if (lctex->data && BLO_read_requires_endian_switch(reader)) { int data_size = lctex->components * lctex->tex_size[0] * lctex->tex_size[1] * lctex->tex_size[2]; @@ -6044,6 +6044,10 @@ static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTe } } } + + if (lctex->data == NULL) { + zero_v3_int(lctex->tex_size); + } } static void direct_link_lightcache(BlendDataReader *reader, LightCache *cache) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 59f27f6cec2..d842c204ba1 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2497,7 +2497,12 @@ static void write_lightcache_texture(BlendWriter *writer, LightCacheTexture *tex else if (tex->data_type == LIGHTCACHETEX_UINT) { data_size *= sizeof(uint); } - BLO_write_raw(writer, data_size, tex->data); + + /* FIXME: We can't save more than what 32bit systems can handle. + * The solution would be to split the texture but it is too late for 2.90. (see T78529) */ + if (data_size < INT_MAX) { + BLO_write_raw(writer, data_size, tex->data); + } } } |