3.0 KiB
3.0 KiB
Session Log — 2026-08-08
Fullscreen Texture Viewer — Verification and RHI Fixes
Continuation of the fullscreen-blit plan (documents/plans/fullscreen-blit.md),
which rewrote main.cpp from the Suzanne mesh demo into a bindless texture
viewer with contain-fit. This session visually verified the renderer and fixed
three real bugs uncovered by that verification.
Verification method
- Ran the app under the X11 SDL driver (
SDL_VIDEODRIVER=x11) and captured the window withxwd -id <window>, then sampled pixels with ImageMagick (magick -format "%[pixel:p{x,y}]" info:). The model cannot view images, so all render checks were programmatic (pure-black bars, centered content). - XTEST synthesised keys (
XTestFakeKeyEvent) are silently dropped by KWin/XWayland (confirmed withxev: FocusIn arrives via_NET_ACTIVE_WINDOW, KeyPress never does). So texture cycling could not be driven headlessly; fit cases were verified by temporarily making each texture the initial selection.
Contain-fit verified (pixel-sampled)
| Texture | Window | Result |
|---|---|---|
| square 1024x1024 | 16:9 | pillarbox (black L/R bars) |
| test_wide 2048x512 | 16:9 | letterbox (black T/B bars) |
| test_tall 512x2048 | 16:9 | pillarbox (black L/R bars) |
| test_fill 1920x1080 | 16:9 | fills exactly (no bars) |
| square, then resized to portrait | portrait | fit recomputed per frame → flips to letterbox |
Bugs found and fixed
VK_SUBOPTIMAL_KHRcrashed the app.prRhiAcquireNextImageVkandprRhiPresentVkrouted SUBOPTIMAL into_checkVk→__builtin_trap()(SIGILL, caught under X11 immediately). Both now returnPR_RHI_SWAPCHAIN_OUT_OF_DATEfor SUBOPTIMAL, same as OUT_OF_DATE (pr_rhi_vk.c).- Swapchain recreate ignored surface extent.
prRhiRecreateSwapchainVkhard-coded the passed width/height. Now queriesvkGetPhysicalDeviceSurfaceCapabilitiesKHRand falls back to the passed size only whencurrentExtent == 0xFFFFFFFF(matches the initial-create logic). - App used logical window size for the swapchain. Under HiDPI the drawable
differs from
SDL_GetWindowSize(1920x1080 logical vs 2400x1350 drawable at 1.25x scale on XWayland) — the root cause of #1. main.cpp now usesSDL_GetWindowSizeInPixelsfor swapchain width/height, the fit rect, the viewport, and the scissor.
CLI arg considered and removed
Added a --texture N startup arg to drive the verification, then removed it at
the user's request (main() is back to no-args, app.selected = 0). If
headless key injection is ever needed again, revisit (e.g. ydotool/wtype on
Wayland, or a WM on a real X server).
Notes
main.cppheader comment,<cstdlib>include, and plan doc all updated to reflect the removed arg.- Native Wayland run still clean after all fixes;
just buildpasses.