1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 10:24:10 +01:00
Commit Graph

1299 Commits

Author SHA1 Message Date
Philip Rebohle
d35ff6ca13
[dxvk] Implement pipeline layout support for dynamic descriptors 2018-06-22 00:29:04 +02:00
Philip Rebohle
32cd85dc11
[dxvk] Discard slices from old physical buffers
Improves effectiveness of an optimization that allows
using dynamic buffer offsets for descriptor sets.
2018-06-22 00:27:52 +02:00
Philip Rebohle
79a1703aea
[util] Set thread names for DXVK's own threads
Makes it easier to identify the command stream thread and the
queue processing thread easier when using a wine build that
supports SetThreadDescription.
2018-06-21 15:12:04 +02:00
Philip Rebohle
432708c15f
[d3d11] Fix image aspect mask for typeless resolve
The DXGI format info only stores the aspect mask for views created
with that format, but we're dealing with a raw resource here so we
have to query the aspect mask from the Vulkan format in question.
Fixes validation errors with typeless resolve if the formats of
the two involved images are identical.
2018-06-21 10:17:59 +02:00
Philip Rebohle
60bf471f06
[d3d11] Fix issue with back buffer creation
In case the window size is 0 in either dimension, we ended up
creating an image with an invalid size. Fixes Vulkan validation
errors in Hearthstone.
2018-06-21 10:12:38 +02:00
Philip Rebohle
f5d73842b2
[d3d11] Do not flush on every call to GetData
There are several scenarios when flushing can have
a significant negative impact on performance:
1. When the query result is already available
2. When the game scatters GetData calls when rendering

Frostpunk hits both issues at the same time, which led to
over 120 queue submissions per frame. This patch reduces
that to 3 submissions per frame when the game is GPU-bound.
2018-06-19 14:34:15 +02:00
Philip Rebohle
5dfe0d077d
[d3d11] Fix render target layouts for linar tiling
There currently doesn't seem to be a game which actually renders
to images with linear tiling, but we should handle this anyway.
Only the GENERAL layout is allowed if the tiling is not OPTIMAL.
2018-06-19 11:28:54 +02:00
Philip Rebohle
15aabcb878
[dxvk] Optimize barriers around vkCmdCopyImage
We don't need to force layout transitions and emit double pipeline
barriers in case the GENERAL layout is being used for both images.
This is somewhat common for images used by compute shaders, and
this optimization ensures that only required barriers are emitted.
2018-06-18 22:30:00 +02:00
Philip Rebohle
f7587014c7
[dxbc] Fix compiler warning 2018-06-18 15:33:35 +02:00
Philip Rebohle
79dc7d8947
[dxvk] Optimized barrier batching around compute shader execution
Reduces the number of unnecessary pipeline barriers after compute shader
dispatches. Yields a small performance improvement in Final Fantasy XV.
2018-06-18 14:35:11 +02:00
Philip Rebohle
f519a0f2e4
[d3d11] Fake streamout support for Final Fantasy XV
The game uses this feature only for Hairworks. This hides an error
message and allows the game to start.
2018-06-16 18:52:20 +02:00
Philip Rebohle
162c465e95
[dxvk] Optimize buffer memory barrier batching
Instead of inserting a barrier after every single buffer copy, update
or clear operation, we batch them up and execute the barrier when the
first dirty buffer is used by a command. This significantly reduces
the number of pipeline barriers in some games, e.g. Final Fantasy XV.
2018-06-16 11:53:06 +02:00
Philip Rebohle
8f8340c2d1
[dxvk] Rename DxvkResourceAccessType to DxvkAccess
We'll be using this enum a lot more in the future.
2018-06-16 10:40:30 +02:00
Philip Rebohle
a148233b13
[d3d11] Use clearBuffer to initialize UAV counters 2018-06-16 10:22:38 +02:00
Philip Rebohle
7fa26f1c87
[d3d11] Implement render pass spilling for UAV rendering
Spilling the render pass should make shader storage buffer/image writes
visible due to how external subpass dependencies are defined. For UAV
rendering, we need to do this when changing the UAVs, even if the render
targets themselves do not change.
2018-06-15 20:49:24 +02:00
Philip Rebohle
7a22fa22a7
[dxgi] FindClosestMatchingMode: Handle Width/Height = 0 case
When an applicationn calls this method with the width or height
set to 0, we are allowed to pick any resolution, so we'll try to
find one close to the *current* display mode which usually returns
the current display mode itself.
2018-06-14 11:34:17 +02:00
Philip Rebohle
c93f2b980e
[d3d11] Report correct timer frequency for TIMESTAMP_DISJOINT queries 2018-06-13 14:30:44 +02:00
Philip Rebohle
48e0b6d684
Revert "[dxvk] Require VK_EXT_shader_viewport_index_layer"
This reverts commit 8d0af0a8fc.

