1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 13:24:20 +01:00
Commit Graph

3097 Commits

Author SHA1 Message Date
Philip Rebohle
4d0cc3e24e
[d3d11] Don't subclass state objects from ComObject
These override reference counting, so we shouldn't use ComObject.
2019-10-14 01:44:37 +02:00
Philip Rebohle
c5c43fb2a4
[d3d11] Allow choosing type wrapper for D3D11DeviceChild base class
Allows subclasses to replace ComObject with something else.
2019-10-14 01:44:27 +02:00
Philip Rebohle
dd9a55ecc0
[util] Don't allow multiple inheritance for COM objects
This never made any sense whatsoever in the first place.
2019-10-14 01:42:24 +02:00
Philip Rebohle
c281e76bac
[d3d11] Don't get private references for state objects
Otherwise we will end up deleting the objects even though they
aren't explicitly heap-allocated. Whoops...
2019-10-14 01:39:54 +02:00
Philip Rebohle
9c6209fbf5
[d3d11] Fix reference counting for state objects
Fixes various wine test failures. Also, state objects are now
allocated in the hash map itself rather than a wrapped COM object.
2019-10-14 01:27:59 +02:00
Philip Rebohle
accbc8828c
[d3d11] Return error if no desc is provided for Create*State methods
Fixes wine test failures.
2019-10-14 01:08:31 +02:00
Philip Rebohle
bd58f1a913
[d3d11] Don't sync CS thread if resource to map is already in use
SynchronizeCsThread can only update the in-use state from available
to in-use, so doing this on a resource that is already in-use is not
necessary. May improve performance in combination with DO_NOT_WAIT.
2019-10-14 00:14:00 +02:00
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
dbe8b09b05
[dxvk] Don't store sampler description in sampler objects
We aren't using this anywhere in the backend or client APIs.
2019-10-13 04:36:33 +02:00
Philip Rebohle
b67e5809ba
[dxvk] Fix buffer usage flags in commitGraphicsBarriers
Only checking for one single usage flag is incorrect since
buffers can have both the storage buffer and storage texel
buffer usage bits set.
2019-10-13 03:18:08 +02:00
Philip Rebohle
950ea21b83
[dxvk] Don't rely on binding mask in commitGraphicsBarriers
We can't actually use that here since we check barriers before
updating shader resources, unlike on the compute path. Check
all resources manually instead.
2019-10-13 02:19:48 +02:00
Philip Rebohle
0e578adcf5
[dxvk] Don't clear binding masks in update*Pipeline
Has no effect anymore since the entire mask gets
overridden in updateShaderResources anyway.
2019-10-13 02:18:09 +02:00
Philip Rebohle
b25ab4155b
[dxvk] Remove outdated comment 2019-10-13 02:01:14 +02:00
Philip Rebohle
0a5b427ded
[dxvk] Add function to insert framebuffer read-back barriers
Required for some D3D9 content.
2019-10-13 02:00:10 +02:00
Philip Rebohle
41cb5ab5f7
[dxvk] Add dependency flag parameter to emitMemoryBarrier
Will be needed for framebuffer-local barriers inside render passes.
2019-10-13 01:51:29 +02:00
Philip Rebohle
8446c28de1
[dxvk] Remove spill parameter from bindRenderTargets
No longer needed.
2019-10-13 01:44:31 +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
4360021539
[dxvk] Implement accurate barrier tracking for draws with side effects
Similar to how this is handled for compute shaders, with some caveats:
- The barriers are never actually emitted, only tracked. Spilling the
  render pass will reset the barriers as it acts as a full barrier.
- Doing this for all draws and all resources would be prohibitively
  expensive, so whenever switching between pipelines with side effects
  and pipelines without side effects, we'll spill the render pass.
2019-10-13 01:44:28 +02:00
Philip Rebohle
baf81473a6
[dxvk] Introduce HasStorageDescriptors to signify pipeline side effects 2019-10-13 01:43:18 +02:00
Philip Rebohle
c5676d3108
[dxvk] Remove incorrect framebuffer-space barriers
We're technically required to use VK_DEPENDENCY_BY_REGION_BIT,
but that isn't actually good enough.
2019-10-12 23:54:54 +02:00
Philip Rebohle
803ec3542d
[dxbc] Fix sample positions
From the D3D11.3 functional specification:
"The sample position is relative to the pixel's center"

Fixes wine test failures.
2019-10-11 18:41:10 +02:00
Philip Rebohle
3a39027987
[d3d11] Add more rigid validation for buffer creation
Fixes several wine test failures.
2019-10-11 17:32:46 +02:00
Philip Rebohle
762df0bedf
[d3d11] Change ValidateBufferProperties to NormalizeBufferProperties 2019-10-11 17:23:02 +02:00
Philip Rebohle
409991b9db
[d3d10] Fix reported bind flags for D3D10 resources
Turns out that the UAV bind flag remains set in the D3D10 description,
even though D3D10 does not support the feature. Fixes wine test failures.
2019-10-11 17:15:33 +02:00
Philip Rebohle
127e037627
[d3d11] Validate texture array size
Fixes a wine test failure and possibly prevents invalid Vulkan API usage.
2019-10-11 17:11:01 +02:00
Philip Rebohle
554b77b47a
[d3d11] Initialize feature level to zero in D3D11CreateDevice
Fixes a wine test failure.
2019-10-11 17:01:23 +02:00
Philip Rebohle
d8c3002b92
[dxvk] Don't use dynamic storage buffers
Doesn't really help in pracrice, but getting rid of them reduces
the number of dynamic offsets we have to update per draw/dispatch.
2019-10-11 14:33:45 +02:00
Philip Rebohle
0068740341
[dxvk] Optimize invalidateBuffer for use with uniform buffers
Since this is by far the most common use case for this
method, an early-out path helps save a bit of CPU time.

Ditch dynamic descriptor set offsets for storage buffers
at the same time since it does not seem to benefit any
real-world applications.
2019-10-11 14:16:47 +02:00
Philip Rebohle
bd5630439e
[dxvk] Inline freeBufferSlice implementation
May save a cycle or two in invalidateBuffer.
2019-10-11 13:06:55 +02:00
Philip Rebohle
594f04d4ed
[dxvk] Dirty framebuffer in beginRecording
This guarantees that the framebuffer is never null.
2019-10-11 12:19:45 +02:00
Philip Rebohle
48b3b3ee85
[dxvk] Use float format for sampled unbound image views
Fixes validation errors in many cases if a texture is not bound.
2019-10-11 02:58:39 +02:00
Philip Rebohle
e615416b31
[dxvk] Fix tessellation validation
Prevents crashes in case an app tries to use tessellation with
an incorrect primitive topology.
2019-10-11 00:04:06 +02:00
Philip Rebohle
2c974cbe1e
[dxvk] Validate graphics state in commitGraphicsState
Same idea as for the related compute work.
2019-10-10 23:56:54 +02:00
Philip Rebohle
649c8d10d6
[dxvk] Validate compute state in commitComputePipelines
This way we can implement early-out for invalid dispatch calls
and save a few validation checks later in the pipeline.
2019-10-10 23:56:54 +02:00
Philip Rebohle
63cc8cdd35
[dxvk] Move descriptor set updates to updateShaderResources
Saves two state flags and allows us to move the descriptor info
array into the function itself.
2019-10-10 22:48:06 +02:00
Philip Rebohle
7df3b409c3
[dxvk] Move dynamic descriptor offset array to stack
There's absolutely no reason to store it in the object.
2019-10-10 22:19:31 +02:00
Philip Rebohle
a743ba6531
[dxvk] Use memcmp replacement for pipeline state lookup
Measured to be over twice as fast as memcmp on Ryzen for the
512-byte graphics pipeline state struct, achieving two cycles
per iteration.
2019-10-07 22:01:48 +02:00
Philip Rebohle
5cb7be2454
[dxvk] Implement state cache v6 -> v7 conversion 2019-10-07 22:01:48 +02:00
Philip Rebohle
345e263a3b
[dxvk] Increase maximum spec constant count to 12
Fills some padding created by the 32-byte alignment.
2019-10-07 22:01:48 +02:00
Philip Rebohle
782b021690
[dxvk] Move compute pipeline state to dxvk_graphics_state.h 2019-10-07 22:01:48 +02:00
Philip Rebohle
e086db5ce5
[dxvk] Use new struct for specialization constant info
Stylistic reasons.
2019-10-07 22:01:47 +02:00
Philip Rebohle
b2087b2e7e
[dxvk] Use packed blend state 2019-10-07 22:01:47 +02:00
Philip Rebohle
079b480602
[dxvk] Use packed depth-stencil state 2019-10-07 22:01:47 +02:00
Philip Rebohle
a933bec72c
[dxvk] Use packed multisample state 2019-10-07 22:01:47 +02:00
Philip Rebohle
09c813c934
[dxvk] Use packed rasterizer state 2019-10-07 22:01:47 +02:00
Philip Rebohle
a5ab88d8f2
[dxvk] Use packed input layout state
Also move attribute and binding descriptions to the end
so that comparisons are more likely to fail early.
2019-10-07 22:01:47 +02:00
Philip Rebohle
c0ae4e38eb
[dxvk] Use packed input assembly state 2019-10-07 22:01:47 +02:00
Philip Rebohle
8d09aa12da
[dxvk] Move DxvkGraphicsPipelineStateInfo to new file
We're going to put a lot of code here, so try to keep things clean.
2019-10-07 22:01:47 +02:00
Philip Rebohle
9dad44a6b1
[dxvk] Prepare for pipeline state changes and bump cache format to v7
One of the changes includes hard-coding certain constants into the old
pipeline state structs, since changing the constants would invalidate
any old state cache and making the conversion pointless.
2019-10-07 22:01:47 +02:00
Philip Rebohle
32dff89b2d
[dxvk] Don't use alignas(16) for DxvkMetaClearArgs members
Instead, pad members explicitly. This is necessary because GCC
makes incorrect assumptions about stack alignment on 32-bit.
2019-10-07 22:01:47 +02:00
Joshua Ashton
ca634ec484 [dxvk] Add missing {} to border color list
Fixes a warning when compiling with Clang
2019-10-06 00:28:19 +02:00
Joshua Ashton
e8ee7a0790 [util] Fix Sha1 dword extraction
Previously we were getting incorrect values here.

The u suffix is no longer necessary, which was originally there to work around a MSVC compiler warning which now doesn't happen under the new code 🤷‍♀
2019-10-06 00:28:19 +02:00
Joshua Ashton
19fa1c405c [d3d10] Remove unused copies of device ptr in D3D10 wrappers
Silences a warning when building with Clang, and removes duplicate unused data.
2019-10-06 00:28:19 +02:00
Joshua Ashton
6d0757520b [dxgi] Initialize size of DEVMODEW structure
The documentation says we should do this.
2019-10-06 00:28:19 +02:00
Philip Rebohle
1117daec24 [dxvk] Don't redundantly clear unused vertex strides to zero
We're already doing this when setting the input layout, and we
don't touch the strides in other parts of the code. May save
a handful of CPU cycles.
2019-10-05 16:52:26 +02:00
Philip Rebohle
70ef456911
[meta] Release 1.4.2 2019-10-04 21:07:36 +02:00
Philip Rebohle
02b79fb738
[util] Report Nvidia GPUs for Modern Warfare Remastered 2019-10-04 18:35:36 +02:00
Philip Rebohle
50349d1bfe
[d3d11] Add missing break; in CreateSurface
Found by a frog. Initial testing did not check return values.
2019-10-02 12:06:51 +02:00
Philip Rebohle
85581bdace
[util] Move GetAdapterLUID out of DXGI internals 2019-10-02 08:42:22 +02:00
Philip Rebohle
8f00af556e
[d3d11] Implement CreateSurface for D3D11DXGIDevice
Documentation for this method is really poor so we'll just try to
make pretty much everything work. Fixes various wine tests.
2019-10-02 02:29:06 +02:00
Philip Rebohle
1366fce0f8
[dxgi] Generate adapter LUIDs if Vulkan does not provide them
Needed because winevulkan does not provide adapter LUIDs.
Fixes various wine test failures, and will be required to
get D3D12 (vkd3d) to work on top of our DXGI implementation.
2019-10-02 01:07:18 +02:00
Philip Rebohle
73b9846c4f
[dxgi] Fix some IDXGIAdapter return codes
Fixes various wine test failures.
2019-10-02 00:33:06 +02:00
Philip Rebohle
d90d450618
[dxgi] Handle invalid arguments passed to Present1
fixes a wine test failure.
2019-10-02 00:19:41 +02:00
Philip Rebohle
f58c1c2d1d
[dxgi] Fix SetFullscreenState behaviour with invalid usage
Fixes various wine test failures.
2019-10-02 00:01:26 +02:00
Philip Rebohle
60ff2b8977
[dxgi] Fix GetContainingOutput and GetFullscreenState output pointer
We're supposed to keep a reference to the output around and return
that for fullscreen swap chains. Fixes various wine test failures.
2019-10-02 00:00:37 +02:00
Philip Rebohle
8d8f4b9200
[d3d11] Add support for DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
Trivial since we treat back buffers as regular D3D textures.
Fixes a wine test failure.
2019-10-01 23:37:54 +02:00
Philip Rebohle
aa35cdbb18
[d3d11] Fix return code on swap chain creation failure
Fixes a wine test failure.
2019-10-01 23:37:54 +02:00
Philip Rebohle
0f15c60192
[d3d11] Use private reference to D3D11 device in D3D11SwapChain
Fixes a wine test failure.
2019-10-01 22:26:07 +02:00
Philip Rebohle
0436e6ddce
[dxgi] Fix some return codes in DxgiSwapChain
Fixes some wine test failures.
2019-10-01 22:25:37 +02:00
Philip Rebohle
0d1048fa87
[d3d11] Fix error handling in SetMaximumFrameLatency
Fixes a wine test failure.
2019-10-01 22:12:23 +02:00
Philip Rebohle
2cb9d34f8f
[dxgi] Fix QueryVideoMemoryInfo return values
Fixes a wine test failure.
2019-10-01 22:12:19 +02:00
Philip Rebohle
1e00f8046c
[dxgi] Fix CheckInterfaceSupport UMD version writeback
Fixes a wine test failure.
2019-10-01 22:12:16 +02:00
Philip Rebohle
cd82669a85
[dxgi] Fix GetDisplayModeList1 output for DXGI_FORMAT_UNKNOWN
Fixes a wine test failure.
2019-10-01 22:12:09 +02:00
Philip Rebohle
f5515075f2
[dxgi] Fix GetDisplayModeList behaviour with a zero mode count
Allocate at least one array element so that we don't accidentally
treat the mode list like it was NULL. Fixes a wine test failure.
2019-10-01 22:12:08 +02:00
Philip Rebohle
2f4e4abcac
[dxgi] Fix CheckInterfaceSupport for IDXGIDevice
On Windows, this succeeds and reports the D3D9 driver version to the
application.
2019-10-01 15:06:50 +02:00
Philip Rebohle
ab51aac6d7 [dxvk] Implement context-local lookup cache for pipeline objects
On hit, looking up a pipeline becomes an extremly cheap O(1) operation,
avoiding a mutex lock and an expensive std::unordered_map lookup. This
works because we don't ever destroy pipeline objects.
2019-09-30 03:42:20 +02:00
Philip Rebohle
35a8cedbc2 [dxvk] Move shader set hash/eq functions into respective structs
Makes it easier to use them outside the pipeline manager.
2019-09-30 03:42:20 +02:00
Philip Rebohle
ba5f319809 [dxvk] Use new shader lookup hash in pipeline manager 2019-09-30 02:09:09 +02:00
Philip Rebohle
5115a42b08 [dxvk] Expose key-based lookup hash in DxvkShader 2019-09-30 02:08:09 +02:00
Philip Rebohle
54ff7bf769 [dxvk] Add methods to retrieve shaders from pipeline 2019-09-30 01:54:49 +02:00
Philip Rebohle
59d4e8a36a [dxbc] Fix NaN handling in not-equal comparison
Ne and Dne are unordered in DXBC. Avoid FUnordNotEqual to
avoid potential issues with drivers and debugging tools.
2019-09-30 00:19:47 +02:00
Philip Rebohle
d128d776ad
[dxvk] Re-introduce state check for updateFramebuffer
Turns out we broke batching render target clears earlier.
2019-09-28 03:29:52 +02:00
Philip Rebohle
6b5d01c934
[meta] Release 1.4.1 2019-09-27 23:03:23 +02:00
Philip Rebohle
2e6da26ff0
[dxvk] Spoof Nvidia GPU for HITMAN 2
This game requires a functioning AGS implementation when it detects
an AMD GPU and complains about missing D3D11 support otherwise.
2019-09-26 19:27:19 +02:00
Philip Rebohle
a920a7275b
[dxvk] Eliminate some redundant state checks 2019-09-26 14:25:56 +02:00
Philip Rebohle
7cdc402a58
[dxvk] Introduce finalizeDraw
May improve code gen by reducing function call overhead, in a
similar way as the duplicated checks in commitGraphicsState do.
2019-09-26 01:31:51 +02:00
Philip Rebohle
187748e4d3
[d3d11] Add a comment explaining ID3D11Predicate/ID3D11Query hack 2019-09-25 22:18:08 +02:00
Philip Rebohle
53fe3423e2
[d3d11] Fix GetPredication 2019-09-25 20:55:43 +02:00
Philip Rebohle
b6cf518962
Revert "[dxbc] Always decorate SV_POSITION as invariant"
This reverts commit 5ee790a4a3.

Breaks Shadow of the Tomb Raider on Nvidia for unknown reasons.
2019-09-24 23:01:36 +02:00
Philip Rebohle
5ee790a4a3
[dxbc] Always decorate SV_POSITION as invariant
Apparently fixes Z-Fighting in Saints Row IV on Nvidia.
2019-09-24 22:19:43 +02:00
Philip Rebohle
51f1d7725c
[dxvk] Store context flags as a 32-bit integer
Might improve code generation for 32-bit builds. We currently
have 31 flags and don't expect any new ones to be added.
2019-09-23 23:34:04 +02:00
Philip Rebohle
8f6df2b7fb
[d3d10] Add some null pointer checks when dealing with resources
Also, fix some more awkward formatting.
2019-09-23 21:59:02 +02:00
Philip Rebohle
cb60211ce0
[d3d10] Fix some awkward formatting 2019-09-23 21:47:30 +02:00
Philip Rebohle
f498e742ec
[d3d11] Handle D3D_PRIMITIVE_TOPOLOGY_UNDEFINED correctly
Luckily, all known cases where games use UNDEFINED topology fail
validation elsewhere due to missing vertex shaders, but we should
handle this correctly anyway.
2019-09-23 15:20:53 +02:00
Philip Rebohle
e8055f81df
[dxvk] Validate primitive topology in pipeline state 2019-09-23 15:19:46 +02:00
Philip Rebohle
f38cfd592e
[dbxc] Actually fix callc implementation
Yeah maybe we should close our blocks properly. There seems to be
no way to generate a callc instruction with fxc so this is untested.
2019-09-22 22:36:42 +02:00
Philip Rebohle
94ce76da6b
[dxbc] Implement label, call and callc instructions
Fixes #1200.
2019-09-22 22:28:58 +02:00
Philip Rebohle
1fa8887c47
[d3d11] Return device lost errors in Present if necessary 2019-09-22 19:20:53 +02:00
Philip Rebohle
11b7b1f1a5
[d3d11] Implement GetDeviceRemovedReason 2019-09-22 19:07:48 +02:00
Philip Rebohle
2e9a836adb
[dxvk] Handle device lost errors on command submission 2019-09-22 19:06:53 +02:00
Philip Rebohle
92d1cf8ae0
[d3d11] Fix CheckFeatureSupport formatting and return code 2019-09-22 15:01:49 +02:00
Entryhazard
252d71e55e Retrieve the function pointer once (#1198) 2019-09-22 10:11:17 +02:00
Philip Rebohle
f37d4b58b6
[dxvk] Explicitly compare resource use count to zero
Fixes MSVC compiler warnings.
2019-09-21 19:04:23 +02:00
Philip Rebohle
21b2a9a078
[meta] Release 1.4 2019-09-21 16:15:37 +02:00
Philip Rebohle
a74eceaf46
[dxvk] Bump state cache version to v6 2019-09-21 14:11:51 +02:00
Philip Rebohle
e253183bc2
[dxvk] Apply spec constants to compute shaders as well 2019-09-21 14:11:51 +02:00
Philip Rebohle
e926ceb9cc
[dxvk] Only time pipeline compile times if requested
Avoids some unnecessary calls to high_resolution_clock::now().
2019-09-21 13:10:09 +02:00
Philip Rebohle
6ecb74d2c0
[dxvk] Check if xfb buffers have actually changed on binding
We should avoid redundant render pass spilling at all costs.
This affects all games using deferred contexts for rendering
due to their implicit use of ClearState and RestoreState.
2019-09-21 05:13:05 +02:00
Philip Rebohle
1347aeba33
[dxvk] Use separate counters for read/write resource usage
It is not unrealistic at all to overflow the 18-bit and 14-bit
counters in modern games, so just use two 32-bit counters instead.
Avoid 64-bit atomics due to poor performance on 32-bit builts.
2019-09-21 02:45:23 +02:00
Philip Rebohle
71e74f1810
[d3d11] Disable DO_NOT_WAIT for Overwatch
Because of course this game breaks for some people with it enabled.
2019-09-21 01:44:38 +02:00
Philip Rebohle
7514aa1ec8
[d3d11] Implement IDXGIDevice4 2019-09-20 18:06:34 +02:00
Philip Rebohle
32410a4f2b
[dxgi] Implement IDXGISwapChain4 2019-09-20 18:06:34 +02:00
Philip Rebohle
5cb7f26bb7
[dxgi] Implement IDXGIOutput5 2019-09-20 18:06:34 +02:00
Philip Rebohle
3e8a6ec463
[dxgi] Implement IDXGIFactory5 2019-09-20 18:06:34 +02:00
Philip Rebohle
9ed980a962
[dxgi] Include DXGI 1.5 headers 2019-09-20 18:06:34 +02:00
marcin mikołajczak
9941769237 [util] Update comment for FIFA 19+ workaround (#1197) 2019-09-20 16:20:26 +02:00
Philip Rebohle
7e7609cac0
Revert "[d3d11] Don't create linearly tiled compressed images"
This reverts commit b8888ffe6a.

This is no longer beneficial since initialization of a
linear image does not stall Map anymore.
2019-09-20 05:59:54 +02:00
Philip Rebohle
e82c87dc52
[d3d11] Implement GetDC / ReleaseDC 2019-09-20 01:44:18 +02:00
Philip Rebohle
028633138a
[d3d11] Implement GDI surface 2019-09-20 01:44:18 +02:00
Joshua Ashton
014870b1ff
[util] Add helpers for GDI/DDI interop 2019-09-20 01:44:18 +02:00
Philip Rebohle
c9a0f06ff4
[d3d11] Enable allowMapFlagNoWait by default
We still keep the option around so that in case of regressions,
users can check if disabling this option fixes their issue.
2019-09-20 01:44:02 +02:00
Philip Rebohle
e9fcf64a8c
[dxvk] Only wait for writes when mapping with D3D11_MAP_READ 2019-09-20 01:44:02 +02:00
Philip Rebohle
5b5927dd41
[dxvk] Implement read-write tracking for resources 2019-09-20 01:44:01 +02:00
Philip Rebohle
63183141bc
[dxvk] Implement read/write tracking in lifetime tracker
This way we will be able to more accurately determine how a
resource is going to be used by the GPU, and we can also cut
unnecessary atomic operations for non-resource objects.
2019-09-20 01:44:01 +02:00
Philip Rebohle
136ad3e4c9
[d3d11] Write to image memory directly in InitHostVisibleTexture
Avoids performing a potentially expensive copy or clear operation
on the GPU.
2019-09-20 01:44:01 +02:00
Philip Rebohle
ae4a5232aa
[d3d11] Use VK_IMAGE_LAYOUT_PREINITIALIZED for mapped images
This way we can directly write image data directly to the image
without having to do it on the GPU.
2019-09-20 01:44:01 +02:00
Philip Rebohle
eb0a492f51
[dxvk] Add initial layout to initImage
Allows us to initialize an image from the PREINITIALIZED layout.
2019-09-20 01:44:01 +02:00
Philip Rebohle
4570b34456
[dxvk] Add initial layout to image create info 2019-09-20 01:44:01 +02:00
Philip Rebohle
51c6eb5cdb
[util] Enable FIFA 19 workaround for FIFA 20 as well
Same procedure as every year.
2019-09-20 00:50:01 +02:00
Philip Rebohle
48417c7d19
[d3d11] Implement DiscardView1
Basically just behave like DiscardView if no rects are passed to
the function, otherwise ignore the call since we can't discard
individual rectangles in any meaningful way.
2019-09-19 13:56:50 +02:00
Philip Rebohle
0338b70596
[dxgi] Implement IDXGIVkInteropAdapter for IDXGIAdapter 2019-09-18 14:53:44 +02:00
Philip Rebohle
9af8387e4e
[dxgi] Define IDXGIVkInteropAdapter interface
Can be used to pull the Vulkan instance and physical device from
a DXGI adapter.
2019-09-18 14:53:44 +02:00
Philip Rebohle
9e02b6b433
[dxgi] Rename IDXGIVkAdapter -> IDXGIDXVKAdapter
This interface exposes DXVK internals and cannot be used for
Vulkan interop. We shouldn't pretend like it could.
2019-09-18 14:07:13 +02:00
Philip Rebohle
bc853d0e48
[d3d11] Only use mapped buffer for images if bind flags are non-zero
We really shouldn't use the intermediate buffer for DYNAMIC images
that can only ever be used for copy commands, since the copies will
be redundant.
2019-09-18 13:15:22 +02:00
Philip Rebohle
65428da3fe
[util] Enable allowMapFlagNoWait for Warhammer II 2019-09-18 13:14:53 +02:00
Philip Rebohle
abf89356cd
[d3d11] Report unified memory if all heaps are device-local
Together with mapping default resources, this may or may not
help performance in some applications on integrated graphics.
2019-09-17 23:52:02 +02:00
Philip Rebohle
518d06b9c2
[d3d11] Enable D3D11.3 MapOnDefaultTextures feature 2019-09-17 23:39:06 +02:00
Philip Rebohle
c59ab258a5
[d3d11] Implement ReadFromSubresource and WriteToSubresource 2019-09-17 23:39:06 +02:00
Philip Rebohle
e764f05a1a
[d3d11] Allow pMappedResource to be null when mapping images
This is required to implement mapping default textures correctly.
2019-09-17 23:39:06 +02:00
Philip Rebohle
6ce8450b12
[d3d11] Implement D3D11.2 MapOnDefaultBuffers feature
Basically just allocates the buffer on a host-visible memory
type, like DYNAMIC or STAGING buffers depending depending on
the CPU access flags.
2019-09-17 17:47:33 +02:00
Philip Rebohle
2cdbe2e6df
[d3d11] Move GetMemoryFlagsForUsage into D3D11Buffer
D3D11Buffer is the only user of this function and the code sharing
potential is limited. This allows us to implement the memory type
selection for buffers in one single place rather than two.
2019-09-17 17:21:10 +02:00
Philip Rebohle
dda89a075e
[d3d11] Report MapOnDefaultTextures feature as unsupported
Bad things can happen if we leave this undefined.
2019-09-17 14:21:19 +02:00
Joshua Ashton
ebc394218a [dxvk] Replicate R component of border color for depth compare samplers (#1194)
Only the red component matters for these samplers -- this lets us pick the best colour based on that alone, as we could get garbage data that doesn't matter in the other components.
2019-09-17 11:15:09 +02:00
Philip Rebohle
2ef34a055d
[d3d11] Implement ID3D11Device5 2019-09-16 16:37:37 +02:00
Philip Rebohle
56daf44d4c
[d3d11] Implement ID3D11Device4 2019-09-16 16:26:18 +02:00
Philip Rebohle
3ba541fde6
[d3d11] Implement D3D11.4 feature queries 2019-09-16 16:22:52 +02:00
Philip Rebohle
6ab6b4a209
[d3d11] Include D3D11.4 headers 2019-09-16 16:14:47 +02:00
Philip Rebohle
fdf560150f
[d3d11] Implement ID3D11Device3 2019-09-16 16:13:34 +02:00
Philip Rebohle
b0f6655b92
[d3d11] Implement ID3D11Query1 2019-09-16 16:13:34 +02:00
Philip Rebohle
84c80a4aaf
[d3d11] Implement ID3D11UnorderedAccessView1 2019-09-16 16:13:34 +02:00
Philip Rebohle
81935e1684
[d3d11] Implement ID3D11ShaderResourceView1 2019-09-16 14:27:44 +02:00
Philip Rebohle
345f8694e8
[d3d11] Implement ID3D11RenderTargetView1 2019-09-16 14:27:44 +02:00
Philip Rebohle
0758f14a35
[d3d11] Implement ID3D11Texture2D1 and ID3D11Texture3D1 2019-09-16 14:27:44 +02:00
Philip Rebohle
d9f409b92f
[d3d11] Implement ID3D11RasterizerState2 2019-09-16 13:41: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
17a6c4168e
[dxbc] Implement stencil ref export from fragment shaders
This is an optional feature in D3D11.3, but easy enough to support.
2019-09-16 12:42:15 +02:00
Philip Rebohle
b7bc51c3bd
[d3d11] Use shaderStorageImageReadWithoutFormat for typed UAV loads 2019-09-16 12:42:15 +02:00
Philip Rebohle
7fae4a41e8
[d3d11] Add definitions for feature levels 12_0 and 12_1
Mostly useful for debugging as we're not going to support these
feature levels for now.
2019-09-16 12:42:14 +02:00
Philip Rebohle
51ff65fbc5
[d3d11] Implement D3D11.3 feature queries 2019-09-16 12:42:14 +02:00
Philip Rebohle
aad44458f7
[d3d11] Include D3D11.3 headers 2019-09-16 12:42:14 +02:00
Philip Rebohle
26afaba410
[dxbc] Implement MSAD4 instruction
Apparently we're required to support this for Direct3D 11.2+.
There are currently no known games that require this instruction.
2019-09-16 12:42:14 +02:00
Philip Rebohle
72a356fe01
[d3d11] Implement GetResourceTiling
When called on a regular resource, native D3D11 will zero
out the return values. We should match this behaviour.
2019-09-16 12:42:14 +02:00
Philip Rebohle
7ba7178d14
[d3d11] Implement ID3D11Device2
Adds some extra validation to resource creation so that
apps cannot accidentally create tiled resources.
2019-09-16 12:42:14 +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
6e28ab956d
[d3d11] Implement D3D11.2 feature queries 2019-09-16 12:42:14 +02:00
Philip Rebohle
d7476f3fb8
[d3d11] Include D3D11.2 headers 2019-09-16 12:42:14 +02:00
Philip Rebohle
f2d461ab5b
[d3d11] Prevent log spam from repeated Get/SetResourceMinLOD calls 2019-09-16 12:41:44 +02:00
Philip Rebohle
3e17ccfaaa
[d3d11] Implement missing D3D11_FEATURE_D3D9_OPTIONS feature query 2019-09-16 02:21:46 +02:00
Philip Rebohle
c852b6de34
[d3d11] Optimize viewport updates if there is only one single viewport 2019-09-13 14:38:51 +02:00
Philip Rebohle
160b684d5a
[d3d11] Add range check for scissors and make failing it unlikely 2019-09-13 11:49:00 +02:00
Philip Rebohle
e2808309a3
[metæ] Release 1.3.4 2019-09-08 21:03:46 +02:00
Philip Rebohle
f57c021ab5
[util] Enable d3d11.allowMapFlagNoWait for Control 2019-09-08 10:35:57 +02:00
Philip Rebohle
b8888ffe6a
[d3d11] Don't create linearly tiled compressed images
Quantum Break uses this for texture uploads, which causes unnecessary
GPU synchronization and queue submissions when doing texture uploads.
2019-09-07 20:16:16 +02:00
orbea
c57e63f7d2 Work around build failure with winegcc/clang. (#1184)
Fixes #1182.
2019-09-05 18:01:33 +02:00
Philip Rebohle
b0552751ad
[d3d11] Fix incorrect AddRef -> Release
Spotted by @jp7677
2019-08-29 21:24:47 +02:00
Philip Rebohle
2776ef43a3
[meta] Release 1.3.3 2019-08-29 20:56:47 +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
a36f056572
[d3d11] Resolve pipeline hazards when binding compute shader UAVs 2019-08-29 19:10:53 +02:00
Philip Rebohle
c8c781c88b
[d3d11] Add check whether a viewed resource has a given bind flag 2019-08-29 19:10:50 +02:00
Philip Rebohle
afc8e4c29d
[d3d11] Filter redundant OMSetRenderTargets calls
Since rebinding render targets is a rather expensive
operation, we should avoid doing so whenever possible.

Affects Resident Evil 2 and Devil May Cry 5.
2019-08-26 23:59:08 +02:00
Philip Rebohle
4789790087
[d3d11] Remove outdated comment
We actually handle this properly now.
2019-08-26 23:43:47 +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
137589d755
[d3d11] Add state to track potentially hazardous bound SRVs 2019-08-26 23:29:01 +02:00
Philip Rebohle
4064dd3737
[d3d11] Add bound compute shader UAV mask
Will be used for efficient hazard tracking.
2019-08-26 23:29:01 +02:00
Philip Rebohle
8208cedfa9
[d3d11] Add common view info struct to all view types
Will be used for hazard detection.
2019-08-26 23:29:01 +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
08e3500beb
[d3d11] Don't use .at() 2019-08-26 23:29:01 +02:00
Philip Rebohle
473025a93b
[dxvk] Add function to find set bits in binding mask 2019-08-26 23:29:01 +02:00
Philip Rebohle
d2d19b0dec
[dxvk] Add function to set bind mask bit to a given value 2019-08-26 23:29:00 +02:00
Jacek Caban
1981140257 [dxvk] Explicitly include unordered_map in dxvk_renderpass.h
When using libstdc++, it's somehow implicitly included, but it's not the case for libc++.
2019-08-26 20:07:58 +02:00
Joshua Ashton
8e54477c2a [util] Use R string literals for app compat regexes 2019-08-24 21:32:51 +02:00
Philip Rebohle
54ca5900e1 [util] Use regular expressions on full exe path to match app profiles
This allows us to detect applications with non-unique executable names
or with variable executable names more reliably, and also allows us to
merge profiles for games that have multiple known exe names.

The matching is also no longer case-sensitive.
2019-08-18 17:49:22 +02:00
Philip Rebohle
c934333a5c [util] Add method to retrieve full exe path 2019-08-17 11:50:39 +02:00
Philip Rebohle
d38607c9be
[dxvk] Implement depth-stencil resolve 2019-08-13 15:16:09 +02:00
Philip Rebohle
e54dfab471
[dxvk] Support depth-stencil resolve using VK_KHR_depth_stencil_resolve 2019-08-13 15:16:09 +02:00
Philip Rebohle
7e95493fba
[dxvk] Support shader-based depth-stencil resolve
Requires VK_EXT_shader_stencil_export for stencil resolves.
2019-08-13 15:16:00 +02:00
Philip Rebohle
a516ca5b85
[dxvk] Add meta shaders for depth-stencil resolve 2019-08-13 14:37:50 +02:00
Philip Rebohle
acf0001fd1
[dxvk] Make device properties accessible from the device 2019-08-13 14:37:50 +02:00
Philip Rebohle
2f15cb7602
[dxvk] Enable VK_KHR_depth_stencil_resolve if available 2019-08-13 12:53:31 +02:00
Philip Rebohle
d127c08487
[dxvk] Enable VK_KHR_create_renderpass2 if available 2019-08-13 12:52:54 +02:00
Philip Rebohle
1999ca9dd4
[util] Set d3d11.dcSingleUseMode=False for SteamVR perf test
*Actually* fixes #1160.
2019-08-10 11:21:47 +02:00
Philip Rebohle
4cce07ccd9
[d3d11] Update resources mapped on deferred contexts in Map()
Apparently it is legal to use mapped buffers on deferred contexts
in D3D11, so we have to execute our update code immediately.

Fixes #1160.
2019-08-10 11:11:44 +02:00
Joshua Ashton
d579f07238 [util] Fix compiling with clang/clang-cl 2019-08-07 06:08:54 +02:00
Philip Rebohle
590834660e
Revert "[dxvk] Use vkCmdUpdateBuffer to clear tiny buffers"
This reverts commit 311661e404.

This once fixed Far Cry Primal, but now for some reason it
breaks Far Cry Primal. Fixes #1155.
2019-08-07 05:41:33 +02:00
Philip Rebohle
bd40b05720
[d3d11] Recreate swap chain immediately after synchronous present fails
Fully restores pre-1.3 behaviour in case async present is disabled.
Apparently this is necessary to avoid hangs on Nvidia for some reason.
2019-08-06 09:11:04 +02:00
Philip Rebohle
9fdd7bf789
[meta] Release 1.3.2 2019-08-05 20:38:22 +02:00
Philip Rebohle
bc0537df37 [d3d11] Remove d3d11.asyncPresent option 2019-08-04 21:49:55 +02:00
Philip Rebohle
a558f82b5f [dxvk] Implement asynchronous presentation option in the backend 2019-08-04 21:49:55 +02:00
Philip Rebohle
77fde83479 [dxvk] Move some code to where it makes more sense 2019-08-04 21:37:26 +02:00
Philip Rebohle
6b2f4f93cc [d3d11] Fix incorrect tracking of mapped image subresources
When returnig DXGI_ERROR_WAS_STILL_DRAWING, we should not mark
the subresource as mapped, and instead ignore subsequent calls
to Unmap.
2019-08-03 19:11:19 +02:00
Philip Rebohle
140a2c1017 Revert "[d3d11] Return error when mapping an already mapped image"
This reverts commit 1cc531eaf8.

Even though an FFXIV apitrace clearly indicates that mapping an
already mapped subresource returns E_OUTOFMEMORY in that game,
this doesn't always seem to be correct behaviour.

Fixes #1148, #1149.
2019-08-03 19:08:22 +02:00
Philip Rebohle
02d92210ad
[dxvk] Avoid redundant descriptor set updates when binding buffers (v2)
We need to check not just the buffer object but also the length of the
bound buffer range, since this information will be written into the
descriptor and cannot be changed via dynamic offsets.

Fixes: f501ebc ('[dxvk] Avoid redundant descriptor set updates when binding buffers')
2019-08-01 21:30:27 +02:00
Philip Rebohle
af15d85baa
[dxvk] Add config option to enable the HUD 2019-08-01 12:37:55 +02:00
Philip Rebohle
4fd41f8550
[dxvk] Don't allow common objects to be reference-counted 2019-07-30 20:06:59 +02:00
Philip Rebohle
65c1e58bd9
[dxvk] Use DxvkObjects to create and pass around common objects 2019-07-30 20:00:38 +02:00
Philip Rebohle
35679d2ba7
[dxvk] Add class that bundles objects shared between device and context
Uses lazy initialization for various meta objects.
2019-07-30 20:00:38 +02:00
Philip Rebohle
cfd7033e40
[dxvk] Pass DxvkDevice to DxvkRenderPassPool constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle
e12103121f
[dxvk] Pass DxvkDevice to DxvkEventPool constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle
40028a5b8c
[dxvk] Pass DxvkDevice to DxvkMetaClearObjects constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle
6a58c432ec
[dxvk] Pass DxvkDevice to DxvkMetaPackObjects constructor 2019-07-30 20:00:38 +02:00
Philip Rebohle
9a2da555c0
[util] Add helper for lazy initialization
a
2019-07-30 20:00:35 +02:00
Philip Rebohle
23379b6b9c
[dxvk] Check render pass before pipeline state during pipeline lookup
Checking one pointer is a bit cheaper than comparing a 1600 byte struct.
2019-07-30 16:19:16 +02:00
Philip Rebohle
a7666aad82
[dxvk] Refactor the way render passes to pipeline compiler methods 2019-07-30 13:17:56 +02:00
Philip Rebohle
13bc3df92f
[dxvk] Refactor render pass objects to not use reference counting
Like pipeline objects, we keep these around anyway so there's no
reason to add ref count overhead. Also use a hash map to perform
the lookup.
2019-07-30 13:13:02 +02:00
Philip Rebohle
d01b6baf38
[dxvk] Introduce compilePipeline method to Dxvk*Pipeline classes
Decouples the act of synchronously retrieving a handle
from asynchronously compiling the pipeline.
2019-07-30 12:14:52 +02:00
Philip Rebohle
3dc33c64a9
[dxvk] Introduce DxvkComputePipelineInstance
Same as the graphics pipeline equivalent.
2019-07-30 11:07:07 +02:00
Philip Rebohle
20b0cbdfb6
[dxvk] Rename compilePipeline -> createPipeline
More in line with Vulkan naming.
2019-07-30 11:06:25 +02:00
Philip Rebohle
6ab074c95b
[dxbc] Only use atomic append/consume optimization in compute shaders
- For fragment shaders, this isn't safe since ballots include helper invocations
- For vertex shaders, if drivers don't support subgroup operations in those
  stages, we don't want it to affect the performance of compute shadres.
2019-07-26 14:07:39 +02:00
Philip Rebohle
dfe2922136
[dxvk] Fix partial clears for mismatched framebuffer attachment sizes
Fixes an issue in Borderlands: The Pre-Sequel, which binds a 512x512
color attachment and a full-screen depth buffer at the same time and
then attempts to clear the depth buffer.
2019-07-24 23:46:02 +02:00
Philip Rebohle
9c5102e257
[dxvk] Don't duplicate geometry shader system value outputs
Fixes #1121. The basic idea here is that all built-ins that can be
written by the GS will be consumed as built-ins by the FS anyway,
so we do not need to keep the o# variable around.
2019-07-24 18:18:20 +02:00
Philip Rebohle
eaa41eb76c
[dxvk] Don't use reference counting for pipeline objects
Again not necessary since these objects are persistent.
Eliminates refcount overhead of pipeline lookups entirely.
2019-07-23 13:15:06 +02:00
Philip Rebohle
8cd13cc5bd
[dxvk] Use shader key structs directly for pipeline lookups
Removes some overhead and unnecessary ref count changes on shaders.
2019-07-23 13:00:04 +02:00
Philip Rebohle
8d4996bcda
[dxvk] Use shader key structs to store shaders in DxvkPipeline objects
Mostly a code cleanup to make constructing these objects a bit easier.
2019-07-23 12:48:11 +02:00
Philip Rebohle
604e89b97a
[dxvk] Rename Dxvk*PipelineKey -> Dxvk*PipelineShaders 2019-07-23 12:41:09 +02:00
Philip Rebohle
70294aac44
[dxvk] Disable resource tracking for DxvkPipeline objects
This isn't necessary at all since these objects are persistent.
2019-07-23 12:34:48 +02:00
Philip Rebohle
00cf2a20a3
[d3d11] Don't allow the creation of buffers with a size of zero 2019-07-21 20:47:42 +02:00
Philip Rebohle
f5cec978c8
[meta] Release 1.3.1 2019-07-20 20:33:19 +02:00
Philip Rebohle
c89bec5abd
[dxvk] Don't log submission errors on presentation
Makes no sense and only leads to confusion.
2019-07-20 20:25:18 +02:00
Philip Rebohle
3f4c9a3bb5
[hud] Add GPU load monitor 2019-07-18 23:23:36 +02:00
Philip Rebohle
5bb20cceb6
[dxvk] Add GPU idle time to stat counters 2019-07-18 23:23:12 +02:00
Philip Rebohle
3d86ecd94d
[dxvk] Estimate GPU idle time based on cleanup thread activity
We'll assume that GPU idle time == time spent waiting for new
command lists to be added to the queue of the cleanup thread.
This isn't entirely accurate, especially if CPU load is very
high, but should be good enough.
2019-07-18 22:54:11 +02:00
Philip Rebohle
02d917c680
[dxvk] Fix meta copy operation for mipmapped images 2019-07-18 19:52:24 +02:00
Philip Rebohle
fb9ea958a1
[dxvk] Fix meta copy operation for 1D images 2019-07-18 19:50:57 +02:00
Philip Rebohle
2905ba82d2
[dxvk] Remove old meta vertex and geometry shaders 2019-07-18 18:59:11 +02:00
Philip Rebohle
8889d6402e
[dxvk] Use new fullscreen shaders for mip gen operations 2019-07-18 18:57:18 +02:00
Philip Rebohle
e91efb6dc2
[dxvk] Use new fullscreen shaders for meta resolve operations 2019-07-18 18:57:17 +02:00
Philip Rebohle
792f15680a
[dxvk] Use new fullscreen shaders for meta copy operations 2019-07-18 18:57:17 +02:00
Philip Rebohle
07408bcdcc
[dxvk] Add new vertex and geometry shaders for fullscreen passes
These new shaders are aimed to be used by all meta operations
and will work without geometry shaders on supported hardware.
2019-07-18 18:57:15 +02:00
Philip Rebohle
92d6f26130
[d3d11] Always enable depth-stencil attachment usage for depth-stencil images
Allows us to use framebuffer copies even if the game itself does not
intend to render to the image.

Improves performance in Final Fantasy XIV on RADV.
2019-07-18 17:26:02 +02:00
Philip Rebohle
8a9cee903b
[dxvk] Use render pass copy for depth-stencil images if beneficial 2019-07-18 17:26:02 +02:00
Philip Rebohle
a08f9d0897
[dxvk] Implement device- and driver-specific performance hints
These are meant to be read by the DxvkContext in order to choose
a fast path for certasin operations.
2019-07-18 17:25:56 +02:00
Philip Rebohle
e611dff45e
[dxvk] Support depth-stencil meta-copy operations 2019-07-18 17:25:56 +02:00
Philip Rebohle
0dd8cba199
[dxvk] Support depth-stencil formats for meta copy objects 2019-07-18 17:25:50 +02:00
Philip Rebohle
89516e2da2
[dxvk] Add meta copy shaders for depth-stencil formats 2019-07-18 17:25:48 +02:00
Philip Rebohle
677e33b9c9
[dxvk] Enable VK_EXT_shader_stencil_export if available 2019-07-18 17:25:48 +02:00
Philip Rebohle
f0fb25c082
[dxvk] Log more device info on device creation
This should tell us whether extension features are actually used.
2019-07-18 13:37:14 +02:00
Philip Rebohle
f3943934a7
[util] Improve multi-line logging 2019-07-18 13:34:52 +02:00
Philip Rebohle
f16ba4794b
[d3d11] Use unlikely() for some query code
This is a somewhat hot path in some games, so why not.
2019-07-17 20:35:00 +02:00
Philip Rebohle
c4b56b9d8d
[d3d11] Use private temporary references for queries
Like the previous commit, just with queries.
2019-07-17 20:16:19 +02:00
Philip Rebohle
7225674088
[d3d11] Use private temporary references for state objects
We really shouldn't be altering the application-visible ref
count when sending these objects to the CS thread.
2019-07-17 20:01:57 +02:00
Philip Rebohle
21a2ce045f
[util] Add convenience method to return public/private references 2019-07-17 19:59:50 +02:00
Philip Rebohle
af8e1a3d47
[d3d11] Simplify ApplyPrimitiveTopology code 2019-07-17 15:54:59 +02:00
Philip Rebohle
3f30fbd098
[d3d11] Simplify BindIndexBuffer code 2019-07-17 14:41:00 +02:00
Philip Rebohle
63fe899bdc
[dxvk] Don't check if bindings have changed in the backend
The state tracker should perform these checks before sending commands
off to the backend anyway, so checking again in the backend is redundant.
2019-07-17 14:26:55 +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
11b7fc8914
[d3d11] Catch invalid ClearUnorderedAccessViewFloat calls
This method cannot be called on integer UAVs.
2019-07-17 11:47:42 +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
c6ea115ca3
[dxvk] Add method to retrieve buffer view format info 2019-07-17 11:47:42 +02:00
Philip Rebohle
c29314de5a
[dxvk] Change DxvkImageView::formatInfo to return view format info
Makes more sense and won't break any existing code using it.
2019-07-17 11:33:39 +02:00
Philip Rebohle
7895272806
[dxvk] Use correct command buffer for buffer updates
Fixes a regression in SpellForce 3.
2019-07-16 23:47:33 +02:00
Philip Rebohle
493b55b073
[dxvk] Compute memory chunk size per memory type rather than per heap 2019-07-16 09:59:44 +02:00
Philip Rebohle
6936da17d9
[dxvk] Try harder to allocate memory from a given memory type
Before failing, see if we can't allocate a smaller chunk size.
2019-07-16 09:59:44 +02:00
Philip Rebohle
18aada29ef
[dxvk] Don't put large resources into their own memory allocations
This approach currently has two issues:
- We might fail to allocate the resource on the desired memory type
  even if there is a chunk available that it would tif in
- With 128MB chunks, this no longer seems to be beneficial anyway
2019-07-16 09:24:55 +02:00
Philip Rebohle
ad8fdcac07
[dxvk] Don't mark queries as stalling if DONOTFLUSH is set 2019-07-16 01:19:02 +02:00
Philip Rebohle
acf6c27e76
[dxvk] Limit maximum size of multi-slice buffers
Reduces memory fragmentation caused by frequently renamed buffers.
2019-07-15 04:14:23 +02:00
Philip Rebohle
d8e31f221f
[dxvk] Fix offset in DxvkBuffer::subSlice 2019-07-15 04:06:12 +02:00
Philip Rebohle
f88658d88c
[dxvk] Template BindPoint parameter in some DxvkContext methods
Again, there's no reason not to do this since the argument is always
constant, and we can skip some work in the compute case.
2019-07-14 20:09:35 +02:00
Philip Rebohle
def05f007c
[dxvk] Template Index parameter of commitGraphicsState
This is always constant anyway, so avoid some unnecessary code.
2019-07-14 19:57:50 +02:00
Philip Rebohle
8dfdda7a39
[dxvk] Get rid of validateCompute/GraphicsState
After all this time we haven't found a single situation where
we need more validation, so scrap it. Checking whether there
is an active render pass was redundant anyway.
2019-07-14 19:34:56 +02:00
Philip Rebohle
a93dd74f71
[dxvk] Don't use derivative pipelines
No driver appears to be taking advantage of this, so why bother.
2019-07-14 13:58:00 +02:00
Philip Rebohle
03c6df56c1
[d3d11] Initialize subresourceLayers in the inner loop
Not doing so causes Dirt Rally to fail uploading some textures
properly for some extremely weird reason.
2019-07-13 23:39:58 +02:00
Philip Rebohle
7cb385facd
[meta] Release 1.3 2019-07-13 19:15:30 +02:00
Philip Rebohle
e116ff49e6
[dxvk] Rename memoryAvailable -> memoryBudget 2019-07-13 19:04:33 +02:00
Joshua Ashton
fac3ae9f83 [spirv] Implement opCross 2019-07-12 23:32:09 +02:00
Joshua Ashton
f280386aec [spirv] Implement opFMix 2019-07-12 23:32:09 +02:00
Philip Rebohle
8644d75722
[dxbc] Use OpDemoteToHelperInvocationEXT for discards if supported 2019-07-11 19:33:17 +02:00
Philip Rebohle
e901e1269d
[spirv] Add support for OpDemoteToHelperInvocationEXT 2019-07-11 19:33:17 +02:00
Philip Rebohle
7b34b8515b
[d3d11] Enable shaderDemoteToHelperInvocation feature 2019-07-11 19:33:17 +02:00
Philip Rebohle
b2a53a2413
[dxvk] Enable VK_EXT_shader_demote_to_helper_invocation if available 2019-07-11 19:33:17 +02:00
Liam Middlebrook
2e83aae472 [dxbc] Print shader signatures at debug loglevel 2019-07-11 12:40:44 +02:00
Liam Middlebrook
ff4fa29304 [dxbc] Add string output function for DxbcRegMask 2019-07-11 12:40:44 +02:00
Liam Middlebrook
2164a44887 [dxbc] Add ostream operator for DxbcScalarType 2019-07-11 12:40:44 +02:00
Philip Rebohle
06d4e06d8a
[dxbc] Enable early discard on RADV/ACO
Still can't enable on LLVM due to GPU hangs. The way we detect it
may have to change in the future, but for now, this should do.
2019-07-08 16:30:56 +02:00
Robin Kertels
47f7333c18
[d3d11] Fix RSGetViewports and RSGetScissorRects behaviour
Fixes #1116.
2019-07-08 13:14:42 +02:00
Philip Rebohle
24e1969dc4
[dxvk] Remove obsolete DxvkEvent class 2019-07-08 00:16:03 +02:00
Philip Rebohle
15072afa1f
[d3d11] Use new signals as frame synchronization events 2019-07-08 00:16:03 +02:00
Philip Rebohle
f0acc40e50
[dxvk] Add support for new signals to the backend 2019-07-08 00:16:03 +02:00
Philip Rebohle
4e8122eda9
[dxvk] Add new signal class 2019-07-08 00:16:00 +02:00
Philip Rebohle
c631953ab6
[d3d11] Don't immediately synchronize after present
This will actually enable asynchronous presentation.
Improves performance in Quake Champions.
2019-07-05 21:20:09 +02:00
Philip Rebohle
77db8158c8
[dxvk] Add option to toggle asynchronous presentation 2019-07-05 21:20:09 +02:00
Philip Rebohle
ed5c43a14d
[dxvk] Implement asynchronous presentation
Off-loads the vkQueuePresentKHR call to the queue submission thread
to avoid synchronization with that thread on a present call.
2019-07-05 15:11:59 +02:00
Philip Rebohle
0900f5d1bc
[dxvk] Fix typo 2019-07-05 15:09:15 +02:00
Philip Rebohle
1cc531eaf8
[d3d11] Return error when mapping an already mapped image
Final Fantasy XIV does this. Should avoid some unnecessary work.
2019-07-05 10:25:06 +02:00
Philip Rebohle
2f64f5b4e7
[dxvk] Check whether CS thread is busy before synchronizing with it
Reduces unnecessary locking overhead, which may be relevant if this
function gets called frequently by GetData or WaitForResource.
2019-07-04 21:37:17 +02:00
Philip Rebohle
f6dbf5bbf0
[dxvk] Increase staging buffer size to 32 MiB
Since the chunk size was also doubled to 128 MiB and we want
staging buffers to get their own allocations.
2019-07-04 20:39:27 +02:00
Philip Rebohle
3b1376b2fe
[dxvk] Increase memory chunk size to 128 MiB
Nvidia drivers apparently don't like smaller chunks very much.
May increase overall memory consumption and fragmentation.
2019-07-04 16:11:13 +02:00
Philip Rebohle
3b128179ab
[dxvk] Print VK_EXT_memory_budget stats on allocation failure
Based on PR #1112, but using a cleaner method to check
support for the VK_EXT_memory_budget extension.

Suggested-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2019-07-03 11:11:12 +02:00
Philip Rebohle
ac9610f377
[dxvk] Add VK_EXT_memory_budget as a passive extension 2019-07-03 11:02:13 +02:00
Philip Rebohle
f21c02caef
[dxvk] Add support for passive device extensions
These extensions only affect physical device functionality and
do not have to be enabled during device creation.
2019-07-03 10:59:48 +02:00
Philip Rebohle
cb806a5d56
[dxvk] Free memory if vkMapMemory fails
Otherwise, we leak the allocated memory chunk and make the
problem even worse than it already is.
2019-07-02 01:26:54 +02:00
Joshua Ashton
1dadba3cce [dxvk] Give null values to empty DxvkGraphicsPipelineInstances
Silences an MSVC warning.
2019-07-01 02:46:54 +02:00
Joshua Ashton
c381e8a29e [util] Add correct type suffixes to Sha1Hash dword function to silence compiler warning 2019-07-01 02:46:54 +02:00
Philip Rebohle
67122d9246
[d3d11] Enable initial image uploads over SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle
9d902418c0
[d3d11] Enable initial buffer uploads over SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle
d5c0a8c842
[dxvk] Upload HUD font texture via SDMA 2019-06-29 01:53:43 +02:00
Philip Rebohle
c7c90830c4
[dxvk] Implement image uploads on SDMA 2019-06-29 01:53:32 +02:00
Philip Rebohle
eb71c62b33
[dxvk] Implement buffer uploads on SDMA 2019-06-29 01:53:32 +02:00
Philip Rebohle
0a40e2c868
[dxvk] Support queue ownership transfer barriers 2019-06-29 01:53:32 +02:00
Philip Rebohle
f85b9088d4
[dxvk] Explicitly specify the command buffer for copy commands 2019-06-29 01:53:32 +02:00
Philip Rebohle
be24ca6099
[dxvk] Rename and add SDMA barrier sets 2019-06-29 01:53:32 +02:00
Philip Rebohle
4f3dcf2bc8
[dxvk] Add SDMA command buffer
This new command buffer will be submitted to the transfer queue,
if available, otherwise it will be the first buffer submitted
to the graphics queue.
2019-06-29 01:53:32 +02:00
Philip Rebohle
4e0de6bc20
[dxvk] Refactor queue submission 2019-06-29 01:53:32 +02:00
Philip Rebohle
545cd52020
[dxvk] Create transfer queue command pool if available 2019-06-29 01:53:32 +02:00
Philip Rebohle
d8163c4446
[dxvk] Don't pass queue handles to DxvkCommandList
Instead, pull them from the device as needed. This coupling would
only make sense if we required one command list per queue family.
2019-06-29 01:53:32 +02:00
Philip Rebohle
d2d11bf995
[dxvk] Add option to enable or disable the transfer queue 2019-06-29 01:53:32 +02:00
Philip Rebohle
191bba660b
[dxvk] Provide way to access queue properties from device 2019-06-29 01:53:32 +02:00
Philip Rebohle
1c39765b86
[dxvk] Rework queue family selection
This allows us to support multiple queues more easily.
2019-06-29 01:53:32 +02:00
Philip Rebohle
110fc8f833
[dxvk] Properly clear used command buffer flags
Fixes an issue where we would always submit the init buffer, even
if it is empty.
2019-06-29 01:53:29 +02:00
Philip Rebohle
770ec2c4db
[dxvk] Get rid of array in present vertex shader 2019-06-29 01:34:16 +02:00
Philip Rebohle
42e61020e4
[d3d11] Remove unused SetRenderTargets method 2019-06-27 15:54:42 +02:00
Philip Rebohle
2148619f3c
[d3d11] Spill render pass when restoring context state as needed 2019-06-27 15:54:42 +02:00
Philip Rebohle
a704e6d27e
[d3d11] Fix UAV binding in OMSetRenderTargets{,AndUnorderedAccessViews}
Unlike for compute shaders, we're supposed to replace all UAV bindings
when binding render targets. We also should spill the render pass when
disabling UAV rendering to avoid read-after-write hazards.

Fixes a potential synchronization bug encountered in Devil May Cry 5.
2019-06-27 15:54:42 +02:00
Joshua Ashton
194db57a4d [spirv] Expose MatrixStride decoration for members 2019-06-27 10:49:49 +02:00
Joshua Ashton
80808d743b [spirv] Add generic memberDecorate 2019-06-27 10:49:49 +02:00
Joshua Ashton
1b8c54eb84 [spirv] Expose opMatrixTimesMatrix, opMatrixTimesVector and opVectorTimesMatrix 2019-06-27 10:49:49 +02:00
Philip Rebohle
afe2b487a6
[dxvk] Avoid redundant vertex and index buffer tracking
Same optimization as for regular resources. Mostly reduces load
on the cleanup thread.
2019-06-27 01:51:15 +02:00
Philip Rebohle
c3ebf4658c
[dxvk] Reorder command list reset operations by importance 2019-06-27 00:02:43 +02:00
Philip Rebohle
7491c06389
[meta] Release 1.2.3 2019-06-26 17:33:57 +02:00
Philip Rebohle
5728d10587
[d3d11] Copy initial texture data to mapped buffer, if available
Otherwise, if an application maps the image right after creating it,
we might end up reading garbage data or overriding the image data.
2019-06-25 14:22:47 +02:00
Philip Rebohle
4d4db6c683
[dxvk] Use void pointers for packImageData
Makes this function a bit less annoying to use.
2019-06-25 14:17:03 +02:00
Philip Rebohle
3293bd21d1
[dxvk] Avoid updating binding mask on hot path in updateShaderResources
Assuming that everything is bound by default allows us to save a few
CPU cycles per descriptor to update as long as that assumption holds
true, while adding only a small constant cost for the update operation.
2019-06-23 23:43:25 +02:00
Philip Rebohle
b7769759f2
[dxvk] Implement comparison and setting multiple bits for DxvkBindingSet 2019-06-23 23:41:56 +02:00
Philip Rebohle
5e3336d79b
[dxvk] Clean up updateShaderResources a bit 2019-06-23 23:21:47 +02:00
Philip Rebohle
81e7a8d1f6
[dxvk] Avoid redundant resource tracking
Only tracks a shader resource if the resource bound to the slot
has actually changed, or if we began recording a new command
buffer. Reduces the number of atomic operations in some games.
2019-06-23 18:55:49 +02:00
Philip Rebohle
924ca9eaec
[dxvk] Add more generic version of DxvkBindingMask 2019-06-23 18:45:34 +02:00
Philip Rebohle
f58242c58d
[dxvk] Fix poor API design around defining resource slots 2019-06-23 15:49:29 +02:00
Andrew Eikum
326eb0bf80 [dxgi] Don't fail leaving fullscreen if window is already destroyed
Unreal Engine 4 games destroy the window, then call
SetFullscreenMode(FALSE). If this call fails, they pop up an error
dialog. Wine tests show that this call should succeed.
2019-06-21 17:27:34 +02:00
Philip Rebohle
62372f5d47
[dxvk] Release staging buffer memory for HUD context
We really don't want to waste 32MB of system RAM because of
one single texture update all the time.
2019-06-21 16:43:22 +02:00
Philip Rebohle
34cdba1df5
[dxvk] Add method to explicitly release staging buffer memory 2019-06-21 16:43:22 +02:00
Philip Rebohle
1c9bc235d0
[dxvk] Remove old staging buffer code 2019-06-21 16:43:22 +02:00
Philip Rebohle
8c1a56af89
[dxvk] Remove old staging buffer allocator from DxvkCommandList 2019-06-21 16:43:22 +02:00
Philip Rebohle
24c282378e
[dxvk] Use new staging buffer allocator in DxvkContext 2019-06-21 16:43:22 +02:00
Philip Rebohle
970deb452e
[dxvk] Implement new staging buffer allocator 2019-06-21 16:43:19 +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
138dde6c3d
[dxvk] Prefer VRAM allocation over dedicated sysmem allocation
May in some cases improve performance when under memory pressure:
If a dedicated allocation is preferred, but the alloaction fails,
try to allocate memory from an already allocated chunk instead
of falling back to system memory right away.
2019-06-20 10:34:54 +02:00
Joshua Ashton
a4a4f5a822 [util] Correct return value of SetThreadDescription 2019-06-19 19:43:36 +02:00
Philip Rebohle
0a35ae6fca
[dxvk] Log memory utilization per heap on memory allocation failures 2019-06-19 14:47:09 +02:00
Philip Rebohle
684355dfca
[d3d11] Fix GetData parameter validation
We're supposed to return an error if a null pointer is
passed along with a non-zero DataSize. Fixes more wine
test failures.
2019-06-16 19:24:44 +02:00
Philip Rebohle
43389d8ef4
[d3d11] Implement timestamp disjoint queries 2019-06-16 17:14:39 +02:00
Philip Rebohle
1c718402f8
[d3d11] Use an array for query and event objects
We're going to need multiple queries to implement certain query types.
2019-06-16 17:14:24 +02:00
Philip Rebohle
fd1b5c8eb9
[dxvk] Add method to permanently change image layout 2019-06-15 16:45:59 +02:00
Philip Rebohle
dc3e5e5949
[meta] Release 1.2.2 2019-06-15 12:58:31 +02:00
Philip Rebohle
58dcf77c08
[dxbc] Disable atomic counter optimization on old RADV versions
Breaks TressFX in Tomb Raider 2013 for some reason, whereas this works
fine on 19.1 with both LLVM 8.0 and 9.0-git.
2019-06-15 12:58:31 +02:00
Philip Rebohle
a715937db1
[dxvk] Always pass through fully enabled color write masks
May improve performance when rendering to RGB-only or Alpha-only
images, which seems to be especially common in D3D9.
2019-06-14 14:27:21 +02:00
Philip Rebohle
c8a429b9e1
[d3d11] Fix CheckMultisampleQualityLevels return code
We're supposed to return E_FAIL for unsupported sample counts,
and not zero-initialize the returned quality level count if the
format is invalid. Fixes wine test failures.
2019-06-14 13:37:01 +02:00
Philip Rebohle
5a66da8ef8
[dxvk] Fix various issues in GetFormatSupportFlags
- Support DXGI_FORMAT_UNKNOWN for buffer resources
- Report D3D11_FORMAT_SUPPORT_CPU_LOCKABLE for all supported formats
- Report support for linear-only image formats properly
- Return E_FAIL in case the format is not supported

Fixes a crash in Planet Coaster (#1091).
2019-06-13 16:32:41 +02:00
Joshua Ashton
9d2f31d231 [vulkan] Add operator overloads for VkOffset3D/2D 2019-06-13 04:45:16 +02:00
Philip Rebohle
1bc0b51262
[d3d11] Implement IDXGISurface2 for ID3D11Texture1D 2019-06-13 04:37:35 +02:00
Philip Rebohle
586d0de7bb
[d3d11] Fix default blend factor 2019-06-13 04:15:23 +02:00
Philip Rebohle
089d47e02e
[d3d11] Fix WSize computation for UAV creation 2019-06-13 04:01:15 +02:00
Philip Rebohle
f02a5a7453
[d3d11] Don't create SRVs and UAVs with a size of 0
This is illegal and triggers invalid Vulkan usage.
2019-06-13 03:47:10 +02:00
Philip Rebohle
4ffddd1e40
[d3d11] Skip GenerateMips if mip gen flag is not set on resource 2019-06-13 03:31:31 +02:00
Philip Rebohle
ce03384ba9
[d3d11] Validate bind flags for D3D11_RESOURCE_MISC_GENERATE_MIPS 2019-06-13 03:31:31 +02:00
Philip Rebohle
63d8d9c3db
[d3d11] Validate buffer descriptions 2019-06-13 03:31:26 +02:00
Philip Rebohle
6a76577f15
[d3d11] Fix behaviour with a viewport count of zero 2019-06-13 02:22:07 +02:00
Philip Rebohle
5ff9c33855
[d3d11] Fix incorrect behaviour when a scissor rect is not specified 2019-06-13 02:16:12 +02:00
Philip Rebohle
78071c750d
[d3d11] Fix crash when setting too many viewports 2019-06-13 01:54:55 +02:00
Philip Rebohle
3b1e03f988
[util] Report correct GPU vendor to Far Cry 3, 4 and Blood Dragon
Now that fast clear behaviour has been fixed in RADV, reporting an
Nvidia GPU breaks rendering again since the game expects the clear
behaviour to match that of the Windows D3D11 drivers exactly. To
recap, clear(0.5) on an R8_UNORM render target results in 127 on
Nvidia GPUs and 128 on AMD GPUs.
2019-06-12 12:32:30 +02:00
Philip Rebohle
d5ba36443e
[dxbc] Fix useRawSsbo option
Add some break to fix some breakage.
2019-06-11 20:23:47 +02:00
Philip Rebohle
d755b18ccb
[dxbc] Repurpose useRawSsbo option
Basically, abuse the minSsboAlignment property to convince the
compiler to always/never emit raw SSBOs for raw and structured
buffers, and use the actual device limit by default.
2019-06-11 20:20:40 +02:00
Philip Rebohle
0f7c23c022
[dxbc] Always use raw storage buffers if alignment requirements are met 2019-06-11 20:20:40 +02:00
Philip Rebohle
163e6aaa50
[dxbc] Store alignment for raw and structured buffers 2019-06-11 20:20:40 +02:00
Philip Rebohle
acab2bd8ce
[d3d11] Fix crash in GetMaximumFrameLatency with a nullptr argument 2019-06-11 16:36:43 +02:00
Philip Rebohle
96b9058fbf
[util] Fix COM private data bug when passing NULL interface
Fixes test failure in wine's DXGI tests.
2019-06-11 16:08:28 +02:00
Philip Rebohle
6d999fad89
[dxgi] Fix some issues introduced with FilterModesByDesc cleanup 2019-06-11 15:45:32 +02:00
Andrew Eikum
cd6e3ffe75
[dxgi] Return non-exact matches from FindClosestMatchingMode1 2019-06-11 02:29:25 +02:00
Philip Rebohle
3dbccb1b61 [dxvk] Revert buffer re-binding optimization
While this optimization can significantly reduce CPU overhead, this
breaks World of Warcraft for some reason. Fixes #1086.
2019-06-06 17:22:17 +02:00
Philip Rebohle
3de87b41a0 [dxvk] Add likely/unlikely around critical CS chunk append code 2019-06-05 22:57:51 +02:00
Philip Rebohle
461a2bec36 [dxvk] Only update buffer object in buffer slices if necessary
Saves CPU cycles when rebinding the same vertex, index and
constant buffers with different offsets.
2019-06-05 20:32:12 +02:00
Philip Rebohle
7e66dc61b9 [d3d11] Avoid buffer ref count changes when only changing offsets
Saves a few CPU cycles in the somewhat common situation where the
currently bound vertex, index or constant buffer is re-bound with
a different offset.
2019-06-04 17:53:54 +02:00
Philip Rebohle
f501ebce97 [dxvk] Avoid redundant descriptor set updates when binding buffers
Reduces unnecessary overhead when binding a different range of the
same buffer, e.g. through D3D11 VSSetConstantBuffers1.
2019-06-03 20:17:15 +02:00
Philip Rebohle
e4e82007b1 [d3d11] Fix inconsistencies in Map/Unmap on immediate/deferred contexts
Should save a few CPU cycles, and also fixes incorrect behaviour when an
application passes null pointers to Map on a deferred context.
2019-06-03 15:31:13 +02:00
Philip Rebohle
58d838b915 [d3d11] Avoid emitting redundant vertex and index buffer updates 2019-06-03 00:18:54 +02:00
Philip Rebohle
19adccea8f [util] Add unlikely() around COM ref counting code
Improves code generation for the common case.
2019-06-02 23:34:53 +02:00
Philip Rebohle
818704d413 [d3d11] Add some likely/unlikely around CS flushes 2019-06-02 20:29:22 +02:00
Philip Rebohle
6cbd611190 [d3d11] Don't clear DSV aspects that are marked as read-only
Saint's Row 4 appears to be doing this. Ref #24.
2019-06-02 16:34:50 +02:00
Philip Rebohle
c59a8e6e48 [d3d11] Initialize depth images to zero rather than one
Matches Windows behaviour.
2019-06-02 16:33:54 +02:00
Philip Rebohle
40d4922682 [d3d11] Fix initial swap chain image count
Reported-by: Joshua Ashton <joshua@froggi.es>
2019-06-02 15:00:15 +02:00
Philip Rebohle
42c9fad017 [dxvk] Fix binding indices for vertex attribute divisor
Also, only emit a divisor description if the divisor isn't 1.
2019-06-02 10:59:34 +02:00
Philip Rebohle
7d91ff06a3 [util] Fix return value of AddRef
We're supposed to return the new ref count, not the old one.
2019-06-01 22:12:32 +02:00
Philip Rebohle
1e0fe36cae
[d3d11] Respect COPY_FLAG_NO_OVERWRITE when updating constant buffers
Heavy Rain uses this to update constan buffers on deferred contexts.
2019-05-25 14:42:32 +02:00
Philip Rebohle
754cf6da30
[d3d11] Validate subresource index in MapImage
Fixes crashes when passing an invalid subresource index.
2019-05-20 19:27:27 +02:00
Philip Rebohle
3168626f4b
[d3d11] Support mapping multiple image subresources at the same time
Fixes #1066.
2019-05-20 19:27:11 +02:00
Philip Rebohle
a82dbf6200
[dxvk] Add new helper function to compute mip level extent
We're going to need this outside the DxvkImage class as well.
2019-05-20 14:27:00 +02:00
Philip Rebohle
cdc5e93dac
[meta] Release 1.2.1 2019-05-19 14:43:33 +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
Robin
6a4fafba3d
[util] Enable D3D11_MAP_FLAG_DO_NOT_WAIT for The Surge 2019-05-17 12:56:57 +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
905f3fe520
[util] Spoof Nvidia GPUs for Mirror's Edge Catalyst
Closes #1062.
2019-05-17 11:40:35 +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
pchome
32e1afc7a1 [build] Add options to disable dxgi/d3d* build 2019-05-15 21:44:39 +02:00
Philip Rebohle
293551dc8d
[d3d10] Fix winelib build
There's no IID_PPV_ARGS on wine.
2019-05-15 21:42:42 +02:00
Philip Rebohle
7d9a75c82c
[dxbc] Use subgroup operations for atomic append/consume operations
Reduces the number of atomic operations performed per subgroup to 1.
2019-05-15 19:32:27 +02:00
Philip Rebohle
dfa3caa946
[spirv] Add OpUndef and more subgroup instructions 2019-05-15 19:31:43 +02:00
Philip Rebohle
d94d89c3ef
[dxbc] Add option to use subgroup ops for atomic counter operations
This can greatly reduce the number of atomic operations when using
append/consume buffers.
2019-05-15 18:49:02 +02:00
Philip Rebohle
78ab26347d
[d3d10] Add static method implementing D3D10CreateDeviceAndSwapChain1
Same as the D3D11 change to make ReShade happy.
2019-05-15 17:18:05 +02:00
Philip Rebohle
8cae607db0
[d3d11] Add static method implementing D3D11CreateDeviceAndSwapChain
ReShade requires this as it hooks both D3D11CreateDevice and *AndSwapChain,
which means that we can't call D3D11CreateDevice without entering infinite
recursion. Fixes #1057.

Suggested-by: Riesi <riesi@opentrash.com>
2019-05-15 16:46:48 +02:00
Philip Rebohle
192310d481
[util] Don't use if constexpr
Fixes compilation on GCC 6.3.
2019-05-15 03:18:23 +02:00
Philip Rebohle
b3f61936d2
[dxvk] Don't align pushg constant data to 64 bytes
Causes binaries compiled with GCC 6.3 to crash on device creation.
2019-05-15 03:07:05 +02:00
Philip Rebohle
9c93ca451d
[dxvk] Apply view swizzles to image clears
Fixes tone mapping in Yakuza Kiwami 2, which uses an A8_UNORM
render target and clears the alpha component to 1.
2019-05-14 21:21:29 +02:00
Philip Rebohle
0b61901424
[dxvk] Add method to swizzle clear color values 2019-05-14 21:21:14 +02:00
Philip Rebohle
3efec8960c
[dxvk] Pass clear value to clearRenderTarget by value 2019-05-14 21:19:56 +02:00
Philip Rebohle
8784ed673b
[d3d11] Use private references for render targets
Matches Windows behaviour and fixes a crash in Yakuza Kiwami 2,
which calls Release() on RTVs and DSVs until the public reference
count reaches zero. Close #1053.
2019-05-14 15:22:24 +02:00
Philip Rebohle
61b97e5dd1
[util] Add support for private references in Com<...> wrapper 2019-05-14 15:20:27 +02:00
Philip Rebohle
54d3103b04
[util] Fix COM reference count type
On Windows, ref counts are only 32 bits wide.
2019-05-14 14:48:42 +02:00
Philip Rebohle
26602b296f
[meta] Release 1.2 2019-05-13 20:40:11 +02:00
Entryhazard
8c2709a1c6 Changed visibility of the winelib build to behave more like MinGW 2019-05-13 20:37:57 +02:00
Philip Rebohle
7d6f78182b
[dxvk] Don't use ALL_COMMANDS_BIT to notify events 2019-05-09 18:07:49 +02:00
Philip Rebohle
2c45eb79c4
[dxvk] Increase number of queued command buffers to 12
Might help avoid stalls in some edge cases.
2019-05-09 18:07:38 +02:00
Philip Rebohle
a54548dae9
[d3d11] Flush more aggressively when CPU bound
Submitting GPU work early is especially important if there is
a CPU<>GPU synchronization point somewhere.
2019-05-09 18:04:36 +02:00
Philip Rebohle
45be1dfb53
[d3d11] Flush more aggressively on stalling Event queries
Increases GPU utilization in Quake Champions.
2019-05-09 18:04:36 +02:00
Philip Rebohle
af45f810b2
[dxvk] Change flushing behaviour of immediate context methods
Should fix some inappropriate flushing, while flushing more
aggressively on render target changes.

We still keep the flush on UpdateSubresource since some games
use it to update large quantities of data.
2019-05-09 18:04:36 +02:00
Philip Rebohle
dcd75a4f09
[util] Optimize popcnt operation 2019-05-09 18:04:33 +02:00
Philip Rebohle
a1feaa6748
[dxvk] Add aspect mask parameter to clearImageView 2019-05-09 09:10:06 +02:00
Philip Rebohle
1fb8b5ec69
[dxvk] Begin render pass in clearImageViewFb if necessary
Otherwise, we might end up calling vkCmdClearAttachments outside
a render pass instance, which is invalid.
2019-05-09 09:09:11 +02:00
Philip Rebohle
0d40c20aef
[dxvk] Compact vertex buffer bindings
This way, we can always update all vertex buffer bindings with one
single API call, without having to deal with any gaps in binding IDs.

The previous optimization triggers a bug in some drivers when no
vertex buffer is ever bound to a given binding point, and may also
trigger inefficient behaviour if the binding range is assumed to
be contiguous.
2019-05-08 03:37:49 +02:00
Philip Rebohle
644f33a82b
[dxvk] Optimize unbound vertex buffer handling
We can actually just set the stride to 0 when binding a null
buffer, so that we can avoid all the runtime tracking.
2019-05-08 00:52:30 +02:00
Philip Rebohle
8029712aa4
[dxvk] Fix unbound vertex buffer handling
Bit of a brain fart there; we can't just change the meaning
of bindingMask since it indirectly affetcs binding strides.
2019-05-08 00:27:13 +02:00
Philip Rebohle
fb70de8852
[dxvk] Optimize vertex buffer binding
If there are gaps in the binding numbers, we don't want to
create overhead by iterating over unused bindings.
2019-05-08 00:21:35 +02:00
Sam Fomenko
078bc27b14 [util] Disable NvAPI hack for Mirror's Edge Catalyst
#893
2019-05-07 22:34:56 +02:00
Philip Rebohle
9355580c4f
[hud] Optimize HUD rendering
Saves some bandwidth by using more compact vertex formats, and
by using push constants for text colors instead of a vertex
attribute.
2019-05-07 22:05:35 +02:00
Philip Rebohle
02768182f1
[dxvk] Implement push constant API 2019-05-07 20:51:27 +02:00
Philip Rebohle
8931013234
[dxvk] Add push constant range info to shaders and pipeline layout 2019-05-07 20:51:18 +02:00
Philip Rebohle
d5b2c2fd23
[dxvk] Pass slot mapping to pipeline layout constructor
We're not getting the info from any other source anyway.
2019-05-07 20:36:18 +02:00
Philip Rebohle
0224dbc371
[dxvk] Optimize spinlock implementation 2019-05-07 13:38:02 +02:00
Philip Rebohle
584fd870b2
[dxvk] Bump state cache version to v5 2019-05-06 03:15:45 +02:00
Philip Rebohle
37f1087783
[dxvk] Add API for specialization constants 2019-05-06 03:15:45 +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
a0c67191a7
[d3d11] Implement depth bounds extension 2019-05-06 00:08:58 +02:00
Philip Rebohle
3867270812
[d3d11] Implement MultiDrawIndirectCount extension 2019-05-06 00:08:58 +02:00
Philip Rebohle
492b7db07b
[d3d11] Support count buffer in Set|BindDrawBuffers 2019-05-06 00:08:58 +02:00
Philip Rebohle
117b7b1ba1
[d3d11] Implement MultiDrawIndirect extension 2019-05-06 00:08:58 +02:00
Philip Rebohle
9e57b03e64
[d3d11] Implement barrier control extension 2019-05-06 00:08:58 +02:00
Philip Rebohle
04bef3c67a
[d3d11] Add stub implementation of D3D11DeviceExt 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
edbbdef787
[d3d11] Add interfaces to support D3D11 extensions 2019-05-06 00:08:57 +02:00
Philip Rebohle
8a3044a342
[dxvk] Implement depth bounds test in backend 2019-05-06 00:08:57 +02:00
Philip Rebohle
5ad212d279
[dxvk] Introduce new pipeline state to enable depth bounds test 2019-05-06 00:08:57 +02:00
Philip Rebohle
bacb1f7c60
[dxvk] Implement indirct draw commands with indirect count 2019-05-06 00:08:57 +02:00
Philip Rebohle
13359d68d7
[dxvk] Enable VK_KHR_draw_indirect_count if available
Useful to implement a corresponding D3D11 extension.
2019-05-06 00:08:57 +02:00
Philip Rebohle
66b6b50af6
[dxvk] Fix stale vertex attribute divisor
Not resetting this may result in unnecessary state cache misses.
2019-05-05 23:18:13 +02:00
Philip Rebohle
b35f3c14df
[dxvk] Off-load command buffer submission to separate thread
Reduces load on the CS thread a bit, which may yield a small
performance improvement.
2019-05-05 16:49:17 +02:00
Robin
4c0c66892a [d3d11] Fix MSVC 2017 compilation 2019-05-04 22:14:28 +02:00
Philip Rebohle
37f9a7ffff
[meta] Release 1.1.1 2019-05-04 15:59:18 +02:00
Philip Rebohle
f733d082f4
[d3d11] Implement D3D11DeviceContext::SwapDeviceContextState 2019-05-04 15:57:57 +02:00
Philip Rebohle
82c6a5eb1a
[d3d11] Implement D3D11Device::CreateDeviceContextState 2019-05-04 15:57:57 +02:00
Philip Rebohle
c1929ccb6f
[d3d11] Add class to implement D3DDeviceContextState 2019-05-04 15:57:55 +02:00
Philip Rebohle
81229d66cc
[d3d10] Explicitly define GUID for ID3D10StateBlock
Fixes linker errors when building against winelib.
2019-05-03 20:32:52 +02:00
Philip Rebohle
53aa27336b
[dxvk] Disable depthWriteEnable if depth attachment has read-only layout
Fixes water rendering in SpellForce 3.
2019-05-03 14:38:21 +02:00
Philip Rebohle
6eeb3b6da9
[dxvk] Add helper function to get info about depth-stencil image layouts 2019-05-03 14:37:59 +02:00
Philip Rebohle
81821414b0
[d3d10] Implement state blocks
Improves compatibility to Wine's Direct2D implementation.
2019-05-03 13:08:57 +02:00
Joshua Ashton
7aecd46f93 [spirv] Implement proj sample variants 2019-05-03 08:34:16 +02:00
Philip Rebohle
f503ba4c8b
[d3d11] Fix counter value offset in DrawAuto
According to the newly released D3D11.3 functional specification,
we're supposed to subtract the offset of the slot 0 vertex buffer
binding from the counter value.
2019-05-02 16:03:52 +02:00
Philip Rebohle
343818cf1c
[d3d11] Always enable shaderStorageImageWriteWithoutFormat
We compile some compute shaders that need it in FL10/FL9 games.
2019-05-02 08:08:45 +02:00
Philip Rebohle
e6eef1d1ec
[d3d11] Minor Map/Unmap optimizations
Avoid unnecessary LockContext call when unmapping a buffer.
This may actually improve performance if the context has
multithreaded protection enabled (e.g. D3D10).
2019-05-01 03:01:36 +02:00
Philip Rebohle
f76fd8fa5d
[d3d11] Minor CPU savings 2019-05-01 03:00:23 +02:00
Philip Rebohle
7e1b0ef8e6
[dxvk] Bump state cache format to version 4
Accomodates for the alpha test changes in D3D11.
2019-05-01 01:57:34 +02:00
Philip Rebohle
93bd923c17
[d3d11] Set up extra state for the HUD renderer 2019-05-01 01:57:34 +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
fc52c1720d
[dxvk] Remove old spec constant code 2019-05-01 01:57:34 +02:00
Philip Rebohle
5714f18d15
[dxvk] Use new specialization constant code for graphics pipelines 2019-05-01 01:57:34 +02:00
Philip Rebohle
c3f7dfd197
[dxvk] Use new specialization constant code for compute pipelines 2019-05-01 01:57:34 +02:00
Philip Rebohle
433c707888
[dxvk] Add new structure to generate specialization constant info
We should avoid passing redundant and unused data to the driver, as
that may interfere with caching. It also adds a lot of unnecessary
data to traces.
2019-05-01 01:57:34 +02:00
Philip Rebohle
0a77ebbeaf
[dxgi] Change default of s_gamma_bound to true
In the future, we'll assume true and only pass the spec constant
value to the driver if their value is actually different from the
default, but this requires reliable defaults.
2019-05-01 01:57:34 +02:00
Philip Rebohle
04e6479690
[dxbc] Remove old spec constant code 2019-05-01 01:57:34 +02:00
Philip Rebohle
dc3cfc9fa0
[dxbc] Use new spec constant API for rasterizer sample count 2019-05-01 01:57:34 +02:00
Philip Rebohle
7111af423d
[dxbc] Add new emitNewSpecConstant method
Convenience method to declare new specialization constants.
2019-05-01 01:57:34 +02:00
Philip Rebohle
a340b3101c
[d3d11] Add missing interface queries for IDXGIObject and IDXGIDeviceSubObject 2019-05-01 01:54:00 +02:00
Eero Kelly
b92dc14c4d [util] Enable constant buffer range check for NieR:Automata
This fixes a graphical corruption issue where Operator 6O's portrait
displays as a large flashing circle due to uninitialized buffer reads.

Fixes issue: https://github.com/ValveSoftware/Proton/issues/1543

Reviewed-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2019-04-30 16:08:52 +02:00
Philip Rebohle
dc52212873
[dxbc] Disable Constant Buffer Range Check on AMD
The hardware already behaves as intended, no need to waste GPÜ cycles.
2019-04-30 16:07:24 +02:00
Philip Rebohle
3b1e753bb5
[dxvk] Re-implement early discard with quad granularity
May perform better on some hardware in situations where we cannot
discard a full subgroup. Closes #753.
2019-04-30 14:46:03 +02:00
Danylo Piliaiev
4dd68987d6 [d3d11] Check if uav's counter slice is defined in CopyStructureCount
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2019-04-30 12:34:27 +02:00
Danylo Piliaiev
261d31cac6 [dxbc] Fix xfb passthrough for system values
vReg should be always allocated for system values which is
necessary for emitXfbOutputSetup and is already done for
hull shader passthrough.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2019-04-30 12:19:21 +02:00
Philip Rebohle
2afe5ec141 [d3d11] Clean up rasterizer state initialization
The error messages are pointless since all of this is already
handled in NormalizeDesc.
2019-04-29 16:22:42 +02:00
Philip Rebohle
06c144f075 [dxbc] Store sample positions as vec2 array
We can append the zeroes in shader code instead. May
improve generated code on drivers that use scratch
memory or temporary uniform buffers for large arrays.
2019-04-29 14:04:42 +02:00
Philip Rebohle
8f5338b1d1 [spirv] Add constvec2f32 helper
We should probably replace this with a proper template at some point.
2019-04-29 13:47:15 +02:00
Philip Rebohle
b14ad7b30c [dxbc] Remove some old TODOs
This is already implemented properly.
2019-04-29 11:48:09 +02:00
Philip Rebohle
04152055b7 [dxbc] Correctly report a sample count of 0 for unbound images 2019-04-29 11:48:09 +02:00
Philip Rebohle
a3e0157ab0 [dxbc] Correctly report a size of 0 for unbound images 2019-04-29 11:48:09 +02:00
Philip Rebohle
18cbaefdcb [dxbc] Correctly report a size of 0 for unbound buffers 2019-04-29 11:48:09 +02:00
Philip Rebohle
ad5da34c57 [dxbc] Fix typo in sample positions 2019-04-29 11:48:09 +02:00
Philip Rebohle
2c61303976 [d3d11] Implement IDXGIResource1 for textures and buffers 2019-04-27 20:21:54 +02:00
Philip Rebohle
54592b7852 [d3d11] Add basic implementation of IDXGIResource1
We don't support resource sharing and subresource surfaces
yet, but the interface should at least be present.
2019-04-27 20:21:47 +02:00
Philip Rebohle
b7a5f11121 [dxgi] Add missing DXGI_CPU_ACCESS_* defines 2019-04-27 19:13:34 +02:00
Philip Rebohle
ac79f69a10 [d3d11] Pass texture as D3D11Resource to DXGI interop objects 2019-04-27 16:25:55 +02:00
Philip Rebohle
d1a019a043 [d3d11] Implement Map / Unmap for IDXGISurface2 2019-04-27 16:17:50 +02:00
Philip Rebohle
af15aa0c32 [d3d11] Implement IDXGISurface2 for compatible 2D textures
Required by SpellForce 3. Fixes #1031.
2019-04-27 15:35:20 +02:00
Philip Rebohle
ed0719432d [dxvk] Add support for per-app configuration
Feature request by Alexandr Oleynikov (@tannisroot).
2019-04-26 19:17:32 +02:00
Philip Rebohle
e2ebfa9012 [dxvk] Add some 'unlikely' statements 2019-04-26 17:52:53 +02:00
Philip Rebohle
9f264ba008 [d3d11] Remove predication workaround for RADV
This no longer has any effect due to changes in the driver, and
we no longer support Predication anyway.
2019-04-25 18:29:13 +02:00
Joshua Ashton
60827c1b22 [d3d11] Improve CreatePredicate logging 2019-04-25 13:14:23 +02:00
Philip Rebohle
4eff83bdee [d3d11] Disable Predication support
Doesn't work at all in the few games that use it.
2019-04-25 11:55:40 +02:00
Philip Rebohle
cd63cebc63 [dxvk] Simplify validateGraphicsState 2019-04-24 23:16:52 +02:00
Philip Rebohle
981ea547f9 [d3d11] Don't use presentation fence 2019-04-23 20:14:34 +02:00
Philip Rebohle
81f6ccb1be [d3d11] Select sync event based on back buffer count
May improve frame pacing in some games.
2019-04-23 20:14:30 +02:00
Philip Rebohle
4cc35da3b2 [d3d11] Allocate one additional swap chain image
DXGI's BufferCount apparently only counts back buffers,
while there's an implicit front buffer.
2019-04-23 20:12:29 +02:00
Philip Rebohle
2245aada03
[dxvk] Use stricter barriers around meta operations
Fixes some rendering issues on AMDVLK in some situations.
2019-04-19 11:41:12 +02:00
Philip Rebohle
95bfac84f1
[dxvk] Support image sub-regions for resolve operations
Required for legacy graphics APIs.
2019-04-19 11:41:12 +02:00
Joshua Ashton
a3966b442b [dxvk] Add adapterCount function to DXVKInstance.
Will be needed in the Direct3D9 interface as you can query the number of adapters.
2019-04-18 23:18:15 +02:00
Joshua Ashton
0c34fae9c7 [spirv] Implement constvec3f32 2019-04-18 23:18:02 +02:00
Joshua Ashton
a770c73dbc [spirv] Implement opVectorTimesScalar 2019-04-18 23:18:02 +02:00
Joshua Ashton
f1a8e02e0f [spirv] Implement opPow 2019-04-18 23:18:02 +02:00
Philip Rebohle
94beec0c13
[dxvk] Fix subresources in barriers for 2D views of 3D images
The array layers passed during framebuffer creation are the selected
3D slices in this case, the image actually only has one array layer.
We should account for that when recording barriers.
2019-04-18 12:08:27 +02:00
Philip Rebohle
b44cad4d32
[dxbc] Replace computeResourceSlotId by light-weight alternatives
Slightly reduces overhead of D3D11 binding methods.
2019-04-18 10:06:15 +02:00
Philip Rebohle
044e3967e7
[hud] Show compiler activity indicator for at least one second
Otherwise this would flicker when shaders are already cached.
2019-04-15 12:42:07 +02:00
Philip Rebohle
35a2a02714
[dxbc] Do not emit GS system values if rasterization is disabled
Fixes issue in Star Citizen, which declares a max output vertex count
of 128 in a geometry shader which emits eight components per vertex,
which becomes 12 components in DXVK due to the gl_Position builtin.
This should keep us below the magic limit of 1024 output components.
2019-04-15 09:00:46 +02:00
Philip Rebohle
f9e56c97cf
[d3d11] Fix hasing of geometry shaders with stream output
The xfb struct contains pointers, but we should hash the
strings instead, otherwise the hash changes between runs.
2019-04-15 03:48:31 +02:00
Philip Rebohle
ca717eeb62
[d3d11] Track query state correctly
Not sure if any game actually needs this, but we should avoid
sending bogus commands to the backend when the app sends bogus
commands to us.
2019-04-14 16:27:15 +02:00
Philip Rebohle
364ae7270d
[d3d11] Don't allocate predicate for unsupported predicates 2019-04-14 14:26:56 +02:00
Philip Rebohle
7dc449ac55
[hud] Add new HUD entry to show shader compiler activity 2019-04-14 13:28:57 +02:00
Philip Rebohle
8b84d002f8
[hud] Pass surface size to HUD renderer 2019-04-14 13:28:57 +02:00
Philip Rebohle
bb01318984
[dxvk] Add stat counter for shader compiler activity 2019-04-14 13:28:57 +02:00
Philip Rebohle
2c0ddbd072
[util] Enable D3D11_MAP_FLAG_DO_NOT_WAIT for Anno 1800
Removes a sync point and almost doubles performance as a result.
2019-04-12 10:52:25 +02:00
Philip Rebohle
adc447cc9f
[dxvk] Increase query pool sizes
Many games create a very large number of occlusion queries, and
we shouldn't create more pools than necessary.
2019-04-08 01:51:38 +02:00
Philip Rebohle
7018db3614
[dxvk] Implement shader-based resolve
Resolve attachments are currently too broken on most drivers,
so we cannot really rely on them.
2019-04-07 21:07:25 +02:00
Philip Rebohle
ea5dcd5b14
[dxvk] Re-implement class to create meta-resolve objects
This time with specialization constants so that we don't have
to read the tetxure's sample count from the descriptor.
2019-04-07 21:07:25 +02:00
Philip Rebohle
addbae585f
[dxvk] Enable VK_AMD_shader_fragment_mask if available 2019-04-07 21:07:25 +02:00
Philip Rebohle
14593baebd
[dxvk] Add new resolve shaders 2019-04-07 21:07:21 +02:00
Philip Rebohle
56300ff9b7
[d3d11] Allocate mapped buffers for staging images on cached memory
These will most likely be used for reading, so we should put them
on a memory type which allows reading.
2019-04-07 14:47:43 +02:00
Philip Rebohle
51f229530b
Revert "[d3d11] Select memory type based on CPU access flags"
This reverts commit 6c8042033e.

Batman: Arkham City doesn't set the CPU access flags correctly
for some images it maps for reading, and breaks on Nvidia as a
result.
2019-04-07 14:42:01 +02:00
Philip Rebohle
1da7b1e87c
Revert "[meta] Release 1.1"
This reverts commit a696f69ec2.
2019-04-07 10:13:18 +02:00
Philip Rebohle
e901d9d149
[dxgi] Fix broken gamma with combined image samplers
Fixes #1003.
2019-04-07 09:55:54 +02:00
Philip Rebohle
a696f69ec2
[meta] Release 1.1 2019-04-06 16:26:21 +02:00
Philip Rebohle
f6bdb7bb63
[dxvk] Fix circular reference between DxvkDevice and DxvkGpuQueryPool 2019-04-06 12:31:20 +02:00
pchome
3eb9f35fc3 [build] Use generator to produce resource files 2019-04-06 11:33:45 +02:00
Philip Rebohle
aa45b3cc31
[dxvk] Fix build failure for some people
Why am I the only one who never has any issues with this?
2019-04-06 10:10:29 +02:00
Sveinar Søpler
4f9dd8d3d0
[build] Add version info to compiled DLLs
Fixes #980.
2019-04-05 21:09:57 +02:00
Philip Rebohle
b89646584b
[util] Enable constant buffer range check for Dark Souls Remastered ans Grim Dawn 2019-04-05 20:56:32 +02:00
Philip Rebohle
5819a69302
[d3d11] Add option to enable constant buffer range checks 2019-04-05 20:56:32 +02:00
Philip Rebohle
9b99c55a2e
[dxbc] Implement optional constant buffer range check 2019-04-05 20:56:29 +02:00
Philip Rebohle
b9bfbb9ccc
[dxvk] Fix move constructor of DxvkShaderModule 2019-04-04 16:10:44 +02:00
Philip Rebohle
da4baefdf0
[spirv] Fix initial allocation size for compressed buffer
The old initial size was still for uint8.
2019-04-04 13:15:59 +02:00
Philip Rebohle
ac3cd0b688
[dxvk] Store compressed shader modules in DxvkShader
Reduces the amount of memory used to store shaders to
around ~45%-50% of the original size.
2019-04-04 13:00:31 +02:00
Philip Rebohle
f49863f321
[dxvk] Store enabled SPIR-V capabilities explicitly 2019-04-04 13:00:31 +02:00
Philip Rebohle
f32200b668
[spirv] Implement in-memory compression for shader modules 2019-04-04 13:00:31 +02:00
Philip Rebohle
d2395180af
[util] Add helpers to pack/unpack data to/from larger units 2019-04-04 13:00:31 +02:00
Liam Middlebrook
9d26031dcb [dxvk] Zero-Initialize SpecConstantData
Ensure that specialization constant data passed into the driver is
zero-initialized.

Having the pData field in VkSpecializationInfo be zero-initialized helps
to create more deterministic input to the driver, which is particularly
useful when debugging shader issues.
2019-04-03 23:21:12 +02:00
Philip Rebohle
cd93ba570e
[dxvk] Simplify DxvkShaderModule
This is merely a wrapper for a VkShaderModule now, so it really
doesn't need anything fancy and definitely doesn't need to be
heap-allocated.
2019-04-03 20:47:58 +02:00
Philip Rebohle
2bd09e52e7
[dxvk] Don't cache shader modules for graphics pipelines
We're only ever going to need those when actually compiling a new
pipeline, so on average we're just wasting large amounts of memory
by keeping them around.

Trades several hundred MB of memory for a small increase in compile
times. Creating shader modules is typically very cheap.
2019-04-03 20:01:36 +02:00
Philip Rebohle
79e867624a
[dxvk] Don't cache shader modules for compute pipelines 2019-04-03 19:46:28 +02:00
Philip Rebohle
632b254714
[d3d11] Use combined image sampler descriptors for the presenter 2019-04-03 17:40:05 +02:00
Philip Rebohle
257c19ed0a
[hud] Use combined image s1ampler for the font texture 2019-04-03 17:40:05 +02:00
Philip Rebohle
ddde5ee6c2
[dxvk] Support combined image sampler descriptors in the backend 2019-04-03 17:40:05 +02:00
Chip Davis
910e1a1835 Only try once to recreate surfaces on surface loss. 2019-04-02 17:26:48 +02:00
Chip Davis
540900b792 [vulkan] Don't loop endlessly on a lost surface.
If the surface is lost in a way that can't be recovered by recreating
the surface from the window, the previous change would wind up looping
forever. Just retry 5 times before giving up.
2019-04-02 17:26:48 +02:00
Chip Davis
e633dbc06f [vulkan] Recreate the surface on surface loss.
According to the Vulkan spec:

> Several WSI functions return `VK_ERROR_SURFACE_LOST_KHR` if the
> surface becomes no longer available. After such an error, the surface
> (and any child swapchain, if one exists) **should** be destroyed, as
> there is no way to restore them to a not-lost state.

So if we get this error, we need to recreate the surface in addition to
the swapchain.
2019-04-02 17:26:48 +02:00
Philip Rebohle
b5f859915a
[dxvk] Properly reset global barrier access flags
Fixes: adaf98bb9d
2019-04-02 15:05:44 +02:00
Philip Rebohle
6da02c6f56
[dxvk] Fix write access flag for barriers
Fixes: adaf98bb9d
2019-04-02 15:01:37 +02:00
Philip Rebohle
adaf98bb9d
[dxvk] Use global memory barrier instead of resource barriers if possible
Hardware doesn't support this type of fine-grained synchronization
anyway, so we really don't need the driver to iterate over anything
up to hundreds of structs - except for layout transitions.
2019-04-02 14:48:39 +02:00
Philip Rebohle
67b9b6e1e1
[dxvk] Pull buffer updates out of render passes whenever possible
Instead of ending the render pass and inserting two barriers, we
perform the update and barrier in a dedicated command buffer.

Improves performance in Sekiro by 5-10% depending on resolution and scene.
2019-04-02 13:17:05 +02:00
Philip Rebohle
e59f53abfa
[dxvk] Allow barriers to be recorded into a specific command buffer 2019-04-02 12:14:15 +02:00
Philip Rebohle
2315d55ecc
[dxvk] Rename DxvkCmdBufferFlag -> DxvkCmdBuffer 2019-04-02 12:10:47 +02:00
Philip Rebohle
e395712de7
[dxvk] Add missing feature check for conditional rendering 2019-04-02 04:13:23 +02:00
Philip Rebohle
295d583c1d
[d3d11] Lazily allocate predicate on SetPredication
Many games use CreatePredicate to create occlusion queries without
actually using predication, and we don't want to pay any runtime
cost for this when predicates aren't actually being used.
2019-04-02 04:07:05 +02:00
Philip Rebohle
87dc472a8d
[dxvk] Set empty scissor rect when the app requests empty viewport
Since we cannot set the viewport size to zero, we should set an
empty scissor rect so that rasterization is still effectively
disabled for the given viewport index.

Fixes #813, #957.
2019-04-01 15:45:41 +02:00
Philip Rebohle
8702374bf7
[dxvk] Do not invalidate iterator before disabling queries
Reported-by: Joshua Ashton <joshua@froggi.es>
2019-04-01 02:58:02 +02:00
Philip Rebohle
70510bab9a [dxvk] Introduce extra pipeline state
Provides extra state that will be passed in via spec constants.
Whether or not this state is used is determined by the shaders.
2019-04-01 02:31:32 +02:00
Philip Rebohle
18d2905bf7 [dxvk] Remove unused alphaToOne state
Nothing supports this anyway, so no reason to carry it around.
2019-04-01 02:31:22 +02:00
Marin Baron
1c434d86cb [util] Enable deferred surface creation for "Dissidia Final Fantasy NT Free Edition".
Avoid white screen, "D3D11Device: No such vertex shader semantic: COLOR0"...
https://www.reddit.com/r/archlinux/comments/b7e38x/protondxvk_dissidia_nt/
2019-03-31 03:27:05 +02:00
Philip Rebohle
a646f8cf2c
[util] Enable deferred surface creation for Nioh
See discussion in #284.
2019-03-29 08:49:37 +01:00
Chip Davis
d741bc47ef [dxgi] Use a recursive mutex.
Some games, like Final Fantasy XIV, call `SetFullscreenState()` again
after the window is resized. When the resize itself was triggered by a
`SetFullscreenState()` call, this will cause us to re-enter the mutex.
2019-03-29 08:26:19 +01: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
8f580efa25
[d3d11] Correctly handle out-of-bounds constant buffer ranges
Otherwise we pass an invalid offset and length to the backend,
which leads to invalid descriptor set updates in Vulkan.
The D3D11 runtime does not report corrected constant offset
and count parameters to the applicaion in *GetConstantBuffers1.

Reported-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2019-03-28 13:45:41 +01:00
Philip Rebohle
09d60f42bc
[d3d11] Work around predicate buffer sync issue on RADV
If the predicate buffer is device-local memory, conditional
rendering commands don't seem to see any updates values even
though there is a barrier. When allocating on host-visible
device memory or system memory, it works as expected.
2019-03-28 10:02:11 +01:00
Philip Rebohle
3a3d7fb378
[d3d11] Properly implement SetPredication 2019-03-28 10:02:11 +01:00
Philip Rebohle
d81146e3d2
[d3d11] Allocate predicate buffer for predicates 2019-03-28 10:02:11 +01:00
Philip Rebohle
7e16c4cda1
[d3d11] Remove unused revision field from D3D11Query 2019-03-28 10:02:11 +01:00
Philip Rebohle
acdb989cfa
[dxvk] Implement conditional rendering 2019-03-28 10:02:11 +01:00
Philip Rebohle
03f00453ef
[dxvk] Add command list functions for conditional rendering 2019-03-28 10:02:11 +01:00
Philip Rebohle
70520e30aa
[dxvk] Enable conditionalRendering feature if present 2019-03-28 10:02:11 +01:00
Philip Rebohle
8f7e606583
[dxvk] Enable VK_EXT_conditional_rendering if available 2019-03-28 10:02:11 +01:00
Philip Rebohle
7f211545ee
[vulkan] Load functions for VK_EXT_conditional_rendering 2019-03-28 10:02:11 +01:00
Chip Davis
13a6ecadcd [dxvk] Remove needless lambda capture of 'this'. 2019-03-27 21:59:15 +01:00
Chip Davis
7a37d88067 [dxvk] Log vertex attributes and buffers when logging pipeline state.
This was invaluable in diagnosing a missing feature from MoltenVK.
2019-03-27 21:59:03 +01:00
Philip Rebohle
edd63d3972
[dxvk] Fix buffer offset in copyDepthStencilImageToPackedBuffer 2019-03-27 14:23:58 +01:00
Philip Rebohle
03881dde72
[dxvk] Implement blitImage function 2019-03-27 02:31:04 +01:00
Philip Rebohle
6c8042033e
[d3d11] Select memory type based on CPU access flags 2019-03-26 21:17:52 +01:00
Philip Rebohle
302c6b5e6c
[d3d11] Implement depth-stencil uploads in resource initializer 2019-03-26 18:11:42 +01:00
Philip Rebohle
fc3515c16f
[d3d11] Implement depth-stencil uploads in UpdateSubresource1 2019-03-26 18:11:42 +01:00
Philip Rebohle
eec1cde1b3
[d3d11] Implement depth-stencil mapping on deferred contexts 2019-03-26 18:05:02 +01:00
Philip Rebohle
97d77fa508
[d3d11] Implement depth-stencil mapping on the immediate context 2019-03-26 18:04:56 +01:00
Philip Rebohle
c38b1802a2
[d3d11] Enable shaderStorageImageExtendedFormats device feature 2019-03-26 17:56:57 +01:00
Philip Rebohle
8194bec1bf
[d3d11] Fix image format mapping when creating mapped buffer 2019-03-26 17:54:43 +01:00
Philip Rebohle
7cd3e9a0d4
[d3d11] Add method to look up packed format 2019-03-26 17:54:14 +01:00
Philip Rebohle
6c2f16fce8
[dxgi] Add methods to retrieve original format mappings 2019-03-26 17:54:14 +01:00
Philip Rebohle
b3ea1b02eb
[dxvk] Implement depth-stencil upload via temporary buffer 2019-03-26 17:54:14 +01:00
Philip Rebohle
0d889e0dcd
[dxvk] Implement depth-stencil unpacking 2019-03-26 17:54:10 +01:00
Philip Rebohle
de45ffd749
[dxvk] Create depth-stencil unpacking pipelines 2019-03-26 16:05:27 +01:00
Philip Rebohle
7124c3f449
[dxvk] Add depth-stencil unpacking shaders 2019-03-26 16:05:27 +01:00
Philip Rebohle
90c7878a53
[dxvk] Rename dxvk_resolve_{vert|geom} -> dxvk_copy_{vert|geom} 2019-03-25 18:22:56 +01:00
Philip Rebohle
7627f6e3ed
[dxvk] Optimize meta copy barriers 2019-03-25 17:58:31 +01:00
Philip Rebohle
fd0daa5ec7
[dxvk] Optimize meta geometry shaders 2019-03-25 17:58:25 +01:00
Philip Rebohle
be1832a348
[d3d11] Don't sample gamma texture if the gamma curve is identity
Saves some GPU time in games that don't use DXGI gamma control at all.
2019-03-24 18:07:21 +01:00
Philip Rebohle
73bb0d8ae2 [dxvk] Remove shader-based resolve
No longer necessary since we're using render pass resolve now.
2019-03-24 16:36:35 +01:00
Philip Rebohle
75ee1f42c2
[dxvk] Use resolve attachment for meta-resolve ops
Faster than the naive fragment shader-based solution.
2019-03-19 11:45:56 +01:00
Philip Rebohle
209248e26d [dxvk] Use vkResetQueryPoolEXT to reset individual queries
This is much faster than the fallback path which uses GPU functions.
2019-03-17 16:25:00 +01:00
Philip Rebohle
3d53f318fd [dxvk] Enable hostQueryReset device feature if available 2019-03-17 16:24:59 +01:00
Philip Rebohle
9dd9f0ab22 [dxvk] Enable VK_EXT_host_query_reset if available 2019-03-17 16:24:59 +01:00
Philip Rebohle
412d79c8c1
[d3d11] Use new query implementation 2019-03-14 21:16:41 +01:00
Philip Rebohle
e5441e841f
[dxvk] Support new query implementation 2019-03-14 21:16:41 +01:00
Philip Rebohle
a8144370c8
[dxvk] Create new query pool and forward it to the context 2019-03-14 21:16:41 +01:00
Philip Rebohle
772fa3074f
[dxvk] Add new query implementation 2019-03-14 21:16:41 +01:00
Philip Rebohle
8c3900c533
[d3d11] Use new GPU events for D3D11 Event queries 2019-03-14 21:16:41 +01:00
Philip Rebohle
3dbd755075
[dxvk] Implement method to signal GPU events 2019-03-14 21:16:41 +01:00
Philip Rebohle
6b9653d261
[dxvk] Create GPU event pool and forward it to the context 2019-03-14 21:16:41 +01:00
Philip Rebohle
4da89ccc48
[dxvk] Add GPU event class
GPU events allow for finer-grained CPU<>GPU synchronization than
the current approach, so we should change our implementation.
2019-03-14 21:16:38 +01:00
Philip Rebohle
7fa2fb5188
[meta] Release 1.0.1 2019-03-14 19:07:18 +01:00
Philip Rebohle
19f82826bb
[d3d11] Don't use presentation fence on ANV
Should hopefully fix stuttering issues introduced with 1.0.
2019-03-14 18:50:33 +01:00
Philip Rebohle
1656860486
[dxgi] Remove obsolete global monitor helper functions 2019-03-14 18:26:39 +01:00
Philip Rebohle
5b72e84726
[dxgi] Use IDXGIVkMonitorInfo in DxgiSwapChain 2019-03-14 18:26:39 +01:00
Philip Rebohle
50347e1256
[dxgi] Use IDXGIVkMonitorInfo in DxgiOutput 2019-03-14 18:26:39 +01:00
Philip Rebohle
7d5b5f288c
[dxgi] Implement IDXGIVkMonitorInfo for DxgiFactory 2019-03-14 18:26:39 +01:00
Philip Rebohle
cfdac13ea5
[dxgi] Add new COM interface for per-monitor data 2019-03-14 18:26:37 +01:00
Philip Rebohle
f272071d8d
[dxvk] Don't enforce HOST_CACHED flag when allocating memory
The better fix would be to support non-coherent memory properly,
but this will have to do for now. Fixes #947.
2019-03-14 16:47:17 +01:00
Philip Rebohle
c35af973bb
[util] Disable NvAPI hack for Star Wars Battlefront 2015
Fixes #968.
2019-03-14 16:33:35 +01:00
Philip Rebohle
2d39be4e72
[d3d11] Check image block alignment in UpdateSubresource1
Fixes validation errors in World of Warcraft, which for some reason
tries to update individual pixels of block-compressed textures.
See #964.
2019-03-14 01:11:39 +01:00
Philip Rebohle
833c433556
[util] Enable relaxed barriers for Devil May Cry 5
Same engine as RE2, same ~10% performance improvement.
2019-03-11 18:36:09 +01:00
Philip Rebohle
0326258829 [dxbc] Use SDiv instead of ShiftRightLogical for index calc on Nvidia
Reportedly fixes Resident Evil 2 and Devil May Cry 5 on Nvidia.
2019-03-09 19:59:56 +01:00
Philip Rebohle
a40d8d49ea
[dxvk] Only enable xfb subpass barrier if feature is enabled
Silences validation errors when running FL9_x applications, or
a driver which does not support VK_EXT_transform_feedback.
2019-03-02 19:56:01 +01:00
Philip Rebohle
4fc96e60c5
[d3d11] Reimplment GetEnabledShaderStages using getShaderPipelineStages
They do the same thing anyway.
2019-03-02 19:56:01 +01:00
Philip Rebohle
d9edb16b75
[dxvk] Use getShaderPipelineStages for dummy resource creation
Fixes some validation errors for FL10_x and FL9_x applications.
2019-03-02 19:56:01 +01:00
Philip Rebohle
2a6d4fa2ba
[dxvk] Implement DxvkDevice::getShaderPipelineStages 2019-03-02 19:56:00 +01:00