macOS: run on MoltenVK, and build pipelines ahead #1469

Closed
github-bot wants to merge 10 commits from gh-pr/1469/head into gh-pr/1469/base
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:07 UTC · original
mohamed-rekiba:feat/moltenvk-host-and-prebuilt-pipelines → main · +36489 −3890 · 293 files · 10 commits · closed without merging

Summary

KytyPS5 runs on macOS through MoltenVK. Pipelines are built ahead, so a draw does not wait for one.

  • Starts on macOS. Under Rosetta 2 the driver's direct memory lies at the top of the guest's reserved range (0x0fbfe00000). Without this, every game stops at agc.cpp EXIT_IF(address != DriverDmemBase).
  • Runs on a GPU without optional Vulkan features. A device decision picks each optional capability. Where one is missing, the shader takes another path: 64-bit floats in software, depth bounds tested in the pixel shader, barycentrics read at the pixel center, per-vertex inputs passed by the vertex stage.
  • Pipelines built ahead. Each game has a pipeline list in the cache folder. At start, worker threads translate the listed programs and build their pipelines. A draw whose pipeline is still building is left out when it only changes the picture.
  • Less CPU work per draw. Copy workers prepare uploads, a texture descriptor is decoded once, and the SRT walk runs as a flat list of steps. The texture cache frees idle images.
  • Read-back. Small images the GPU writes are copied back to guest memory when their command list completes, so the Unreal Engine sky light in Crash Bandicoot 4 has the right brightness.
  • Up to four players. A gamepad takes the next free player at its first button press, so the first pad pressed is player 1 and the next is player 2. Each player has its own user, standard and special port, input, motion, vibration, light bar and trigger effects; players 2 to 4 log out when their pad disconnects, and player 1 keeps the keyboard. A copy of a pad that the host reports twice never presses, so it plays as nobody. The PS button never reaches the game: a hold of it for 2 s closes the game. A gamepad remap event never stops the emulator.
  • Also: a --video-out-resolution option, --perf-counters, --bench-script (key presses replayed for measured runs), a log line naming each gamepad's vendor, product, path and driver, and SO_BROADCAST and ADCX on Rosetta 2. The GPU tests run on MoltenVK, and CI runs every unit test from one list.

Performance

Crash Bandicoot 4 on an Apple M4 Max, x86_64 under Rosetta 2, MoltenVK 1.4.2:

Without the parts below With them
First level 5–6 fps about 28 fps (28.7 on the one-minute route)

What each part is worth, measured without and with it in the same scene:

Part Without With
Shaders translated ahead on worker threads 17 frame gaps over 200 ms in 115 s 0–1
Pipelines built on worker threads 8.2 fps level average on a first run; 75 s of stops with 150 ms builds 13 fps; 11.5 fps kept with the same builds
MoltenVK driver cache not loaded from disk 76 s to load 75 MB at start none
SRT tape 6.76 ms of resource walk per frame 2.90 ms
Texture descriptors decoded once 4.10 ms of binding work per frame 3.38 ms
Texture layouts: the last 64 kept per thread about 16,800 layout computations per frame 86% answered from the kept layouts
Guest tables read by their exact bytes GPU thread busy 92 ms per frame 54 ms
Depth snapshot buffers from a pool; one snapshot for a run of depth-bounds draws 1,400 buffers made per 8 s, 0.45 ms each; 75 copies of 8 MiB per frame 140 buffers
NoContraction marks left out where the driver makes them slow 5–7 fps 11–12 fps
--video-out-resolution FullHd 10–14 fps (the game renders at 4K) 16–17 fps
Idle images freed; cache buffers cover 2 MiB chunks 27 fps falling to 7 within six minutes 20–25 fps throughout six minutes
Render passes kept whole; no barrier between read-only uses 36 ms of encoding per frame, 6–7 fps 11 ms, 9–10 fps
MoltenVK encodes on its own thread 66.5 ms of renderer work per frame 48.2 ms
Submissions in batches of 128 draws or 2 ms 14 fps 16–17 fps
Hot ranges uploaded once per guest submission 18.3 fps, 210 MB uploaded per frame 21.5 fps, 133 MB
Hot pages stay open for 32 guest frames 21.5 fps, 1,457 faults per frame 26.6 fps, 83 faults
Copy workers for uploads 26–27 fps 30.5 fps
GPU-written bytes read from buffer memory; the asking thread waits 7–20 ms per read-back, 8–10 fps about 1 ms, 11–14 fps
Colour fast clears read from the guest's metadata fill 130–170 ms of GPU-thread read-backs per frame none

The scenes, routes and render sizes differ between parts, so the rows do not add up. In one nine-minute run of the recorded route with every part, the level held 27–34 fps: the cache buffers levelled off at 654 and device memory at 4.4 GB, and a guest fault cost 40–60 µs on average (fault_us / guest_faults) throughout.

Where the work of a frame runs

Work that would hold a draw runs ahead of it, on other threads, or once for many draws. Details: docs/performance.

Where the work of a frame runs

Crash Bandicoot 4: level fps without and with each part

Pipelines: built when a draw needs them, or built ahead

The CPU path of one draw

Commits

  1. agc: the driver's direct memory lies inside the guest range on macOS
  2. macOS: run on MoltenVK, with pipelines built ahead and less CPU work per draw
  3. graphics: images the GPU wrote are copied back when their list completes
  4. graphics: push constants, the driver cache, and lanes in one-lane stages
  5. input: up to four players, each with a user, a port and a gamepad
  6. perf, ci and tests: a benchmark script, live levels in --perf-counters
  7. docs: screenshots, and where the work of a frame runs

Each commit builds on its own.

Game and build

Game ID Status
Crash Bandicoot 4: It's About Time PPSA02433 In game, about 28 fps
Contra: Operation Galuga PPSA15368 In game, about 45 fps

Test result

Result details: Both games reach controllable gameplay with correct rendering. All 84 unit tests pass on MoltenVK, the GPU tests included. Two players with two gamepads were checked in Contra: Operation Galuga.

Host system

  • OS: macOS 27.0.1 (26A434)
  • CPU: Apple M4 Max, running x86_64 under Rosetta 2
  • GPU: Apple M4 Max (Metal 4), MoltenVK 1.4.2
  • RAM / VRAM: 36 GB unified memory

Evidence

Log file: I can send it on request.

Screenshots:

Crash Bandicoot 4 Contra: Operation Galuga
Crash Bandicoot 4 Contra: Operation Galuga
**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469) `mohamed-rekiba:feat/moltenvk-host-and-prebuilt-pipelines` → `main` · +36489 −3890 · 293 files · 10 commits · closed without merging ## Summary KytyPS5 runs on macOS through MoltenVK. Pipelines are built ahead, so a draw does not wait for one. - **Starts on macOS.** Under Rosetta 2 the driver's direct memory lies at the top of the guest's reserved range (`0x0fbfe00000`). Without this, every game stops at `agc.cpp` `EXIT_IF(address != DriverDmemBase)`. - **Runs on a GPU without optional Vulkan features.** A device decision picks each optional capability. Where one is missing, the shader takes another path: 64-bit floats in software, depth bounds tested in the pixel shader, barycentrics read at the pixel center, per-vertex inputs passed by the vertex stage. - **Pipelines built ahead.** Each game has a pipeline list in the cache folder. At start, worker threads translate the listed programs and build their pipelines. A draw whose pipeline is still building is left out when it only changes the picture. - **Less CPU work per draw.** Copy workers prepare uploads, a texture descriptor is decoded once, and the SRT walk runs as a flat list of steps. The texture cache frees idle images. - **Read-back.** Small images the GPU writes are copied back to guest memory when their command list completes, so the Unreal Engine sky light in Crash Bandicoot 4 has the right brightness. - **Up to four players.** A gamepad takes the next free player at its first button press, so the first pad pressed is player 1 and the next is player 2. Each player has its own user, standard and special port, input, motion, vibration, light bar and trigger effects; players 2 to 4 log out when their pad disconnects, and player 1 keeps the keyboard. A copy of a pad that the host reports twice never presses, so it plays as nobody. The PS button never reaches the game: a hold of it for 2 s closes the game. A gamepad remap event never stops the emulator. - **Also:** a `--video-out-resolution` option, `--perf-counters`, `--bench-script` (key presses replayed for measured runs), a log line naming each gamepad's vendor, product, path and driver, and SO_BROADCAST and ADCX on Rosetta 2. The GPU tests run on MoltenVK, and CI runs every unit test from one list. ## Performance Crash Bandicoot 4 on an Apple M4 Max, x86_64 under Rosetta 2, MoltenVK 1.4.2: | | Without the parts below | With them | |---|---|---| | First level | 5–6 fps | about 28 fps (28.7 on the one-minute route) | What each part is worth, measured without and with it in the same scene: | Part | Without | With | |---|---|---| | Shaders translated ahead on worker threads | 17 frame gaps over 200 ms in 115 s | 0–1 | | Pipelines built on worker threads | 8.2 fps level average on a first run; 75 s of stops with 150 ms builds | 13 fps; 11.5 fps kept with the same builds | | MoltenVK driver cache not loaded from disk | 76 s to load 75 MB at start | none | | SRT tape | 6.76 ms of resource walk per frame | 2.90 ms | | Texture descriptors decoded once | 4.10 ms of binding work per frame | 3.38 ms | | Texture layouts: the last 64 kept per thread | about 16,800 layout computations per frame | 86% answered from the kept layouts | | Guest tables read by their exact bytes | GPU thread busy 92 ms per frame | 54 ms | | Depth snapshot buffers from a pool; one snapshot for a run of depth-bounds draws | 1,400 buffers made per 8 s, 0.45 ms each; 75 copies of 8 MiB per frame | 140 buffers | | NoContraction marks left out where the driver makes them slow | 5–7 fps | 11–12 fps | | `--video-out-resolution FullHd` | 10–14 fps (the game renders at 4K) | 16–17 fps | | Idle images freed; cache buffers cover 2 MiB chunks | 27 fps falling to 7 within six minutes | 20–25 fps throughout six minutes | | Render passes kept whole; no barrier between read-only uses | 36 ms of encoding per frame, 6–7 fps | 11 ms, 9–10 fps | | MoltenVK encodes on its own thread | 66.5 ms of renderer work per frame | 48.2 ms | | Submissions in batches of 128 draws or 2 ms | 14 fps | 16–17 fps | | Hot ranges uploaded once per guest submission | 18.3 fps, 210 MB uploaded per frame | 21.5 fps, 133 MB | | Hot pages stay open for 32 guest frames | 21.5 fps, 1,457 faults per frame | 26.6 fps, 83 faults | | Copy workers for uploads | 26–27 fps | 30.5 fps | | GPU-written bytes read from buffer memory; the asking thread waits | 7–20 ms per read-back, 8–10 fps | about 1 ms, 11–14 fps | | Colour fast clears read from the guest's metadata fill | 130–170 ms of GPU-thread read-backs per frame | none | The scenes, routes and render sizes differ between parts, so the rows do not add up. In one nine-minute run of the recorded route with every part, the level held 27–34 fps: the cache buffers levelled off at 654 and device memory at 4.4 GB, and a guest fault cost 40–60 µs on average (fault_us / guest_faults) throughout. ## Where the work of a frame runs Work that would hold a draw runs ahead of it, on other threads, or once for many draws. Details: [`docs/performance`](https://github.com/mohamed-rekiba/KytyPS5/tree/feat/moltenvk-host-and-prebuilt-pipelines/docs/performance). ![Where the work of a frame runs](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/performance/performance-overview.svg) ![Crash Bandicoot 4: level fps without and with each part](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/performance/fps-progress.svg) ![Pipelines: built when a draw needs them, or built ahead](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/performance/pipeline-timeline.svg) ![The CPU path of one draw](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/performance/draw-cpu-path.svg) ## Commits 1. agc: the driver's direct memory lies inside the guest range on macOS 2. macOS: run on MoltenVK, with pipelines built ahead and less CPU work per draw 3. graphics: images the GPU wrote are copied back when their list completes 4. graphics: push constants, the driver cache, and lanes in one-lane stages 5. input: up to four players, each with a user, a port and a gamepad 6. perf, ci and tests: a benchmark script, live levels in --perf-counters 7. docs: screenshots, and where the work of a frame runs Each commit builds on its own. ## Game and build | Game | ID | Status | |---|---|---| | Crash Bandicoot 4: It's About Time | PPSA02433 | In game, about 28 fps | | Contra: Operation Galuga | PPSA15368 | In game, about 45 fps | ## Test result **Result details:** Both games reach controllable gameplay with correct rendering. All 84 unit tests pass on MoltenVK, the GPU tests included. Two players with two gamepads were checked in Contra: Operation Galuga. ## Host system - **OS:** macOS 27.0.1 (26A434) - **CPU:** Apple M4 Max, running x86_64 under Rosetta 2 - **GPU:** Apple M4 Max (Metal 4), MoltenVK 1.4.2 - **RAM / VRAM:** 36 GB unified memory ## Evidence **Log file:** I can send it on request. **Screenshots:** | Crash Bandicoot 4 | Contra: Operation Galuga | |---|---| | ![Crash Bandicoot 4](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/screenshots/ps5-07.jpg) | ![Contra: Operation Galuga](https://raw.githubusercontent.com/mohamed-rekiba/KytyPS5/feat/moltenvk-host-and-prebuilt-pipelines/docs/screenshots/ps5-08.jpg) |
- Options for the emulator's features: video-out resolution, GPU frames
  in flight, guest memory import, GPU debug labels, frame counters, trace
  screenshots and hang reports, EA emulation and the network state. Each
  takes effect where its feature reads it.
- PerfCounters: counts of the events that cost frame time, printed every
  30 flips with --perf-counters.
- Trace (--trace-dir): one row per guest frame with its time, its
  counters and the time of each column (GPU waits, compiles, ...), plus
  keyed records and screenshots, for scripts to read after a run.
- signalDefer: a host section that a guest signal handler must not
  interrupt; the signal is delivered when the outermost section ends.
- cacheFolder: the per-user folder for what the emulator builds for
  itself (pipeline and program lists).
- BitArray set operators, an FNV-1a hash, and slot vector, profiler and
  subsystem helpers that later changes use.

Tests: perf_counters, cache_folder, bit_array.
- The driver's direct memory lies at the top of the guest's
  system-reserved range, which ends lower on macOS under Rosetta 2.
- SHA-NI and ADCX are emulated when they trap, as SSE4a is: the
  console's CPU has them, games use them without a check, and Rosetta 2
  does not translate them. ADOX is left out: Rosetta 2 hands the signal
  handler stale flags before it, so a result would be silently wrong.
- An illegal instruction that cannot be emulated names its reason.
- Tests build with the Windows allocator.

Tests: macos_sse4a (macOS only).
- A request ends with a status, headers and a body: HttpSendRequest,
  HttpReadData and the response queries answer from it.
- A service the emulator answers itself is found by
  OfflineServices::Handle. With none, a request fails as an
  unreachable server does (HTTP_ERROR_TIMEOUT).
- A hostname lookup accepts the asynchronous flag and stores the
  address as a host-order integer.
- SO_BROADCAST reads back as the guest kernel's flag bit, on every host,
  also for a P2P datagram socket.

Tests: net_resolver, kernel_file_system.
- The trial check answers 0, "not a trial". A game reads any value
  other than 0 or 1 as a failed check and falls back to its trial.
- NpWebApi2 entitlements: a request names its entitlements in the path
  or in an entitlementIds= list; each is answered as owned and active.
- CP932 conversion checks the shape of each character first, so hosts
  whose converters accept different bytes give the same result.
- APR keeps the archives a game reads open, and tells the GPU caches of
  each read before its bytes reach guest memory.

Tests: np_entitlement_access_pft, np_webapi2_entitlements, ces.
A game of EA signs in to its account services (eadp.nexus.connect,
gRPC) and then logs in to its Blaze server. Without answers it stays
signed out and offers only offline menus.

- A game that holds EA's authority key gets a built-in Blaze server,
  over TLS 1.2 (mbedTLS) on one end of a socket pair, and a patch that
  makes it trust that server's authority. The key is found by search;
  no game is named.
- The service directory names the account services with an http://
  address; connections to it reach a stand-in over cleartext HTTP/2 with
  prior knowledge (frames, HPACK, flow control). It answers the
  authorization-code and token calls; nothing checks the values.
- Blaze: pre-authentication built from the game's own request, login
  with the emulator's account and persona, the UserAuthenticated and
  UserAdded notifications, configuration, census subscriptions, and an
  empty success reply for the other calls a new user makes.
- NP Auth and NP WebApi2 answer a signed-in account for such a game.
- KYTY_EA_TRACE, KYTY_EA_UPSTREAM and KYTY_EA_DIR trace the calls,
  forward unanswered ones to EA's server, and keep replies.
- --no-emulate-ea and a launcher checkbox turn it off.

Not verified: online modes and what the empty replies mean for them.

Tests: ea_emulation_pre_auth, ea_emulation_tdf, ea_emulation_patch_plan,
ea_emulation_authentication.
- A gamepad takes the next free player at its first button press, up to
  four. Stick and sensor input and releases never take a seat, so a pad
  the host reports twice, which never presses, plays as nobody. A pad
  keeps its seat until it disconnects.
- Each player has its own standard and special port, input, motion,
  vibration, light bar and trigger effects. A player who logs out keeps
  its ports; its next pad starts from a fresh state.
- The user service reports the logins and logouts and lists the
  logged-in users without gaps.
- The PS button never reaches the game. A 2 s hold of it, or of both
  triggers on a pad without one, closes the game from player 1's pad.
- A gamepad device event never stops the emulator: a remap needs
  nothing, and a pad reported as added again is not opened twice.
- Buttons, triggers and sticks go through the user's input map.
- The log names each gamepad's vendor, product, path and driver.

Tests: player_seats, gamepad_quit, pad_input, controller_settings,
host_input.
- --bench-script replays key presses at given times or frames and logs
  the frame rate each second, for measured runs from a launch.
- --perf-counters and --trace-dir are read from the command line; the
  trace starts with the emulator and names each unresolved import.
- KYTY_INPUT_LOG writes the player's key and button presses with the
  presented frame; KYTY_AUDIO_DUMP writes what each audio port sends.
- PRINT_NAME also marks each library call in the trace.

Tests: bench_script.
- The backing of guest memory is read without a lock while its mappings
  keep their generation; every change to the mappings takes the lock
  that gives them a new one.
- Direct memory is a sealed memfd, so the GPU can import it; a range is
  translated to its backing offset when it is mapped in one piece.
- A wait on an address cannot miss a wake between its slices.
- A guest signal that arrives in a host section waits for its end.
- A guest thread that fails while the emulator ends waits for the end
  instead of reporting a crash; a crash report shows the memory the
  registers point at.
