Skip to content

WIP: tu: Fix non-memcpy CmdCopy* behaviour for float formats

Danylo Piliaiev requested to merge Danil/mesa:turnip/fix/cmdcopy-as-memcpy into main

vkCmdCopy* commands are supposed to act like memcpy, see https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/2917 for the discussion.

Copying certain values with SNORM and FLOAT formats results in their clamping, for example:

  • SNORM: 0x80 (-1.0 snorm8) value will get clamped to 0x81 (also -1.0); See #6480 (closed)
  • FLOAT: NaN value will get clamped to some non-NaN float value; See #6723

So we have to use UINT format to copy them. The only obstacle is UBWC fast-clear value which encodes different values for different formats. Fortunately, hardware automatically fast-clears only VK_FORMAT_R8G8B8A8_UNORM and we don't do fast-clear manually for any format. So it should be safe to reinterpret SNORM and FLOAT formats as UINT.

Fixes GL tests running through Zink:

 KHR-GL46.texture_view.view_classes
 KHR-GL46.copy_image.functional

Closes: #6723

Edited by Danylo Piliaiev

Merge request reports