Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d4a6db9
enable in the gn args
HomuHomu833 Apr 14, 2026
5ba280f
lazy to figure out apple
HomuHomu833 Apr 14, 2026
de51a4f
trying smth
HomuHomu833 Apr 14, 2026
1b6e114
maybe?
HomuHomu833 Apr 14, 2026
d150a87
subzero is weird
HomuHomu833 Apr 14, 2026
82fbae2
fun
HomuHomu833 Apr 14, 2026
dbd101a
Update build-angle.yml
HomuHomu833 Apr 14, 2026
da027bc
say wallahi bro say wallahi
HomuHomu833 Apr 14, 2026
eb6bfd4
ig sed usage comes back
HomuHomu833 Apr 14, 2026
342ed81
Merge branch 'feature/swiftshader' of https://github.com/ShadowEngine…
HomuHomu833 Apr 14, 2026
eaa6b31
ehh?
HomuHomu833 Apr 14, 2026
b2f73a6
enable vulkan in apple
HomuHomu833 Apr 14, 2026
ab8f944
idk
HomuHomu833 Apr 14, 2026
ed83f32
hmmmmm 🫰🫰🫰🫰
HomuHomu833 Apr 14, 2026
0f79c77
I /gen no idea Google is so weird
HomuHomu833 Apr 14, 2026
75f298e
Merge branch 'feature/swiftshader' of https://github.com/ShadowEngine…
HomuHomu833 Apr 14, 2026
e640056
e
HomuHomu833 Apr 14, 2026
a76b3b2
idk yet again
HomuHomu833 Apr 14, 2026
342ee75
bradar wat is dis
HomuHomu833 Apr 14, 2026
e60cb27
ig we need to import this aswell
HomuHomu833 Apr 14, 2026
1e50568
Merge branch 'feature/swiftshader' of https://github.com/ShadowEngine…
HomuHomu833 Apr 14, 2026
ec35ceb
Update Setup.hx
HomuHomu833 Apr 14, 2026
9a65e3c
impossible to get swiftshader for android
HomuHomu833 Apr 14, 2026
d48a022
Merge branch 'feature/swiftshader' of https://github.com/ShadowEngine…
HomuHomu833 Apr 14, 2026
e0c2e86
I need compile on host for more info
HomuHomu833 Apr 14, 2026
eeb58cb
Update Build.hx
HomuHomu833 Apr 15, 2026
3c2036b
Update Build.hx
HomuHomu833 Apr 15, 2026
d7df2d5
Update Setup.hx
HomuHomu833 Apr 15, 2026
69cb6d7
ok no
HomuHomu833 Apr 15, 2026
7f53927
screw you gclient
HomuHomu833 Apr 15, 2026
5ee1815
Update Setup.hx
HomuHomu833 Apr 15, 2026
9c6d878
Update gclient sync command and handle Android platform
HomuHomu833 Apr 15, 2026
3e28e68
chaos breaking my puh part 2
HomuHomu833 Apr 15, 2026
f24e3f7
idk bro
HomuHomu833 Apr 15, 2026
a723847
Update Setup.hx
HomuHomu833 Apr 15, 2026
8bd064a
Update Build.hx
HomuHomu833 Apr 15, 2026
c8abe2b
Update Build.hx
HomuHomu833 Apr 15, 2026
032f316
Update Build.hx
HomuHomu833 Apr 15, 2026
63d7638
macaroniOS
HomuHomu833 Apr 15, 2026
f873d13
remove subzero
HomuHomu833 Apr 15, 2026
a6c7ba0
Update Build.hx
HomuHomu833 Apr 16, 2026
07d262f
Update Build.hx
HomuHomu833 Apr 16, 2026
21451a7
24
HomuHomu833 Apr 16, 2026
d7e5d08
upstream patches
HomuHomu833 Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions patches/0001-metal-drawable-timeout-safety.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From d0d1a5aad7d52a698581fe969b80460a4712c9f8 Mon Sep 17 00:00:00 2001
From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com>
Date: Thu, 16 Apr 2026 01:20:32 +0300
Subject: [PATCH] Avoid blocking on nextDrawable; skip busy frames

---
src/libANGLE/renderer/metal/SurfaceMtl.mm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.mm b/src/libANGLE/renderer/metal/SurfaceMtl.mm
index e57fb5018b..69e5f3d500 100644
--- a/src/libANGLE/renderer/metal/SurfaceMtl.mm
+++ b/src/libANGLE/renderer/metal/SurfaceMtl.mm
@@ -461,6 +461,7 @@ egl::Error WindowSurfaceMtl::initialize(const egl::Display *display)
mMetalLayer.get().device = metalDevice;
mMetalLayer.get().pixelFormat = mColorFormat.metalFormat;
mMetalLayer.get().framebufferOnly = NO; // Support blitting and glReadPixels
+ mMetalLayer.get().allowsNextDrawableTimeout = YES; // No indefinite waits

