0

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
abergmeier
  • 13,224
  • 13
  • 64
  • 120
  • which algorithm? FLT_MAX is a valid and non-infinite float value, so it's fine to use in spir-v – ratchet freak Sep 22 '17 at 20:12
  • So... what problem have you had with using this value? What operations do you want to do with such values? – Nicol Bolas Sep 22 '17 at 22:03
  • @NicolBolas I am currently writing the shader and am mostly wondering whether using a hardcoded `FLTX_MAX` will work on all Vulkan devices out there. Is there any guarantee, that a Vulkan device does not use 31bits instead of e.g. 32? So no problems as of now but want to know which guarantees I can get. – abergmeier Sep 23 '17 at 20:05

1 Answers1

2

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++.

Jesse Hall
  • 6,441
  • 23
  • 29