Commit Graph

69 Commits

Author SHA1 Message Date
Georg Lehmann 6071e998fd [d3d9] Handle invalid modes in Device::Reset 2021-08-08 08:50:00 +00:00
Philip Rebohle cd8a2bcfcd [dxvk] Use custom sync primitives 2021-06-29 00:51:20 +02:00
Philip Rebohle ba4938e201
[dxvk] Add slice alignment to copyImageToBuffer 2021-06-24 21:07:47 +02:00
Philip Rebohle 4f5f85925b [d3d9] Add frame rate limiter and d3d9.maxFrameRate option 2021-06-12 13:50:08 +02:00
Joshua Ashton 747834e9b0 [d3d9] Bump frame id before presentation 2021-06-01 18:31:29 +02:00
Joshua Ashton 787de33022 [d3d9] Sync frame latency after presentation 2021-06-01 18:16:35 +02:00
Philip Rebohle 0b88d0deab
[vulkan] Remove getSyncSemaphores from presenter
Instead, return the semaphores in acquireNextImage.
2021-06-01 04:32:50 +02:00
Philip Rebohle 253884a8c7
[vulkan] Remove fence from presenter
We don't use these anywhere.
2021-06-01 03:51:16 +02:00
Philip Rebohle 0af7229b8e
[util] Restore display modes of all monitors in RestoreMonitorDisplayMode
Fixes #2064.
2021-06-01 01:48:12 +02:00
Philip Rebohle 6462174c13
[dxvk] Support multi-plane formats in copyImageToBuffer 2021-05-30 19:42:43 +02:00
Joshua Ashton 4a4b96611d
[d3d9] Only log WaitForVBlank stub once 2021-04-30 19:33:24 +01:00
Robin Kertels 4f45e74d96 [d3d9] Improve naming of texture dirty flag and dirty boxes 2021-03-22 17:43:07 +00:00
Rémi Bernon 1589f516c9 [d3d9] Convert window position relative to its parent. 2021-03-03 15:49:52 +00:00
Philip Rebohle 12693b17f9 [d3d9] Use DxvkSwapchainBlitter for presentation 2021-02-27 14:54:14 +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
Philip Rebohle 73a06aea72
[d3d9] Manually discard swap chain image view on present 2021-02-21 02:18:55 +01:00
Joshua Ashton 59816a71b9
Revert "[d3d9] Don't minimise in WM_ACTIVATEAPP"
Not needed as this was an FSHack bug.

This reverts commit d87200c4d9.
2021-02-19 03:14:56 +00:00
Joshua Ashton d87200c4d9
[d3d9] Don't minimise in WM_ACTIVATEAPP
Sometimes mode-setting jank can occur and technically we'd need to re-set the mode on the next present if the game gets actually minimised.
2021-02-15 17:29:45 +00:00
Philip Rebohle 4f184b3424 [d3d9] Mark images as shared if necessary 2021-02-14 04:00:02 +01:00
Gabriel Ivăncescu 83f6400a07 d3d9: Send necessary messages for full-screen windows during WM_ACTIVATEAPP. 2021-01-08 13:40:34 +00:00
DadSchoorse 9b602ef850
[util] Rework tearFree as a Tristate
PR #1606.
2020-05-02 10:18:13 +02:00
Joshua Ashton 9f4baf3f55 [d3d9] Fix swapchain surface refs once and for all
The refcounting for d3d9 swapchain surfaces is very funny.
They don't actually hold any form of reference to their parent, unlike the surface->texture relationship.

When a swapchain is destroyed, the surfaces become orphans (like offscreen rendertargets) if they are still reffed.

Calling GetContainer on them when orphaned will return E_NOINTERFACE and nullptr for __uuidof(IDirect3DSwapChain)

Fixes some potential lingering refs on the device.
2020-04-26 13:32:22 +01:00
Joshua Ashton 42089d73c5 [d3d9] Fix ref-counting for swapchain surfaces 2020-04-18 21:06:38 +01:00
Joshua Ashton 4699d4162a [d3d9] Implement swapchain containers for surfaces
Fixes a crash in L.A. Noire.

Closes #1564
2020-04-13 01:42:30 +01:00
Joshua Ashton 93b4427a13 [d3d9] Add and use D3D9WindowMessageFilter helper
Stops us forgetting to reset the message filter

