MetalSharp / WineMetalGL

WineMetalGL
OpenGL, rebuilt on Metal.

A replacement for Apple's deprecated OpenGL framework. Native Arm64 apps and Wine programs get OpenGL 1.0 through 4.6 and OpenGL ES 2.0 through 3.2, conformant with the Khronos GL-CTS, drawn with Metal. MetalSharp 1.0.0 uses it on both builds.

Version 3.7.0OpenGL 4.6GLES 3.2x86_64 + arm64 WineLGPL-3.0-or-later
  1. OpenGL / WGL
  2. winemetalgl.dll
  3. libwinemetalgl
  4. GLSL → SPIR-V → MSL
  5. Metal
What it is

OpenGL without Apple's OpenGL.

Apple deprecated its OpenGL framework in 2018, and it stops at OpenGL 4.1. WineMetalGL replaces it. Native Arm64 applications and Wine programs get OpenGL 1.0 through 4.6, core and compatibility profiles, and OpenGL ES 2.0 through 3.2, all drawn with Metal.

The core, libwinemetalgl.dylib, has no dependency on Apple's OpenGL. It compiles GLSL with glslang and SPIRV-Cross to the Metal Shading Language, and implements the GL state machine, resources, and draws on Metal. The Wine module (winemetalgl.dll and winemetalgl.so, with a forwarding opengl32.dll in the prefix) carries WGL and every GL call to the core. Wine itself is not patched or rebuilt.

  • OpenGL 4.6Core and compatibility contexts, which Apple's OpenGL can't provide.
  • GLES 3.2OpenGL ES 2.0 through 3.2.
  • Khronos CTSConformant with the GL-CTS test suite.
  • x86_64 + arm64x86_64 Wine and CrossOver, and, since 3.7.0, native arm64 Wine.
In MetalSharp 1.0.0

On both builds.

x86_64 build

The runtime bundle carries WineMetalGL 3.7.0's core next to Wine's Mac driver, which loads it. Games get OpenGL 4.6 core and compatibility contexts on Metal; DOOM (2016) runs its OpenGL renderer on it.

WINEMETALGL=0 goes back to Apple's OpenGL.

Arm64 FEX build

WineMetalGL is the default OpenGL in MetalSharp Wine, so prefixes need no setup. It also backs the OpenGL lane, where Wine's own Direct3D runs over WineMetalGL.

OPENGL_BACKEND=wine goes back to Wine's own OpenGL.

Conformance

Measured against the Khronos CTS.

Every Khronos CTS run per OpenGL version. 4.4 and 4.5 are covered by the KHR-GL46 run.

OpenGLConformanceUnsupported
3.099.88%2.28%
3.1100%2.38%
3.2100%0.69%
3.3100%1.11%
4.099.99%10.11%
4.199.99%10.08%
4.299.98%9.74%
4.399.97%15.60%
4.4 – 4.5Covered by KHR-GL46
4.699.98%22.33%
GLESConformanceUnsupported
2.0100%0.60%
3.0100%0.83%
3.199.98%1.24%
3.299.95%0.64%

“Unsupported” counts the CTS cases that report NotSupported. Unsupported explains each gap, and Conformance results lists every run with the reason for each failing case.

Performance

Faster than Apple's OpenGL.

Where both run an entry, WineMetalGL's average frame time is 1.2 to 19.6 times shorter.

Frame times from WineMetalGL's game corpus, the median of three 600-frame runs with vsync off. Apple's OpenGL is the same program with WINEMETALGL=0.

EntryWineMetalGL avgApple's OpenGL avgFaster by
scene33-core (GL 3.3 core)0.249 ms0.565 ms2.27×
scene33-core-300.251 ms0.554 ms2.21×
scene4x-core41 (GL 4.1 tessellation)2.038 ms39.889 ms19.57×
legacy-gl21 (fixed function)0.455 ms0.533 ms1.17×
legacy-gl21-i386 (32-bit)0.469 ms0.548 ms1.17×

The GL 4.2 through 4.6 and compatibility-profile scenes run only on WineMetalGL: Apple's OpenGL can't create those contexts. See Performance and the game corpus.

The app

Install it anywhere.

WineMetalGL's DMG installs it into any Wine prefix or CrossOver bottle, and updates the app and the installed runtime when a new version comes out. The release also has install scripts and packages for x86_64 and arm64 Wine.

FeatureUse
InstallInstall WineMetalGL into a Wine found on your Mac (its default prefix), and turn it on or off
Custom installChoose any Wine and prefix in Finder to install into
Install CrossOverInstall into a CrossOver bottle anywhere, with or without CrossOver installed, and turn it on or off
Game fixesTurn quick fixes for tested games on or off
x87 accelerationFor older 32-bit games that use x87 math
Runtime logsTurn on logs before launching, to see what fails and report it

New in 3.7.0: arm64 Wine

WineMetalGL now runs inside native arm64 Wine: CrossOver 27's arm64 bottles and MetalSharp Wine, for native ARM64, x86_64, and 32-bit programs, with no Rosetta. install-wine-module.sh and install-crossover.sh work out which kind of Wine or bottle they're installing into and fetch the matching package.

Go deeper

Source and docs.