Host:
- Runs on MoltenVK: a capability layer chooses a fallback for each
  missing feature, a placeholder texture stands in where the device has
  no null descriptor, and resources stay resident while a command buffer
  that uses them is in flight.
- The shader store and the driver's pipeline cache of each game live in
  a cache folder (--pipeline-cache-folder; default: the user's cache
  folder). Compute shaders a command list will dispatch are translated
  ahead on worker threads.
- --video-out-resolution sets the output the console reports to games.

Guest memory and order:
- On Linux, buffers over direct memory are guest memory itself
  (udmabuf), with import windows built ahead; fills and copies of such
  memory run in GPU order, and memory a formatted store or a GDS save
  writes becomes a copy.
- The guest records at most --gpu-frames-in-flight frames ahead of the
  host GPU.
- The host GPU reads the counts of indirect dispatches in thread
  dimensions; a dispatch of more than 16M groups does nothing.
- A flip raises the end-of-pipe interrupt, in order with the work before
  it, when the game raised none of its own since the last flip.
- Images the GPU wrote are copied back when their command list
  completes; only whole pages are published.

Images:
- Dynamic resolution: a target rendered at a new extent keeps what the
  GPU rendered at the old one; a larger or narrower request gets an
  image of its own extent; a render pass stays inside its attachments.
- Depth images of other extents share their HTile clear state, and a
  bound depth image is not cleared again.
- Mips stop at 1x1, an image goes without the view flags its host format
  refuses, a fast clear of consecutive layers is one clear, and only the
  changed layers of an image are uploaded.

Shaders:
- A loop ends after a budget of iterations for each invocation instead
  of hanging the GPU (KYTY_LOOP_BUDGET changes the budget).
- A call inside a loop is skipped instead of stopping the emulator; a
  call through a table of functions links every function it names.
- A wave reduction or scan built from lane shifts and lane reads becomes
  a subgroup operation, also where constant propagation reveals it.
- Reads of a lane known from the code are resolved at translation
  (ReadLaneElimination); the control-flow graph follows them.
- Packed FP16 add, multiply and FMA run natively where the host has
  FP16.
- An append or consume in a one-lane stage counts as one.
- A branch target past the decoded code is not marked.

Hosts with fewer features (MoltenVK):
- 64-bit floats in software, depth bounds tested in the pixel shader,
  and fallbacks for barycentrics and other optional features, chosen by
  the host's capabilities.
- A multiply-add with denormal flushing is emitted in few instructions,
  so large shaders stay small enough to build.

Smaller code: EXEC selects that nothing reads are dropped, buffer loads
are selected by their bounds, float min and max take one instruction,
and image heap descriptors are found through a hash map.

Measurement: KYTY_GPU_TIME and KYTY_GPU_PROFILE time each frame, draw
and dispatch on the host GPU; frames.csv shows where the GPU thread's
time went; KYTY_TRACE_DRS, KYTY_TRACE_SHADERS and KYTY_TRACE_PASSES
list image, shader and pass events of chosen frames.

Tests: shader_cfg, soft_float64, scalar_provenance, resource_tracking,
compute_prescan, copy_workers, fence_retirement, frame_pacer,
guest_memory_window, guest_write_log, image_readback, queue_commits,
submit_plan, and more GPU checks in shader_recompiler_compute.
- .github/scripts/unit-tests.sh holds the unit tests CI builds and runs;
  each job checks that the list and the registered tests agree, and the
  Windows job keeps a copy that is checked against it.
- A manual run can publish its builds as a pre-release; a push to main
  releases from the repository that built it, with a GitHub App token
  when one is set up; the launcher looks for updates there.
- A new run on the same branch cancels the one in progress.
- Only the shipped programs are link-time optimized, and pull requests
  skip it.
- Docs: screenshots, where the work of a frame runs, raising the udmabuf
  limit, and the debugging and profiling tools on Linux.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:24 +00:00
github-bot closed this pull request 2026-11-26 09:57:24 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-11-08 09:36 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 2316b7a339d313970eb929920e9e0e58d03f486f
  • Latest commit, not reviewed: b644e860d8

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The PR expands graphics and shader execution with host-capability checks, asynchronous pipeline building, mesh emulation, shader-based depth bounds, and updated GPU memory synchronization. It adds performance counters, cache handling, and configuration for reported video resolution and pipeline-cache location. Controller input state moves into PadInput; socket broadcast handling and x64 instruction emulation are updated. CMake and CI gain additional unit-test targets and shared test-list validation.

Merge Risk: Moderate · previous review 2316b

Draws within the same render pass may read data before an earlier write is made visible, causing incorrect rendering. Resolve or explicitly accept that risk before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 395 functions across 60 files. (1 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the two primary changes: macOS support through MoltenVK and ahead-of-time pipeline building.
Description check Passed The description is directly related to the changeset and explains the macOS support, pipeline building, performance work, input changes, testing, and reported results.
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 395 functions across 60 files. (1 skipped: 1 unsupported.)

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

ℹ️ Recent review info

⚙️ Run configuration

  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 74616419-71aa-4138-83fe-b77169446ca2
📥 Commits

Reviewing files that changed from the base of the PR and between 1ee6777dffe89833bd307b945719fe0c5a806c4c and 2316b7a339d313970eb929920e9e0e58d03f486f.

⛔ Files ignored due to path filters (5)

  • docs/performance/draw-cpu-path.svg is excluded by !**/*.svg
  • docs/performance/performance-overview.svg is excluded by !**/*.svg
  • docs/performance/pipeline-timeline.svg is excluded by !**/*.svg
  • docs/screenshots/ps5-07.jpg is excluded by !**/*.jpg
  • docs/screenshots/ps5-08.jpg is excluded by !**/*.jpg
📒 Files selected for processing (1)

  • docs/performance/README.md
🚧 Files skipped from review as they are similar to previous changes (1)

  • docs/performance/README.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6135201369) · edited 2026-11-08 09:36 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1469?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > - Last reviewed commit: 2316b7a339d313970eb929920e9e0e58d03f486f > - Latest commit, not reviewed: b644e860d82462b20a67ee254431c369aed367f6 > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The PR expands graphics and shader execution with host-capability checks, asynchronous pipeline building, mesh emulation, shader-based depth bounds, and updated GPU memory synchronization. It adds performance counters, cache handling, and configuration for reported video resolution and pipeline-cache location. Controller input state moves into `PadInput`; socket broadcast handling and x64 instruction emulation are updated. CMake and CI gain additional unit-test targets and shared test-list validation. </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_priority:{"version":1,"urgency":"p1","manual":false} --> <!-- change_assessment_commit:"2316b7a339d313970eb929920e9e0e58d03f486f" --> <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-normal-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Moderate</strong> · previous review <code>2316b</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟡 Moderate** · up to `2316b` --> <!-- final_review_risk_coverage:{"sourceCommitId":"2316b7a339d313970eb929920e9e0e58d03f486f","coveredCommitId":"2316b7a339d313970eb929920e9e0e58d03f486f","kind":"reviewed"} --> Draws within the same render pass may read data before an earlier write is made visible, causing incorrect rendering. Resolve or explicitly accept that risk before merging. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <br> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks (1 warning)</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 395 functions across 60 files. (1 skipped… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks (4 passed)</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly identifies the two primary changes: macOS support through MoltenVK and ahead-of-time pipeline building. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is directly related to the changeset and explains the macOS support, pipeline building, performance work, input changes, testing, and reported results. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> <br> **Explanation** Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 395 functions across 60 files. (1 skipped: 1 unsupported.) </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- announcements_start --> > [!TIP] > <details> > <summary><strong>🎯 Customize your risk assessments</strong></summary> > <dl> > <dd> > <br> > > Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using **Merge Risk Instructions** and **Security Risk Instructions** in your review settings. Security architecture risk assessments require the **Advanced plan or above**. > > </dd> > </dl> > </details> > > <details> > <summary><strong>✅ Automatic approvals, with your rules</strong></summary> > <dl> > <dd> > <br> > > Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable **Automatic approvals** in review settings, with overrides for teams or file paths. > > </dd> > </dl> > </details> <!-- announcements_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1469)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <br> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> <br> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `74616419-71aa-4138-83fe-b77169446ca2` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 1ee6777dffe89833bd307b945719fe0c5a806c4c and 2316b7a339d313970eb929920e9e0e58d03f486f. </dd> </dl> </details> <details> <summary><strong>⛔ Files ignored due to path filters (5)</strong></summary> <dl> <dd> <br> * `docs/performance/draw-cpu-path.svg` is excluded by `!**/*.svg` * `docs/performance/performance-overview.svg` is excluded by `!**/*.svg` * `docs/performance/pipeline-timeline.svg` is excluded by `!**/*.svg` * `docs/screenshots/ps5-07.jpg` is excluded by `!**/*.jpg` * `docs/screenshots/ps5-08.jpg` is excluded by `!**/*.jpg` </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (1)</strong></summary> <dl> <dd> <br> * `docs/performance/README.md` </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes (1)</strong></summary> <dl> <dd> <br> * docs/performance/README.md </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 01:17 UTC
On src/graphics/guest_gpu/graphicsRun.cpp line 1285 (outdated):

@@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_
 
 void CommandProcessor::EmitGlobalBarrier() {
 	Common::LockGuard lock(m_renderer.GetMutex());
-
-	vk::MemoryBarrier2 barrier {};
-	barrier.srcStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite;
-	barrier.dstStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite;
-
-	vk::DependencyInfo dependency {};
-	dependency.memoryBarrierCount = 1;
-	dependency.pMemoryBarriers    = &barrier;
-	GetScheduler().EndRendering();
-	CurrentBuffer().Handle().pipelineBarrier2(dependency);
+	CurrentBuffer().RequestGlobalBarrier();

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C4 'ShaderWriteHazardBarrier|ShaderAccessBarrier|RequestGlobalBarrier|m_global_barrier_pending' src/graphics/host_gpu/renderer

Repository: KytyPS5/KytyPS5

Length of output: 9939


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- relevant diff ---'
git diff --unified=35 df5b9b92be7dfd463b47756b707d6d356a9f0550 d2627578db2cffc47e199cb75212eab6bdcf7732 -- \
  src/graphics/guest_gpu/graphicsRun.cpp \
  src/graphics/host_gpu/renderer/context.cpp \
  src/graphics/host_gpu/renderer/render.h \
  src/graphics/host_gpu/renderer/renderGraphics.cpp \
  src/graphics/host_gpu/renderer/renderCompute.cpp \
  src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp
printf '%s\n' '--- relevant symbols and call sites ---'
rg -n -F --glob '*.{cpp,h}' -- \
  'RequestGlobalBarrier' \
  'EmitGlobalBarrier' \
  'ShaderWriteHazardBarrier' \
  'ShaderAccessBarrier' \
  'HasShaderMemoryWrites' \
  'EndRendering' \
  'TrySendCommandSync' \
  'RELEASE_MEM' \
  'PartialFlush' \
  src/graphics src/core 2>/dev/null || true
printf '%s\n' '--- graphics renderer outlines/files ---'
rg --files src/graphics/host_gpu/renderer | sort

Repository: KytyPS5/KytyPS5

Length of output: 42682


🏁 Script executed:

printf '%s\n' 'awaiting prior request result'

Repository: KytyPS5/KytyPS5

Length of output: 183


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- graphics draw barrier-related symbols ---'
rg -n -F -- \
  'ShaderWriteBarrier' \
  'ShaderWriteHazardBarrier' \
  'ShaderAccessBarrier' \
  'HasShaderMemoryWrites' \
  'EndRendering' \
  'Draw(' \
  'draw(' \
  'BeginRendering' \
  'RequestGlobalBarrier' \
  src/graphics/host_gpu/renderer/renderDraw.cpp \
  src/graphics/host_gpu/renderer/renderDraw.h \
  src/graphics/host_gpu/renderer/renderContext.cpp \
  src/graphics/host_gpu/renderer/context.cpp \
  src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp
printf '%s\n' '--- complete relevant draw declarations ---'
sed -n '1,260p' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '--- draw remainder ---'
sed -n '261,620p' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '--- barrier implementation ---'
sed -n '1,230p' src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp

Repository: KytyPS5/KytyPS5

Length of output: 947


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- renderDraw.cpp around shader write barrier ---'
nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1410,1565p'
printf '%s\n' '--- renderDraw.cpp shader-write references ---'
rg -n -F -- 'ShaderWriteBarrier' src/graphics/host_gpu/renderer/renderDraw.cpp
rg -n -F -- 'shader_write_stages' src/graphics/host_gpu/renderer/renderDraw.cpp
rg -n -F -- 'HasShaderMemoryWrites' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '--- barrier implementation ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '134,170p'
printf '%s\n' '--- relevant command-buffer methods ---'
nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '95,155p'

Repository: KytyPS5/KytyPS5

Length of output: 13217


🏁 Script executed:

nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1410,1565p'
printf '%s\n' '---'
rg -n -F -- 'ShaderWriteBarrier' src/graphics/host_gpu/renderer/renderDraw.cpp
rg -n -F -- 'shader_write_stages' src/graphics/host_gpu/renderer/renderDraw.cpp
rg -n -F -- 'HasShaderMemoryWrites' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '134,170p'
printf '%s\n' '---'
nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '95,155p'

Repository: KytyPS5/KytyPS5

Length of output: 13060


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- shader write helper definitions ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '1,135p'
printf '%s\n' '--- helper declarations and contracts ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.h | sed -n '1,45p'
printf '%s\n' '--- draw setup write tracking ---'
nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1290,1370p'

Repository: KytyPS5/KytyPS5

Length of output: 12732


🐛 Suggested fix
-		if (HasShaderBufferWrites(stage.stage)) {
+		if (HasShaderMemoryWrites(stage.stage)) {
...
-	if (state.ps_active && HasShaderBufferWrites(state.ps_input_info.stage)) {
+	if (state.ps_active && HasShaderMemoryWrites(state.ps_input_info.stage)) {
**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501822) · edited 2026-10-13 01:17 UTC On `src/graphics/guest_gpu/graphicsRun.cpp` line 1285 (outdated): ```diff @@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_ void CommandProcessor::EmitGlobalBarrier() { Common::LockGuard lock(m_renderer.GetMutex()); - - vk::MemoryBarrier2 barrier {}; - barrier.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite; - barrier.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite; - - vk::DependencyInfo dependency {}; - dependency.memoryBarrierCount = 1; - dependency.pMemoryBarriers = &barrier; - GetScheduler().EndRendering(); - CurrentBuffer().Handle().pipelineBarrier2(dependency); + CurrentBuffer().RequestGlobalBarrier(); ``` **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash rg -nP -C4 'ShaderWriteHazardBarrier|ShaderAccessBarrier|RequestGlobalBarrier|m_global_barrier_pending' src/graphics/host_gpu/renderer ``` Repository: KytyPS5/KytyPS5 Length of output: 9939 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- relevant diff ---' git diff --unified=35 df5b9b92be7dfd463b47756b707d6d356a9f0550 d2627578db2cffc47e199cb75212eab6bdcf7732 -- \ src/graphics/guest_gpu/graphicsRun.cpp \ src/graphics/host_gpu/renderer/context.cpp \ src/graphics/host_gpu/renderer/render.h \ src/graphics/host_gpu/renderer/renderGraphics.cpp \ src/graphics/host_gpu/renderer/renderCompute.cpp \ src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp printf '%s\n' '--- relevant symbols and call sites ---' rg -n -F --glob '*.{cpp,h}' -- \ 'RequestGlobalBarrier' \ 'EmitGlobalBarrier' \ 'ShaderWriteHazardBarrier' \ 'ShaderAccessBarrier' \ 'HasShaderMemoryWrites' \ 'EndRendering' \ 'TrySendCommandSync' \ 'RELEASE_MEM' \ 'PartialFlush' \ src/graphics src/core 2>/dev/null || true printf '%s\n' '--- graphics renderer outlines/files ---' rg --files src/graphics/host_gpu/renderer | sort ``` Repository: KytyPS5/KytyPS5 Length of output: 42682 --- 🏁 Script executed: ```bash printf '%s\n' 'awaiting prior request result' ``` Repository: KytyPS5/KytyPS5 Length of output: 183 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- graphics draw barrier-related symbols ---' rg -n -F -- \ 'ShaderWriteBarrier' \ 'ShaderWriteHazardBarrier' \ 'ShaderAccessBarrier' \ 'HasShaderMemoryWrites' \ 'EndRendering' \ 'Draw(' \ 'draw(' \ 'BeginRendering' \ 'RequestGlobalBarrier' \ src/graphics/host_gpu/renderer/renderDraw.cpp \ src/graphics/host_gpu/renderer/renderDraw.h \ src/graphics/host_gpu/renderer/renderContext.cpp \ src/graphics/host_gpu/renderer/context.cpp \ src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp printf '%s\n' '--- complete relevant draw declarations ---' sed -n '1,260p' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '--- draw remainder ---' sed -n '261,620p' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '--- barrier implementation ---' sed -n '1,230p' src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 947 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- renderDraw.cpp around shader write barrier ---' nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1410,1565p' printf '%s\n' '--- renderDraw.cpp shader-write references ---' rg -n -F -- 'ShaderWriteBarrier' src/graphics/host_gpu/renderer/renderDraw.cpp rg -n -F -- 'shader_write_stages' src/graphics/host_gpu/renderer/renderDraw.cpp rg -n -F -- 'HasShaderMemoryWrites' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '--- barrier implementation ---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '134,170p' printf '%s\n' '--- relevant command-buffer methods ---' nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '95,155p' ``` Repository: KytyPS5/KytyPS5 Length of output: 13217 --- 🏁 Script executed: ```bash nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1410,1565p' printf '%s\n' '---' rg -n -F -- 'ShaderWriteBarrier' src/graphics/host_gpu/renderer/renderDraw.cpp rg -n -F -- 'shader_write_stages' src/graphics/host_gpu/renderer/renderDraw.cpp rg -n -F -- 'HasShaderMemoryWrites' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '134,170p' printf '%s\n' '---' nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '95,155p' ``` Repository: KytyPS5/KytyPS5 Length of output: 13060 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- shader write helper definitions ---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp | sed -n '1,135p' printf '%s\n' '--- helper declarations and contracts ---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.h | sed -n '1,45p' printf '%s\n' '--- draw setup write tracking ---' nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '1290,1370p' ``` Repository: KytyPS5/KytyPS5 Length of output: 12732 --- </details> <details> <summary>🐛 Suggested fix</summary> ```diff - if (HasShaderBufferWrites(stage.stage)) { + if (HasShaderMemoryWrites(stage.stage)) { ... - if (state.ps_active && HasShaderBufferWrites(state.ps_input_info.stage)) { + if (state.ps_active && HasShaderMemoryWrites(state.ps_input_info.stage)) { ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:e20211ce86af755c8adc9969 --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 00:34 UTC
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 435 (outdated):

@@ -413,7 +424,15 @@ void TextureCache::UntrackImageTail(ImageId id) {
 }
 
 void TextureCache::TrackImageDownload(ImageId id, Image& image) {
-	if (m_readback_linear_images && !image.info.IsTiled() && !image.info.data.Empty()) {
+	const auto& info = image.info;
+	if (ReadsBackToGuest({.width            = info.extent.width,
+	                      .height           = info.extent.height,
+	                      .depth            = info.extent.depth,
+	                      .layers           = info.resources.layers,
+	                      .tiled            = info.IsTiled(),
+	                      .block_compressed = info.IsBlock()},
+	                     m_readback_linear_images) &&
+	    !info.data.Empty()) {

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C3 '\bProcessDownloadImages\s*\(' src
rg -nP -C2 'ReadbackLinearImagesEnabled|readback_linear_images' src

Repository: KytyPS5/KytyPS5

Length of output: 9271


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- TrackImageDownload and surrounding logic ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '390,475p'
printf '%s\n' '--- ProcessDownloadImages complete function ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '2215,2285p'
printf '%s\n' '--- imageReadback contract ---'
nl -ba src/graphics/host_gpu/imageReadback.h | sed -n '1,90p'
printf '%s\n' '--- relevant callers and download-set references ---'
rg -n -C3 -F -- 'm_download_images' src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.h
printf '%s\n' '--- changed lines relative to supplied base ---'
git diff --unified=20 df5b9b92be7dfd463b47756b707d6d356a9f0550 d2627578db2cffc47e199cb75212eab6bdcf7732 -- src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/imageReadback.h

Repository: KytyPS5/KytyPS5

Length of output: 42870


🏁 Script executed:

#!/bin/bash
set -e
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '400,465p'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '2225,2285p'
rg -n -C5 -F -- 'm_download_images' src/graphics/host_gpu/renderer/cache/textureCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4793


Remove the setting check from ProcessDownloadImages.

TrackImageDownload() adds eligible tiny images to m_download_images even when m_readback_linear_images is false. ProcessDownloadImages() then returns before processing that set. With the default configuration, tiny GPU-written images are not copied back to guest memory.

🐛 Suggested fix
 void TextureCache::ProcessDownloadImages() {
-	if (!m_readback_linear_images) {
-		return;
-	}
 	std::scoped_lock lock {m_lock};

✅ Addressed in commit afae11b

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501826) · edited 2026-10-13 00:34 UTC On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 435 (outdated): ```diff @@ -413,7 +424,15 @@ void TextureCache::UntrackImageTail(ImageId id) { } void TextureCache::TrackImageDownload(ImageId id, Image& image) { - if (m_readback_linear_images && !image.info.IsTiled() && !image.info.data.Empty()) { + const auto& info = image.info; + if (ReadsBackToGuest({.width = info.extent.width, + .height = info.extent.height, + .depth = info.extent.depth, + .layers = info.resources.layers, + .tiled = info.IsTiled(), + .block_compressed = info.IsBlock()}, + m_readback_linear_images) && + !info.data.Empty()) { ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash rg -nP -C3 '\bProcessDownloadImages\s*\(' src rg -nP -C2 'ReadbackLinearImagesEnabled|readback_linear_images' src ``` Repository: KytyPS5/KytyPS5 Length of output: 9271 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- TrackImageDownload and surrounding logic ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '390,475p' printf '%s\n' '--- ProcessDownloadImages complete function ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '2215,2285p' printf '%s\n' '--- imageReadback contract ---' nl -ba src/graphics/host_gpu/imageReadback.h | sed -n '1,90p' printf '%s\n' '--- relevant callers and download-set references ---' rg -n -C3 -F -- 'm_download_images' src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.h printf '%s\n' '--- changed lines relative to supplied base ---' git diff --unified=20 df5b9b92be7dfd463b47756b707d6d356a9f0550 d2627578db2cffc47e199cb75212eab6bdcf7732 -- src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/imageReadback.h ``` Repository: KytyPS5/KytyPS5 Length of output: 42870 --- 🏁 Script executed: ```bash #!/bin/bash set -e nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '400,465p' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '2225,2285p' rg -n -C5 -F -- 'm_download_images' src/graphics/host_gpu/renderer/cache/textureCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4793 --- </details> **Remove the setting check from `ProcessDownloadImages`.** `TrackImageDownload()` adds eligible tiny images to `m_download_images` even when `m_readback_linear_images` is `false`. `ProcessDownloadImages()` then returns before processing that set. With the default configuration, tiny GPU-written images are not copied back to guest memory. <details> <summary>🐛 Suggested fix</summary> ```diff void TextureCache::ProcessDownloadImages() { - if (!m_readback_linear_images) { - return; - } std::scoped_lock lock {m_lock}; ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ebe6f1054634a34ef0d4366a --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit afae11b
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 00:48 UTC
On src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp line 1849 (outdated):

@@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 		     static_cast<void*>(pixel_program.module));
 	}
 
-	auto cached = std::make_unique<Pipeline>();
-	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
-	CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-	                       ps_input_info, programs, static_params, m_driver_cache);
-	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
-
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id);
+	PipelineJob job;
+	job.rendering    = rendering;
+	job.vertex_input = key.vertex_input;
+	EXIT_IF(vertex_info.size() > job.vertex_info.size());
+	std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin());
+	job.vertex_count = static_cast<uint32_t>(vertex_info.size());
+	if (ps_input_info != nullptr) {
+		job.pixel = *ps_input_info;
+	}
+	job.programs      = programs;
+	job.static_params = static_params;
+	RememberPipeline(key, job);
+	QueueBuild(key, std::move(job));
+	return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame);
+}
 