Previously when the device was intially created with fullscreen, filter would always be enabled
2020-04-08 20:20:01 +01:00
Joshua Ashton 3f4ffdfba8 [d3d9] Fix MinGW compilation
MSVC doesn't care about static.
2020-04-06 20:35:30 +01:00
Joshua Ashton 46329689ba [d3d9] Handle WM_DESTROY event 2020-04-06 20:16:17 +01:00
Joshua Ashton 18b46e5c22 [d3d9] Move HookWindowProc out of swapchain class 2020-04-06 20:15:49 +01:00
Joshua Ashton a340cd4dd3 [d3d9] Add CallCharsetFunction helper 2020-04-06 20:06:45 +01:00
Joshua Ashton 6cf052b3f2 [d3d9] Cleanup ResetWindowProc 2020-04-06 19:45:15 +01:00
Joshua Ashton 135d246610 [d3d9] Cleanup and formatting for window proc hook 2020-04-06 19:42:48 +01:00
Joshua Ashton 47ddd8466a [d3d9] Re-look up wnd proc iterator
Avoids a potential issue where this could change address during this time.
2020-04-06 19:40:25 +01:00
Joshua Ashton a80eea926a [d3d9] Filter out window messages we cause
Closes #1517
2020-04-06 19:38:26 +01:00
Joshua Ashton 5ff7cad77d [d3d9] Fix formatting in D3D9WindowProc 2020-03-25 07:14:35 +00:00
Florian Will 1a4b15a82d [d3d9] Add option to disable the explicit frontbuffer
The Vulkan swapchain is unaffected by this, but we don't create an
"internal" frontbuffer in D3D9SwapChainEx if this option is set. This
breaks GetFrontBufferData (which returns backbuffer data if the option
is enabled), but it disables front/backbuffer flipping.

Most windows drivers apparently always use the same backbuffer for all
frames in windowed mode. At least one game (ZUSI 3) seems to rely on
this behavior, and only redraws dirty regions for each frame instead of
redrawing everything. With buffer flips, this leads to flickering. When
enabling this new noExplicitFrontBuffer option, the flickering
disappears.
2020-03-18 19:31:00 +00:00
Rémi Bernon 14946c599f [d3d9] Hook WM_NCCALCSIZE to get rid of fullscreen non-client areas. 2020-03-11 17:46:08 +00:00
Joshua Ashton 45c8b09104 [d3d9] Don't update present region in Reset
Fixes a regression in A Hat in Time when changing resolutions
2020-03-06 18:23:08 +00:00
Philip Rebohle 245007daba [d3d9] Don't use m_monitor in GetDisplayModeEx
Should fix #1495.
2020-03-05 15:25:05 +00:00
Philip Rebohle 5e41e00456 [d3d9] Use new common monitor functions 2020-03-04 23:06:15 +00:00
Joshua Ashton 528cacca5f [d3d9] Only have a single implicit swapchain
I am naive to think that this API is in any way sane, and that iSwapChains actually does what you would expect.

Swapchains created by CreateAdditionalSwapchain[Ex] are not tracked in that figure... There can only ever be one.

Great API. Very cool.

This also adds and consolidates some missing thread synchronization on the swapchain functions (that should have already had it).

(note: m_implicitSwapchain always exists, so we don't need to lock if that's all we call.)
2020-02-28 01:29:38 +00:00
Joshua Ashton e41640dcde [d3d9] Make nullptr/oob checks in GetBackBuffer unlikely 2020-02-28 01:03:34 +00:00
Joshua Ashton 8cfca32c2a [d3d9] Don't InitReturnPtr in GetBackBuffer
Matches native behaviour.

Found via a Wine test.
2020-02-28 01:02:56 +00:00
Joshua Ashton 3332bb2844 [d3d9] Add some missing synchronization when completely remaking a presenter 2020-02-27 22:55:20 +00:00
Joshua Ashton 33f6add0ff [d3d9] Fix sampler decision at Present time 2020-02-27 22:54:43 +00:00
Joshua Ashton b6e1da916a [d3d9] Fix scissor rect size when presenting 2020-02-27 22:53:14 +00:00
Joshua Ashton 1592e2770b [d3d9] Remove unnecessary dirty checks in Reset 2020-02-26 22:34:17 +00:00
Joshua Ashton f095f6385e [d3d9] Initialize all backbuffers in swapchain creation
Otherwise they are garbage and undefined layout.

Fixes some validation errors in Lumino City #1462
2020-02-21 06:45:02 +00:00
Joshua Ashton 38838f7428 [d3d9] Synchronize present and wait for idle when invalidating a swapchain
Lumino City calls CreateAdditionalSwapchain instead of the regular device reset functions.

We were missing some needed synchronization here to make this work properly for this game.

Impacts #1462
2020-02-21 01:38:58 +00:00
Joshua Ashton 261a242486 [d3d9] Disallow GetFrontBufferData for anything but D3DPOOL_SYSTEMMEM
Fixes #1464
2020-02-19 18:05:50 +00:00
Joshua Ashton 2f8fbf9114 [d3d9] Use linear sampler for upscaling if extents don't match on Present 2020-02-07 18:53:47 +00:00