Commit Graph

185 Commits

Author SHA1 Message Date
Robin Kertels 584e1515b1 [d3d9] Fix pitch when copying straight from mapping buffer 2021-07-23 13:36:21 +00:00
Robin Kertels 34101dcf26 [d3d9] Fix UpdateTexture extent
Same as 5f1629f2cb
2021-07-23 13:36:21 +00:00
Joshua Ashton d3112c320b [d3d9] Add dirty texture tracking
Reduces overhead from re-binding and unnecessary binding (srgb changes) in L4D2.

I go from about 750 -> 850-900 fps in c1m2_streets with this change.
2021-07-14 20:38:49 +00:00
Robin Kertels 8eeff90e0a [d3d9] Only use staging buffers for uploads once we've stalled on the resource 2021-07-14 19:26:25 +00:00
Robin Kertels b83261b759 [d3d9] Adjust waiting in LockBuffer to staging buffer upload
Now that we're uploading using a staging buffer,
we don't need to wait for non default buffers.

We should also respect READONLY for WRITEONLY buffers
(yes, it sounds dumb) because Nostale relies on that.
2021-07-14 19:26:25 +00:00
Robin Kertels ed24c17d53 [d3d9] Validate srcRect and dstPoint in UpdateSurface 2021-07-14 18:33:38 +00:00
Georg Lehmann b3b2f0921c [d3d9] Never init pSharedHandle.
This parameter has three different meanings if it's non NULL:
- if Pool is D3DPOOL_SYSTEMMEM it's a host pointer for inital data
- if it points to a nullptr it's a output handle
- if it's a pointer to non NULL pointer it's an import handle
2021-07-14 15:29:46 +00:00
Robin Kertels 5f1629f2cb [d3d9] Fix FlushImage extent for smaller mip maps 2021-07-10 16:23:56 +00:00
Joshua Ashton c7f8267f98 [d3d9] Fix NV12 conversion
Froggy is the right color now
2021-07-08 22:36:59 -07:00
Robin Kertels 309284e7dc [d3d9] Respect 4 byte pitch when reading back texture 2021-07-01 05:47:44 -07:00
Robin Kertels c43618d19f [d3d9] Fix texture dirty box clearing
- Fix interleaved locks with evictManagedOnUnlock
We need to make sure there are no other subresources of a texture locked
before clearing the dirty box. Otherwise the data for those other subresources
won't get copied into VRAM.

- Clear dirty box regardless of texture pool
Otherwise we keep repacking and copying the whole texture
for every single lock. This causes performance problems
in Star Wars: The Old Republic.
2021-07-01 05:47:44 -07:00
Philip Rebohle 2ff8b42fff [d3d9] Enable robustBufferAccess2 feature if available
Tightens some out-of-bound rules around vertex attributes.
2021-06-29 18:35:47 -07: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 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
Robin Kertels 8a93bbd8fa [d3d9] Make sure clear extent does not exceed rt size 2021-06-19 16:11:11 -07:00
Robin Kertels d7c4afbeba [d3d9] Pass correct element size to texture converter 2021-06-19 10:43:31 -07:00
Robin Kertels 6f468ec5e0 [d3d9] Fix texture converter 2021-06-12 03:48:01 -07:00
Joshua Ashton f1a9d72d38 [d3d9] Don't scale z to [0, 1] for POSITIONT
I originally thought the depth clipping region was always [0, 1] when I first implemented this nearly 2 years ago.

The depth clipping region is already in the viewport's depth range, so just don't do anything here if we are z-testing.