-	auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached));
-	EXIT_IF(!inserted);
+void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) {
+	const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder];

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Stop the pipeline builders before Save() destroys m_driver_cache.

Each builder thread copies m_driver_cache into the local driver_cache when it starts. WindowRun calls PipelineCache::Save() after the window loop ends. The builder threads still run at that point, because only ~PipelineCache stops them. Save() then calls destroyPipelineCache(m_driver_cache) and sets the member to null. A builder that still has a queued or in-progress job then calls createGraphicsPipelines/createComputePipelines with the destroyed handle.

This is a use-after-destroy. It also violates the Vulkan rule that vkDestroyPipelineCache must not run while the cache is in use (external synchronization). The trigger is a release build, on a host where the cache is kept on disk (not MoltenVK), with writable lists, and with listed pipelines still building at exit. The result can be a crash or driver corruption at shutdown.

Before the cache is destroyed, stop and join the builders in Save(). Another option is to not destroy the cache in Save() and let the destructor do it after m_builders.clear().

Proposed fix
 void PipelineCache::Save() {
 	if (m_driver_cache == nullptr || m_driver_cache_path.empty() || !m_lists_writable) {
 		return;
 	}
+	// The builders use m_driver_cache; none may run while it is read and destroyed.
+	for (auto& builder: m_builders) {
+		builder.request_stop();
+	}
+	m_builders.clear();

✅ Confirmed as addressed by @⁠mohamed-rekiba

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501831) · edited 2026-10-13 00:48 UTC On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1849 (outdated): ```diff @@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( static_cast<void*>(pixel_program.module)); } - auto cached = std::make_unique<Pipeline>(); - LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); - LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id); + PipelineJob job; + job.rendering = rendering; + job.vertex_input = key.vertex_input; + EXIT_IF(vertex_info.size() > job.vertex_info.size()); + std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin()); + job.vertex_count = static_cast<uint32_t>(vertex_info.size()); + if (ps_input_info != nullptr) { + job.pixel = *ps_input_info; + } + job.programs = programs; + job.static_params = static_params; + RememberPipeline(key, job); + QueueBuild(key, std::move(job)); + return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame); +} - auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached)); - EXIT_IF(!inserted); +void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) { + const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder]; ``` **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** **Stop the pipeline builders before `Save()` destroys `m_driver_cache`.** Each builder thread copies `m_driver_cache` into the local `driver_cache` when it starts. `WindowRun` calls `PipelineCache::Save()` after the window loop ends. The builder threads still run at that point, because only `~PipelineCache` stops them. `Save()` then calls `destroyPipelineCache(m_driver_cache)` and sets the member to null. A builder that still has a queued or in-progress job then calls `createGraphicsPipelines`/`createComputePipelines` with the destroyed handle. This is a use-after-destroy. It also violates the Vulkan rule that `vkDestroyPipelineCache` must not run while the cache is in use (external synchronization). The trigger is a release build, on a host where the cache is kept on disk (not MoltenVK), with writable lists, and with listed pipelines still building at exit. The result can be a crash or driver corruption at shutdown. Before the cache is destroyed, stop and join the builders in `Save()`. Another option is to not destroy the cache in `Save()` and let the destructor do it after `m_builders.clear()`. <details> <summary>Proposed fix</summary> ```diff void PipelineCache::Save() { if (m_driver_cache == nullptr || m_driver_cache_path.empty() || !m_lists_writable) { return; } + // The builders use m_driver_cache; none may run while it is read and destroyed. + for (auto& builder: m_builders) { + builder.request_stop(); + } + m_builders.clear(); ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:d7edf288a40e3a959c0c6fc5 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠mohamed-rekiba <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 00:48 UTC
On src/graphics/host_gpu/renderer/pipeline/shaders.cpp line 518 (outdated):

@@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p
 		                  vk::ShaderStageFlagBits::eFragment);
 	}
 	CreateDescriptorLayout(graphics, pipeline, descriptor_bindings);
-	const vk::PushConstantRange push_constants {graphics_stages, 0,
-	                                            ShaderRecompiler::IR::NativePushConstantSize};
+	// An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to
+	// the pixel shader only, plus the vertex shader's record address.
+	vk::PushConstantRange push_constants[2] {
+	    {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0,
+	     ShaderRecompiler::IR::NativePushConstantSize},
+	    {vk::ShaderStageFlagBits::eVertex, 0,
+	     ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}};
 
 	vk::PipelineLayoutCreateInfo pipeline_layout_info {};
 	pipeline_layout_info.setLayoutCount         = 1;
 	pipeline_layout_info.pSetLayouts            = &pipeline.descriptor_set_layout;
-	pipeline_layout_info.pushConstantRangeCount = 1;
-	pipeline_layout_info.pPushConstantRanges    = &push_constants;
+	pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u;
+	pipeline_layout_info.pPushConstantRanges    = push_constants;

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use one push-constant range per graphics layout, and push with exactly its stage flags. The graphics layout defines ranges whose stage flags differ from the stageFlags that the draw path passes to pushConstants. VUID-vkCmdPushConstants-offset-01796 requires each push to include every stage of every range that overlaps the pushed bytes. The emulated-mesh eVertex push and the shader-side depth-bounds eFragment push break this rule. With --vulkan-validation, the debug callback exits on the first such draw. Without validation, the behavior depends on the driver.

  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp#L506-L518: create one range {stages, 0, NativePushConstantSize}, where stages is eVertex | eFragment for emulated mesh and graphics_stages otherwise. Store stages in a new PipelineCache::Pipeline::push_constant_stages field.
  • src/graphics/host_gpu/renderer/renderDraw.cpp#L1163-L1169: push the depth-bounds parameters with pipeline.push_constant_stages instead of eFragment. To do this, pass the Pipeline to ApplyDepthBoundsByShader in place of the layout. Push mesh_draw_data at Line 1465 with the same flags.
📍 Affects 2 files
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp#L506-L518 (this comment)
  • src/graphics/host_gpu/renderer/renderDraw.cpp#L1163-L1169

✅ Confirmed as addressed by @⁠mohamed-rekiba

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501837) · edited 2026-10-13 00:48 UTC On `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` line 518 (outdated): ```diff @@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p vk::ShaderStageFlagBits::eFragment); } CreateDescriptorLayout(graphics, pipeline, descriptor_bindings); - const vk::PushConstantRange push_constants {graphics_stages, 0, - ShaderRecompiler::IR::NativePushConstantSize}; + // An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to + // the pixel shader only, plus the vertex shader's record address. + vk::PushConstantRange push_constants[2] { + {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0, + ShaderRecompiler::IR::NativePushConstantSize}, + {vk::ShaderStageFlagBits::eVertex, 0, + ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}}; vk::PipelineLayoutCreateInfo pipeline_layout_info {}; pipeline_layout_info.setLayoutCount = 1; pipeline_layout_info.pSetLayouts = &pipeline.descriptor_set_layout; - pipeline_layout_info.pushConstantRangeCount = 1; - pipeline_layout_info.pPushConstantRanges = &push_constants; + pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u; + pipeline_layout_info.pPushConstantRanges = push_constants; ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Use one push-constant range per graphics layout, and push with exactly its stage flags.** The graphics layout defines ranges whose stage flags differ from the `stageFlags` that the draw path passes to `pushConstants`. VUID-vkCmdPushConstants-offset-01796 requires each push to include every stage of every range that overlaps the pushed bytes. The emulated-mesh `eVertex` push and the shader-side depth-bounds `eFragment` push break this rule. With `--vulkan-validation`, the debug callback exits on the first such draw. Without validation, the behavior depends on the driver. - `src/graphics/host_gpu/renderer/pipeline/shaders.cpp#L506-L518`: create one range `{stages, 0, NativePushConstantSize}`, where `stages` is `eVertex | eFragment` for emulated mesh and `graphics_stages` otherwise. Store `stages` in a new `PipelineCache::Pipeline::push_constant_stages` field. - `src/graphics/host_gpu/renderer/renderDraw.cpp#L1163-L1169`: push the depth-bounds parameters with `pipeline.push_constant_stages` instead of `eFragment`. To do this, pass the `Pipeline` to `ApplyDepthBoundsByShader` in place of the layout. Push `mesh_draw_data` at Line 1465 with the same flags. <details> <summary>📍 Affects 2 files</summary> - `src/graphics/host_gpu/renderer/pipeline/shaders.cpp#L506-L518` (this comment) - `src/graphics/host_gpu/renderer/renderDraw.cpp#L1163-L1169` </details> <!-- consolidated_sites_start --> <!-- <consolidated_sites> <site> <role>anchor</role> <file>src/graphics/host_gpu/renderer/pipeline/shaders.cpp</file> <line_range>506-518</line_range> </site> <site> <role>sibling</role> <file>src/graphics/host_gpu/renderer/renderDraw.cpp</file> <line_range>1163-1169</line_range> </site> </consolidated_sites> --> <!-- consolidated_sites_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:44f529af72d8d8a83bfa7b2d --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠mohamed-rekiba <!-- This is an auto-generated comment by CodeRabbit -->
@ -1570,1 +1756,4 @@
});
if (state.single_lane) {
return atomic;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 00:48 UTC

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C4 '\bsingle_lane\s*=' src/graphics
rg -nP -C3 'UsesSingleLaneModel' src/graphics

Repository: KytyPS5/KytyPS5

Length of output: 10370


🏁 Script executed:

set -e
printf '%s\n' '--- EmitAppendConsume references and definition ---'
rg -n -F -- 'EmitAppendConsume' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler
printf '%s\n' '--- affected function ---'
sed -n '1280,1435p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
printf '%s\n' '--- module capability setup and requirements ---'
rg -n -F -C5 -- 'DefineModule' src/graphics/shader/recompiler/backend/spirv
rg -n -F -C4 -- 'subgroup_ballot' src/graphics/shader/recompiler/backend/spirv
printf '%s\n' '--- append/consume IR and stage gates ---'
rg -n -i -C4 -- 'append_consume|append consume|uses_append' src/graphics/shader/recompiler

Repository: KytyPS5/KytyPS5

Length of output: 24832


🏁 Script executed:

set -e
printf '%s\n' '--- Ballot and FirstLane implementations ---'
rg -n -F -- 'Ballot(' src/graphics/shader/recompiler/backend/spirv
rg -n -F -- 'FirstLane(' src/graphics/shader/recompiler/backend/spirv
printf '%s\n' '--- single-lane predicate ---'
sed -n '35,105p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
printf '%s\n' '--- module subgroup capability block ---'
sed -n '850,885p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
printf '%s\n' '--- helper variable definition ---'
sed -n '625,650p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp

Repository: KytyPS5/KytyPS5

Length of output: 9829


🏁 Script executed:

set -e
sed -n '515,580p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp

Repository: KytyPS5/KytyPS5

Length of output: 3441


Use a count of one for active single-lane invocations.

EmitAppendConsume counts bits from the ballot even when state.single_lane is true. ValueEmitContext::Ballot replicates the predicate into all four 32-bit words in single-lane mode. The current code counts two words, so an active invocation produces count == 64 instead of 1. The atomic counter therefore advances by 64 and returns incorrect append/consume slots.

Suggested fix
-	const auto count = Binary(state, spv::OpIAdd, TypeU32(state),
-	                          Unary(state, spv::OpBitCount, TypeU32(state), low),
-	                          Unary(state, spv::OpBitCount, TypeU32(state), high));
+	const auto count =
+	    state.single_lane
+	        ? Select(state, TypeU32(state), exec, ConstantU32(state, 1), ConstantU32(state, 0))
+	        : Binary(state, spv::OpIAdd, TypeU32(state),
+	                 Unary(state, spv::OpBitCount, TypeU32(state), low),
+	                 Unary(state, spv::OpBitCount, TypeU32(state), high));

✅ Confirmed as addressed by @⁠mohamed-rekiba

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501840) · edited 2026-10-13 00:48 UTC **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash rg -nP -C4 '\bsingle_lane\s*=' src/graphics rg -nP -C3 'UsesSingleLaneModel' src/graphics ``` Repository: KytyPS5/KytyPS5 Length of output: 10370 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- EmitAppendConsume references and definition ---' rg -n -F -- 'EmitAppendConsume' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler printf '%s\n' '--- affected function ---' sed -n '1280,1435p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp printf '%s\n' '--- module capability setup and requirements ---' rg -n -F -C5 -- 'DefineModule' src/graphics/shader/recompiler/backend/spirv rg -n -F -C4 -- 'subgroup_ballot' src/graphics/shader/recompiler/backend/spirv printf '%s\n' '--- append/consume IR and stage gates ---' rg -n -i -C4 -- 'append_consume|append consume|uses_append' src/graphics/shader/recompiler ``` Repository: KytyPS5/KytyPS5 Length of output: 24832 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- Ballot and FirstLane implementations ---' rg -n -F -- 'Ballot(' src/graphics/shader/recompiler/backend/spirv rg -n -F -- 'FirstLane(' src/graphics/shader/recompiler/backend/spirv printf '%s\n' '--- single-lane predicate ---' sed -n '35,105p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp printf '%s\n' '--- module subgroup capability block ---' sed -n '850,885p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp printf '%s\n' '--- helper variable definition ---' sed -n '625,650p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 9829 --- 🏁 Script executed: ```bash set -e sed -n '515,580p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 3441 --- </details> **Use a count of one for active single-lane invocations.** `EmitAppendConsume` counts bits from the ballot even when `state.single_lane` is true. `ValueEmitContext::Ballot` replicates the predicate into all four 32-bit words in single-lane mode. The current code counts two words, so an active invocation produces `count == 64` instead of `1`. The atomic counter therefore advances by 64 and returns incorrect append/consume slots. <details> <summary>Suggested fix</summary> ```diff - const auto count = Binary(state, spv::OpIAdd, TypeU32(state), - Unary(state, spv::OpBitCount, TypeU32(state), low), - Unary(state, spv::OpBitCount, TypeU32(state), high)); + const auto count = + state.single_lane + ? Select(state, TypeU32(state), exec, ConstantU32(state, 1), ConstantU32(state, 0)) + : Binary(state, spv::OpIAdd, TypeU32(state), + Unary(state, spv::OpBitCount, TypeU32(state), low), + Unary(state, spv::OpBitCount, TypeU32(state), high)); ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:2a497b9d9effadcbce1bd22d --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠mohamed-rekiba <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · edited 2026-10-13 00:48 UTC
On src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp line 261 (outdated):

@@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) {
 	return stats;
 }
 
+namespace {
+
+Block::iterator PositionOf(Inst* inst) {
+	auto* block = inst->Parent();
+	auto  it    = std::find_if(block->begin(), block->end(),
+	                           [&](const Inst& candidate) { return &candidate == inst; });
+	EXIT_IF(it == block->end());
+	return it;
+}
+
+// What lane `lane` of a register holds, when every lane holds the same values except where
+// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the
+// lanes of a vector register, so the value must come back exactly: through the writes to other
+// lanes, and through the merges that masked writes and joining paths leave behind.
+// Every value that `seed` picks, and every value computed from one.
+template <typename Seed>
+std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) {
+	std::unordered_set<const Inst*> tainted;
+	for (bool changed = true; changed;) {
+		changed = false;
+		for (const auto* block: program.blocks) {
+			for (const auto& inst: *block) {
+				if (tainted.contains(&inst)) {
+					continue;
+				}
+				bool taint = seed(inst);
+				for (size_t index = 0; !taint && index < inst.NumArgs(); index++) {
+					const auto* argument = inst.Arg(index).Resolve().TryInstruction();
+					taint                = argument != nullptr && tainted.contains(argument);
+				}
+				if (taint) {
+					tainted.insert(&inst);
+					changed = true;
+				}
+			}
+		}
+	}
+	return tainted;
+}
+
+// Every value that holds, or is computed from, a register with a lane write. Such a value may
+// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of
+// it back exactly.
+std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) {
+	return ValuesComputedFrom(
+	    program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; });
+}
+
+// Every value computed from what differs between invocations: a vector register's first value,
+// a builtin, an attribute. A value that differs only through a branch on such a value is not
+// found.
+std::unordered_set<const Inst*> PerInvocationValues(const Program& program) {
+	return ValuesComputedFrom(program, [](const Inst& inst) {
+		switch (inst.GetOpcode()) {
+			case ValueOpcode::GetVectorRegister:
+			case ValueOpcode::GetBuiltin:
+			case ValueOpcode::GetAttribute:
+			case ValueOpcode::GetInterpolationParameter:
+			case ValueOpcode::GetTessellationAttribute:
+			case ValueOpcode::GetThreadBitScalarRegister:
+			case ValueOpcode::LaneId: return true;
+			default: return false;
+		}
+	});
+}
+
+// Once per shader: its permutations are translated one by one, on several threads.
+void ReportFirstLaneRead(const Program& program) {
+	static std::mutex                   mutex;
+	static std::unordered_set<uint64_t> reported;
+	{
+		std::lock_guard lock(mutex);
+		if (!reported.insert(program.shader_hash).second) {
+			return;
+		}
+	}
+	std::fprintf(stderr,
+	             "shader reads the first lane of a value that differs between invocations, in "
+	             "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64
+	             " stage=%u)\n",
+	             program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) {
+	EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly "
+	     "(%s): hash=0x%016" PRIx64 " stage=%u\n",
+	     what, program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+struct LaneLowering {
+	const Program&                         program;
+	const std::unordered_set<const Inst*>& with_lane_writes;
+};
+
+Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known,
+                            Value source, uint32_t lane) {
+	source     = source.Resolve();
+	auto* inst = source.TryInstruction();
+	if (inst == nullptr) {
+		return source;
+	}
+	if (const auto found = known.find(inst); found != known.end()) {
+		return found->second;
+	}
+	switch (inst->GetOpcode()) {
+		case ValueOpcode::WriteLane: {
+			const auto selector = inst->Arg(2).Resolve();
+			const auto below    = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane);
+			Value      result;
+			if (selector.IsImmediate()) {
+				result = selector.U32() == lane ? inst->Arg(1) : below;
+			} else {
+				auto*      block = inst->Parent();
+				const auto at    = PositionOf(inst);
+				const auto hit =
+				    block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)});
+				result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32,
+				                                       {Value(&*hit), inst->Arg(1), below}));

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Wrap the V_WRITELANE selector into the wave size.

