Philip Rebohle
dc31be7118
[d3d11] Use global user config for D3D11 options
2018-08-07 14:59:09 +02:00
Philip Rebohle
3359b89166
[d3d11] Do not hold strong references to the ID3D11Resource in views
...
Emulates Windows behaviour more closely. Fixes refcount-related
error messages in Unreal Engine 4 (see #302 ), as well as a crash
in Yakuza 0 (see #533 ).
2018-08-05 21:31:13 +02:00
Philip Rebohle
ffc87faed0
[d3d11] Add private ref count helpers for ID3D11Resource
2018-08-05 21:31:13 +02:00
Philip Rebohle
c223e35608
[d3d11] Do not keep a strong reference to the swap chain back buffer
...
Fixes crash in Yakuza 0 with fullscreen mode enabled. SEGA, please,
stop being lazy and learn to use reference counting correctly.
2018-08-05 21:31:13 +02:00
Philip Rebohle
871c96b130
[d3d11] Refactor Unordered Access View Creation
...
Part 4 / 4 of the refactor.
2018-08-05 19:28:39 +02:00
Philip Rebohle
55203eb458
[d3d11] Refactor Shader Resource View Creation
...
Part 3 / 4 of the refactor.
2018-08-05 19:20:12 +02:00
Philip Rebohle
1038bf2ef5
[d3d11] Refactor Render Target View Creation
...
Part 2 / 4 of the refactor.
2018-08-05 19:07:53 +02:00
Philip Rebohle
0598982f35
[d3d11] Refactor Depth-Stencil View Creation
...
Part 1 of 4 of a much needed refactor. Instead of translating
the structures in the D3D11Device class, we'll move the code
to the respective view classes in order to clean up.
2018-08-05 19:02:45 +02:00
Philip Rebohle
16315a39a0
[d3d11] Use new resource helper functions during view creation
...
This simplifies things when both buffers and textures are allowed.
2018-08-05 18:56:42 +02:00
Philip Rebohle
b87f3f5155
[d3d11] Add common resource helper functions
2018-08-05 18:45:24 +02:00
Philip Rebohle
66e178756e
[d3d11] Introduce GetCommonBuffer helper
...
Also update GetCommonTexture documentation.
2018-08-05 18:29:29 +02:00
Philip Rebohle
ace8e42213
[d3d11] Move BufferInfo struct into D3D11Buffer
2018-08-05 18:24:01 +02:00
Philip Rebohle
fe66e668e5
[dxvk] Implement native discardBuffer function in the backend
...
This may be more efficient because it avoids renaming the buffer
in case it can be used without inserting additional barriers.
2018-08-03 11:28:00 +02:00
Philip Rebohle
fb88070888
[d3d11] Implement copy flags for CopySubresourceRegion1 / UpdateSubresource1
2018-08-03 11:22:26 +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
212bd56b93
[d3d11] Fix border color mapping for opaque white
2018-08-02 17:04:09 +02:00
Philip Rebohle
0ba00b3f59
[dxvk] Add extended device feature structure
...
This allows the client API to query and enable extended
features in the future, should it become necessary, much
like the extende feature queries.
2018-07-31 16:58:25 +02:00
Philip Rebohle
bf06654a83
[d3d11] Remove DXVK_SHADER_READ_PATH
...
Broken, and won't work with ICB UBOs.
2018-07-30 20:29:05 +02:00
Philip Rebohle
bf912d0a5f
[d3d11] Create shader constant buffer if necessary
2018-07-30 20:29:05 +02:00
Philip Rebohle
c31e646921
[dxvk] Introduce concept of shader constants
...
Large constant arrays should be moved to a uniform buffer instead
of being baked directly into the shader code.
2018-07-30 20:29:05 +02:00
Philip Rebohle
af5de8a8ef
[d3d11] Fix compiler warning
2018-07-30 20:27:18 +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
adadf362a3
[d3d11] Optimize WaitForResource behaviour when resource is already idle
...
We don't have to flush everything in this case, just flushing the current
CS chunk is enough to determine if the resource is in use by the GPU.
2018-07-23 16:08:01 +02:00
Philip Rebohle
662b6429a8
[d3d11] Refactor resource initialization
...
In addition to moving the code to a separate class, this also
improves flushing behaviour by limiting the amount of memory
being initialized rather than the number of commands executed.
2018-07-23 15:21:17 +02:00
Mikhail Paulyshka
f38ee85a39
[build] Fix compilation on MSVC ( #505 )
...
* [build] do not use shared_library/objects property with MSVC
* [util] use ./com/com_include.h instead of windef.h
It is required for Windows 10 SDK.
* [util] store thread procedure lambda in std::function
* [dxgi] fix annoying MSVC warning
warning C4099: 'IDXGIVkInteropDevice': type name first seen using 'class' now seen using 'struct'
2018-07-21 12:43:33 +02:00
Philip Rebohle
5fe4c4f610
[dxvk] Use VkImageViewUsageCreateInfoKHR when creating image views
...
Must be used when view formats are used that do not support all
usage bits of the underlying image. Refs #504 .
2018-07-21 10:58:06 +02:00
Jacek Caban
88cda20746
[d3d11] Import dxgi by -l instead of directly specifying library name.
2018-07-19 08:55:34 +02:00
Jacek Caban
c934d85b85
[d3d11] Move D3D11ImmediateContext constexpr values to .cpp file
...
In my winelib builds, I get unresolved dxvk::D3D11ImmediateContext::MinFlushIntervalUs symbol. I'm not sure why it doesn't inline this constexpr, but it doesn't seem useful to expose that in header anyway.
2018-07-19 08:55:34 +02:00
Jacek Caban
6d16bb4c87
Don't use std::thread.
...
Wine needs to setup each thread that has an access to Windows APIs. It means that in winelib builds, we can't let standard C++ library create threads and need to use Wine for that instead. I wrote a thin wrapper around Windows thread functions so that the rest of code just has to use new dxvk::thread class instead of std::thread.
2018-07-19 08:55:34 +02:00
Jacek Caban
06511aa72c
[build] Use .spec files instead of .def files in winelib build
2018-07-19 08:55:34 +02:00
Jacek Caban
635a43fefe
[build] Explicitly specify .dll and .exe extensions in winelib build
...
meson can't handle that itself.
2018-07-19 08:55:34 +02:00
Philip Rebohle
2100d7aa3a
[d3d11] Fake SO support for F1 2015, Mafia 3
2018-07-12 00:32:36 +02:00
Philip Rebohle
87b5161b2a
[d3d11] Reset implicit flush timer only when actually flushing
...
In some situations, calling Flush without any commands that
could be flushed would unnecessarily prevent the implicit
flush heuristic from kicking in properly.
2018-07-09 20:31:54 +02:00
Philip Rebohle
c8c6f24b63
[d3d11] Fix log spam when an application uses DiscardView
...
We don't support this method, but we should only issue the warning
once to prevent poor performance.
2018-07-08 15:53:30 +02:00
Philip Rebohle
974db9712b
[dxvk] Remove clear rect parameter from clearRenderTarget
...
With deferred clears and render target-based clears, this was
not properly supported anyway.
2018-07-06 15:01:37 +02:00
Philip Rebohle
63af141383
[d3d11] Set proper view format list for typed UAVs
...
Typed UAVs are mutable, but we only need them to be compatible to
their typed format and the bit-compatible integer format used for
clears.
2018-07-03 13:31:22 +02:00
Philip Rebohle
cbf4772973
[d3d11] Pass image format family to the backend
2018-07-03 12:44:56 +02:00
Philip Rebohle
bc1384b7b4
[d3d11] Issue warning when using a command list more than once
...
The way buffers are invalidated can cause issues when the same command
list is submitted multiple times. Games don't seem to need this right
now.
2018-06-29 12:44:52 +02:00
Philip Rebohle
4520b1ca8f
[d3d11] Fix usage and access flags for multisampled images
...
Meta-resolve operations will use the image in a fragment shader.
2018-06-28 16:47:54 +02:00
Philip Rebohle
42a676bbdb
[d3d11] Tweak implicit flush limits
...
We're going to flush more often in CPU-limited scenarios, but these
new values are reasonable especially in games which submit large
amounts of GPU work at once, and should help reduce rendering latency.
Improves GPU utilization and frame rates in Hellblade by up to 10%.
2018-06-27 20:25:33 +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
4f28d57352
[dxvk] Remove unused rasterizer discard state flag
2018-06-25 16:56:52 +02:00
Philip Rebohle
060cd1d87c
[d3d11] Do not use MUTABLE_FORMAT_BIT for strictly typed formats
...
This used to cause issues in the past, but apparently we can safely
enable this optimization now. Improves performance slightly on RADV.
2018-06-24 17:01:05 +02:00
Philip Rebohle
845c78fd20
[dxbc] Consider stream index in signature entry lookup
2018-06-23 20:13:00 +02:00
Philip Rebohle
102591369e
[dxbc] Add DxbcModuleInfo struct
...
This will be required in the future to pass data from the
application to the shader compiler.
2018-06-23 17:14:35 +02:00
Philip Rebohle
432708c15f
[d3d11] Fix image aspect mask for typeless resolve
...
The DXGI format info only stores the aspect mask for views created
with that format, but we're dealing with a raw resource here so we
have to query the aspect mask from the Vulkan format in question.
Fixes validation errors with typeless resolve if the formats of
the two involved images are identical.
2018-06-21 10:17:59 +02:00
Philip Rebohle
60bf471f06
[d3d11] Fix issue with back buffer creation
...
In case the window size is 0 in either dimension, we ended up
creating an image with an invalid size. Fixes Vulkan validation
errors in Hearthstone.
2018-06-21 10:12:38 +02:00
Philip Rebohle
f5d73842b2
[d3d11] Do not flush on every call to GetData
...
There are several scenarios when flushing can have
a significant negative impact on performance:
1. When the query result is already available
2. When the game scatters GetData calls when rendering
Frostpunk hits both issues at the same time, which led to
over 120 queue submissions per frame. This patch reduces
that to 3 submissions per frame when the game is GPU-bound.
2018-06-19 14:34:15 +02:00
Philip Rebohle
5dfe0d077d
[d3d11] Fix render target layouts for linar tiling
...
There currently doesn't seem to be a game which actually renders
to images with linear tiling, but we should handle this anyway.
Only the GENERAL layout is allowed if the tiling is not OPTIMAL.
2018-06-19 11:28:54 +02:00
Philip Rebohle
f519a0f2e4
[d3d11] Fake streamout support for Final Fantasy XV
...
The game uses this feature only for Hairworks. This hides an error
message and allows the game to start.
2018-06-16 18:52:20 +02:00
Philip Rebohle
a148233b13
[d3d11] Use clearBuffer to initialize UAV counters
2018-06-16 10:22:38 +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
c93f2b980e
[d3d11] Report correct timer frequency for TIMESTAMP_DISJOINT queries
2018-06-13 14:30:44 +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
dcd6c2c0f3
[d3d11] Implement CheckCounterInfo and related stubs
...
DXVK does not support device-specific counters, which seem to
be useful only for GPU profiling during development, but we
should report this properly to the application.
2018-06-11 14:01:45 +02:00
Philip Rebohle
05f24c3c38
[d3d11] Reduce log spam about UAV rendering
2018-06-10 04:19:30 +02:00
Philip Rebohle
1e7a05c796
[d3d11] Remove GetData do-not-flush workaround for Fallout 4
...
Not needed anymore due to the implicit flush.
2018-06-08 13:13:42 +02:00
Philip Rebohle
d4cb5115e7
[d3d11] Flush implicitly when GetData returns S_FALSE
...
Keeps the GPU busy when spinning on a query and ensures that we're
flushing at some point. Replaces the Fallout 4 hang workaround.
2018-06-08 13:11:24 +02:00
Philip Rebohle
a2df1ea4c9
[d3d11] Added warning that UAV rendering might not work as expected
...
We still haven't implemented synchronization for UAV rendering properly.
2018-06-08 12:42:09 +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
68a7ad81e1
[d3d11] Enable 64-bit math feature
...
We still have DMovc to implement, but it doesn't look like this
instruction is required as of now.
2018-06-07 15:35:24 +02:00
Philip Rebohle
e8ac81fe8a
[dxvk] Removed support for depth bounds test
...
This feature is not used in D3D11, so we don't need backend support.
2018-06-06 13:11:09 +02:00
Philip Rebohle
6579b2ad99
Merge branch 'auto-flush-v2'
2018-06-05 18:46:46 +02:00
Philip Rebohle
4a0c81276f
[d3d11] Implement new auto-flush heuristic
2018-06-04 23:31:49 +02:00
ZeroFault
d44cc7630b
Allow FarCry 5 to use D3D11_MAP_FLAG_DO_NOT_WAIT ( #416 )
2018-06-03 22:33:08 +02:00
Philip Rebohle
fc8573891e
[d3d11] Fix vertex attribute offset with D3D11_APPEND_ALIGNED_ELEMENT
...
Computes the correct offset even if some vertex attributes are not used
by the vertex shader. Fixes a crash in Sleeping Dogs: Definitive Edition
(#407 ).
2018-05-30 13:33:48 +02:00
Philip Rebohle
c600b43d73
[d3d11] Allocate DYNAMIC buffers on device-local host-visible memory
...
Improves performance on AMD cards when GPU-bound.
~5% FPS increase in The Witcher 3.
2018-05-29 14:50:08 +02:00
Philip Rebohle
8cd97959f2
[d3d11] Chjeck whether input layouts are identical
...
Prevents redundant state changes when a game switches between
identical input layouts. Reduces the the number of Vulkan
calls in Grim Dawn by ~30%.
2018-05-27 01:10:49 +02:00
Philip Rebohle
48037a8b87
[d3d11] Enable shaderStorageImageMultisample if the device supports it
2018-05-26 20:34:40 +02:00
Philip Rebohle
b78130defd
[d3d11] Overwatch: Fake success in CreateGeometryShaderWithStreamOutput
2018-05-25 23:53:34 +02:00
Philip Rebohle
84a62f795f
Merge branch 'meta-mipgen'
2018-05-25 17:46:41 +02:00
Philip Rebohle
4b37590e14
[dxvk] Use new mip map generator
2018-05-25 17:45:41 +02:00
Philip Rebohle
49bda46a37
[d3d11] Validate and correct scissor rects
...
Fixes Vulkan validation errors in Frostpunk and more closely
emulates Windows behaviour.
2018-05-25 00:08:28 +02:00
Philip Rebohle
58e9280891
[dxbc] Remove Tex2D -> Tex2DArray workaround
2018-05-24 11:49:12 +02:00
Philip Rebohle
d1b705bf0d
[dxgi] Implemented IDXGISwapChain1
2018-05-23 01:06:34 +02:00
Philip Rebohle
a39b9cb131
[d3d11] Pre-clear buffers with D3D11_USAGE_DEFAULT
...
Some games may expect buffers, like images, to be pre-initialized.
2018-05-22 21:10:39 +02:00
Philip Rebohle
51104c104d
[d3d11] Refactor InitTexture method
2018-05-22 21:06:26 +02:00
Philip Rebohle
425a5bca2e
[d3d11] Optimized buffer mapping on deferred contexts
2018-05-22 00:11:32 +02:00
Philip Rebohle
26b319b29b
[d3d11] Fallout 4: Force Flush on GetData calls
2018-05-14 02:40:59 +02:00
Philip Rebohle
c17f4e2fc0
[dxvk] Increase update buffer size
...
Helps reduce the number of memory allocations further
when deferred contexts are used for rendering.
2018-05-13 14:45:50 +02:00
Philip Rebohle
9d4654f445
[dxvk] Fix update buffer allocation size
2018-05-13 11:12:54 +02:00
Philip Rebohle
b6d33e6289
[d3d11] D3D11SamplerState: Cosmetic changes
2018-05-09 11:55:05 +02:00
Philip Rebohle
cd92d0b992
[dxvk] Allow binding render targets of different sizes
...
In order to not cause Vulkan validation issues, we have
to reduce the framebuffer size. Fixes a regression in
Bioshock Infinite.
2018-05-07 20:46:20 +02:00
Philip Rebohle
3e111086b2
[d3d11] Implement D3D11CoreCreateDevice
...
Some applications need this function to be present and it's better to
fail for them with an error code rather than crash because the entry
point does not exist in our DLLs.
2018-05-07 14:06:52 +02:00
Philip Rebohle
fb3dbd8bcd
[d3d11] Relaxed view format compatibility check
...
Fixes regressions in multiple games. MSDN docs regarding
format compatibility are wrong in every way.
2018-05-05 20:16:01 +02:00
Philip Rebohle
f4a92a685f
[d3d11] Normalize render target and depth-stencil view types
...
Fixes a regression in Kingdom Come: Deliverance that was
introduced in a55bee9554
.
2018-05-05 15:53:49 +02:00
Philip Rebohle
5a639797d2
[d3d11] Fix stencil component mapping in shader resource views
...
Fixes terrain rendering in Far Cry 5.
2018-05-05 15:15:09 +02:00
Philip Rebohle
8177898151
[d3d11] Validate image view format compatibility
...
Fixes Vulkan validation errors in Far Cry 5.
2018-05-05 15:13:35 +02:00
Philip Rebohle
e1a27faa4a
[dxgi] Added DXGI format family info
2018-05-05 12:57:22 +02:00
Philip Rebohle
a55bee9554
[d3d11] Validate render targets before setting them up
...
Mimicks what native D3D11 does. Fixes validation errors in
Nier:Automata with multisampling enabled in some situations.
2018-05-05 09:12:36 +02:00
Philip Rebohle
fb288d8713
[d3d11] Disable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT for typed formats
...
Yields over 10% performance improvement on RADV in GPU-bound scenarios.
2018-05-05 00:49:43 +02:00
Philip Rebohle
c2c8d8be8a
[d3d11] Minor formatting fix
2018-05-04 21:52:34 +02:00
Philip Rebohle
9cec1ecca3
[d3d11] Fix stage and access mask for default constant buffers
2018-05-04 10:23:36 +02:00
Philip Rebohle
59d4f1a1fb
[util] Add method to retrieve SHA1 hashes in 32-bit chunks
2018-05-03 23:47:42 +02:00
Philip Rebohle
e30a8299e6
[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass
2018-05-02 00:45:10 +02:00
Philip Rebohle
41fca78d27
[dxgi] Add GetDevice method to IDXGIVkInteropSurface
...
Convenient way of getting the IDXGIVkInteropDevice from the surface
without having to go through several D3D interface queries.
2018-05-01 23:30:39 +02:00
Philip Rebohle
2626a26072
[d3d11] Fix sampler state validation for anisotropy
...
Fixes an issue where samplers are not created in Path of Exile.
2018-04-30 19:36:42 +02:00
Philip Rebohle
ba53cf92ac
Revert "[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass"
...
This reverts commit 1bbfe77013
.
Breaks Path of Exile.
2018-04-30 18:47:35 +02:00
Philip Rebohle
16a25db846
Merge branch 'master' of https://github.com/doitsujin/dxvk
2018-04-30 15:56:32 +02:00
Philip Rebohle
1bbfe77013
[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass
2018-04-30 15:47:29 +02:00
ZeroFault
768a078250
[d3d11] Implement state block normalization ( #333 )
...
* [d3d11] implement stateblock normalization
* add const to default state description object
* fix code formatting
* Correct the blend state normalization
* add missing error return
* code cleanup and refactoring
* remove unecessary const qualifier and fix code formatting
* [d3d11] Cosmetic changes
2018-04-30 10:41:57 +02:00
Philip Rebohle
d5041337f5
[d3d11] Use linar tiling for textures if optimal tiling is not supported
...
Fixes texture creation issues in various Batman games.
2018-04-29 14:43:24 +02:00
Philip Rebohle
7cb7e4a944
Merge branch 'master' of https://github.com/doitsujin/dxvk
2018-04-28 14:18:18 +02:00
Philip Rebohle
99813a7778
[d3d11] Use const ref pointer for device parameter
...
Closes #323 .
2018-04-28 14:17:52 +02:00
pchome
4a74cd45d5
[clang-tidy] performance-move-const-arg fix ( #324 )
...
https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html
2018-04-28 14:13:23 +02:00
pchome
78e8621d09
[clang-tidy] performance-for-range-copy fix ( #322 )
...
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2018-04-28 01:14:57 +02:00
Philip Rebohle
1784b8c44d
[d3d11] Merge interop API
2018-04-26 22:20:09 +02:00
Philip Rebohle
01147492d5
[dxbc] Implemented Texture2D -> Texture2DArray mapping as a knob
...
Doing this for all applications is not necessary and degrades
performance in some cases.
2018-04-23 00:46:27 +02:00
Philip Rebohle
e53cb72e39
[dxbc] Make DxbcOptions a set of flags
...
This allows for game-specific workarounds and driver-specific
workarounds to be applied in an easier fashion.
2018-04-22 23:49:41 +02:00
Philip Rebohle
cfcca11fc5
[d3d11] CopySubresourceRegion: Fix block size alignment check
...
The source region size doesn't have to be aligned to the destination
block size. We should be checking whether the destination region is
aligned to the destination block size.
2018-04-22 23:00:31 +02:00
Philip Rebohle
4a71da3a1c
[d3d11] Improved debug output for CopySubresourceRegion
2018-04-22 22:35:10 +02:00
Philip Rebohle
2f20a61342
[dxbc] Map 2D MS shader resource views to 2D MS Array views
...
Works around a game bug in Dragon Age: Inquisition, which binds
an MS image to a non-MS resource slot. Closes
2018-04-22 18:27:01 +02:00
Philip Rebohle
f71f527b4d
[d3d11] Prevent mapping of depth-stencil textures
...
We currently don't support this, and copying data back and forth
with the wrong image aspect set crashes the RADV driver.
2018-04-21 20:34:41 +02:00
Philip Rebohle
dcb5b2a20c
[dxbc] Map 1D and 2D textures to their respective array type v2
...
We need to adjust the texture coordinate vectors as well, so that
some instructions continue to work properly.
2018-04-21 18:09:43 +02:00
Philip Rebohle
0318cc730a
Revert "[dxbc] Map 1D and 2D textures to their respective array type"
...
Broken. Requires some prep work in the shader compiler.
2018-04-21 15:38:39 +02:00
Philip Rebohle
906355b0da
[dxbc] Map 1D and 2D textures to their respective array type
...
As with cube textures, some games think it's a good idea to bind a
non-array view to a slot that expects an array view or vice versa.
Fixes clouds not appearing in TrackMania 2 Stadium (#191 ).
2018-04-21 14:15:10 +02:00
Philip Rebohle
0558a3b2c5
[d3d11] Fix incorrect cube face count calculation
2018-04-21 14:14:42 +02:00
ZeroFault
52f0d853c0
[d3d11] add some resource validation for copying resources ( #305 )
...
* [d3d11] add some resource validation for CopyResource and CopyResourceSubregion
combine if statement
* [d3d11] added copy extents validation for compressed formats
* correct return values
* fix incorrect logic operators
* set valid copy extents when possible
* [d3d11] Clamp copy region in CopySubresourceRegion
* [dxvk] Add helper methods to deal with block-compressed images
* [d3d11] Clean up validation in CopySubresourceRegion
* [d3d11] Improve error reporting and validation in CopyResource
* [d3d11] Fix inconsistent error messages
2018-04-20 23:35:29 +02:00
Philip Rebohle
1ed1c43431
[d3d11] Wire up D3D11VkInteropSurface to D3D11Texture*D classes
2018-04-20 11:12:54 +02:00
Philip Rebohle
81a0fa4805
[d3d11] Implemented IDXGIVkInteropSurface for common textures
2018-04-20 10:38:39 +02:00
Joshua Ashton
90e7fe6791
Make hashes use correct types and fix narrowing warnings in spirv module. ( #307 )
...
* Fix narrowing warnings in spirv_module relating to enum's default width on x64
* Make hashes of states use correct types without casting.
* Fix narrowing conversion in d3d11_sampler.cpp
2018-04-20 01:10:58 +02:00
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
98b8d41016
[dxbc] Write shader name to the generated SPIR-V
...
Might help identifying shaders in debugging tools such as Renderdoc.
2018-04-15 21:00:08 +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
87d14fb57f
[d3d11] Report TYPED_UAV only if both TBs and SIs are supported
2018-04-14 23:20:35 +02:00
Philip Rebohle
f07f610b6a
[d3d11] Improve format support queries
...
- Do not report MIP_AUTOGEN if the image format cannot
be used as a color attachment
- Do not report SAMPLE_COMPARISON and GATHER_COMPARISON
if the DXGI format has no corresponding depth format
- Only report image-related features if the image format
can actually be used as a sampled image
2018-04-14 16:07:01 +02:00
Philip Rebohle
a6767ebd52
[d3d11] Improved debug output of D3D11DeviceContext methods
2018-04-14 11:45:31 +02:00
Philip Rebohle
4a0c9dbaba
[d3d11] Validate texture sample count
...
Fixes incorrect return values in case a game tries to create
a texture with an unsupported number of samples.
2018-04-13 13:46:45 +02:00
Philip Rebohle
8508994a63
[d3d11] Cap mip level count for textures and views
...
Some games do not compute the number of mip levels of
a texture or texture view correctly, so we should work
around this by capping it to the highest possible value.
2018-04-12 23:42:11 +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
bd5254f8d3
[d3d11] Fixed compiler errors
...
Why the hell did my GCC not complain about this earlier?
2018-04-08 22:26:35 +02:00
pchome
acaf6c9e87
[d3d11] Fix compilation with WINE headers ( #247 )
...
All this structures are defined in WINE headers but `D3D11_FORMAT_SUPPORT2`.
2018-04-07 14:02:57 +02:00
Philip Rebohle
00a452ed89
[d3d11] Implement DXBC shader module cache
...
If an application compiles the same shader multiple times, we should reuse
an already existing DxvkShaderModule instead of creating a new one. This
helps keep the number of DxvkGraphicsPipeline objects low in games such
as Rise of the Tomb Raider.
2018-04-06 17:54:02 +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
7de27d4fd8
[d3d11] Flush immediate context on command list execution
...
This optimization may help keep the GPU busy in case there's
a large number of draw calls pending at the time a command
list from a deferred context is submitted for execution.
2018-04-03 19:53:37 +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
77010d96e4
[dxgi/d3d11] Set returned pointers to nullptr before returning
...
May solve issues with applications which check whether the returned
pointer is null rather than checking a function's return value.
2018-04-02 12:04:20 +02:00
Vesim987
a2f05467c7
[d3d11] Force CreateRenderTargetView to return S_OK with D3D11_RESOURCE_DIMENSION_BUFFER ( #230 )
...
It makes Battlefield 3 and Battlefield 4 working.
2018-03-31 21:47:54 +02:00
Philip Rebohle
ae88f83b86
[d3d11] Introduce D3D11DeviceContainer
...
Refactored DxgiVkDevice, D3D11Device and D3D11Presenter
to behave more like aggregable objects, where the new
D3D11DeviceContainer class is the COM aggregate object.
Fixes the reference counting issue outlined in #210 .
2018-03-28 21:24:52 +02:00
Philip Rebohle
8d3dcba8d5
[dxgi] Renamed private DXGI interfaces
2018-03-28 19:06:00 +02:00
Philip Rebohle
410cde3f17
[dxgi] Move device creation to DxgiAdapter
...
This is better than exporting new functions.
2018-03-28 18:58:53 +02:00
Philip Rebohle
1a8567a363
[d3d11] Fixed silly bug in blend state comparison
2018-03-28 11:55:03 +02:00
Philip Rebohle
675b1c5b8c
[d3d11] Implemented image mapping on deferred contexts
...
Also refactored buffer mapping to reduce code duplication.
Optimized the lookup function for a small performance gain
in games which map a lot of resources on deferred contexts.
2018-03-25 13:24:03 +02:00
Philip Rebohle
61c55d6f89
[d3d11] Get rid of redundant format query
2018-03-25 08:38:31 +02:00
Philip Rebohle
4e84a77896
[d3d11] Disable DO_NOT_WAIT flag by default
...
Apparently this breaks Elder Scrolls Online as well, so we'll
just enable it explicitly for games which benefit from this
optimization and disable it by default.
2018-03-25 00:54:42 +01:00
Philip Rebohle
4ed007e9f6
[d3d11] Add <unordered_map> include
...
Fixes #201 .
2018-03-24 18:54:00 +01:00
Philip Rebohle
0900e1b5f9
[d3d11] Added missing files
2018-03-24 17:29:13 +01:00
Philip Rebohle
bd69e843c2
[d3d11] Added D3D11Options
...
Includes a per-app knob for Witcher 3 to disable D3D11_MAP_FLAG_DO_NOT_WAIT.
2018-03-24 17:02:24 +01:00
Philip Rebohle
ba9e1f307d
[dxbc] Don't use rvalue references for file streams
2018-03-23 18:17:16 +01:00
Philip Rebohle
0a2fa590f5
[d3d11] Reset busy flag after emitting the Flush command
...
Fixes a general performance regression in games
that call WaitForResources a lot.
2018-03-23 11:54:19 +01:00
Philip Rebohle
085fd6a959
[d3d11] Remove unnecessary Map() check
2018-03-22 19:28:00 +01:00
Philip Rebohle
d9b1995cf0
[d3d11] Do not forward D3D11_MAP_FLAG_DO_NOT_WAIT for mapped images
...
Workaround for a regression in The Witcher 3 that was introduced
in commit 53d557c2db
. May have a
significant negative impact on performance in some games.
2018-03-22 14:12:43 +01: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
7f6c8dff95
[d3d11] Fix flush condition and CS thread synchronization
...
If chunks have been sent to the CS thread, we need to
flush even if the current chunk is empty.
2018-03-22 12:58:26 +01:00
Philip Rebohle
53d557c2db
[d3d11] Implement D3D11_MAP_FLAG_DO_NOT_WAIT
...
Improves framerate in Dishonored 2 by up to 50%.
2018-03-22 11:02:14 +01:00
Philip Rebohle
08806070ca
[d3d11] Fix CheckFeatureSupport return value
2018-03-21 15:08:34 +01:00
Philip Rebohle
efcd5c6b4d
[d3d11] Implement support for D3D11_FEATURE_FORMAT_SUPPORT2
2018-03-21 13:31:22 +01:00
Philip Rebohle
09151f3616
[d3d11] Lift shaderStorageImageReadWithoutFormat requirement
2018-03-21 12:57:29 +01:00
Philip Rebohle
c1a1ff3915
[d3d11] Implement remaining D3D11.1 feature queries
2018-03-21 04:58:31 +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
6550e8d623
[d3d11] Expose implemented Feature Level 11.1 features
2018-03-20 23:25:23 +01:00
Philip Rebohle
fd4e55007f
[d3d11] Export support for driver command lists
...
This indicates that our implementation of UpdateSubresource on
deferred contexts is not affected by the same issue as on Windows.
2018-03-19 17:57:20 +01:00
Philip Rebohle
493ad66d91
[d3d11] Remove obsolete acquire/release pair
...
This is no longer needed with the universally
thread-safe slice allocator.
2018-03-19 17:56:26 +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
pchome
2f8ccfa30e
[build] Add header required for std::find_if()
2018-03-19 12:49:48 +02:00
Philip Rebohle
f1c3b59e87
[d3d11] Implemented buffer mapping on deferred contexts
...
Allows the MultiThreadedRendering demo from the Microsoft SDK to run.
2018-03-19 03:19:13 +01:00
Philip Rebohle
d6d6ed4efd
[d3d11] Expose Feature Level 11_1 if explicitly requested
...
Not enabled by default since some 11_1 functionality is not yet implemented.
2018-03-18 23:39:40 +01:00
Philip Rebohle
127fad89be
[d3d11] Refactored D3D11SamplerState creation
2018-03-18 23:35:40 +01:00
Philip Rebohle
b04e9b5f18
[d3d11] Refactored D3D11DepthStencilState creation
2018-03-18 23:32:01 +01:00
Philip Rebohle
11d8eb3be4
[d3d11] Implemented D3D11BlendState1
2018-03-18 23:27:29 +01:00
Philip Rebohle
2591bbdabd
[d3d11] Implemented ID3D11RasterizerState1 stub
2018-03-18 22:53:20 +01:00
Philip Rebohle
0a473b4f86
[d3d11] Return error if an application creates an RTV for a buffer
...
Vulkan does not support buffer RTVs, and neither does DXVK, so we
should return an error in that case. Previously, DXVK would crash
upon querying image information.
2018-03-18 21:38:48 +01:00
Philip Rebohle
e009e63aa7
[d3d11] Fix sampler state refcount issue
...
We cannot use strong references in state objects that
are stored inside a member of the device itself.
2018-03-18 14:57:14 +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
Philip Rebohle
a8eecfbfe5
[d3d11] Enable direct image mapping by default
2018-03-18 00:36:53 +01:00
Philip Rebohle
ebd46e4109
[d3d11] Re-define D3D11_FEATURE_DATA_ARCHITECTURE_INFO
...
Fixes previous commit on MinGW.
2018-03-17 21:38:35 +01:00
Mikhail Paulyshka
043982d3be
[d3d11] stub implementation of ID3D11Device1 ( #175 )
2018-03-17 20:11:00 +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
ccfe1a346b
[d3d11] Moved GetViewFromDesc and NormalizeDesc out of D3D11Devuce
2018-03-17 13:42:37 +01:00
Philip Rebohle
0ddbb58ce4
[d3d11] Enable IDXGIDevice2 interface query
2018-03-17 13:05:55 +01:00
Philip Rebohle
eb8ae5cc82
[d3d11] Allow 2D array view creation for 3D textures
...
Fixes a regression that was introduced with the texture
class refactor. Fixes validation issues in Hellblade.
2018-03-14 20:40:11 +01:00
Philip Rebohle
0e0ee61d9b
[d3d11] Always use VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
...
We need to investigate why not doing this breaks shadows in Heaven.
2018-03-14 17:40:26 +01:00
Philip Rebohle
3b20c71894
[d3d11] Re-implement direct image mapping (disabled by default)
...
We cannot enable this by default yet because it may break some games.
2018-03-14 16:40:28 +01:00
Philip Rebohle
155bd32e22
[d3d11] Check if a textue can be created before making the attempt
...
This may prevent driver crashes and give more useful debugging info
in case a given combination of image parameters is not supported by
a device. May also improve compatibility with direct image mapping.
2018-03-14 16:03:48 +01:00
Philip Rebohle
7a6d61d943
[d3d11] Create mapped image buffer only when needed
...
Also adds some documentation to D3D11CommonTexture.
2018-03-14 14:49:45 +01:00
Philip Rebohle
0ba3337289
[d3d11] Refactored Map/Unmap methods
2018-03-14 14:40:09 +01:00
Philip Rebohle
91b82c05b2
[d3d11] Refactoring texture classes: Move static methods into D3D11CommonTexture
2018-03-14 01:16:31 +01:00
Philip Rebohle
56df0bcccb
[d3d11] Refactoring texture classes: Remove D3D11TextureInfo
2018-03-14 00:45:07 +01:00
Philip Rebohle
16d66c8a1d
[d3d11] Refactoring texture classes: Introduce D3D11CommonTexture
2018-03-13 23:51:30 +01:00