Commit Graph

167 Commits

Author SHA1 Message Date
Philip Rebohle 3d5becaf6a [d3d11] Implement Acquire/ReleaseWrappedResource 2023-03-18 00:50:42 +01:00
Philip Rebohle 3f9d2269f6 [d3d11] Synchronize queue submissions for 11on12 devices as necessary
When the app explicitly calls Flush, Signal or Wait, we need to wait
for the submission to actually take place so that subsequent D3D12
submissions execute in the correct order.
2023-03-18 00:50:42 +01:00
Philip Rebohle da32453b42 [dxvk] Add submission feedback to command submissions 2023-03-16 20:59:43 +01:00
Philip Rebohle d7a4ddb5d0 [d3d11] Implement more accurate resource tracking on deferred contexts
Allows us to track chunks that access any given tracked resource more
accurately and flush as needed, e.g. if a staging buffer is written at
the start of a long command list.
2023-01-17 15:01:06 +01:00
Philip Rebohle cf5adb8b12 [d3d11] Improve flushing around deferred context submissions 2023-01-17 15:01:06 +01:00
Philip Rebohle 591e2df701 [d3d11] Consider flushing after each CS chunk
This way we will never end up with overly long command lists.
2023-01-17 15:01:06 +01:00
Philip Rebohle 2a3d7ee7dc [d3d11] Use new flush heuristic 2023-01-17 15:01:06 +01:00
Philip Rebohle f952418958 [d3d11] Determine pending commands based on sequence number
We get this for free and this allows us to query how many CS chunks
have been emitted since the last flush.
2023-01-17 15:01:06 +01:00
Joshua Ashton 000a647c56 [d3d11] Store D3D11DeviceContextState as private ref
Avoids a circular dependency
2022-09-16 12:49:10 +02:00
Philip Rebohle fdcbdeb28f [d3d11] Implement dirty trackig for default-mapped images
Avoids GPU synchronization when using WriteToSubresource,
and also reduces bandwidth.
2022-09-05 05:52:55 +02:00
Philip Rebohle ca833082b5 [d3d11] Fix broken image readback for mapped default images 2022-09-05 04:31:13 +02:00
Philip Rebohle 559fa50f54 [d3d11] Introduce d3d11.enableContextLock option 2022-08-24 12:27:02 +02:00
Philip Rebohle 86bdda70b4 [d3d11] Move D3D10Multithread instance to immediate context
Deferred contexts do not support this.
2022-08-24 12:15:35 +02:00
Joshua Ashton a554a6d60d [d3d11] Include win32 compat headers where applicable 2022-08-21 21:40:55 +02:00
Philip Rebohle 7685a86494
[d3d11] Change state restoring behaviour in SwapDeviceContextState 2022-08-05 14:13:24 +02:00
Philip Rebohle c7d9201303
[d3d11] Change state clearing behaviour around deferred contexts
Resetting command list state at the end of each D3D11 command list,
as well as before ExecuteCommandList, will allow us to track which
state needs to be reset, which may save us a significant amount of
CPU work.
2022-08-05 14:13:24 +02:00
Philip Rebohle 91fc0a8688
[d3d11] Rename and factor out some state clearing methods 2022-08-05 14:13:21 +02:00
Philip Rebohle 0f94971193
[d3d11,d3d9] Lock context/device in EndFrame
Fixes #2787.
2022-08-05 12:10:03 +02:00
Philip Rebohle e49524fcb0
[d3d11] Move GetType and GetContextFlags to D3D11CommonContext 2022-08-04 13:43:36 +02:00
Philip Rebohle 77c032da5c
[d3d11] Move OM* functions to D3D11CommonContext
We can get rid of the immediate context overload as well
since we can just directly call FlushImplicit here.
2022-08-04 13:43:35 +02:00
Philip Rebohle 10345d0063
[d3d11] Move QueryInterface to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle 3ead348b82
[d3d11] Move UpdateSubresource code to D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle e4204f76e6
[d3d11] Introduce D3D11CommonContext 2022-08-04 13:43:35 +02:00
Philip Rebohle dcd2c4847b
[d3d11] Implement ID3D11Fence
No interop support just yet.

Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 02:15:16 +02:00
Philip Rebohle cdf22a4086
[dxvk] Rename imageFormatInfo -> lookupFormatInfo 2022-07-15 17:25:13 +02:00
Joshua Ashton e884413c49 [dxvk] Don't synchronize device if going for DLL shutdown
All our other threads have been destroyed and we can no longer synchronize with them properly.

Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
2022-07-14 17:04:52 +02:00
Philip Rebohle 7e42939a4a
[d3d11] Call endFrame at the end of each frame 2022-06-28 14:35:57 +02:00
Philip Rebohle ab0c15ea54
[dxvk] Introduce DxvkContextType 2022-06-28 14:35:57 +02:00
Philip Rebohle 17a1b0ad44
[d3d11] Consider empty CS chunks when tracking resources
Avoids deadlocks if we track multiple resources and flush in between.
2022-02-18 14:21:53 +01:00
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 e1b3bc45ce
[d3d11] Add d3d11.maxImplicitDiscardSize option 2022-02-14 04:17:56 +01:00
Philip Rebohle 2f80f8847e
[d3d11] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle d96c5a1076
[dxvk] Store DXVK device inside DxvkCsThread object 2022-02-13 02:07:48 +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 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 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 37f3d9208b
[dxvk] Introduce sequence numbers for CS submissions 2022-02-11 18:17:34 +01:00
Philip Rebohle 6c862b63a2
[d3d11] Optimize UpdateSubresource for small buffer updates
Some games use UpdateSubresource to upload constant buffers in
between draws, so this path should be as fast as possible.

Also fixes a potential issue when using D3D11_COPY_NO_OVERWRITE
on deferred contexts, since the Map requirements don't hold here.
2022-02-07 16:14:02 +01:00
Philip Rebohle 67391a7bb0
[d3d11] Introduce d3d11.ignoreGraphicsBarriers option 2021-09-09 14:28:25 +02:00
Philip Rebohle 4c222ec557
[d3d11] Use callback fence to signal Flush1 event 2021-08-05 22:57:58 +02:00
Philip Rebohle 9f80d9f8b2
[d3d11] Remove functions to update mapped buffers
No longer relevant since staging images will no longer be backed
by actual Vulkan images and dynamic images are not GPU-writable.
2021-06-24 21:07:48 +02:00
Philip Rebohle fd66f44561
[d3d11] Use UpdateImage in D3D11ImmediateContext::UnmapImage 2021-06-24 21:07:48 +02:00
Philip Rebohle 596f65f75f
[d3d11] Handle MAP_MODE_STAGING when mapping images on the immediate context 2021-06-24 21:07:48 +02:00
Philip Rebohle f155b8a8b9
[d3d11] Introduce DiscardSlice and GetMappedSlice for image resources
These do the same as they do for buffer resources, but for a mapped
image subresource instead.
2021-06-24 21:07:48 +02:00
Philip Rebohle f50c5234dc
[dxvk] Add source offset/extent to copyPackedBufferToDepthStencilImage 2021-06-24 21:07:48 +02:00
Philip Rebohle 4840cdaf8c
[dxvk] Add slice alignment to copyBufferToImage 2021-06-24 21:07:45 +02:00