The lane argument is already reduced with % program.wave_size. The immediate branch compares selector.U32() == lane without that reduction. A selector such as 35 in wave32, or 67 in wave64, then misses its lane. The read returns the value from below the write. The final lowering pass at Line 385 does apply % program.wave_size, so the two paths disagree.

selector.U32() also exits if the immediate is not U32. SearchChain checks the type first; this code does not.

The dynamic branch also compares the selector without masking it to the wave size.

Proposed fix
--- "a/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp"
+++ "b/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp"
@@ -250,13 +250,15 @@
 			const auto selector = inst->Arg(2).Resolve();
 			const auto below    = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane);
 			Value      result;
-			if (selector.IsImmediate()) {
-				result = selector.U32() == lane ? inst->Arg(1) : below;
+			if (selector.IsImmediate() && selector.GetType() == Type::U32) {
+				result = selector.U32() % lowering.program.wave_size == lane ? inst->Arg(1) : below;
 			} else {
 				auto*      block = inst->Parent();
 				const auto at    = PositionOf(inst);
+				const auto masked = block->PrependNewInst(
+				    at, ValueOpcode::BitwiseAnd32, {selector, Value(lowering.program.wave_size - 1u)});
 				const auto hit =
-				    block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)});
+				    block->PrependNewInst(at, ValueOpcode::IEqual32, {Value(&*masked), Value(lane)});
 				result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32,
 				                                       {Value(&*hit), inst->Arg(1), below}));
 			}

Apply the same masking to the dynamic selector at Lines 388-389.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			if (selector.IsImmediate() && selector.GetType() == Type::U32) {
				result = selector.U32() % lowering.program.wave_size == lane ? inst->Arg(1) : below;
			} else {
				auto*      block = inst->Parent();
				const auto at    = PositionOf(inst);
				const auto masked = block->PrependNewInst(
				    at, ValueOpcode::BitwiseAnd32, {selector, Value(lowering.program.wave_size - 1u)});
				const auto hit =
				    block->PrependNewInst(at, ValueOpcode::IEqual32, {Value(&*masked), Value(lane)});
				result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32,
				                                       {Value(&*hit), inst->Arg(1), below}));

✅ Confirmed as addressed by @⁠mohamed-rekiba

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253501843) · edited 2026-10-13 00:48 UTC On `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` line 261 (outdated): ```diff @@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) { return stats; } +namespace { + +Block::iterator PositionOf(Inst* inst) { + auto* block = inst->Parent(); + auto it = std::find_if(block->begin(), block->end(), + [&](const Inst& candidate) { return &candidate == inst; }); + EXIT_IF(it == block->end()); + return it; +} + +// What lane `lane` of a register holds, when every lane holds the same values except where +// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the +// lanes of a vector register, so the value must come back exactly: through the writes to other +// lanes, and through the merges that masked writes and joining paths leave behind. +// Every value that `seed` picks, and every value computed from one. +template <typename Seed> +std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) { + std::unordered_set<const Inst*> tainted; + for (bool changed = true; changed;) { + changed = false; + for (const auto* block: program.blocks) { + for (const auto& inst: *block) { + if (tainted.contains(&inst)) { + continue; + } + bool taint = seed(inst); + for (size_t index = 0; !taint && index < inst.NumArgs(); index++) { + const auto* argument = inst.Arg(index).Resolve().TryInstruction(); + taint = argument != nullptr && tainted.contains(argument); + } + if (taint) { + tainted.insert(&inst); + changed = true; + } + } + } + } + return tainted; +} + +// Every value that holds, or is computed from, a register with a lane write. Such a value may +// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of +// it back exactly. +std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) { + return ValuesComputedFrom( + program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; }); +} + +// Every value computed from what differs between invocations: a vector register's first value, +// a builtin, an attribute. A value that differs only through a branch on such a value is not +// found. +std::unordered_set<const Inst*> PerInvocationValues(const Program& program) { + return ValuesComputedFrom(program, [](const Inst& inst) { + switch (inst.GetOpcode()) { + case ValueOpcode::GetVectorRegister: + case ValueOpcode::GetBuiltin: + case ValueOpcode::GetAttribute: + case ValueOpcode::GetInterpolationParameter: + case ValueOpcode::GetTessellationAttribute: + case ValueOpcode::GetThreadBitScalarRegister: + case ValueOpcode::LaneId: return true; + default: return false; + } + }); +} + +// Once per shader: its permutations are translated one by one, on several threads. +void ReportFirstLaneRead(const Program& program) { + static std::mutex mutex; + static std::unordered_set<uint64_t> reported; + { + std::lock_guard lock(mutex); + if (!reported.insert(program.shader_hash).second) { + return; + } + } + std::fprintf(stderr, + "shader reads the first lane of a value that differs between invocations, in " + "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64 + " stage=%u)\n", + program.shader_hash, static_cast<unsigned>(program.stage)); +} + +[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) { + EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly " + "(%s): hash=0x%016" PRIx64 " stage=%u\n", + what, program.shader_hash, static_cast<unsigned>(program.stage)); +} + +struct LaneLowering { + const Program& program; + const std::unordered_set<const Inst*>& with_lane_writes; +}; + +Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known, + Value source, uint32_t lane) { + source = source.Resolve(); + auto* inst = source.TryInstruction(); + if (inst == nullptr) { + return source; + } + if (const auto found = known.find(inst); found != known.end()) { + return found->second; + } + switch (inst->GetOpcode()) { + case ValueOpcode::WriteLane: { + const auto selector = inst->Arg(2).Resolve(); + const auto below = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane); + Value result; + if (selector.IsImmediate()) { + result = selector.U32() == lane ? inst->Arg(1) : below; + } else { + auto* block = inst->Parent(); + const auto at = PositionOf(inst); + const auto hit = + block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)}); + result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32, + {Value(&*hit), inst->Arg(1), below})); ``` **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Wrap the `V_WRITELANE` selector into the wave size.** The `lane` argument is already reduced with `% program.wave_size`. The immediate branch compares `selector.U32() == lane` without that reduction. A selector such as 35 in wave32, or 67 in wave64, then misses its lane. The read returns the value from below the write. The final lowering pass at Line 385 does apply `% program.wave_size`, so the two paths disagree. `selector.U32()` also exits if the immediate is not `U32`. `SearchChain` checks the type first; this code does not. The dynamic branch also compares the selector without masking it to the wave size. <details> <summary>Proposed fix</summary> ```diff --- "a/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp" +++ "b/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp" @@ -250,13 +250,15 @@ const auto selector = inst->Arg(2).Resolve(); const auto below = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane); Value result; - if (selector.IsImmediate()) { - result = selector.U32() == lane ? inst->Arg(1) : below; + if (selector.IsImmediate() && selector.GetType() == Type::U32) { + result = selector.U32() % lowering.program.wave_size == lane ? inst->Arg(1) : below; } else { auto* block = inst->Parent(); const auto at = PositionOf(inst); + const auto masked = block->PrependNewInst( + at, ValueOpcode::BitwiseAnd32, {selector, Value(lowering.program.wave_size - 1u)}); const auto hit = - block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)}); + block->PrependNewInst(at, ValueOpcode::IEqual32, {Value(&*masked), Value(lane)}); result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32, {Value(&*hit), inst->Arg(1), below})); } ``` </details> Apply the same masking to the dynamic selector at Lines 388-389. <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion if (selector.IsImmediate() && selector.GetType() == Type::U32) { result = selector.U32() % lowering.program.wave_size == lane ? inst->Arg(1) : below; } else { auto* block = inst->Parent(); const auto at = PositionOf(inst); const auto masked = block->PrependNewInst( at, ValueOpcode::BitwiseAnd32, {selector, Value(lowering.program.wave_size - 1u)}); const auto hit = block->PrependNewInst(at, ValueOpcode::IEqual32, {Value(&*masked), Value(lane)}); result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32, {Value(&*hit), inst->Arg(1), below})); ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:13c32ba09877bb0f66dcefbd --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠mohamed-rekiba <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:22 UTC · original · reviewed

Actionable comments posted: 6

🧹 Nitpick comments (1)
tests/shaderCfgTests.cpp (1)

6589-6593: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Check that a missing parameter produces zero values.

The comment on Line 6589 states the contract: if the vertex shader does not write a parameter, its values are zero, not undefined. The test only calls CheckSpirvBinaryValidates on missing.control and missing.evaluation. A valid module can still feed OpUndef into the flat vertex-value outputs. In that case this test still passes, and the zero-fill regression is not caught.

Add a check on the evaluation shader text. For example, assert that it has no OpUndef.

♻️ Proposed check
   vertex_program.param_export_mask = 0b10u;
   const auto missing = BuildTriangleVertexValueShaders(vertex, pixel, true);
   CheckSpirvBinaryValidates(missing.control);
   CheckSpirvBinaryValidates(missing.evaluation);
+  Check(DisassembleSpirvBinary(missing.evaluation).find("OpUndef") == std::string::npos &&
+            DisassembleSpirvBinary(missing.control).find("OpUndef") == std::string::npos,
+        "a parameter the vertex shader does not write was left undefined");
 }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e40dc2fd-3195-4993-b97b-2373fe190f6c
📥 Commits

Reviewing files that changed from the base of the PR and between df5b9b92be and d2627578db2cffc47e199cb75212eab6bdcf7732.

⛔ Files ignored due to path filters (2)
  • docs/screenshots/ps5-07.jpg is excluded by !**/*.jpg
  • docs/screenshots/ps5-08.jpg is excluded by !**/*.jpg
📒 Files selected for processing (172)
  • .github/scripts/unit-tests.sh
  • .github/workflows/build.yml
  • .gitignore
  • CMakeLists.txt
  • README.md
  • src/common/cacheFolder.h
  • src/common/emulatorConfig.cpp
  • src/common/emulatorConfig.h
  • src/common/fileLock.cpp
  • src/common/fileLock.h
  • src/common/hash.h
  • src/common/perfCounters.cpp
  • src/common/perfCounters.h
  • src/common/profiler.h
  • src/graphics/guest_gpu/command_processor/commandProcessor.h
  • src/graphics/guest_gpu/command_processor/constRam.h
  • src/graphics/guest_gpu/command_processor/pm4Handlers.cpp
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/guest_gpu/graphicsRun.h
  • src/graphics/guest_gpu/tile.cpp
  • src/graphics/host_gpu/bufferChunk.h
  • src/graphics/host_gpu/cacheCollection.h
  • src/graphics/host_gpu/copyWorkers.h
  • src/graphics/host_gpu/depthSnapshotPlan.h
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/guestWriteLog.h
  • src/graphics/host_gpu/hostCapabilities.h
  • src/graphics/host_gpu/hostLowering.h
  • src/graphics/host_gpu/imageReadback.h
  • src/graphics/host_gpu/pageManager.cpp
  • src/graphics/host_gpu/pipelineUse.h
  • src/graphics/host_gpu/queueCommits.h
  • src/graphics/host_gpu/rangeSet.h
  • src/graphics/host_gpu/readbackPlan.h
  • src/graphics/host_gpu/regionDefinitions.h
  • src/graphics/host_gpu/regionManager.h
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.h
  • src/graphics/host_gpu/renderer/cache/samplerCache.cpp
  • src/graphics/host_gpu/renderer/cache/samplerCache.h
  • src/graphics/host_gpu/renderer/cache/streamBuffer.cpp
  • src/graphics/host_gpu/renderer/cache/streamBuffer.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/commandScheduler.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.h
  • src/graphics/host_gpu/renderer/context.cpp
  • src/graphics/host_gpu/renderer/depthRenderTarget.cpp
  • src/graphics/host_gpu/renderer/dynamicState.cpp
  • src/graphics/host_gpu/renderer/fenceRetirement.h
  • src/graphics/host_gpu/renderer/image/colorMetadataFill.h
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/image.h
  • src/graphics/host_gpu/renderer/image/imageView.cpp
  • src/graphics/host_gpu/renderer/masterSemaphore.cpp
  • src/graphics/host_gpu/renderer/masterSemaphore.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptors.h
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.h
  • src/graphics/host_gpu/renderer/pipeline/programList.h
  • src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp
  • src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.h
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp
  • src/graphics/host_gpu/renderer/render.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • src/graphics/host_gpu/renderer/renderContext.cpp
  • src/graphics/host_gpu/renderer/renderContext.h
  • src/graphics/host_gpu/renderer/renderDraw.cpp
  • src/graphics/host_gpu/renderer/sync.cpp
  • src/graphics/host_gpu/submitPlan.h
  • src/graphics/host_gpu/vertexSubgroupProbe.cpp
  • src/graphics/host_gpu/vertexSubgroupProbe.h
  • src/graphics/host_gpu/vulkanCommon.h
  • src/graphics/host_gpu/writeHeat.h
  • src/graphics/host_gpu/writeWatchSet.h
  • src/graphics/presentation/overlayQueue.h
  • src/graphics/presentation/systemOverlay.cpp
  • src/graphics/presentation/videoOut.cpp
  • src/graphics/presentation/videoOutResolution.h
  • src/graphics/presentation/window/deviceSuitability.cpp
  • src/graphics/presentation/window/deviceSuitability.h
  • src/graphics/presentation/window/swapchain.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/presentation/window/window.cpp
  • src/graphics/presentation/window/windowInternal.h
  • src/graphics/shader/capturedVertexLayout.h
  • src/graphics/shader/recompiler/ShaderRecompiler.cpp
  • src/graphics/shader/recompiler/ShaderRecompiler.h
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
  • src/graphics/shader/recompiler/backend/spirv/softFloat64.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterCapturedReplay.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFloat64.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMesh.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp
  • src/graphics/shader/recompiler/frontend/translate/Memory.cpp
  • src/graphics/shader/recompiler/ir/Program.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/Value.cpp
  • src/graphics/shader/recompiler/ir/Value.h
  • src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp
  • src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.h
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.h
  • src/graphics/shader/rectListShader.cpp
  • src/graphics/shader/shader.cpp
  • src/graphics/shader/shader.h
  • src/graphics/shader/shaderCompiler.h
  • src/graphics/shader/shaderPixelParameter.cpp
  • src/graphics/shader/triangleVertexValueShader.cpp
  • src/graphics/shader/triangleVertexValueShader.h
  • src/kernel/pthread.cpp
  • src/launcher/forms/configuration_edit_dialog.ui
  • src/launcher/include/configuration.h
  • src/launcher/src/configuration.cpp
  • src/launcher/src/configurationEditDialog.cpp
  • src/launcher/src/mainDialog.cpp
  • src/libs/agc.cpp
  • src/libs/agc.h
  • src/libs/controller.cpp
  • src/libs/network.cpp
  • src/libs/padInput.cpp
  • src/libs/padInput.h
  • src/loader/runtimeLinker.cpp
  • src/loader/x64InstructionEmulator.cpp
  • src/loader/x64InstructionEmulator.h
  • src/main.cpp
  • tests/BufferChunkTests.cpp
  • tests/CacheCollectionTests.cpp
  • tests/CacheFolderTests.cpp
  • tests/ConstRamTests.cpp
  • tests/ControllerSettingsTests.cpp
  • tests/CopyWorkersTests.cpp
  • tests/DepthSnapshotPlanTests.cpp
  • tests/DeviceSuitabilityTests.cpp
  • tests/FenceRetirementTests.cpp
  • tests/FileLockTests.cpp
  • tests/GuestWriteLogTests.cpp
  • tests/HostLoweringTests.cpp
  • tests/ImageReadbackTests.cpp
  • tests/KernelFileSystemTests.cpp
  • tests/MemoryTrackerTests.cpp
  • tests/MetadataFillTests.cpp
  • tests/OverlayQueueTests.cpp
  • tests/PadInputTests.cpp
  • tests/PerfCountersTests.cpp
  • tests/PipelineUseTests.cpp
  • tests/ProgramListTests.cpp
  • tests/QueueCommitsTests.cpp
  • tests/ReadbackPlanTests.cpp
  • tests/ResourceMaterializationTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/SoftFloat64Tests.cpp
  • tests/SubmitPlanTests.cpp
  • tests/VideoOutResolutionTests.cpp
  • tests/WriteHeatTests.cpp
  • tests/macosSse4aTests.cpp
  • tests/shaderCfgTests.cpp