( We still need to keep the flattening around for when ztest is disabled though :( )

Fixes: #2056
2021-06-06 09:31:01 -07:00
Joshua Ashton fcb7639106 [d3d9] Synchronize frame latency on latency change 2021-06-01 18:16:35 +02:00
Philip Rebohle 6462174c13
[dxvk] Support multi-plane formats in copyImageToBuffer 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
Joshua Ashton f0c1e89443 [d3d9] Handle zero-sized draws
These return S_OK, because ofc they do.
2021-05-05 19:25:46 +01:00
Joshua Ashton 0f52c85d21 [d3d9] Account for vertex declaration size for UP draws
The stride may not give us the full picture here as the stride
may not encompass the vertex declaration entirely.

Consider a vertex declaration of size 20, and a stride of 12,
we may not have covered the whole range of space the draw wants with
VertexCount * Stride.

Some games such as FF13 Lightning Returns have two float3s in the vertex decl
and draw two triangles with the last float being out of bounds. This causes
the whole vertex element to be set to 0 on NVIDIA which breaks their fullscreen passes.

Instead, take (VertexCount - 1) * Stride + VertexDeclSize for the buffer size
and pad with 0s outside of the VertexCount * Stride range.

Closes: #2046
Closes: #1908
2021-05-05 19:25:46 +01:00
Robin Kertels 525fd53bbc [d3d9] Fix FlushBuffer
Use stored mapped slice and use correct dst offset.
2021-04-23 18:06:29 +01:00
Robin Kertels da23771df4 [d3d9] Remove unused variable 2021-04-23 18:06:29 +01:00
Robin Kertels 13f53531e5 [d3d9] Fix offset in UpdateSurface 2021-04-22 20:18:50 +01:00
Robin Kertels 0bc8b0b33a [d3d9] Align pitch to 4 2021-04-22 17:44:58 +01:00
Robin Kertels 03f5893011 [d3d9] Remove implicit discard 2021-04-22 17:44:58 +01:00
Robin Kertels b9512a4063 [d3d9] Only copy dirty parts of managed/sysmem resources 2021-04-22 17:44:58 +01:00
Robin Kertels 4261ff6ec1 [d3d9] Use staging buffer for managed copies 2021-04-22 17:44:58 +01:00
Robin Kertels bb11d7dee8 [d3d9] Refactor AllocUpBuffer so it can be used for managed uploads 2021-04-22 17:44:58 +01:00
Robin Kertels 8cc0c9a0f1 [d3d9] Clamp dirty buffer range
And always maintain dirty range.
2021-04-22 17:44:58 +01:00
Philip Rebohle c3feea2bce [dxvk] Make samplerAnisotropy feature optional 2021-04-04 20:01:30 +01:00
Philip Rebohle 0a787683b6 [dxvk] Don't require shaderStorageImageExtendedFormats
No real reason to, not sure why we did this in the first place.
2021-04-04 20:01:30 +01:00
Robin Kertels d17f62902d [d3d9+util] Remove AllowLockFlagReadonly option 2021-03-22 17:43:07 +00:00
Robin Kertels dba7525954 [d3d9] Mark non default resources as dirty by default 2021-03-22 17:43:07 +00:00
Robin Kertels 8159e87331 [d3d9] Fix some issues with dirty box handling
- The dst texture in UpdateSurface must be in D3DPOOL_DEFAULT
  which doesn't do dirty tracking. So we don't need to
  call AddDirtyBox there.
- Clear DirtyBox when we flush managed textures with EvictManagedOnUnlock.
- Do nothing in AddDirtyBox for D3DPOOL_DEFAULT textures
2021-03-22 17:43:07 +00:00
Robin Kertels cb5f8aa392 [d3d9] Properly scale dirty box 2021-03-22 17:43:07 +00:00
Robin Kertels 3f57a3a8cc [d3d9] Use buffer DirtyRange to track managed uploads 2021-03-22 17:43:07 +00:00
Robin Kertels 4f45e74d96 [d3d9] Improve naming of texture dirty flag and dirty boxes 2021-03-22 17:43:07 +00:00
Robin Kertels 6f139791d2 [d3d9] Improve naming of buffer flags and ranges 2021-03-22 17:43:07 +00:00
Philip Rebohle e3b92bcfac
[dxvk] Add conservative rasterization mode to rasterizer state 2021-03-13 20:22:32 +01:00
Joshua Ashton 31063252eb
[d3d9] Don't implicit discard if read locked 2021-02-28 15:06:23 +00:00
Joshua Ashton 741070785a
[d3d9] Allow implicit discard for all backed buffers 2021-02-28 13:01:00 +00:00
Joshua Ashton 8c2ec5d9c9
[d3d9] Clean up resource locking code 2021-02-27 20:15:39 +00:00
Joshua Ashton e8fc7ea23a
[d3d9] Add d3d9.allowImplicitDiscard option 2021-02-27 20:08:57 +00:00
Joshua Ashton 50d223e614
[d3d9] Add option to use device local memory for constant buffers
Useful for testing performance.
2021-02-27 19:29:52 +00:00
Robin Kertels eec4481ca0 [d3d9] Fix various issues in UpdateTexture
- Skip copies for empty or invalid rects
- align up the extent
- use util functions to slightly clean up the code
2021-02-27 17:31:15 +00:00
Philip Rebohle dcf4599c98 [d3d9] Use ATTACHMENT_OPTIMAL layout for render targets
Significantly improves GPU-bound performance on RADV in a number of games.
2021-02-26 05:02:32 +00:00