Search code examples
vulkanspir-v

How to process FLT_MAX in GLSL for Vulkan


I have an algorithm which I try to implement in GLSL for Vulkan. That algorithm uses FLT_MAX.

Now I could define that to an arbitrary high float value but I really would be interested in how to actually e.g. process that value on runtime in GLSL.


Solution

  • Vulkan shaders are required to support single-precision IEEE-754 representation, with a few exceptions detailed in the Vulkan SPIR-V environment spec. So FLT_MAX should work the way you expect it to in C/C++.