Commit Graph

3046 Commits

Author SHA1 Message Date
Philip Rebohle c7718e5952
[d3d11] Zero-initialize UAV counters
Fixes a hang in Dirt Rally on RADV.
2019-11-18 18:40:39 +01:00
Philip Rebohle cee7db1c57
[dxvk] Always align texel buffers to at least 16 bytes
Since we don't know the view format in advance, and some
drivers require single-texel alignment.
2019-11-18 13:45:35 +01:00
Philip Rebohle 73a5b33375
[d3d11] Also fix reset counter memory order for deferred context queries 2019-11-15 19:48:41 +01:00
Philip Rebohle e787077554
[util] Remove traces of the allowMapFlagNoWait option 2019-11-15 19:45:40 +01:00
Philip Rebohle c24dad75dc
[d3d11] Remove allowMapFlagNoWait option 2019-11-15 11:09:11 +01:00
Philip Rebohle dbc14fe65c
[d3d11] Fix memory order for query reset counter
Probably doesn't change anything, but let's fix it anyway.
2019-11-14 23:43:58 +01:00
Philip Rebohle a6483e02fe
[d3d11] Submit stalling event queries before flushing
Otherwise, instead of preventing syncs, this would actually
have the opposite effect.
2019-11-14 22:57:30 +01:00
Philip Rebohle 3457e312b0
[dxvk] Always align index buffer slices to 256 Bytes
To be on the safe side.
2019-11-14 14:32:01 +01:00
Philip Rebohle 420d95e396
[dxvk] Store shader capability information in separate set of flags 2019-11-12 18:05:03 +01:00
Philip Rebohle 1ca235d186
[util] Disable strict DC mode for MGSV again
Not necessary since the resubmitted contexts don't contain mapped buffers.
2019-11-12 00:59:33 +01:00
Philip Rebohle 4f7e7979e3
[util] Add app profile for Metal Gear Solid 5 2019-11-11 23:31:14 +01:00
Philip Rebohle cc18730967
[dxvk] Enable option to disable OpenVR integration 2019-11-11 23:30:35 +01:00
Philip Rebohle 9f66351b82
[dxvk] Move extension provider list to DxvkInstance 2019-11-11 23:30:07 +01:00
Philip Rebohle 6948d18f5f
[dxvk] Always align vertex buffer slices to 256 bytes
Works around an unknown geometry rendering isssue in Warhammer Chaosbane.
Should probably be investigated at some point.
2019-11-10 22:37:11 +01:00
Philip Rebohle 31baf3529a
[d3d11] Fix uninitialized DSV flags
Fixes #1242.
2019-11-10 15:02:21 +01:00
Philip Rebohle 4b199ef60d
[dxvk] Remove option to disable transfer queue 2019-11-08 11:29:22 +01:00
Philip Rebohle a74449c367
[dxvk] Remove ability to query instance from adapter
Adapters don't hold a reference to the instance.
2019-11-08 11:28:08 +01:00
Philip Rebohle 77574d9970
[d3d11] Don't query DXVK instance from adapter 2019-11-08 11:25:58 +01:00
Philip Rebohle b2317cad4d
[dxvk] Pass DXVK instance to DXVK device directly, not through the adapter 2019-11-08 11:17:02 +01:00
Philip Rebohle 212f5ba1f3
[dxgi] Query DXVK instance from DXGI factory, not the adapter 2019-11-08 11:06:15 +01:00
Philip Rebohle ed8af3ccc4
[dxvk] Document wonky DxvkAdapter ref count behaviour 2019-11-07 21:08:20 +01:00
Philip Rebohle a0dba6bbf9
[d3d11] Hold reference to DxvkInstance
Hack to keep the instance alive which owns the adapters. Should
fix #1240 for now, but we should fix this properly later on.
2019-11-07 20:21:27 +01:00
Philip Rebohle b18c50d5ab
[dxvk] Use static variables for extension provider instances
Also, remove redundant interface documentation.
2019-11-07 01:35:10 +01:00
Joshua Ashton dbf2407fd3 [dxvk] Implement extension provider system
This change introduces a new system for providing extra instance/device extensions.

