KhronosGroup / KhronosGroup/Vulkan-Docs
Feature Request: Allow 3D image sampling with unnormalized coordinates
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
Currently Vulkan does not allow to sample 3d images with unnormalized coordinates.
Doing so results in a validation warning:
If the VkPipeline object bound to the pipeline bind point used by this command accesses a VkSampler object that uses unnormalized coordinates, that sampler must not be used to sample from any VkImage with a VkImageView of the type VK_IMAGE_VIEW_TYPE_3D, VK_IMAGE_VIEW_TYPE_CUBE, VK_IMAGE_VIEW_TYPE_1D_ARRAY, VK_IMAGE_VIEW_TYPE_2D_ARRAY or VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, in any shader stage (https://vulkan.lunarg.com/doc/view/1.3.204.1/windows/1.3-extensions/vkspec.html#VUID-vkCmdDispatch-None-02702)
As far as i understood this limitation comes from the fact that there could be hardware that does not support this.
If it is not possible to generally allow this, i would propose to make this available via a feature flag - where the driver can inform if it is supported or not. So that this feature can be used on HW that is able to do this in a clean and officially supported way.
Why do i think this feature should be added:
1. I work for a healthcare company and our input data are 3d images. Working with unnormalized coordinates is the natural way to work with such data (voxel coordinates). Having unnormalized coordinates to sample 3d images makes things much easier for us.
2. When using unnormalized coordinates to sample 3d images, the validation layer creates a warning, but the GPUs i have tested (from different Vendors) always are able to work with sampling 3d images in unnormalized coordinates without problems. At least on desktop GPUs it seems to me that the HW and the drivers are in fact typically able to do this already.
3. When looking beyond Vulkan it seems that sampling with unnormalized coordinates on 3d images is already possible with compute APIs like CUDA and SYCL. Probably this is the reason why i noticed that modern GPUs in fact are able to do this also in Vulkan right now (but create a validation error message)?
So preventing to use this feature for all GPUs in Vulkan because there can be GPUs that do not support this seems not to be a good solution to me. Why prevent people from using an important feature that would be possible on many GPUs without a problem?
Contributor guide
Research direction
Start with the linked Vulkan specification VUID-vkCmdDispatch-None-02702 and the restriction on unnormalized-coordinate samplers. Determine whether 3D-image sampling needs a feature flag or a specification change, and define the supported behavior and validation requirements; done means the proposal is resolved in the Vulkan specification with corresponding validation guidance.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100