Commit Graph

114 Commits

Author SHA1 Message Date
Philip Rebohle 12f0f8b13f
[d3d11] Don't use a state object for default blend state 2019-10-13 23:15:23 +02:00
Philip Rebohle c30fd8fb97
[d3d11] Don't use a state object for default depth-stencil state 2019-10-13 23:15:23 +02:00
Philip Rebohle b0231403fe
[d3d11] Don't use a state object for default rasterizer state 2019-10-13 23:15:23 +02:00
Philip Rebohle a89c662984
[d3d11] Introduce ResetState and use it for ClearState
ClearState gets used a lot in games that use deferred
contexts, so we should make sure it's fast. Since we
apply default state everywhere, there is no need to
perform any expensive RestoreState operations.

Reduces the amount of time spent on ClearState on the
CS thread by ~40%, and by ~90% on the calling thread.
2019-10-13 23:15:23 +02:00
Philip Rebohle 102a18060e
[d3d11] Don't spill render pass when rebinding render targets
The backend handles this now, so it's no longer necessary.
2019-10-13 01:44:31 +02:00
Philip Rebohle f9d9307a28
[d3d11] Implement ID3D11DeviceContext4 2019-09-16 13:41:31 +02:00
Philip Rebohle 0599a82dee
[d3d11] Implement ID3D11DeviceContext3 2019-09-16 13:41:31 +02:00
Philip Rebohle c1a7243811
[d3d11] Implement ID3D11DeviceContext2
We don't support tiled resources nor markers for now.
Marker support could be added through debug layers.
2019-09-16 12:42:14 +02:00
Philip Rebohle 30d19cd0f2
[d3d11] Rename some hazard tracking methods for clarity 2019-08-29 19:10:53 +02:00
Philip Rebohle 6be124e2cd
[d3d11] Check for conflicts withing RTV and UAV lists upon binding them 2019-08-29 19:10:53 +02:00
Philip Rebohle e07ef1ec40
[d3d11] Resolve pipeline hazards when binding render targets 2019-08-29 19:10:53 +02:00
Philip Rebohle 5756e5c921
[d3d11] Check for shader resource view hazards
Fixes incorrect behaviour in games that try to use a currently bound
UAV or render target as a shader resource at the same time.

Fixes visual artifacts in Shining Resonance Refrain on AMD hardware.
2019-08-26 23:43:47 +02:00
Philip Rebohle 5ae5053a2a
[d3d11] Remove templated SetUnorderedAccessViews
Not needed because the CS and OM paths are separate anyway.
2019-08-26 23:29:01 +02:00
Philip Rebohle b6c395c013
[dxvk] Don't track command count in CS chunks
We weren't using this at all, and it's not necessary
to check whether the chunk is empty either.
2019-07-17 12:52:25 +02:00
Philip Rebohle b20ceec727
[d3d11] Handle integer formats in ClearRenderTargetView correctly
We're supposed to apply the same color conversion as in ClearView.
2019-07-17 11:47:42 +02:00
Philip Rebohle 42e61020e4
[d3d11] Remove unused SetRenderTargets method 2019-06-27 15:54:42 +02:00
Philip Rebohle a41bd8c4a0
[d3d11] Further optimize constant buffer binding
Saves a few CPU cycles on the more common SetConstantBuffers method,
compared to SetConstantBuffers1.
2019-06-20 22:49:19 +02:00
Philip Rebohle 3141467c37
[d3d11] Template all functions that take ShaderStage as an argument
Basically what D9VK does. Doesn't seem to affect performance, but why not.
2019-06-20 22:09:02 +02:00
Philip Rebohle 818704d413 [d3d11] Add some likely/unlikely around CS flushes 2019-06-02 20:29:22 +02:00
Philip Rebohle 9004fde78d
[d3d11] Remove useless 'virtual' keyword 2019-05-19 14:38:48 +02:00
Philip Rebohle e1610f81dc
Revert "[d3d11] Use STDMETHODCALLTYPE for private virtual method"
For some reason, this produces broken binaries for some Gentoo
users. Fixes #1067.

This reverts commit e5fa55cbb5.
2019-05-19 13:22:04 +02:00
Philip Rebohle 8e9e7963a2
[d3d11] Update mapped buffers of staging textures immediately
Improves performance in Lords of the Fallen and The Surge.
Closes #1049.

