Commit Graph

2104 Commits

Author SHA1 Message Date
Philip Rebohle b89646584b
[util] Enable constant buffer range check for Dark Souls Remastered ans Grim Dawn 2019-04-05 20:56:32 +02:00
Philip Rebohle 5819a69302
[d3d11] Add option to enable constant buffer range checks 2019-04-05 20:56:32 +02:00
Philip Rebohle 9b99c55a2e
[dxbc] Implement optional constant buffer range check 2019-04-05 20:56:29 +02:00
Philip Rebohle b9bfbb9ccc
[dxvk] Fix move constructor of DxvkShaderModule 2019-04-04 16:10:44 +02:00
Philip Rebohle da4baefdf0
[spirv] Fix initial allocation size for compressed buffer
The old initial size was still for uint8.
2019-04-04 13:15:59 +02:00
Philip Rebohle ac3cd0b688
[dxvk] Store compressed shader modules in DxvkShader
Reduces the amount of memory used to store shaders to
around ~45%-50% of the original size.
2019-04-04 13:00:31 +02:00
Philip Rebohle f49863f321
[dxvk] Store enabled SPIR-V capabilities explicitly 2019-04-04 13:00:31 +02:00
Philip Rebohle f32200b668
[spirv] Implement in-memory compression for shader modules 2019-04-04 13:00:31 +02:00
Philip Rebohle d2395180af
[util] Add helpers to pack/unpack data to/from larger units 2019-04-04 13:00:31 +02:00
Liam Middlebrook 9d26031dcb [dxvk] Zero-Initialize SpecConstantData
Ensure that specialization constant data passed into the driver is
zero-initialized.

Having the pData field in VkSpecializationInfo be zero-initialized helps
to create more deterministic input to the driver, which is particularly
useful when debugging shader issues.
2019-04-03 23:21:12 +02:00
Philip Rebohle cd93ba570e
[dxvk] Simplify DxvkShaderModule
This is merely a wrapper for a VkShaderModule now, so it really
doesn't need anything fancy and definitely doesn't need to be
heap-allocated.
2019-04-03 20:47:58 +02:00
Philip Rebohle 2bd09e52e7
[dxvk] Don't cache shader modules for graphics pipelines
We're only ever going to need those when actually compiling a new
pipeline, so on average we're just wasting large amounts of memory
by keeping them around.

Trades several hundred MB of memory for a small increase in compile
times. Creating shader modules is typically very cheap.
2019-04-03 20:01:36 +02:00
Philip Rebohle 79e867624a
[dxvk] Don't cache shader modules for compute pipelines 2019-04-03 19:46:28 +02:00
Philip Rebohle 632b254714
[d3d11] Use combined image sampler descriptors for the presenter 2019-04-03 17:40:05 +02:00
Philip Rebohle 257c19ed0a
[hud] Use combined image s1ampler for the font texture 2019-04-03 17:40:05 +02:00
Philip Rebohle ddde5ee6c2
[dxvk] Support combined image sampler descriptors in the backend 2019-04-03 17:40:05 +02:00
marcin mikołajczak 342a483e45 fix typo in README.md 2019-04-03 15:47:08 +02:00
Chip Davis 910e1a1835 Only try once to recreate surfaces on surface loss. 2019-04-02 17:26:48 +02:00
Chip Davis 540900b792 [vulkan] Don't loop endlessly on a lost surface.
If the surface is lost in a way that can't be recovered by recreating
the surface from the window, the previous change would wind up looping
forever. Just retry 5 times before giving up.
2019-04-02 17:26:48 +02:00
Chip Davis e633dbc06f [vulkan] Recreate the surface on surface loss.
According to the Vulkan spec:

> Several WSI functions return `VK_ERROR_SURFACE_LOST_KHR` if the
> surface becomes no longer available. After such an error, the surface
> (and any child swapchain, if one exists) **should** be destroyed, as
> there is no way to restore them to a not-lost state.

So if we get this error, we need to recreate the surface in addition to
the swapchain.
2019-04-02 17:26:48 +02:00
Philip Rebohle b5f859915a
[dxvk] Properly reset global barrier access flags
Fixes: adaf98bb9d
2019-04-02 15:05:44 +02:00
Philip Rebohle 6da02c6f56
[dxvk] Fix write access flag for barriers
Fixes: adaf98bb9d
2019-04-02 15:01:37 +02:00
Philip Rebohle adaf98bb9d
[dxvk] Use global memory barrier instead of resource barriers if possible
Hardware doesn't support this type of fine-grained synchronization
anyway, so we really don't need the driver to iterate over anything
up to hundreds of structs - except for layout transitions.
2019-04-02 14:48:39 +02:00
Philip Rebohle 67b9b6e1e1
[dxvk] Pull buffer updates out of render passes whenever possible
Instead of ending the render pass and inserting two barriers, we
perform the update and barrier in a dedicated command buffer.

