Commit Graph

199 Commits

Author SHA1 Message Date
Georg Lehmann 28a07ef445 [d3d9] Validate vertex declaration on draws 2021-08-08 08:50:00 +00:00
Georg Lehmann 8c0003552c [d3d9] Reject depth stencil StrechRect during an active scene 2021-08-08 08:50:00 +00:00
Georg Lehmann 09e5939502 [d3d9] Reject 2 BeginScene + EndScene without Begin 2021-08-08 08:50:00 +00:00
Georg Lehmann 6071e998fd [d3d9] Handle invalid modes in Device::Reset 2021-08-08 08:50:00 +00:00
Georg Lehmann 64c4eea922 [d3d9] Mark texture dirty on SetLod 2021-08-08 02:28:44 +00:00
Joshua Ashton fd50eae5c2 [d3d9] Optimize framebuffer binding with RT mask 2021-08-08 02:14:11 +00:00
Joshua Ashton 2f22c1b53d [d3d9] Optimize clears with rt mask and better ref tracking 2021-08-08 02:14:11 +00:00
Joshua Ashton 072d3a039e [d3d9] Track bound RTs
This also improves active RT hazard tracking by also accounting for NULL
2021-08-08 02:14:11 +00:00
Georg Lehmann 973678e6bf [d3d9] Only look at the last bit for D3DSAMP_SRGBTEXTURE 2021-08-07 13:09:13 +00:00
Georg Lehmann a1fbcf35de [d3d9] Ignore clear with Count == 0 and non-NULL rect 2021-08-06 18:54:17 +00:00
Robin Kertels 7873bebaf2 [d3d9] Only check range overlap if the buffer is not directly mapped 2021-07-28 16:57:02 +00:00
Joshua Ashton b8a4b85c48
[d3d9] Fix clearing render targets on device reset 2021-07-26 14:35:48 +02:00
Robin Kertels 6ba3d2f9d4 [d3d9] Set correct usage flags for large temporary staging buffers 2021-07-23 13:36:21 +00:00
Robin Kertels fa279eb8ad [d3d9] Ignore NO_DIRTY_UPDATE for POOL_DEFAULT resources
Respecting it breaks Senren Banka because we never upload the texture.
2021-07-23 13:36:21 +00:00
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