This consolidates platform-specific and vr-related to its' own thing for potential future cross-platform/native Linux work.
2019-11-07 01:24:52 +01:00
Joshua Ashton 27898ebbfc [build] Simplify and correct errors in options handling
Fix some typos...

D3D10 is dependent on D3D11 therefore DXGI is always dependent on D3D11
2019-11-07 01:24:52 +01:00
Joshua Ashton 4ad99feb73 [build] Demote no frontends/tests to a warning 2019-11-07 01:24:52 +01:00
Philip Rebohle 1d961b7dc3
[d3d11] 'a' is not a very good name for a variable 2019-11-04 13:46:18 +01:00
Philip Rebohle 77a0cb2b19
[d3d11] Don't synchronize with CS thread on present
Instead, submit from the CS thread in order to prevent out-of-order
submissions. Improves minimum FPS in Final Fantasy XIV by 5-10%.
2019-11-02 17:53:17 +01:00
Philip Rebohle e6c3f0479d
[dxvk] Let device know that async presentation is enabled 2019-11-02 17:53:17 +01:00
Philip Rebohle d96c22be05
[d3d11] Do not synchronize with CS thread in GetData
Instead, use a counter to determine whether there are any
pending operation for the query on the CS thread.
2019-11-02 17:53:17 +01:00
Philip Rebohle 0924bb469c
[d3d11] Move query state tracking to immediate context implementation 2019-11-02 17:53:17 +01:00
Philip Rebohle be5dc234c1
[d3d11] Move common Begin/End implementation to immediate context 2019-11-02 13:48:03 +01:00
Philip Rebohle 63dbca82e7
[d3d11] Track used queries in deferred contexts and command lists 2019-11-02 13:48:03 +01:00
Philip Rebohle 0671007437
[d3d11] Only execute Begin for scoped queries 2019-11-02 13:48:03 +01:00
Philip Rebohle 1459f0e852
[util] Fix != and == operator for private/public COM pointers 2019-11-02 13:48:00 +01:00
Philip Rebohle 1780c549e5
[d3d11] Only add storage buffer usage flag to constant buffers if needed
Otherwise, the backend optimization for dynamic uniform buffers will not
kick in.
2019-10-30 10:58:05 +01:00
Philip Rebohle e95bc3256f
[d3d11] Move handling of constantBufferRangeCheck option to D3D11Options 2019-10-30 10:57:36 +01:00
Philip Rebohle 9e084e63ca
[d3d11] Remove useless members from D3D11DeferredContextMapEntry 2019-10-30 00:44:17 +01:00
Philip Rebohle 9e69a610cb
[dxgi] Use 64-bit integers for refresh rate matching math
Otherwise, there may be integer overflows for certain parameter values.
2019-10-29 08:42:53 +01:00
Philip Rebohle c4e5323e0e
[dxbc] Remove old constant buffer range check 2019-10-28 17:52:50 +01:00
Philip Rebohle fd547b666e
[dxbc] Don't emit a spec constant for uniform buffers 2019-10-28 15:44:02 +01:00
Philip Rebohle 3d213efe53
[dxbc] Use SSBOs for dynamically indexed constant buffers if needed
SSBOs are tightly bound-checked on all Nvidia GPUs, so this allows for
a more accurate workaround for games relying on OOB access behaviour.
2019-10-28 15:42:46 +01:00
Philip Rebohle 68760f5b20
[dxbc] Parse dynamically indexed flag for constant buffers 2019-10-28 14:15:44 +01:00
Philip Rebohle 7db98a1aa4
[meta] Release 1.4.4 2019-10-27 17:56:31 +01:00
Alexandr dacf1ab4d6 [util] Enable constant buffer range check for Saints Row games
Fixes character flickering on Nvidia.
2019-10-27 11:55:48 +01:00
Philip Rebohle a2b629415e
Revert "[d3d11] Fix ref counting for D3D11CommandList"
This reverts commit 55bae45915.
2019-10-27 11:10:49 +01:00
Philip Rebohle fc0ede0657
Revert "[d3d11] Recycle command lists from deferred contexts"
This reverts commit 4e3da45fde.

