Commit Graph

316 Commits

Author SHA1 Message Date
Robin Kertels bdafa16e39 [d3d9] Only bind depth buffer if the depth or stencil test is enabled 2022-04-20 00:58:17 +01:00
Robin Kertels 42c66c410e [d3d9] Calculate slice alignment when uploading straight from the mapping buffer 2022-04-06 18:52:58 +00:00
Philip Rebohle e7e7fa231c
[dxvk] GPU query reset path
Require VK_EXT_host_query_reset instead. This fallback path is
untested nowadays and too slow to be useful.
2022-03-30 13:32:18 +02:00
Robin Kertels b2f22d5719 [d3d9] UpdateTexture: Handle automatic mip gen properly 2022-03-24 02:31:42 +00:00
Joshua Ashton 787a979514 [d3d9] Implement D3D9UserDefinedAnnotation 2022-03-17 11:35:19 +01:00
Joshua Ashton 47b1ab52ce [d3d9] Implement D3D9GlobalAnnotationList 2022-03-17 11:35:19 +01:00
Robin Kertels 115385d1d9 [d3d9] Update buffer seq number in FlushBuffer
How did I miss this?!
2022-03-15 01:24:54 +00:00
Robin Kertels 5f4fc56226 [d3d9] Update texture sequence number AFTER using it 2022-03-13 17:13:00 +00:00
Derek Lesho 6640cc350c
[d3d9] Add support for shared IDirect3DTexture9 resources. 2022-03-12 16:23:06 +01:00
Joshua Ashton dc6c350cf2 [d3d9] Add fallthrough comment to SetRenderState
Silences a warning
2022-03-10 00:47:38 +01:00
Joshua Ashton 53b9a723ac [d3d9] Set initial dirty state flags
We had a bug where initial state values caused the data to not get sent to the backend.

Let's fix that going forward and dirty everything we possibly can on device creation.
2022-03-09 23:33:12 +00:00
Robin Kertels b42c07253e [d3d9] Fix sysmem readback 2022-02-24 07:49:55 +00:00
Robin Kertels a81c653b42 [d3d9] Fix synchronization after readback 2022-02-22 21:49:28 +00:00
Robin Kertels 29d8812709 [d3d9] Don't set NeedsReadback for POOL_SYSMEM textures
... or in SetRenderTarget because we always do readback for render targets.
2022-02-21 13:43:04 +00:00
Robin Kertels b163a99bde [d3d9] Clean up texture locking
We had two code paths that largely did the same.
2022-02-21 00:08:41 +00:00
Robin Kertels dde83717f1 [d3d9] Rename WrittenByGPU to NeedsReadback 2022-02-21 00:08:41 +00:00
Robin Kertels 40444c1f50 [d3d9] Unify texture uploads 2022-02-21 00:08:41 +00:00
Robin Kertels 97ae14b6a0 [d3d9] Synchronize only to given sequence number in WaitForResources 2022-02-20 03:29:31 +00:00
Robin Kertels 917a8d00a2 [d3d9] Track last staging resource usage with a sequence number 2022-02-20 03:29:31 +00:00
Robin Kertels c12cd1952c [d3d9] Handle different mip chain lengths in UpdateTexture 2022-02-20 03:29:04 +00:00
Philip Rebohle 4d9b464f7c
[d3d9] Use new waitForResource method 2022-02-14 03:15:47 +01:00
Philip Rebohle a03c038f03
[d3d9] Exit early in ProcessVertices if the vertex count is 0
We don't want to pass a zero-sized copy to the backend.
2022-02-13 02:08:19 +01:00
Philip Rebohle d96c5a1076
[dxvk] Store DXVK device inside DxvkCsThread object 2022-02-13 02:07:48 +01:00
Philip Rebohle 37f3d9208b
[dxvk] Introduce sequence numbers for CS submissions 2022-02-11 18:17:34 +01:00
Robin Kertels b220c8989b [d3d9] Only enable FETCH4 for single channel formats 2022-01-28 21:34:18 +00:00
Georg Lehmann f5744284eb [d3d9] Dirty FF vertex shader if any D3D9VertexDeclFlags change.
The vertex shader depends on all of these in some way.
2022-01-10 22:06:15 +00:00
Christopher Egert b1a6cbad7f [d3d9] Update FFVS when D3DFVF_PSIZE is specified.
This fixes #2387
2022-01-10 20:05:41 +00:00
Robin Kertels 6c17b8801c [d3d9] Add strict option to float emulation setting 2021-12-05 16:49:19 +00:00
Robin Kertels 804eca9cad [d3d9] Respect shader defined constants for HWVP/PS buffer binding range 2021-11-30 01:57:22 +00:00
Robin Kertels 0061139652 [d3d9] Copy shader defined constants into SWVP UBO
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Georg Lehmann <dadschoorse@gmail.com>
2021-11-30 01:57:22 +00:00
Robin Kertels 39039f9ac8 [dxso+d3d9] Clean up texture slots 2021-11-30 01:57:22 +00:00
Robin Kertels 7f89fe1406 [d3d9+utils] Remove swvp hack 2021-10-15 10:54:18 +01:00
Robin Kertels 530f87f158 [d3d9+dxso] Rely on robustness for unset HW VS & PS constants 2021-10-15 10:54:18 +01:00
Robin Kertels 869f75895c [d3d9+dxso] Switch constant buffer order 2021-10-15 10:54:18 +01:00
Robin Kertels 791d533a1d [d3d9+dxso] Rely on robustness for unset SWVP constants 2021-10-15 10:54:18 +01:00
Robin Kertels 01f633289b [d3d9] Use mapped slice when locking POOL_DEFAULT textures
Fixes an issue where the game would end up using the wrong
buffer slice if it previously mapped the same texture with DISCARD.

