Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dx12] Support for unnormalized coordinates in samplers #2883

Open
kvark opened this issue Jul 4, 2019 · 2 comments
Open

[dx12] Support for unnormalized coordinates in samplers #2883

kvark opened this issue Jul 4, 2019 · 2 comments

Comments

@kvark
Copy link
Member

kvark commented Jul 4, 2019

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.

bors bot added a commit that referenced this issue Jul 5, 2019
2885: Hardcoded immutable samplers in Metal r=grovesNL a=kvark

Also adds unnormalized sampling to HAL.
Blocked on spirv_cross 0.15.0 release.

Fixes #2837
Partially fulfills #2883 
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: metal
- [ ] `rustfmt` run on changed code


Co-authored-by: Dzmitry Malyshau <[email protected]>
bors bot added a commit that referenced this issue Jul 5, 2019
2885: Hardcoded immutable samplers in Metal r=grovesNL a=kvark

Also adds unnormalized sampling to HAL.
Blocked on spirv_cross 0.15.0 release.

Fixes #2837
Partially fulfills #2883 
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: metal
- [ ] `rustfmt` run on changed code


Co-authored-by: Dzmitry Malyshau <[email protected]>
@kvark
Copy link
Member Author

kvark commented Jul 5, 2019

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 kvark changed the title Support for unnormalized coordinates in samplers [dx12] Support for unnormalized coordinates in samplers Jul 5, 2019
@kvark
Copy link
Member Author

kvark commented Oct 2, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant