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

3097 Commits

Author SHA1 Message Date
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
Joshua Ashton
d01110259c [d3d11, d3d10] Init returnptrs for CreateDevice funcs. 2019-02-27 23:17:08 +01:00
Joshua Ashton
995949a9f9 [d3d10] Fix and cleanup S_FALSE handling 2019-02-27 22:01:04 +01:00
Joshua Ashton
62a833b528 [dxgi] Correct return values for CreateDXGIFactory[1/2] 2019-02-27 22:01:04 +01:00
Joshua Ashton
ccf24db428 [d3d10] Fix null pBlendStateDesc being dereferenced on def. desc 2019-02-27 22:01:04 +01:00
Joshua Ashton
2454041903 [d3d10] nullptr checks for resource creation 2019-02-27 22:01:04 +01:00
Joshua Ashton
28df1e0825 [d3d11] nullptr check descs & fix return values 2019-02-27 22:01:04 +01:00
Philip Rebohle
10140f40ca
[dxvk] Release 1.0 2019-02-25 20:26:50 +01:00
Philip Rebohle
e03b574cc1
[d3d11] Block on image acquisition fence before presenting
May potentially improve frame timing on drivers where image
acquisition does not block.
2019-02-25 13:34:49 +01:00
Philip Rebohle
b6804a95b7
[vulkan] Create per-swap image fences for presenter 2019-02-25 13:34:49 +01:00
Philip Rebohle
a6d1fe07f2
[vulkan] Add helper method to wait for presenter fence 2019-02-25 13:34:49 +01:00
Philip Rebohle
2231caaa9e
[vulkan] Add optional fence paratemer to acquireNextImage
We'll reset the fence prior to acquisition, so that the user of
this API won't have to do it.
2019-02-25 13:34:46 +01:00
Philip Rebohle
6d814b24da
[dxbc] Fix invalid SPIR-V for FirstBitHi / FirstBitShi on vectors
Refs #930.
2019-02-23 21:27:40 +01:00
Philip Rebohle
d12a8e09a8
[dxbc] Decorate integer fragment shader builtins as flat
Fixes yellow tint in Unreal Engine 4 games on RADV and AMDGPU-PRO.
2019-02-23 14:33:59 +01:00
Philip Rebohle
b65520d627
[dxvk] Fix feature query for vertex attribute divisor 2019-02-20 11:47:15 +01:00
Philip Rebohle
38c6eeed26
[dxbc] Only emit depth clamp in fragment shader if necessary
We don't need this if the depth clip extension is supported
by the driver.
2019-02-19 14:27:21 +01:00
Philip Rebohle
9159401b14
[dxvk] Use depthClipEnable during graphics pipeline creation
Fall back to previous behaviour if the feature is not available.
2019-02-19 14:22:36 +01:00
Philip Rebohle
49965fd79e
[dxvk] Enable depthClipEnable feature if available 2019-02-19 13:57:34 +01:00
Philip Rebohle
cc5ac885f5
[dxvk] Enable VK_EXT_depth_clip_enable if available 2019-02-19 13:53:56 +01:00
Philip Rebohle
20ea74fa99
[d3d11] Do not enable shaderStorageImageMultisample device feature
See https://github.com/KhronosGroup/MoltenVK/issues/502
2019-02-19 11:32:32 +01:00
Philip Rebohle
2d81decb91
[dxbc] Fix SPIR-V caps for SRV and UAV resources 2019-02-19 11:31:12 +01:00
Philip Rebohle
d9931e3621
[utils] Report Nvidia GPUs for Far Cry 3 and Far Cry 4
Both games make assumptions about the exact clear value for UNORM
render targets, which is incorrect on most Vulkan drivers.
2019-02-18 18:04:36 +01:00
Andrew Sheldon
be22756d2a Update DXVK_FILTER_DEVICE_NAME to support matching substrings
Why? RADV device names include the LLVM version, which means that on every LLVM
upgrade, the device name needs to be changed to match. This change allows setting
something like "AMD RADV VEGA10" which should remain persistent over time.
2019-02-17 08:32:03 +01:00
Philip Rebohle
fe781df591
[util] Enable relaxed barriers for Resident Evil 7
Same engine as Resident Evil 2, although the impact will be lower.
2019-02-15 20:59:33 +01:00
Philip Rebohle
11d2082fd2
[hud] Add 'api' option to show the client API 2019-02-15 18:05:44 +01:00
Philip Rebohle
10123ce9ab
[dxvk] Pass description of the client API to the DXVK device 2019-02-15 17:38:52 +01:00
Philip Rebohle
cbaeca8f43
[d3d11] Move sType/pNext initialization for dev.features to backend
There's no good reason to have this code in the D3D11 module.
2019-02-15 10:20:03 +01:00
Philip Rebohle
f7ed7b7118
[d3d11] Fix device feature enablement in some situations
- Geometry shaders are required by the backend
- FL9 already supports BC texture formats
2019-02-15 10:05:17 +01:00
Philip Rebohle
7056425bbd
[dxvk] Create state cache directory if it does not yet exist
We only create it if the parent directory already exists. Resolves #907.
2019-02-11 22:24:19 +01:00
Philip Rebohle
9bfa470581
[util] Implement createDirectory function 2019-02-11 21:59:46 +01:00
Philip Rebohle
629238ac36
[util] Implement tows method to convert strings to wide strings 2019-02-11 21:35:32 +01:00
Philip Rebohle
746562de5a
[dxgi,d3d11] Remove IDXGIVkPresentDevice 2019-02-11 20:06:12 +01:00
Philip Rebohle
fd445f7b4d
[d3d11] Move D3D11 presenter creation to WineDXGISwapChainFactory 2019-02-11 20:06:12 +01:00
Philip Rebohle
9f8c1d08a6
[dxgi,d3d11] Move swap chain creation to D3D11 module 2019-02-11 20:06:12 +01:00
Philip Rebohle
7ed91872b6
[dxgi] Use IWineDXGISwapChainFactory to create DXGI swap chains 2019-02-11 20:06:11 +01:00
Joshua Ashton
5ea8648cd9 [d3d11, d3d10, dxgi] Handle null ppvObject in QueryInterface. (#909)
When a null ppvObject is passed into a QueryInterface on any IUnknown, a E_POINTER should be returned as the result (and it should not crash.)

This matches native d3d11/d3d10/dxgi behaviour and the documentation found here https://docs.microsoft.com/en-us/windows/desktop/api/unknwn/nf-unknwn-iunknown-queryinterface(q_) for IUnknown.
2019-02-10 08:01:01 +01:00
Philip Rebohle
311661e404
[dxvk] Use vkCmdUpdateBuffer to clear tiny buffers
While this might consume a few more CPU cycles, UpdateBuffer may
be cheaper on the GPU for very small buffers, so we should use
it instead.

Also seems to fix rendering issues in Far Cry Primal for unknown reasons.
2019-02-09 22:21:57 +01:00
Philip Rebohle
8543f96413
[dxvk] Don't create flat 2D views for cube maps
Fixes a rendering issue in Heroes of the Storm, where the game
binds a cube map array to a resource slot which expects a 2D
view.

Refs #777.
2019-02-09 01:01:43 +01:00
Philip Rebohle
f6380fa152
[util] Enable relaxed barriers for Resident Evil 2
Improves performance by up to 10% when GPU-bound.
2019-02-08 01:38:03 +01:00
Philip Rebohle
e56710e64f
[d3d11] Add option to disable write-after-write barriers 2019-02-07 19:39:05 +01:00
Philip Rebohle
023cf01c3c
[dxvk] Implemet IgnoreWriteAfterWrite for compute shaders
When enabled, potential write-after-write hazards will be ignored and
no barrier will be inserted. Can improve performance in some cases.
2019-02-07 19:39:05 +01:00
Philip Rebohle
24dca37fce
[dxvk] Add methods to query source access type for an accessed resource 2019-02-07 19:39:05 +01:00
Philip Rebohle
9165f8c072
[dxvk] Add type and context method to set barrier control flags 2019-02-07 19:39:05 +01:00
Philip Rebohle
915091b76b
[dxbc] OpSDiv by 4 -> OpShiftRightLogical by 2 2019-02-07 19:32:07 +01:00
Philip Rebohle
8b80db7839
[dxbc] Fix storage class for UBO loads
UniformConstant is used for other things, UBOs are Uniform.
2019-02-05 21:28:50 +01:00
Philip Rebohle
9c4a6ee950
[utils] Enable strict division for Final Fantasy XIV
Fixes #904.
2019-02-05 21:28:27 +01:00
Philip Rebohle
c0b325b483
[dxbc] Add option to enable strict sm4-compliat division
SM4 is defined to return the first source operand if the divisor is zero.
Windows drivers don't do this by default, so we shouldn't do it either.
2019-02-05 21:08:13 +01:00
Philip Rebohle
a4378996d9
[dxbc] Reduce length of temporary shader input array to a minimum
Fixes severe performance regression with the AMD proprietary driver.
2019-02-04 13:30:08 +01:00
Philip Rebohle
6c17fa075b
[d3d11] Minor map optimization on deferred contexts 2019-02-04 10:26:04 +01:00
Philip Rebohle
8d493d9445
[d3d11] Minor map optimization on immediate contexts
We should make the fast path as fast as possible.
2019-02-04 10:24:30 +01:00
Philip Rebohle
01a7e06ad7
[dxvk] Inline DxvkBuffer::allocSlice and DxvkBuffer::freeSlice
Seems to take some load off both the main rendering thread and the
cleanup thread in SotTR.
2019-02-04 10:01:29 +01:00
Philip Rebohle
c451c9a95e
[dxvk] Only merge clears when framebuffer size matches view size
Otherwise, we'll only clear a smaller portion of the view, which is
incorrect. Fixes a rendering issue in Fallout New Vegas with DXUP.
2019-02-04 07:31:17 +01:00
Philip Rebohle
405bd737e0
[util] Disable nvapi hack for Far Cry 4 / Primal
Dunia engine games don't seem to like this either.
2019-02-04 07:09:37 +01:00
Philip Rebohle
e5a06d3f4a
[dxbc] Only load requested components from constant buffers
Results in better performance compared to loading the entire vector
on RADV. Suggested by Samuel Pitoiset.
2019-01-30 16:32:25 +01:00
Philip Rebohle
c360a196fb
[dxvk] Restore dedicated allocation behaviour
Whoops.
2019-01-30 15:49:06 +01:00
Philip Rebohle
412fb9ac57
[dxvk] Use VK_EXT_memory_budget to report memory usage 2019-01-30 15:45:57 +01:00
Philip Rebohle
b76f470c5f
[dxvk] Remove dxvk.allowMemoryOvercommit option
The default behaviour is now to allow overallocation by default,
which makes sense especially when VK_EXT_memory_priority is used.

Does not seem to affect Nvidia drivers.
2019-01-30 13:52:43 +01:00
Philip Rebohle
dfa8524e73
[dxvk] Wire up memory priority to device memory allocations 2019-01-30 13:52:43 +01:00
Philip Rebohle
03b488772d
[dxvk] Store device instead of adapter in memory allocator 2019-01-30 13:52:43 +01:00
Philip Rebohle
b884c56631
[dxvk] Enable VK_EXT_memory_priority and features if available 2019-01-30 13:52:43 +01:00
Philip Rebohle
e7bf1647dd
[dxvk] Use high memory priority for GPU-writable resources 2019-01-30 13:52:43 +01:00
Philip Rebohle
134613375d
[dxvk] Introduce concept of priorities to device-local memory allocations
The priority defines the importance of any given allocation being
resident in device-local memory rather than system memory, with
values between 0 (low) and 1 (high).

Suballocations will only work on chunks with the requested priority.
This ensures that high-priority allocations are reserved solely for
high-priority resources, and that high-priority resources will be
allocated from a high-priority memory chunk.
2019-01-30 13:52:43 +01:00
Philip Rebohle
35c7d687ff
[meta] Release 0.96 2019-01-26 18:41:48 +01:00
Philip Rebohle
af92bc9d9b
[utils] Disable nvapi hack for Mass Effect Andromeda
Fixes #886.
2019-01-26 18:38:58 +01:00
Philip Rebohle
1cc24c223b
[dxbc] Reduce length of tessellation i/o arrays to minimum
This allows us to fix a violation of the Vulkan specification
where using the same location range for per-vertex and per-patch
i/o is illegal.

May also help certain drivers figure out what's actually needed.
2019-01-26 17:12:23 +01:00
Philip Rebohle
b0b7960548
[dxbc] Add method to count required registers for signatures 2019-01-26 17:11:49 +01:00
Philip Rebohle
0b5cffb0bb
[dxbc] Parse patch constant signature 2019-01-26 14:52:29 +01:00
Philip Rebohle
3960355d47
[d3d11] Avoid redundant viewport updates in RSSetState
Rise of the Tomb Raider changes its rasterizer state very frequently
(once every handful of draws), and the viewport package is very large,
so we should avoid sending it to the CS thread redundantly.

We only need to update when the scissor test state has changed.
2019-01-23 05:36:49 +01:00
Philip Rebohle
df7573f332
[dxvk] Implement separate code path for clear-only render passes
Allows more clears to overlap with non-rendering commands
in case the app calls OMSetRenderTargets prior to the clear.
Also fixes a bug where we might accidentally use the wrong
set of color attachments to set up render pass operations.
2019-01-23 01:12:03 +01:00
Philip Rebohle
8cfb7936ed
[dxvk] Use explicit barriers after framebuffer clears
This may allow clears to overlap with subsequent commands unless a
barrier is actually required.
2019-01-23 01:12:03 +01:00
Philip Rebohle
2aeef063c1
[dxvk] Properly support TOP_OF_PIPE and BOTTOM_OF_PIPE for barriers 2019-01-23 01:12:03 +01:00
Philip Rebohle
1631243c64
[dxvk] Don't flush barriers in renderPassBindFramebuffer
Instead, any pending barriers must be flushed manually if necessary.
2019-01-23 01:11:55 +01:00
Philip Rebohle
5b90b6a7ce
[dxvk] Make external subpass dependencies part of DxvkRenderPassOps
This will allow us to use finer-grained synchronization around certain
meta operations involving render targets, such as clears.
2019-01-22 20:13:43 +01:00
Philip Rebohle
a79409ad02
Revert "[dxvk] Don't put rendering stage/access masks into image info"
This reverts commit ce3642edd0.

We're actually going to need these when optimizing render pass barriers.
2019-01-22 14:52:35 +01:00
Philip Rebohle
3109ab476a
[dxvk] Add support for general memory barriers
Affects all resources with compatible stage and access flags.
2019-01-22 14:31:10 +01:00
Philip Rebohle
b1540a16e8
[dxvk] Fix render pass ops in clearImageViewFb 2019-01-22 13:41:10 +01:00
Andrew Eikum
9ad24a2216 [d3d11] In D3D11CreateDevice, create DXGI factory with IDXGIFactory1 support (#878) 2019-01-22 10:57:05 +01:00
Philip Rebohle
cfc3f686bb
[util] Update per-app config overrides 2019-01-19 17:45:26 +01:00
Philip Rebohle
c3ae180c1a
[d3d11] Remove d3d11.fakeStreamOutput option
Only relevant on old drivers which do not support the extension.
Assumed to be enabled by default if Transform Feedback is not supported.
2019-01-19 17:39:59 +01:00
Philip Rebohle
4d4bd182c1
[d3d11] Allow arbitrary back buffer formats for swap chains
Doesn't match D3D11 behaviour, but shouldn't really break anything
since D3D11 has a fixed set of swap chain-compatible formats.

Might help DXUP in avoiding unnecessary framebuffer blits.
2019-01-19 02:28:25 +01:00
Philip Rebohle
4dac8e7233
[dxvk] Update buffer view in clearBufferView
Otherwise we might accidentally clear the wrong buffer region.
2019-01-18 21:29:05 +01:00
Philip Rebohle
9dbe352c51
[dxvk] Fix incorrect buffer view range for views with non-zero offset 2019-01-18 21:26:48 +01:00
Philip Rebohle
7e975bbdfc
[dxvk] Move blend constants and stencil ref state to DxvkDynamicState
For consistency with how depth bias is being stored.
2019-01-17 22:26:27 +01:00
Philip Rebohle
95815a075b
[dxvk] Move depth bias out of rasterizer state
While the previous model corresponded to D3D11, it does
not reflect that the backend treats it the same way as
e.g. blend constants.
2019-01-17 22:25:21 +01:00
Philip Rebohle
8cc4497f11
[dxvk] Only update index buffer for indexed draws
This is somewhat uncommon, but we sometimes bind an index
buffer in a render pass that doesn't get used at all.
2019-01-17 03:15:21 +01:00
Philip Rebohle
321feed728
[dxvk] Bump state cache version to v3
We're still going to try and fix up v2 entries. This may
cause unnecessary pipelines to be created for games that
actually use depth bias.
2019-01-17 02:32:09 +01:00
Philip Rebohle
0d84ebd4c9
[dxvk] DepthClampEnable -> DepthClipEnable
There are subtle differences between the two that we
should deal with in the backend at some point.
2019-01-17 01:59:10 +01:00
Philip Rebohle
4819287029
[d3d11] Do not enable depth bias if the parameters are zero 2019-01-17 00:53:54 +01:00
Philip Rebohle
422198952a
[dxvk] Use minimal set of dynamic state
We don't need to enable blend constants for pipelines that don't
have blending enabled, etc. This helps reduce the number of API
calls slightly and may help the driver work more efficiently.
2019-01-16 20:55:41 +01:00
Philip Rebohle
190f114449
[dxvk] Add methods to check which dynamic states a pipeline uses 2019-01-16 20:01:20 +01:00
Philip Rebohle
59462f3231
[dxvk] Don't re-emit dynamic state every time we bind a pipeline
This used to be necessary on some drivers that would lose dynamic
state upon pipeline bindings, but that no longer seems to be the
case.
2019-01-16 17:47:31 +01:00
Michal Srb
cc38412d04 [d3d11] Fix bad check in DrawInstancedIndirect (#863) 2019-01-15 11:12:03 +01:00
Philip Rebohle
109300d541
[d3d11] Remove unused syncMode option 2019-01-14 19:21:10 +01:00
Philip Rebohle
2bae3a5c8b
[d3d11] Reintroduce support for dxgi.maxFrameLatency
This option was previously ignored for some reason.
2019-01-14 18:29:25 +01:00
Entryhazard
7306c3153c [util] Change getEnvVar to use getenv (#859) 2019-01-13 21:27:59 +01:00
Philip Rebohle
ddce33692c
[meta] Release v0.95 2019-01-12 21:42:49 +01:00
Philip Rebohle
79eded9ae2
[d3d11] Only apply viewport and scissor rect if they have changed
Resident Evil 2 calls these functions before every single draw
call, so we should avoid emitting redundant viewport updates.
2019-01-12 20:22:08 +01:00
Philip Rebohle
c804d99db7
[d3d11] Fix log spam in SetEvictionPriority stubs 2019-01-12 15:22:34 +01:00
Philip Rebohle
bee21e7539
[dxbc] Support parsing the ISG1 and OSG1 signature chunks
Required to get the Resident Evil 2 demo to work.
2019-01-12 15:17:51 +01:00
Philip Rebohle
3935d2540e
[util] Get rid of explicit wchar_t parameter
We shouldn't be catering to Windows' weird string encoding mechanisms.
2019-01-11 13:43:15 +01:00
Philip Rebohle
4f0da40afa
[d3d11] Add some documentation to d3d11_cmd.h 2019-01-11 12:05:25 +01:00
Philip Rebohle
e665d896e3
[d3d11] Fix build errors on MSVC 2019-01-10 18:26:52 +01:00
Philip Rebohle
bbc3b3fb2b
[d3d11] Use multiDrawIndirect for subsequent indirect draw calls
Significantly improves performance in AC:Odyssey when CPU bound.
Only has an effect when no state changes between draw calls, and
when the draw parameter buffer is tightly packed.
2019-01-10 17:14:12 +01:00
Philip Rebohle
ad6233f74c
[d3d11] Enable multiDrawIndirect device feature if available 2019-01-10 16:59:53 +01:00
Philip Rebohle
f7dbcbe882
[dxvk] Introduce command type with extra data
The additional data is stored as a struct which can be
modified after submitting the command to the CS chunk.
2019-01-10 16:59:53 +01:00
Philip Rebohle
d12b2c6149
[util] Disable NVAPI hack for NFS2015 and CoD:WW2
Fixes #850.
Fixes #832.
2019-01-10 11:59:35 +01:00
Philip Rebohle
cf9de54a12
[dxgi] Add dxgi.nvapiHack option to disable NVAPI workaround 2019-01-10 11:58:16 +01:00
Philip Rebohle
9faf841f32
[dxvk] Remove DxvkPhysicalBuffer and friends 2019-01-09 18:05:01 +01:00
Philip Rebohle
8b5db80fbd
[dxvk] Reimplement DxvkBuffer
Avoids the DxvkPhysicalBuffer indirection and keeps all buffer
objects alive until the DxvkBuffer itself gets destroyed.
2019-01-09 18:04:46 +01:00
Philip Rebohle
cc61e38b9c
[dxvk] Reimplement DxvkBufferView
Instead of recreating the buffer view every single time the
underlying buffer gets invalidated, this keeps all buffer
views around until the object itself gets destroyed.
2019-01-09 18:02:00 +01:00
Philip Rebohle
61fdf4ef64
[dxvk] Use DxvkBufferSliceHandle for dummy resources 2019-01-09 18:02:00 +01:00
Philip Rebohle
c8e1813b07
[dxvk] Use DxvkBufferSliceHandle for staging buffers 2019-01-09 18:02:00 +01:00
Philip Rebohle
004db3677b
[dxvk] Use DxvkBufferSliceHandle for transform feedback 2019-01-09 15:13:04 +01:00
Philip Rebohle
17398e47bd
[dxvk] Use DxvkBufferSliceHandle for buffer memory barriers 2019-01-09 15:03:17 +01:00
Philip Rebohle
bbb7728b58
[dxvk] Introduce DxvkBufferSliceHandle
This struct is meant to replace DxvkPhysicalBufferSlice in the long
run, in a way that doesn't require extra reference counting.
2019-01-09 14:56:02 +01:00
Philip Rebohle
2f1f8ba0a4
[d3d11] Fix CheckMultisampleQualityLevels behaviour
- Querying DXGI_FORMAT_UNKNOWN should not return an error,
  and should advertize support for a sample count of 1
- Querying non-power of two sample counts should not fail
- Invalid arguments should be handled properly
2019-01-09 00:28:25 +01:00
Philip Rebohle
6282280f8d
[util] Enable raw SSBOs for FIFA 19
This game incorrectly binds a typed buffer view when the shader
expects a structured buffer. Using raw SSBOs matches Windows
behaviour in this case. Fixes #642.
2019-01-08 23:18:46 +01:00
Philip Rebohle
4fe5929799
[dxbc] Add options to enable/disble early discard and raw ssbo use 2019-01-08 20:58:18 +01:00
Philip Rebohle
524227d21c
[util] Add tristate config option type 2019-01-08 20:57:38 +01:00
Philip Rebohle
214891ffc6
[d3d11] Improve error logging when texture creation fails 2019-01-08 10:34:48 +01:00
Philip Rebohle
9890b87225
[dxbc] Fix incorrect error message 2019-01-08 00:46:24 +01:00
Philip Rebohle
d0ee7f54bf
[hud] Add DXVK_HUD=full option
Enables all HUD elements at once. Close #842.
2019-01-07 19:23:00 +01:00
Chip Davis
6feeb4bbba Only set 2D_ARRAY_COMPATIBLE on 3D textures that will be rendered to.
It is impossible to create a 2D or 2D array SRV or UAV from a 3D
texture. Nor is it possible to create a DSV from a 3D texture.
Therefore, the only time we ever need to create a 2D array view from a
3D texture is when we're going to render to it.
2019-01-02 19:15:23 +01:00
Robin
7a69135ba1 [d3d10] Check if d3d11 pointers are null 2019-01-02 19:13:42 +01:00
Robin
1750b14c2a [d3d11] Lock in SynchronizeCsThread
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes #567.
2018-12-30 21:08:52 +01:00
Robin
4c9af44356 [d3d10] Use context lock instead of separate device lock 2018-12-30 21:08:52 +01:00
Philip Rebohle
4e22e4bc3a [dxgi] Refactor swap chain creation
Cleans up constructor and moves a bunch of common code
to the new CreateDxvkSwapChainForHwnd function, which
can be called from both d3d11 and dxgi.

Also fixes potential issues with the current implementation
of the IWineDXGISwapChainFactory interface.
2018-12-21 15:53:29 +01:00
Philip Rebohle
15078357dc [dxgi] Implement and use GetWindowClientSize fuction
This new function provides a cleaner way to retrieve a
window's client size and can be used outside the swap
chain functions.
2018-12-21 15:14:07 +01:00
Philip Rebohle
1e393bf24d [d3d11] Implement IWineDXGISwapChainFactory
See #822.
2018-12-21 14:03:28 +01:00
Andrew Eikum
dc2cde3395 [vr] Cosmetic code cleanup, again
This reverts commit 20353f6f62f802bab9618b19940748af19cc1812, but fixes
openvr_api module refcounting.
2018-12-20 01:35:27 +01:00
Philip Rebohle
652525119f
[vr] Query required device extensions during instance creation
After the DXGI device refactor in c5deedef2d,
device extensions required for OpenVR interop would not be enabled correctly
because the VR-related code is now being called from both the D3D11 and DXGI
DLLs rather than just the DXGI DLL, and the D3D11 one is not in the expected
state when querying required device extensions. Querying them during instance
creation fixes that problem as it moves the relevant code back to the same
DLL which creates the Vulkan instance.
2018-12-20 01:32:56 +01:00
Philip Rebohle
f638689b2a
[d3d11] Remove some unnecessary type casts in interop code 2018-12-19 22:34:47 +01:00
Philip Rebohle
92f3648efa
[meta] Release 0.94 2018-12-15 13:54:57 +01:00
Philip Rebohle
e5beab2872
[dxbc] Rename struct_c0 -> c0_t etc. 2018-12-14 23:45:38 +01:00
Philip Rebohle
01b8e74457
[dxbc] Use raw SSBOs for raw and structured buffers if appropriate 2018-12-14 23:45:37 +01:00
Philip Rebohle
48548eb894
[dxbc] Add useRawSsbo option
ENabled when we can replace texel buffers for raw and structured
buffers with raw SSBOs.
2018-12-14 23:45:37 +01:00
Philip Rebohle
fd201c4c53
[dxvk] Bind buffer slice when binding buffer view
This is going to be necessary when we can bind raw buffer views as SSBOs.
2018-12-14 23:45:37 +01:00
Philip Rebohle
0bc2498570
[dxvk] Relax compute shader barriers for read-only storage buffers 2018-12-14 23:45:37 +01:00
Philip Rebohle
a0de90861c
[dxvk] Store access flags in resource slots
Makes distinguishing read-only resources from read-write
resources significantly easier.
2018-12-14 23:45:37 +01:00
Philip Rebohle
3fff5d56b3
[d3d11] Mark raw and structured buffers as potential storage buffers 2018-12-14 23:45:37 +01:00
Philip Rebohle
0d230eb447
[spirv] Add OpArrayLength instruction 2018-12-14 23:45:34 +01:00
Philip Rebohle
328871de7e
[d3d11] Re-introduce support for dxgi.numBackBuffers option 2018-12-14 14:58:36 +01:00
Philip Rebohle
64aefcc2a1
[dxgi] Catch exception when instance creation fails
Fixes #810.
2018-12-12 18:36:37 +01:00
Philip Rebohle
f276bcd0e7
[dxbc] Check for RADV/Nvidia drivers explicitly using the new function
This way, only RADV gets locked out of using early discard whereas
AMDVLK and -PRO are able to use it.
2018-12-12 16:27:01 +01:00
Philip Rebohle
598280dc3f
[dxvk] Add function to check for a specific driver / driver version 2018-12-12 15:43:39 +01:00
Philip Rebohle
6c992c7b02
[dxvk] Enable VK_KHR_driver_properties 2018-12-12 15:16:25 +01:00
Philip Rebohle
d16323f56b
[dxgi] Clean up DxgiAdapter 2018-12-11 16:03:37 +01:00
Philip Rebohle
a29b9f6779
[dxgi] Use new mode switch API for DxgiOutput
Also removes the old functions which are no longer needed.
2018-12-11 16:02:46 +01:00
Philip Rebohle
d9cf8fdc58
[dxgi] Use new mode switch API for DxgiSwapChain 2018-12-11 16:02:46 +01:00
Philip Rebohle
1594a20b94
[dxgi] Add new functions to change the display mode of a monitor 2018-12-11 16:02:35 +01:00
Philip Rebohle
1db3c6d883
[dxgi] Remove SetOutputData and GetOutputData methods 2018-12-11 15:33:54 +01:00
Philip Rebohle
aa2ec3f998
[dxgi] Port DxgiOutput and DxgiSwapChain to new monitor data API
This allows us to remove the dependency between DxgiSwapChain
and DxgiVkAdapter without losing gamma control emulation.
2018-12-11 15:32:54 +01:00
Philip Rebohle
e30bb498b6
[dxgi] Add functions to share per-monitor data between DXGI objects 2018-12-11 15:32:00 +01:00
Philip Rebohle
57e814717e
[dxgi] Move GetOutputFromMonitor to swap chain class
Not a great solution, but we only need it for the swap chain anyway.
2018-12-10 12:38:33 +01:00
Philip Rebohle
9e9e17348f
[dxgi] DxgiSwapchain: Remove SetGammaControl methods
These were only used internally to forward stuff to the presenter
anyway, so we might as well call that method directly.
2018-12-10 12:34:57 +01:00
Philip Rebohle
7eb60daf63
[dxgi] DxgiSwapchain: Take factory as IDXGIFactory
No need to be specific about the exact type of factory.
2018-12-10 12:10:15 +01:00
Philip Rebohle
9572425912
[dxvk] Clear color write mask if fragment shader output is undefined
Fallout 76 writes undefined data to one specific render target
otherwise. Refs #779.
2018-12-07 13:43:27 +01:00
Philip Rebohle
ef63328eb8
[d3d10] Initialize DSV pointer in OMGetRenderTargets
Completely redundant, but apparently MSVC refuses to compile the
code otherwise. Refs #801.
2018-12-07 13:43:14 +01:00
Philip Rebohle
86d4d31b7c
[dxgi] Ignore scaling and scanline order during fullscreen transitions
Games usually don't use these correctly anyway, so we might as well
ignore them, since DXVK's DXGI does not report scanline modes other
than UNSPECIFIED. Fixes #291.
2018-12-06 16:38:45 +01:00
Philip Rebohle
171cf53bc0 [dxvk] Don't re-initialize 3D images when clearing render targets
Layout transitions apply to the full subresource, even if we only
render to one slice. Fixes #775 on Nvidia Kepler and Maxwell cards.
2018-12-04 23:25:50 +01:00
Philip Rebohle
df667b7b0e
[dxgi] Report Adapter LUID if available 2018-12-04 19:39:09 +01:00
Philip Rebohle
033ea0c31b
[d3d11] Find Vulkan device if DXGI adapter was not created by DXVK
Tests the LUID, then the PCI device IDs, and finally falls back
to the first Vulkan device available on the system. This allows
DXVK's d3d11.dll to be used without its own dxgi.dll, as long
as presentation support is implemented in some way.

With the previous changes, based on zzhiyi/dxvk@0fc3a24d96

Co-authored-by: Zhiyi Zhang <zzhang@codeweavers.com>
2018-12-04 19:38:52 +01:00
Philip Rebohle
f7b3b9ca5c
[dxvk] Add new methods to find adapters by LUID or device ID
Co-authored-by: Zhiyi Zhang <zzhang@codeweavers.com>
2018-12-04 19:38:52 +01:00
Philip Rebohle
bb1f431e44
[dxvk] Query device ID information if available
Co-authored-by: Zhiyi Zhang <zzhang@codeweavers.com>
2018-12-04 19:38:52 +01:00
Philip Rebohle
1cc0455c8a
[dxgi] Remove old DXGIDevice implementation and IDXGIVkDevice
Both have been moved to the D3D11 module and are no longer needed.
2018-12-04 19:38:52 +01:00
Philip Rebohle
c5deedef2d
[d3d11] Move IDXGIDevice implementation to D3D11 module
Helps decouple the D3D11 module from the DXGI implementation. This
also allows us to clean up D3D11 device creation, which is much needed.

Based on zzhiyi/dxvk@fa441937f1

Co-authored-by: Zhiyi Zhang <zzhang@codeweavers.com>
2018-12-04 19:38:38 +01:00
Philip Rebohle
de29174d42
Revert "[vr] Cosmetic code cleanup"
This reverts commit a3bf90f5a3.

Crashes SuperHot VR for some reason.
2018-12-04 18:50:11 +01:00
Philip Rebohle
556e0d1dba Revert "[util] Report Nvidia GPU for Battlefield 1"
This reverts commit 500d67e002.

This game has some built-in driver detection on Nvidia which makes it
fail to start on non-Nvidia hardware or when nvapi is not present.
Fixes #795.
2018-12-02 20:27:39 +01:00
Philip Rebohle
835d92b802 [d3d10] D3D10CreateDeviceAndSwapChain: Ignore swap chain if null
Like e4b91057ac, this might fix some
issues with ReShade in D3D10 games.
2018-12-02 15:52:17 +01:00
Philip Rebohle
e4b91057ac [d3d11] D3D11CreateDeviceAndSwapChain: Ignore swap chain if null
Fixes some issue with ReShade.
2018-12-02 13:43:55 +01:00
Philip Rebohle
cf21111401
[d3d11] Implement ID3D11Multithread for D3D11 contexts 2018-11-30 11:38:00 +01:00
Philip Rebohle
28216909bd
[d3d10] Implement D3D10Multithread 2018-11-30 11:37:57 +01:00
Philip Rebohle
d1f179c5af
[util] Add likely/unlikely macros 2018-11-29 22:53:04 +01:00
Philip Rebohle
af2f5cc77f
[dxgi] Remove format lookup methods from IDXGIVkAdapter interface 2018-11-28 19:06:34 +01:00
Philip Rebohle
cc7f5c4bb1
[d3d11] Duplicate format table into D3D11 device
Removes the direct D3D11Device->DXGIAdapter dependency.
2018-11-28 18:34:05 +01:00
Philip Rebohle
193d24a3e2
[dxgi] Remove IDXGIVkBackBuffer 2018-11-28 18:15:27 +01:00
Philip Rebohle
092cad0e76
[dxvk] Remove DxvkSemaphore 2018-11-28 12:44:18 +01:00
Philip Rebohle
80b9f1d03b
[dxvk] Remove DxvkSurface 2018-11-28 12:44:18 +01:00
Philip Rebohle
9b923bb386
[dxvk] Remove DxvkSwapChain 2018-11-28 12:44:17 +01:00
Philip Rebohle
9139fbf95d
[d3d11] Use new Vulkan presenter 2018-11-28 12:44:17 +01:00
Philip Rebohle
81306cdc11
[dxvk] Support new Vulkan presenter in DxvkDevice 2018-11-28 12:44:17 +01:00
Philip Rebohle
746529b71b
[dxvk] Pass raw semaphore handles to submitCommandList 2018-11-28 12:44:17 +01:00
Philip Rebohle
a5c17f2753
[d3d11] Use flushCommandList method to flush initializer context 2018-11-28 12:44:17 +01:00
Philip Rebohle
979ccf23e3
[vulkan] Implement new Vulkan presenter / swap chain 2018-11-28 12:44:11 +01:00
Philip Rebohle
7096937c11
[dxbc] Use ballot to determine early-discard condition in fragment shaders 2018-11-27 11:50:01 +01:00
Philip Rebohle
0113e8f360
[spirv] Add subgroup ballot instructions 2018-11-27 11:50:01 +01:00
Philip Rebohle
4057937d2d
[dxvk] Refactor descriptor set allocation
With this new approach, descriptor pools are decoupled from the
command list they are used with. Instead, the DXVK context takes
ownership of a single descriptor pool until it runs out of memory.

This reduces the amount of memory wasted for under-utilized pools
and should this reduce an application's memory footprint.
2018-11-27 11:42:13 +01:00
Philip Rebohle
eb7a5da975
[dxvk] Rebalance descriptor set allocation
This should more closely reflect what applications actually use.
The basic idea here is that it is better for apps to run out of
descriptors before running out of sets and thus reduce the
overall memory footprint of the application.
2018-11-27 10:04:16 +01:00
Philip Rebohle
08b403f655
[d3d11] Fix potential UAV binding issue
When rebinding an already active UAV, we still need to
update the counter unless the app passed a value of -1.

Ref #712.
2018-11-26 17:18:35 +01:00
Philip Rebohle
500d67e002
[util] Report Nvidia GPU for Battlefield 1
Reportedly improves performance for some weird reason.
2018-11-26 08:04:30 +01:00
Philip Rebohle
2d55852777
[dxvk] Disable state cache for Anno 2205
Fixes #686.
2018-11-24 20:04:21 +01:00
Philip Rebohle
10b272b4c9
[meta] Release 0.93 2018-11-24 10:41:41 +01:00
Philip Rebohle
2424cf0289
[dxbc] Disable early discard on AMD cards
Causes GPU hangs.
2018-11-24 10:09:33 +01:00
Philip Rebohle
ce3642edd0
[dxvk] Don't put rendering stage/access masks into image info
Not needed since these stages and access flags are handled by render
pass transitions.
2018-11-24 00:40:59 +01:00
Philip Rebohle
8081dc1591
[util] Enable TGSM initialization for Quantum Break
Fixes artifacting on Mesa 18.3.
2018-11-23 16:12:09 +01:00
Philip Rebohle
a75c596132
[d3d11] Add config option to enable TGSM initialization 2018-11-23 16:12:02 +01:00
Philip Rebohle
ea5f11d091
[dxbc] Implement function to clear thread-group shared memory
Can be enabled in case a game reads undefined data from TGSM.
2018-11-23 15:57:54 +01:00
Philip Rebohle
79a6dd111e
[dxbc] Store workgroup size for compute shaders 2018-11-23 14:39:33 +01:00
Philip Rebohle
3e686098cc
[dxbc] Disable subgroup early discard on Nvidia GPUs
People report performance regressions up to 5% with it enabled.
2018-11-23 12:28:48 +01:00
Philip Rebohle
6dd82dfe03
[dxbc] Clamp written depth value to (0.0, 1.0)
Fixes shadow issue in Overwatch (#738).
2018-11-23 12:00:23 +01:00
Philip Rebohle
0418c02ac3
[dxbc] Use clustered subgroup operations on supported hardware 2018-11-21 11:17:09 +01:00
Philip Rebohle
ab17c49c4e
[dxbc] Fix compiler warning about uninitialized values 2018-11-21 11:17:09 +01:00
Philip Rebohle
4f76b89941
[dxbc] Use subgroup operations for early discard
Can improve performance in some complex fragment shaders.
2018-11-21 11:17:09 +01:00
Philip Rebohle
a574829bb6
[dxbc] Remove DeferKill flag
This behaviour is correct, and needs to be enabled by default.
2018-11-21 11:17:09 +01:00
Philip Rebohle
968a085f1e
[dxvk] Query device subgroup properties
Also query the device properites for this extension as well
as support for subgroup operations on this device.
2018-11-21 11:17:09 +01:00
Philip Rebohle
67e10246cb
[dxvk] Request Vulkan 1.1 instance
Falls back to a regular 1.0 instance on old drivers.
We need to do this in order to legally use SPIR-V 1.3.
2018-11-21 11:17:09 +01:00
Philip Rebohle
59d0ad4413
[spirv] Add non-uniform group instructions 2018-11-21 11:17:09 +01:00
Philip Rebohle
dbd7db3328
[dxvk] Fix typo around dual-src blending
Fixes e744117042
2018-11-20 19:55:08 +01:00
Philip Rebohle
bcd5a9235c
[dxvk] Make use of VK_AMD_memory_overallocation_behavior
Currently only supported on AMDVLK. Enforces memory limits on a driver
level unless the corresponding dxvk.allowMemoryOvercommit option is enabled.
2018-11-20 15:50:41 +01:00
Philip Rebohle
99f6953e89
[dxvk] Store DXVK options directly with the instance object 2018-11-20 15:50:01 +01:00
Philip Rebohle
81765de35b
[util] Remove default options that spoof AMD GPUs
This is no longer necessary due to the nvapi workaround.
2018-11-20 13:17:36 +01:00
Philip Rebohle
5d49644cdc
[dxgi] Hack: Report Nvidia cards as AMD cards by default
Prevents UE4 games from repeatedly trying to load nvapi.dll
on a performance-critical code path.
2018-11-20 13:15:39 +01:00
Philip Rebohle
bfb7e54218
[d3d11] Rename dcMapSpeedHack to dcSingleUseMode 2018-11-20 11:37:48 +01:00
Philip Rebohle
ad5688764c
[d3d11] Use single-use submission mode for CS chunks where possible 2018-11-20 10:44:04 +01:00
Philip Rebohle
c61200d35f
[dxvk] Introduce single-use mode for CS chunks
This allows us to reset the CS chunk immediately while executing it,
which can reduce the overhead of the reset operation and may lead to
resources being released earlier.
2018-11-20 10:35:23 +01:00
Philip Rebohle
e744117042
[dxvk] Patch fragment shader for dual-source blending 2018-11-19 17:07:05 +01:00
Philip Rebohle
f69c5e4c4e
[dxbc] Emit Index decoration for pixel shader outputs
Simplifies shader patching when dual-source blending is used.
2018-11-19 16:57:11 +01:00
Philip Rebohle
3e3c31f365
[spirv] Add support for Index decoration
Needed for dual-source blending
2018-11-19 16:57:08 +01:00
Philip Rebohle
5aad615aef
[dxvk] Unbind graphics pipeline when spilling render pass
Otherwise we may in some very rare cases continue using an incorrect
pipeline in subsequent render passes if the same shaders are used for
drawing.
2018-11-19 01:35:41 +01:00
Philip Rebohle
85f0fe729c
[dxvk] Move DxvkEventTracker to dxvk_event.{h,cpp}
The upcoming new event and query classes will follow this design.
Reduces the number of files around these small classes.
2018-11-17 01:17:03 +01:00
Andrew Eikum
aea4162198 [dxgi] MultiByteToWideChar counts length in characters 2018-11-16 19:53:37 +01:00
Philip Rebohle
e4d3357e55
[dxgi] Query window size before creating presenter
Otherwise we may pass a size of zero to the presenter.
2018-11-16 15:03:09 +01:00
Derek Lesho
66bcc4b3d8 Use std::string for util::getEnvVar input
This allows cleaner code when implementing DXVK as a native library
2018-11-16 06:43:45 +01:00
Philip Rebohle
c25483e856
[dxgi] Implement IDXGISwapChain3
- Stub IDXGISwapChain3::ResizeBuffers1
2018-11-15 18:02:27 +01:00
Philip Rebohle
81bb561c75
[dxgi] Implement IDXGIAdapter3 2018-11-15 18:02:21 +01:00
Philip Rebohle
171251bc83
[dxgi] Implement IDXGIFactory4
Do not support WARP adapters for the moment.
2018-11-15 17:08:36 +01:00
Philip Rebohle
0b7e114cb0
[dxgi] Implement IDXGIDevice3 2018-11-15 17:08:36 +01:00
Philip Rebohle
23ac9b5277
[dxgi] Implement IDXGISwapChain2 stubs
Most of the additions are stubs for now, but we should be
able to implement most of the functionality at a later time.

None of the backends implement this yet, but this should be
relatively easy to do.
2018-11-15 17:08:35 +01:00
Philip Rebohle
a849ffc56c
[dxgi] Implement IDXGIOutput3 2018-11-15 17:08:35 +01:00
Philip Rebohle
9af842801c
[dxgi] Implement IDXGIFactory3 2018-11-15 17:08:35 +01:00
Philip Rebohle
f03d87b918
[dxgi] Implement IDXGIOutput1
Required for DXGI 1.2.
2018-11-15 17:08:35 +01:00
Philip Rebohle
f7b2194e0b
[dxgi] Include DXGI 1.4 headers 2018-11-15 17:08:27 +01:00
Philip Rebohle
1af96347e1
[dxvk] Forward memory allocation statistics to the adapter 2018-11-15 17:08:05 +01:00
Philip Rebohle
d49de734b7
[dxvk] Set low thread priority for pipeline compiler threads
This currently does not have any effect when using regular wine, but
if it ever gets supported then these background jobs should have less
of an influence on the game's performance when they kick in.
2018-11-15 12:19:24 +01:00
Philip Rebohle
305168d2bb
[util] Add method to set thread priority 2018-11-15 12:17:18 +01:00
Philip Rebohle
6adf534589
[dxvk] Add option to set number of pipeline compiler threads 2018-11-15 09:24:11 +01:00
Philip Rebohle
4db5c21ec5
[dxvk] Use ticket lock to synchronize access to query objects
Lowers overhead in the uncontested case compared to std::mutex, and
prevents the main rendering thread from blocking updates for too long.
2018-11-13 17:05:37 +01:00
Philip Rebohle
63d42073b8
[util] Add ticket lock implementation 2018-11-13 17:05:06 +01:00
Philip Rebohle
1724d51079
[dxgi] Refactor presenter creation
This change is needed to support non-D3D11 presenters in our DXGI code.
2018-11-12 11:39:34 +01:00
Philip Rebohle
8d2f8fca64
[meta] Release v0.92 2018-11-11 16:16:01 +01:00
Philip Rebohle
6f28ce5809
[dxvk] Do not require GL_EXT_samplerless_texture_functions
Ubuntu ships a version of the GLSL compiler that does not support
this extension yet, so building DXVK fails on those systems.
Closes #760.
2018-11-11 15:48:07 +01:00
Philip Rebohle
a971370524
[dxbc] Implement Dmovc instruction
Fixes some mandelbrot demo mentioned in #216.
2018-11-10 23:27:56 +01:00
Philip Rebohle
0cfa5b16d3
[d3d11] Support R11G11B10 format in ClearUnorderedAccessViewUint
Silences an error message in Shadow of the Tomb Raider. Does not have
any consequences for this game because it initializes the view to 0.
2018-11-10 18:48:44 +01:00
Philip Rebohle
05856e836b
[d3d11] Don't enable StorageImageReadWithoutFormat feature for FL11_0
We don't really need this, although it might be useful in the future.
2018-11-10 11:34:23 +01:00
Philip Rebohle
504de3994b
[dxvk] Inline DxvkBufferView::updateView method
Most of the time the condition is false, so we should help
the compiler where we can to optimize for the common case.
2018-11-09 11:40:44 +01:00
Philip Rebohle
bd03225c14
[dxbc] Refactor DxbcOptions
A bit mask isn't good enough going forward, and we also don't
need application-specific options for now.
2018-11-09 08:41:02 +01:00
Philip Rebohle
ab3ba776e0
[d3d11] Do not re-upload mapped image if it was mapped for reading 2018-11-08 18:51:53 +01:00
Philip Rebohle
4d103aad5d
[d3d11] Allow mapping depth-stencil images for reading
This may be needed for The Surge and Lords of the Fallen.
2018-11-08 18:51:47 +01:00
Philip Rebohle
f483bc9633
[d3d11] Add usage flag for meta-pack operations if necessary
- Fix depth-stencil format list
2018-11-08 18:51:43 +01:00
Philip Rebohle
81a5e2fa0c
[d3d11] Add helper to find exact mapping for depth-stencil formats
This is necessary in situations when we need to get the Vulkan format
that corresponds to the DXGI format rather than the remapped one.
2018-11-08 18:51:43 +01:00
Philip Rebohle
2b02e692c3
[dxvk] Implement DxvkContext::copyDepthStencilImageToPackedBuffer 2018-11-08 18:10:56 +01:00
Philip Rebohle
d7d1db1b8b
[dxvk] Add convenience method to retrieve image descriptor 2018-11-08 18:10:56 +01:00
Philip Rebohle
fc8f49899a
[dxvk] Create instance of depth-stencil packing objects 2018-11-08 18:10:56 +01:00
Philip Rebohle
119c06e453
[dxvk] Add pipelines needed for depth-stencil packing
- Add method to retrieve meta pack pipeline for a given format
- Add descriptor update template
2018-11-08 18:10:49 +01:00
Philip Rebohle
863f2d07fd
[dxvk] Add compute shaders for depth-stencil packing 2018-11-08 18:10:49 +01:00
Philip Rebohle
0dbac29729
[dxvk] Add packed size to depth-stencil formats 2018-11-08 18:10:49 +01:00
Philip Rebohle
70b14f9dbf
[dxvk] Report app name to the Vulkan implementation
Because why not?
2018-11-07 21:54:00 +01:00
Philip Rebohle
f32aff29fa
[d3d11] Clear compressed images if they do not get initialized
This probably makes Quantum Break run even worse, but I don't really
care at this point. Fixes #744.
2018-11-07 18:41:07 +01:00
Philip Rebohle
7ed9f36769
[dxvk] Add clearCompressedColorImage method
Since we can't use regular clears for compressed
formats, we need a new method to zero image memory.
2018-11-07 18:31:01 +01:00
Philip Rebohle
2d8c9c6a26
[vulkan] Add makeSubresourceLayers helper 2018-11-07 18:30:44 +01:00
Philip Rebohle
3d2e5a7cde
[util] Spoof Nvidia card for Elite Dangerous 2018-11-06 17:03:01 +01:00
Philip Rebohle
780780f8d1
[dxbc] Don't enable sample shading for interpolation functions
Actually doesn't resolve #456, and doesn't make any sense either because
interpolation at a given sample index is apparently supposed to work even
without using sample shading.
2018-11-05 18:30:32 +01:00
Philip Rebohle
2ee7ef7689
[dxbc] Enable sample shading when using interpolation functions
Fixes artifacts on RADV when enabling MSAA in World of Warcraft (#456).
2018-11-05 17:07:11 +01:00
Philip Rebohle
5a1b37b770
[build] Don't use empty dependencies
Fixes build error with Meson 0.44.
2018-11-05 07:55:36 +01:00
Philip Rebohle
e0f1510901
[meta] Release 0.91 2018-11-04 17:23:27 +01:00
dhewg
a05c93dd17 cross build cleanup (#746)
- Don't turn off warnings for winelib builds, fix them. Using __declspec on winelib builds just doesn't make sense.
- Drop the custom cross property 'winelib'. Detect it instead.
- Move the libdl dependency to the build system
- Don't run wine during mingw build process. Same as for wine builds, see 715d2571
2018-11-04 16:18:32 +01:00
Philip Rebohle
b6ded02a5d
[dxvk] Pull 'if's into commit{Graphics,Compute}State methods
Improves performance because GCC generates silly code around those
if blocks, most of which have a false condition anyway. Improves
performance of 100k empty draw calls with no state changes by as
much as 25%.
2018-11-03 00:51:02 +01:00
Philip Rebohle
963bd66fb3
[dxvk] Use new vulkan helpers to create VkImageSubresourceRange structs 2018-11-02 19:42:53 +01:00
Philip Rebohle
a97073adb9
[dxvk] Move vulkan helpers to vulkan module 2018-11-02 19:42:29 +01:00
Philip Rebohle
d5481ac013
[d3d11] Remove redundant D3D11Buffer::GetSize method 2018-11-02 15:43:46 +01:00
Philip Rebohle
851d9fb726
[general] Remove unnecessary include directories from build files
These are no longer needed because dxvk includes consistently
use relative file paths now, instead of global includes.
2018-11-02 14:54:39 +01:00
Philip Rebohle
93d88afab9
[general] Fix some old includes 2018-11-02 14:37:59 +01:00
Philip Rebohle
1cd912556e
[dxvk] Move Vulkan loader to separate directory 2018-11-02 14:23:45 +01:00
Philip Rebohle
45a234607a
[dxvk] Track device / instance ownership
This allows us to use the Vulkan function loader for a vkd3d device.
2018-11-02 14:13:07 +01:00
Philip Rebohle
175385481e
[dxvk] Insert barrier before CS image view clear only if needed
Removes one unnecessary sync point in Claybook.
2018-11-01 21:48:22 +01:00
Philip Rebohle
f5b21d42fc
[dxvk] Open state cache file only when necessary
Fixes an issue with Shadow of the Tomb Raider randomly nuking its cache
when it creates not one but *two* D3D11 devices.
2018-11-01 16:35:49 +01:00
Philip Rebohle
8054e4a772
[dxvk] Add DXVK context method to transparently flush the command list
This is identical to what the D3D11 function did, but having it in this
place will allow us to potentially implement better flush heuristics
based on work done on the CS thread.
2018-11-01 13:24:42 +01:00
Philip Rebohle
36ccd46ae7
[dxvk] Move sampler border color handling to the backend 2018-10-31 21:51:23 +01:00
Philip Rebohle
e15e693dc4
[dxvk] Spill render pass for pipelines that use vertex stage UAVs
We cannot use simple pipeline barriers in this case because of the
extremely strict restrictions surrounding self-dependencies.
2018-10-30 14:43:52 +01:00
Philip Rebohle
76b63efedb
[dxvk] Use self-dependency to synchronize SSBO writes
While this doesn't support vertex stages yet, it should be faster
when the pipeline writes to storage resources from the fragment
shader.

We should analyze the vertex stage shaders for SSBO writes in
order to determine whether to spill the render pass.
2018-10-30 14:11:27 +01:00
Philip Rebohle
43ed820be9 [d3d11] Remove state tracking for UAV rendering
This scenario is now properly handled by the DXVK state tracker.
2018-10-29 12:12:34 +01:00
Philip Rebohle
fd52022fff [dxvk] Spill render pass after draws with storage resources 2018-10-29 12:12:34 +01:00
Philip Rebohle
9decfb34b7 [dxvk] Determine whether a graphics pipeline writes to resources
- Fix missing test for storage texel buffers
2018-10-29 12:12:34 +01:00
Philip Rebohle
ec8559f40a [dxvk] Remove unneeded atomic that holds base pipeline handles
No longer needed because the full pipeline object gets locked anyway.
2018-10-29 12:11:33 +01:00
Philip Rebohle
a53e053391
[dxbc] Fix incorrect data type for explicit interpolation instructions 2018-10-25 22:25:13 +02:00
Philip Rebohle
5a30110d0f
Revert "[d3d11] Remove some flush points"
This reverts commit 5ab6f691ae.

Apparently this leads to extremely bad frame times on some Nvidia setups.
2018-10-25 20:55:37 +02:00
Philip Rebohle
422cf71c55
[util] Spoof Nvidia GPU for The Vanishing of Ethan Carter Redux
For some reason it crashes with AMD cards, but apparently not in D3D code.
Closes #732.
2018-10-25 18:31:55 +02:00
Philip Rebohle
941db96f79
[dxvk] Remove obsolete DxvkShaderKey constructor 2018-10-25 11:30:02 +02:00
Philip Rebohle
c9ce09e098
[d3d11] Respect xfb metadata when computing shader hash
Closes #733.
2018-10-25 11:28:02 +02:00
Philip Rebohle
7eeeeaa625
[util] Provide method to compute SHA-1 hash from multiple data chunks
The underlying implementation supports this trivially, so we should
provide a way to use this feature.
2018-10-25 10:34:38 +02:00
Philip Rebohle
589229f4ca
[dxgi] Query device interface from the presenter
Removes the coupling between IDXGISwapChain and IDXGIDevice.
This is necessary because D3D12 devices don't support IDXGIDevice.
2018-10-24 15:54:56 +02:00
Philip Rebohle
7b9726fd93
[d3d11] D3D11Presenter -> D3D11PresentDevice 2018-10-23 15:10:01 +02:00
Philip Rebohle
83b51a66ac
[dxgi] Don't build shaders for presentation
These are now embedded in the D3D11 module.
2018-10-23 14:58:57 +02:00
Philip Rebohle
86e6477e80
[dxgi] Remove unused presenter options 2018-10-23 14:58:57 +02:00
Philip Rebohle
3b5b20ca3f
[dxgi] Remove old DXGI presenter 2018-10-23 14:58:57 +02:00
Philip Rebohle
b53f6661f8
[dxgi] Use new presenter for D3D11 2018-10-23 14:58:57 +02:00
Philip Rebohle
967b276acb
[d3d11] Add COM interface for API-agnostic presenter 2018-10-23 14:58:57 +02:00
Philip Rebohle
64185d9be4
[d3d11] Move some DXGI presenter options to D3D11 2018-10-23 14:58:57 +02:00
Philip Rebohle
8cb4852a61
[d3d11] Add new D3D11 swap chain code
- Fix deferred surface creation
2018-10-23 14:58:39 +02:00
Philip Rebohle
db2880acfd
[dxvk] Update blend constants only when they have actually changed
Reduces number of redundant state changes in Resonance of Fate.
2018-10-22 15:35:56 +02:00
Andreas Heider
ac0f8d6a64
Spoof AMD GPU for Assetto Corsa Competizione 2018-10-22 10:57:54 +02:00
Błażej Szczygieł
57718dcf84 [util] Spoof AMD GPU for SAO FB
Improves performance by not trying to load nvapi.
2018-10-22 10:51:48 +02:00
Philip Rebohle
5124fd87d5
[d3d11] Implicitly flush when queueing an event query
Significantly improves GPU utilization in Quake Champions.
2018-10-17 17:28:47 +02:00
Philip Rebohle
5ecfbd8425
[d3d11] Do not use QueryInterface to get query pointers
We're not going to implement counters anyway, so this is
unnecessary overhead.
2018-10-17 17:28:47 +02:00
Philip Rebohle
5ab6f691ae
[d3d11] Remove some flush points
These aren't as useful as they may look like since they occur
at render pass boundaries anyway.
2018-10-17 17:28:47 +02:00
Philip Rebohle
f14d17b743
[d3d11] Don't mark context methods as 'final' 2018-10-17 17:28:47 +02:00
Philip Rebohle
11b269efd1
[d3d11] Save a few CPU cycles in Map/MapBuffer 2018-10-16 12:29:04 +02:00
Philip Rebohle
e0e945f724
[d3d11] Show SetPredication message only when the predicate is not NULL
Helps determine which games actually use the feature.
2018-10-15 19:35:50 +02:00
Philip Rebohle
56e9bba279
[dxgi] Fix scaling when swap image extent mismatches window size
In Proton 3.16, the window size is not necessarily equal to the size
of the WSI swap chain and DXVK is responsible for doing the scaling,
so we should compare to the actual swap image size instead.
2018-10-15 18:35:00 +02:00
Philip Rebohle
254cd8bd06
[dxvk] Optimize image descriptor updates
Avoids unnecessary atomic operations when rendering to a framebuffer
with a depth attachment.
2018-10-15 16:35:40 +02:00
Philip Rebohle
890e5f8c9c
[meta] Release v0.90 2018-10-13 16:31:32 +02:00
Philip Rebohle
6b5aa0b928
Merge branch 'vk_transform_feedback' 2018-10-13 08:00:51 +02:00
Philip Rebohle
8172d347be
Revert "[d3d10] Implement ID3D10Multithread"
This reverts commit 55d6eae210.

We probably don't need it, and the current implementation is broken.
2018-10-12 19:29:52 +02:00
Philip Rebohle
8630ee235a
[util] Re-enable D3D10 for Bioshock 2018-10-12 19:06:53 +02:00
Philip Rebohle
55d6eae210
[d3d10] Implement ID3D10Multithread 2018-10-12 19:06:05 +02:00
Philip Rebohle
e549c9303b
[d3d10] Respect D3D10_CREATE_DEVICE_SINGLETHREADED flag
May improve performance in games which do not need the locking behaviour.
2018-10-12 18:36:02 +02:00
Philip Rebohle
6d18efdfc7
[d3d10] Lock device on context operations
May fix thread safety issues in some games. Apparently, the
D3D10Device is supposed to be thread safe by default.
2018-10-12 18:31:55 +02:00
Tk-Glitch
502af0f866 [util] Spoof AMD GPU for Dauntless and Redout.
It silences some nvapi related warnings and improves performance on both titles by up to 10%.
Also fixes a random crash on Redout.
2018-10-12 12:43:58 +02:00
Fredrick Lockert
27026f48a2 [util] Spoof AMD card for Star Citizen 2018-10-12 07:10:13 +02:00
Philip Rebohle
406816d17c
[d3d10] Support pOffsets parameter in SOGetTargets 2018-10-10 19:55:42 +02:00
Philip Rebohle
93a851a2fc
[d3d11] Implement DrawAuto method 2018-10-10 19:55:42 +02:00
Philip Rebohle
44024e7a7a
[d3d11] Implement Stream Output queries 2018-10-10 19:55:42 +02:00
Philip Rebohle
93753a5ce7
[d3d11] Bind transform feedback buffers in SOSetTargets 2018-10-10 19:55:41 +02:00
Philip Rebohle
97d776cc00
[d3d11] Allocate counter for stream output buffers 2018-10-10 19:55:41 +02:00
Philip Rebohle
0d89dfae95
[d3d11] Report format support for stream output buffers 2018-10-10 19:55:41 +02:00
Philip Rebohle
7369dee9d6
[d3d11] Create passthrough geometry shader if necessary
Fixes stream output in Unity Engine titles.

- Fix compilation with new DxbcProgramInfo struct.
2018-10-10 19:55:41 +02:00
Philip Rebohle
5463dc7e6c
[d3d11] Implement CreateGeometryShaderWithStreamOutput
- Emit error instead of warning when enabling rasterization
2018-10-10 19:55:26 +02:00
Philip Rebohle
f42ea9f1d1
[d3d11] Set transform feedback usage, stage and access flags 2018-10-10 13:05:38 +02:00
Philip Rebohle
3a48092630
[dxvk] Implement transform feedback draw call 2018-10-10 13:05:37 +02:00
Philip Rebohle
929b75a038
[dxvk] Add support for transform feedback queries 2018-10-10 13:05:37 +02:00
Philip Rebohle
4bdf6daa39
[dxvk] Add structure for transform feedback stream queries 2018-10-10 13:05:37 +02:00
Philip Rebohle
3435702719
[dxvk] Add basic support for indexed queries 2018-10-10 13:05:37 +02:00
Philip Rebohle
76d917df20
[dxvk] Add xfb counter write -> xfb counter read barrier
- Update xfb counter barrier
2018-10-10 13:05:37 +02:00
Philip Rebohle
93b1b9bc00
[dxvk] Implement transform feedback
Begins transform feedback when rendering with an xfb-enabled
pipeline bound, and ends transform feedback as needed, while
writing back the counters supplied by the app. This does not
yet support transform feedback queries or the draw command.
2018-10-10 13:05:37 +02:00
Philip Rebohle
a27e440272
[dxvk] Detect Xfb and set rasterized stream index 2018-10-10 13:05:37 +02:00
Philip Rebohle
1f135f59ed
[dxvk] Add Xfb API stubs 2018-10-10 13:05:37 +02:00
Philip Rebohle
52e1671167
[dxvk] Add Xfb context state 2018-10-10 13:05:37 +02:00
Philip Rebohle
989a10ab88
[dxvk] Enable transform feedback device feature if available
- Enable geometryStreams feature
2018-10-10 13:05:37 +02:00
Philip Rebohle
e27083a04f
[dxvk] Query transform feedback device properties if available 2018-10-10 13:05:37 +02:00
Philip Rebohle
13ecbcaaf5
[dxvk] Enable VK_EXT_transform_feedback 2018-10-10 13:05:37 +02:00
Philip Rebohle
61d56a1732
[dxvk] Add definitions for transform feedback entry points 2018-10-10 13:05:37 +02:00
Philip Rebohle
bf906aa226
[dxvk] Add support for transform feedback access flags 2018-10-10 13:05:37 +02:00
Philip Rebohle
d2c62a8645
[dxbc] Implement passthrough geometry shader
This is needed when vertex or domain shader code is
passed to CreateGeometryShaderWithStreamOutput.

- Fix compilation with new DxbcProgramInfo.
2018-10-10 10:28:15 +02:00
Philip Rebohle
017699df15
[dxbc] Implement Xfb output declarations and setup 2018-10-10 10:28:15 +02:00
Philip Rebohle
bb780bbe10
[dxbc] Add Xfb decorations 2018-10-10 10:28:15 +02:00
Philip Rebohle
6a5fe2247a
[dxbc] Add support for multiple streams in geometry shaders 2018-10-10 10:28:15 +02:00
Philip Rebohle
a42f03e32d
[dxbc] Add Xfb structures to DxbcModuleInfo 2018-10-10 10:28:15 +02:00
Philip Rebohle
eff81c7edf
[dxvk] Implement getShader method for graphics pipelines 2018-10-10 10:28:12 +02:00
Philip Rebohle
e5f3019524
[dxgi] *Actually* silence WaitForVBlank warning
Guess who needs more coffee.
2018-10-09 19:17:20 +02:00
Philip Rebohle
08b241b3ea
[d3d11] Add option to disable deferred context mapping speed hack
Fixes a regression in The Evil Within.

We should probably find a proper solution, but for now this is the best
thing we can do for games which reuse command lists.
2018-10-09 17:07:50 +02:00
Philip Rebohle
6dd5cdbc3e
[dxgi] Silence WaitForVblank warning 2018-10-09 14:48:49 +02:00
Andre Heider
8fcdf78b51 [dxbc] rename DxbcProgramVersion to DxbcProgramInfo
The version in not part of this class anymore.
2018-10-08 12:32:01 +02:00
Andre Heider
8492f0501e [dxbc] Drop unused major/minor from DxbcProgramVersion 2018-10-08 12:32:01 +02:00
Philip Rebohle
781ee00f5c
[dxvk] Refactor indirect draw/dispatch commands
Introduces an OpenGL-style bind point for the argument buffer, which
means we can avoid a lot of unnecessary reference tracking in games
that do a lot of indirect draw calls.

Reduces CPU overhead in Assassin's Creed Odyssey.
2018-10-08 10:23:18 +02:00
Philip Rebohle
eb55325640
[dxvk] Fix missing buffer tracking for indirect draw calls
This is optimized to allow a large number of indirect draws to be
submitted if they all access the same argument buffer, as is the
case in Assassin's Creed Syndicate and Odyssey.
2018-10-07 17:51:44 +02:00
Philip Rebohle
af16461858
[dxvk] Fix missing indirect dispatch barriers and tracking 2018-10-07 17:33:03 +02:00
Philip Rebohle
417b6cb6dc
[dxvk] Reduce CPU overhead of indirect draw calls 2018-10-07 17:09:46 +02:00
Philip Rebohle
87f1cd2385
[dxgi] Fix undefined display mode format for display mode transitions
Fixes resolution change option in Dark Souls 3.
2018-10-06 08:01:48 +02:00
Philip Rebohle
09bbb68d98
[meta] Release v0.81 2018-10-05 21:14:11 +02:00
Philip Rebohle
a3bf90f5a3
[vr] Cosmetic code cleanup 2018-10-04 12:30:26 +02:00
Andrew Eikum
bc367fd817
[vr] Load native openvr library on winelib builds 2018-10-04 12:08:12 +02:00
Philip Rebohle
0b4f1b6d6f
[d3d11] Implement DiscardView and DiscardResource for images 2018-10-01 16:54:34 +02:00
Philip Rebohle
0d9e714d3e
[dxvk] Add discardImage method 2018-10-01 16:54:34 +02:00
Philip Rebohle
da76d74a2d
[dxvk] Minor internal buffer API cleanup 2018-09-30 11:05:20 +02:00
Philip Rebohle
aaaf2c53e0
[dxvk] Don't reset unused bind points
Saves a few CPU cycles when binding resources.
2018-09-29 20:23:00 +02:00
Philip Rebohle
387f41ede5
[dxvk] Make DxvkBuffer destructor explicit
Prevents compiler from inlining massive amounts of code where it's
not needed. This is more consistent with the other classes as well.
2018-09-29 20:19:07 +02:00
Philip Rebohle
da8274daaf
[d3d11] Don't set meta-resolve usage flags for depth buffers
Depth buffers cannot be resolved in D3D11.
May improve performance on some hardware when MSAA is used.
2018-09-29 14:59:36 +02:00
Philip Rebohle
894d9606d5
[dxgi] Add option to force-enable MAILBOX present mode
Provides Enhanced Sync-like functionality (#678).
2018-09-29 08:13:52 +02:00
Philip Rebohle
de4c88d5aa
[d3d11] Skip CopyResource when src and dst resource are the same 2018-09-28 19:41:27 +02:00
Philip Rebohle
c9d61e16d9
[d3d11] Skip ResolveSubresource when dst and src resource are the same
Fixes black screen issue in Mortal Kombat X (#670).
2018-09-28 19:41:16 +02:00
Philip Rebohle
33408a8a74
[dxvk] Fix stencil state assignment
Not really important since we don't use stencil anyway,
but we should at least populate the struct correctly.
2018-09-27 21:04:49 +02:00
Philip Rebohle
161fb6215a
[d3d11] Optimize UAV binding
- UpdateBuffer is faster than ClearBuffer for small updates.
- We shouldn't dispatch *two* CS commands for each UAV, one is enough.
2018-09-27 16:50:34 +02:00
Philip Rebohle
518ab2ebdd
[dxvk] Refactor resolve ops
Brings this more in line with clear and copy operations, which
both have more than one code path. Also optimizes barriers.
2018-09-27 12:42:20 +02:00
Philip Rebohle
c5f7f9f3b0
[d3d11] Enable usage flags for meta copy formats
This is required in order to make meta copies work between images
that do not have the necessary D3D11 bind flags set, and it may
speed things up because it allows rendering to the destination
image directly rather than requiring a temporary image.
2018-09-27 11:44:09 +02:00
Philip Rebohle
509e6f1abf
[dxvk] Use new meta copy for depth <> color image copies 2018-09-27 11:44:09 +02:00
Philip Rebohle
fad2e13882
[dxvk] Add meta copy code
The current way of copying data between incompatible images is slow
and does not work for multisampled images. This new code implements
a render pass which performs an exact copy of the source data.
2018-09-27 11:44:09 +02:00
Philip Rebohle
c11d492597
[dxvk] Add meta copy shaders
Used to copy between depth and color images.
2018-09-27 11:44:09 +02:00
Philip Rebohle
b73b91a5c9
[dxgi] Implement slightly better QueryResourceResidency stub
This now returns redidency values for all queried resources, but
not the correct ons. May fix issues in Fallout 4?
2018-09-27 07:31:30 +02:00
Philip Rebohle
63d7770870
[dxvk] Flush queued barriers when binding any frame buffer
We need to flush when starting meta render passes as well.
2018-09-25 21:32:21 +02:00
Philip Rebohle
8bcd47d6dc
[dxvk] Simplify pipeline object locking
Any more complex approach is not very useful at the moment
because we have to put a lock around the actual compile
function anyway.
2018-09-25 18:22:58 +02:00
Philip Rebohle
0be291e123
[dxvk] Don't do image-to-buffer copies for multisampled images
Vulkan does not allow this.
2018-09-25 14:37:53 +02:00
Philip Rebohle
305c361c00
[d3d11] Fix incomplete usage mask for buffer UAVs 2018-09-25 10:14:42 +02:00
Philip Rebohle
ddfa7e40b3
[dxvk] Renove redundant vkDestroyPipeline 2018-09-24 22:54:49 +02:00
Philip Rebohle
a950872c7c
[dxvk] Check whether the vertex binding / attribute count is valid 2018-09-24 16:22:12 +02:00
Philip Rebohle
1e40a14a50
[d3d10] Disable D3D10 support for Bioshock 2018-09-24 15:30:13 +02:00
Philip Rebohle
bd4338be42
[d3d10] Add option to enable or disable D3D10 support 2018-09-24 15:26:33 +02:00
Philip Rebohle
04ed4273ba
[dxvk] Avoid buffer slice copy when binding index/vertex buffers
Also redesigns getDescriptor to always return the offset.
2018-09-23 20:09:01 +02:00
Philip Rebohle
1c865328d3
[meta] Release v0.80 2018-09-23 19:01:15 +02:00
Philip Rebohle
b49876528a
[dxvk] Enable state cache for compute pipelines
Also cleans up some code to get the design more in line
with how graphics pipelines are handled.
2018-09-23 14:42:03 +02:00
Philip Rebohle
6c8ac9e5f4
[dxvk] Add compute shader support to pipeline state cache 2018-09-23 14:42:03 +02:00
Philip Rebohle
689602497f
[d3d11] Use state cache 2018-09-23 14:41:49 +02:00
Philip Rebohle
4a72cae1e6
[dxvk] Enable state cache 2018-09-23 14:41:43 +02:00
Philip Rebohle
57dab630b5
[dxvk] Add pipeline state cache
Stores state vectors for graphics pipelines in a file and allows
games to start compiling them in advance on subsequent launches.

Changes:
(1) Add environment variable to select the cache file path
(2) Add magic number and entry size to cache file header
2018-09-22 22:38:35 +02:00
Philip Rebohle
d6742e38c5
[dxvk] Lock pipeline object while compiling one pipeline
This prevents us from compiling the exact same pipeline twice
at the same time, which for some reason crashes RADV.
2018-09-22 12:04:06 +02:00
Philip Rebohle
0e2d63f6d2
[dxvk] Add method to retrieve shader key from shader module 2018-09-22 12:04:06 +02:00
Philip Rebohle
f3a23ab81f
[util] Add convenience method for SHA1 hash compulation 2018-09-22 12:04:06 +02:00
Philip Rebohle
83447975ac
[dxvk] Refactor pipeline stat counters
The stat counter struct no longer has to be passed to
the pipeline compiler function.

The new implementation uses atomic counters of the pipeline manager
rather than per-command list counters, which removes the need to
pass the counter structure to the compiler function.
2018-09-22 12:02:20 +02:00
Philip Rebohle
5410680401
[dxvk] Refactor pipeline object constructors
This way we don't need to pass everything to the pipeline objects.
2018-09-22 11:59:25 +02:00
Philip Rebohle
9284081180
[dxvk] Remove redundant declaration 2018-09-21 19:43:47 +02:00
Philip Rebohle
0f52ec2796
Revert "[dxvk] Move command submission to separate thread"
This reverts commit f61ff5d345.

Apparently, this causes extremely poor frame times on some
configurations. Reason is currently unknown.
2018-09-20 19:58:00 +02:00
Philip Rebohle
2eda95f61a
[dxvk] Optimize retrieval of dynamic buffer offsets 2018-09-20 15:19:33 +02:00
Philip Rebohle
f61ff5d345
[dxvk] Move command submission to separate thread
- Reduces load on the CS thread and the main rendering thread.
- This takes into account that VR apps access the queue as well.
2018-09-20 14:43:06 +02:00
Philip Rebohle
539cc77b6e
[dxvk] Eliminate buffer slice copy when updating buffer descriptors 2018-09-20 12:10:43 +02:00
Philip Rebohle
03a760bec6
[meta] Remove redundant linker entries for the utils library
Fixes #651.
2018-09-19 21:00:44 +02:00
Philip Rebohle
35238ec4d1
[d3d11] Make D3D11 context methods more robust to null pointers
Assetto Corsa tries to do some questionable things when reflections
are disabled in the game options. Refs #648.
2018-09-19 12:33:30 +02:00
Philip Rebohle
c1190e81b2
[d3d11] Handle pResource == nullptr case during view creation 2018-09-19 11:55:11 +02:00
Philip Rebohle
837a3f5787
[d3d11] Don't allow creation of 0x0-sized textures 2018-09-18 21:33:27 +02:00
Philip Rebohle
bf5476900a
[d3d11] Expose Feature Level 11_1
- We don't actually support the ExtendedResourceSharing feature, but
  since we currently don't support resource sharing at all, this makes
  no difference in practice
- Likewise, MultisampleRTVWithForcedSampleCountOne is not really
  supported, as the Vulkan backend will still use the sample count
  of the color attachments, but should have no effect in practice.
- This does not change the fact that Predication and Stream Output
  are still missing.
2018-09-18 16:27:40 +02:00
Philip Rebohle
d9009efd22
[d3d11] Implement and advertize support for CopyWithOverlap feature 2018-09-18 16:22:47 +02:00
Philip Rebohle
e3c2815782
[dxvk] Add copyBufferRegion and copyImageRegion methods
These new methods can support overlapped subresource copies by
creating a temporary resource and effectively using two copy
operations. This is required for D3D11 overlapped copies.
2018-09-18 16:20:57 +02:00
Philip Rebohle
3f47fdab4d
[d3d11] Advertize support for the ForcedSampleCount rasterizer state 2018-09-18 13:23:28 +02:00
Philip Rebohle
482930f04a
[dxvk] Implement backend support for D3D11 forced sample count
We don't support rasterization with a sample count different from
the framebuffer sample count, but if there are no attachments, any
sample count is allowed.
2018-09-18 13:22:28 +02:00
Philip Rebohle
4469ef1ec1
[d3d11] Replace shader debug name with shader key 2018-09-18 10:35:27 +02:00
Philip Rebohle
a078bb947e
[d3d11] Replace D3D11ShaderKey with DxvkShaderKey 2018-09-18 10:35:08 +02:00
Philip Rebohle
0843e2211c
[dxvk] Add new DxvkShaderKey to represent unique shader key 2018-09-18 10:35:08 +02:00
Philip Rebohle
12efd88726
[dxvk] Avoid more unnecessary copies of ref-counted pointers
Improves performance measurably in Shadow Warrior 2 when CPU bound.
2018-09-17 23:42:34 +02:00
Philip Rebohle
3a1fbdaaf1
[dxvk] Avoid buffer slice copy when tracking buffer views 2018-09-17 23:30:36 +02:00
Philip Rebohle
6c889c0005
Revert "[d3d11] Avoid unnecessary buffer slice copy when mapping buffer"
This reverts commit 72106a02cb.

Breaks things for some reason. Doesn't have much of an impact anyway.
2018-09-17 23:08:00 +02:00
Philip Rebohle
72106a02cb
[d3d11] Avoid unnecessary buffer slice copy when mapping buffer 2018-09-17 22:04:31 +02:00
Philip Rebohle
820904f22d
[dxvk] Optimize ref counting around resource tracking
Micro-optimization that reduces the number of atomic increments
and decrements when moving reference-counted objects around.
2018-09-17 20:42:08 +02:00
Philip Rebohle
f42f708f72
[dxvk] Rename DxvkBindingState -> DxvkBindingMask
Preparation for some more binding-related work.
2018-09-17 10:45:28 +02:00
Philip Rebohle
eac86fab15
[dxvk] Do not map allocations that don't need a HOST_VISIBLE memory type
Should reduce the amount of virtual memory used on systems without
dedicated VRAM. Refs #640.
2018-09-17 09:08:00 +02:00
Philip Rebohle
19408f0ebe
[d3d11] Fix reported RowPitch/DepthPitch for mapped buffers
Some games rely on this being the exact buffer size.
2018-09-17 07:45:05 +02:00
Philip Rebohle
a78dc3b444
[dxvk] Do not store a strong reference from adapter to instance
The instance stores an array of adapters now. Fixes crash when
using the device filter, and fixes the instance not getting
destroyed.
2018-09-16 19:11:15 +02:00
Philip Rebohle
fde67b9773
[dxgi] IsCurrent is not actually a stub 2018-09-16 10:20:24 +02:00
Philip Rebohle
c8e0c253ba
[dxvk] Simplify graphics pipeline instance management 2018-09-16 10:07:45 +02:00
Philip Rebohle
b6bf72aeb6
[dxvk] Fix some legacy cruft around Vulkan instance creation 2018-09-15 14:16:56 +02:00
Philip Rebohle
364e15d11a
[dxvk] Remove all remaining pipecompiler code 2018-09-14 17:22:56 +02:00
Philip Rebohle
18927dc958
[dxvk] Remove asynchronous pipeline compiler 2018-09-14 16:46:07 +02:00
Jens Peters
d4947261c6
[util] Improve logging of configuration options 2018-09-14 15:34:46 +02:00
Philip Rebohle
922f0382f6
[dxvk] Remove option for asynchronous shader compilation
Unsafe.
2018-09-13 20:40:32 +02:00
Philip Rebohle
059073fcd0
[dxbc] Fix missing hull shader input declarations
Fixes tessellation in Tomb Raider 2013. Closes #368.
2018-09-13 18:25:32 +02:00
Philip Rebohle
797c568c74
[dxbc] Use temporary array for per-patch hull shader outputs
Drivers don't seem to like it when output arrays are addressed dynamically.
2018-09-13 15:17:39 +02:00
Philip Rebohle
d86b5361f0
[dxvk] Only mark render targets as used on draw calls 2018-09-13 12:00:49 +02:00
Philip Rebohle
9e3914b368
[dxvk] Remove redundant parameter from DxvkCommandList constructor 2018-09-12 18:54:05 +02:00
Philip Rebohle
2d93452cba
[util] Spoof Nvidia card for Assassin's Creed Syndicate
This one actually doesn't work properly when the AMD AGS library
is not present, but is fine with nvapi not being there.
2018-09-12 14:10:49 +02:00
Philip Rebohle
1127a344dc
[dxvk] Fix query type enablement in query manager
We cannot use query types as flag indices, since query
types added in the future may have gretaer enum values
than 32.
2018-09-11 13:01:00 +02:00
Philip Rebohle
f9add97a07
[d3d11] Fix Begin/End for all queries other than Event and Timestamp 2018-09-11 13:00:52 +02:00
Philip Rebohle
ea6b6e2e53
[dxvk] Rename useAsyncPipeCompiler -> asyncPipeCompiler 2018-09-11 08:38:18 +02:00
Philip Rebohle
ea9e812798
[dxvk] Introduce new 'Created' state for queries
New initial state for queries. D3D11 returns an error when trying to
retrieve data from a query in this state, rather than S_FALSE or S_OK.
2018-09-10 23:07:51 +02:00
Philip Rebohle
d7441f274b
[dxvk] Enable device features for VK_EXT_vertex_attribute_divisor 2018-09-10 22:10:16 +02:00
Philip Rebohle
ba65a1e36b
[dxvk] Query new Vertex Attribute Divisor features
This was added in revision 3 of the extension.
2018-09-10 21:46:14 +02:00
Philip Rebohle
f5270c8522
[dxvk] Collect info about the supported revisions of an extension 2018-09-10 21:40:40 +02:00
Philip Rebohle
5c89a68879
[dxvk] Implement render target state tracking for async compilation
This ensures that we always render to targets which are only used once.
2018-09-10 19:41:17 +02:00
Philip Rebohle
f94f5a74ba
[dxvk] Add methods to track render target view usage 2018-09-10 18:05:52 +02:00
Philip Rebohle
c7ddaea5a6
[dxvk] Add method to retrieve current frame number 2018-09-10 18:05:33 +02:00
Philip Rebohle
5cc2c219dd
[dxvk] Use all but two available threads for async pipeline compilation 2018-09-10 17:03:11 +02:00
Philip Rebohle
6532302e34
[util] Implement dxvk:🧵:hardware_concurrency 2018-09-10 17:02:51 +02:00
Philip Rebohle
c3b542878c
[dxvk] Repurpose asynchronous pipeline compiler
Removes support for DISABLE_OPTIMIZATION_BIT. Instead, pipelines
will not be made available until compiled by one of the worker
threads.
2018-09-10 17:02:42 +02:00
Philip Rebohle
012a5c2f74
[d3d11] Add option to enforce anisotropic filtering
When setting d3d11.samplerAnisotropy to a non-negative value,
AF will be either disabled (0) or enabled with the given
anisotropy (>0) for all samplers.
2018-09-10 15:42:55 +02:00
Philip Rebohle
16a3ae52fe
[dxbc] Remove emitCsSystemValueLoad
There are no compute shader system values.
2018-09-10 11:50:13 +02:00
Philip Rebohle
f8dc5612f7
[d3d11] Added option to limit tessellation factors
d3d11.maxTessFactor accepts values ranging from 8 to 64, and limits
the maximum tessellation factor accordingly.
2018-09-09 23:14:00 +02:00
Philip Rebohle
2541aeb25c
[dxgi] Add option to override the sync interval 2018-09-09 19:14:30 +02:00
Philip Rebohle
d7b16dd90a
[dxgi] Add option to change the back buffer count 2018-09-09 19:12:07 +02:00
Philip Rebohle
b7d8be25f1
[dxgi] Use DXGI back buffer count for the Vulkan swap chain 2018-09-09 19:07:41 +02:00
Philip Rebohle
45f61cbae5
[dxvk] Fix initial query state
Trying to retrieve data from newly created D3D11 queries is supposed
to return S_FALSE and not return data, so we shouldn't mark the query
as available immediately after creation.
2018-09-09 14:35:09 +02:00
Jens Peters
e48c27ac30 [util] Spoof AMD card for Batman: Arkham Knight (#627)
This prevents game crashes in "Detective Mode" for NVidia cards.
Fixes https://github.com/doitsujin/dxvk/issues/580
2018-09-08 16:33:44 +02:00
MartinPL
f949240b2f Spoof AMD card for GTA V
GTA V working out of box on Proton for Nvidia users. Tested
#624
https://github.com/ValveSoftware/Proton/issues/37#issuecomment-415833819
2018-09-08 12:51:39 +02:00
Philip Rebohle
60796a8143
[util] Spoof AMD card for Dragon Quest XI
This game for some reason seems to keep searching for NVAPI DLLs
and runs at an extremely low framerate as a result. Fixes #622.
2018-09-07 07:50:08 +02:00
Philip Rebohle
108a6645e6
[dxbc] Make emitRawBufferLoad more readable 2018-09-06 21:44:53 +02:00
Philip Rebohle
57e5b05f32
[d3d11] Fix layer count for 3D RTVs with non-zero base mip level
We have to take the mip level into account as well, or otherwise
we may create a view with more layers than the selected mip level has.
2018-09-04 07:39:46 +02:00
Philip Rebohle
2533b9f4ed
[dxvk] Fix layer count for 2D views into 3D images 2018-09-04 07:38:47 +02:00
Philip Rebohle
9520c9b1b8
[dxbc] Apply Modulo 31 to bit counts and offsets (shr/shl/bfe/bfi)
Assassin's Creed Syndicate relies on correct behaviour.
2018-09-03 01:01:44 +02:00
Philip Rebohle
09948a3495
[d3d11] Synchronize CS thread after flush when waiting for resource
In some rare cases, the flush operation itself may add new references
which we need to see while spinning on the resource's usage counter.
2018-09-01 21:25:39 +02:00
Philip Rebohle
2b3d9aaf5c
[dxvk] Remap spec constant ranges
Keeping the numbers low will make debugging shaders easier.
glslang seems to have an upper limit on spec constant IDs
in place.
2018-09-01 20:41:25 +02:00
Philip Rebohle
825200b2a2
[dxvk] Don't change spec constant IDs that are no valid resource slots
Fixes pipeline state-related specialization constants.
2018-09-01 20:27:36 +02:00
Philip Rebohle
ffc2130ee6
[d3d11] Pass format swizzle to render target views
Fixes missing caterpillars in World of Tanks (#410).
2018-09-01 18:15:31 +02:00
Philip Rebohle
05e505a844
[dxbc] Implement pixel shader output component mapping 2018-09-01 18:15:27 +02:00
Philip Rebohle
70786aeee8
[spirv] Support OpVectorExtractDynamic instruction 2018-09-01 17:59:50 +02:00
Philip Rebohle
cb274e040d
[dxvk] Add spec constants for pixel shader output mapping 2018-09-01 17:59:50 +02:00
Philip Rebohle
37a8743dbc
[dxvk] Add output component mask state to graphics pipelines
This is required in order to implement swizzled render target views.
We currently use this to remap color write masks as needed.
2018-09-01 17:59:50 +02:00
Philip Rebohle
7c97e276f2
[dxvk] Fix up component swizzle for render target views
Vulkan does not support non-identity swizzles for image views that are
used for rendering, but we have to keep the information around in order
to support rendering to swizzled image formats.
2018-09-01 15:51:56 +02:00
Philip Rebohle
f74661daa4
Revert "[util] Limit device memory size to 4095 MB for Life is Feudal MMO"
This reverts commit 73cbf5b352.

The workaround is no longer necessary due t a game update.
Closes #614.
2018-08-31 22:54:16 +02:00
Philip Rebohle
2f90213c0f
[dxvk] Enable pipeline statistics queries around compute shaders
Fixes potential issues caused by csInvocations being 0.
2018-08-31 16:24:03 +02:00
Philip Rebohle
657093c14e
[dxvk] Refactor query management
Moved all query-related state tracking and management into a
separate class. This allows for new query types to be added
in the future, and makes less dodgy assumptions about the
current state when beginning or ending a query.
2018-08-31 15:38:09 +02:00
Jacek Caban
9fd30cf5bf [util] Handle WCHAR strings in str::format. 2018-08-31 05:37:34 +02:00
Philip Rebohle
66d1bed083
[d3d11] Remove old UAV counter buffer implementation 2018-08-30 15:32:46 +02:00
Philip Rebohle
5c45a50daf
[d3d11] Use D3D11CounterBuffer for UAV counters 2018-08-30 15:24:47 +02:00
Philip Rebohle
9992ba1a79
[d3d11] Add more general counter buffer allocator
We're going to need it for more than just UAV counters soon.
2018-08-30 15:24:38 +02:00
pchome
ff604d5a53 [d3d10] Fix d3d11 dependecy for winelib build 2018-08-28 12:52:45 +02:00
Philip Rebohle
f1b075c0f3 [dxvk] Add CS chunk pool
Reduces the number of dynamic memory allocations for CS chunks by
recycling them once they are no longer needed. Also fixes a potential
issue with chunks that are dispatched multiple times.
2018-08-27 16:07:38 +02:00
Philip Rebohle
b75b7d0999 [dxvk] Simplify discardBuffer access flags
Specifying both read and write access is unnecessary, as the dirty
check will always return true for writes when it would also return
true for reads.
2018-08-27 14:50:47 +02:00
Philip Rebohle
01cc49555a [dxbc] End functions correctly even if last instruction is not 'ret'
Some DXBC shaders don't end in a return instruction, but rather implicitly
end when all branches end in a return instruction. Fixes an illegal shader
generated in Crysis 1.
2018-08-27 14:29:40 +02:00
Philip Rebohle
34152a01a5 [dxvk] Add device filter
When setting DXVK_FILTER_DEVICE_NAME, only devices with a
matching device name will be reported to the application.
2018-08-27 14:22:14 +02:00
Philip Rebohle
5f42950650 [dxgi] Don't use FIFO present mode if IMMEDIATE is not available
Might fix potential performance issues on Nvidia when VSYNC is disabled.
Based on RPCS3/rpcs3@25ec3789fe
2018-08-26 23:39:53 +02:00
Philip Rebohle
08a9963734 [dxvk] Fix clear compute shaders for 2D array views
The Z component is not part of the image extent. Fixes #598.
2018-08-26 20:08:16 +02:00
Philip Rebohle
0704b044a9 [dxgi] Fix format parameter in CheckImageFormatSupport 2018-08-26 12:37:12 +02:00
Philip Rebohle
2bdd614d07 [dxgi] Log display mode changes 2018-08-26 12:37:12 +02:00
Nikolay Sivov
d464d11fbd [d3d10] Fix resource type for buffers. 2018-08-26 12:16:09 +02:00
Philip Rebohle
73cbf5b352 [util] Limit device memory size to 4095 MB for Life is Feudal MMO
Reporting 4GB or more VRAM causes an integer overflow in this game.
Fixes #591.
2018-08-25 01:23:22 +02:00
Philip Rebohle
57db0b60fb [dxgi] Add option to limit reported device memory size 2018-08-25 01:22:19 +02:00
Joshua Ashton
48697346c0 [d3d10] Implement Get/SetTextFilterSize using the behaviour D3D10 exhibits (#587) 2018-08-22 01:32:59 +02:00
jacekcw
2ff614b241 [build] Use native Vulkan ABI for winelib builds (#520)
Allows 32-bit winelib builds to run.
2018-08-17 19:55:37 +02:00
Philip Rebohle
55632c6b61
[util] Add log message when loading a configuration file 2018-08-17 19:42:32 +02:00
Philip Rebohle
7fa6dddc9e
[dxgi] Remove dxgi.fakeDx10Support option
No longer needed because we have actual Dx10 support now.
2018-08-17 12:33:53 +02:00
Philip Rebohle
b51361eaa9
Revert "[dxbc] Work around OpControlBarrier issue on radv 18.2-git"
This reverts commit 9293acfeb5.

This issue is caused by an LLVM bug, which now has a workaround in RADV:
https://cgit.freedesktop.org/mesa/mesa/commit/?id=71d5b2fbf83061a1319141d26942771e8c75ff2b
2018-08-17 11:50:36 +02:00
Philip Rebohle
f75e3ad13f
[d3d11] Fix silly GenerateMips bug 2018-08-16 00:57:16 +02:00
Philip Rebohle
c3c7a4172d
[d3d11] Fix interface query for ID3D11Predicate 2018-08-16 00:13:40 +02:00
Mikhail Paulyshka
2a96d717d3 [d3d11] fixed compilation with MinGW-headers 6.0.0 or greater 2018-08-15 22:02:39 +02:00
Mikhail Paulyshka
9cce41394b [build] partially revert previous d3dcompiler related change 2018-08-15 21:59:44 +02:00
Philip Rebohle
e271bc490e
[d3d11] Enable ExtendedDoublesShaderInstructions 2018-08-15 20:12:41 +02:00