For some reason this caused crashes.
2019-10-27 11:00:59 +01:00
Philip Rebohle 8c34f4ff8a
[dxvk] Validate image layouts in render pass formats read from cache
This will discard invalid cache entries generated by DXVK 1.4.3.
2019-10-27 00:04:57 +02:00
Philip Rebohle 03dc59ef39
[dxvk] Write correct depth-stencil attachment layout to state cache
Fixes a dumb issue where we'd compress layouts with high enum values
to a single byte and incorrectly interpret the result as PREINITIALIZED.
2019-10-26 23:59:11 +02:00
Philip Rebohle 9361f19da6
[dxvk] Fix uninitialized depth attachment reference
Also don't redundantly null color attachment refs for cosmetic reasons.
2019-10-26 23:37:46 +02:00
Philip Rebohle 6888a98c89
[dxbc] Always set geometry shader invocation count
Fixes validation errors when the DXBC shader does not specify
the invocation count itself.
2019-10-26 23:19:59 +02:00
Philip Rebohle 144f4badef
[dxbc] Always allocate at least one input array element
Turns out that shaders with no inputs can still have an input signature,
in which case we were generating a zero-length array which is illegal.
2019-10-26 23:13:59 +02:00
Philip Rebohle 20f79a754b
[d3d11] Adjust buffer memory flags if apitrace is attached
Using cached memory speeds up apitrace significantly as it
reads back mapped memory regions.
2019-10-26 22:56:47 +02:00
Philip Rebohle 44c0f96fc1
[dxvk] Pause transform feedback on buffer updates
Otherwise, we might override a currently bound transform
feedback buffer or counter buffer. Fixes Unity Engine.
2019-10-26 19:57:39 +02:00
Philip Rebohle 3c4a57acc6
[dxvk] Fix bogus xfb buffer update check 2019-10-26 19:40:32 +02:00
Philip Rebohle 0683f4f2c0
[d3d11] Remove D3D11 counter buffer class 2019-10-26 17:44:29 +02:00
Philip Rebohle e967c52ff7
[d3d11] Allocate predicate buffer per query
Allows us to get rid of the D3D11 counter buffer class.
2019-10-26 17:44:29 +02:00
Philip Rebohle 09f507c284
[d3d11] Allocate xfb counter buffer per buffer
Same idea as with UAV counters, allows for more efficient updates.
2019-10-26 17:44:29 +02:00
Philip Rebohle 191c9644af
[d3d11] Allocate counter buffer per UAV
Might slightly increase memory overhead, however this allows
the backend to execute UAV counter updates more efficiently.
2019-10-26 17:44:29 +02:00
Philip Rebohle 320e0de4a0
[dxvk] Handle xfb barriers in commitGraphicsBarriers
Avoids spilling the render pass when switching xfb buffers.
2019-10-26 17:44:29 +02:00
Philip Rebohle 5b66f1ec0b
[dxvk] Replace buffer in updateBuffer even outside of render passes
Needed to avoid barriers arount D3D11 UAV counter buffer updates.
2019-10-26 17:44:29 +02:00
Philip Rebohle d1e9e1392d
[dxvk] Lazily allocate slices of small buffers
Reduces memory overhead in case games create small static
buffers. This is somewhat common for index buffers used
to render fullscreen quads or triangles.
2019-10-26 15:24:55 +02:00
Philip Rebohle 7751541662
[dxvk] Don't lock swap lock if not necessary
The swap lock only protects the 'next' free list, which
is not accessed at all when creating a new buffer.
2019-10-26 15:24:54 +02:00
Philip Rebohle e868f829b5
[dxvk] Pad buffers more tightly
This will allow for smaller buffers to be laid out more efficiently.
2019-10-26 15:24:54 +02:00
Philip Rebohle 83fc15c594
[dxvk] Force-update draw buffer for graphics pipeline barrier checks 2019-10-26 12:41:40 +02:00
Philip Rebohle c44d30d78b
[dxvk] Consider indirect draw buffer in graphics pipeline barriers 2019-10-26 04:13:05 +02:00
Philip Rebohle f60d1db1f1
[dxvk] Consider vertex/index buffers in graphics pipeline barriers
Leaving these out was an oversight.
2019-10-26 04:12:32 +02:00
Philip Rebohle e918104ef3
[dxvk] Introduce checkGfxImageBarrier 2019-10-26 03:56:57 +02:00
Philip Rebohle 7a78852776
[dxvk] Introduce checkGfxBufferBarrier 2019-10-26 03:56:52 +02:00
Philip Rebohle 2b812f07c1
[dxvk] Move finalizeDraw into commitGraphicsState
There is no readon to perform this after the draw anymore.
2019-10-26 03:55:03 +02:00
Philip Rebohle 4e3da45fde
[d3d11] Recycle command lists from deferred contexts
Can save a few memory allocations and deallocations at runtime.
2019-10-25 23:09:21 +02:00
Philip Rebohle 7f66373a69
[util] Add virtual destructor to NoWrapper 2019-10-25 22:08:00 +02:00
Philip Rebohle 55bae45915
[d3d11] Fix ref counting for D3D11CommandList 2019-10-25 21:37:18 +02:00
Philip Rebohle 41f04ffb61
[d3d11] Fix incorrect AddRef return value 2019-10-25 21:36:21 +02:00
Philip Rebohle f9c2e43ffc
[d3d11] Don't set HOST pipeline stage and access flags for resources
The backend does not and will not use that information at all.
2019-10-24 16:57:06 +02:00
Philip Rebohle 2d6a3396dd
[dxbc] Declare length of shader input array late
Otherwise, we generate out-of-bounds array reads and writes
in broken ENB shaders.
2019-10-23 16:36:52 +02:00
Philip Rebohle df61a479a2
[spirv] Add 'late' constants
Late constants can be used to reserve a placeholder ID for a constant
before the constant's value is known. The value can be changed later.
Only scalar 32-bit integer and floating point types are supported
as of right now.
2019-10-23 16:09:28 +02:00
Philip Rebohle 59d4556641
[dxbc] Extend scalar constants to vectors if required
Needed for ENB. Fixes #865.
2019-10-23 15:26:22 +02:00
Philip Rebohle ec8ca8a403
[dxbc] Assume vec4 type for i/o vars not declared in signature
Works around an ENB bug.
2019-10-23 15:26:22 +02:00
Philip Rebohle 3e12a116bb
[dxbc] Declare temp registers on demand
And ignore dcl_temps. Needed to successfully compile some broken
ENB shaders (this does work on Windows too). See #865.
2019-10-23 13:55:04 +02:00
Philip Rebohle ee77afb6af
[d3d11] Validate shader module capabilities
Only create a shader module if the device actually supports
the required features. Apparently this is needed for some
Unity Engine games.
2019-10-21 12:10:05 +02:00
Philip Rebohle ddf010479d
[d3d11] Refactor shader module creation 2019-10-21 12:09:53 +02:00
Philip Rebohle 9444162ca6
[util] Enable constant buffer range check for Titan Quest
Reportedly flickers on Nvidia GPUs otherwise.
2019-10-20 13:27:12 +02:00
Philip Rebohle 7a0360d7c2
[dxgi] Remove useless d3d10.enable option 2019-10-19 00:34:51 +02:00
Philip Rebohle ad3542f4fc
[meta] Release 1.4.3 2019-10-18 17:50:38 +02:00
Philip Rebohle 8211225ad4
[dxbc] Swap OpSelect arguments for Ne/Dne, don't use OpLogicalNot
Saves one instruction.
2019-10-18 03:22:20 +02:00
Philip Rebohle b756c229a9
[dxvk] Implement more compact state cache data format (v8)
Omits a lot of unnecessary data and considerably reduces
the state cache file size, often by over 80%.
2019-10-18 00:33:50 +02:00
Philip Rebohle 0ac89ccd9e
[util] Add missing != operator to Sha1Hash 2019-10-18 00:33:40 +02:00
Philip Rebohle 4b0a5dffb2
[dxvk] Support component mappings in blitter 2019-10-16 20:00:38 +02:00
Philip Rebohle d998aaad12
[dxvk] Add some component mapping helpers 2019-10-16 20:00:38 +02:00
Philip Rebohle 0d7f658f96
[dxvk] Implement framebuffer-based blit 2019-10-16 20:00:38 +02:00
Philip Rebohle 6290cfdb48
[dxvk] Add class for framebuffer-based blits 2019-10-16 17:31:40 +02:00
Philip Rebohle 6234a1a6b0
[dxvk] Support arbitrary source texture coordinates in blitter 2019-10-16 02:45:44 +02:00
Philip Rebohle 859ac59e6c
[dxvk] Support multisampled destinations in blitter
Apparently this is required for some D3D9 content.
2019-10-16 02:17:55 +02:00
Philip Rebohle e747315ba6
[dxvk] Support both linear and nearest samplers in blitter 2019-10-16 02:08:04 +02:00
Philip Rebohle 6ea21d57fe
[dxvk] Factor out mip gen classes and rename them to DxvkMetaBlit*
Since mip map generation is a blit operation, we can make a more
general-purpose blitter and implement mip map generation on top
of that.
2019-10-16 01:52:14 +02:00
Philip Rebohle d899bd2d76
[d3d11] Remove obsolete DefaultDesc methods from state classes 2019-10-14 05:28:46 +02:00
Philip Rebohle 68c257fc0d
[d3d11] Fix ref counting for state objects bound to a context
Using raw pointers is safe here since the objects never get destroyed
during the lifetime of the context.
2019-10-14 02:06:33 +02:00
Philip Rebohle 1282c2b99e
[d3d11] Fix immediate context reference counting
Fixes various wine test failures.
2019-10-14 01:56:34 +02:00
Philip Rebohle 4d0cc3e24e
[d3d11] Don't subclass state objects from ComObject
These override reference counting, so we shouldn't use ComObject.
2019-10-14 01:44:37 +02:00
Philip Rebohle c5c43fb2a4
[d3d11] Allow choosing type wrapper for D3D11DeviceChild base class
Allows subclasses to replace ComObject with something else.
2019-10-14 01:44:27 +02:00
Philip Rebohle dd9a55ecc0
[util] Don't allow multiple inheritance for COM objects
This never made any sense whatsoever in the first place.
2019-10-14 01:42:24 +02:00
Philip Rebohle c281e76bac
[d3d11] Don't get private references for state objects
Otherwise we will end up deleting the objects even though they
aren't explicitly heap-allocated. Whoops...
2019-10-14 01:39:54 +02:00
Philip Rebohle 9c6209fbf5
[d3d11] Fix reference counting for state objects
Fixes various wine test failures. Also, state objects are now
allocated in the hash map itself rather than a wrapped COM object.
2019-10-14 01:27:59 +02:00
Philip Rebohle accbc8828c
[d3d11] Return error if no desc is provided for Create*State methods
Fixes wine test failures.
2019-10-14 01:08:31 +02:00
Philip Rebohle bd58f1a913
[d3d11] Don't sync CS thread if resource to map is already in use
SynchronizeCsThread can only update the in-use state from available
to in-use, so doing this on a resource that is already in-use is not
necessary. May improve performance in combination with DO_NOT_WAIT.
2019-10-14 00:14:00 +02:00
Philip Rebohle 12f0f8b13f
[d3d11] Don't use a state object for default blend state 2019-10-13 23:15:23 +02:00
Philip Rebohle c30fd8fb97
[d3d11] Don't use a state object for default depth-stencil state 2019-10-13 23:15:23 +02:00
Philip Rebohle b0231403fe
[d3d11] Don't use a state object for default rasterizer state 2019-10-13 23:15:23 +02:00
Philip Rebohle a89c662984
[d3d11] Introduce ResetState and use it for ClearState
ClearState gets used a lot in games that use deferred
contexts, so we should make sure it's fast. Since we
apply default state everywhere, there is no need to
perform any expensive RestoreState operations.

