Commit Graph

15 Commits

Author SHA1 Message Date
5c2cf9074f Merge pull request #3016 from 0xTehuti 2026-11-22 15:14:05 -05:00
36343d86b1 test: prevent present and swapchain tests from stealing focus (SW_SHOWNOACTIVATE) 2026-11-22 20:07:03 +01:00
6a2246c299 TEST-330: check presented colour via swapchain readback under Wine 2026-11-22 18:19:43 +01:00
98e9acfb91 Merge pull request #1908 from Jolymmiles 2026-11-22 10:39:19 -05:00
17a27f23cc d3d12_present_test: check the presented images through the capture, GDI screen read only where it works
Under Wine's macOS driver the test failed at its last step, the GDI read of the screen: GetPixel on the screen DC
returns CLR_INVALID there for every pixel, even one GDI painted itself (BitBlt from the screen DC fails too), and
the window's own DC holds Wine's GDI surface (white), not the image presented through the Metal layer. The
presenter itself was fine: all the injected-failure checks passed, MoltenVK made 320x240 and 400x300 swapchains
at contents scale 1.0, and the driver reported no out-of-date presents. The "present failed" lines in that log
(VkResult -1000001004 twice, then -1 = VK_ERROR_OUT_OF_HOST_MEMORY) are the test's own injections; markers around
them showed each line inside its injection.

The test now enables the presenter's capture and checks the whole presented image for the clear colour at the
swapchain's size after the first 60 frames, after the resize and at the end, on every platform. The screen check
stays where GDI can read the screen; a CLR_INVALID there is reported and skipped instead of failing. The test also
says on stderr that the next three "present failed" lines are expected, since they were read as faults twice.
Checked under CrossOver's Wine 11 with MoltenVK 1.4.3 on an Apple M3 Max: the test passes, and with the clear
colour changed the capture check fails at the first 60 frames.
2026-11-22 18:59:21 +04:00
a24d8cc6ba runtime: fallback and clamp swapchain extent when surface reports undefined extent (D3D-165) 2026-11-22 19:48:05 +05:30
1f71839aa3 runtime: fallback and clamp swapchain extent when surface reports undefined extent (D3D-165) 2026-11-22 18:59:51 +05:30
85520f2a64 Merge pull request #1560 from Instru Control 2026-11-22 07:38:12 -05:00
1cca596655 Merge pull request #1391 from Flyander 2026-11-22 07:37:55 -05:00
ec6645401d [TEST-200] Make M1 CTest skips accurate 2026-11-22 13:13:38 +01:00
84a0b02161 Test Vulkan swapchain retry after a surface query failure 2026-11-22 15:43:12 +03:30
95288af6df Tests: skip d3d12_present on-screen colour check on HDR displays (TEST-209)
On a Windows HDR desktop, DWM scales SDR content by the user's configured
SDR white level, causing GDI GetPixel reads to reflect the boosted and
potentially clipped values (e.g. 66,205,255 for a 51,153,230 clear).

Use IDXGIOutput6::GetDesc1 to check if the monitor displaying the test window
is running in HDR mode (DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020), and skip
the on-screen colour check with an informative message if so, avoiding false
test failures.

Tested on AMD Radeon RX 9070 (driver 26.10.1, Windows 11).
AI-assisted.
2026-11-22 13:03:17 +01:00
de47dbd0aa d3d12_present_test runs under ctest; skipped (77) without a Vulkan device with presentation
tests/test_ctest_registration.py requires every built *_test to be run by
ctest. d3d12_present_test now exits 77 when vktest::Device can't be created
with presentation, like xbox_present_test, and is registered with
SKIP_RETURN_CODE 77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:53:04 +01:00
Ryx
147f9300cf Runtime: presenter survives failed submits and recreations, and counts only shown frames (review)
From VictorJulianiR's review of the presenter, with Vonsek's measurements:
- A failed blit submission left the frame's fence reset with nothing to signal it, so the next present waited
  forever (Vonsek: the retry reached vkWaitForFences with UINT64_MAX). An empty batch now takes the acquire
  semaphore and signals the fence, and the swapchain is recreated next time to give back the image that was
  never presented. If that batch fails too, or a fence wait or reset fails, the presenter stops (ok() is
  false). A back buffer the device does not know is refused before an image is acquired for it.
- A swapchain recreation published the new swapchain before its per-image semaphores existed, so a failed
  semaphore left a presenter that could submit with a null one. The images and semaphores are now built in
  local storage and published only when all exist; on a failure the partial objects are released and the next
  present tries again.
- An out-of-date present was counted as presented (Vonsek: 69 VK_SUCCESS and one VK_ERROR_OUT_OF_DATE_KHR
  reached 70). presented() now counts VK_SUCCESS and VK_SUBOPTIMAL_KHR only; the caller still gets VK_SUCCESS.

d3d12_present_test gives the device and presenter their functions through a driver double that forwards to the
real driver. It counts real out-of-date presents (the frame counts allow for them) and live binary semaphores.
It reports one present as out of date and one as suboptimal, fails the second semaphore of a recreation, and
fails one blit submission. Against the old presenter the test fails at the frame count after the resize, where
this RTX 5060 Ti reported a real out-of-date present.

Docs: the presenter is named as leonida::VulkanPresenter, made by rt::d3d12::create_window_presenter, and the
test is described as 60 frames then 10 after a resize (AlxcBTW).
2026-11-22 04:55:03 +01:00
Ryx
e876fc830e Runtime: present D3D12 back buffers to a window on Vulkan (milestone M0)
- vulkan_present.h: VulkanPresenter blits a back buffer (an ordinary texture
  in D3D12's PRESENT state, layout tracked like any other) to an acquired
  swapchain image and presents it on the same VkQueue, after the
  application's work. Two frames in flight, a present semaphore per image,
  FIFO for vsync else MAILBOX/IMMEDIATE, swapchain recreated on resize or
  out-of-date/suboptimal, minimised windows skip presents.
- rt::d3d12::create_window_presenter / WindowPresenter: Win32 surface for a
  Vulkan device created with presentation; holds the device. This is the back
  end a DXGI shim or PresentX would call; the game's own front end is still
  open (docs question 6), so neither is invented here.
- Standalone device enables VK_KHR_surface/win32_surface and VK_KHR_swapchain
  when present; the test helper can too.

Test: d3d12_present_test opens a window and presents 60 frames through the
Xbox-ABI proxy (reset, PRESENT->RENDER_TARGET, clear, ->PRESENT, execute,
present, fence), resizes the window (swapchain recreated, scaled blit),
switches to unsynchronised presents, and reads the screen with GDI:
51,153,229 for a 51,153,230 clear. Clean under the Khronos validation layer,
as are the other GPU tests; 6/6 ctest.
2026-11-22 04:54:51 +01:00