From 02ca005ada09abd40dafe05de1ed74ef99d3633b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 27 Feb 2019 18:03:20 +0100 Subject: [PATCH] vkd3d: Use vkCmdResolveImage() to resolve typeless resources if possible. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d/command.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 5b11c3c4..4999280a 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -2855,8 +2855,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi ID3D12Resource *src, UINT src_sub_resource_idx, DXGI_FORMAT format) { 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; - const struct vkd3d_format *src_format, *dst_format; const struct vkd3d_vk_device_procs *vk_procs; VkImageResolve vk_image_resolve; @@ -2876,13 +2876,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi 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))) { WARN("Invalid format %#x.\n", dst_resource->desc.Format); @@ -2894,6 +2887,20 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi 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. */ 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)))