Search code examples
texturesvulkan

VK_FORMAT_R16_UINT texture format in Vulkan


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?


Solution

  • 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.