Commit Graph

201 Commits

Author SHA1 Message Date
Philip Rebohle 67fe452580
[dxvk] Track lifetime of framebuffer attachments
We should mark images that are being used for rendering as
in-use by the GPU when binding the corresponding framebuffer.
2018-07-10 04:47:50 +02:00
Philip Rebohle 4d1a70bd89
[dxvk] Fix deferred depth-stencil clears
If a game clears the depth and stencil aspects of a depth-stencil
buffer separately, we must not override the load op and clear value
of the previously set aspect. Fixes a rendering issue in Hitman
Absolution.
2018-07-06 15:23:59 +02:00
Philip Rebohle 974db9712b
[dxvk] Remove clear rect parameter from clearRenderTarget
With deferred clears and render target-based clears, this was
not properly supported anyway.
2018-07-06 15:01:37 +02:00
Philip Rebohle db2b6e1219
[dxvk] Optimize image layout transitions
This should reduce unnecessary execution dependencies when
transitioning image layouts before executing image copies.
2018-06-28 13:52:54 +02:00
Philip Rebohle 8c65203ac2
[dxvk] Fix potential layout transition issues with depth-stencil images
Some operations can operate on only one of the two aspects
of a depth-stencil image. This fixes two possible issues:
- Image memory barriers must be applied to all image aspects
- VK_IMAGE_LAYOUT_UNDEFINED is no longer used as a source layout
  if the operation requiring the transition only uses one aspect
