radv: blitting 3D images with linear filter
When calling vkCmdBlitImage with a 3D image and a linear filter, the slices should probably be linearly interpolated as well, which radv does not seem to be doing (not sure about anv, should probably be checked too). The vulkan spec is somewhat confusing to read on that matter. First it says
3D textures are blitted slice by slice
but below that, it states:
If the filter parameter is VK_FILTER_LINEAR then the value sampled from the source image is taken by doing linear filtering using the interpolated z coordinate. If filter parameter is VK_FILTER_NEAREST then the value sampled from the source image is taken from the single nearest slice, with an implementation-dependent arithmetic rounding mode.
I clearly understand that as slices being linearly interpolated. This does not seem to be done in radv, the culprit seems to be for instance here, where the correct floating point z value is converted to an integer for the VkExtent3D. At the moment, the used filter mode does not seem to matter for the z axis, which does not seem like the intent of the vulkan spec. The expected behavior would be to linearly interpolate between different slices when blitting 3D images with linear filter I guess (the way it is already done on the X and Y axes).
In practice (and how I noticed this), the truncation of the z floats leads to voxel content "moving" towards smaller z coordinates when using the blit function for generating mipmaps of a 3D image with a linear filter.