#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
// Autoresize with parent layer.
@@ -651,12 +652,9 @@ angle::Result WindowSurfaceMtl::obtainNextDrawable(const gl::Context *context)
mCurrentDrawable = [mMetalLayer nextDrawable];
if (!mCurrentDrawable)
{
- // The GPU might be taking too long finishing its rendering to the previous frame.
- // Try again, indefinitely wait until the previous frame render finishes.
- // TODO: this may wait forever here
- mMetalLayer.get().allowsNextDrawableTimeout = NO;
- mCurrentDrawable = [mMetalLayer nextDrawable];
- mMetalLayer.get().allowsNextDrawableTimeout = YES;
+ // GPU is too busy, skip this frame.
+ // We will try to get drawable again in next frame.
+ return angle::Result::Continue;
}

if (!mColorTexture)
--
2.47.1.windows.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From f0bb382b1f7a1ca97848e3b8ab92f94f79401d95 Mon Sep 17 00:00:00 2001
From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com>
Date: Thu, 16 Apr 2026 09:00:58 +0300
Subject: [PATCH] Skip frame when backbuffer resized

---
src/libANGLE/renderer/metal/SurfaceMtl.mm | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.mm b/src/libANGLE/renderer/metal/SurfaceMtl.mm
index 69e5f3d500..f55b1d11f5 100644
--- a/src/libANGLE/renderer/metal/SurfaceMtl.mm
+++ b/src/libANGLE/renderer/metal/SurfaceMtl.mm
@@ -647,6 +647,9 @@ angle::Result WindowSurfaceMtl::obtainNextDrawable(const gl::Context *context)
if (checkIfLayerResized(context))
{
contextMtl->onBackbufferResized(context, this);
+
+ // Skip rendering this frame since the backbuffer was just resized/recreated
+ return angle::Result::Continue;
}

mCurrentDrawable = [mMetalLayer nextDrawable];
--
2.47.1.windows.1

24 changes: 24 additions & 0 deletions patches/0003-metal-limit-metal-layer-maximum-drawable-count.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From c8c5326dcf35723611aa2d7db3bd1b0ff64cfbe8 Mon Sep 17 00:00:00 2001
From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com>
Date: Thu, 16 Apr 2026 09:24:02 +0300
Subject: [PATCH] Limit Metal layer drawable count to 2

---
src/libANGLE/renderer/metal/SurfaceMtl.mm | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.mm b/src/libANGLE/renderer/metal/SurfaceMtl.mm
index f55b1d11f5..f00d8b7faf 100644
--- a/src/libANGLE/renderer/metal/SurfaceMtl.mm
+++ b/src/libANGLE/renderer/metal/SurfaceMtl.mm
@@ -462,6 +462,7 @@ egl::Error WindowSurfaceMtl::initialize(const egl::Display *display)
mMetalLayer.get().pixelFormat = mColorFormat.metalFormat;
mMetalLayer.get().framebufferOnly = NO; // Support blitting and glReadPixels
mMetalLayer.get().allowsNextDrawableTimeout = YES; // No indefinite waits
+ mMetalLayer.get().maximumDrawableCount = 2; // Low-latency swapchain depth (min buffering, system may extend)

#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
// Autoresize with parent layer.
--
2.47.1.windows.1

42 changes: 30 additions & 12 deletions source/angle/Build.hx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ class Build
// Copy angle's libs.
for (buildConfig in buildConfigs)
{
final libsToCopy:Array<String> = ANGLE_LIBS;
var libsToCopy:Array<String> = ANGLE_LIBS;

if (buildPlatform == 'windows')
libsToCopy.push('d3dcompiler_47');
libsToCopy = ['d3dcompiler_47', 'libEGL', 'libGLESv2', 'vk_swiftshader'];
else if (buildPlatform == 'linux')
libsToCopy = ['libEGL', 'libGLESv2', 'libvk_swiftshader'];
else if (buildPlatform == 'macos')
libsToCopy = ['libEGL', 'libGLESv2', 'libVkICD_mock_icd'];

for (lib in libsToCopy)
{
Expand Down Expand Up @@ -145,6 +149,11 @@ class Build
iosFrameworksToCombine.get(lib)?.get(buildConfig.environment)?.push(libDestination);
}
}

if (buildPlatform == 'windows')
FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/bin/${buildConfig.cpu}/vk_swiftshader_icd.json');
else if (buildPlatform == 'linux')
FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/lib/${buildConfig.cpu}/vk_swiftshader_icd.json');
}

if (buildPlatform == 'macos')
Expand Down Expand Up @@ -242,7 +251,18 @@ class Build
renderingBackends.push('angle_enable_metal=false'); // Disable Metal backend
renderingBackends.push('angle_enable_null=false'); // Disable Null backend
renderingBackends.push('angle_enable_wgpu=false'); // Disable WebGPU backend
renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader
if (buildPlatform != 'android')
{
renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader
if (buildPlatform == 'windows')
{
renderingBackends.push('use_swiftshader_with_subzero=false'); // Disable Subzero for SwiftShader
}
}
else
{
renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader
}

