-
Notifications
You must be signed in to change notification settings - Fork 329
Description
In Vulkan, some depth formats can be filtered post-comparison. This is supposed to be used for percentage-closer filtering (PCF). We currently do not support this.
However, @kvark points out that there is a format feature flag, but it only exposes whether the format can be filtered without comparison. Filtering with comparison is always supported, regardless of the bit, but the results are completely implementation-defined (spec only says "should").
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
specifies that ifVK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
is also set, an image view can be used with a sampler that has either ofmagFilter
orminFilter
set toVK_FILTER_LINEAR
, ormipmapMode
set toVK_SAMPLER_MIPMAP_MODE_LINEAR
. IfVK_FORMAT_FEATURE_BLIT_SRC_BIT
is also set, an image can be used as thesrcImage
tovkCmdBlitImage
with afilter
ofVK_FILTER_LINEAR
. This bit must only be exposed for formats that also support theVK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
orVK_FORMAT_FEATURE_BLIT_SRC_BIT
.If the format being queried is a depth/stencil format, this bit only specifies that the depth aspect (not the stencil aspect) of an image of this format supports linear filtering, and that linear filtering of the depth aspect is supported whether depth compare is enabled in the sampler or not. If this bit is not present, linear filtering with depth compare disabled is unsupported and linear filtering with depth compare enabled is supported, but may compute the filtered value in an implementation-dependent manner which differs from the normal rules of linear filtering. The resulting value must be in the range [0,1] and should be proportional to, or a weighted average of, the number of comparison passes or failures.
I'm not clear on whether the bit is supposed to say anything about comparison+filtering. It almost sounds like it's saying it's only implementation-defined if the bit is unset, but I think that's just poor wording, and it means to say it's always implementation-defined.
See also:
https://docs.google.com/spreadsheets/d/12u6g6-dUGxuwgaNVRDdZVZ0u2zb9kotqEO3_ZA-1930/edit?usp=sharing