Commit Graph
90 Commits
Author SHA1 Message Date
nmzik e76f2d1af8 new ABIs 2026-07-29 00:31:08 +02:00
nmzik 64845e2294 new ABI, broaden support 2026-07-29 00:31:08 +02:00
nmzik 4b9030bd3d ABI fixes: libNet, libSaveData (rewrite the legacy Kyty implementation) 2026-07-29 00:30:24 +02:00
nmzik a6b61d7aa0 refactor(graphics): split renderer and recompiler into focused modules 2026-07-29 00:30:24 +02:00
Stefanos CostaandGitHub 2b9cba457e Linux: port the emulator to a working state on Linux (#117)
Linux: port the emulator to a working state
KytyPS5-2026-07-28-2b9cba4
2026-07-29 00:25:58 +02:00
nmzikandGitHub 3dc793d859 Fix badges (#120)
Build and Release KytyPS5 / Build KytyPS5 (Windows) (push) Waiting to run
Build and Release KytyPS5 / Build KytyPS5 (macOS) (push) Waiting to run
Build and Release KytyPS5 / Release KytyPS5 (push) Blocked by required conditions
Build KytyPS5 (Linux) / build (push) Canceled after 0s
docs: fix build badges
KytyPS5-2026-07-28-3dc793d
2026-07-28 19:40:14 +02:00
nmzikandGitHub 01d78b71fe CI: release Windows and macOS archives (#119)
* ci: release Windows and macOS archives

* docs: note experimental macOS support
2026-07-28 19:33:21 +02:00
4d79f19089 macOS (Apple Silicon) support: native build running under Rosetta 2 with MoltenVK (#102)
* macos: POSIX platform layer (host fault handler, virtual memory)

- hostException: Mach/POSIX signal-based host fault handler mirroring the
  Windows vectored handler (SIGSEGV/SIGBUS/SIGILL), behind
  '#elif defined(__APPLE__)'. Windows and Linux branches are untouched.
- sysLinuxVirtual: mach_vm_region-based is_mapped (no /proc/self/maps on
  macOS), PTHREAD_MUTEX_NORMAL, and a MAP_FIXED carve-in-place allocator that
  never leaves an unmapped hole for dyld/Rosetta/Metal to claim. All
  __APPLE__-guarded; the original Linux allocator path is preserved verbatim.
- sysLinuxDbg/sysLinuxFileIO: libgen.h for basename(), and a POSIX
  opendir/readdir implementation of SysFileGetDents (previously a stub).

* macos: guest kernel backing, threads, and POSIX libs

- memory/memoryAddressSpace: anonymous shm_open backing (macOS has no
  memfd_create) and re-reserve-on-unmap so a guest MAP_FIXED remap never
  destroys a host mapping (__APPLE__-guarded). Drops host <sys/mman.h> MAP_*
  macros so the guest's constexpr MAP_* constants compile (no-op on Windows).
- pthread: undef the host PTHREAD_STACK_MIN macro; on non-Windows, pin the
  stack-switch asm's guest rsp/rbp to callee-saved r14/r15 (the template
  clobbers r12/r13); __APPLE__ no-op for the absent pthread_condattr_setclock.
  The Windows stack-switch asm is byte-identical.
- network: define SOCKET/INVALID_SOCKET for the non-Windows paths (were
  undefined at 20+ use sites), and rename the non-Windows kernel_clock_*
  helpers to the CamelCase names the callers already use. Both repair the
  shared non-Windows build. Integer reinterpret_cast -> static_cast.

* loader: pin stack-switch asm operands to callee-saved registers

RunEntry switches to the guest stack with an asm template that clobbers
r12/r13 before consuming its inputs. With plain "r" constraints the compiler
may place func/guest_rsp/guest_rbp into r12/r13, so 'callq *func' jumps
through the saved host rsp -- a latent miscompile on every platform that any
unrelated codegen change can trigger. Pin the inputs to rbx/r14/r15, which the
template never touches and the SysV callee preserves.

General correctness fix (not macOS-specific); the same fix is applied to
pthread RunOnGuestStack.

* macos: Vulkan/MoltenVK graphics enablement

- pageManager: GPU write-tracking via Mach VM queries + mprotect (mprotect
  cannot report the previous protection, so the expected-old check is dropped),
  thread id via pthread_mach_thread_np, 4 KB page-size check -- __APPLE__-guarded.
- shaders/renderDraw/vulkanWindow: MoltenVK lacks VK_EXT_color_write_enable,
  VK_EXT_depth_clip_enable and depthBounds; fall back to static color-write
  masks and default depth clipping, request VK_KHR_portability_subset, and
  reuse the graphics queue for present when only one queue is exposed. Non-Apple
  pipeline/extension setup is unchanged.
- window: optional borderless window (KYTY_BORDERLESS) to sidestep a Rosetta
  NSException in macOS window chrome.

* graphics: macOS thread identity for region tracking

Region-ownership locks resolve the current thread via GetCurrentThreadId()
on Windows and EXIT elsewhere. Use the Mach thread port on macOS (nonzero
per-thread id; 0 stays the no-owner sentinel).

* macos: marshal AppKit window operations to the main thread

The present worker thread shows the window, updates its icon and title, and
recreates a lost Vulkan surface. AppKit traps with 'Must only be used from the
main thread' when these run off the main thread. Route them through a small
task queue drained by the SDL main loop (an SDL_USEREVENT wakes the loop when
it is blocked in SDL_WaitEvent). Title updates are fire-and-forget; showing
the window and surface recreation wait for completion.

Windows and Linux call the SDL functions directly, as before.

* build: ignore the _Build output directory

_Build is the conventional out-of-tree build location (only _Build/vscode-clang
was ignored); a stray git add could sweep build artifacts into a commit.

* macos: isolate stack-switch workaround

---------

Co-authored-by: nmzik <Nmzik@mail.ru>
KytyPS5-2026-07-28-4d79f19
2026-07-28 19:03:15 +02:00
8fe4765f9e ci: add macOS build workflow (#114)
Build KytyPS5 (Linux) / build (push) Waiting to run
Build KytyPS5 / build (push) Waiting to run
Build KytyPS5 / release (push) Blocked by required conditions
Build KytyPS5 (macOS) / build (push) Has been cancelled
* ci: add macOS build workflow

* macos: add POSIX compatibility guards

* ci: select Xcode 26 for macOS

* macos: add kernel POSIX compatibility

* launcher: support macOS process startup

* ci: fix macOS architecture verification

* ci: cache glslang on Windows

---------

Co-authored-by: Abdullah K. <akjee204@gmail.com>
KytyPS5-2026-07-27-8fe4765
2026-07-27 22:01:50 +02:00
nmzik c71bb9fc9e build: make clang-tidy checks opt-in KytyPS5-2026-07-27-c71bb9f 2026-07-27 16:33:22 +02:00
nmzikandGitHub f60f80b631 launcher: add local game patches (#111)
launcher: add game patches
KytyPS5-2026-07-27-f60f80b
2026-07-27 16:19:31 +02:00
Abdullah K.andnmzik 31ea0081a9 perf: skip LOGF formatting when logging is silent
Build KytyPS5 (Linux) / build (push) Waiting to run
Build KytyPS5 / build (push) Waiting to run
Build KytyPS5 / release (push) Blocked by required conditions
LOGF/LOGF_COLOR always ran fmt::sprintf even when the output was discarded; at
emulator log volume the formatting alone costs frames. Add Log::IsSilent() and
short-circuit before formatting. Behavior-preserving on all platforms (it only
skips work whose result is thrown away); before init it reports non-silent so
early logs still print.

(cherry picked from commit 1749e0fc68)
KytyPS5-2026-07-27-31ea008
2026-07-27 14:21:03 +02:00
Abdullah K.andnmzik 7921269878 build: add macOS (Apple Silicon) build support
macOS compiles the existing POSIX/Linux code paths (KYTY_PLATFORM_LINUX)
targeting x86_64 under Rosetta 2. Adds an APPLE branch to the build:
selects Apple's ld64 linker, unsets the Ninja response-file forcing (Apple
ar has no @file support), derives the target arch from CMAKE_OSX_ARCHITECTURES
for cpuinfo/ffmpeg, and re-signs the binary post-build with JIT entitlements
(required to execute written trampolines and Rosetta-translated guest code).

All changes are guarded by if(APPLE); Windows and Linux configuration is
unchanged.

(cherry picked from commit 13be13b757)
KytyPS5-2026-07-27-7921269
2026-07-27 14:16:51 +02:00
nmzik e42f6c3892 ci: add Linux build workflow KytyPS5-2026-07-27-e42f6c3 2026-07-27 14:13:34 +02:00
nmzik 7351eae117 graphics: add 1D image descriptor support KytyPS5-2026-07-27-7351eae 2026-07-27 14:10:51 +02:00
nmzik 125287dc30 graphics: broaden depth compatibility 2026-07-27 10:29:37 +02:00
nmzik 142b3c20fa graphics: unify buffer bindings and depth target handling 2026-07-27 10:12:41 +02:00
nmzik f43567e12c shader: validate MSAA image descriptors during materialization 2026-07-27 10:12:41 +02:00
nmzik c86d4b1f0d Fix linux compilation 2026-07-27 10:12:41 +02:00
nmzik 31fb3ec5af graphics: broaden storage image and view format compatibility 2026-07-27 10:12:41 +02:00
nmzik c3b2ae9733 graphics: support more depth-tiled storage image formats 2026-07-27 10:12:41 +02:00
nmzik 93774ee37c fix teardown 2026-07-27 02:27:37 +02:00
nmzik a20cf5d298 refactor renderer 2026-07-27 02:27:29 +02:00
nmzik a720b28b7f graphics: cleanup 2026-07-23 23:21:26 +02:00
nmzik 7638c25d76 renderer: replace generation retries with staged resource binding 2026-07-23 22:32:30 +02:00
nmzik 85876388cf gpuTiler: fix performance (dispatch a 2D 8×8 workgroup) KytyPS5-2026-07-22-8587638 2026-07-22 23:36:00 +02:00
nmzik f60007e923 refactor(gpu): use a single ordered PM4 scheduler 2026-07-22 23:15:03 +02:00
nmzik dbcb444c05 unify graphics and compute on one Vulkan queue KytyPS5-2026-07-22-dbcb444 2026-07-22 17:44:38 +02:00
nmzikandGitHub cf595beedf Install glslang for Windows CI
Install glslang with validator tools and optimizer support, add it to PATH, and verify it before configuring the Windows build.
KytyPS5-2026-07-21-cf595be
2026-07-22 00:32:54 +02:00
nmzik 8a4600c5e9 graphics: fix initialization 2026-07-21 07:37:52 +02:00
nmzik 0a5f78c727 graphics: refactoring #2 2026-07-21 07:37:52 +02:00
nmzik b51d4322cc Add GPU tilers/tests 2026-07-21 07:37:52 +02:00
nmzik 728b5b7d01 fix: render-target aliases were synchronously read back and copied through host memory twice 2026-07-21 07:37:52 +02:00
nmzik 42f634a751 fix fetch shader V_SAD_U32, video-out buffer overlap 2026-07-21 07:37:52 +02:00
nmzik aebf6b4913 graphics: synchronize host file writes and depth clipping
Map paired PS5 depth-clip state through Vulkan pipeline creation and preserve asymmetric hard failures. Prepare GPU-mapped guest ranges before kernel file reads so buffer, texture, and alias ownership remains coherent. Add focused regression coverage and update the current launch target.
2026-07-21 07:37:52 +02:00
nmzik 91690ac29e Implement texture-alias, mip-tail 2026-07-21 07:37:52 +02:00
nmzik 999f87576e graphics: add native PS5 MSAA and safe image allocation reuse 2026-07-21 07:37:52 +02:00
bd9086e484 Auto Build Workflow (#31)
* Add GitHub Actions workflow for building KytyPS5

---------

Co-authored-by: nmzik <Nmzik@mail.ru>
KytyPS5-2026-07-19-bd9086e
2026-07-19 01:55:58 +02:00
nmzik 39c379ff21 remove Vulkan SDK usage 2026-07-19 01:30:40 +02:00
nmzik cbc11d2eaf Refactor graphics #1 2026-07-19 00:54:31 +02:00
nmzik 7905f2d12f graphics: migrate Vulkan backend to Vulkan-Hpp 2026-07-18 12:33:21 +02:00
nmzik 587cb238f0 videoout minor fix 2026-07-18 11:00:36 +02:00
kirathenotebookandnmzik e05cd30268 Fix AMD RDNA startup crash and rendering corruption
# What changed
- Drop the unused VK_FORMAT_D24_UNORM_S8_UINT device check that
  rejected some AMD GPUs.
- Only treat VALIDATION-type Vulkan messages as fatal, not
  GENERAL-type ones.
- Restrict compute queues to the graphics queue's family.
- Force per-invocation lane mask emulation for 64-wide waves, since
  RDNA's lane layout differs from GCN despite matching wave size.

# Why
On AMD Radeon GPUs the emulator failed to find a suitable device,
crashed during queue setup, or rendered corrupted output, while
NVIDIA was unaffected.

Each change removes an assumption in device selection, debug
message handling, queue selection, or shader lane-mask emulation
that happened to hold for NVIDIA but not for AMD.

# Validation
- Built on Windows with clang-cl. Note: the latest Vulkan SDK
  (1.4.350) fails to build against the pinned Vulkan-Headers
  submodule; used 1.4.328.1 instead, which matches it.
- Tested on a Radeon RX 9070 XT + Ryzen 7 9800X3D.
- Alex Kidd in Miracle World DX and Dreaming Sarah now boot and
  render correctly (previously failed to start or rendered
  corrupted).
- Not yet verified for regressions on NVIDIA hardware; testing from
  someone with an NVIDIA GPU would help confirm no regression there.

# AI assistance disclosure
AI assistance was used to diagnose the root cause of each issue and
prepare the initial patch. The contributor reviewed the complete
diff and tested it on the affected AMD hardware before opening this
pull request.
2026-07-18 10:46:16 +03:00
nmzik 601c82a031 format source files 2026-07-18 09:01:52 +02:00
nmzik 6c1bd853ac fix depth overlap 2026-07-18 08:51:38 +02:00
nmzik af2f2d54b6 add videoout DCC 2026-07-18 08:37:38 +02:00
nmzik 387f9e3cde add pre-commit format hook 2026-07-18 06:35:04 +02:00
nmzik da6cee924b Revert "Implement vertex swizzle"
This reverts commit f4b52cea2b.
2026-07-18 06:21:00 +02:00
nmzik 62a92abc66 refactor cache/split responsibilities 2026-07-18 06:16:14 +02:00
nmzik 78431dba4a Handle stencil storage/depth transitions 2026-07-18 04:56:20 +02:00