💤 Files with no reviewable changes (2)
  • src/libs/agc.cpp
  • src/graphics/shader/recompiler/ir/Value.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#pullrequestreview-5497338990) · **reviewed** **Actionable comments posted: 6** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>tests/shaderCfgTests.cpp (1)</summary><blockquote> `6589-6593`: **📐 Maintainability & Code Quality** | **🔵 Trivial** | **⚡ Quick win** **Check that a missing parameter produces zero values.** The comment on Line 6589 states the contract: if the vertex shader does not write a parameter, its values are zero, not undefined. The test only calls `CheckSpirvBinaryValidates` on `missing.control` and `missing.evaluation`. A valid module can still feed `OpUndef` into the flat vertex-value outputs. In that case this test still passes, and the zero-fill regression is not caught. Add a check on the evaluation shader text. For example, assert that it has no `OpUndef`. <details> <summary>♻️ Proposed check</summary> ```diff vertex_program.param_export_mask = 0b10u; const auto missing = BuildTriangleVertexValueShaders(vertex, pixel, true); CheckSpirvBinaryValidates(missing.control); CheckSpirvBinaryValidates(missing.evaluation); + Check(DisassembleSpirvBinary(missing.evaluation).find("OpUndef") == std::string::npos && + DisassembleSpirvBinary(missing.control).find("OpUndef") == std::string::npos, + "a parameter the vertex shader does not write was left undefined"); } ``` </details> <!-- cr-comment:v1:e47b643591b889d0ba675e88 --> </blockquote></details> </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `e40dc2fd-3195-4993-b97b-2373fe190f6c` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between df5b9b92be7dfd463b47756b707d6d356a9f0550 and d2627578db2cffc47e199cb75212eab6bdcf7732. </details> <details> <summary>⛔ Files ignored due to path filters (2)</summary> * `docs/screenshots/ps5-07.jpg` is excluded by `!**/*.jpg` * `docs/screenshots/ps5-08.jpg` is excluded by `!**/*.jpg` </details> <details> <summary>📒 Files selected for processing (172)</summary> * `.github/scripts/unit-tests.sh` * `.github/workflows/build.yml` * `.gitignore` * `CMakeLists.txt` * `README.md` * `src/common/cacheFolder.h` * `src/common/emulatorConfig.cpp` * `src/common/emulatorConfig.h` * `src/common/fileLock.cpp` * `src/common/fileLock.h` * `src/common/hash.h` * `src/common/perfCounters.cpp` * `src/common/perfCounters.h` * `src/common/profiler.h` * `src/graphics/guest_gpu/command_processor/commandProcessor.h` * `src/graphics/guest_gpu/command_processor/constRam.h` * `src/graphics/guest_gpu/command_processor/pm4Handlers.cpp` * `src/graphics/guest_gpu/graphicsRun.cpp` * `src/graphics/guest_gpu/graphicsRun.h` * `src/graphics/guest_gpu/tile.cpp` * `src/graphics/host_gpu/bufferChunk.h` * `src/graphics/host_gpu/cacheCollection.h` * `src/graphics/host_gpu/copyWorkers.h` * `src/graphics/host_gpu/depthSnapshotPlan.h` * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/guestWriteLog.h` * `src/graphics/host_gpu/hostCapabilities.h` * `src/graphics/host_gpu/hostLowering.h` * `src/graphics/host_gpu/imageReadback.h` * `src/graphics/host_gpu/pageManager.cpp` * `src/graphics/host_gpu/pipelineUse.h` * `src/graphics/host_gpu/queueCommits.h` * `src/graphics/host_gpu/rangeSet.h` * `src/graphics/host_gpu/readbackPlan.h` * `src/graphics/host_gpu/regionDefinitions.h` * `src/graphics/host_gpu/regionManager.h` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.h` * `src/graphics/host_gpu/renderer/cache/samplerCache.cpp` * `src/graphics/host_gpu/renderer/cache/samplerCache.h` * `src/graphics/host_gpu/renderer/cache/streamBuffer.cpp` * `src/graphics/host_gpu/renderer/cache/streamBuffer.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/commandScheduler.cpp` * `src/graphics/host_gpu/renderer/commandScheduler.h` * `src/graphics/host_gpu/renderer/context.cpp` * `src/graphics/host_gpu/renderer/depthRenderTarget.cpp` * `src/graphics/host_gpu/renderer/dynamicState.cpp` * `src/graphics/host_gpu/renderer/fenceRetirement.h` * `src/graphics/host_gpu/renderer/image/colorMetadataFill.h` * `src/graphics/host_gpu/renderer/image/image.cpp` * `src/graphics/host_gpu/renderer/image/image.h` * `src/graphics/host_gpu/renderer/image/imageView.cpp` * `src/graphics/host_gpu/renderer/masterSemaphore.cpp` * `src/graphics/host_gpu/renderer/masterSemaphore.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/pipeline/descriptors.h` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.h` * `src/graphics/host_gpu/renderer/pipeline/programList.h` * `src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.cpp` * `src/graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.h` * `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` * `src/graphics/host_gpu/renderer/render.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `src/graphics/host_gpu/renderer/renderContext.cpp` * `src/graphics/host_gpu/renderer/renderContext.h` * `src/graphics/host_gpu/renderer/renderDraw.cpp` * `src/graphics/host_gpu/renderer/sync.cpp` * `src/graphics/host_gpu/submitPlan.h` * `src/graphics/host_gpu/vertexSubgroupProbe.cpp` * `src/graphics/host_gpu/vertexSubgroupProbe.h` * `src/graphics/host_gpu/vulkanCommon.h` * `src/graphics/host_gpu/writeHeat.h` * `src/graphics/host_gpu/writeWatchSet.h` * `src/graphics/presentation/overlayQueue.h` * `src/graphics/presentation/systemOverlay.cpp` * `src/graphics/presentation/videoOut.cpp` * `src/graphics/presentation/videoOutResolution.h` * `src/graphics/presentation/window/deviceSuitability.cpp` * `src/graphics/presentation/window/deviceSuitability.h` * `src/graphics/presentation/window/swapchain.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/presentation/window/window.cpp` * `src/graphics/presentation/window/windowInternal.h` * `src/graphics/shader/capturedVertexLayout.h` * `src/graphics/shader/recompiler/ShaderRecompiler.cpp` * `src/graphics/shader/recompiler/ShaderRecompiler.h` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h` * `src/graphics/shader/recompiler/backend/spirv/softFloat64.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterCapturedReplay.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFloat64.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMesh.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp` * `src/graphics/shader/recompiler/frontend/translate/Memory.cpp` * `src/graphics/shader/recompiler/ir/Program.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/Value.cpp` * `src/graphics/shader/recompiler/ir/Value.h` * `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` * `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.h` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h` * `src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp` * `src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp` * `src/graphics/shader/recompiler/ir/passes/SrtWalker.h` * `src/graphics/shader/rectListShader.cpp` * `src/graphics/shader/shader.cpp` * `src/graphics/shader/shader.h` * `src/graphics/shader/shaderCompiler.h` * `src/graphics/shader/shaderPixelParameter.cpp` * `src/graphics/shader/triangleVertexValueShader.cpp` * `src/graphics/shader/triangleVertexValueShader.h` * `src/kernel/pthread.cpp` * `src/launcher/forms/configuration_edit_dialog.ui` * `src/launcher/include/configuration.h` * `src/launcher/src/configuration.cpp` * `src/launcher/src/configurationEditDialog.cpp` * `src/launcher/src/mainDialog.cpp` * `src/libs/agc.cpp` * `src/libs/agc.h` * `src/libs/controller.cpp` * `src/libs/network.cpp` * `src/libs/padInput.cpp` * `src/libs/padInput.h` * `src/loader/runtimeLinker.cpp` * `src/loader/x64InstructionEmulator.cpp` * `src/loader/x64InstructionEmulator.h` * `src/main.cpp` * `tests/BufferChunkTests.cpp` * `tests/CacheCollectionTests.cpp` * `tests/CacheFolderTests.cpp` * `tests/ConstRamTests.cpp` * `tests/ControllerSettingsTests.cpp` * `tests/CopyWorkersTests.cpp` * `tests/DepthSnapshotPlanTests.cpp` * `tests/DeviceSuitabilityTests.cpp` * `tests/FenceRetirementTests.cpp` * `tests/FileLockTests.cpp` * `tests/GuestWriteLogTests.cpp` * `tests/HostLoweringTests.cpp` * `tests/ImageReadbackTests.cpp` * `tests/KernelFileSystemTests.cpp` * `tests/MemoryTrackerTests.cpp` * `tests/MetadataFillTests.cpp` * `tests/OverlayQueueTests.cpp` * `tests/PadInputTests.cpp` * `tests/PerfCountersTests.cpp` * `tests/PipelineUseTests.cpp` * `tests/ProgramListTests.cpp` * `tests/QueueCommitsTests.cpp` * `tests/ReadbackPlanTests.cpp` * `tests/ResourceMaterializationTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/SoftFloat64Tests.cpp` * `tests/SubmitPlanTests.cpp` * `tests/VideoOutResolutionTests.cpp` * `tests/WriteHeatTests.cpp` * `tests/macosSse4aTests.cpp` * `tests/shaderCfgTests.cpp` </details> <details> <summary>💤 Files with no reviewable changes (2)</summary> * src/libs/agc.cpp * src/graphics/shader/recompiler/ir/Value.cpp </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=b06a27b5-8d09-4451-acbf-e043394b38ce attempt=2654d5bd-a0d5-41c9-ae8a-4d0606e93101 batch=1/1 -->
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:46 UTC · original
On src/graphics/guest_gpu/graphicsRun.cpp line 1285 (outdated):

@@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_
 
 void CommandProcessor::EmitGlobalBarrier() {
 	Common::LockGuard lock(m_renderer.GetMutex());
-
-	vk::MemoryBarrier2 barrier {};
-	barrier.srcStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite;
-	barrier.dstStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite;
-
-	vk::DependencyInfo dependency {};
-	dependency.memoryBarrierCount = 1;
-	dependency.pMemoryBarriers    = &barrier;
-	GetScheduler().EndRendering();
-	CurrentBuffer().Handle().pipelineBarrier2(dependency);
+	CurrentBuffer().RequestGlobalBarrier();

Kept as is. The draw path's barrier is for buffers only and is unchanged from main. Storage image writes are ordered by each image's own access tracking: Image::GetBarriers emits a barrier for a repeated write or a write followed by a read of the same image, so HasShaderMemoryWrites here would add a second, global barrier for images.

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253634843) On `src/graphics/guest_gpu/graphicsRun.cpp` line 1285 (outdated): ```diff @@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_ void CommandProcessor::EmitGlobalBarrier() { Common::LockGuard lock(m_renderer.GetMutex()); - - vk::MemoryBarrier2 barrier {}; - barrier.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite; - barrier.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite; - - vk::DependencyInfo dependency {}; - dependency.memoryBarrierCount = 1; - dependency.pMemoryBarriers = &barrier; - GetScheduler().EndRendering(); - CurrentBuffer().Handle().pipelineBarrier2(dependency); + CurrentBuffer().RequestGlobalBarrier(); ``` Kept as is. The draw path's barrier is for buffers only and is unchanged from `main`. Storage image writes are ordered by each image's own access tracking: `Image::GetBarriers` emits a barrier for a repeated write or a write followed by a read of the same image, so `HasShaderMemoryWrites` here would add a second, global barrier for images.
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:46 UTC · original
On src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp line 1849 (outdated):

@@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 		     static_cast<void*>(pixel_program.module));
 	}
 
-	auto cached = std::make_unique<Pipeline>();
-	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
-	CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-	                       ps_input_info, programs, static_params, m_driver_cache);
-	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
-
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id);
+	PipelineJob job;
+	job.rendering    = rendering;
+	job.vertex_input = key.vertex_input;
+	EXIT_IF(vertex_info.size() > job.vertex_info.size());
+	std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin());
+	job.vertex_count = static_cast<uint32_t>(vertex_info.size());
+	if (ps_input_info != nullptr) {
+		job.pixel = *ps_input_info;
+	}
+	job.programs      = programs;
+	job.static_params = static_params;
+	RememberPipeline(key, job);
+	QueueBuild(key, std::move(job));
+	return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame);
+}
 
-	auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached));
-	EXIT_IF(!inserted);
+void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) {
+	const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder];

Fixed in 4f614606. Save() now writes the driver cache once and keeps it alive (m_driver_cache_saved). The destructor stops and joins the builders, then destroys the cache. Stopping the builders in Save() was not used: draws can still run after the window loop ends, and a draw that waits for its pipeline would never return.

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253635155) On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1849 (outdated): ```diff @@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( static_cast<void*>(pixel_program.module)); } - auto cached = std::make_unique<Pipeline>(); - LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); - LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id); + PipelineJob job; + job.rendering = rendering; + job.vertex_input = key.vertex_input; + EXIT_IF(vertex_info.size() > job.vertex_info.size()); + std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin()); + job.vertex_count = static_cast<uint32_t>(vertex_info.size()); + if (ps_input_info != nullptr) { + job.pixel = *ps_input_info; + } + job.programs = programs; + job.static_params = static_params; + RememberPipeline(key, job); + QueueBuild(key, std::move(job)); + return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame); +} - auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached)); - EXIT_IF(!inserted); +void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) { + const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder]; ``` Fixed in 4f614606. `Save()` now writes the driver cache once and keeps it alive (`m_driver_cache_saved`). The destructor stops and joins the builders, then destroys the cache. Stopping the builders in `Save()` was not used: draws can still run after the window loop ends, and a draw that waits for its pipeline would never return.
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:46 UTC · original
On src/graphics/host_gpu/renderer/pipeline/shaders.cpp line 518 (outdated):

@@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p
 		                  vk::ShaderStageFlagBits::eFragment);
 	}
 	CreateDescriptorLayout(graphics, pipeline, descriptor_bindings);
-	const vk::PushConstantRange push_constants {graphics_stages, 0,
-	                                            ShaderRecompiler::IR::NativePushConstantSize};
+	// An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to
+	// the pixel shader only, plus the vertex shader's record address.
+	vk::PushConstantRange push_constants[2] {
+	    {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0,
+	     ShaderRecompiler::IR::NativePushConstantSize},
+	    {vk::ShaderStageFlagBits::eVertex, 0,
+	     ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}};
 
 	vk::PipelineLayoutCreateInfo pipeline_layout_info {};
 	pipeline_layout_info.setLayoutCount         = 1;
 	pipeline_layout_info.pSetLayouts            = &pipeline.descriptor_set_layout;
-	pipeline_layout_info.pushConstantRangeCount = 1;
-	pipeline_layout_info.pPushConstantRanges    = &push_constants;
+	pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u;
+	pipeline_layout_info.pPushConstantRanges    = push_constants;

Fixed in 4f614606. A graphics layout has one range over every stage it serves (vertex + fragment for an emulated mesh draw), kept as Pipeline::push_constant_stages. The descriptor push data, the mesh draw records and the depth-bounds push all use exactly those stages.

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253635374) On `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` line 518 (outdated): ```diff @@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p vk::ShaderStageFlagBits::eFragment); } CreateDescriptorLayout(graphics, pipeline, descriptor_bindings); - const vk::PushConstantRange push_constants {graphics_stages, 0, - ShaderRecompiler::IR::NativePushConstantSize}; + // An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to + // the pixel shader only, plus the vertex shader's record address. + vk::PushConstantRange push_constants[2] { + {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0, + ShaderRecompiler::IR::NativePushConstantSize}, + {vk::ShaderStageFlagBits::eVertex, 0, + ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}}; vk::PipelineLayoutCreateInfo pipeline_layout_info {}; pipeline_layout_info.setLayoutCount = 1; pipeline_layout_info.pSetLayouts = &pipeline.descriptor_set_layout; - pipeline_layout_info.pushConstantRangeCount = 1; - pipeline_layout_info.pPushConstantRanges = &push_constants; + pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u; + pipeline_layout_info.pPushConstantRanges = push_constants; ``` Fixed in 4f614606. A graphics layout has one range over every stage it serves (vertex + fragment for an emulated mesh draw), kept as `Pipeline::push_constant_stages`. The descriptor push data, the mesh draw records and the depth-bounds push all use exactly those stages.
@ -1570,1 +1756,4 @@
});
if (state.single_lane) {
return atomic;
}
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:46 UTC · original