2018-06-28 12:44:57 +02:00
Philip Rebohle 4f28d57352
[dxvk] Remove unused rasterizer discard state flag 2018-06-25 16:56:52 +02:00
Philip Rebohle 5d1f00be34
[dxvk] Implement shader-based meta-resolve operation
This should work around a variety of potential driver issues
when games resolve typeless images with a different format.
2018-06-23 13:17:01 +02:00
Philip Rebohle 4b5ec1be3e
[dxvk] Implement support for dynamic buffer binding offsets 2018-06-22 00:33:06 +02:00
Philip Rebohle 15aabcb878
[dxvk] Optimize barriers around vkCmdCopyImage
We don't need to force layout transitions and emit double pipeline
barriers in case the GENERAL layout is being used for both images.
This is somewhat common for images used by compute shaders, and
this optimization ensures that only required barriers are emitted.
2018-06-18 22:30:00 +02:00
Philip Rebohle 79dc7d8947
[dxvk] Optimized barrier batching around compute shader execution
Reduces the number of unnecessary pipeline barriers after compute shader
dispatches. Yields a small performance improvement in Final Fantasy XV.
2018-06-18 14:35:11 +02:00
Philip Rebohle 162c465e95
[dxvk] Optimize buffer memory barrier batching
Instead of inserting a barrier after every single buffer copy, update
or clear operation, we batch them up and execute the barrier when the
first dirty buffer is used by a command. This significantly reduces
the number of pipeline barriers in some games, e.g. Final Fantasy XV.
2018-06-16 11:53:06 +02:00
Philip Rebohle 7fa26f1c87
[d3d11] Implement render pass spilling for UAV rendering
Spilling the render pass should make shader storage buffer/image writes
visible due to how external subpass dependencies are defined. For UAV
rendering, we need to do this when changing the UAVs, even if the render
targets themselves do not change.
2018-06-15 20:49:24 +02:00
Philip Rebohle e8ac81fe8a
[dxvk] Removed support for depth bounds test
This feature is not used in D3D11, so we don't need backend support.
2018-06-06 13:11:09 +02:00
Philip Rebohle 8b4852be16
[dxvk] Make depth bias a dynamic state
Works around an issue with some games not setting the D3D11 depth
bias state correctly, which can result in an excessive number of
pipelines being compiled.
2018-06-06 12:45:45 +02:00
Philip Rebohle f77392a264
[dxvk] Apply dynamic state at draw time
Changes to the viewport, stencil reference and blend constants are often
coupled with a pipeline state update, so it makes sense to update it later.
2018-05-29 05:03:27 +02:00
Philip Rebohle 97e3b89bc7
[dxvk] Emit dynamic state only if a pipeline is bound
Fixes validation errors in Dirt 4.
2018-05-26 20:09:31 +02:00
Philip Rebohle a0e0ba1cc8
[dxvk] Align length when clearing entire buffer
Buffer slices in DXVK are always aligned to at least
256 bytes, so this is safe. Fixes a regression leading
to GPU hangs on RADV.
2018-05-25 21:02:15 +02:00
Philip Rebohle b30e53fa0d
[dxvk] Track image (rather than the view) when generating mip maps 2018-05-25 19:15:14 +02:00
Philip Rebohle 4b37590e14
[dxvk] Use new mip map generator 2018-05-25 17:45:41 +02:00
Philip Rebohle d9772b0ffd
[dxvk] Create image views for all supported view types
Rather than creating just one image view per DxvkImageView, we create
views for all compatible types in an attempt to work around game bugs
in Diablo 3, Far Cry 5, Nier Automata, Dishonored 2, Trackmania etc.,
which bind incompatible resource views to some resource slots.
2018-05-24 11:44:04 +02:00
Philip Rebohle 3fc9466a07
[dxvk] Fix query scopes
Occlusion queries must begin and end in the same render pass.
Fixes a rendering issue in Shadow Warrior 2 on AMD drivers.
2018-05-12 19:46:08 +02:00
Philip Rebohle c7d2957d8f
[util] Remove duplicate tzcnt function 2018-05-09 20:09:09 +02:00
Philip Rebohle 37456d583e
[dxvk] Move DxvkPipelineCache to DxvkPipeManager
Since the pipeline cache isn't used for anything else but compiling
pipelines, keeping this stuff together is much more useful.
2018-05-09 14:26:45 +02:00
Philip Rebohle 47b9fd8b19
[dxvk] Reimplement vertex buffer bindings
Reduces the number of Vulkan calls for vertex buffer bindings and
works around incorrect validation errors emitted when applications
do not use a consecutive range of vertex bindings. No performance
impact is expected in most games.
2018-05-09 13:01:52 +02:00
Philip Rebohle 3a3b1eda59 [dxvk] Move render pass out of pipeline state vector 2018-05-03 23:48:45 +02:00
Philip Rebohle 5683422208 Merge branch 'clearopt' 2018-05-02 00:45:17 +02:00
Philip Rebohle e30a8299e6 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-05-02 00:45:10 +02:00
Philip Rebohle badb93334e [dxvk] Fix DxvkContext::transformImage
We have to spill the render pass before transforming the
image. We don't need the barrier if the old and new
layout are the same.
2018-05-01 23:29:58 +02:00
Philip Rebohle 5e02c1bb2f [dxvk] Move DxvkPipelineManager instance back to DxvkDevice 2018-05-01 16:56:33 +02:00
Philip Rebohle cf1358b2f4 [dxvk] Fixed partial depth-stencil clear operations 2018-04-30 21:42:16 +02:00
Philip Rebohle ba53cf92ac Revert "[dxvk] Refactor DxvkFramebuffer and DxvkRenderpass"
This reverts commit 1bbfe77013.
Breaks Path of Exile.
2018-04-30 18:47:35 +02:00
Philip Rebohle 5d5be87402 [dxvk] Oprimize render target clear operations
We can save one image layout transition when clearing a render
target by delaying clears until vkCmdBeginRenderPass is called.
2018-04-30 17:04:13 +02:00
Philip Rebohle 1bbfe77013 [dxvk] Refactor DxvkFramebuffer and DxvkRenderpass 2018-04-30 15:47:29 +02:00
Philip Rebohle 1bcae90dd0 [dxvk] Fix image layouts for images using VK_IMAGE_TILING_LINEAR
We have to use VK_IMAGE_LAYOUT_GENERAL for those. On top of that,
we should avoid image transitions when the image is in GENERAL
layout anyway in order to save some time on the GPU.
2018-04-29 15:28:50 +02:00
Philip Rebohle 1784b8c44d [d3d11] Merge interop API 2018-04-26 22:20:09 +02:00
Philip Rebohle 8cb3a266f7 [dxvk] Fix potential state tracking issue when updating render targets 2018-04-26 18:43:19 +02:00
Philip Rebohle 962a7f5766 [dxvk] Ignore redundant render target bindings
Further reduces render pass count if applications bind render targets
without using them, and then bind the old set of render targets again.
2018-04-26 15:30:18 +02:00
Philip Rebohle 1075990dbe [dxvk] Apply render target bindings at draw time
This should help reduce the number of redundant render pass spills,
especially in games which use deferred contexts for rendering. This
optimization mostly helps in GPU-bound scenarios.
2018-04-26 14:47:55 +02:00
Philip Rebohle d91114d733 [dxvk] Rename renderPassBegin/End methods to start/spillRenderPass 2018-04-23 11:11:40 +02:00
Philip Rebohle 62b0e34a73
[d3d11] Implement IDXGIVkInteropDevice for D3D11Device 2018-04-20 00:19:03 +02:00
Philip Rebohle 9a8263f465
[dxvk] Implement vertex binding divisors
Uses VK_EXT_vertex_attribute_divisor when available.
2018-04-17 17:24:16 +02:00
Philip Rebohle 31ed6e5cd3
[dxvk] Move render target set comparison to DxvkRenderTargets 2018-04-15 03:01:52 +02:00
Philip Rebohle d523405a5a
[dxvk] Implement bindRenderTargets method
An alternative to manually creating a framebuffer object and binding
it via bindFramebuffer. Future optmizations can use this to bring
down the number of redundant render pass changes.
2018-04-15 01:09:53 +02:00
Philip Rebohle 9d84e1bfaa
[dxvk] Implement clearBufferView and clearImageView 2018-04-11 23:13:34 +02:00
Philip Rebohle 676b0cb476
[dxvk] Added DxvkMetaClearObjects stub 2018-04-11 17:05:12 +02:00
Philip Rebohle 687ef77860
[dxvk] Enable sample rate shading if needed 2018-04-08 21:49:30 +02:00
Philip Rebohle 9ef4168867 [dxvk] Added support for pipeline-related stat counters 2018-04-03 15:52:39 +02:00
Philip Rebohle 8aa8610221 [dxvk] Implement basic stat counters for draw calls, queue ops 2018-04-03 11:56:12 +02:00
Philip Rebohle 6e27f12e22
[dxvk] Move DxvkPipelineManager object to DxvkContext
Since we create only one DxvkContext per D3D11Device, rather than
per D3D11DeviceContext as originally planned, there is no need to
keep the pipeline manager as a global thread-safe object. This may
slightly reduce CPU overhead.
2018-03-29 12:32:20 +02:00
Philip Rebohle fc47fb8f6c
[dxvk] Do not create descriptor set layout/template if binding count is 0
Fixes a validation error in case an application renders geometry without
any active shader resource slots.
2018-03-26 23:13:33 +02:00