Skip to content

Add macOS support - #267

Merged
marchc1 merged 1 commit into
SourceDotNET:mainfrom
Earu:feature/macos-support
Nov 16, 2026
Merged

marchc1 merged 1 commit into
SourceDotNET:mainfrom
Earu:feature/macos-support

Conversation

@Earu

@Earu Earu commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

DISCLAIMER: @marchc1 for this to work fully it'd need the Luajit fork sdn uses to also build for osx.

DISCLAIMER 2: CEF is not working currently, this is because it needs to be notorized and signed (thanks apple), I could get it working locally in a testing env but eventually if we want to ship to apple we'd need to have a proper developer account (byebye my 100$)...

DISCLAIMER 3: I changed some of the path resolution to AppContext.BaseDirectory it felt better to use, if you think thats not warranted I can remove it.

DISCLAIMER 4: This needs users to install a homebrew package (FreeImage) to work, I left it like that but eventually we probably need some sort of install script for the osx platform, or to bundle it (?).

Rendering:

  • Run the GL 4.6 renderer on macOS through Mesa (Zink over KosmicKrisp). SDL3_MesaEGL_Context renders into an EGL pbuffer at the engine's render size and presents each frame through SDL's Metal renderer.
  • Bundle libEGL, libgallium, KosmicKrisp and the Vulkan loader into Build//mesa/lib at build time. Requires brew install mesa vulkan-loader.
  • Scale mouse coordinates between window and render size so clicks land correctly when the two differ, as in fullscreen.
  • Implement HardwareConfig.CanDoSRGBReadFromRTs, which only the macOS shader path calls.

Native libraries:

  • Move libsteam_api.dylib to runtimes/osx/native so arm64 finds it.
  • Use Homebrew's arm64 FreeImage on Apple Silicon, since the NuGet package only ships x86_64.
  • Implement GetSystemFontPath on macOS through CoreText.

Cross-platform fixes:

  • Fix font fallback "NULL" entries being compared by reference, which looped forever when no fallback font could be loaded.
  • Use the invariant culture process-wide so data files parse correctly on locales with a comma decimal separator.
  • Resolve the mod directory, relative search paths and the platform directory against AppContext.BaseDirectory instead of the working directory, so launching from outside the build output works.
  • Find the Garry's Mod install through the macOS Steam library path.
  • Skip loading Chromium on macOS when the CEF framework is missing, instead of searching the working directory tree.

Rendering:
- Run the GL 4.6 renderer on macOS through Mesa (Zink over KosmicKrisp).
  SDL3_MesaEGL_Context renders into an EGL pbuffer at the engine's render
  size and presents each frame through SDL's Metal renderer.
- Bundle libEGL, libgallium, KosmicKrisp and the Vulkan loader into
  Build/<config>/mesa/lib at build time. Requires
  `brew install mesa vulkan-loader`.
- Scale mouse coordinates between window and render size so clicks land
  correctly when the two differ, as in fullscreen.
- Implement HardwareConfig.CanDoSRGBReadFromRTs, which only the macOS
  shader path calls.

Native libraries:
- Move libsteam_api.dylib to runtimes/osx/native so arm64 finds it.
- Use Homebrew's arm64 FreeImage on Apple Silicon, since the NuGet
  package only ships x86_64.
- Implement GetSystemFontPath on macOS through CoreText.

Cross-platform fixes:
- Fix font fallback "NULL" entries being compared by reference, which
  looped forever when no fallback font could be loaded.
- Use the invariant culture process-wide so data files parse correctly
  on locales with a comma decimal separator.
- Resolve the mod directory, relative search paths and the platform
  directory against AppContext.BaseDirectory instead of the working
  directory, so launching from outside the build output works.
- Find the Garry's Mod install through the macOS Steam library path.
- Skip loading Chromium on macOS when the CEF framework is missing,
  instead of searching the working directory tree.
@marchc1

marchc1 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Forgot to approve this but #264 will also mean we need to have the BASS OSX binaries as well (noting for myself before merging)

@marchc1

marchc1 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Waiting on #264 now.

@marchc1
marchc1 merged commit bcf51d0 into SourceDotNET:main Nov 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants