feat(recompiler): add WGSL with native cache compatibility #9094

Closed
SteelCrab wants to merge 4 commits from upstream-pr/9094 into main
SteelCrab commented 2026-10-21 12:08:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SteelCrab on 2026-10-21T12:08:19Z.


What

Superseded by draft #16391, which refreshes this WGSL topic on current main. The results below are historical to this closed branch.

Add a WGSL backend for WebGPU and standalone anyps5-wgsl shader tools. WGSL requests have distinct cache keys; native requests preserve their existing key bytes, SPIR-V bytes and serialized shader artifacts. The generated production compiler source-version stamp still changes when compiler sources change.

Add public compute fixtures, native/WGSL/native cache-reuse checks and a baseline snapshot harness. CI builds the PR base and change from the same fixture sources and compares all nine native output files byte for byte. Known WGSL limitations are recorded in docs/dev/debt/shader.md.

Extracted prerequisite of #6879. The dependency line records the requested landing order after the relinker and library portability PRs; this branch is based directly on main and its tests run independently. Native masked-select and other integration fixes are excluded.

Tested

Ubuntu 26.04.1 x86-64, GCC 15.2, Rust 1.98.0; main baseline 47fa6eecf8e7124c88d26ccc37056c13713f7143.

  • Shader-tools Release build passed. wgsl_native_compat and shader_native_snapshot: 2/2 passed. Native baseline shader_native_snapshot: 1/1 passed.
  • Three public compute fixtures: all nine cache-key, SPIR-V and encoded-artifact files match main byte for byte. Native-to-WGSL-to-native cache reuse also passed, including the target-specific key check.
  • cargo build --release --locked --manifest-path tools/wgsl-check/Cargo.toml passed. Naga validates all three generated WGSL compute stages; wgpu creates 3/3 Vulkan pipelines on llvmpipe (LLVM 21.1.8, 256 bits).
  • Main and change focused CTest runs and the pipeline checker used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. No log reports a missing validation layer or a VUID- error; the change adds none.
  • Code Conventions passed; overlap check completed. #6879 carries a temporary integration copy; other shared shader/cache files are reported for ordering review.
  • CI: WGSL backend / native-compatibility-and-wgsl builds both native baselines, compares bytes, checks native cache reuse, validates WGSL with Naga and creates the three wgpu pipelines. It checks validation logs explicitly and fails on missing layers, skipped cases or VUID- errors. The fork workflow needs maintainer approval; remote CI is not claimed as passing.
  • No title execution or physical-GPU rendering is claimed. Private captures that need an independent masked-select correction are not part of this PR's claims.

The relinker prerequisite #10017 and the library-portability prerequisite #11341 have merged. Follow #16391 for this topic.

Remote status: Conventions passed. This prerequisite remains closed while its dependencies land in the sequential staging plan. WGSL workflow ended before any jobs ran: approval was required and expired. The passing build and test counts above are local results.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Mesa llvmpipe (LLVM 21.1.8, 256 bits), Mesa 26.0.8, Vulkan, Ubuntu 26.04.1; no physical GPU tested
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4951286263 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9094). Originally posted by [SteelCrab](https://github.com/SteelCrab) on 2026-10-21T12:08:19Z. --- ### What Superseded by draft #16391, which refreshes this WGSL topic on current main. The results below are historical to this closed branch. Add a WGSL backend for WebGPU and standalone `anyps5-wgsl` shader tools. WGSL requests have distinct cache keys; native requests preserve their existing key bytes, SPIR-V bytes and serialized shader artifacts. The generated production compiler source-version stamp still changes when compiler sources change. Add public compute fixtures, native/WGSL/native cache-reuse checks and a baseline snapshot harness. CI builds the PR base and change from the same fixture sources and compares all nine native output files byte for byte. Known WGSL limitations are recorded in `docs/dev/debt/shader.md`. Extracted prerequisite of #6879. The dependency line records the requested landing order after the relinker and library portability PRs; this branch is based directly on main and its tests run independently. Native masked-select and other integration fixes are excluded. ### Tested Ubuntu 26.04.1 x86-64, GCC 15.2, Rust 1.98.0; main baseline `47fa6eecf8e7124c88d26ccc37056c13713f7143`. - Shader-tools Release build passed. `wgsl_native_compat` and `shader_native_snapshot`: **2/2 passed**. Native baseline `shader_native_snapshot`: **1/1 passed**. - Three public compute fixtures: **all nine cache-key, SPIR-V and encoded-artifact files match main byte for byte**. Native-to-WGSL-to-native cache reuse also passed, including the target-specific key check. - `cargo build --release --locked --manifest-path tools/wgsl-check/Cargo.toml` passed. Naga validates all three generated WGSL compute stages; wgpu creates **3/3 Vulkan pipelines** on llvmpipe (LLVM 21.1.8, 256 bits). - Main and change focused CTest runs and the pipeline checker used `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. No log reports a missing validation layer or a `VUID-` error; the change adds none. - Code Conventions passed; overlap check completed. #6879 carries a temporary integration copy; other shared shader/cache files are reported for ordering review. - CI: **WGSL backend / `native-compatibility-and-wgsl`** builds both native baselines, compares bytes, checks native cache reuse, validates WGSL with Naga and creates the three wgpu pipelines. It checks validation logs explicitly and fails on missing layers, skipped cases or `VUID-` errors. The fork workflow needs maintainer approval; remote CI is not claimed as passing. - No title execution or physical-GPU rendering is claimed. Private captures that need an independent masked-select correction are not part of this PR's claims. The relinker prerequisite #10017 and the library-portability prerequisite #11341 have merged. Follow #16391 for this topic. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Remote status: [Conventions passed](https://github.com/boykopovar/AnyPS5/actions/runs/39597227084/job/119212434752). This prerequisite remains closed while its dependencies land in the sequential staging plan. [WGSL workflow](https://github.com/boykopovar/AnyPS5/actions/runs/39597227587) ended before any jobs ran: approval was required and expired. The passing build and test counts above are local results. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: Mesa llvmpipe (LLVM 21.1.8, 256 bits), Mesa 26.0.8, Vulkan, Ubuntu 26.04.1; no physical GPU tested <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
github-actions[bot] commented 2026-10-21 12:08:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T12:08:39Z.


Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315532598 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9094#issuecomment-6315532598). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T12:08:39Z. --- Thank you for your contribution! Authors with no pull requests merged into `main` can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9094
No description provided.