Fixes #2329
2021-10-15 10:46:40 +01:00
Robin Kertels c8341e4be3 [d3d9] Fix lenient clears 2021-09-28 21:14:02 +01:00
Robin Kertels c4449faf5a [d3d9] Don't clamp clears to the size of RT 0 2021-09-27 21:57:15 +01:00
Robin Kertels 29ee1a74e6 Revert "[d3d9] Avoid depth degenerate viewports"
This reverts commit 78d22cc7a5.
2021-09-27 14:55:49 +01:00
Georg Lehmann 827c7a892c [util] Replace countof with std::size 2021-09-10 11:58:46 +01:00
Georg Lehmann ed70f9a07c [d3d9] Support unsupported formats in LockRect 2021-08-23 17:38:50 +01:00
Georg Lehmann 82d40f5bba [d3d9] Return a pointer in GetUnsupportedFormatInfo 2021-08-23 17:38:50 +01:00
Georg Lehmann 41d0fcff95 [d3d9] Disable projection for PS 1.4 2021-08-19 01:47:42 -07:00
Robin Kertels 956b23c9e9 [d3d9] Use correct pitch to calculate buffer offset 2021-08-18 13:31:00 -07:00
Joshua Ashton 3718cee9eb [d3d9] Clean up texture type tracking
Additionally stops leaky pipelines on PS 1.x shaders from partial mask updates.
2021-08-17 07:02:56 -07:00
Joshua Ashton 64852f05c3 [d3d9] Track fixed function sampler bitfields
Cleans some stuff up a little bit and makes FF draws faster when this gets incorrectly invalidated.
2021-08-17 07:02:56 -07:00
Joshua Ashton c6a4c41d20 [d3d9] Batch texture unbinding 2021-08-17 07:02:56 -07:00
Joshua Ashton a346949304
[d3d9] Remove needless locks in SetTexture and SetSamplerState 2021-08-16 19:09:16 +01:00
Georg Lehmann 6103e3c800 [d3d9] Use BitMask helper 2021-08-16 08:49:46 -07:00
Joshua Ashton b09b912797
[d3d9] Fix unbinding textures
Closes: #2236
2021-08-16 15:33:49 +01:00
Georg Lehmann a75cf2f39d [d3d9] Fix parital DS clears with full RT clear 2021-08-15 19:00:47 +00:00
Joshua Ashton a6156856e5 [d3d9] Don't check for NULL pViewport
This cannot be NULL.
2021-08-11 11:44:09 +00:00
Joshua Ashton 78d22cc7a5 [d3d9] Avoid depth degenerate viewports 2021-08-11 11:44:09 +00:00
Joshua Ashton 5f4f4d57df
[d3d9] Fix initial mapping of images written by GPU 2021-08-11 12:14:17 +01:00
Joshua Ashton 679d703efc [d3d9] Fix upload race with default image mapping
Fixes a Wine test
2021-08-11 11:53:17 +02:00
Robin Kertels 60a7047550 [d3d9] Fix D3DLOCK_READONLY handling with evictManagedOnUnlock 2021-08-11 07:35:39 +00:00
Joshua Ashton a1f0bb99ee
[d3d9] Cleanup D3D9DeviceEx members 2021-08-11 01:38:34 +01:00
Joshua Ashton 5e48035e99
[d3d9] Only bind textures if they are used by the shader 2021-08-11 01:08:13 +01:00
Joshua Ashton c0c1565cba [d3d9, dxso] Alias color and depth samplers and improve tracking
Takes me from 340 -> 460fps in A Hat in Time's main menu when CPU bound.
2021-08-10 23:46:03 +00:00
Joshua Ashton 85468a5526 [d3d9] Add extra brackets to fetch4 filter check 2021-08-09 22:54:19 +00:00
Joshua Ashton 674f008e23 [d3d9] Use m_activeTexture mask for SRGB check 2021-08-09 22:54:19 +00:00
Joshua Ashton 1823a098a1 [d3d9] Clean up SetStateSamplerState 2021-08-09 22:54:19 +00:00
Joshua Ashton ea4aa87336 [d3d9] Add unlikelies to rare vendor hacks 2021-08-09 22:54:19 +00:00
Georg Lehmann 1ea79cf136 [d3d9] Only respect relevant bits of D3DRS_STENCILREF 2021-08-09 22:54:06 +00:00
Joshua Ashton abba425ed0 [d3d9] Optimize MarkTextureBindingDirty with tzcnt loop of m_activeTextures 2021-08-09 09:54:12 +00:00
Joshua Ashton 242b7b6d9c [d3d9, dxso] Remove AlphaTestEnable spec constant
Go based on the func we already have. Avoids wasting a spec const.
2021-08-09 09:52:07 +00:00
Georg Lehmann ada463badc [d3d9] Mark mips as dirty on Clear if needed 2021-08-08 10:27:43 +00:00
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