Commit Graph

1236 Commits

Author SHA1 Message Date
Philip Rebohle 6d24f767c6
[dxvk] Load function pointers for VK_KHR_get_physical_device_properties2 2018-07-23 18:09:50 +02:00
Philip Rebohle adadf362a3
[d3d11] Optimize WaitForResource behaviour when resource is already idle
We don't have to flush everything in this case, just flushing the current
CS chunk is enough to determine if the resource is in use by the GPU.
2018-07-23 16:08:01 +02:00
Philip Rebohle 662b6429a8
[d3d11] Refactor resource initialization
In addition to moving the code to a separate class, this also
improves flushing behaviour by limiting the amount of memory
being initialized rather than the number of commands executed.
2018-07-23 15:21:17 +02:00
Philip Rebohle 2b8c96fe35
[util] Fix reference counting for thread objects
Fixes a potential race when threads run out of scope
before the thread function has started.
2018-07-22 02:24:04 +02:00
Philip Rebohle e4c5880ac6
[util] Fix Win32 thread helper
- Implements move semantics for thread objects properly.
  This is necessary in order to avoid closing the thread
  handle multiple times, and to avoid passing invalid
  pointers to the thread function in some cases.
- More closely emulates the behaviour of std::thread.
2018-07-22 01:28:35 +02:00
Philip Rebohle 64ffcbc9ef
[util] Code cleanup for winegcc stuff 2018-07-21 12:51:50 +02:00
Mikhail Paulyshka f38ee85a39 [build] Fix compilation on MSVC (#505)
* [build] do not use shared_library/objects property with MSVC

* [util] use ./com/com_include.h instead of windef.h

It is required for Windows 10 SDK.

* [util] store thread procedure lambda in std::function

* [dxgi] fix annoying MSVC warning

warning C4099: 'IDXGIVkInteropDevice': type name first seen using 'class' now seen using 'struct'
2018-07-21 12:43:33 +02:00
Philip Rebohle c5a010a48c
[dxgi] Do not use MUTABLE_FORMAT_BIT for SRGB images
Creation of non-SRGB views for SRGB images fails on Windows.
2018-07-21 11:41:45 +02:00
Philip Rebohle 5fe4c4f610
[dxvk] Use VkImageViewUsageCreateInfoKHR when creating image views
Must be used when view formats are used that do not support all
usage bits of the underlying image. Refs #504.
2018-07-21 10:58:06 +02:00
Philip Rebohle 8ffe545b38
Revert "[dxvk] Bump maximum number of command buffers in flight to 16"
This reverts commit d744a3cd69.

Reportely has an unexpected negative impact on frame times in
The Witcher 3 and potentially other games on some setups.
2018-07-20 15:56:07 +02:00
Philip Rebohle de920458d7
[dxvk] Make DxvkEvent lock-free
Reduces locking overhead and potential stuttering
issues when an app is spinning on the event.
2018-07-20 15:48:09 +02:00
Philip Rebohle b601a94750
[dxgi] Make faking Dx10 support a per-app option
Also whitelist World of Warcraft, which requires this hack for now.
2018-07-20 13:49:40 +02:00
Philip Rebohle d744a3cd69
[dxvk] Bump maximum number of command buffers in flight to 16 2018-07-20 11:42:42 +02:00
Philip Rebohle adcc7a4573
[dxgi] Synchronize presentation to enforce maximum frame latency
Some games may rely on the maximum number of frames in flight.
Might fix a related issue in Hard Reset (#503) and Okami HD (#283).
2018-07-20 11:40:37 +02:00
Philip Rebohle fd55520301
[dxgi] Implement IDXGIDevice::SetMaximumFrameLatency
We'll be doing the CPU synchronization with DXVK events during
presentation.
2018-07-20 11:39:51 +02:00
Philip Rebohle 0fd8019a70
[dxvk] Add DxvkEvent::wait method 2018-07-20 11:39:24 +02:00
Philip Rebohle 336b3858c9
[dxvk] Relax VK_EXT_vertex_attribute_divisor requirement
Nvidia 396.45 still does not support this. Nvidia, please, we need it.
2018-07-19 23:10:12 +02:00
Philip Rebohle 19f74a89cd
[dxvk] Optimize buffer renaming
Small reduction in CPU overhead by using spinlocks instead of
a full mutex for the two buffer free lists.
2018-07-19 09:44:58 +02:00
Jacek Caban 88cda20746 [d3d11] Import dxgi by -l instead of directly specifying library name. 2018-07-19 08:55:34 +02:00
Jacek Caban c934d85b85 [d3d11] Move D3D11ImmediateContext constexpr values to .cpp file
In my winelib builds, I get unresolved dxvk::D3D11ImmediateContext::MinFlushIntervalUs symbol. I'm not sure why it doesn't inline this constexpr, but it doesn't seem useful to expose that in header anyway.
2018-07-19 08:55:34 +02:00
Jacek Caban 6d16bb4c87 Don't use std::thread.
Wine needs to setup each thread that has an access to Windows APIs. It means that in winelib builds, we can't let standard C++ library create threads and need to use Wine for that instead. I wrote a thin wrapper around Windows thread functions so that the rest of code just has to use new dxvk::thread class instead of std::thread.
2018-07-19 08:55:34 +02:00
Jacek Caban cea1f15eab [util] Don't use std::wstring.
std::wstring is problematic, because wchar_t on other platforms might not be what we need. -fshort-wchar can mitigate that partially, but it's more problematic for stdc++ classes.
2018-07-19 08:55:34 +02:00
Jacek Caban c2c10cc207 [util] Reimplement fromws using WideCharToMultiByte and system codepage.
Also, using UTF-8 for convertion may not be what's intended, esp. if such strings end up being passed back to system API (eg. open file). The patch uses CP_ACP on mingw build (which is how Windows APIs will interpret it) or CP_UNIXCP on Wine (which is Wine extension to convert to whatever glibc and other host libs expect).

It's also needed for the next patch.
2018-07-19 08:55:34 +02:00
Jacek Caban 02ae42c7de [util] Remove getTempDirectory
It's not used anywhere.
2018-07-19 08:55:34 +02:00
Jacek Caban 06511aa72c [build] Use .spec files instead of .def files in winelib build 2018-07-19 08:55:34 +02:00
Jacek Caban 635a43fefe [build] Explicitly specify .dll and .exe extensions in winelib build
meson can't handle that itself.
2018-07-19 08:55:34 +02:00
Philip Rebohle 6848b45c7a Revert "[dxgi] Support multiple outputs per adapter"
This reverts commit 1c86ed8c93.

Causes build issues on 32-bit platforms.
2018-07-16 19:07:41 +02:00
Philip Rebohle 1c86ed8c93 [dxgi] Support multiple outputs per adapter 2018-07-16 17:03:55 +02:00
Philip Rebohle a728884742 [dxgi] Fixed nonsense compiler warning with some GCC versions 2018-07-14 12:15:15 +02:00
Philip Rebohle 9de3a619c2
[dxgi] Use back buffer size to determine fullscreen resolution
This is the correct behaviour on Windows and may fix some issues.
2018-07-12 16:00:33 +02:00
Philip Rebohle 2100d7aa3a
[d3d11] Fake SO support for F1 2015, Mafia 3 2018-07-12 00:32:36 +02:00
Philip Rebohle 0ee375ffb0
Revert "[dxvk] Disable image format list"
This reverts commit 04d7f2896a.

False alarm, although we should correct the format classes
at some point.
2018-07-11 23:36:00 +02:00
Philip Rebohle 65ffa4122d
[hud] Add option to show DXVK version
General idea based on PR #490. Closes #488.
2018-07-11 17:40:07 +02:00
Philip Rebohle 2fce0a7685
[build] Extract version number from git if available
Logs the version number and game executable name as well.
2018-07-11 17:39:00 +02:00
Philip Rebohle cc4b53db43
[dxvk] Require VK_KHR_get_physical_device_properties2
We have to enable this extension in order to be able to use
VK_EXT_vertex_attribute_divisor without validation errors.
2018-07-11 15:51:43 +02:00
Philip Rebohle 22bb4391ba
[vr] Load OpenVR API DLL if necessary
Some games initialize the DXGI factory and D3D11 device even before
loading the OpenVR DLL, so we have to be even more invasive.
2018-07-11 15:31:35 +02:00
Philip Rebohle 67fe452580
[dxvk] Track lifetime of framebuffer attachments
We should mark images that are being used for rendering as
in-use by the GPU when binding the corresponding framebuffer.
2018-07-10 04:47:50 +02:00
Philip Rebohle 87b5161b2a
[d3d11] Reset implicit flush timer only when actually flushing
In some situations, calling Flush without any commands that
could be flushed would unnecessarily prevent the implicit
flush heuristic from kicking in properly.
2018-07-09 20:31:54 +02:00
Philip Rebohle 43cbe42ea8
[dxvk] Pick memory chunk size dynamically
Reduces the number of Vulkan memory allocations, and
can lead to lower CPU overhead in certain situations.
Improves Shadow Warrior 2 by ~2% on RADV.
2018-07-09 19:18:39 +02:00
Philip Rebohle 2aa6b04fd9
[dxvk] Fix tzcnt return value when source value is 0 2018-07-09 13:32:43 +02:00
Philip Rebohle 2caf346fbb
[dxvk] Add access flags to external subpass dependencies again
Apparently we need those to make sure that the initial layout
transition itself is valid. We don't need to add shader access
though, since we cannot access attachments inside shaders.
2018-07-09 11:23:28 +02:00
Philip Rebohle b789187df5
[dxvk] Fixed external subpass dependencies
Fixes validation errors and some unnecessary cruft. We don't need
visibility operations in the external-to-renderpass dependency
because that part is handled by regular barriers, an execution
dependency is enough (but still required to handle write-after-read.
2018-07-09 10:08:12 +02:00
Philip Rebohle c8c6f24b63
[d3d11] Fix log spam when an application uses DiscardView
We don't support this method, but we should only issue the warning
once to prevent poor performance.
2018-07-08 15:53:30 +02:00
Philip Rebohle 4d1a70bd89
[dxvk] Fix deferred depth-stencil clears
If a game clears the depth and stencil aspects of a depth-stencil
buffer separately, we must not override the load op and clear value
of the previously set aspect. Fixes a rendering issue in Hitman
Absolution.
2018-07-06 15:23:59 +02:00
Philip Rebohle 974db9712b
[dxvk] Remove clear rect parameter from clearRenderTarget
With deferred clears and render target-based clears, this was
not properly supported anyway.
2018-07-06 15:01:37 +02:00
Philip Rebohle 04d7f2896a
[dxvk] Disable image format list
Causes rendering issues in Far Cry 4.
2018-07-05 22:49:30 +02:00
Philip Rebohle 63af141383
[d3d11] Set proper view format list for typed UAVs
Typed UAVs are mutable, but we only need them to be compatible to
their typed format and the bit-compatible integer format used for
clears.
2018-07-03 13:31:22 +02:00
Philip Rebohle cbf4772973
[d3d11] Pass image format family to the backend 2018-07-03 12:44:56 +02:00
Philip Rebohle 9b78738d2c
[dxvk] Pass image format list to the driver
Allows drivers to enable DCC in some situations.
2018-07-03 12:44:01 +02:00
Philip Rebohle c1334e7601
[dxvk] Require VK_KHR_image_format_list
All supported drivers support this extension, so we don't make it optional.
2018-07-03 12:43:32 +02:00