Fixed in 4f614606: in a one-lane stage the count is 1, and the atomic runs only for an active invocation. New test: a one-lane GDS append has no OpBitCount (shaderCfgTests).

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253635686) Fixed in 4f614606: in a one-lane stage the count is 1, and the atomic runs only for an active invocation. New test: a one-lane GDS append has no `OpBitCount` (shaderCfgTests).
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 00:46 UTC · original
On src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp line 261 (outdated):

@@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) {
 	return stats;
 }
 
+namespace {
+
+Block::iterator PositionOf(Inst* inst) {
+	auto* block = inst->Parent();
+	auto  it    = std::find_if(block->begin(), block->end(),
+	                           [&](const Inst& candidate) { return &candidate == inst; });
+	EXIT_IF(it == block->end());
+	return it;
+}
+
+// What lane `lane` of a register holds, when every lane holds the same values except where
+// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the
+// lanes of a vector register, so the value must come back exactly: through the writes to other
+// lanes, and through the merges that masked writes and joining paths leave behind.
+// Every value that `seed` picks, and every value computed from one.
+template <typename Seed>
+std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) {
+	std::unordered_set<const Inst*> tainted;
+	for (bool changed = true; changed;) {
+		changed = false;
+		for (const auto* block: program.blocks) {
+			for (const auto& inst: *block) {
+				if (tainted.contains(&inst)) {
+					continue;
+				}
+				bool taint = seed(inst);
+				for (size_t index = 0; !taint && index < inst.NumArgs(); index++) {
+					const auto* argument = inst.Arg(index).Resolve().TryInstruction();
+					taint                = argument != nullptr && tainted.contains(argument);
+				}
+				if (taint) {
+					tainted.insert(&inst);
+					changed = true;
+				}
+			}
+		}
+	}
+	return tainted;
+}
+
+// Every value that holds, or is computed from, a register with a lane write. Such a value may
+// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of
+// it back exactly.
+std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) {
+	return ValuesComputedFrom(
+	    program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; });
+}
+
+// Every value computed from what differs between invocations: a vector register's first value,
+// a builtin, an attribute. A value that differs only through a branch on such a value is not
+// found.
+std::unordered_set<const Inst*> PerInvocationValues(const Program& program) {
+	return ValuesComputedFrom(program, [](const Inst& inst) {
+		switch (inst.GetOpcode()) {
+			case ValueOpcode::GetVectorRegister:
+			case ValueOpcode::GetBuiltin:
+			case ValueOpcode::GetAttribute:
+			case ValueOpcode::GetInterpolationParameter:
+			case ValueOpcode::GetTessellationAttribute:
+			case ValueOpcode::GetThreadBitScalarRegister:
+			case ValueOpcode::LaneId: return true;
+			default: return false;
+		}
+	});
+}
+
+// Once per shader: its permutations are translated one by one, on several threads.
+void ReportFirstLaneRead(const Program& program) {
+	static std::mutex                   mutex;
+	static std::unordered_set<uint64_t> reported;
+	{
+		std::lock_guard lock(mutex);
+		if (!reported.insert(program.shader_hash).second) {
+			return;
+		}
+	}
+	std::fprintf(stderr,
+	             "shader reads the first lane of a value that differs between invocations, in "
+	             "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64
+	             " stage=%u)\n",
+	             program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) {
+	EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly "
+	     "(%s): hash=0x%016" PRIx64 " stage=%u\n",
+	     what, program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+struct LaneLowering {
+	const Program&                         program;
+	const std::unordered_set<const Inst*>& with_lane_writes;
+};
+
+Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known,
+                            Value source, uint32_t lane) {
+	source     = source.Resolve();
+	auto* inst = source.TryInstruction();
+	if (inst == nullptr) {
+		return source;
+	}
+	if (const auto found = known.find(inst); found != known.end()) {
+		return found->second;
+	}
+	switch (inst->GetOpcode()) {
+		case ValueOpcode::WriteLane: {
+			const auto selector = inst->Arg(2).Resolve();
+			const auto below    = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane);
+			Value      result;
+			if (selector.IsImmediate()) {
+				result = selector.U32() == lane ? inst->Arg(1) : below;
+			} else {
+				auto*      block = inst->Parent();
+				const auto at    = PositionOf(inst);
+				const auto hit =
+				    block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)});
+				result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32,
+				                                       {Value(&*hit), inst->Arg(1), below}));

Fixed in 4f614606. Both paths of the one-lane lowering wrap the selector into the wave: an immediate with % wave_size, a dynamic one with & (wave_size - 1), and an immediate that is not U32 takes the dynamic path. New test: a selector of 67 writes lane 3. The nitpick is in too: the missing-parameter test checks that neither shader has OpUndef.

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 00:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253635941) On `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` line 261 (outdated): ```diff @@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) { return stats; } +namespace { + +Block::iterator PositionOf(Inst* inst) { + auto* block = inst->Parent(); + auto it = std::find_if(block->begin(), block->end(), + [&](const Inst& candidate) { return &candidate == inst; }); + EXIT_IF(it == block->end()); + return it; +} + +// What lane `lane` of a register holds, when every lane holds the same values except where +// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the +// lanes of a vector register, so the value must come back exactly: through the writes to other +// lanes, and through the merges that masked writes and joining paths leave behind. +// Every value that `seed` picks, and every value computed from one. +template <typename Seed> +std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) { + std::unordered_set<const Inst*> tainted; + for (bool changed = true; changed;) { + changed = false; + for (const auto* block: program.blocks) { + for (const auto& inst: *block) { + if (tainted.contains(&inst)) { + continue; + } + bool taint = seed(inst); + for (size_t index = 0; !taint && index < inst.NumArgs(); index++) { + const auto* argument = inst.Arg(index).Resolve().TryInstruction(); + taint = argument != nullptr && tainted.contains(argument); + } + if (taint) { + tainted.insert(&inst); + changed = true; + } + } + } + } + return tainted; +} + +// Every value that holds, or is computed from, a register with a lane write. Such a value may +// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of +// it back exactly. +std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) { + return ValuesComputedFrom( + program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; }); +} + +// Every value computed from what differs between invocations: a vector register's first value, +// a builtin, an attribute. A value that differs only through a branch on such a value is not +// found. +std::unordered_set<const Inst*> PerInvocationValues(const Program& program) { + return ValuesComputedFrom(program, [](const Inst& inst) { + switch (inst.GetOpcode()) { + case ValueOpcode::GetVectorRegister: + case ValueOpcode::GetBuiltin: + case ValueOpcode::GetAttribute: + case ValueOpcode::GetInterpolationParameter: + case ValueOpcode::GetTessellationAttribute: + case ValueOpcode::GetThreadBitScalarRegister: + case ValueOpcode::LaneId: return true; + default: return false; + } + }); +} + +// Once per shader: its permutations are translated one by one, on several threads. +void ReportFirstLaneRead(const Program& program) { + static std::mutex mutex; + static std::unordered_set<uint64_t> reported; + { + std::lock_guard lock(mutex); + if (!reported.insert(program.shader_hash).second) { + return; + } + } + std::fprintf(stderr, + "shader reads the first lane of a value that differs between invocations, in " + "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64 + " stage=%u)\n", + program.shader_hash, static_cast<unsigned>(program.stage)); +} + +[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) { + EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly " + "(%s): hash=0x%016" PRIx64 " stage=%u\n", + what, program.shader_hash, static_cast<unsigned>(program.stage)); +} + +struct LaneLowering { + const Program& program; + const std::unordered_set<const Inst*>& with_lane_writes; +}; + +Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known, + Value source, uint32_t lane) { + source = source.Resolve(); + auto* inst = source.TryInstruction(); + if (inst == nullptr) { + return source; + } + if (const auto found = known.find(inst); found != known.end()) { + return found->second; + } + switch (inst->GetOpcode()) { + case ValueOpcode::WriteLane: { + const auto selector = inst->Arg(2).Resolve(); + const auto below = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane); + Value result; + if (selector.IsImmediate()) { + result = selector.U32() == lane ? inst->Arg(1) : below; + } else { + auto* block = inst->Parent(); + const auto at = PositionOf(inst); + const auto hit = + block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)}); + result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32, + {Value(&*hit), inst->Arg(1), below})); ``` Fixed in 4f614606. Both paths of the one-lane lowering wrap the selector into the wave: an immediate with `% wave_size`, a dynamic one with `& (wave_size - 1)`, and an immediate that is not U32 takes the dynamic path. New test: a selector of 67 writes lane 3. The nitpick is in too: the missing-parameter test checks that neither shader has `OpUndef`.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:48 UTC · original
On src/graphics/host_gpu/renderer/pipeline/shaders.cpp line 518 (outdated):

@@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p
 		                  vk::ShaderStageFlagBits::eFragment);
 	}
 	CreateDescriptorLayout(graphics, pipeline, descriptor_bindings);
-	const vk::PushConstantRange push_constants {graphics_stages, 0,
-	                                            ShaderRecompiler::IR::NativePushConstantSize};
+	// An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to
+	// the pixel shader only, plus the vertex shader's record address.
+	vk::PushConstantRange push_constants[2] {
+	    {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0,
+	     ShaderRecompiler::IR::NativePushConstantSize},
+	    {vk::ShaderStageFlagBits::eVertex, 0,
+	     ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}};
 
 	vk::PipelineLayoutCreateInfo pipeline_layout_info {};
 	pipeline_layout_info.setLayoutCount         = 1;
 	pipeline_layout_info.pSetLayouts            = &pipeline.descriptor_set_layout;
-	pipeline_layout_info.pushConstantRangeCount = 1;
-	pipeline_layout_info.pPushConstantRanges    = &push_constants;
+	pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u;
+	pipeline_layout_info.pPushConstantRanges    = push_constants;

@mohamed-rekiba Thanks for the fix in 4f614606. One graphics push-constant range and matching Pipeline::push_constant_stages at each push address the stage-flag mismatch.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253645171) On `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` line 518 (outdated): ```diff @@ -447,14 +503,19 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p vk::ShaderStageFlagBits::eFragment); } CreateDescriptorLayout(graphics, pipeline, descriptor_bindings); - const vk::PushConstantRange push_constants {graphics_stages, 0, - ShaderRecompiler::IR::NativePushConstantSize}; + // An emulated mesh program is bound to the compute pipeline, so the graphics layout pushes to + // the pixel shader only, plus the vertex shader's record address. + vk::PushConstantRange push_constants[2] { + {mesh_emulated ? vk::ShaderStageFlagBits::eFragment : graphics_stages, 0, + ShaderRecompiler::IR::NativePushConstantSize}, + {vk::ShaderStageFlagBits::eVertex, 0, + ShaderRecompiler::IR::PushData::MeshEmulatedDrawDwordCount * sizeof(uint32_t)}}; vk::PipelineLayoutCreateInfo pipeline_layout_info {}; pipeline_layout_info.setLayoutCount = 1; pipeline_layout_info.pSetLayouts = &pipeline.descriptor_set_layout; - pipeline_layout_info.pushConstantRangeCount = 1; - pipeline_layout_info.pPushConstantRanges = &push_constants; + pipeline_layout_info.pushConstantRangeCount = mesh_emulated ? 2u : 1u; + pipeline_layout_info.pPushConstantRanges = push_constants; ``` `@mohamed-rekiba` Thanks for the fix in `4f614606`. One graphics push-constant range and matching `Pipeline::push_constant_stages` at each push address the stage-flag mismatch. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Vulkan%20push%20constants%20must%20cover%20every%20overlapping%20stage.%20%40coderabbitai%20caught%20mismatched%20flags%E2%80%94use%20one%20range%20and%20matching%20stage%20flags%20to%20prevent%20validation%20failures.%20Try%20%40coderabbitai%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1469%23discussion_r4253501837)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -1570,1 +1756,4 @@
});
if (state.single_lane) {
return atomic;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:48 UTC · original

@mohamed-rekiba Thanks for the fix. The supplied code uses count == 1 in single-lane mode and gates the atomic with exec. This addresses the incorrect counter increment. The reported shaderCfgTests regression test covers the unwanted OpBitCount emission.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253645460) `@mohamed-rekiba` Thanks for the fix. The supplied code uses `count == 1` in single-lane mode and gates the atomic with `exec`. This addresses the incorrect counter increment. The reported `shaderCfgTests` regression test covers the unwanted `OpBitCount` emission. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Single-lane%20append%2Fconsume%20could%20advance%20slots%20by%2064.%20%40coderabbitai%20caught%20the%20ballot%20popcount%20bug%E2%80%94now%20active%20invocations%20count%20as%201%2C%20with%20regression%20coverage.%20Try%20CodeRabbit%20%F0%9F%90%87%E2%9C%85&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1469%23discussion_r4253501840)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:48 UTC · original
On src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp line 261 (outdated):

@@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) {
 	return stats;
 }
 
+namespace {
+
+Block::iterator PositionOf(Inst* inst) {
+	auto* block = inst->Parent();
+	auto  it    = std::find_if(block->begin(), block->end(),
+	                           [&](const Inst& candidate) { return &candidate == inst; });
+	EXIT_IF(it == block->end());
+	return it;
+}
+
+// What lane `lane` of a register holds, when every lane holds the same values except where
+// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the
+// lanes of a vector register, so the value must come back exactly: through the writes to other
+// lanes, and through the merges that masked writes and joining paths leave behind.
+// Every value that `seed` picks, and every value computed from one.
+template <typename Seed>
+std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) {
+	std::unordered_set<const Inst*> tainted;
+	for (bool changed = true; changed;) {
+		changed = false;
+		for (const auto* block: program.blocks) {
+			for (const auto& inst: *block) {
+				if (tainted.contains(&inst)) {
+					continue;
+				}
+				bool taint = seed(inst);
+				for (size_t index = 0; !taint && index < inst.NumArgs(); index++) {
+					const auto* argument = inst.Arg(index).Resolve().TryInstruction();
+					taint                = argument != nullptr && tainted.contains(argument);
+				}
+				if (taint) {
+					tainted.insert(&inst);
+					changed = true;
+				}
+			}
+		}
+	}
+	return tainted;
+}
+
+// Every value that holds, or is computed from, a register with a lane write. Such a value may
+// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of
+// it back exactly.
+std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) {
+	return ValuesComputedFrom(
+	    program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; });
+}
+
+// Every value computed from what differs between invocations: a vector register's first value,
+// a builtin, an attribute. A value that differs only through a branch on such a value is not
+// found.
+std::unordered_set<const Inst*> PerInvocationValues(const Program& program) {
+	return ValuesComputedFrom(program, [](const Inst& inst) {
+		switch (inst.GetOpcode()) {
+			case ValueOpcode::GetVectorRegister:
+			case ValueOpcode::GetBuiltin:
+			case ValueOpcode::GetAttribute:
+			case ValueOpcode::GetInterpolationParameter:
+			case ValueOpcode::GetTessellationAttribute:
+			case ValueOpcode::GetThreadBitScalarRegister:
+			case ValueOpcode::LaneId: return true;
+			default: return false;
+		}
+	});
+}
+
+// Once per shader: its permutations are translated one by one, on several threads.
+void ReportFirstLaneRead(const Program& program) {
+	static std::mutex                   mutex;
+	static std::unordered_set<uint64_t> reported;
+	{
+		std::lock_guard lock(mutex);
+		if (!reported.insert(program.shader_hash).second) {
+			return;
+		}
+	}
+	std::fprintf(stderr,
+	             "shader reads the first lane of a value that differs between invocations, in "
+	             "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64
+	             " stage=%u)\n",
+	             program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) {
+	EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly "
+	     "(%s): hash=0x%016" PRIx64 " stage=%u\n",
+	     what, program.shader_hash, static_cast<unsigned>(program.stage));
+}
+
+struct LaneLowering {
+	const Program&                         program;
+	const std::unordered_set<const Inst*>& with_lane_writes;
+};
+
+Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known,
+                            Value source, uint32_t lane) {
+	source     = source.Resolve();
+	auto* inst = source.TryInstruction();
+	if (inst == nullptr) {
+		return source;
+	}
+	if (const auto found = known.find(inst); found != known.end()) {
+		return found->second;
+	}
+	switch (inst->GetOpcode()) {
+		case ValueOpcode::WriteLane: {
+			const auto selector = inst->Arg(2).Resolve();
+			const auto below    = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane);
+			Value      result;
+			if (selector.IsImmediate()) {
+				result = selector.U32() == lane ? inst->Arg(1) : below;
+			} else {
+				auto*      block = inst->Parent();
+				const auto at    = PositionOf(inst);
+				const auto hit =
+				    block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)});
+				result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32,
+				                                       {Value(&*hit), inst->Arg(1), below}));

