2
votes

Vulkan does not have any pixel transfer functionality like OpenGL does. But how does the VK_FORMAT_R16_UINT format works? Can use it to sample unsigned short value from the pixel shader? When I use it, I only get zeros from the sampler. I am using linear filtering.

If I use the format VK_FORMAT_R16_UNORM instead of VK_FORMAT_R16_UINT I get values between 0-1 so I guess Vulkan normalize the values for me in that case?

1
Are you using linear filtering? Support for that is not guaranteed for VK_FORMAT_R16_UNORM. Have you checked you have no validation errors? - Columbo
@Columbo yes I am using linear filtering and I have no validation errors. - hidayat
To use linear filtering on VK_FORMAT_R16_UINT you need to first check for support using vkGetPhysicalDeviceFormatProperties (check for VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT). Can you verify if it's supported? - Columbo
@Columbo It did not support it, I thought the validation layer would tell me something if it was not supported, thank you. Can you write your comment in an answer so I can put it as a correct answer. - hidayat

1 Answers

3
votes

Support for linear filtering for the format VK_FORMAT_R16_UINT is not guaranteed by the spec.

Before using linear filtering on VK_FORMAT_R16_UINT you need to first check for support using vkGetPhysicalDeviceFormatProperties (check for VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT).

It is surprising that the validation layers did not report the misuse. It would be worth filing an enhancement request to get that check added.