Reduces the amount of time spent on ClearState on the
CS thread by ~40%, and by ~90% on the calling thread.
2019-10-13 23:15:23 +02:00
Philip Rebohle dbe8b09b05
[dxvk] Don't store sampler description in sampler objects
We aren't using this anywhere in the backend or client APIs.
2019-10-13 04:36:33 +02:00
Philip Rebohle b67e5809ba
[dxvk] Fix buffer usage flags in commitGraphicsBarriers
Only checking for one single usage flag is incorrect since
buffers can have both the storage buffer and storage texel
buffer usage bits set.
2019-10-13 03:18:08 +02:00
Philip Rebohle 950ea21b83
[dxvk] Don't rely on binding mask in commitGraphicsBarriers
We can't actually use that here since we check barriers before
updating shader resources, unlike on the compute path. Check
all resources manually instead.
2019-10-13 02:19:48 +02:00
Philip Rebohle 0e578adcf5
[dxvk] Don't clear binding masks in update*Pipeline
Has no effect anymore since the entire mask gets
overridden in updateShaderResources anyway.
2019-10-13 02:18:09 +02:00
Philip Rebohle b25ab4155b
[dxvk] Remove outdated comment 2019-10-13 02:01:14 +02:00
Philip Rebohle 0a5b427ded
[dxvk] Add function to insert framebuffer read-back barriers
Required for some D3D9 content.
2019-10-13 02:00:10 +02:00
Philip Rebohle 41cb5ab5f7
[dxvk] Add dependency flag parameter to emitMemoryBarrier
Will be needed for framebuffer-local barriers inside render passes.
2019-10-13 01:51:29 +02:00
Philip Rebohle 8446c28de1
[dxvk] Remove spill parameter from bindRenderTargets
No longer needed.
2019-10-13 01:44:31 +02:00
Philip Rebohle 102a18060e
[d3d11] Don't spill render pass when rebinding render targets
The backend handles this now, so it's no longer necessary.
2019-10-13 01:44:31 +02:00
Philip Rebohle 4360021539
[dxvk] Implement accurate barrier tracking for draws with side effects
Similar to how this is handled for compute shaders, with some caveats:
- The barriers are never actually emitted, only tracked. Spilling the
  render pass will reset the barriers as it acts as a full barrier.