@mohamed-rekiba Thanks for the fix. The supplied code confirms that both lowering paths wrap the selector and check Type::U32 before calling U32(). The selector-67 regression test covers the reported mismatch.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253645538) On `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` line 261 (outdated): ```diff @@ -138,4 +141,260 @@ ReadLaneStats EliminateReadLane(Program& program, uint32_t wave_size) { return stats; } +namespace { + +Block::iterator PositionOf(Inst* inst) { + auto* block = inst->Parent(); + auto it = std::find_if(block->begin(), block->end(), + [&](const Inst& candidate) { return &candidate == inst; }); + EXIT_IF(it == block->end()); + return it; +} + +// What lane `lane` of a register holds, when every lane holds the same values except where +// V_WRITELANE put a scalar into one lane. A compiler keeps scalars it has no register for in the +// lanes of a vector register, so the value must come back exactly: through the writes to other +// lanes, and through the merges that masked writes and joining paths leave behind. +// Every value that `seed` picks, and every value computed from one. +template <typename Seed> +std::unordered_set<const Inst*> ValuesComputedFrom(const Program& program, Seed&& seed) { + std::unordered_set<const Inst*> tainted; + for (bool changed = true; changed;) { + changed = false; + for (const auto* block: program.blocks) { + for (const auto& inst: *block) { + if (tainted.contains(&inst)) { + continue; + } + bool taint = seed(inst); + for (size_t index = 0; !taint && index < inst.NumArgs(); index++) { + const auto* argument = inst.Arg(index).Resolve().TryInstruction(); + taint = argument != nullptr && tainted.contains(argument); + } + if (taint) { + tainted.insert(&inst); + changed = true; + } + } + } + } + return tainted; +} + +// Every value that holds, or is computed from, a register with a lane write. Such a value may +// differ from lane to lane, so only the operations LaneOfUniformRegister follows give a lane of +// it back exactly. +std::unordered_set<const Inst*> ValuesWithLaneWrites(const Program& program) { + return ValuesComputedFrom( + program, [](const Inst& inst) { return inst.GetOpcode() == ValueOpcode::WriteLane; }); +} + +// Every value computed from what differs between invocations: a vector register's first value, +// a builtin, an attribute. A value that differs only through a branch on such a value is not +// found. +std::unordered_set<const Inst*> PerInvocationValues(const Program& program) { + return ValuesComputedFrom(program, [](const Inst& inst) { + switch (inst.GetOpcode()) { + case ValueOpcode::GetVectorRegister: + case ValueOpcode::GetBuiltin: + case ValueOpcode::GetAttribute: + case ValueOpcode::GetInterpolationParameter: + case ValueOpcode::GetTessellationAttribute: + case ValueOpcode::GetThreadBitScalarRegister: + case ValueOpcode::LaneId: return true; + default: return false; + } + }); +} + +// Once per shader: its permutations are translated one by one, on several threads. +void ReportFirstLaneRead(const Program& program) { + static std::mutex mutex; + static std::unordered_set<uint64_t> reported; + { + std::lock_guard lock(mutex); + if (!reported.insert(program.shader_hash).second) { + return; + } + } + std::fprintf(stderr, + "shader reads the first lane of a value that differs between invocations, in " + "the single-lane model: each invocation reads its own (hash=0x%016" PRIx64 + " stage=%u)\n", + program.shader_hash, static_cast<unsigned>(program.stage)); +} + +[[noreturn]] void StopAtInexactLaneRead(const Program& program, const char* what) { + EXIT("shader reads a register lane in a way the single-lane model cannot give back exactly " + "(%s): hash=0x%016" PRIx64 " stage=%u\n", + what, program.shader_hash, static_cast<unsigned>(program.stage)); +} + +struct LaneLowering { + const Program& program; + const std::unordered_set<const Inst*>& with_lane_writes; +}; + +Value LaneOfUniformRegister(const LaneLowering& lowering, std::unordered_map<Inst*, Value>& known, + Value source, uint32_t lane) { + source = source.Resolve(); + auto* inst = source.TryInstruction(); + if (inst == nullptr) { + return source; + } + if (const auto found = known.find(inst); found != known.end()) { + return found->second; + } + switch (inst->GetOpcode()) { + case ValueOpcode::WriteLane: { + const auto selector = inst->Arg(2).Resolve(); + const auto below = LaneOfUniformRegister(lowering, known, inst->Arg(0), lane); + Value result; + if (selector.IsImmediate()) { + result = selector.U32() == lane ? inst->Arg(1) : below; + } else { + auto* block = inst->Parent(); + const auto at = PositionOf(inst); + const auto hit = + block->PrependNewInst(at, ValueOpcode::IEqual32, {selector, Value(lane)}); + result = Value(&*block->PrependNewInst(at, ValueOpcode::SelectU32, + {Value(&*hit), inst->Arg(1), below})); ``` `@mohamed-rekiba` Thanks for the fix. The supplied code confirms that both lowering paths wrap the selector and check `Type::U32` before calling `U32()`. The selector-67 regression test covers the reported mismatch. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Wrap%20%60V_WRITELANE%60%20selectors%20to%20the%20wave%20size%20in%20both%20immediate%20and%20dynamic%20paths%2C%20and%20guard%20non-U32%20immediates.%20A%20new%20test%20covers%20selector%2067%20in%20wave64.%20Try%20%40coderabbitai%20%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1469%23discussion_r4253501843)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 00:48 UTC · original
On src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp line 1849 (outdated):

@@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 		     static_cast<void*>(pixel_program.module));
 	}
 
-	auto cached = std::make_unique<Pipeline>();
-	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
-	CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-	                       ps_input_info, programs, static_params, m_driver_cache);
-	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
-
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id);
+	PipelineJob job;
+	job.rendering    = rendering;
+	job.vertex_input = key.vertex_input;
+	EXIT_IF(vertex_info.size() > job.vertex_info.size());
+	std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin());
+	job.vertex_count = static_cast<uint32_t>(vertex_info.size());
+	if (ps_input_info != nullptr) {
+		job.pixel = *ps_input_info;
+	}
+	job.programs      = programs;
+	job.static_params = static_params;
+	RememberPipeline(key, job);
+	QueueBuild(key, std::move(job));
+	return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame);
+}
 
-	auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached));
-	EXIT_IF(!inserted);
+void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) {
+	const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder];

@mohamed-rekiba Thanks for the clarification. The supplied code confirms that Save() keeps m_driver_cache alive and uses m_driver_cache_saved to prevent repeated saves. The destructor stops and joins the builders before it destroys the cache. This addresses the use-after-destroy finding.

Keeping the builders active after Save() also avoids blocking later draws that wait for pipeline completion.


✏️ Learnings added
Learnt from: mohamed-rekiba
Repo: KytyPS5/KytyPS5 PR: 1469
File: src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:1850-1851
Timestamp: 2026-10-13T00:48:38.658Z
Learning: In KytyPS5, draws can still run after the window loop ends. In src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp, PipelineCache::Save() must not stop the pipeline builders: a later draw can wait indefinitely in PipelineCache::WhenReady() if its pipeline is queued but no builder remains. Stop and join the builders during PipelineCache destruction before destroying the driver cache.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 00:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253646132) On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1849 (outdated): ```diff @@ -941,19 +1828,131 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( static_cast<void*>(pixel_program.module)); } - auto cached = std::make_unique<Pipeline>(); - LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); - LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + LogPipelineTrace("CreatePipelineInternal queued", vs_id, ps_id); + PipelineJob job; + job.rendering = rendering; + job.vertex_input = key.vertex_input; + EXIT_IF(vertex_info.size() > job.vertex_info.size()); + std::copy(vertex_info.begin(), vertex_info.end(), job.vertex_info.begin()); + job.vertex_count = static_cast<uint32_t>(vertex_info.size()); + if (ps_input_info != nullptr) { + job.pixel = *ps_input_info; + } + job.programs = programs; + job.static_params = static_params; + RememberPipeline(key, job); + QueueBuild(key, std::move(job)); + return WhenReady(*m_graphics_pipelines.find(key)->second, effects, frame); +} - auto [iter, inserted] = m_graphics_pipelines.emplace(std::move(key), std::move(cached)); - EXIT_IF(!inserted); +void PipelineCache::BuildPipelines(std::stop_token stop, uint32_t builder) { + const auto driver_cache = m_builder_caches.empty() ? m_driver_cache : m_builder_caches[builder]; ``` `@mohamed-rekiba` Thanks for the clarification. The supplied code confirms that `Save()` keeps `m_driver_cache` alive and uses `m_driver_cache_saved` to prevent repeated saves. The destructor stops and joins the builders before it destroys the cache. This addresses the use-after-destroy finding. Keeping the builders active after `Save()` also avoids blocking later draws that wait for pipeline completion. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: mohamed-rekiba Repo: KytyPS5/KytyPS5 PR: 1469 File: src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:1850-1851 Timestamp: 2026-10-13T00:48:38.658Z Learning: In KytyPS5, draws can still run after the window loop ends. In src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp, PipelineCache::Save() must not stop the pipeline builders: a later draw can wait indefinitely in PipelineCache::WhenReady() if its pipeline is queued but no builder remains. Stop and join the builders during PipelineCache destruction before destroying the driver cache. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Avoid%20pipeline-cache%20use-after-destroy%3A%20save%20once%2C%20keep%20the%20cache%20alive%2C%20then%20stop%20and%20join%20builders%20before%20destroying%20it%E2%80%94without%20blocking%20late%20draws.%20Try%20%40coderabbitai%20%F0%9F%9B%A1%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1469%23discussion_r4253501831)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -0,0 +29,4 @@
A pipeline that is not in the list is built on a worker, and the list keeps it for the next run.
A draw whose pipeline is still building:
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 01:10 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clarify pipeline-miss outcomes.

A picture-only draw receives a grace wait and can appear if its pipeline becomes ready during that wait. A reset-target draw can also be left out after its frame-budget wait expires because control falls through to the same grace-wait path. The current wording can therefore mislead readers about when these draws appear.

Suggested fix
- Picture-only draws are left out. Draws that reset a target wait within a per-frame budget.
+ Picture-only draws wait briefly and are left out only if the pipeline is still unavailable. Draws that reset a target wait within a per-frame budget, then can also be left out if the pipeline is still unavailable.
**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 01:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253758950) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Clarify pipeline-miss outcomes.** A picture-only draw receives a grace wait and can appear if its pipeline becomes ready during that wait. A reset-target draw can also be left out after its frame-budget wait expires because control falls through to the same grace-wait path. The current wording can therefore mislead readers about when these draws appear. <details><summary>Suggested fix</summary> ```diff - Picture-only draws are left out. Draws that reset a target wait within a per-frame budget. + Picture-only draws wait briefly and are left out only if the pipeline is still unavailable. Draws that reset a target wait within a per-frame budget, then can also be left out if the pipeline is still unavailable. ``` </details> <!-- fingerprinting:phantom:medusa:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:076f149e244976c7a031f2ba --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 01:10 UTC · original
On docs/performance/README.md line 39 (outdated):

@@ -0,0 +1,40 @@
+# Performance
+
+KytyPS5 keeps the GPU thread free for draws: work moves off that thread, runs ahead, or runs once.
+Each diagram puts the simple way, where the draw does the work on the GPU thread, next to the way KytyPS5 does it.
+The diagrams show how the work moves. They are not measurements.
+
+## Overview
+
+Each row shows work the draw can do on the GPU thread, and where KytyPS5 does it.
+
+![Where the work of a frame runs](performance-overview.svg)
+
+## Pipelines built ahead
+
+Each game gets a pipeline list in the cache folder.
+At start, worker threads translate the listed programs and build their pipelines.
+A pipeline that is not known yet is built on a worker, and the list keeps it for the next run.
+
+A draw whose pipeline is still building:
+
+- is left out when it only changes the picture;
+- waits within a per-frame budget when its target was cleared that frame;
+- waits when it writes memory or a fresh target.
+
+![Pipelines: built when a draw needs them, or built ahead](pipeline-timeline.svg)
+
+## The CPU path of one draw
+
+- **SRT tape.** A resource plan without control flow runs its SRT reads (the shader resource table) as a flat list of steps. Plans with control flow keep the walker.
+- **Texture descriptors.** A decoded descriptor is remembered per shader resource.
+- **Uploads.** Copy workers copy guest bytes into staging buffers in parallel.
+- **Pipelines.** A pipeline is built ahead, or the draw is left out while a worker builds it.
+
+![The CPU path of one draw](draw-cpu-path.svg)
+
+## Also
+
+- **Waits for the GPU.** Submissions are planned. Fences retire resources after the queue, and a resource is destroyed only when every queue commit that holds it completes.
+- **Cache memory.** The caches free idle memory in 2 MiB chunks, within a limit. Images the GPU wrote are kept.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the cache-memory description.

BUFFER_CHUNK_SIZE describes allocation coverage, not eviction. Collection uses candidate-count limits and device-memory-budget thresholds, not 2 MiB eviction chunks or a 2 MiB memory limit. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them.

Suggested fix
--- "a/docs/performance/README.md"
+++ "b/docs/performance/README.md"
@@ -36,5 +36,5 @@
 ## Also
 
 - **Waits for the GPU.** Submissions are planned. Fences retire resources after the queue, and a resource is destroyed only when every queue commit that holds it completes.
-- **Cache memory.** The caches free idle memory in 2 MiB chunks, within a limit. Images the GPU wrote are kept.
+- **Cache memory.** Cache collection uses device-memory-budget thresholds and bounded candidate batches. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them.
 - **Frame cost.** `--perf-counters` prints what a frame costs: draws, dispatches, uploads and copy regions.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

