Commit Graph

4106 Commits

Author SHA1 Message Date
Philip Rebohle 34fd16b8f2
[d3d11] Add implicit flush after tracking sequence numbers
Flushing early when using a tracked resource may reduce stalls.
2022-02-16 20:49:00 +01:00
Philip Rebohle 2dfdc5ac3b
[d3d11] Enable stall tracking for timestamp queries
Because games are dumb and don't understand that the GPU doesn't
work synchronously with the render thread.
2022-02-16 19:59:11 +01:00
Philip Rebohle d45f5a8d79
[d3d11] Handle subresource field in copy/move operations
Derp.
2022-02-15 13:00:10 +01:00
Philip Rebohle e70f9f92a6
[util] Enable apitrace mode for Nier Replicant
Game is broken and reads back dynamic vertex/index buffers over PCI-E.
2022-02-14 09:20:41 +01:00
Philip Rebohle 4e464327ef
[util] Bump maxImplicitDiscardSize for Quantum Break
Otherwise we're synchronizing and frame times are garbage.
2022-02-14 04:21:46 +01:00
Philip Rebohle e1b3bc45ce
[d3d11] Add d3d11.maxImplicitDiscardSize option 2022-02-14 04:17:56 +01:00
Philip Rebohle 63bf928ab5
[hud] Display GPU synchronization in HUD 2022-02-14 03:28:45 +01:00
Philip Rebohle 4d9b464f7c
[d3d9] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle 2f80f8847e
[d3d11] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle 0c99b17081
[dxvk] Introduce DxvkDevice::waitForResource
Blocks on the queue thread's condition variable instead of busy-waiting,
and tracks synchronization with new stat counters. Cleanup is rearranged
to minimize delays before signals and resources are notified.
2022-02-14 03:15:47 +01:00
Philip Rebohle 25ebf94873
[dxvk] Display barrier count in draw call HUD item 2022-02-14 01:10:15 +01:00
Philip Rebohle 316e252a27
[dxvk] Add stat counter for pipeline barriers 2022-02-14 01:08:55 +01:00
Philip Rebohle b5078a7ec0
[dxvk] Reduce context staging buffer size to 4 MiB
Same idea as before, just create a temporary buffer for larger resources.