- Doing this for all draws and all resources would be prohibitively
  expensive, so whenever switching between pipelines with side effects
  and pipelines without side effects, we'll spill the render pass.
2019-10-13 01:44:28 +02:00
Philip Rebohle baf81473a6
[dxvk] Introduce HasStorageDescriptors to signify pipeline side effects 2019-10-13 01:43:18 +02:00
Philip Rebohle c5676d3108
[dxvk] Remove incorrect framebuffer-space barriers
We're technically required to use VK_DEPENDENCY_BY_REGION_BIT,
but that isn't actually good enough.
2019-10-12 23:54:54 +02:00
Philip Rebohle 803ec3542d
[dxbc] Fix sample positions
From the D3D11.3 functional specification:
"The sample position is relative to the pixel's center"

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

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

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

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

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

Affects Resident Evil 2 and Devil May Cry 5.
2019-08-26 23:59:08 +02:00
Philip Rebohle 4789790087
[d3d11] Remove outdated comment
We actually handle this properly now.
2019-08-26 23:43:47 +02:00
Philip Rebohle 5756e5c921
[d3d11] Check for shader resource view hazards
Fixes incorrect behaviour in games that try to use a currently bound
UAV or render target as a shader resource at the same time.

Fixes visual artifacts in Shining Resonance Refrain on AMD hardware.
2019-08-26 23:43:47 +02:00
Philip Rebohle 137589d755
[d3d11] Add state to track potentially hazardous bound SRVs 2019-08-26 23:29:01 +02:00
Philip Rebohle 4064dd3737
[d3d11] Add bound compute shader UAV mask
Will be used for efficient hazard tracking.
2019-08-26 23:29:01 +02:00
Philip Rebohle 8208cedfa9
[d3d11] Add common view info struct to all view types
Will be used for hazard detection.
2019-08-26 23:29:01 +02:00
Philip Rebohle 5ae5053a2a
[d3d11] Remove templated SetUnorderedAccessViews
Not needed because the CS and OM paths are separate anyway.
2019-08-26 23:29:01 +02:00
Philip Rebohle 08e3500beb
[d3d11] Don't use .at() 2019-08-26 23:29:01 +02:00
Philip Rebohle 473025a93b
[dxvk] Add function to find set bits in binding mask 2019-08-26 23:29:01 +02:00
Philip Rebohle d2d19b0dec
[dxvk] Add function to set bind mask bit to a given value 2019-08-26 23:29:00 +02:00
Jacek Caban 1981140257 [dxvk] Explicitly include unordered_map in dxvk_renderpass.h
When using libstdc++, it's somehow implicitly included, but it's not the case for libc++.
2019-08-26 20:07:58 +02:00
Joshua Ashton 8e54477c2a [util] Use R string literals for app compat regexes 2019-08-24 21:32:51 +02:00
Philip Rebohle 54ca5900e1 [util] Use regular expressions on full exe path to match app profiles
This allows us to detect applications with non-unique executable names
or with variable executable names more reliably, and also allows us to
merge profiles for games that have multiple known exe names.

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

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

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

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

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

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

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

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

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

