diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-25 17:05:53 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-25 17:14:32 +0300 |
commit | 4e9fffc2892601b3b11366f115f342ebeeb026f1 (patch) | |
tree | 88c969530d82f12952fbee0d96abd576e84031a6 /source/blender/imbuf/intern/oiio/openimageio_api.cpp | |
parent | 1bbc1eed6221fcdfad9c160d2979040d44aa888e (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/oiio/openimageio_api.cpp')
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index e001b8b21c4..4746cec41d4 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -194,7 +194,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac { struct ImBuf *ibuf = NULL; int width, height, components; - bool is_float, is_alpha; + bool is_float, is_alpha, is_half; int basesize; char file_colorspace[IM_MAX_SPACE]; const bool is_colorspace_manually_set = (colorspace[0] != '\0'); @@ -243,6 +243,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac is_alpha = spec.alpha_channel != -1; basesize = spec.format.basesize(); is_float = basesize > 1; + is_half = spec.format == TypeDesc::HALF; /* we only handle certain number of components */ if (!(components >= 1 && components <= 4)) { @@ -271,6 +272,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac ibuf->ftype = IMB_FTYPE_PSD; ibuf->channels = 4; ibuf->planes = (3 + (is_alpha ? 1 : 0)) * 4 << basesize; + ibuf->flags |= (is_float && is_half) ? IB_halffloat : 0; try { return ibuf; |