mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix #159311: Cycles texture cache issues with different working spaces
The colorspace from the tx file was not properly used, which caused some wrong colorspace conversions when using working spaces other than Linear Rec.709. Pull Request: https://projects.blender.org/blender/blender/pulls/159543
This commit is contained in:
parent
c51fcf73a7
commit
5d2b8f8a52
12 changed files with 48 additions and 3 deletions
|
|
@ -28,6 +28,9 @@ ustring u_colorspace_scene_linear_srgb("scene_linear_srgb");
|
|||
ustring u_colorspace_srgb("__builtin_srgb");
|
||||
|
||||
/* Cached data. */
|
||||
static thread_mutex cache_xyz_to_scene_linear_mutex;
|
||||
static string cache_xyz_to_scene_linear_hash;
|
||||
|
||||
#ifdef WITH_OCIO
|
||||
static thread_mutex cache_processors_mutex;
|
||||
static unordered_map<ustring, OCIO::ConstProcessorRcPtr> cache_processors;
|
||||
|
|
@ -75,13 +78,14 @@ static void check_invalidate_caches()
|
|||
cache_scene_linear_interop_id = "";
|
||||
cache_scene_linear_srgb_interop_id = "";
|
||||
}
|
||||
{
|
||||
const thread_scoped_lock cache_lock(cache_xyz_to_scene_linear_mutex);
|
||||
cache_xyz_to_scene_linear_hash.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static thread_mutex cache_xyz_to_scene_linear_mutex;
|
||||
static string cache_xyz_to_scene_linear_hash;
|
||||
|
||||
ColorSpaceProcessor *ColorSpaceManager::get_processor(ustring colorspace)
|
||||
{
|
||||
#ifdef WITH_OCIO
|
||||
|
|
@ -789,6 +793,11 @@ Transform ColorSpaceManager::get_xyz_to_scene_linear_rgb()
|
|||
|
||||
const std::string &ColorSpaceManager::get_xyz_to_scene_linear_rgb_string()
|
||||
{
|
||||
#ifdef WITH_OCIO
|
||||
/* Clear the cached hash if the scene linear colorspace changed. */
|
||||
check_invalidate_caches();
|
||||
#endif
|
||||
|
||||
/* NOTE: Be careful not to change existing hashes if at all possible, as this
|
||||
* will cause all texture files to be regenerated with significantly increased
|
||||
* disk usage. */
|
||||
|
|
|
|||
|
|
@ -280,6 +280,12 @@ void ImageMetaData::detect_tiles(ImageInput &input,
|
|||
}
|
||||
else {
|
||||
tile_need_conform = false;
|
||||
|
||||
/* For tx files, use the color space hint to determine if this was encoded
|
||||
* as scene linear, scene linear + sRGB or data. */
|
||||
if (!colorspace_file_hint.empty()) {
|
||||
colorspace = ustring(colorspace_file_hint);
|
||||
}
|
||||
}
|
||||
|
||||
bool has_tiles = false;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:515c9b8eead89c3d7731915980b31b01dbb9f31fafc3c86c9b2ae1e9a4e7e265
|
||||
size 46255
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9c1a191ed021a093318f14d6269722ca7d9f70de92823461d69693d01087cbff
|
||||
size 46255
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:59b2342e379638be9e89850ea4807db65ac2d6978feae50029e098b7872e286d
|
||||
size 43284
|
||||
3
tests/files/render/image_colorspace/image_acescg.blend
Normal file
3
tests/files/render/image_colorspace/image_acescg.blend
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1b8c58d21a40a1bb35d5dfb2d2f3300d9957b777ce01e24c35143509b3690531
|
||||
size 88148
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a4b5a06409c2243539cec63727b7a8b1b2996ffe2f31c75e1e8353b067d15a3e
|
||||
size 81532
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8a04d4ac8c6a40c1493a74a8f565bcb56353f968ee404fe3232ded45ebfef88b
|
||||
size 83820
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9191ebc8fa9a8141923a6440208861ade3e970d84a4ec593c5c8a65060524b9d
|
||||
size 232
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8581151329779d954d215d5a4d42b36c0782c688557950bc93b8fb53591e54d6
|
||||
size 62449
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9a08efbb5814176b578d7aa0aafca7d6dc39525dc24d116873308419cd771fbd
|
||||
size 38267
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d7ccc94992460dc73c53931ac495ba9a7f78f4237d2a8ad2bc6b6c66b91fb521
|
||||
size 122957
|
||||
Loading…
Add table
Add a link
Reference in a new issue