Philip Rebohle
219853aa9f
[dxvk] Rework dirty descriptor state tracking
2022-06-28 14:35:57 +02:00
Philip Rebohle
d5e53d3271
[dxvk] Add resource binding code using new pipeline layouts
2022-06-28 14:32:31 +02:00
Philip Rebohle
53519e2bd5
[dxvk] Remove old resource binding methods
2022-06-28 14:32:30 +02:00
Philip Rebohle
10eabb34da
[dxvk] Add shader stage parameter to binding methods
2022-06-28 14:32:30 +02:00
Philip Rebohle
520d62903a
[dxvk] Remove null check when setting vertex stride
...
Move the responsibility to the front-end instead.
2022-02-19 13:29:59 +01:00
Philip Rebohle
080aa1a989
[dxvk] Add initBuffer method
2022-02-17 20:58:31 +01:00
Philip Rebohle
102bceb30c
[dxvk] Remove unused clear methods
2022-02-17 20:58:31 +01:00
Philip Rebohle
464c6810b3
[dxvk] Repurpose initImage method
...
This is now supposed to clear images of any type, and only to be
used for resource initialization after creation.
2022-02-17 20:58:31 +01:00
Philip Rebohle
b5078a7ec0
[dxvk] Reduce context staging buffer size to 4 MiB
...
Same idea as before, just create a temporary buffer for larger resources.
This can avoid frequent Vulkan memory allocations and deallocations since
many small buffers are more likely to fit into a single memory chunk than
a small number of large buffers, thus reducing the overall memory footprint.
2022-02-14 01:01:34 +01:00
Philip Rebohle
b9201db554
[dxvk] Remove unused trimStagingBuffers method
2022-02-13 02:08:20 +01:00
Philip Rebohle
8518572d13
[dxvk] Use DxvkStagingBuffer in DxvkContext
2022-02-13 02:08:20 +01:00
Philip Rebohle
1b88bc624a
[dxvk] Remove unused updateImage function
2022-02-13 02:08:20 +01:00
Philip Rebohle
5e763853e5
[dxvk] Introduce tryInvalidateDeviceLocalBuffer
2022-02-13 02:08:19 +01:00
Philip Rebohle
52666a33c6
[dxvk] Expose a way to increment stat counters
...
In case the counters come from external sources.
2022-02-13 02:07:45 +01:00
Philip Rebohle
2abe2132a6
[dxvk] Implement framebuffer cache
...
Reduces the number of object allocations per frame.
2021-11-09 18:09:50 +01:00
Philip Rebohle
f1aad6cb7b
[dxvk] Remove frame buffer from context state
2021-11-09 16:37:33 +01:00
Adam Moss
86148ec070
[d3d11,dxvk] Implement DXVK pieces required for DX11 DLSS support
...
Notably, fairly generic functions to create/launch/destroy Cuda kernels,
and methods to fetch GPU virtual addresses and handles for DX11 resources.
Note: Requires some corresponding dxvk-nvapi changes for DLSS to
be initialized successfully.
2021-09-24 15:10:07 +02:00
Philip Rebohle
f50c5234dc
[dxvk] Add source offset/extent to copyPackedBufferToDepthStencilImage
2021-06-24 21:07:48 +02:00
Philip Rebohle
a14884c652
[dxvk] Add destination offset/extent to copyDepthStencilImageToPackedBuffer
...
Needed to support partial copies between buffers and depth-stencil images.
2021-06-24 21:07:47 +02:00
Philip Rebohle
ba9d670157
[dxvk] Introduce copyPackedBufferImage
2021-06-24 21:07:47 +02:00
Philip Rebohle
ba4938e201
[dxvk] Add slice alignment to copyImageToBuffer
2021-06-24 21:07:47 +02:00
Philip Rebohle
4840cdaf8c
[dxvk] Add slice alignment to copyBufferToImage
2021-06-24 21:07:45 +02:00
Philip Rebohle
6462174c13
[dxvk] Support multi-plane formats in copyImageToBuffer
2021-05-30 19:42:43 +02:00
Philip Rebohle
41e28cb280
[dxvk] Support multi-plane formats in uploadImage
2021-05-30 19:42:43 +02:00
Philip Rebohle
86542248df
[dxvk] Support multi-plane formats in copyBufferToImage
2021-05-30 19:42:43 +02:00
Philip Rebohle
0f5e126735
[dxvk] Introduce flushSharedImages
...
Fixes problems with images not being cleared prior to presentation
if the clear is the last command issued in the frame.
2021-05-30 19:42:43 +02:00
Liam Middlebrook
5ce5999232
[dxvk] Add support for debug utils labels
...
Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
2021-04-08 14:25:02 +02:00
Philip Rebohle
95740eb78c
[dxvk] Use clears to impelemnt image copies if possible
...
Optimizes away a large amount of redundant depth-stencil clear+copy
madness in Final Fantasy XIV for a small performance improvement.
2021-03-06 02:43:28 +01:00
Philip Rebohle
e46bf78f31
[dxvk] Implement discardImageView
...
Built on top of the deferred clear logic.
2021-02-21 01:56:52 +01:00
Philip Rebohle
a0cf5926d8
[dxvk] Add parameter to prepareImage to ignore clears
...
Otherwise we may flush clears while clearing a render target,
which is silly and undoes the layout optimizations.
2021-02-14 04:22:52 +01:00
Philip Rebohle
2b401725dc
[dxvk] Do not transition non-shared images at the end of the command buffer
...
Currently, if the frontend flushes the command list, we always transition
render targets to their default layout. This may lead to some arbitrary
GPU performance issues if the transitions are not free.
Instead, keep all images that are only used internally in their attachment
layout across command list boundaries, until they are unbound.
2021-02-14 04:00:02 +01:00
Philip Rebohle
6efc2588f8
[dxvk] Remove checkFramebufferBarrier
...
No longer serves any practical purpose.
2021-02-14 04:00:02 +01:00
Philip Rebohle
bd87c12138
[dxvk] Make suspend parameter of spillRenderPass not optional
2021-02-12 03:13:11 +01:00
Philip Rebohle
d7db413cac
[dxvk] Introduce prepareImage
...
This transitions any framebuffer attachment that is currently in
the wrong layout back to its default layout before it is used by
functions that expec it to be in the default layout.
2021-02-12 03:13:10 +01:00
Philip Rebohle
ba698430cb
[dxvk] Suspend render pass when updating framebuffer
...
Saves barriers in case some of the previously bound framebuffer
arre reused in the new one.
2021-02-12 03:13:10 +01:00
Philip Rebohle
29afaea338
[dxvk] Track current render target image layouts
...
This can be used to optimize away some barriers and layout transitions.
2021-02-12 03:13:10 +01:00
Philip Rebohle
0ce5dd8b03
[dxvk] Remove conditional rendering from backend
...
Was disabled anyway due to being broken on various drivers,
so let's get rid of it.
2020-11-30 19:18:26 +01:00
Joshua Ashton
7cd46e72e9
[dxvk] Add filter type to generateMipmaps
2020-05-27 10:12:43 +02:00
Philip Rebohle
bbd5762d3d
[dxvk] Add initializeImage helper
...
Allows us to use TOP_OF_PIPE -> xxx barriers more often.
2020-05-02 20:10:19 +02:00
Philip Rebohle
b9c56e3e97
[dxvk] Improve deferred clear logic
...
Ignores currently bound render targets until we actually begin a
render pass. This allows us to use LOAD_OP_CLEAR in more situations,
including when games clear their RTs before binding them.
2020-05-02 11:36:32 +02:00
Philip Rebohle
2967f567d8
[dxvk] Introduce performClear helper
2020-05-02 11:36:31 +02:00
Philip Rebohle
7b8a65589e
[dxvk] Use null descriptors for unbound resources
...
This way we won't have to recompile pipelines any time the app
unbinds a resource.
2020-04-30 16:36:59 +02:00
Philip Rebohle
2a25e3f899
[dxvk] Skip draws if no index buffer is bound
...
It doesn't make much sense to bind the null buffer here, as we'd
just draw the same vertex over and over again.
2020-04-30 16:36:59 +02:00
Philip Rebohle
bea16263e4
[dxvk] Use GPU-local buffer in clearCompressedColorImage
...
Saves VA space in applications that do not initialize their textures..
2020-04-21 18:10:09 +02:00
Philip Rebohle
81c3daa3d0
[dxvk] Remove image renaming
...
Broken by design, has to be implemented by client APIs instead.
2020-01-23 22:21:45 +01:00
Philip Rebohle
41a91cbae6
[dxvk] Implement image swapping
2020-01-16 18:50:23 +01:00
Philip Rebohle
b9258c0c49
[dxvk] Separate gfx resource hazard checking and barrier emission
...
Otherwise, when performing three draws with the same storage buffers or
storage images bound, we don't emit a barrier between the 2nd and 3rd
draw since the tracking information gets cleared by the second draw.
Fixes #1262 .
2019-12-11 13:45:57 +01:00
Philip Rebohle
4c0e4fba0c
[dxvk] Don't return a value from updateShaderResources
...
We're checking the bind point all the time anyway, so the previous
design was inconsistent.
2019-11-28 15:25:12 +01:00
Philip Rebohle
2aa1ff414c
[dxvk] Bind descriptor sets at descriptor update time
...
Gets rid of one 'if' per draw/dispatch and two functions.
2019-11-28 15:17:42 +01:00
Philip Rebohle
2d1fb52b2f
[util] Reimplement Signal
...
The new implementation is more akin to D3D12 fences or timeline
semaphores, and should make implementing similar concepts easier.
2019-11-26 16:11:46 +01:00
Philip Rebohle
014798161c
[dxvk] Avoid some unnecessary barriers around render target clears
2019-11-18 19:36:19 +01: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
4b0a5dffb2
[dxvk] Support component mappings in blitter
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
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
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
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
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
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
e253183bc2
[dxvk] Apply spec constants to compute shaders as well
2019-09-21 14:11:51 +02:00
Philip Rebohle
5b5927dd41
[dxvk] Implement read-write tracking for resources
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
d38607c9be
[dxvk] Implement depth-stencil resolve
2019-08-13 15:16:09 +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
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
24e1969dc4
[dxvk] Remove obsolete DxvkEvent class
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
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
be24ca6099
[dxvk] Rename and add SDMA barrier sets
2019-06-29 01:53:32 +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
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
34cdba1df5
[dxvk] Add method to explicitly release staging buffer memory
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
fd1b5c8eb9
[dxvk] Add method to permanently change image layout
2019-06-15 16:45:59 +02:00
Philip Rebohle
3efec8960c
[dxvk] Pass clear value to clearRenderTarget by value
2019-05-14 21:19:56 +02:00
Philip Rebohle
a1feaa6748
[dxvk] Add aspect mask parameter to clearImageView
2019-05-09 09:10:06 +02:00
Philip Rebohle
02768182f1
[dxvk] Implement push constant API
2019-05-07 20:51:27 +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
8a3044a342
[dxvk] Implement depth bounds test in backend
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
95bfac84f1
[dxvk] Support image sub-regions for resolve operations
...
Required for legacy graphics APIs.
2019-04-19 11:41:12 +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
e59f53abfa
[dxvk] Allow barriers to be recorded into a specific command buffer
2019-04-02 12:14:15 +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
acdb989cfa
[dxvk] Implement conditional rendering
2019-03-28 10:02:11 +01:00