mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
0b23ea3318
Mirrors the GL design with the Part-A lessons baked in: - Per-base_x wide surfaces (RGBA8 color + OWN stencil image + framebuffer on the SHARED render pass, so every existing pipeline works unchanged and the mask-bit stencil mirror is real on the wide surface from day one - GL originally shipped a stencil-less wide FBO). - The mirror is a second render pass appended to the SAME one-shot command buffer as the canonical batch (flush_geometry + flush_tex_batch): no extra submits, u_xoff/u_xhalf push constants carry the x-translation/wider clip (the VK shaders were pre-plumbed for this). - Mirror scissor = full-width X but DRAW-AREA Y (the GL band-bleed lesson: full-height Y let draws bleed across vertical double-buffer bands and flicker the top/bottom edges). - wide_clear via vkCmdClearAttachments (color + stencil to bit15) over the cleared band; full-screen overlay rects suppress the batch mirror and draw one full-wide-width rect instead (margins dim/fade correctly). - GPU-direct present: vk_renderer_present_wide blits the displayed band from the wide image to the swapchain, letterboxed at (4*wide_w : 3*native_w); returns 0 -> caller falls back (unchanged) when no surface exists. - vkb_render_wide_display CPU readback backs gr_wide_supported() + the ws debug dump; wide entry points no-op when nothing changed (they sit inside guest emulation - Part-A lesson). - vk_perf gains wide/wclr per-frame counters. First validation: Tomba2 build-vk 16:9 (PSX_WS_FORCE_2D=1) locks 60fps (frame_period p50 16.68ms) with wide passes active; wide surface allocs are one-time (vk_perf allocs ~0 steady state). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>