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/draw/engines | |
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/draw/engines')
-rw-r--r-- | source/blender/draw/engines/image/image_drawing_mode.hh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 21dac8009f6..8913b7469ed 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -332,6 +332,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD offset++; } } + IMB_gpu_clamp_half_float(&extracted_buffer); GPU_texture_update_sub(texture, GPU_DATA_FLOAT, @@ -388,6 +389,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD } BKE_image_release_ibuf(image, tile_buffer, lock); } + IMB_gpu_clamp_half_float(&texture_buffer); GPU_texture_update(info.texture, GPU_DATA_FLOAT, texture_buffer.rect_float); imb_freerectImbuf_all(&texture_buffer); } |