if (buildPlatform == 'windows')
{
Expand All @@ -258,13 +278,7 @@ class Build
renderingBackends.push('angle_enable_vulkan=true'); // Enable Vulkan backend
renderingBackends.push('angle_enable_vulkan_api_dump_layer=false'); // Disable Vulkan API dump layer
renderingBackends.push('angle_enable_vulkan_validation_layers=false'); // Disable Vulkan validation layers
renderingBackends.push('angle_use_custom_libvulkan=false'); // Use system Vulkan loader only

if (buildPlatform == 'linux')
{
renderingBackends.push('angle_use_x11=true'); // Use X11 frontend
renderingBackends.push('angle_use_wayland=true'); // Use Wayland frontend
}
renderingBackends.push('angle_use_custom_libvulkan=false'); // Use system Vulkan loader

if (buildPlatform == 'windows')
{
Expand Down Expand Up @@ -346,15 +360,19 @@ class Build
if (buildPlatform != 'ios')
{
renderingBackends.push('angle_enable_gl=true'); // Enable OpenGL backend
renderingBackends.push('angle_enable_vulkan=true'); // Enable Vulkan backend
renderingBackends.push('angle_enable_vulkan_api_dump_layer=false'); // Disable Vulkan API dump layer
renderingBackends.push('angle_enable_vulkan_validation_layers=false'); // Disable Vulkan validation layers
renderingBackends.push('angle_use_custom_libvulkan=true'); // Use ANGLE's Vulkan loader
}
else
{
renderingBackends.push('angle_enable_gl=false'); // Disable OpenGL backend
renderingBackends.push('angle_enable_vulkan=false'); // Disable Vulkan backend
}
renderingBackends.push('angle_enable_metal=true'); // Enable Metal backend
renderingBackends.push('angle_enable_null=false'); // Disable Null backend
renderingBackends.push('angle_enable_wgpu=false'); // Disable WebGPU backend
renderingBackends.push('angle_enable_vulkan=false'); // Disable Vulkan backend
renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader

if (buildPlatform == 'macos')
Expand Down Expand Up @@ -434,7 +452,7 @@ class Build
if (buildPlatform == 'ios')
targetConfig.args.push('ios_enable_code_signing=false');
else if (buildPlatform == 'android')
targetConfig.args.push('android_ndk_api_level=26');
targetConfig.args.push('android_ndk_api_level=24');
}

@:noCompletion
Expand Down
42 changes: 19 additions & 23 deletions source/angle/Setup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Setup
// Configure and sync ANGLE dependencies
FileUtil.goAndBackFromDir('angle', function():Void
{
final platform:String = Platform.getBuildPlatform();

// Hard-pin ANGLE to a specific commit
Sys.command('git', ['checkout', ANGLE_COMMIT]);

Expand All @@ -62,37 +64,31 @@ class Setup
gclientFile.push(' "managed": False,');
gclientFile.push(' }');
gclientFile.push(']');
gclientFile.push('');
if (platform == 'windows')
gclientFile.push('target_os = ["win"]');
else if (platform == 'linux')
gclientFile.push('target_os = ["linux"]');
else if (platform == 'mac')
gclientFile.push('target_os = ["mac"]');
else if (platform == 'android')
gclientFile.push('target_os = ["android"]');
else if (platform == 'ios')
gclientFile.push('target_os = ["ios"]');
File.saveContent('.gclient', gclientFile.join('\n'));
}

// Syncing ANGLE dependencies with gclient...
Sys.command('gclient', ['sync', '--no-history', '--shallow', '--jobs', '8']);
Sys.command('gclient', ['runhooks']);

// For some reason gclient does not add some stuff so we have to clone it ourselves.
FileUtil.goAndBackFromDir('third_party', function():Void
{
if (!FileSystem.exists('android_sdk/BUILD.gn'))
{
FileUtil.deletePath('android_sdk');
Sys.command('git', ['clone', 'https://chromium.googlesource.com/chromium/src/third_party/android_sdk']);
}

if (!FileSystem.exists('ijar/BUILD.gn'))
// weird MSVC quirk
if (platform == 'windows')
FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void
{
FileUtil.deletePath('ijar');
Sys.command('git', ['clone', 'https://chromium.googlesource.com/chromium/src/third_party/ijar']);
}

FileUtil.goAndBackFromDir('cpu_features', function():Void
{
if (!FileSystem.exists('src/ndk_compat'))
{
FileUtil.deletePath('src');
Sys.command('git', ['clone', 'https://github.com/google/cpu_features', 'src', '-b', 'v0.8.0']);
}
Sys.command("sed -i '/SuccIterator(InstructionT \\*Inst)/i\\ SuccIterator() : Inst(nullptr), Idx(0) {}' llvm/include/llvm/IR/CFG.h");
});
});


FileUtil.applyGitPatchesFromDir('../../patches');
});

Expand Down