Reputation: 11732
Note: I distinguish sample
from fetch
in the title, since in my tests this behavior seems to differ between the two.
Possible answers:
Upvotes: 3
Views: 3265
Reputation: 8973
I assume that your texture/view format is R32_UINT.
If you do :
uint value = texture.Load(pixelLocation);
it will return you uint (just exact same value)
If you do :
float value = texture.Load(pixelLocation);
It will perform a cast (potential precision issue)
If you try to sample, it will do other, as sampling on uint format is normally not allowed (can go from wrong value to driver crash).
Case 1 (scaled down range): is not available with R32, only with R16 or R8 in that case you need to use DXGI_FORMAT_R16_UNORM instead of UINT for the shader view (or texture format). Sample of course works in that case.
Upvotes: 0
Reputation: 11732
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.
Upvotes: 2