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
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
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
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
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
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
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
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
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
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
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
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
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
e253183bc2
[dxvk] Apply spec constants to compute shaders as well
2019-09-21 14:11:51 +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
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
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
590834660e
Revert "[dxvk] Use vkCmdUpdateBuffer to clear tiny buffers"
...
This reverts commit 311661e4041e182e9bd6d8a6bd3d168901bb5c87.
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
77fde83479
[dxvk] Move some code to where it makes more sense
2019-08-04 21:37:26 +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
65c1e58bd9
[dxvk] Use DxvkObjects to create and pass around common objects
2019-07-30 20:00:38 +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
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
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
02d917c680
[dxvk] Fix meta copy operation for mipmapped images
2019-07-18 19:52:24 +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
8a9cee903b
[dxvk] Use render pass copy for depth-stencil images if beneficial
2019-07-18 17:26:02 +02:00