vk: RADV support for depth scaling and transfer

This commit is contained in:
kd-11 2018-06-08 13:53:45 +03:00 committed by kd-11
parent 63f803b68a
commit 00eaf39c01

View File

@ -161,23 +161,26 @@ namespace vk
// Drivers are not very accepting of aspect COLOR -> aspect DEPTH or aspect STENCIL separately // Drivers are not very accepting of aspect COLOR -> aspect DEPTH or aspect STENCIL separately
// However, this works okay for D24S8 (nvidia-only format) // However, this works okay for D24S8 (nvidia-only format)
// To work around the problem we use the non-existent DEPTH/STENCIL/DEPTH_STENCIL aspect of the color texture instead // To work around the problem we use the non-existent DEPTH/STENCIL aspect of the color texture instead (AMD only)
VkImageAspectFlags typeless_aspect = VK_IMAGE_ASPECT_COLOR_BIT; VkImageAspectFlags typeless_aspect;
if (transfer_flags == VK_IMAGE_ASPECT_DEPTH_BIT || transfer_flags == VK_IMAGE_ASPECT_STENCIL_BIT) const bool single_aspect = (transfer_flags == VK_IMAGE_ASPECT_DEPTH_BIT || transfer_flags == VK_IMAGE_ASPECT_STENCIL_BIT);
switch (vk::get_driver_vendor())
{ {
// NOTE: This path is only taken for VK_FORMAT_D32_SFLOAT_S8_UINT as there is no 36-bit format available case driver_vendor::AMD:
// On Nvidia, the default format is VK_FORMAT_D24_UNORM_S8_UINT which does not require this workaround // This workaround allows proper transfer of stencil data
switch (vk::get_driver_vendor()) typeless_aspect = aspect;
{ break;
case driver_vendor::AMD: case driver_vendor::NVIDIA:
// Quirks: This workaround allows proper transfer of stencil data // This workaround allows only transfer of depth data, stencil is ignored (D32S8 only)
case driver_vendor::NVIDIA: // However, transfer from r32 to d24s8 in color->depth_stencil works
// Quirks: This workaround allows only transfer of depth data, stencil is ignored typeless_aspect = (single_aspect)? aspect : VK_IMAGE_ASPECT_COLOR_BIT;
typeless_aspect = aspect; break;
break; case driver_vendor::RADV:
default: // This workaround allows only transfer of depth data, stencil is ignored (D32S8 only)
break; default:
} typeless_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
break;
} }
//1. Copy unscaled to typeless surface //1. Copy unscaled to typeless surface