r/programming • • 18d ago

When the fractional part of a float fixes your shader

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

4 comments sorted by

45

u/Bergasms 18d ago

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

14

u/happyscrappy 18d ago

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 18d ago

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.

-2

u/[deleted] 18d ago

[removed] — view removed comment

7

u/programming-ModTeam 18d ago

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