The Eden Nintendo Switch Emulator
Find a file
xbzk 73918d23d5
[video_core, maxwell] fixes for homebrew games that use MESA compiler (#4012)
two main issues:

shader_environment.cpp

Support Mesa nv50_ir-compiled homebrew fragment shaders
Mesa nv50_ir (used by NZP-Switch via libdrm_nouveau) emits Maxwell SASS that differs from NVN in two ways our shader pipeline didn't account for, causing "infinite" loops during shader scanning.

How?  TryFindSize() previously detected end-of-shader only via NVN's "BRA $-1" self-branch trailer (SELF_BRANCH_A/B). Mesa-compiled shaders end with an unconditional @PT EXIT and emit no trailer, so scanning ran past the shader and looped to MAXIMUM_SIZE.

Fix: Added a secondary match against @PT EXIT T (opcode 0xE30, predicate PT, flow T) as a fallback terminator. The mask is estrictive enough to reject predicated EXITs, conditional-flow EXITs, and sched control words, so well-formed NVN shaders see no ehavior change (their single @PT EXIT immediately precedes BRA $-1, and both detections return the same size).

load_store_attribute.cpp + attribute.h

IPA's is_perspective check only applied the ×position_w correction for IR::IsGeneric() attributes, and used a per-component SPH lookup. Two failure modes followed:

1. Mesa fragment shaders read varyings via legacy attribute slots
(ColorFrontDiffuse, FixedFncTexture, FogCoordinate) which are
remapped to generic varyings later by ConvertLegacyToGeneric. At
IPA-translation time they're still legacy, so IsGeneric() was
false and the inject was skipped — but the resulting GLSL/SPIR-V
varying was Smooth (perspective-correct), and the SASS still
issued its manual perspective dance via MUFU.RCP(ATTR_W)+FMUL,
compounding an extra ×clip_w factor. NZP fog (eye_z distance
varying) ended up as eye_z⁴×density² instead of eye_z²×density²,
saturating fog to white everywhere.

2. Even for legacy attrs that should inject, Mesa stores them in two formats selected by the IPA's interpolation_mode field:
Pass/Multiply/Constant → attr/w (perspective); inject ×position_w
Sc (ScreenLinear)      → raw attr; do NOT inject
Unconditionally injecting for Sc dims vertex colors by 1/clip_w because there's no SASS multiplier to round-trip it back.

Fix: extend the IPA correction path to also fire on IsLegacyAttribute(), gated on interpolation_mode != Sc. While here, the generic-path check is widened from per-component to vector-level (first non-Unused PixelImap, with all-Unused fallthrough treated as Perspective) so it matches the GLSL interpolation qualifier picked by CollectInterpolationInfo — this fixes the same all-zeroed-imap case Mesa exposes for explicit generics. IsLegacyAttribute moved from translate_program.cpp's anonymous namespace into attribute.h next to IsGeneric so IPA can reach it.

Tested on NaziZombies:Portable (Switch homebrew): fog now matches real
hardware, vertex-colored geometry (hand, gun, decals) renders correctly.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4012
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
2026-06-15 03:05:11 +02:00
.ci [tools] refactor, use #!/bin/sh, update license files (#3998) 2026-05-22 21:15:31 +02:00
.forgejo [android] Remove unused SPIRV strings and make strings check run on PRs (#3885) 2026-04-25 23:32:20 +02:00
.patch [externals] UCRT64 support (#4035) 2026-06-09 21:41:50 +02:00
.reuse [docs] troubleshoot section, release policies, gpu documentation (#3078) 2025-12-12 18:36:19 +01:00
.tx [cmake] feat: FFmpeg CI, allow 16kb android builds, update translations for transifex (#2543) 2025-09-23 19:38:11 +02:00
CMakeModules [externals] UCRT64 support (#4035) 2026-06-09 21:41:50 +02:00
dist [windows] Add NSIS installer (#4008) 2026-06-12 23:44:13 +02:00
docs [externals] UCRT64 support (#4035) 2026-06-09 21:41:50 +02:00
externals [deps] update sirit 1.0.4 -> 1.0.5 (#4079) 2026-06-10 20:52:35 +02:00
hooks [tools] refactor, use #!/bin/sh, update license files (#3998) 2026-05-22 21:15:31 +02:00
LICENSES general: fix trailing whitespace 2024-01-08 09:34:32 -05:00
src [video_core, maxwell] fixes for homebrew games that use MESA compiler (#4012) 2026-06-15 03:05:11 +02:00
tools [qt] fix various crashes due to invalid/corrupted/outdated settings (#4070) 2026-06-14 20:48:24 +02:00
.codespellrc core: refactor emulated cpu core activation 2023-12-04 10:37:16 -05:00
.git-blame-ignore-revs Skip git blame 2023-11-04 18:26:49 +00:00
.gitattributes chore: make yuzu REUSE compliant 2022-07-27 12:53:49 +02:00
.gitignore [gitignore] add *.tar.zst (#3663) 2026-03-02 05:28:26 +01:00
.shellcheckrc [tools, cmake] refactor: update/hash check scripts, use tags for some more deps, proper CPMUtil separation (#2666) 2025-10-05 03:04:53 +02:00
CMakeLists.txt [externals] UCRT64 support (#4035) 2026-06-09 21:41:50 +02:00
CONTRIBUTING.md [meta] remove stale/dead links in help/about (#3064) 2025-11-22 21:08:55 +01:00
cpmfile.json [externals] UCRT64 support (#4035) 2026-06-09 21:41:50 +02:00
Doxyfile chore: make yuzu REUSE compliant 2022-07-27 12:53:49 +02:00
LICENSE.txt chore: make yuzu REUSE compliant 2022-07-27 12:53:49 +02:00
README.md [docs] Obtanium, installing mods, external ES-DE config, section about CFW and settings (#3678) 2026-03-07 18:16:05 +01:00
shell.nix [tools] refactor, use #!/bin/sh, update license files (#3998) 2026-05-22 21:15:31 +02:00


Eden
Eden

Eden is a free and opensource (FOSS) Switch 1 emulator, derived from Yuzu and Sudachi - started by developer Camille LaVey. It's written in C++ with portability in mind, with builds for Windows, Linux, macOS, Android, FreeBSD and more.

Discord Stoat

Compatibility | Development | Building | Download | Support | License

Compatibility

The emulator is capable of running most commercial games at full speed, provided you meet the necessary hardware requirements.

A list of supported games will be available in future. Please be patient.

Check out our website for the latest news on exciting features, monthly progress reports, and more!

Packaging status

Development

Most of the development happens on our Git server. It is also where our central repository is hosted. For development discussions, please join us on Discord or Stoat. You can also follow us on X (Twitter) for updates and announcements.

If you would like to contribute, we are open to new developers and pull requests. Please ensure that your work is of a high standard and properly documented. You can also contact any of the developers on Discord or Stoat to learn more about the current state of the emulator.

See the sign-up instructions for information on registration.

Alternatively, if you wish to add translations, go to the Eden project on Transifex and review the translations README.

Documentation

We have a user manual! See our User Handbook.

Building

See the General Build Guide

For information on provided development tooling, see the Tools directory

Download

You can download the latest releases from here.

Save us some bandwidth! We have mirrors available as well.

Support

If you enjoy the project and would like to support us financially, please check out our developers' donation pages!

Any donations received will go towards things such as:

  • Switch consoles to explore and reverse-engineer the hardware
  • Switch games for testing, reverse-engineering, and implementing new features
  • Web hosting and infrastructure setup
  • Additional hardware (e.g. GPUs as needed to improve rendering support, other peripherals to add support for, etc.)
  • CI Infrastructure

If you would prefer to support us in a different way, please join our Discord and talk to Camille or any of our other developers.

License

Eden is licensed under the GPLv3 (or any later version). Refer to the LICENSE.txt file.