- **Cache memory.** Cache collection uses device-memory-budget thresholds and bounded candidate batches. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them.
**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 01:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253758955) On `docs/performance/README.md` line 39 (outdated): ```diff @@ -0,0 +1,40 @@ +# Performance + +KytyPS5 keeps the GPU thread free for draws: work moves off that thread, runs ahead, or runs once. +Each diagram puts the simple way, where the draw does the work on the GPU thread, next to the way KytyPS5 does it. +The diagrams show how the work moves. They are not measurements. + +## Overview + +Each row shows work the draw can do on the GPU thread, and where KytyPS5 does it. + +![Where the work of a frame runs](performance-overview.svg) + +## Pipelines built ahead + +Each game gets a pipeline list in the cache folder. +At start, worker threads translate the listed programs and build their pipelines. +A pipeline that is not known yet is built on a worker, and the list keeps it for the next run. + +A draw whose pipeline is still building: + +- is left out when it only changes the picture; +- waits within a per-frame budget when its target was cleared that frame; +- waits when it writes memory or a fresh target. + +![Pipelines: built when a draw needs them, or built ahead](pipeline-timeline.svg) + +## The CPU path of one draw + +- **SRT tape.** A resource plan without control flow runs its SRT reads (the shader resource table) as a flat list of steps. Plans with control flow keep the walker. +- **Texture descriptors.** A decoded descriptor is remembered per shader resource. +- **Uploads.** Copy workers copy guest bytes into staging buffers in parallel. +- **Pipelines.** A pipeline is built ahead, or the draw is left out while a worker builds it. + +![The CPU path of one draw](draw-cpu-path.svg) + +## Also + +- **Waits for the GPU.** Submissions are planned. Fences retire resources after the queue, and a resource is destroyed only when every queue commit that holds it completes. +- **Cache memory.** The caches free idle memory in 2 MiB chunks, within a limit. Images the GPU wrote are kept. ``` **📐 Maintainability & Code Quality** | **🟡 Minor** | **⚡ Quick win** **Correct the cache-memory description.** `BUFFER_CHUNK_SIZE` describes allocation coverage, not eviction. Collection uses candidate-count limits and device-memory-budget thresholds, not 2 MiB eviction chunks or a 2 MiB memory limit. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them. <details><summary>Suggested fix</summary> ```diff --- "a/docs/performance/README.md" +++ "b/docs/performance/README.md" @@ -36,5 +36,5 @@ ## Also - **Waits for the GPU.** Submissions are planned. Fences retire resources after the queue, and a resource is destroyed only when every queue commit that holds it completes. -- **Cache memory.** The caches free idle memory in 2 MiB chunks, within a limit. Images the GPU wrote are kept. +- **Cache memory.** Cache collection uses device-memory-budget thresholds and bounded candidate batches. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them. - **Frame cost.** `--perf-counters` prints what a frame costs: draws, dispatches, uploads and copy regions. ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion - **Cache memory.** Cache collection uses device-memory-budget thresholds and bounded candidate batches. Idle texture collection keeps GPU-written images, but memory-pressure collection can free them. ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b6caf25ad0d5f515116b0d01 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 01:10 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5aaf2904-594f-46b7-aa09-e8c397164725
📥 Commits

Reviewing files that changed from the base of the PR and between 4f614606ca7ea3323753f0700b3db50affdd0635 and 278f574c89f64cd18c591f30016ec23e48238040.

⛔ Files ignored due to path filters (3)
  • docs/performance/draw-cpu-path.svg is excluded by !**/*.svg
  • docs/performance/performance-overview.svg is excluded by !**/*.svg
  • docs/performance/pipeline-timeline.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • docs/performance/README.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 01:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#pullrequestreview-5497697187) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `5aaf2904-594f-46b7-aa09-e8c397164725` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4f614606ca7ea3323753f0700b3db50affdd0635 and 278f574c89f64cd18c591f30016ec23e48238040. </details> <details> <summary>⛔ Files ignored due to path filters (3)</summary> * `docs/performance/draw-cpu-path.svg` is excluded by `!**/*.svg` * `docs/performance/performance-overview.svg` is excluded by `!**/*.svg` * `docs/performance/pipeline-timeline.svg` is excluded by `!**/*.svg` </details> <details> <summary>📒 Files selected for processing (1)</summary> * `docs/performance/README.md` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=a331857d-5aee-4f53-85eb-d35be6faf8ed attempt=283b19de-8805-432d-a4c6-f00dbe97dcab batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-13 01:17 UTC · original
On src/graphics/guest_gpu/graphicsRun.cpp line 1285 (outdated):

@@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_
 
 void CommandProcessor::EmitGlobalBarrier() {
 	Common::LockGuard lock(m_renderer.GetMutex());
-
-	vk::MemoryBarrier2 barrier {};
-	barrier.srcStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite;
-	barrier.dstStageMask  = vk::PipelineStageFlagBits2::eAllCommands;
-	barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite;
-
-	vk::DependencyInfo dependency {};
-	dependency.memoryBarrierCount = 1;
-	dependency.pMemoryBarriers    = &barrier;
-	GetScheduler().EndRendering();
-	CurrentBuffer().Handle().pipelineBarrier2(dependency);
+	CurrentBuffer().RequestGlobalBarrier();

@mohamed-rekiba Thanks for clarifying. The draw-path barrier covers buffer writes. Image::GetBarriers separately orders repeated storage image writes and subsequent reads of the same image. My suggestion would add a redundant global barrier for those image accesses. I withdraw the finding.


✏️ Learnings added
Learnt from: mohamed-rekiba
Repo: KytyPS5/KytyPS5 PR: 1469
File: src/graphics/guest_gpu/graphicsRun.cpp:1291-1291
Timestamp: 2026-10-13T01:17:39.820Z
Learning: In KytyPS5's C++ renderer, the draw-path shader-write barrier in src/graphics/host_gpu/renderer/renderDraw.cpp intentionally uses HasShaderBufferWrites for buffer hazards. Storage image hazards use per-image access tracking in Image::GetBarriers in src/graphics/host_gpu/renderer/image/image.cpp, which emits barriers for repeated writes and write-to-read transitions on the same image. Do not replace HasShaderBufferWrites with HasShaderMemoryWrites solely to include storage image writes in the draw-path global barrier.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-13 01:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#discussion_r4253793857) On `src/graphics/guest_gpu/graphicsRun.cpp` line 1285 (outdated): ```diff @@ -1223,18 +1282,7 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_ void CommandProcessor::EmitGlobalBarrier() { Common::LockGuard lock(m_renderer.GetMutex()); - - vk::MemoryBarrier2 barrier {}; - barrier.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite; - barrier.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands; - barrier.dstAccessMask = vk::AccessFlagBits2::eMemoryRead | vk::AccessFlagBits2::eMemoryWrite; - - vk::DependencyInfo dependency {}; - dependency.memoryBarrierCount = 1; - dependency.pMemoryBarriers = &barrier; - GetScheduler().EndRendering(); - CurrentBuffer().Handle().pipelineBarrier2(dependency); + CurrentBuffer().RequestGlobalBarrier(); ``` `@mohamed-rekiba` Thanks for clarifying. The draw-path barrier covers buffer writes. `Image::GetBarriers` separately orders repeated storage image writes and subsequent reads of the same image. My suggestion would add a redundant global barrier for those image accesses. I withdraw the finding. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: mohamed-rekiba Repo: KytyPS5/KytyPS5 PR: 1469 File: src/graphics/guest_gpu/graphicsRun.cpp:1291-1291 Timestamp: 2026-10-13T01:17:39.820Z Learning: In KytyPS5's C++ renderer, the draw-path shader-write barrier in src/graphics/host_gpu/renderer/renderDraw.cpp intentionally uses HasShaderBufferWrites for buffer hazards. Storage image hazards use per-image access tracking in Image::GetBarriers in src/graphics/host_gpu/renderer/image/image.cpp, which emits barriers for repeated writes and write-to-read transitions on the same image. Do not replace HasShaderBufferWrites with HasShaderMemoryWrites solely to include storage image writes in the draw-path global barrier. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠maok625 on GitHub · 2026-10-13 17:53 UTC · original · edited 2026-10-13 18:41 UTC

Is there a build to test your PR ? I would like to test it on my Apple M4. I wanted to also ask if building the artifacts went successful for you, as I encountered some fails when building a merged version of your commits on my fork. Here are the logs :

Test project /Users/runner/work/KytyPS5-PullsTry/KytyPS5-PullsTry/_Build/macos
Start 1: emulator_user_name_cli
1/63 Test #1: emulator_user_name_cli .................. Passed 3.80 sec
Start 2: emulator_user_name_too_long
2/63 Test #2: emulator_user_name_too_long ............. Passed 0.12 sec
Start 3: emulator_present_mode_cli
3/63 Test #3: emulator_present_mode_cli ............... Passed 0.12 sec
Start 4: emulator_present_mode_invalid
4/63 Test #4: emulator_present_mode_invalid ........... Passed 0.10 sec
Start 5: emulator_video_out_resolution_cli
5/63 Test #5: emulator_video_out_resolution_cli ....... Passed 0.11 sec
Start 6: emulator_video_out_resolution_invalid
6/63 Test #6: emulator_video_out_resolution_invalid ... Passed 0.11 sec
Start 7: ime_dialog
7/63 Test #7: ime_dialog .............................. Passed 0.31 sec
Start 8: shader_cfg
8/63 Test #8: shader_cfg .............................. Passed 3.73 sec
Start 9: scalar_provenance
9/63 Test #9: scalar_provenance ....................... Passed 1.15 sec
Start 10: device_suitability
10/63 Test #10: device_suitability ...................... Passed 0.31 sec
Start 11: host_lowering
11/63 Test #11: host_lowering ........................... Passed 0.34 sec
Start 12: write_heat
12/63 Test #12: write_heat .............................. Passed 0.38 sec
Start 13: perf_counters
13/63 Test #13: perf_counters ........................... Passed 0.38 sec
Start 14: guest_write_log
14/63 Test #14: guest_write_log ......................... Passed 0.30 sec
Start 15: copy_workers
15/63 Test #15: copy_workers ............................ Passed 1.11 sec
Start 16: readback_plan
16/63 Test #16: readback_plan ........................... Passed 0.29 sec
Start 17: pipeline_use
17/63 Test #17: pipeline_use ............................ Passed 0.30 sec
Start 18: submit_plan
18/63 Test #18: submit_plan ............................. Passed 0.25 sec
Start 19: cache_collection
19/63 Test #19: cache_collection ........................ Passed 0.30 sec
Start 20: buffer_chunk
20/63 Test #20: buffer_chunk ............................ Passed 0.29 sec
Start 21: depth_snapshot_plan
21/63 Test #21: depth_snapshot_plan ..................... Passed 0.25 sec
Start 22: video_out_resolution
22/63 Test #22: video_out_resolution .................... Passed 0.30 sec
Start 23: queue_commits
23/63 Test #23: queue_commits ........................... Passed 0.27 sec
Start 24: bench_script
24/63 Test #24: bench_script ............................ Passed 0.27 sec
Start 25: cache_folder
25/63 Test #25: cache_folder ............................ Passed 0.25 sec
Start 26: file_lock
26/63 Test #26: file_lock ............................... Passed 1.25 sec
Start 27: image_page_table
27/63 Test #27: image_page_table ........................ Passed 0.30 sec
Start 28: metadata_fill
28/63 Test #28: metadata_fill ........................... Passed 0.28 sec
Start 29: fence_retirement
29/63 Test #29: fence_retirement ........................ Passed 0.32 sec
Start 30: memory_tracker
30/63 Test #30: memory_tracker .......................... Passed 1.52 sec
Start 31: page_manager
31/63 Test #31: page_manager ............................ Passed 19.68 sec
Start 32: archive_file
32/63 Test #32: archive_file ............................ Passed 0.45 sec
Start 33: trophy_system
33/63 Test #33: trophy_system ........................... Passed 0.34 sec
Start 34: avplayer_file
34/63 Test #34: avplayer_file ........................... Passed 1.93 sec
Start 35: bit_array
35/63 Test #35: bit_array ............................... Passed 0.26 sec
Start 36: lru_cache
36/63 Test #36: lru_cache ............................... Passed 0.22 sec
Start 37: program_list
37/63 Test #37: program_list ............................ Passed 0.24 sec
Start 38: soft_float64
38/63 Test #38: soft_float64 ............................ Passed 1.44 sec
Start 39: shader_vertex_metadata
39/63 Test #39: shader_vertex_metadata .................. Passed 0.30 sec
Start 40: resource_materialization
40/63 Test #40: resource_materialization ................ Passed 0.36 sec
Start 41: resource_tracking
41/63 Test #41: resource_tracking ....................... Passed 0.55 sec
Start 42: event_queue_lifetime
42/63 Test #42: event_queue_lifetime .................... Passed 0.43 sec
Start 43: kernel_file_system
43/63 Test #43: kernel_file_system ......................Subprocess aborted***Exception: 4.90 sec
KernelFileSystemTests: failed: create hidden Vulkan test window
Start 44: sync_on_address
44/63 Test #44: sync_on_address ......................... Passed 1.40 sec
Start 45: audio_out2_port
45/63 Test #45: audio_out2_port ......................... Passed 0.38 sec
Start 46: audio_out_timing
46/63 Test #46: audio_out_timing ........................ Passed 1.54 sec
Start 47: ngs2_sampler
47/63 Test #47: ngs2_sampler ............................ Passed 0.33 sec
Start 48: pad_haptics
48/63 Test #48: pad_haptics ............................. Passed 1.52 sec
Start 49: controller_settings
49/63 Test #49: controller_settings ..................... Passed 0.35 sec
Start 50: pad_input
50/63 Test #50: pad_input ............................... Passed 0.27 sec
Start 51: player_seats
51/63 Test #51: player_seats ............................ Passed 0.25 sec
Start 52: gamepad_quit
52/63 Test #52: gamepad_quit ............................ Passed 0.24 sec
Start 53: image_readback
53/63 Test #53: image_readback .......................... Passed 0.28 sec
Start 54: overlay_queue
54/63 Test #54: overlay_queue ........................... Passed 0.25 sec
Start 55: const_ram
55/63 Test #55: const_ram ............................... Passed 0.25 sec
Start 56: save_data_memory
56/63 Test #56: save_data_memory ........................ Passed 0.43 sec
Start 57: png_enc
57/63 Test #57: png_enc ................................. Passed 0.28 sec
Start 58: ces
58/63 Test #58: ces .....................................***Failed 1.29 sec
CesTests:108: CesMbcsStrToUtf8Str(context, test.source.data(), test.limit, &consumed, output.data(), output.size(), &produced) == test.error
CesTests:109: consumed == 1 && produced == 1
CesTests:112: CesMbcsStrGetUtf8Len(context, test.source.data(), test.limit, &consumed, &produced) == test.error
CesTests:113: consumed == 1 && produced == 1
Start 59: save_data_dialog
59/63 Test #59: save_data_dialog ........................ Passed 0.29 sec
Start 60: http_uri_parse
60/63 Test #60: http_uri_parse .......................... Passed 0.80 sec
Start 65: virtual_memory_allocation
61/63 Test #65: virtual_memory_allocation ............... Passed 1.57 sec
Start 66: guest_red_zone_patcher
62/63 Test #66: guest_red_zone_patcher .................. Passed 0.15 sec
Start 84: macos_sse4a
63/63 Test #84: macos_sse4a ............................. Passed 0.34 sec
Errors while running CTest
97% tests passed, 2 tests failed out of 63
Total Test time (real) = 62.15 sec
The following tests FAILED:
43 - kernel_file_system (Subprocess aborted)
58 - ces (Failed)
Error: Process completed with exit code 8.

**@⁠maok625** on GitHub · 2026-10-13 17:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6151767153) · edited 2026-10-13 18:41 UTC Is there a build to test your PR ? I would like to test it on my Apple M4. I wanted to also ask if building the artifacts went successful for you, as I encountered some fails when building a merged version of your commits on my fork. Here are the logs : Test project /Users/runner/work/KytyPS5-PullsTry/KytyPS5-PullsTry/_Build/macos Start 1: emulator_user_name_cli 1/63 Test #1: emulator_user_name_cli .................. Passed 3.80 sec Start 2: emulator_user_name_too_long 2/63 Test #2: emulator_user_name_too_long ............. Passed 0.12 sec Start 3: emulator_present_mode_cli 3/63 Test #3: emulator_present_mode_cli ............... Passed 0.12 sec Start 4: emulator_present_mode_invalid 4/63 Test #4: emulator_present_mode_invalid ........... Passed 0.10 sec Start 5: emulator_video_out_resolution_cli 5/63 Test #5: emulator_video_out_resolution_cli ....... Passed 0.11 sec Start 6: emulator_video_out_resolution_invalid 6/63 Test #6: emulator_video_out_resolution_invalid ... Passed 0.11 sec Start 7: ime_dialog 7/63 Test #7: ime_dialog .............................. Passed 0.31 sec Start 8: shader_cfg 8/63 Test #8: shader_cfg .............................. Passed 3.73 sec Start 9: scalar_provenance 9/63 Test #9: scalar_provenance ....................... Passed 1.15 sec Start 10: device_suitability 10/63 Test #10: device_suitability ...................... Passed 0.31 sec Start 11: host_lowering 11/63 Test #11: host_lowering ........................... Passed 0.34 sec Start 12: write_heat 12/63 Test #12: write_heat .............................. Passed 0.38 sec Start 13: perf_counters 13/63 Test #13: perf_counters ........................... Passed 0.38 sec Start 14: guest_write_log 14/63 Test #14: guest_write_log ......................... Passed 0.30 sec Start 15: copy_workers 15/63 Test #15: copy_workers ............................ Passed 1.11 sec Start 16: readback_plan 16/63 Test #16: readback_plan ........................... Passed 0.29 sec Start 17: pipeline_use 17/63 Test #17: pipeline_use ............................ Passed 0.30 sec Start 18: submit_plan 18/63 Test #18: submit_plan ............................. Passed 0.25 sec Start 19: cache_collection 19/63 Test #19: cache_collection ........................ Passed 0.30 sec Start 20: buffer_chunk 20/63 Test #20: buffer_chunk ............................ Passed 0.29 sec Start 21: depth_snapshot_plan 21/63 Test #21: depth_snapshot_plan ..................... Passed 0.25 sec Start 22: video_out_resolution 22/63 Test #22: video_out_resolution .................... Passed 0.30 sec Start 23: queue_commits 23/63 Test #23: queue_commits ........................... Passed 0.27 sec Start 24: bench_script 24/63 Test #24: bench_script ............................ Passed 0.27 sec Start 25: cache_folder 25/63 Test #25: cache_folder ............................ Passed 0.25 sec Start 26: file_lock 26/63 Test #26: file_lock ............................... Passed 1.25 sec Start 27: image_page_table 27/63 Test #27: image_page_table ........................ Passed 0.30 sec Start 28: metadata_fill 28/63 Test #28: metadata_fill ........................... Passed 0.28 sec Start 29: fence_retirement 29/63 Test #29: fence_retirement ........................ Passed 0.32 sec Start 30: memory_tracker 30/63 Test #30: memory_tracker .......................... Passed 1.52 sec Start 31: page_manager 31/63 Test #31: page_manager ............................ Passed 19.68 sec Start 32: archive_file 32/63 Test #32: archive_file ............................ Passed 0.45 sec Start 33: trophy_system 33/63 Test #33: trophy_system ........................... Passed 0.34 sec Start 34: avplayer_file 34/63 Test #34: avplayer_file ........................... Passed 1.93 sec Start 35: bit_array 35/63 Test #35: bit_array ............................... Passed 0.26 sec Start 36: lru_cache 36/63 Test #36: lru_cache ............................... Passed 0.22 sec Start 37: program_list 37/63 Test #37: program_list ............................ Passed 0.24 sec Start 38: soft_float64 38/63 Test #38: soft_float64 ............................ Passed 1.44 sec Start 39: shader_vertex_metadata 39/63 Test #39: shader_vertex_metadata .................. Passed 0.30 sec Start 40: resource_materialization 40/63 Test #40: resource_materialization ................ Passed 0.36 sec Start 41: resource_tracking 41/63 Test #41: resource_tracking ....................... Passed 0.55 sec Start 42: event_queue_lifetime 42/63 Test #42: event_queue_lifetime .................... Passed 0.43 sec Start 43: kernel_file_system 43/63 Test #43: kernel_file_system ......................Subprocess aborted***Exception: 4.90 sec KernelFileSystemTests: failed: create hidden Vulkan test window Start 44: sync_on_address 44/63 Test #44: sync_on_address ......................... Passed 1.40 sec Start 45: audio_out2_port 45/63 Test #45: audio_out2_port ......................... Passed 0.38 sec Start 46: audio_out_timing 46/63 Test #46: audio_out_timing ........................ Passed 1.54 sec Start 47: ngs2_sampler 47/63 Test #47: ngs2_sampler ............................ Passed 0.33 sec Start 48: pad_haptics 48/63 Test #48: pad_haptics ............................. Passed 1.52 sec Start 49: controller_settings 49/63 Test #49: controller_settings ..................... Passed 0.35 sec Start 50: pad_input 50/63 Test #50: pad_input ............................... Passed 0.27 sec Start 51: player_seats 51/63 Test #51: player_seats ............................ Passed 0.25 sec Start 52: gamepad_quit 52/63 Test #52: gamepad_quit ............................ Passed 0.24 sec Start 53: image_readback 53/63 Test #53: image_readback .......................... Passed 0.28 sec Start 54: overlay_queue 54/63 Test #54: overlay_queue ........................... Passed 0.25 sec Start 55: const_ram 55/63 Test #55: const_ram ............................... Passed 0.25 sec Start 56: save_data_memory 56/63 Test #56: save_data_memory ........................ Passed 0.43 sec Start 57: png_enc 57/63 Test #57: png_enc ................................. Passed 0.28 sec Start 58: ces 58/63 Test #58: ces .....................................***Failed 1.29 sec CesTests:108: CesMbcsStrToUtf8Str(context, test.source.data(), test.limit, &consumed, output.data(), output.size(), &produced) == test.error CesTests:109: consumed == 1 && produced == 1 CesTests:112: CesMbcsStrGetUtf8Len(context, test.source.data(), test.limit, &consumed, &produced) == test.error CesTests:113: consumed == 1 && produced == 1 Start 59: save_data_dialog 59/63 Test #59: save_data_dialog ........................ Passed 0.29 sec Start 60: http_uri_parse 60/63 Test #60: http_uri_parse .......................... Passed 0.80 sec Start 65: virtual_memory_allocation 61/63 Test #65: virtual_memory_allocation ............... Passed 1.57 sec Start 66: guest_red_zone_patcher 62/63 Test #66: guest_red_zone_patcher .................. Passed 0.15 sec Start 84: macos_sse4a 63/63 Test #84: macos_sse4a ............................. Passed 0.34 sec Errors while running CTest 97% tests passed, 2 tests failed out of 63 Total Test time (real) = 62.15 sec The following tests FAILED: 43 - kernel_file_system (Subprocess aborted) 58 - ces (Failed) Error: Process completed with exit code 8.
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-13 19:57 UTC · original · edited 2026-10-13 20:01 UTC

@⁠maok625 I have fix the tests issues and you can download the build releases from here
KytyPS5-2026-10-13-c9013e6

**@⁠mohamed-rekiba** on GitHub · 2026-10-13 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6154004458) · edited 2026-10-13 20:01 UTC @⁠maok625 I have fix the tests issues and you can download the build releases from here [KytyPS5-2026-10-13-c9013e6](https://github.com/mohamed-rekiba/KytyPS5/releases/tag/KytyPS5-2026-10-13-c9013e6)
Author
Owner

@⁠maok625 on GitHub · 2026-10-13 22:34 UTC · original

Good news, it starts up games on my M4, thanks !

**@⁠maok625** on GitHub · 2026-10-13 22:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6156650218) Good news, it starts up games on my M4, thanks !
Author
Owner

@⁠mohamed-rekiba on GitHub · 2026-10-14 12:36 UTC · original

Hey @⁠Nmzik,
Please let me know if you have any comments

**@⁠mohamed-rekiba** on GitHub · 2026-10-14 12:36 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6168495032) Hey @⁠Nmzik, Please let me know if you have any comments
Author
Owner

@⁠jamesst20 on GitHub · 2026-10-14 17:34 UTC · original

Vice City - Apple M4 Pro 48GB - MoltenVK version 1.4.2

Capture d’écran, le 2026-10-14 à 13 31 17

**@⁠jamesst20** on GitHub · 2026-10-14 17:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6174407394) <details><summary>Vice City - Apple M4 Pro 48GB - MoltenVK version 1.4.2</summary> <p> <img width="1280" height="751" alt="Capture d’écran, le 2026-10-14 à 13 31 17" src="https://github.com/user-attachments/assets/82d65055-eb20-4773-a617-6b4052ae1237" /> </p> </details>
Author
Owner

@⁠Nmzik on GitHub · 2026-10-15 21:13 UTC · original · edited 2026-10-15 21:20 UTC

Hey @⁠Nmzik, Please let me know if you have any comments

@⁠mohamed-rekiba Thanks for detailed info (before/after). I will definitely take a look. Some changes can easily benefit non macOS platforms

**@⁠Nmzik** on GitHub · 2026-10-15 21:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1469#issuecomment-6202392166) · edited 2026-10-15 21:20 UTC > Hey @⁠Nmzik, Please let me know if you have any comments @⁠mohamed-rekiba Thanks for detailed info (before/after). I will definitely take a look. Some changes can easily benefit non macOS platforms

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.