Commit Graph

117 Commits

Author SHA1 Message Date
Józef Kucia 086f263a9e dxgi: Acquire Vulkan image just before present when we have user images.
The current DXGI back buffer index is independent of the current Vulkan
image index when we have user images. We can use this fact to delay
calling vkAcquireNextImageKHR().

This increases GPU utilization from 84% to 100% in the main menu of
Metro Exouds on Nvidia.

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>
2019-05-06 13:19:33 -05:00
Józef Kucia 711e68c9b8 dxgi: Add some asserts for Vulkan swapchains.
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>
2019-05-06 13:19:33 -05:00
Józef Kucia 3084ea8269 dxgi: Make Vulkan swapchain image count independent of DXGI buffer count.
Vulkan can create more swapchain images than requested.

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>
2019-05-06 13:19:33 -05:00
Józef Kucia 2002585000 dxgi: Factor out d3d12_swapchain_record_swapchain_blit().
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>
2019-05-06 13:19:33 -05:00
Andrey Gusev 29cd7dd072 dxgi: Add DECLSPEC_HOTPATCH to d3d11_swapchain_Present().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46953
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46971
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-23 23:50:45 +02:00
Henri Verbeet 7d351e1168 dxgi: Slightly simplify d3d11_swapchain_init().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-12 15:33:46 +02:00
Józef Kucia 6b05ef1f01 dxgi: Add support for building with Win32 Vulkan.
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>
2019-03-21 19:32:17 +01:00
Józef Kucia 0f86a47ece dxgi: Do not forward d3d12_swapchain_Present() to d3d12_swapchain_Present1().
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>
2019-03-14 23:52:59 +01:00
Józef Kucia e88084f650 dxgi: Do not forward d3d11_swapchain_Present() to d3d11_swapchain_Present1().
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>
2019-03-13 23:40:39 +01:00
Józef Kucia e3ad02bd3e dxgi: Factor out d3d11_swapchain_get_hwnd().
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>
2019-03-12 20:31:41 +01:00
Józef Kucia f0f16e255e dxgi: Implement d3d12_swapchain_GetContainingOutput().
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>
2019-03-11 19:15:05 +01:00
Józef Kucia 5a676c2ff5 dxgi: Improve d3d11_swapchain_GetContainingOutput() implementation.
Use MonitorFromWindow() to find the containing IDXGIOutput. This matches
our DXGI tests.

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>
2019-03-11 19:15:03 +01:00
Józef Kucia 9d023a5004 dxgi: Rename d3d12_swapchain_have_user_images() to d3d12_swapchain_has_user_images().
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>
2019-03-06 18:31:43 +01:00
Józef Kucia 42b22b0a77 dxgi: Reject DXGI_FORMAT_UNKNOWN for swapchains.
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>
2019-03-06 18:31:41 +01:00
Józef Kucia 715a52a61c dxgi: Avoid recreating swapchain when we don't have user images.
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>
2019-03-06 18:31:27 +01:00
Józef Kucia bfdc07e7d0 dxgi: Handle VK_ERROR_OUT_OF_DATE_KHR returned from vkAcquireNextImageKHR().
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>
2019-03-04 12:25:30 +01:00
Józef Kucia 09e7f1cba1 dxgi: Factor out d3d12_swapchain_recreate_vulkan_swapchain().
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>
2019-03-04 12:25:28 +01:00
Józef Kucia 17d5774152 dxgi: Introduce d3d12_swapchain_have_user_images().
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>
2019-03-04 12:25:25 +01:00
Józef Kucia 0510bca696 dxgi: Recreate Vulkan swapchain only when current buffer index is 0.
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>
2019-02-28 21:37:30 +01:00
Józef Kucia b78f02922d dxgi: Implement 0 sync interval for D3D12 swapchains.
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>
2019-02-28 21:37:30 +01:00
Józef Kucia 00e6b50da6 dxgi: Use VK_FILTER_LINEAR for swapchain blits if dimensions don't match.
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>
2019-02-28 21:37:30 +01:00
Józef Kucia 6e052efbff dxgi: Set Vulkan swapchain size according to VkSurfaceCapabilitiesKHR.
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>
2019-02-28 21:37:30 +01:00
Józef Kucia 13bcb4d946 dxgi: Re-create swapchain on VK_ERROR_OUT_OF_DATE_KHR.
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>
2019-02-28 21:37:30 +01:00
Józef Kucia 0da481856b dxgi: Always use user images instead of using Vulkan swapchain directly.
Some Vulkan drivers require that swapchain dimensions and window dimensions match exactly.
Additionally, we want to have ability to change the presentation mode, and the only way to change
the presentation mode in Vulkan is to recreate the swapchain.

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>
2019-02-28 21:37:30 +01:00
Henri Verbeet 8ba075a059 dxgi: Introduce the IWineDXGISwapChainFactory interface.
The basic idea is that a project like vkd3d could provide its own
implementation of the IWineDXGISwapChainFactory interface, and so wouldn't
need specific handling in dxgi_factory_CreateSwapChainForHwnd().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:41 +01:00
Józef Kucia 9042fbe1e4 wined3d: Lock wined3d mutex in wined3d_swapchain_present().
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>
2018-12-03 22:27:05 +01:00
Józef Kucia 56d2db81b3 wined3d: Lock wined3d mutex in wined3d_swapchain_decref().
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>
2018-11-29 17:48:34 +01:00
Józef Kucia aaba7fdd00 dxgi: Avoid locking wined3d mutex around wined3d_swapchain_incref().
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>
2018-11-29 17:48:34 +01:00
Józef Kucia 0896decb18 wined3d: Lock wined3d mutex in wined3d_swapchain_resize_target().
Fixes a deadlock. It can also be seen as a small step towards more
fine-grained locking in wined3d.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45431
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>
2018-11-29 17:48:34 +01:00
Henri Verbeet 543605ca9d wined3d: Pass correct bind flags to swapchain creation functions.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-31 16:17:36 +01:00
Józef Kucia 50ca01a387 dxgi: Add support for DXGI_FORMAT_R16G16B16A16_FLOAT D3D12 swapchains.
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>
2018-09-18 20:59:38 +02:00
Józef Kucia db30c0791f dxgi: Validate formats for flip presentation model.
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>
2018-09-18 20:59:38 +02:00
Józef Kucia a53681829b dxgi: Validate swapchain desc in d3d12_swapchain_ResizeBuffers().
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>
2018-09-18 20:59:38 +02:00
Józef Kucia e36af9284f dxgi: Factor out dxgi_validate_swapchain_desc().
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>
2018-09-18 20:59:38 +02:00
Józef Kucia 25c3d9938a dxgi: Return actual swap effect for D3D11 swapchains.
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>
2018-08-30 20:27:05 +02:00
Józef Kucia 8c6e8d6c82 dxgi: Add support for DXGI_FORMAT_R10G10B10A2_UNORM D3D12 swapchains.
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>
2018-08-30 20:27:01 +02:00
Józef Kucia d10a9faa46 dxgi: Implement d3d12_swapchain_ResizeBuffers().
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>
2018-08-29 22:01:38 +02:00
Józef Kucia 9902af08ce dxgi: Factor out d3d12_swapchain_create_vulkan_swapchain().
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>
2018-08-29 22:01:38 +02:00
Józef Kucia 7343aec0cd dxgi: Factor out d3d12_swapchain_destroy_buffers().
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>
2018-08-29 22:01:38 +02:00
Józef Kucia 278ddcbfba dxgi: Move D3D12 helper functions closer to the top of the file.
We need to re-create a Vulkan swapchain in ResizeBuffers().

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>
2018-08-29 22:01:38 +02:00
Józef Kucia 79bc939b40 dxgi: Choose exact formats for D3D12 swapchain fallback formats.
Mainly to avoid gamma correction issues.

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>
2018-08-27 17:34:47 +02:00
Józef Kucia df84cb3842 dxgi: Prefer vkGet*ProcAddr() for loading Vulkan functions.
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>
2018-08-16 13:06:09 +02:00
Józef Kucia 684f5baf12 dxgi: Blit user buffers to Vulkan swapchain buffers while presenting.
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>
2018-08-14 10:16:01 +02:00
Józef Kucia 51ef737bf8 dxgi: Create user images for swapchain formats not supported by Vulkan.
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>
2018-08-14 10:16:01 +02:00
Józef Kucia 6eca8ea8cd dxgi: Factor out d3d12_swapchain_create_buffers().
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>
2018-08-14 10:16:01 +02:00
Józef Kucia 671cdd0b81 dxgi: Wait for Vulkan queue to become idle before destroying swapchain.
Direct3D 12 debug layers do not complain when a swapchain is destroyed
immediately after Present().

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>
2018-08-14 10:16:01 +02:00
Józef Kucia eef51f2e2b dxgi: Introduce helper function to destroy partially initialized swapchain.
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>
2018-08-14 10:16:01 +02:00
Józef Kucia 1df190cba3 dxgi: Set transfer image usage for Vulkan swapchain images.
For CopyTextureRegion() on swapchain buffers.

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>
2018-08-14 10:16:01 +02:00
Józef Kucia f59925416a winevulkan: Remove vkAcquireNextImageKHR() from Vulkan driver functions.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-16 21:28:45 +02:00
Józef Kucia 80120d62eb dxgi: Avoid possible NULL pointer access in d3d11_swapchain_SetFullscreenState().
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>
2018-07-09 22:20:32 +02:00