Commit Graph

495 Commits

Author SHA1 Message Date
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