gfx icon indicating copy to clipboard operation
gfx copied to clipboard

[dx12] Support for unnormalized coordinates in samplers

Open kvark opened this issue 6 years ago • 2 comments

Vulkan sampler descriptor has this field: unnormalizedCoordinates.

The task here is to add it to our API and do a basic investigation on where it can't be supported.

kvark avatar Jul 04 '19 13:07 kvark

Now that #2885 has landed, we have the API in place. We need to find a way to support it on DX12, at least, and also look into DX11 and GL if possible.

kvark avatar Jul 05 '19 13:07 kvark

I'm thinking, the possible solution could be:

  1. provide a root constant (32 bit) with each bit corresponding to a sampler. Bit = 1 if the coordinates are unnormalized.
  2. in the generated HLSL, whenever there is a sampling operation, we can insert code that checks the relevant bit. If the bit is set, the injected code would call GetDimensions on the texture, and use it to produce the normalized coordinates prior to sampling.

kvark avatar Oct 02 '20 20:10 kvark