Co-authored-by: Robin <robin.kertels@outlook.com>
2019-05-17 12:44:36 +02:00
Philip Rebohle e5fa55cbb5
[d3d11] Use STDMETHODCALLTYPE for private virtual method
Improves code generation on some compilers.
2019-05-15 22:01:19 +02:00
Philip Rebohle 7687db0303
[dxvk] Remove extra pipeline state
This can be expressed with specialization constants now.
2019-05-06 00:18:59 +02:00
Philip Rebohle 492b7db07b
[d3d11] Support count buffer in Set|BindDrawBuffers 2019-05-06 00:08:58 +02:00
Philip Rebohle 1cd8749234
[d3d11] Add stub implementation of D3D11DeviceContextExt 2019-05-06 00:08:58 +02:00
Philip Rebohle f733d082f4
[d3d11] Implement D3D11DeviceContext::SwapDeviceContextState 2019-05-04 15:57:57 +02:00
Philip Rebohle 9fc09c843d
[d3d11] Set up unused extra state for the backend correctly 2019-05-01 01:57:34 +02: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 bbc3b3fb2b
[d3d11] Use multiDrawIndirect for subsequent indirect draw calls
Significantly improves performance in AC:Odyssey when CPU bound.
Only has an effect when no state changes between draw calls, and
when the draw parameter buffer is tightly packed.
2019-01-10 17:14:12 +01:00
Robin 4c9af44356 [d3d10] Use context lock instead of separate device lock 2018-12-30 21:08:52 +01:00
Philip Rebohle cf21111401
[d3d11] Implement ID3D11Multithread for D3D11 contexts 2018-11-30 11:38:00 +01:00
Philip Rebohle 08b403f655
[d3d11] Fix potential UAV binding issue
When rebinding an already active UAV, we still need to
update the counter unless the app passed a value of -1.

Ref #712.
2018-11-26 17:18:35 +01:00
Philip Rebohle ad5688764c
[d3d11] Use single-use submission mode for CS chunks where possible 2018-11-20 10:44:04 +01:00
Philip Rebohle f14d17b743
[d3d11] Don't mark context methods as 'final' 2018-10-17 17:28:47 +02:00
Philip Rebohle 406816d17c
[d3d10] Support pOffsets parameter in SOGetTargets 2018-10-10 19:55:42 +02:00
Philip Rebohle 93753a5ce7
[d3d11] Bind transform feedback buffers in SOSetTargets 2018-10-10 19:55:41 +02:00
Philip Rebohle 781ee00f5c
[dxvk] Refactor indirect draw/dispatch commands
Introduces an OpenGL-style bind point for the argument buffer, which
means we can avoid a lot of unnecessary reference tracking in games
that do a lot of indirect draw calls.

Reduces CPU overhead in Assassin's Creed Odyssey.
2018-10-08 10:23:18 +02:00
Philip Rebohle 0b4f1b6d6f
[d3d11] Implement DiscardView and DiscardResource for images 2018-10-01 16:54:34 +02:00
Philip Rebohle 161fb6215a
[d3d11] Optimize UAV binding
- UpdateBuffer is faster than ClearBuffer for small updates.
- We shouldn't dispatch *two* CS commands for each UAV, one is enough.
2018-09-27 16:50:34 +02:00
Philip Rebohle 66d1bed083
[d3d11] Remove old UAV counter buffer implementation 2018-08-30 15:32:46 +02:00
Philip Rebohle f1b075c0f3 [dxvk] Add CS chunk pool
Reduces the number of dynamic memory allocations for CS chunks by
recycling them once they are no longer needed. Also fixes a potential
issue with chunks that are dispatched multiple times.
2018-08-27 16:07:38 +02:00
Philip Rebohle 3fee20dfec
[d3d11] Implement DiscardResource for buffers
We don't suppor this for images, and we don't support DiscardView yet.
Buffers can be invalidated, which may in some cases be beneficial in
order to avoid synchronization on the GPU.
2018-08-03 11:10:40 +02:00
Philip Rebohle 8044ce6c7e
[d3d11] Refactor UAV counter buffer allocator
- Fixes violation of the minStorageBufferOffsetAlignment limit
- Allows allocation of multiple counter buffers if necessary
2018-08-03 10:17:02 +02:00
Philip Rebohle 7f0f7ac048
[d3d11] Refactor shader binding
This way we can get rid of an unnecessary template and make future
extensions possible.
2018-07-30 19:37:19 +02:00
Philip Rebohle 9fee253d09
[d3d11] Add more implicit flush points
All these methods will implicitly spill the active render pass and
are typically not called very often, so we can try to keep the GPU
busy.
2018-06-27 18:34:17 +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 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 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 4a0c81276f
[d3d11] Implement new auto-flush heuristic 2018-06-04 23:31:49 +02:00