turnip/zink: KHR-GL46.texture_view.view_classes failure due to non-memcpy behavior of vkCmdCopyBufferToImage
There are actually two big tests failing due to this:
KHR-GL46.texture_view.view_classes
KHR-GL46.copy_image.functional
The failing subtest of KHR-GL46.texture_view.view_classes
does:
- Copy from buffer into
VK_FORMAT_R16G16B16A16_SFLOAT
image; - Create
R32G32_SINT
view ofVK_FORMAT_R16G16B16A16_SFLOAT
image; - In VS sample through views with both formats and then compare the result.
The failing part is copying into VK_FORMAT_R16G16B16A16_SFLOAT
from a buffer.
Buffer has:
Element | Data | Data | Data | Data |
---|---|---|---|---|
0 | FFFFFF80 | FFFFFF81 | FFFFFF82 | FFFFFF83 |
After the copying into VK_FORMAT_R16G16B16A16_SFLOAT
the data becomes:
Element | Data | Data | Data | Data |
---|---|---|---|---|
0 | 7E007E00 | 7E007E00 | 7E007E00 | 7E007E00 |
Not a bit exact copy, because the data gets reinterpret as float.
Per old discussion in Khronos (https://gitlab.khronos.org/vulkan/vulkan/-/issues/527) all vkCmdCopy
commands should work as memcpy. There already was a fix for Turnip for SNORM blits: !10735 (merged)
My current solution is to reinterpret all float formats as uint formats of appropriate size (Danil/mesa@25e4b4a6), this seem to make the tests pass. Though I'm not sure I fully understand this whole minefield so I'd like to hear opinions from others.