# 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 with `xwd -id `, 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 with `xev`: 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 1. **`VK_SUBOPTIMAL_KHR` crashed the app.** `prRhiAcquireNextImageVk` and `prRhiPresentVk` routed SUBOPTIMAL into `_checkVk` → `__builtin_trap()` (SIGILL, caught under X11 immediately). Both now return `PR_RHI_SWAPCHAIN_OUT_OF_DATE` for SUBOPTIMAL, same as OUT_OF_DATE (`pr_rhi_vk.c`). 2. **Swapchain recreate ignored surface extent.** `prRhiRecreateSwapchainVk` hard-coded the passed width/height. Now queries `vkGetPhysicalDeviceSurfaceCapabilitiesKHR` and falls back to the passed size only when `currentExtent == 0xFFFFFFFF` (matches the initial-create logic). 3. **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 uses `SDL_GetWindowSizeInPixels` for 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.cpp` header comment, `` include, and plan doc all updated to reflect the removed arg. - Native Wayland run still clean after all fixes; `just build` passes.