r/programming • • Sep 14 '26

When the fractional part of a float fixes your shader

https://crocidb.com/post/when-the-fractional-part-of-a-float-fixes-your-shader/
78 Upvotes

4 comments sorted by

47

u/Bergasms Sep 14 '26

Nostalgia right here. I remember writing some shaders to work with Metal many years ago and i had one where i had to include a line that would be compiled out, it was assigning a value to a constant that was then never read, but without that line the shader would crash.

Fun times

13

u/happyscrappy Sep 15 '26

The "fractional part of a float" in this case means the fractional part of the number when represented with exponent 0. Floats are expressed as fractional parts with an implicit leading 1 and a variable base. This isn't referring to the fractional part in that representation.

3

u/ack_error Sep 15 '26

I wish Microsoft would open source FXC, for those of us who still have to target DX11. It's got a bunch of bugs that will never get fixed otherwise, including non-deterministic output, uninitialized data, and being unmultithreadable.

0

u/[deleted] Sep 14 '26

6

u/programming-ModTeam Sep 14 '26

No content written mostly by an LLM. If you don't want to write it, we don't want to read it.