-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MacOS Port of Xenia #2332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
wmarti
wants to merge
3,219
commits into
xenia-project:master
Choose a base branch
from
wmarti:metal-backend-clean-msc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
MacOS Port of Xenia #2332
+593,160
−326,854
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements control sequences such as conditional branching, breaking, and trapping
Register was getting stomped over
On the x64 side, this is the same as the `reset()` function resetting the label-manager
Resolving the function puts it into X0 and should be called immediately after. We were just calling ResolveFunction on ResolveFunction recursively
Things still get weird at the thunks, but this allows for callstacks between-to-guest calls
Also changes the register to X3 by default
Should be `GUEST_RET_ADDR` not `GUEST_CALL_RET_ADDR`.
Let the register type determine the reverse-size REV32 was also the wrong instruction to use.
`W1` is a possible HIR register allocation and using W1 here was stomping over it. Don't use W1, use the provided "scratch" register.
Derive the reversal-size from the register-size. REV32 is also the wrong one to be using here since it will reverse the bytes of upper and lower 32-bit words.
Share a somewhat similar calling convention as ARM64
Fixes callstacks!!!!
16-bit word rather than 8-bit
These instructions need to use an extra register to generate their constants if they are too large
`x0` was loading the thunk rather than using `xip` Fixes lots of init bugs!
Restart render encoders when the render target cache changes render pass attachments (dummy RT0 → real RTs, depth/stencil binding) to satisfy Metal validation. Bind stencil attachments based on the depth texture pixel format and size the dummy RT to avoid scissor/viewport assertions.
Derive viewport/scissor size from depth attachments for depth-only passes to satisfy Metal validation. Add Metal texture creation + GPU load shader coverage for k_16* UNORM/FLOAT formats plus DXT3A/DXT5A/CTX1 decoding to remove unsupported-format failures in Halo 3 traces.
Add Halo 3 and Gears of War trace filenames to Phase 2 so future Metal work can quickly validate render-target transfer and render-pass stability changes.
Metal validates pipeline attachment formats against the active render pass. For depth-only draws, attach a dummy color RT0 so pipelines that include color formats remain valid, and ensure viewport/scissor sizing prefers depth targets over the dummy when both exist.
Avoid invalid blit readbacks by capturing using the actual bound RT dimensions and skipping non-BGRA8 formats. Always create cubemap textures as cube arrays to match shader expectations, and size the dummy color attachment from the active depth target for depth-only passes.
Document the Resolve pipeline/key gap in MetalRenderTargetCache::Resolve and add a checklist to implement the missing compute resolve pipelines to avoid IssueCopy failures in real traces.
…entation/UI pipelines
…senter optimization
d8a981d to
4b81238
Compare
|
very cool! it would probably be better if you targeted xenia-canary though, there is much more active development there |
4b81238 to
015cd72
Compare
Author
Will look into it, thanks! |
- Build Metal XeSL bytecode for all shader stages, skipping only FXAA in buildshaders. - Add per-binding swizzled texture views with signed pixel-format support for Metal bindings. - Enable GPU texture load path by default and align Metal texture formats and BC decompression with D3D12. - Wire missing Metal texture_load pipelines (DXT3A_AS_1111, R10G11B11/R11G11B10, UNORM/SNORM helpers) and update NEXT_STEPS tracking.
- Refresh Metal shader bytecode outputs and include Metal UI shaders. - Update macOS DXBC->DXIL converter and Metal runtime plumbing changes. - Record local docs/metal updates and submodule pointers.
954a62d to
5d51a8f
Compare
Probe norm16 UNORM/SNORM support at init and choose load shaders and pixel formats to match D3D12/Vulkan fallback behavior when the host lacks those formats, while keeping standard paths when available. Log a single info line when any norm16 format falls back to float so trace validation can confirm behavior without noisy per-texture output.
5d51a8f to
cae9331
Compare
Remove the Metal CPU untile fallback so texture loading matches D3D12 and Vulkan behavior, keeping GPU texture_load shaders as the only path. Document the next investigation steps for missing bindings, memexport warnings, and resolve/transfer parity in NEXT_STEPS.
Log decoded fetch data for missing bindings, emit one-time memexport shader hashes, and capture transfer format/pixel format pairs to support render target parity analysis. Update NEXT_STEPS tracking and validate with a trace run.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress port of Xenia for MacOS, currently only tested on Apple Silicon, over @Wunkolo’s ARM64 backend #2259. In theory this would also work on iOS devices, but only in regions where JIT compilation is available, and distribution is available outside of the AppStore, like the EU.
The Metal backend translates Xbox 360 shader microcode through multiple stages:
The pipeline leverages:
metalirconverterlibrary for DXIL → Metal IRMaybe eventually I'll go the SPIR-V -> MSL route, but this seemed the easiest for now (even though there's a big performance penalty).
The entire thing has been essentially “vibecoded” over the last ~year, so there's probably a minefield of issues, and there are many merge conflicts, and tons of bloat that's not meant to be committed (sorry, I'm still learning how to use git), but I'll get those issues ironed out over time. Not expecting this to get merged anytime soon, but just opening this PR for tracking. The "app" builds but does not run games yet. I've got
xenia-gpu-metal-trace-dumpreproducing traces captured in D3D12 backend from Gears of War ~mostly correctly. Other Games are WIP, as you can see below.Gears of War
Halo 3
GTA IV