This can avoid frequent Vulkan memory allocations and deallocations since
many small buffers are more likely to fit into a single memory chunk than
a small number of large buffers, thus reducing the overall memory footprint.
2022-02-14 01:01:34 +01:00
Philip Rebohle 08ecd49c66
[dxvk] Don't suballocate large staging buffer allocations
Otherwise we'll risk wasting almost half the staging buffer memory.
Creating a temporary buffer is cheap enough, so just do that.
2022-02-14 01:00:48 +01:00
Philip Rebohle b9201db554
[dxvk] Remove unused trimStagingBuffers method 2022-02-13 02:08:20 +01:00
Philip Rebohle 95b7e6c030
[dxvk] Rework HUD font texture initialization
We really shouldn't need a separate context for this.
2022-02-13 02:08:20 +01:00
Philip Rebohle 425fce9200
[dxvk] Introduce transient memory flag for staging buffers
Potentially reduces fragmentation by putting short-lived staging buffers
and sysmem resources created by the application into different memory pools.
2022-02-13 02:08:20 +01:00
Philip Rebohle 9d4be00fa7
[dxvk] Allow large sysmem allocations on 64-bit platforms again
Since we frequently discard staging buffers now, having larger chunks
is actually beneficial again.
2022-02-13 02:08:20 +01:00
Philip Rebohle d262bebd90
[dxvk] Remove DxvkStagingDataAlloc
Unused and overly clunky.
2022-02-13 02:08:20 +01:00
Philip Rebohle 8518572d13
[dxvk] Use DxvkStagingBuffer in DxvkContext 2022-02-13 02:08:20 +01:00
Philip Rebohle 1b88bc624a
[dxvk] Remove unused updateImage function 2022-02-13 02:08:20 +01:00
Philip Rebohle 3b833988fe
[dxvk] Use staging buffer for gamma ramp uploads 2022-02-13 02:08:19 +01:00
Philip Rebohle 80c5b61e26
[d3d11] Use DxvkStagingBuffer in D3D11DeviceContext 2022-02-13 02:08:19 +01:00
Philip Rebohle 0bc19472e8
[dxvk] Introduce DxvkStagingBuffer 2022-02-13 02:08:19 +01:00
Philip Rebohle 82518de4b4
[dxvk] Discard buffer slice in copyBuffer if possible 2022-02-13 02:08:19 +01:00
Philip Rebohle 5e763853e5
[dxvk] Introduce tryInvalidateDeviceLocalBuffer 2022-02-13 02:08:19 +01:00
Philip Rebohle 6a3de28f94
[dxvk] Repurpose updateBuffer
Only allow it for very small updates where scheduling a copy command would
likely be slower. Some drivers have special paths for tiny updates.
2022-02-13 02:08:19 +01:00
Philip Rebohle a03c038f03
[d3d9] Exit early in ProcessVertices if the vertex count is 0
We don't want to pass a zero-sized copy to the backend.
2022-02-13 02:08:19 +01:00
Philip Rebohle 26381fd5df
[d3d11] Only use updateBuffer for very small buffer updates
Otherwise we may end up with significant copy overhead on the CS thread.
2022-02-13 02:08:19 +01:00
Philip Rebohle ac9ed96457
[hud] Add HUD item to show CS thread stats 2022-02-13 02:07:48 +01:00
Philip Rebohle b02496a8f4
[dxvk] Add CS thread stat counters 2022-02-13 02:07:48 +01:00
Philip Rebohle d96c5a1076
[dxvk] Store DXVK device inside DxvkCsThread object 2022-02-13 02:07:48 +01:00
Philip Rebohle 52666a33c6
[dxvk] Expose a way to increment stat counters
In case the counters come from external sources.
2022-02-13 02:07:45 +01:00
Philip Rebohle b6121c84aa
[d3d11] Avoid GPU synchronization on mapping images when possible 2022-02-11 18:17:35 +01:00
Philip Rebohle 3f16de157b
[d3d11] Avoid GPU synchronization on mapping buffers when possible 2022-02-11 18:17:35 +01:00
Philip Rebohle c82b504e52
[d3d11] Further simplify D3D11DeferredContextMapEntry
And no longer create a strong reference to the given resource.
2022-02-11 18:17:35 +01:00
Philip Rebohle 2dcdd20517
[d3d11] Change D3D11ResourceRef constructor to be more useful 2022-02-11 18:17:35 +01:00
Philip Rebohle 0364a79eb0
[d3d11] Optimize Unmap on immediate contexts 2022-02-11 18:17:35 +01:00
Philip Rebohle 5a6711ed1d
[d3d11] Synchronize only to given sequence number in WaitForResources
Avoids costly thread synchronization when mapping staging resources
for reading, as well as some other scenarios.
2022-02-11 18:17:35 +01:00
Philip Rebohle afe1840c74
[d3d11] Track resources when dispatching Cubin shaders as well 2022-02-11 18:17:35 +01:00
Philip Rebohle bb16734a43
[d3d11] Implement sequence number tracking on deferred contexts 2022-02-11 18:17:35 +01:00
Philip Rebohle 2eeb7295c8
[d3d11] Increment sequence number when submitting command lists
This does not do any tracking on deferred contexts just yet.
2022-02-11 18:17:35 +01:00
Philip Rebohle d33dac569c
[d3d11] Track last staging resource usage with a sequence number 2022-02-11 18:17:35 +01:00
Philip Rebohle 55a6b80919
[d3d11] Add method to query D3D11 resource dimension from texture 2022-02-11 18:17:35 +01:00
Philip Rebohle d870b6ff38
[d3d11] Store ID3D11Resource interface in D3D11CommonTexture
Going full circle here, but it's actually useful now.
2022-02-11 18:17:35 +01:00
Philip Rebohle 9c32beccdc
[d3d11] Store buffer map mode in D3D11Buffer
Matches what we do for textures, and makes it so that we don't
have to dereference the resource pointer to figure this out.
2022-02-11 18:17:35 +01:00
Philip Rebohle 2db56fa160
[d3d11] Add D3D11ResourceRef
Implements private ref counting for arbitrary resource types.
2022-02-11 18:17:35 +01:00
Philip Rebohle 391c9e13ca
[d3d11] Add ResourceAddRef/ReleasePrivate with known resource type 2022-02-11 18:17:35 +01:00
Philip Rebohle 6b91b87dba
[dxvk] Reorganize DxvkBuffer data structure
Should hopefully reduce CPU cache conflicts.
2022-02-11 18:17:34 +01:00
Philip Rebohle 37f3d9208b
[dxvk] Introduce sequence numbers for CS submissions 2022-02-11 18:17:34 +01:00