diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-10-12 09:47:12 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-10-12 09:56:14 +0300 |
commit | 872a45f42bc5a582fac59e9cd24239ee25821bff (patch) | |
tree | 578aebfda4bcd28075fb3565ede2118ae9ed62ff /source/blender/imbuf/IMB_imbuf.h | |
parent | 78634b1fd1fb76f101cd36e05fc80d00cd4c6f07 (diff) |
ImageEngine: Clamp image data to fit half float range.
When image data exceeds half float ranges values are set to +/-
infinity that could lead to artifacts later on in the pipeline.
Color management for example.
This patch adds a utility function `IMB_gpu_clamp_half_float`
that clamps full float values to fit within the range of
half floats.
This fixes T98575 and T101601.
Diffstat (limited to 'source/blender/imbuf/IMB_imbuf.h')
-rw-r--r-- | source/blender/imbuf/IMB_imbuf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 7e652e31506..5c76dfe52df 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -895,6 +895,13 @@ eGPUTextureFormat IMB_gpu_get_texture_format(const struct ImBuf *ibuf, bool use_grayscale); /** + * Ensures that values stored in the float rect can safely loaded into half float gpu textures. + * + * Does nothing when given image_buffer doesn't contain a float rect. + */ +void IMB_gpu_clamp_half_float(struct ImBuf *image_buffer); + +/** * The `ibuf` is only here to detect the storage type. The produced texture will have undefined * content. It will need to be populated by using #IMB_update_gpu_texture_sub(). */ |