Vulkan: Low Precision Float Conversion #108168

Merged
Jeroen Bakker merged 3 commits from Jeroen-Bakker/blender:vulkan-low-precision-float-conversion into main 2023-06-07 07:50:12 +02:00

3 Commits

Author SHA1 Message Date
Jeroen Bakker 5843a4b703 Code formatting. 2023-06-01 13:39:52 +02:00
Jeroen Bakker 7959794a23 Fix code style. 2023-05-23 14:36:29 +02:00
Jeroen Bakker 418cb6f797 Vulkan: Low Precision Float Conversion
This PR adds conversion template to convert between Low Precision float
formats. These include Binary32 floats and lower. It also adds support
to convert between unsigned and signed float formats and float formats
with different mantissa and exponents.

Additionally overflows (values that don't fit in the target float
format) will be clamped to the maximum value.

Reasoning:
Up to now the Vulkan backend only supported float and half float
formats, but to support workbench 11 and 10 unsigned floats have to be
supported as well. The available libraries that support those float
formats targets scientific applications. Where the final code couldn't
be optimized that well by the compiler.

Data conversion for color pixels have different requirements about
clamping and sign, what could eliminate some clamping code in other
areas in Blender as well. Also could fix some indesired clamping when
using pixels with high intensity that didn't fit in the texture format
leading to artifects in Eevee and slow-down in the image editor.
2023-05-23 09:50:16 +02:00