Breaks Renderdoc, which currently does not support this extension.
2018-06-12 23:18:41 +02:00
Philip Rebohle
fc3ff78083
[dxgi] Map typeless formats to their UNORM variants by default
Works around some annoyances with RenderDoc.
2018-06-12 22:35:02 +02:00
Philip Rebohle
a607fe107f
[dxbc] Remove workarounds for the old Nvidia shader compiler 2018-06-12 22:13:53 +02:00
Philip Rebohle
8d0af0a8fc
[dxvk] Require VK_EXT_shader_viewport_index_layer 2018-06-12 21:55:41 +02:00
Philip Rebohle
e6c786b39f
[dxvk] Sort extension names in alphabetical order
This is purely cosmetic.
2018-06-12 17:01:35 +02:00
Philip Rebohle
f8650c1c9f
[dxvk] Require VK_KHR_maintenance2 and VK_EXT_vertex_attribute_divisor
Wine 3.10 added support for these extensions, so we should use them.
2018-06-11 21:09:52 +02:00
Philip Rebohle
f5d55726b3
[dxbc] Fix index returned by ImmAtomicConsume instruction
Since the atomic operations always return the old value, we have to
subtract one for the consume instruction. The append instruction is
unaffected. Fixes an issue with vegetation in Final Fantasy XV.
2018-06-11 20:17:29 +02:00
Philip Rebohle
dce2f844c0
[d3d11] Add ID3DUserDefinedAnnotation stub
We can implement this properly in the future using VK_EXT_debug_utils.
2018-06-11 14:29:47 +02:00
Philip Rebohle
dcd6c2c0f3
[d3d11] Implement CheckCounterInfo and related stubs
DXVK does not support device-specific counters, which seem to
be useful only for GPU profiling during development, but we
should report this properly to the application.
2018-06-11 14:01:45 +02:00
Philip Rebohle
05f24c3c38
[d3d11] Reduce log spam about UAV rendering 2018-06-10 04:19:30 +02:00
Philip Rebohle
1e7a05c796
[d3d11] Remove GetData do-not-flush workaround for Fallout 4
Not needed anymore due to the implicit flush.
2018-06-08 13:13:42 +02:00
Philip Rebohle
d4cb5115e7
[d3d11] Flush implicitly when GetData returns S_FALSE
Keeps the GPU busy when spinning on a query and ensures that we're
flushing at some point. Replaces the Fallout 4 hang workaround.
2018-06-08 13:11:24 +02:00
Philip Rebohle
a2df1ea4c9
[d3d11] Added warning that UAV rendering might not work as expected
We still haven't implemented synchronization for UAV rendering properly.
2018-06-08 12:42:09 +02:00
Philip Rebohle
c716372941
[d3d11] Move GetData implementation to D3D11ImmediateContext
It is illegal to call this method on a deferred context, so we should
filter out those calls. This allows the implementation to make use of
features specific to the immediate context.
2018-06-08 12:29:24 +02:00
Philip Rebohle
e35cbf833c
[dxbc] Fixed issue with FtoD instruction picking an incorrect type 2018-06-07 16:02:59 +02:00
Philip Rebohle
68a7ad81e1
[d3d11] Enable 64-bit math feature
We still have DMovc to implement, but it doesn't look like this
instruction is required as of now.
2018-06-07 15:35:24 +02:00
Philip Rebohle
10170a89ab
[dxbc] Implemented 64-bit compare instructions 2018-06-07 15:21:30 +02:00
Philip Rebohle
a89eb15546
[dxbc] Implemented 64-bit Vector ALU instructions 2018-06-07 15:05:06 +02:00
Philip Rebohle
97af5ee6fe
[dxbc] Implement DtoF and FtoD instructions 2018-06-07 14:32:56 +02:00
Philip Rebohle
ff11fc2445
[spirv] Added OpFConvert instruction 2018-06-07 14:32:34 +02:00
Philip Rebohle
420b7218ae
Revert "[dxvk] Increase memory chunk size to 32 MiB"
This reverts commit 83ae39f727.

