Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when I have a uint32 (R32) texture and I sample/fetch from it in a shader?

Note: I distinguish sample from fetch in the title, since in my tests this behavior seems to differ between the two.

Possible answers:

  • The [0..2^32] range is scaled down to [0..1] (I think OpenGL works this way)
  • The uint32s are casted to float32s (which, incidentally, means that some precision is lost).
  • Other?
like image 968
Stefan Monov Avatar asked Feb 01 '26 23:02

Stefan Monov


1 Answers

I made a test with renderdoc.

When using fetch, and the texture is defined with Texture2D<uint>, the fetch functions simply return a uint instead of a float4.

like image 114
Stefan Monov Avatar answered Feb 04 '26 15:02

Stefan Monov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!