vkd3d: Use vkCmdResolveImage() to resolve typeless resources if possible.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-02-27 18:03:20 +01:00 committed by Alexandre Julliard
parent 98d89c09fe
commit 02ca005ada

View File

@ -2855,8 +2855,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi
ID3D12Resource *src, UINT src_sub_resource_idx, DXGI_FORMAT format) ID3D12Resource *src, UINT src_sub_resource_idx, DXGI_FORMAT format)
{ {
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface); struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
const struct vkd3d_format *src_format, *dst_format, *vk_format;
struct d3d12_resource *dst_resource, *src_resource; struct d3d12_resource *dst_resource, *src_resource;
const struct vkd3d_format *src_format, *dst_format;
const struct vkd3d_vk_device_procs *vk_procs; const struct vkd3d_vk_device_procs *vk_procs;
VkImageResolve vk_image_resolve; VkImageResolve vk_image_resolve;
@ -2876,13 +2876,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi
d3d12_command_list_end_current_render_pass(list); d3d12_command_list_end_current_render_pass(list);
if (dxgi_format_is_typeless(dst_resource->desc.Format)
|| dxgi_format_is_typeless(src_resource->desc.Format))
{
FIXME("Not implemented for typeless resources.\n");
return;
}
if (!(dst_format = vkd3d_format_from_d3d12_resource_desc(&dst_resource->desc, DXGI_FORMAT_UNKNOWN))) if (!(dst_format = vkd3d_format_from_d3d12_resource_desc(&dst_resource->desc, DXGI_FORMAT_UNKNOWN)))
{ {
WARN("Invalid format %#x.\n", dst_resource->desc.Format); WARN("Invalid format %#x.\n", dst_resource->desc.Format);
@ -2894,6 +2887,20 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi
return; return;
} }
if (dxgi_format_is_typeless(dst_resource->desc.Format) || dxgi_format_is_typeless(src_resource->desc.Format))
{
if (!(vk_format = vkd3d_format_from_d3d12_resource_desc(&dst_resource->desc, format)))
{
WARN("Invalid format %#x.\n", format);
return;
}
if (dst_format->vk_format != src_format->vk_format || dst_format->vk_format != vk_format->vk_format)
{
FIXME("Not implemented for typeless resources.\n");
return;
}
}
/* Resolve of depth/stencil images is not supported in Vulkan. */ /* Resolve of depth/stencil images is not supported in Vulkan. */
if ((dst_format->vk_aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) if ((dst_format->vk_aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))
|| (src_format->vk_aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))) || (src_format->vk_aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)))