Improves performance in Sekiro by 5-10% depending on resolution and scene.
2019-04-02 13:17:05 +02:00
Philip Rebohle e59f53abfa
[dxvk] Allow barriers to be recorded into a specific command buffer 2019-04-02 12:14:15 +02:00
Philip Rebohle 2315d55ecc
[dxvk] Rename DxvkCmdBufferFlag -> DxvkCmdBuffer 2019-04-02 12:10:47 +02:00
Philip Rebohle e395712de7
[dxvk] Add missing feature check for conditional rendering 2019-04-02 04:13:23 +02:00
Philip Rebohle 295d583c1d
[d3d11] Lazily allocate predicate on SetPredication
Many games use CreatePredicate to create occlusion queries without
actually using predication, and we don't want to pay any runtime
cost for this when predicates aren't actually being used.
2019-04-02 04:07:05 +02:00
Philip Rebohle 87dc472a8d
[dxvk] Set empty scissor rect when the app requests empty viewport
Since we cannot set the viewport size to zero, we should set an
empty scissor rect so that rasterization is still effectively
disabled for the given viewport index.

Fixes #813, #957.
2019-04-01 15:45:41 +02:00
Philip Rebohle 8702374bf7
[dxvk] Do not invalidate iterator before disabling queries
Reported-by: Joshua Ashton <joshua@froggi.es>
2019-04-01 02:58:02 +02:00
Philip Rebohle 70510bab9a [dxvk] Introduce extra pipeline state
Provides extra state that will be passed in via spec constants.
Whether or not this state is used is determined by the shaders.
2019-04-01 02:31:32 +02:00
Philip Rebohle 18d2905bf7 [dxvk] Remove unused alphaToOne state
Nothing supports this anyway, so no reason to carry it around.
2019-04-01 02:31:22 +02:00
Marin Baron 1c434d86cb [util] Enable deferred surface creation for "Dissidia Final Fantasy NT Free Edition".
Avoid white screen, "D3D11Device: No such vertex shader semantic: COLOR0"...
https://www.reddit.com/r/archlinux/comments/b7e38x/protondxvk_dissidia_nt/
2019-03-31 03:27:05 +02:00
Philip Rebohle a646f8cf2c
[util] Enable deferred surface creation for Nioh
See discussion in #284.
2019-03-29 08:49:37 +01:00
Chip Davis d741bc47ef [dxgi] Use a recursive mutex.
Some games, like Final Fantasy XIV, call `SetFullscreenState()` again
after the window is resized. When the resize itself was triggered by a
`SetFullscreenState()` call, this will cause us to re-enter the mutex.
2019-03-29 08:26:19 +01:00
Philip Rebohle 61adaa941d
[d3d11] Implement fast path for binding full constant buffers
Saves a few CPU cycles in the most common case where
we don't have to perform any sort of range check.
2019-03-28 14:09:08 +01:00
Philip Rebohle 8f580efa25
[d3d11] Correctly handle out-of-bounds constant buffer ranges
Otherwise we pass an invalid offset and length to the backend,
which leads to invalid descriptor set updates in Vulkan.
The D3D11 runtime does not report corrected constant offset
and count parameters to the applicaion in *GetConstantBuffers1.

Reported-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2019-03-28 13:45:41 +01:00
Philip Rebohle 09d60f42bc
[d3d11] Work around predicate buffer sync issue on RADV
If the predicate buffer is device-local memory, conditional
rendering commands don't seem to see any updates values even
though there is a barrier. When allocating on host-visible
device memory or system memory, it works as expected.
2019-03-28 10:02:11 +01:00
Philip Rebohle 3a3d7fb378
[d3d11] Properly implement SetPredication 2019-03-28 10:02:11 +01:00
Philip Rebohle d81146e3d2
[d3d11] Allocate predicate buffer for predicates 2019-03-28 10:02:11 +01:00
Philip Rebohle 7e16c4cda1
[d3d11] Remove unused revision field from D3D11Query 2019-03-28 10:02:11 +01:00
Philip Rebohle acdb989cfa
[dxvk] Implement conditional rendering 2019-03-28 10:02:11 +01:00
Philip Rebohle 03f00453ef
[dxvk] Add command list functions for conditional rendering 2019-03-28 10:02:11 +01:00
Philip Rebohle 70520e30aa
[dxvk] Enable conditionalRendering feature if present 2019-03-28 10:02:11 +01:00
Philip Rebohle 8f7e606583
[dxvk] Enable VK_EXT_conditional_rendering if available 2019-03-28 10:02:11 +01:00
Philip Rebohle 7f211545ee
[vulkan] Load functions for VK_EXT_conditional_rendering 2019-03-28 10:02:11 +01:00
Chip Davis 13a6ecadcd [dxvk] Remove needless lambda capture of 'this'. 2019-03-27 21:59:15 +01:00
Chip Davis 7a37d88067 [dxvk] Log vertex attributes and buffers when logging pipeline state.
This was invaluable in diagnosing a missing feature from MoltenVK.
2019-03-27 21:59:03 +01:00
Philip Rebohle edd63d3972
[dxvk] Fix buffer offset in copyDepthStencilImageToPackedBuffer 2019-03-27 14:23:58 +01:00
Philip Rebohle 03881dde72
[dxvk] Implement blitImage function 2019-03-27 02:31:04 +01:00