You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
macOS Apple Silicon arm64 + Vulkan/MoltenVK backend (WIP)
Brings PsyCross up on Apple Silicon and adds an opt-in Vulkan/MoltenVK
rendering backend alongside the existing OpenGL one. Selected at build
time via the parent project's premake option `--renderer=vulkan`.
Visible state with the Vulkan backend enabled:
- Driver 2 main menu (logo, items, sepia tint, red highlight) renders
pixel-equivalent to the OpenGL backend.
- HUD (Damage / Felony bars, timer, mini-map) renders with the right
palette.
- 3D world geometry is visible (skyline, skybox, player car segments).
Wet-street reflection still wins over the road overlay until blend
modes are re-enabled (gated for now — see below).
- Texture sampling for 4-bit / 8-bit / 16-bit paletted PSX textures
with CLUT lookup; UVs floor()ed to integer texels to avoid sub-texel
palette-index noise; RGB-1555 decode.
- D32_SFLOAT depth attachment with depth test (LESS_OR_EQUAL); the
GL-style projection matrices are remapped from [-1, 1] to Vulkan's
[0, 1] z range in the vertex shader.
Build / toolchain:
- src/render/PsyX_render_vk.cpp — new Vulkan backend behind RENDERER_VK.
Vulkan instance + surface + device + swapchain + render pass +
command buffers, single graphics pipeline layout matching GrVertex
(PGXP variant), push-constant projection (2D ortho + 3D perspective),
shaderc-runtime GLSL→SPIR-V compile, GR_BeginScene/EndScene/Clear/
DrawTriangles/UpdateVertexBuffer plus stubs for the rest of the GR_*
surface.
- include/PsyX/PsyX_render.h — recognises RENDERER_VK alongside the
existing RENDERER_OGL/RENDERER_OGLES paths.
- 5 PSX BlendMode pipeline variants (BM_NONE / BM_AVERAGE / BM_ADD /
BM_SUBTRACT / BM_ADD_QUATER_SOURCE) pre-baked; GR_SetBlendMode picks
the active one. Currently forced to BM_NONE because BM_AVERAGE was
being applied to every semi-trans face and turning the entire HUD
translucent — re-enable will need the texture's STP bit plumbed
through to the fragment first.
LP64 / arm64 portability fixes:
- include/psx/types.h: u_long → uint32_t on LP64 (preserves PSX 32-bit
semantics) with a macOS guard that pre-empts <sys/types.h> typedefs.
- include/psx/libgpu.h: P_LEN = 3 for arm64 (same as x86_64) and a
64-bit-correct pointer pack.
- src/psx/LIBCD.C, LIBETC.C, LIBGPU.C, LIBSPU.C: macOS portability —
malloc.h guards, intptr_t casts for ptr→int conversions, missing
libetc include.
- src/PsyX_main.cpp: drop the intrThread, run vsync_callback on the
main thread instead. Fixes an arm64 race where the interrupt thread
could fire vsync_callback in the middle of OT building, dropping
primitives non-deterministically.
- src/render/PsyX_render.cpp: disable async PBO/blit on macOS — the
GL-on-Metal compatibility layer doesn't honour the same timing the
GL backend assumes.
0 commit comments