Commit 0e2ea06
committed
VULKAN: Decline SW framebuffer when linear image has padded rowPitch
When the linear-tiled VkImage backing the per-frame swapchain texture
ends up with a row pitch wider than width*bpp, vulkan_get_current_sw_framebuffer
now returns false instead of handing the core a directly mapped pointer.
The core falls back to its own tightly packed buffer, which vulkan_frame()
already uploads row-by-row via the existing slow path.
Why
---
RetroArch's pattern (host-write into a HOST_VISIBLE linear-tiled image at
vkGetImageSubresourceLayout's rowPitch, transition PREINITIALIZED -> GENERAL,
sample) is fully spec-correct and works on every conformant Vulkan driver.
On MoltenVK it doesn't always work. Linear images are backed by a buffer-
backed MTLTexture, and Apple requires bytesPerRow alignment of 64 bytes on
Apple GPUs (256 on the simulator). For widths whose tight pitch isn't
already aligned (e.g. the 2048 core at 376x444 XRGB8888, where 376*4 = 1504
gets padded up to 1536), the host writes and GPU sampling go through
different paths in MoltenVK's MVKImage and produce a diagonal shear.
The check
---
A pure runtime test: 'is rowPitch wider than width*bpp?'. On Mesa, NVIDIA,
AMD, ARM Mali, Qualcomm Adreno etc., linear images with sampled+transfer_src
usage at retro-friendly widths report rowPitch == width*bpp, so the test is
false and the existing direct-write fast path is taken unchanged. Only
MoltenVK at awkward widths takes the fallback, paying one extra row-by-row
memcpy per frame (~40 MB/s at 60 fps for 376x444x4 - negligible).
Fixes 2048 core rendering on iOS Vulkan.1 parent 6a9b02d commit 0e2ea06
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7340 | 7340 | | |
7341 | 7341 | | |
7342 | 7342 | | |
| 7343 | + | |
| 7344 | + | |
| 7345 | + | |
| 7346 | + | |
| 7347 | + | |
| 7348 | + | |
| 7349 | + | |
| 7350 | + | |
| 7351 | + | |
| 7352 | + | |
| 7353 | + | |
| 7354 | + | |
| 7355 | + | |
| 7356 | + | |
| 7357 | + | |
| 7358 | + | |
| 7359 | + | |
| 7360 | + | |
| 7361 | + | |
| 7362 | + | |
7343 | 7363 | | |
7344 | 7364 | | |
7345 | 7365 | | |
| |||
0 commit comments