Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-02-25 17:05:53 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-02-25 17:14:32 +0300
commit4e9fffc2892601b3b11366f115f342ebeeb026f1 (patch)
tree88c969530d82f12952fbee0d96abd576e84031a6 /source/blender/imbuf/intern/openexr/openexr_api.cpp
parent1bbc1eed6221fcdfad9c160d2979040d44aa888e (diff)
GPU: Add Image property to allow high bitdepth support on a per image basis
This adds the `Half Float Precision` option in the image property panel. This option is only available on float textures and is enabled by default. Adding a flag inside the imbuf (IB_halffloat) on load is done for EXR and PSD formats that can store half floating point (16bits/channels). The option is then not displayed in this case and forced. Related task T73086 Reviewed By: brecht Differential Revision: https://developer.blender.org/D6891
Diffstat (limited to 'source/blender/imbuf/intern/openexr/openexr_api.cpp')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index e1513169736..9fa2c7a28c5 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1757,6 +1757,18 @@ static bool exr_has_alpha(MultiPartInputFile &file)
return !(file.header(0).channels().findChannel("A") == NULL);
}
+static bool exr_is_half_float(MultiPartInputFile &file)
+{
+ const ChannelList &channels = file.header(0).channels();
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) {
+ const Channel &channel = i.channel();
+ if (channel.type != HALF) {
+ return false;
+ }
+ }
+ return true;
+}
+
static bool imb_exr_is_multilayer_file(MultiPartInputFile &file)
{
const ChannelList &channels = file.header(0).channels();
@@ -1909,6 +1921,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
const int is_alpha = exr_has_alpha(*file);
ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0);
+ ibuf->flags |= exr_is_half_float(*file) ? IB_halffloat : 0;
if (hasXDensity(file->header(0))) {
ibuf->ppm[0] = xDensity(file->header(0)) * 39.3700787f;