Commit Graph

224 Commits

Author SHA1 Message Date
Philip Rebohle 62b0e34a73
[d3d11] Implement IDXGIVkInteropDevice for D3D11Device 2018-04-20 00:19:03 +02:00
Philip Rebohle fcdba67b88
[d3d11] Implement 2D<->3D image copies in CopySubresourceRegion 2018-04-17 22:22:49 +02:00
ZeroFault a248ae985d [d3d11] nullptr check on Begin and End (#295) 2018-04-17 13:57:39 +02:00
Philip Rebohle d523405a5a
[dxvk] Implement bindRenderTargets method
An alternative to manually creating a framebuffer object and binding
it via bindFramebuffer. Future optmizations can use this to bring
down the number of redundant render pass changes.
2018-04-15 01:09:53 +02:00
Philip Rebohle a6767ebd52
[d3d11] Improved debug output of D3D11DeviceContext methods 2018-04-14 11:45:31 +02:00
Philip Rebohle 56a1433d3f
[d3d11] ClearUnorderedAccessViewUInt: Create temp view if necessary
If this method is used to clear a view with a floating point format,
we need to create a compatible view with an integer format in order
to clear the resource with the correct value. Fixes some calls to
this function in Rise of the Tomb Raider and other games.
2018-04-12 23:31:15 +02:00
Philip Rebohle db541d188f
[dxgi] Added static format mapping table 2018-04-12 17:49:14 +02:00
Philip Rebohle ef4a3c5bfc
[d3d11] Use meta clear for ClearUnorderedAccessView* methods 2018-04-11 23:39:12 +02:00
Philip Rebohle e06300d592
[d3d11] Fix multisample format support query for depth images
Fixes a crash in World of Warships when reflections are enabled.
2018-04-04 11:24:16 +02:00
Philip Rebohle 2973c18055 [dxgi/d3d11] Remove COM_QUERY_INTERFACE macro, reset pointers
May fix some crashes in applications that rely on the returned
pointer being set to nullptr before returning.
2018-04-02 12:52:02 +02:00
Philip Rebohle b3aff7cd2e
[d3d11] Fix immediate context initialization
The old initialization code did not take either CSMT or
Deferred Contexts into account and could lead to illegal
calls to beginRecording.

Fixes a hang encountered in Dishonored 2.
2018-03-22 13:40:45 +01:00
Philip Rebohle 17e981f360
[dxvk] Increase UAV slot count to 64 for the graphics pipeline
D3D11 raised this limit from 8 UAVs in the fragment shader to
64 UAVs in all graphics stages combined.
2018-03-21 04:56:33 +01:00
Philip Rebohle bd71f256e5
[d3d11] Fixed constant buffer binding update 2018-03-21 03:26:31 +01:00
Philip Rebohle c6251d28fc
[d3d11] Remove warnings from CopySubresourceRegion1 / UpdateSubresource1
The flags should have no impact on correctness, so not supporting them
makes no difference. Prevents log spam in Dishonored 2.
2018-03-19 14:52:42 +01:00
Philip Rebohle 2346a2ac03
[d3d11] Remove inconsistent uses of "this" 2018-03-18 12:57:39 +01:00
Philip Rebohle c43702e445
[d3d11] Implement GetConstantBuffers1 methods 2018-03-18 12:45:27 +01:00
Philip Rebohle e54246d000
[d3d11] Implement SetConstantBuffers1 methods 2018-03-18 12:39:11 +01:00
Philip Rebohle 3133e4ba35
[d3d11] Add constant buffer offsets and counts to context state 2018-03-18 12:36:45 +01:00
Mikhail Paulyshka a3e7139c1e [d3d11] stub implementation of ID3DDeviceContext1 (#174) 2018-03-17 18:54:09 +01:00
Philip Rebohle 52a9a4f406
[dxvk] Reimplemented clearRenderTarget
Closer to the D3D11 API. We cannot use the normal clearColorImage and
clearDepthStencilImage methods in case the game uses a 2D array view
for a 3D image. Fixes some validation issues in Hellblade.
2018-03-17 17:59:43 +01:00
Philip Rebohle 1af52abb67
[d3d11] Move OMSetRenderTargets optimization to D3D11ImmediateContext
We cannot call Flush() on deferred contexts anyway, so the command
submission optimization should only be applied to immediate contexts.
2018-03-17 14:09:16 +01:00
Philip Rebohle 56df0bcccb
[d3d11] Refactoring texture classes: Remove D3D11TextureInfo 2018-03-14 00:45:07 +01:00
Philip Rebohle afaa3b5a30
[d3d11] Fix minor code inconsistencies 2018-03-10 14:41:06 +01:00
Philip Rebohle 7069df6b1e
[d3d11] Reimplemented ClearState
Potentially increases the overhead of ClearState calls, but also correctly
resets the context state when deferred contexts are used.
2018-03-10 13:06:15 +01:00
Philip Rebohle 5cb6c968b5
[d3d11] Fix RestoreUnorderedAccessViews for pixel shaders 2018-03-10 12:47:45 +01:00
Philip Rebohle ca53fe7925
[d3d11] Minor fixes 2018-03-10 12:11:17 +01:00
Philip Rebohle 969b35c80c
[d3d11] RestoreState: Restore DS/OM/RS state objects 2018-03-10 11:56:58 +01:00
Philip Rebohle 5befa3b745
[d3d11] RestoreState: Restore IA state 2018-03-10 11:44:27 +01:00
Philip Rebohle c49a0b969b
[d3d11] RestoreState: Restore viewport state 2018-03-10 11:31:40 +01:00
Philip Rebohle f15feef47f
[d3d11] RestoreState: Restore shader resource bindings 2018-03-10 11:30:32 +01:00
Philip Rebohle 5ef0f31c66
[dxvk/d3d11] Refactored resource binding
Slightly reduces overhead of D3D11 *SetShaderResources methods.
2018-03-10 11:16:52 +01:00
Philip Rebohle b72f11a0bf
[d3d11] RestoreState: Restore vertex and index buffer bindings 2018-03-10 10:39:07 +01:00
Philip Rebohle d1a2cff9ac
[d3d11] RestoreState: Restore framebuffer and shader bindings 2018-03-10 10:19:07 +01:00
Philip Rebohle 3b42011c50
[d3d11] Implemented OMGetRenderTargetsAndUnorderedAccessViews and predication stub 2018-03-09 16:47:20 +01:00
Philip Rebohle 85d28f7328
[d3d11] Implemented ClearUnorderedAccessViewUint for raw and structured buffers 2018-03-07 16:29:13 +01:00
Philip Rebohle 95e2c641e0
[d3d11] Partially implement SOSetTargets/SOGetTargets
This does not implement any stream output functionality yet,
but it allows games to set and query stream output buffers.
2018-03-07 15:32:19 +01:00
Mikhail Paulyshka 9deb73a2a7 Add support for MSVC, attempt 3 (#130)
* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()
* do not use DLLEXPORT macro for MSVC

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs for MSVC
* do not use DLLEXPORT macro for MSVC

* [meson] fix build scripts for MSVC

* change cpp version from c++1z to c++latest for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) for MSVC (bypass 'C2375: redefinition; different linkage' error)
* fix .def files for MinGW
* add --enable-stdcall-fixup linker flag for MinGW
2018-03-06 18:34:34 +01:00
Philip Rebohle 1cbe6829eb
Revert "Add MSVC support (#123)"
This reverts commit c63d4361a0.
2018-03-05 14:32:28 +01:00
Mikhail Paulyshka c63d4361a0 Add MSVC support (#123)
* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs

* [meson] fix build scripts for MSVC

* change cpp version from 1z to 17 for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) (bypass 'C2375: redefinition; different linkage' error)
2018-03-05 14:28:51 +01:00
Mikhail Paulyshka 6c62d7608e [d3d11] add stub for ID3DUserDefinedAnnotation (#122)
* [d3d11] D3D11DeviceContext::QueryInterface: log missing GUID

* [d3d11] suppress warnings for ID3DUserDefinedAnnotation and ID3D11Debug
2018-03-05 01:07:09 +01:00
Philip Rebohle 82ac381919
[d3d11] Move framebuffer creation out of OMSetRenderTargets
This might be useful when restoring context state.
2018-03-03 22:15:41 +01:00
Philip Rebohle b469cfac0b
[d3d11] Implemented FinishCommandList/ExecuteCommandList 2018-03-03 20:59:17 +01:00
Philip Rebohle d74db72add
[d3d11] Implemented CSGetUnorderedAccessViews 2018-03-01 07:02:39 +01:00
Philip Rebohle 43b7e84bb5
[d3d11] Return fake tessellation shader obejects to the application
Prevents crashes in applications that use domain and hull shaders for
more than just rendering. Allows Fallout 4 tp run.
2018-02-26 17:29:10 +01:00
Philip Rebohle eadf74264b
[d3d11] Return early for clear operations on NULL views
Fixes a crash in Fallout 4 when loading into the game.
2018-02-24 23:39:22 +01:00
Philip Rebohle 82fc851f32
[d3d11] Fixed CopySubresourceRegion for partial buffer updates
Fixes a subtle bug that caused the Fallout 4 menu to render random
geometry.
2018-02-23 15:16:44 +01:00
Philip Rebohle cb3daaf856
[dxvk] Change resolveImage interface to accept an explicit format 2018-02-20 22:26:23 +01:00
Philip Rebohle 43dbc9f1d6
[dxvk] Support depth-to-color image copies and vice versa
Fixes validation errors and depth of field effect in Neptunia VII
and potentially other games which do not use all depth images for
rendering.
2018-02-20 13:08:50 +01:00
Philip Rebohle 5334ff57bf [d3d11] Wired up D3D11Query to backend 2018-02-18 22:34:23 +01:00
Philip Rebohle 61ce7022e2
[d3d11] Fix optional write issue in GetData() 2018-02-07 12:35:40 +01:00
Philip Rebohle b31ebbb690
[d3d11] Add support for DSV read-only flags
Games need this in order to use the depth buffer as both
a framebuffer attachment and a shader resource.
2018-02-06 17:31:23 +01:00
Philip Rebohle e25f4b2299
[d3d11] Implemented ClearUnorderedAccessViewUint for images 2018-02-04 23:57:43 +01:00
Philip Rebohle 495f58370c
[d3d11] Implemented CopySubresourceRegion for buffers
Also fixed a typo where ResolveSubresource would do the
wrong thing.
2018-02-03 21:14:55 +01:00
Philip Rebohle 78c46f444a
[d3d11] Added missing CS thread sync for non-discard Map() 2018-01-31 16:39:47 +01:00
Philip Rebohle 08436ad1e1
[d3d11] Get rid of duplicate code in ResolveSubresource 2018-01-30 02:20:28 +01:00
Philip Rebohle 6c6b108cdd
[d3d11] Handle non-multisampled source images in ResolveSubresource 2018-01-30 01:18:43 +01:00
Philip Rebohle 4aaa351225
[d3d11] Fixed query-related logging
Log messages in GetData did not take into account that
writing back data is actually optional.
2018-01-29 17:04:07 +01:00
Philip Rebohle ca53eaf878
[general] Minor COM pointer improvements 2018-01-29 16:31:25 +01:00
Philip Rebohle 52e8918b57
[d3d11] Added support for tessellation patch primitives 2018-01-29 11:31:00 +01:00
Philip Rebohle 8f554a210b
[d3d11] Silence unnecessary SOSetTargets errors 2018-01-29 01:15:51 +01:00
Philip Rebohle 6d75178870
[d3d11] Remove default sampler
This is handled in the backend now.
2018-01-28 22:05:08 +01:00
Philip Rebohle b8e49f1eb8
[d3d11] Fixed incorrect aspect mask for depth-stencil clear ops
Application may specify a clear flag that the image format does
not support, in which case it should just be ignored. Fixes
validation errors in Microsoft's MultiThreadedRendering demo.
2018-01-28 21:13:37 +01:00
Philip Rebohle b63346b052
[d3d11] Implmented ResolveSubresource for typed resources
Enables MSAA support in Nier:Automata and potentially other games.
2018-01-28 18:06:41 +01:00
Philip Rebohle 363a0f8a6b
[d3d11] Implemented IAGetIndexBuffer an IAGetVertexBuffers
TressFX needs this.
2018-01-23 19:10:48 +01:00
Philip Rebohle 14bb4ed9c2
[d3d11] Fixed depth-stencil clear outside renderpasses
Fixes rendering in Tomb Raider (2013).
2018-01-23 19:01:07 +01:00
Philip Rebohle e198bd2d55
[d3d11] Sub-allocate from larger update buffers for UpdateSubresources
Reduces the allocation overhead when applications frequently
call UpdateSubresources to update small buffers and textures.
2018-01-23 16:43:55 +01:00
Philip Rebohle 2c20bf4dcb
[d3d11] Use Map() for host-visible buffers in UpdateSubresource 2018-01-23 12:16:28 +01:00
Philip Rebohle 5b1311b71e
[d3d11] Added stubs for deferred contexts and command lists 2018-01-23 09:23:31 +01:00
Philip Rebohle b923a2004f
[d3d11] Fixed image copy operation 2018-01-21 01:57:12 +01:00
Philip Rebohle b7a00e32ec
[dxvk] Limit size of the CS command queue
Prevents memory leaks and fixes stuttering in Heaven.
2018-01-21 00:49:07 +01:00
Philip Rebohle 6ab7897127
[d3d11] Enabled command stream thread 2018-01-20 23:12:03 +01:00
Philip Rebohle 7d7cc1ceda
[d3d11] Record commands into a CS chunk 2018-01-20 22:52:18 +01:00
Philip Rebohle f25b3c8b32
[d3d11] Use EmitCs for resource updates 2018-01-20 21:42:11 +01:00
Philip Rebohle 496acd71b1
[d3d11] Use EmitCs for some Copy/Clear operations 2018-01-20 19:30:31 +01:00
Philip Rebohle 9441974497
[d3d11] Use EmitCs for state object updates 2018-01-20 19:11:42 +01:00
Philip Rebohle cbbfefbbb7
[d3d11] Use EmitCs for shader and resource binding methods 2018-01-20 18:54:37 +01:00
Philip Rebohle 7fad731096
[d3d11] Use EmitCs for Input Assembly methods 2018-01-20 18:34:25 +01:00
Philip Rebohle e951a5ea0c
[d3d11] Use EmitCs for draw and dispatch calls 2018-01-20 18:26:17 +01:00
Philip Rebohle 4d17b1752f
[d3d11] Use EmitCs for general setup and synchronization methods 2018-01-20 18:01:43 +01:00
Philip Rebohle 2dd24a14d2
[dxvk] Refactored blend constants
This will make things a little less painful when capturing
blend constants in a lambda function, as required for CSMT.
2018-01-20 15:41:06 +01:00
Philip Rebohle 0b426a0942
[d3d11] Added new D3D11ImmediateContext class
Initial prep work for both CSMT and Deferred Contexts.
2018-01-20 13:22:44 +01:00
Philip Rebohle f88adc4e82
[d3d11] Implemented mipmap generation 2018-01-20 09:46:54 +01:00
Philip Rebohle 2a364c557b
[d3d11] Implemented image mapping for reads 2018-01-19 18:09:49 +01:00
Philip Rebohle 9334873188
[dxvk] Cleaned up DxvkBufferSlice and added documentation 2018-01-18 18:50:44 +01:00
Philip Rebohle 6e6c290e01
[d3d11] Use DxvkPhysicalBufferSlice for resource copies and buffer views 2018-01-18 18:33:13 +01:00
Philip Rebohle 9acc4a1a82
[d3d11] Map default constant buffers to host memory
Improves performance in applications that use UpdateSubresources
to frequently update constant buffers, such as Unigine Heaven,
Unigine Valley and Homefront.
2018-01-18 11:55:27 +01:00
Philip Rebohle ade9cd0587
[d3d11] Removed some uninteresting log messages
Reduces log spamming in Homefront.
2018-01-17 23:49:26 +01:00
Clément Guérin 340438954d [d3d11] copy all layers and mipmaps in CopyResource
avoid using potentially undefined mappedSubresource
2018-01-14 12:17:54 -08:00
Clément Guérin 482147d929 [d3d11] support textures in CopyResource
fixes green textures and log spam with TrackMania
2018-01-14 11:09:14 -08:00
Philip Rebohle 198c9389af [d3d11] Flush resource init commands
Like regular command buffers, the command buffers used for resource
initialization should not be able to grow indefinitely.
2018-01-13 23:40:17 +01:00
Philip Rebohle c7a9763f6d [d3d11] Re-implemented draw call-based context flush
After doing more testing, it became apparent that this
optimization is beneficial most of the time and may also
improve stability by limiting the number of commands
recorded into a single command buffer.
2018-01-13 23:09:03 +01:00
Philip Rebohle 65d84dabfe [d3d11] Removed draw-call based context flush
Combined with the recent command submission optimization,
this actually had a negative impact on performance.
2018-01-13 05:27:26 +01:00
Philip Rebohle ac1fe7c2b0 [d3d11] Optimized command submission 2018-01-13 05:00:27 +01:00
Philip Rebohle 672675ba78 [d3d11] Implemented OMSetRenderTargetsAndUnorderedAccessViews
Note that this does *not* properly implement UAV rendering in
the backend yet. For that, we need to add memory barriers.
2018-01-12 15:38:07 +01:00
Philip Rebohle 32078033c6 [d3d11] Fixed UAV counter buffer binding 2018-01-11 17:12:39 +01:00
Philip Rebohle c1d6c20066 [d3d11] Implemented D3D11 parts of append/consume buffers 2018-01-11 12:23:55 +01:00
Philip Rebohle 1b67ffaed2 [d3d11] Added default sampler state 2018-01-10 19:07:55 +01:00
Philip Rebohle 3925675b89 [d3d11] Optimized command submission
The context will now be flushed after a render pass that consisted of
several hundreds of draw calls. This way the GPU should be kept busy.
2018-01-08 17:45:21 +01:00
Philip Rebohle ad10ab07f8 Revert "[d3d11] Added dummy resoruce binding for buffers"
This approach will not work if the d3d11 context binds an
incompatible resouce in case the pipeline itself changes.
2018-01-08 13:01:31 +01:00
Philip Rebohle 24ad9e730c [d3d11] Added dummy resoruce binding for buffers
Fixes crashes when a D3D11 application uses unbound resources
in shaders. Allows Nier:Automata to play back cutscenes.
2018-01-08 10:17:52 +01:00