Does not show any considerable advantage over the 16 MiB chunk size
and reduces the effectiveness of the host-visible device-local memory
type on AMD cards.
2018-06-06 23:47:43 +02:00
Philip Rebohle
15b0327243
Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-06-06 23:12:48 +02:00
Philip Rebohle
b8468fda43
[dxvk] Improve swap chain format fallback logic
When requesting an unsupported non-SRGB format, we shouldn't
fall back to an SRGB format since that will cause Gamma issues.
2018-06-06 23:10:38 +02:00
Philip Rebohle
79d3b203ef
[dxvk] Added format flag to mark SRGB color formats 2018-06-06 23:09:39 +02:00
Philip Rebohle
518c260ad6
[util] Add == and != operator to Flags 2018-06-06 23:09:23 +02:00
ZeroFault
b43060bec1 fix MSVC compile error with function pointer type declaration (#422) 2018-06-06 22:11:26 +02:00
Philip Rebohle
e8ac81fe8a
[dxvk] Removed support for depth bounds test
This feature is not used in D3D11, so we don't need backend support.
2018-06-06 13:11:09 +02:00
Philip Rebohle
8b4852be16
[dxvk] Make depth bias a dynamic state
Works around an issue with some games not setting the D3D11 depth
bias state correctly, which can result in an excessive number of
pipelines being compiled.
2018-06-06 12:45:45 +02:00
Philip Rebohle
6579b2ad99
Merge branch 'auto-flush-v2' 2018-06-05 18:46:46 +02:00
Philip Rebohle
83ae39f727
[dxvk] Increase memory chunk size to 32 MiB
Reduces the number of memory allocations considerably.
2018-06-05 18:45:11 +02:00
Philip Rebohle
39a7169e1a
[vr] Silence non-virtual destructor warnings on GCC 2018-06-05 01:03:59 +02:00
Philip Rebohle
2c9c7e1a36
Merge branch 'openvr-v2' 2018-06-05 00:16:37 +02:00
Philip Rebohle
4a0c81276f
[d3d11] Implement new auto-flush heuristic 2018-06-04 23:31:49 +02:00
Philip Rebohle
cfe99368fb
[dxvk] Make number of queued submissions available to DXVK 2018-06-04 23:24:42 +02:00
ZeroFault
d44cc7630b Allow FarCry 5 to use D3D11_MAP_FLAG_DO_NOT_WAIT (#416) 2018-06-03 22:33:08 +02:00
Philip Rebohle
217399926d
Revert "[dxbc] Bound-check dynamically indexed constant buffer reads"
This reverts commit 621aed5fdb.

Breaks Dishonored 2. Apparently, out-of-bounds access to constant buffers
is allowed as long as it doesn't exceed the range of bound constants.
2018-06-02 18:09:59 +02:00
Philip Rebohle
34477933ef
[dxvk] Fixed uninitialized value in meta-resolve 2018-06-02 12:20:46 +02:00
Philip Rebohle
9ff17b03f2
[dxbc] Support RenderTargetId and ViewportId in Vertex/Domain shaders
Fixes shader compilation errors in Pillars of Eternity II (#408)
and Lost Sphear (#406). Currently unsupported by RADV.
2018-06-01 13:57:26 +02:00
Philip Rebohle
3a520dfe4a
[dxvk] Enable VK_EXT_shader_viewport_index_layer if available
Required to support SV_RenderTargetArrayIndex in vertex shaders.
2018-06-01 13:56:09 +02:00
Philip Rebohle
b7dff330f8
[spirv] Update SPIR-V headers 2018-06-01 13:43:19 +02:00
Philip Rebohle
aa76bae32a
[dxbc] Fix incorrect OpSelectionMerge instruction
Fixes a regression introduced in v0.53 that would cause
Witcher 3 to crash when enabling Nvidia Hairworks on RADV.
2018-05-31 14:20:12 +02:00
Philip Rebohle
621aed5fdb
[dxbc] Bound-check dynamically indexed constant buffer reads
Emulates D3D11 behaviour more closely on Nvidia hardware.
Fixes an issue in Dark Souls Remastered caused by constant
buffer access with an undefined index value (#405).
2018-05-31 10:13:32 +02:00
Philip Rebohle
7fe4a70342 Version 0.53
-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEJz0EC1ETuIbRoJDUyMxhNCejHJkFAlsLDL4ACgkQyMxhNCej
 HJmIPwgArq3gx2qLKKLokrCyVbwf5UfYtMbnyEQCs7nSBbb0JiaeQXJClAdIwFP6
 VncCpCDOjvssHAiXMF1hfbHDMvVpMa3nwz+O2bOKFxg9OCt69T0wqbOvNVuJzEq4
 7zXWNBXegPJaY5KQXiJORetU/xNcb8/ikWEAT57vkRu2RvvT2ct/oaynWZtgh+X5
 /OMHW1nMP9Bvwm5ZCWw2fCdT9evqIrXL3IreoJKX+dW/10oIaUnh+Q5Fcm7L0s7i
 dYkmm1KM6WiHpO/duK0SpbOl9ASzorwtcRjgM2syzM0QljcUpdnRCDXsuVWYOpRL
 7GbtyzdVC/SJknJoWMdTcpIX6fjYPA==
 =nkRK
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEJz0EC1ETuIbRoJDUyMxhNCejHJkFAlsOvCkACgkQyMxhNCej
 HJlusQgAkfcCUgFLMLGoUeOJaHkpDnv5/s13AMG3a+m9SLUavQ87izysrp6cEaF6
 1O1Rxf/NHqhOh8jGwHILVmDWeYzDGkNKUW0/g0A0hcLMDyh5f5zMVqYoX9ITsjmG
 w5Woc4I7JPqsPdqJ0FOk/dQKIrnVXr/SZXrna55ZvXPI9q1wz0QCbE4E/q47tJUA
 3F5yw+eNaRWEHe7T9wSXdtuVo7R1NFqewt5kTvgiYg6HCWSCNAvgTVHnEg2tpaNC
 rzipvxXKSNbDB30JpC8+R6aP4b7z6P9p1KjyoSKT7Jb5kvOw3p6eY5WQq69KUhhq
 EjTMwUrFaP1K6IJwgWfxLxIufp5pqw==
 =JJRk
 -----END PGP SIGNATURE-----

Merge tag 'v0.53' into openvr-v2

Version 0.53
2018-05-30 16:58:46 +02:00
Philip Rebohle
fc8573891e
[d3d11] Fix vertex attribute offset with D3D11_APPEND_ALIGNED_ELEMENT
Computes the correct offset even if some vertex attributes are not used
by the vertex shader. Fixes a crash in Sleeping Dogs: Definitive Edition
(#407).
2018-05-30 13:33:48 +02:00
Philip Rebohle
3b70e23e2c
[dxvk] Allow overcommitting non-device local memory
If allocations on host-local memory types fail, we can rely on
Vulkan's error reporting. May fix issues on systems with small amounts of VRAM.
2018-05-29 14:56:41 +02:00
Philip Rebohle
c600b43d73
[d3d11] Allocate DYNAMIC buffers on device-local host-visible memory
Improves performance on AMD cards when GPU-bound.
~5% FPS increase in The Witcher 3.
2018-05-29 14:50:08 +02:00
Philip Rebohle
a9eff13b92
[dxvk] Refactor memory allocator
In addition to some much needed code cleanips, the allocator will no
longer try to over-commit memory heaps.
2018-05-29 14:48:27 +02:00
Philip Rebohle
f77392a264
[dxvk] Apply dynamic state at draw time
Changes to the viewport, stencil reference and blend constants are often
coupled with a pipeline state update, so it makes sense to update it later.
2018-05-29 05:03:27 +02:00
Philip Rebohle
e615fc19a9
[dxgi] Support SyncInterval values > 1
Required for Eve Online and the Unity Blacksmith demo.
2018-05-28 21:06:35 +02:00
Philip Rebohle
f68bf1a187
[dxvk] Added correct element size to depth-only and stencil-only formats
Fixes depth-to-color image copies in Elex and Neptunia VII.
2018-05-28 20:33:49 +02:00
Philip Rebohle
8cd97959f2
[d3d11] Chjeck whether input layouts are identical
Prevents redundant state changes when a game switches between
identical input layouts. Reduces the the number of Vulkan
calls in Grim Dawn by ~30%.
2018-05-27 01:10:49 +02:00
Philip Rebohle
de9ffdcfa3
Merge branch 'dxbc-correct-derivs' 2018-05-26 21:13:28 +02:00
Philip Rebohle
48037a8b87
[d3d11] Enable shaderStorageImageMultisample if the device supports it 2018-05-26 20:34:40 +02:00
Philip Rebohle
97e3b89bc7
[dxvk] Emit dynamic state only if a pipeline is bound
Fixes validation errors in Dirt 4.
2018-05-26 20:09:31 +02:00
Philip Rebohle
001794a094
[dxbc] Implement deferred kill operation
Fixes visual issues during LOD transitions in The Witcher 3,
Rise of the Tomb Raider and other games with a similar LOD
system. UAV stores and atomics are conditionalized as well.
2018-05-26 19:25:20 +02:00
Philip Rebohle
0619842dd9
[dxbc] Make UAV stores and atomics conditional
We should only perform stores when the corresponding
UAV is bound. This may be extended with range checks
at a later time.
2018-05-26 19:01:44 +02:00
Philip Rebohle
9278221416
[dxbc] Run analyzer before creating compiler object
We may need the analysis results when initializing the compiler object.
2018-05-26 17:46:49 +02:00
Philip Rebohle
af62d423b2
[dxbc] Add per-device option for deferred kills 2018-05-26 17:08:39 +02:00
Philip Rebohle
ec5572aa69
[dxbc] Scan for discard and derivative instructions 2018-05-26 17:08:08 +02:00
Philip Rebohle
667616bc39
[dxvk] Remove unnecessary include 2018-05-26 14:56:36 +02:00
Philip Rebohle
a2d9874b26
[dxvk] Use new spec constant structure for pipeline compilation 2018-05-26 14:54:29 +02:00
Philip Rebohle
d79f39b963
[dxbc] Implement sampleinfo instruction for rasterizer 2018-05-26 14:54:05 +02:00
Philip Rebohle
4ae15f3edf
[dxvk] Add global specialization constant data structures
Implements a unified way of defining specialization constants
for graphics and compute pipelines which can be easily extended
in the future.
2018-05-26 14:50:00 +02:00
Philip Rebohle
27816b470a
[spirv] Add support for 32-bit specialization constants 2018-05-26 13:52:33 +02:00
Philip Rebohle
b78130defd
[d3d11] Overwatch: Fake success in CreateGeometryShaderWithStreamOutput 2018-05-25 23:53:34 +02:00
Philip Rebohle
a0e0ba1cc8
[dxvk] Align length when clearing entire buffer
Buffer slices in DXVK are always aligned to at least
256 bytes, so this is safe. Fixes a regression leading
to GPU hangs on RADV.
2018-05-25 21:02:15 +02:00
Philip Rebohle
b30e53fa0d
[dxvk] Track image (rather than the view) when generating mip maps 2018-05-25 19:15:14 +02:00
Philip Rebohle
84a62f795f
Merge branch 'meta-mipgen' 2018-05-25 17:46:41 +02:00
Philip Rebohle
4b37590e14
[dxvk] Use new mip map generator 2018-05-25 17:45:41 +02:00
Philip Rebohle
19b6a16173
[dxvk] Add new mip map generator
The current approach uses Vulkan blits, which does not
work if the image view in question has a different format
than the image itself.
2018-05-25 17:44:50 +02:00
Philip Rebohle
7ec93debf1
[dxvk] Add shaders for mip map generation 2018-05-25 17:44:34 +02:00
Philip Rebohle
49bda46a37
[d3d11] Validate and correct scissor rects
Fixes Vulkan validation errors in Frostpunk and more closely
emulates Windows behaviour.
2018-05-25 00:08:28 +02:00
Philip Rebohle
254676049a
[dxvk] Added convenience equal checker for unordered maps 2018-05-24 20:18:37 +02:00
Philip Rebohle
d844ddfdfa
[dxgi] Add option for deferred surface creation
Deferred surface creation is required for Frostpunk due to conflicts
with the D3D9 swap chain created by the game before it presents the
first frame to the DXGI swap chain, but breaks NieR:Automata due to
threading issues.
2018-05-24 13:04:29 +02:00
Philip Rebohle
f087016e77
[dxgi] Add app-specific DXGI options 2018-05-24 13:04:21 +02:00
Philip Rebohle
a43025294a
[dxbc] Remove DxbcImageInfo::layered property 2018-05-24 12:07:03 +02:00
Philip Rebohle
12d79257be
[dxbc] Remove TexCube -> TexCubeArray workaround 2018-05-24 12:00:31 +02:00
Philip Rebohle
58e9280891
[dxbc] Remove Tex2D -> Tex2DArray workaround 2018-05-24 11:49:12 +02:00
Philip Rebohle
d9772b0ffd
[dxvk] Create image views for all supported view types
Rather than creating just one image view per DxvkImageView, we create
views for all compatible types in an attempt to work around game bugs
in Diablo 3, Far Cry 5, Nier Automata, Dishonored 2, Trackmania etc.,
which bind incompatible resource views to some resource slots.
2018-05-24 11:44:04 +02:00
Philip Rebohle
61049c33fb
[dxgi] Reduce reported VRAM on 32-bit platforms
This is closer to what Windows does, and some applications may have
trouble with more than 3GB VRAM.
2018-05-24 10:48:06 +02:00
Philip Rebohle
38c5e57025
[dxgi] Refactor Vulkan swap chain and surface creation
Creating the Vulkan surface at the latest possible moment fixes
an issue with Frostpunk, which renders to a D3D9 swap chain
before presenting to the GXGI swap chain.
2018-05-23 13:03:12 +02:00
Philip Rebohle
531732fe91
[dxgi] Add IDXGIFactory2 to supported interfaces 2018-05-23 01:32:52 +02:00
Philip Rebohle
d1b705bf0d
[dxgi] Implemented IDXGISwapChain1 2018-05-23 01:06:34 +02:00
Philip Rebohle
58fa815926
[dxgi] Fixed error message formatting in DxgiDevice 2018-05-22 23:52:12 +02:00
Philip Rebohle
56e7389495
[dxgi] Stubbed out IDXGIFactory2 2018-05-22 23:52:03 +02:00
Philip Rebohle
5a61d81135
[dxgi] Stubbed out IDXGISwapChain1 2018-05-22 23:50:28 +02:00
Philip Rebohle
979ba2d7c6
[dxgi] Implemented IDXGIAdapter2 2018-05-22 23:48:07 +02:00
Philip Rebohle
a39b9cb131
[d3d11] Pre-clear buffers with D3D11_USAGE_DEFAULT
Some games may expect buffers, like images, to be pre-initialized.
2018-05-22 21:10:39 +02:00
Philip Rebohle
51104c104d
[d3d11] Refactor InitTexture method 2018-05-22 21:06:26 +02:00
Philip Rebohle
fb11acbc91
[dxbc] Implement geometry shader instancing
Required for Frostpunk (see #385).
2018-05-22 19:36:53 +02:00
Philip Rebohle
7f619d9051 [dxvk] Use only one extra thread for async pipeline compilation
With the benefits of asynchronous compilation being generally low and
compilation in advance not being feasible, there is no reason to create
more threads.
2018-05-22 00:32:44 +02:00
Philip Rebohle
425a5bca2e [d3d11] Optimized buffer mapping on deferred contexts 2018-05-22 00:11:32 +02:00
Joshua Ashton
5cc3afcf30 Fix tzcnt intrinsic on MSVC (#381) 2018-05-19 09:26:25 +02:00
Philip Rebohle
126c50a674
[dxbc] SampleMask does not depend on SampleRateShading
This was fixed in a later revision of the SPIR-V 1.0 specification.
2018-05-19 09:07:31 +02:00
Philip Rebohle
a6ace7908f
[dxbc] Do not emit empty 'else' blocks 2018-05-18 22:37:23 +02:00
Philip Rebohle
d1d829c09b
[vr] Query Vulkan extensions for OpenVR at runtime 2018-05-18 16:47:44 +02:00
Philip Rebohle
707967ac1d
[vr] Add OpenVR loader
Provides methods to query required Vulkan instance and device extensions.
2018-05-18 16:46:34 +02:00
Philip Rebohle
7408bc22b5
[dxvk] Remove ability to enable instance layers 2018-05-17 00:35:12 +02:00
Philip Rebohle
a30e1368b1
[dxvk] Implement name set merging 2018-05-17 00:35:04 +02:00
Philip Rebohle
796379a551
[dxvk] Refactor the way instance extensions are enabled 2018-05-17 00:34:48 +02:00
Philip Rebohle
d1eddbdc3f
[dxvk] Make vk::NameSet more versatile 2018-05-17 00:34:38 +02:00
Philip Rebohle
40b52758e3
[dxvk] Enumerate discrete GPUs before integrated GPUs
May help with games that do not run on Intel GPUs when
the Intel Vulkan driver is installed alongside the AMD
or Nvidia drivers.
2018-05-16 16:17:39 +02:00
Philip Rebohle
26b319b29b
[d3d11] Fallout 4: Force Flush on GetData calls 2018-05-14 02:40:59 +02:00
Philip Rebohle
a90c2843a7
[dxvk] Remove std::vector from DxvkDataBuffer
Vectors are zero-initialized upon resize, which is unnecessary
in this case and potentially impacts performance.
2018-05-13 21:34:38 +02:00
Philip Rebohle
516d7f091e
Merge branch 'disable-opt-bit' 2018-05-13 16:19:31 +02:00
Philip Rebohle
f42f7cc743
[dxvk] Make use of the asynchronous pipeline compiler optional
Users can enable this by setting DXVK_USE_PIPECOMPILER=1.
2018-05-13 16:02:23 +02:00
Philip Rebohle
2ee80ce1bd
[dxvk] Log start/stop of pipe compiler worker threads 2018-05-13 15:37:31 +02:00
Philip Rebohle
368eea7310
[dxvk] Use derivative pipelines again 2018-05-13 15:37:18 +02:00
Philip Rebohle
c17f4e2fc0
[dxvk] Increase update buffer size
Helps reduce the number of memory allocations further
when deferred contexts are used for rendering.
2018-05-13 14:45:50 +02:00
Philip Rebohle
9d4654f445
[dxvk] Fix update buffer allocation size 2018-05-13 11:12:54 +02:00
Philip Rebohle
3fc9466a07
[dxvk] Fix query scopes
Occlusion queries must begin and end in the same render pass.
Fixes a rendering issue in Shadow Warrior 2 on AMD drivers.
2018-05-12 19:46:08 +02:00
Philip Rebohle
5f3b65014f
[dxvk] Reset query pools on the init buffer 2018-05-12 19:45:42 +02:00
Philip Rebohle
3135359ee9
[dxvk] Create a separate command buffer for initialization tasks
We'll use this to reset query pools without having to spill
the active render pass. Required to fix a query-related bug.
2018-05-12 19:32:50 +02:00
Philip Rebohle
581e505f54
[dxbc] Fix bit scan instructions
firstbithi counts from the MSB rather than the LSB. Fixes
rendering issues in Hitman.
2018-05-12 01:39:23 +02:00
Philip Rebohle
b805560340
[dxvk] Do not log invalid pipeline state
Fixes some log spam in case games attempt to render geometry
with an invalid pipeline state vector.
2018-05-10 21:59:57 +02:00
Philip Rebohle
cfb4791872
[dxvk] Use VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT
Optimized versions of the pipelines will be compiled asynchronously.
2018-05-10 14:54:44 +02:00
Philip Rebohle
517a7532be
[dxvk] Added DxvkPipelineCompiler 2018-05-10 14:29:13 +02:00
Philip Rebohle
3b132196d3
[dxvk] Add ability to hold two pipeline handles to pipeline instances 2018-05-10 14:15:47 +02:00
Philip Rebohle
010fc6ad49
[dxvk] Implement DxvkGraphicsPipelineInstance
This should come in handy when compiling an optimized version of
a pipeline asynchronously. This can be extended to hold multiple
pipeline handles, i.e. one optimized one and one without opts.

Collateral damage: We're not using derivative pipelines anymore,
needs to be re-added at a later point.
2018-05-09 22:23:50 +02:00
Philip Rebohle
ec3b7e39af
[util] Fix includes 2018-05-09 20:37:49 +02:00
Philip Rebohle
c7d2957d8f
[util] Remove duplicate tzcnt function 2018-05-09 20:09:09 +02:00
Philip Rebohle
37456d583e
[dxvk] Move DxvkPipelineCache to DxvkPipeManager
Since the pipeline cache isn't used for anything else but compiling
pipelines, keeping this stuff together is much more useful.
2018-05-09 14:26:45 +02:00
Philip Rebohle
47b9fd8b19
[dxvk] Reimplement vertex buffer bindings
Reduces the number of Vulkan calls for vertex buffer bindings and
works around incorrect validation errors emitted when applications
do not use a consecutive range of vertex bindings. No performance
impact is expected in most games.
2018-05-09 13:01:52 +02:00
Philip Rebohle
b6d33e6289
[d3d11] D3D11SamplerState: Cosmetic changes 2018-05-09 11:55:05 +02:00
Philip Rebohle
5465ee8a85
[util] Add tzcnt function 2018-05-09 00:01:00 +02:00
Philip Rebohle
33e511485c
[hud] Fixed uninitialized depth bounds values 2018-05-07 21:53:32 +02:00
Philip Rebohle
cd92d0b992
[dxvk] Allow binding render targets of different sizes
In order to not cause Vulkan validation issues, we have
to reduce the framebuffer size. Fixes a regression in
Bioshock Infinite.
2018-05-07 20:46:20 +02:00
Philip Rebohle
3c611503d6
[dxgi] Fix reported VRAM size for 32-bit builds 2018-05-07 19:04:25 +02:00
Philip Rebohle
3e111086b2
[d3d11] Implement D3D11CoreCreateDevice
Some applications need this function to be present and it's better to
fail for them with an error code rather than crash because the entry
point does not exist in our DLLs.
2018-05-07 14:06:52 +02:00
Philip Rebohle
757be61b70
[dxgi] Use per-adapter format lookup tables
Allows Nvidia cards to use 24-bit depth buffers.
2018-05-06 13:12:30 +02:00
Philip Rebohle
fb3dbd8bcd
[d3d11] Relaxed view format compatibility check
Fixes regressions in multiple games. MSDN docs regarding
format compatibility are wrong in every way.
2018-05-05 20:16:01 +02:00
Philip Rebohle
f4a92a685f
[d3d11] Normalize render target and depth-stencil view types
Fixes a regression in Kingdom Come: Deliverance that was
introduced in a55bee9554.
2018-05-05 15:53:49 +02:00
Philip Rebohle
5a639797d2
[d3d11] Fix stencil component mapping in shader resource views
Fixes terrain rendering in Far Cry 5.
2018-05-05 15:15:09 +02:00
Philip Rebohle
8177898151
[d3d11] Validate image view format compatibility
Fixes Vulkan validation errors in Far Cry 5.
2018-05-05 15:13:35 +02:00
Philip Rebohle
e1a27faa4a
[dxgi] Added DXGI format family info 2018-05-05 12:57:22 +02:00
Philip Rebohle
a55bee9554
[d3d11] Validate render targets before setting them up
Mimicks what native D3D11 does. Fixes validation errors in
Nier:Automata with multisampling enabled in some situations.
2018-05-05 09:12:36 +02:00
Philip Rebohle
fb288d8713
[d3d11] Disable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT for typed formats
Yields over 10% performance improvement on RADV in GPU-bound scenarios.
2018-05-05 00:49:43 +02:00
Philip Rebohle
fe24d76fd0
[dxgi] Report D3D10 support only when DXVK_FAKE_DX10_SUPPORT is set
Should fix a regression in Assassin's Creed 4: Black Flag.
2018-05-05 00:48:35 +02:00
Philip Rebohle
94b74667e9
[dxgi] Fix Fullscreen->Windowed transition (again)
We need to preserve the flags if the application changes them.
This is in line with what native DXGI does.
2018-05-04 21:55:38 +02:00
Philip Rebohle
c2c8d8be8a
[d3d11] Minor formatting fix 2018-05-04 21:52:34 +02:00
Philip Rebohle
6cbc133619 [dxgi] Use ShowWindow instead of redundant SetWindowPos call 2018-05-04 17:53:02 +02:00
Philip Rebohle
de803b3670 [dxgi] Report refresh rate as a multiple of 1000 Hz
More closely emulates what Windows dows.
2018-05-04 17:37:29 +02:00
Philip Rebohle
9cec1ecca3 [d3d11] Fix stage and access mask for default constant buffers 2018-05-04 10:23:36 +02:00
Philip Rebohle
ac1d505d14 [dxvk] Do not compute SHA-1 hash of generated shaders
We do not need this on this branch.
2018-05-04 00:16:39 +02:00
Philip Rebohle
ae0e5bccdd [dxvk] Make shader accessible from shader module 2018-05-03 23:56:28 +02:00
Philip Rebohle
33357f1f36 [dxvk] Compute SHA-1 hash of generated shaders 2018-05-03 23:56:22 +02:00
Philip Rebohle
3a3b1eda59 [dxvk] Move render pass out of pipeline state vector 2018-05-03 23:48:45 +02:00
Philip Rebohle
59d4f1a1fb [util] Add method to retrieve SHA1 hashes in 32-bit chunks 2018-05-03 23:47:42 +02:00
Philip Rebohle
77d0424d7f [dxgi] Advertize support for ID3D10Device and ID3D10Device1
We don't actually support these, but applications can reasonably
assume that D3D10 is supported if D3D11 is present. Closes #329.
2018-05-02 17:00:56 +02:00
Philip Rebohle
27d3a78d79 [dxbc] Omit empty source string in OpSource instruction
This parameter is optional and confuses RenderDoc if present.
2018-05-02 13:07:26 +02:00
Philip Rebohle
5683422208 Merge branch 'clearopt' 2018-05-02 00:45:17 +02:00
Philip Rebohle
e30a8299e6 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-05-02 00:45:10 +02:00
Philip Rebohle
41fca78d27 [dxgi] Add GetDevice method to IDXGIVkInteropSurface
Convenient way of getting the IDXGIVkInteropDevice from the surface
without having to go through several D3D interface queries.
2018-05-01 23:30:39 +02:00
Philip Rebohle
badb93334e [dxvk] Fix DxvkContext::transformImage
We have to spill the render pass before transforming the
image. We don't need the barrier if the old and new
layout are the same.
2018-05-01 23:29:58 +02:00
Philip Rebohle
5e02c1bb2f [dxvk] Move DxvkPipelineManager instance back to DxvkDevice 2018-05-01 16:56:33 +02:00
Philip Rebohle
d201a1f7c6 [dxvk] Made pipe manager and pipeline classes thread-safe 2018-05-01 16:45:28 +02:00
Philip Rebohle
cf1358b2f4 [dxvk] Fixed partial depth-stencil clear operations 2018-04-30 21:42:16 +02:00
Philip Rebohle
4c298d486d [dxgi] Restore display mode even when the window got destroyed 2018-04-30 20:15:35 +02:00
Philip Rebohle
46f2e4d864 [dxgi] CheckInterfaceSupport; Log interface queries 2018-04-30 20:01:50 +02:00
Philip Rebohle
370ff34e9f [d3d11] Fix sampler state validation for anisotropy
Fixes an issue where samplers are not created in Path of Exile.
2018-04-30 19:38:38 +02:00
Philip Rebohle
2626a26072 [d3d11] Fix sampler state validation for anisotropy
Fixes an issue where samplers are not created in Path of Exile.
2018-04-30 19:36:42 +02:00
Philip Rebohle
ba53cf92ac Revert "[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass"
This reverts commit 1bbfe77013.
Breaks Path of Exile.
2018-04-30 18:47:35 +02:00
Philip Rebohle
5d5be87402 [dxvk] Oprimize render target clear operations
We can save one image layout transition when clearing a render
target by delaying clears until vkCmdBeginRenderPass is called.
2018-04-30 17:04:13 +02:00
Philip Rebohle
16a25db846 Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-30 15:56:32 +02:00
Philip Rebohle
1bbfe77013 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-04-30 15:47:29 +02:00
ZeroFault
768a078250 [d3d11] Implement state block normalization (#333)
* [d3d11] implement stateblock normalization

* add const to default state description object

* fix code formatting

* Correct the blend state normalization

* add missing error return

* code cleanup and refactoring

* remove unecessary const qualifier and fix code formatting

* [d3d11] Cosmetic changes
2018-04-30 10:41:57 +02:00
Philip Rebohle
a32050374c [dxgi] Implement display mode changes
Allows games to change the screen resolution in fullscreen
mode. This is currently in a rough shape and some games may
not work as expected when selecting fullscreen mode.
2018-04-29 23:03:27 +02:00
Philip Rebohle
a3c561f9dc [dxgi] LeaveFullscreenMode: Correctly restore the window size 2018-04-29 17:26:00 +02:00
Philip Rebohle
1bcae90dd0 [dxvk] Fix image layouts for images using VK_IMAGE_TILING_LINEAR
We have to use VK_IMAGE_LAYOUT_GENERAL for those. On top of that,
we should avoid image transitions when the image is in GENERAL
layout anyway in order to save some time on the GPU.
2018-04-29 15:28:50 +02:00
Philip Rebohle
d5041337f5 [d3d11] Use linar tiling for textures if optimal tiling is not supported
Fixes texture creation issues in various Batman games.
2018-04-29 14:43:24 +02:00
Philip Rebohle
9aa73d1148 [dxvk] Set non-zero framebuffer size when there are no attachments
This is required for UAV-only rendering and will be required for
stream output in the future as well.
2018-04-29 11:19:18 +02:00
Philip Rebohle
7cb7e4a944 Merge branch 'master' of https://github.com/doitsujin/dxvk 2018-04-28 14:18:18 +02:00
Philip Rebohle
99813a7778 [d3d11] Use const ref pointer for device parameter
Closes #323.
2018-04-28 14:17:52 +02:00
pchome
4a74cd45d5 [clang-tidy] performance-move-const-arg fix (#324)
https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html
2018-04-28 14:13:23 +02:00
pchome
1dbf8bf2a1 [dxvk] Fix native build on *nix x86_64 systems (#328)
* [dxvk] Fix native build on *nix x86_64 systems

> /usr/include/c++/v1/algorithm:2633:1:
> note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'unsigned long long')

winegcc, clang-tidy and other native build types/tools are affected.

http://en.cppreference.com/w/cpp/language/types#Data_models
> 64 bit systems:
> * LLP64 or 4/4/8 (int and long are 32-bit, pointer is 64-bit) 
>    * Win64 API 
> * LP64 or 4/8/8 (int is 32-bit, long and pointer are 64-bit) 
>    * Unix and Unix-like systems (Linux, Mac OS X) 

http://en.cppreference.com/w/cpp/types/integer#Function_macros_for_minimum-width_integer_constants
Macro `UINT64_C(1)` from `stdint.h` should literally interpret `1` to `1UL` or `1ULL`
```c
# if __WORDSIZE == 64
#  define UINT64_C(c)	c ## UL
# else
#  define UINT64_C(c)	c ## ULL
# endif
```

* [dxvk] Fix native build on *nix x86_64 systems

Use explicit template argument instead of 1ull or UINT64_C(1) macro.
2018-04-28 09:08:14 +02:00
pchome
78e8621d09 [clang-tidy] performance-for-range-copy fix (#322)
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2018-04-28 01:14:57 +02:00
Philip Rebohle
1784b8c44d [d3d11] Merge interop API 2018-04-26 22:20:09 +02:00
Philip Rebohle
8cb3a266f7 [dxvk] Fix potential state tracking issue when updating render targets 2018-04-26 18:43:19 +02:00
Philip Rebohle
962a7f5766 [dxvk] Ignore redundant render target bindings
Further reduces render pass count if applications bind render targets
without using them, and then bind the old set of render targets again.
2018-04-26 15:30:18 +02:00
Philip Rebohle
1075990dbe [dxvk] Apply render target bindings at draw time
This should help reduce the number of redundant render pass spills,
especially in games which use deferred contexts for rendering. This
optimization mostly helps in GPU-bound scenarios.
2018-04-26 14:47:55 +02:00
Philip Rebohle
8606576d83 [hud] Do not explicitly use a framebuffer object 2018-04-26 13:24:42 +02:00
Philip Rebohle
5eaacf7459 [dxbc] Add gs_vertex_in to the entry point interface
Fixes invalid SPIR-V generated in the Blacksmith demo (#267).
2018-04-23 18:07:31 +02:00
Philip Rebohle
d91114d733 [dxvk] Rename renderPassBegin/End methods to start/spillRenderPass 2018-04-23 11:11:40 +02:00