Fixes a crash in Planet Coaster (#1091).
2019-06-13 16:32:41 +02:00
Joshua Ashton 9d2f31d231 [vulkan] Add operator overloads for VkOffset3D/2D 2019-06-13 04:45:16 +02:00
Philip Rebohle 1bc0b51262
[d3d11] Implement IDXGISurface2 for ID3D11Texture1D 2019-06-13 04:37:35 +02:00
Philip Rebohle 586d0de7bb
[d3d11] Fix default blend factor 2019-06-13 04:15:23 +02:00
Philip Rebohle 089d47e02e
[d3d11] Fix WSize computation for UAV creation 2019-06-13 04:01:15 +02:00
Philip Rebohle f02a5a7453
[d3d11] Don't create SRVs and UAVs with a size of 0
This is illegal and triggers invalid Vulkan usage.
2019-06-13 03:47:10 +02:00
Philip Rebohle 4ffddd1e40
[d3d11] Skip GenerateMips if mip gen flag is not set on resource 2019-06-13 03:31:31 +02:00
Philip Rebohle ce03384ba9
[d3d11] Validate bind flags for D3D11_RESOURCE_MISC_GENERATE_MIPS 2019-06-13 03:31:31 +02:00
Philip Rebohle 63d8d9c3db
[d3d11] Validate buffer descriptions 2019-06-13 03:31:26 +02:00
Philip Rebohle 6a76577f15
[d3d11] Fix behaviour with a viewport count of zero 2019-06-13 02:22:07 +02:00
Philip Rebohle 5ff9c33855
[d3d11] Fix incorrect behaviour when a scissor rect is not specified 2019-06-13 02:16:12 +02:00
Philip Rebohle 78071c750d
[d3d11] Fix crash when setting too many viewports 2019-06-13 01:54:55 +02:00
Philip Rebohle 3b1e03f988
[util] Report correct GPU vendor to Far Cry 3, 4 and Blood Dragon
Now that fast clear behaviour has been fixed in RADV, reporting an
Nvidia GPU breaks rendering again since the game expects the clear
behaviour to match that of the Windows D3D11 drivers exactly. To
recap, clear(0.5) on an R8_UNORM render target results in 127 on
Nvidia GPUs and 128 on AMD GPUs.
2019-06-12 12:32:30 +02:00
Philip Rebohle d5ba36443e
[dxbc] Fix useRawSsbo option
Add some break to fix some breakage.
2019-06-11 20:23:47 +02:00
Philip Rebohle d755b18ccb
[dxbc] Repurpose useRawSsbo option
Basically, abuse the minSsboAlignment property to convince the
compiler to always/never emit raw SSBOs for raw and structured
buffers, and use the actual device limit by default.
2019-06-11 20:20:40 +02:00
Philip Rebohle 0f7c23c022
[dxbc] Always use raw storage buffers if alignment requirements are met 2019-06-11 20:20:40 +02:00
Philip Rebohle 163e6aaa50
[dxbc] Store alignment for raw and structured buffers 2019-06-11 20:20:40 +02:00
Philip Rebohle acab2bd8ce
[d3d11] Fix crash in GetMaximumFrameLatency with a nullptr argument 2019-06-11 16:36:43 +02:00
Philip Rebohle 96b9058fbf
[util] Fix COM private data bug when passing NULL interface
Fixes test failure in wine's DXGI tests.
2019-06-11 16:08:28 +02:00
Philip Rebohle 6d999fad89
[dxgi] Fix some issues introduced with FilterModesByDesc cleanup 2019-06-11 15:45:32 +02:00
Andrew Eikum cd6e3ffe75
[dxgi] Return non-exact matches from FindClosestMatchingMode1 2019-06-11 02:29:25 +02:00
Philip Rebohle 3dbccb1b61 [dxvk] Revert buffer re-binding optimization
While this optimization can significantly reduce CPU overhead, this
breaks World of Warcraft for some reason. Fixes #1086.
2019-06-06 17:22:17 +02:00
Philip Rebohle 3de87b41a0 [dxvk] Add likely/unlikely around critical CS chunk append code 2019-06-05 22:57:51 +02:00
Philip Rebohle 461a2bec36 [dxvk] Only update buffer object in buffer slices if necessary
Saves CPU cycles when rebinding the same vertex, index and
constant buffers with different offsets.
2019-06-05 20:32:12 +02:00
Philip Rebohle 7e66dc61b9 [d3d11] Avoid buffer ref count changes when only changing offsets
Saves a few CPU cycles in the somewhat common situation where the
currently bound vertex, index or constant buffer is re-bound with
a different offset.
2019-06-04 17:53:54 +02:00
Philip Rebohle f501ebce97 [dxvk] Avoid redundant descriptor set updates when binding buffers
Reduces unnecessary overhead when binding a different range of the
same buffer, e.g. through D3D11 VSSetConstantBuffers1.
2019-06-03 20:17:15 +02:00
Philip Rebohle e4e82007b1 [d3d11] Fix inconsistencies in Map/Unmap on immediate/deferred contexts
Should save a few CPU cycles, and also fixes incorrect behaviour when an
application passes null pointers to Map on a deferred context.
2019-06-03 15:31:13 +02:00
Philip Rebohle 58d838b915 [d3d11] Avoid emitting redundant vertex and index buffer updates 2019-06-03 00:18:54 +02:00
Philip Rebohle 19adccea8f [util] Add unlikely() around COM ref counting code
Improves code generation for the common case.
2019-06-02 23:34:53 +02:00