From d4a6db98b76b881590efb51482a31c37ca3dd090 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 15:28:49 +0300 Subject: [PATCH 01/40] enable in the gn args --- source/angle/Build.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 926e5a5..181fe40 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -242,7 +242,7 @@ 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 + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader if (buildPlatform == 'windows') { @@ -355,7 +355,7 @@ class Build 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 + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader if (buildPlatform == 'macos') { From 5ba280f9069cc4afaf4b64bcbb4168c0955a5e5d Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 15:40:53 +0300 Subject: [PATCH 02/40] lazy to figure out apple --- source/angle/Build.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 181fe40..9a513ce 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -355,7 +355,7 @@ class Build 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=true'); // Enable SwiftShader + renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader if (buildPlatform == 'macos') { From de51a4fb0070970b35cb4b1bb20ac640f51e8257 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 15:54:24 +0300 Subject: [PATCH 03/40] trying smth --- source/angle/Setup.hx | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 7c20559..aca8170 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -66,33 +66,8 @@ class Setup } // Syncing ANGLE dependencies with gclient... - Sys.command('gclient', ['sync', '--no-history', '--shallow', '--jobs', '8']); + Sys.command('gclient', ['sync', '--no-history', '--jobs', '8']); - // 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')) - { - 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']); - } - }); - }); - FileUtil.applyGitPatchesFromDir('../../patches'); }); From 1b6e11479be6e5f5d11657283b4a845eb93515b4 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 16:08:21 +0300 Subject: [PATCH 04/40] maybe? --- source/angle/Setup.hx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index aca8170..209d7fe 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -52,6 +52,7 @@ class Setup Sys.command('gclient', ['config', '--unmanaged', 'https://chromium.googlesource.com/angle/angle']); { + final platform = Platform.getBuildPlatform(); // Create a .gclient file with proper setup final gclientFile:Array = []; gclientFile.push('solutions = ['); @@ -62,11 +63,23 @@ 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', '--jobs', '8']); + Sys.command('gclient', ['runhooks']); FileUtil.applyGitPatchesFromDir('../../patches'); }); From d150a871937913efa1fef172eab776d7fee4aefe Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 16:33:23 +0300 Subject: [PATCH 05/40] subzero is weird --- source/angle/Setup.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 209d7fe..6f3155c 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -81,6 +81,12 @@ class Setup Sys.command('gclient', ['sync', '--no-history', '--jobs', '8']); Sys.command('gclient', ['runhooks']); + if (platform == 'android') + FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-subzero', function():Void + { + FileUtil.copyDirectory('build/Android/include', 'include'); + }); + FileUtil.applyGitPatchesFromDir('../../patches'); }); From 82fbae295562d1981c36b3debf02d353d4c0e1e7 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 16:35:30 +0300 Subject: [PATCH 06/40] fun --- source/angle/Setup.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 6f3155c..1fbae09 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -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]); @@ -52,7 +54,6 @@ class Setup Sys.command('gclient', ['config', '--unmanaged', 'https://chromium.googlesource.com/angle/angle']); { - final platform = Platform.getBuildPlatform(); // Create a .gclient file with proper setup final gclientFile:Array = []; gclientFile.push('solutions = ['); From dbd101a2321f5c1323136a5ceb068d2c0ae4ad53 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 17:16:22 +0300 Subject: [PATCH 07/40] Update build-angle.yml --- .github/workflows/build-angle.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-angle.yml b/.github/workflows/build-angle.yml index b585089..8704ed7 100644 --- a/.github/workflows/build-angle.yml +++ b/.github/workflows/build-angle.yml @@ -77,13 +77,19 @@ jobs: - name: Checkout uses: actions/checkout@main + - name: Setup Android NDK 64bit + uses: nttld/setup-ndk@main + id: setup-ndk + with: + ndk-version: r25c + - name: Setup Haxe uses: ShadowEngineTeam/setup-haxe@main with: haxe-version: 4.3.7 - name: Build Angle - run: ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME haxe build.hxml --define buildPlatform=android + run: ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }} haxe build.hxml --define buildPlatform=android - name: Upload Artifact uses: actions/upload-artifact@main From da027bc33cadce58babf63661a5f9d88216260c4 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 17:30:22 +0300 Subject: [PATCH 08/40] say wallahi bro say wallahi --- .github/workflows/build-angle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-angle.yml b/.github/workflows/build-angle.yml index 8704ed7..880c36a 100644 --- a/.github/workflows/build-angle.yml +++ b/.github/workflows/build-angle.yml @@ -77,7 +77,7 @@ jobs: - name: Checkout uses: actions/checkout@main - - name: Setup Android NDK 64bit + - name: Setup Android NDK uses: nttld/setup-ndk@main id: setup-ndk with: From eb6bfd4dd4de53e86791c48721dd774a1d3efbd8 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 17:56:19 +0300 Subject: [PATCH 09/40] ig sed usage comes back --- source/angle/Setup.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 1fbae09..bc026eb 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -88,6 +88,12 @@ class Setup FileUtil.copyDirectory('build/Android/include', 'include'); }); + if (platform == 'windows') + FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void + { + Sys.command("sed -i 's/cflags += \\[/cflags += [ \"\\/std:c++17\",/' BUILD.gn"); + }); + FileUtil.applyGitPatchesFromDir('../../patches'); }); From eaa6b31c6245499028e9820cd03d6c11e760a5f3 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 18:14:28 +0300 Subject: [PATCH 10/40] ehh? --- .github/workflows/build-angle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-angle.yml b/.github/workflows/build-angle.yml index 880c36a..38ea4c9 100644 --- a/.github/workflows/build-angle.yml +++ b/.github/workflows/build-angle.yml @@ -81,7 +81,7 @@ jobs: uses: nttld/setup-ndk@main id: setup-ndk with: - ndk-version: r25c + ndk-version: r21e - name: Setup Haxe uses: ShadowEngineTeam/setup-haxe@main From b2f73a61aafb1688b4d11277dd78561db13ae59a Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 18:20:16 +0300 Subject: [PATCH 11/40] enable vulkan in apple --- source/angle/Build.hx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 9a513ce..58785b9 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -343,18 +343,18 @@ class Build renderingBackends.push('angle_enable_d3d9=false'); // Disable D3D9 backend renderingBackends.push('angle_enable_d3d11=false'); // Disable D3D11 backend - if (buildPlatform != 'ios') - { + /*if (buildPlatform != 'ios') + {*/ renderingBackends.push('angle_enable_gl=true'); // Enable OpenGL backend - } + /*} else { renderingBackends.push('angle_enable_gl=false'); // Disable OpenGL 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_vulkan=true'); // Enable Vulkan backend renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader if (buildPlatform == 'macos') From ab8f944ae58ba4101d408ed0ee61814bdc6584f6 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 18:40:25 +0300 Subject: [PATCH 12/40] idk --- .github/workflows/build-angle.yml | 8 +------- source/angle/Build.hx | 11 ++++++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-angle.yml b/.github/workflows/build-angle.yml index 38ea4c9..b585089 100644 --- a/.github/workflows/build-angle.yml +++ b/.github/workflows/build-angle.yml @@ -77,19 +77,13 @@ jobs: - name: Checkout uses: actions/checkout@main - - name: Setup Android NDK - uses: nttld/setup-ndk@main - id: setup-ndk - with: - ndk-version: r21e - - name: Setup Haxe uses: ShadowEngineTeam/setup-haxe@main with: haxe-version: 4.3.7 - name: Build Angle - run: ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }} haxe build.hxml --define buildPlatform=android + run: ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME haxe build.hxml --define buildPlatform=android - name: Upload Artifact uses: actions/upload-artifact@main diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 58785b9..58eaf68 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -343,18 +343,19 @@ class Build renderingBackends.push('angle_enable_d3d9=false'); // Disable D3D9 backend renderingBackends.push('angle_enable_d3d11=false'); // Disable D3D11 backend - /*if (buildPlatform != 'ios') - {*/ + if (buildPlatform != 'ios') + { renderingBackends.push('angle_enable_gl=true'); // Enable OpenGL backend - /*} + renderingBackends.push('angle_enable_vulkan=true'); // Enable Vulkan backend + } 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=true'); // Enable Vulkan backend renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader if (buildPlatform == 'macos') From ed83f329476af546d7097b8618d49448e3147fd2 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 20:06:53 +0300 Subject: [PATCH 13/40] =?UTF-8?q?hmmmmm=20=F0=9F=AB=B0=F0=9F=AB=B0?= =?UTF-8?q?=F0=9F=AB=B0=F0=9F=AB=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/angle/Setup.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index bc026eb..429c1e4 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -91,7 +91,7 @@ class Setup if (platform == 'windows') FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void { - Sys.command("sed -i 's/cflags += \\[/cflags += [ \"\\/std:c++17\",/' BUILD.gn"); + Sys.command("sed -i '/SuccIterator(InstructionT \\*Inst)/i\\ SuccIterator() : Inst(nullptr), Idx(0) {}' llvm/include/llvm/IR/CFG.h"); }); FileUtil.applyGitPatchesFromDir('../../patches'); From 0f79c77474a5b6e86359950f17974b27139924ba Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 22:11:14 +0300 Subject: [PATCH 14/40] I /gen no idea Google is so weird --- .../include/vulkan/vk_android_native_buffer.h | 292 ++++++++++++++++++ source/angle/Build.hx | 10 +- source/angle/Setup.hx | 3 + 3 files changed, 298 insertions(+), 7 deletions(-) create mode 100644 patches/include/vulkan/vk_android_native_buffer.h diff --git a/patches/include/vulkan/vk_android_native_buffer.h b/patches/include/vulkan/vk_android_native_buffer.h new file mode 100644 index 0000000..159b2d5 --- /dev/null +++ b/patches/include/vulkan/vk_android_native_buffer.h @@ -0,0 +1,292 @@ +/* + * Copyright 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __VK_ANDROID_NATIVE_BUFFER_H__ +#define __VK_ANDROID_NATIVE_BUFFER_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define VK_ANDROID_native_buffer 1 + +#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER 11 +/* + * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 6 + * + * This version of the extension transitions from gralloc0 to gralloc1 usage + * flags (int -> 2x uint64_t). The WSI implementation will temporarily continue + * to fill out deprecated fields in VkNativeBufferANDROID, and will call the + * deprecated vkGetSwapchainGrallocUsageANDROID if the new + * vkGetSwapchainGrallocUsage2ANDROID is not supported. This transitionary + * backwards-compatibility support is temporary, and will likely be removed + * (along with all gralloc0 support) in a future release. + */ +/* + * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8 + * + * This version of the extension doesn't introduce new types or structs, but is + * to accommodate the new struct VkBindImageMemorySwapchainInfoKHR added in + * VK_KHR_swapchain spec version 69. When VkBindImageMemorySwapchainInfoKHR is + * chained in the pNext chain of VkBindImageMemoryInfo, a VkNativeBufferANDROID + * that holds the correct gralloc handle according to the imageIndex specified + * in VkBindImageMemorySwapchainInfoKHR will be additionally chained to the + * pNext chain of VkBindImageMemoryInfo and passed down to the driver. + */ +/* + * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 9 + * + * This version of the extension is largely designed to clean up the mix of + * GrallocUsage and GrallocUsage2 + */ +/* + * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 10 + * + * This version of the extension cleans up a bug introduced in version 9 + */ +/* + * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 + * + * This version of the extension deprecates the last of grallocusage and + * extends VkNativeBufferANDROID to support passing AHardwareBuffer* + */ +#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 +#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer" + +#define VK_ANDROID_NATIVE_BUFFER_ENUM(type, id) \ + ((type)(1000000000 + \ + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id))) +#define VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID \ + VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 0) +#define VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID \ + VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 1) +#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID \ + VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 2) +#define VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_ANDROID \ + VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 3) +#define VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_2_ANDROID \ + VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 4) + +/* clang-format off */ +typedef enum VkSwapchainImageUsageFlagBitsANDROID { + VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID = 0x00000001, + VK_SWAPCHAIN_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSwapchainImageUsageFlagBitsANDROID; +typedef VkFlags VkSwapchainImageUsageFlagsANDROID; + +/* + * struct VkNativeBufferUsage2ANDROID + * + * consumer: gralloc1 consumer usage flag + * producer: gralloc1 producer usage flag + */ +typedef struct { + uint64_t consumer; + uint64_t producer; +} VkNativeBufferUsage2ANDROID; + +/* + * struct VkNativeBufferANDROID + * + * sType: VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID + * pNext: NULL or a pointer to a structure extending this structure + * handle: buffer handle returned from gralloc alloc() + * stride: stride returned from gralloc alloc() + * format: gralloc format requested when the buffer was allocated + * usage: gralloc usage requested when the buffer was allocated + * usage2: gralloc usage requested when the buffer was allocated + * usage3: gralloc usage requested when the buffer was allocated + * ahb: The AHardwareBuffer* from the actual ANativeWindowBuffer. Caller + * maintains ownership of resource. AHardwareBuffer pointer is only valid + * for the duration of the function call + */ +typedef struct { + VkStructureType sType; + const void* pNext; + buffer_handle_t handle; + int stride; + int format; + int usage; /* DEPRECATED in SPEC_VERSION 6 */ + VkNativeBufferUsage2ANDROID usage2; /* DEPRECATED in SPEC_VERSION 9 */ + uint64_t usage3; /* ADDED in SPEC_VERSION 9 */ + struct AHardwareBuffer* ahb; /* ADDED in SPEC_VERSION 11 */ +} VkNativeBufferANDROID; + +/* + * struct VkSwapchainImageCreateInfoANDROID + * + * sType: VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID + * pNext: NULL or a pointer to a structure extending this structure + * usage: is a bitmask of VkSwapchainImageUsageFlagsANDROID + */ +typedef struct { + VkStructureType sType; + const void* pNext; + VkSwapchainImageUsageFlagsANDROID usage; +} VkSwapchainImageCreateInfoANDROID; + +/* + * struct VkPhysicalDevicePresentationPropertiesANDROID + * + * sType: VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID + * pNext: NULL or a pointer to a structure extending this structure + * sharedImage: specifies if the image can be shared with the display system + */ +typedef struct { + VkStructureType sType; + const void* pNext; + VkBool32 sharedImage; +} VkPhysicalDevicePresentationPropertiesANDROID; + +/* + * struct VkGrallocUsageInfoANDROID + * + * sType: VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_ANDROID + * pNext: NULL or a pointer to a structure extending this structure + * format: value specifying the format the image will be created with + * imageUsage: bitmask of VkImageUsageFlagBits describing intended usage + * + * DEPRECATED in SPEC_VERSION 10 + */ +typedef struct { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageUsageFlags imageUsage; +} VkGrallocUsageInfoANDROID; + +/* + * struct VkGrallocUsageInfo2ANDROID + * + * sType: VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_2_ANDROID + * pNext: NULL or a pointer to a structure extending this structure + * format: value specifying the format the image will be created with + * imageUsage: bitmask of VkImageUsageFlagBits describing intended usage + * swapchainImageUsage: is a bitmask of VkSwapchainImageUsageFlagsANDROID + * + * DEPRECATED in SPEC_VERSION 11 + */ +typedef struct { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageUsageFlags imageUsage; + VkSwapchainImageUsageFlagsANDROID swapchainImageUsage; +} VkGrallocUsageInfo2ANDROID; + +/* DEPRECATED in SPEC_VERSION 6 */ +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + int* grallocUsage); + +/* DEPRECATED in SPEC_VERSION 9 */ +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage2ANDROID)( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, + uint64_t* grallocConsumerUsage, + uint64_t* grallocProducerUsage); + +/* DEPRECATED in SPEC_VERSION 10 */ +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage3ANDROID)( + VkDevice device, + const VkGrallocUsageInfoANDROID* grallocUsageInfo, + uint64_t* grallocUsage); + +/* DEPRECATED in SPEC_VERSION 11 */ +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage4ANDROID)( + VkDevice device, + const VkGrallocUsageInfo2ANDROID* grallocUsageInfo, + uint64_t* grallocUsage); + +typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageANDROID)( + VkDevice device, + VkImage image, + int nativeFenceFd, + VkSemaphore semaphore, + VkFence fence); + +typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int* pNativeFenceFd); + +#ifndef VK_NO_PROTOTYPES + +/* DEPRECATED in SPEC_VERSION 6 */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + int* grallocUsage +); + +/* DEPRECATED in SPEC_VERSION 9 */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, + uint64_t* grallocConsumerUsage, + uint64_t* grallocProducerUsage +); + +/* DEPRECATED in SPEC_VERSION 10 */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage3ANDROID( + VkDevice device, + const VkGrallocUsageInfoANDROID* grallocUsageInfo, + uint64_t* grallocUsage +); + +/* DEPRECATED in SPEC_VERSION 11 */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage4ANDROID( + VkDevice device, + const VkGrallocUsageInfo2ANDROID* grallocUsageInfo, + uint64_t* grallocUsage +); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID( + VkDevice device, + VkImage image, + int nativeFenceFd, + VkSemaphore semaphore, + VkFence fence +); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int* pNativeFenceFd +); + +#endif +/* clang-format on */ + +#ifdef __cplusplus +} +#endif + +#endif /* __VK_ANDROID_NATIVE_BUFFER_H__ */ diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 58eaf68..3e8cfff 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -260,12 +260,6 @@ class Build 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 - } - if (buildPlatform == 'windows') { final targetConfigX64:Config = getDefaultTargetPlatform(); @@ -347,6 +341,8 @@ class Build { 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 } else { @@ -356,7 +352,7 @@ class Build 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_swiftshader=false'); // Disable SwiftShader + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader if (buildPlatform == 'macos') { diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index bc026eb..0e326aa 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -95,6 +95,9 @@ class Setup }); FileUtil.applyGitPatchesFromDir('../../patches'); + + if (platform == 'android') + FileUtil.copyFile('patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); }); // Print From e640056b9bea9c162206eaafcae7e3c8e91261b1 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 22:27:08 +0300 Subject: [PATCH 15/40] e --- source/angle/Build.hx | 2 +- source/angle/Setup.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 3e8cfff..3ca729d 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -352,7 +352,7 @@ class Build 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_swiftshader=true'); // Enable SwiftShader + renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader if (buildPlatform == 'macos') { diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 0910195..3c7c595 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -97,7 +97,7 @@ class Setup FileUtil.applyGitPatchesFromDir('../../patches'); if (platform == 'android') - FileUtil.copyFile('patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); + FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); }); // Print From a76b3b2b05e1e1ad280ce592ca1e2667838a3b56 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 22:58:01 +0300 Subject: [PATCH 16/40] idk yet again --- patches/include/cutils/native_handle.h | 125 +++++++++++++++++++++++++ source/angle/Setup.hx | 3 + 2 files changed, 128 insertions(+) create mode 100644 patches/include/cutils/native_handle.h diff --git a/patches/include/cutils/native_handle.h b/patches/include/cutils/native_handle.h new file mode 100644 index 0000000..e46e7cd --- /dev/null +++ b/patches/include/cutils/native_handle.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NATIVE_HANDLE_H_ +#define NATIVE_HANDLE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define NATIVE_HANDLE_MAX_FDS 1024 +#define NATIVE_HANDLE_MAX_INTS 1024 + +/* Declare a char array for use with native_handle_init */ +#define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \ + alignas(native_handle_t) char (name)[ \ + sizeof(native_handle_t) + sizeof(int) * ((maxFds) + (maxInts))] + +typedef struct native_handle +{ + int version; /* sizeof(native_handle_t) */ + int numFds; /* number of file-descriptors at &data[0] */ + int numInts; /* number of ints at &data[numFds] */ +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wzero-length-array" +#endif + int data[0]; /* numFds + numInts ints */ +#if defined(__clang__) +#pragma clang diagnostic pop +#endif +} native_handle_t; + +typedef const native_handle_t* buffer_handle_t; + +/* + * Closes the file descriptors contained in this native_handle_t, which may + * either be untagged or tagged for ownership by this native_handle_t via + * native_handle_set_tag(). Mixing untagged and tagged fds in the same + * native_handle_t is not permitted and triggers an fdsan exception, but + * native_handle_set_fdsan_tag() can be used to bring consistency if this is + * intentional. + * + * If it's known that fds are tagged, prefer native_handle_close_with_tag() for + * better safety. + * + * return 0 on success, or a negative error code on failure + */ +int native_handle_close(const native_handle_t* h); + +/* + * Equivalent to native_handle_close(), but throws an fdsan exception if the fds + * are untagged. Use if it's known that the fds in this native_handle_t were + * previously tagged via native_handle_set_tag(). + */ +int native_handle_close_with_tag(const native_handle_t* h); + +/* + * Initializes a native_handle_t from storage. storage must be declared with + * NATIVE_HANDLE_DECLARE_STORAGE. numFds and numInts must not respectively + * exceed maxFds and maxInts used to declare the storage. + */ +native_handle_t* native_handle_init(char* storage, int numFds, int numInts); + +/* + * Creates a native_handle_t and initializes it. Must be destroyed with + * native_handle_delete(). Note that numFds must be <= NATIVE_HANDLE_MAX_FDS, + * numInts must be <= NATIVE_HANDLE_MAX_INTS, and both must be >= 0. + */ +native_handle_t* native_handle_create(int numFds, int numInts); + +/* + * Updates the fdsan tag for any file descriptors contained in the supplied + * handle to indicate that they are owned by this handle and should only be + * closed via native_handle_close()/native_handle_close_with_tag(). Each fd in + * the handle must have a tag of either 0 (unset) or the tag associated with + * this handle, otherwise an fdsan exception will be triggered. + */ +void native_handle_set_fdsan_tag(const native_handle_t* handle); + +/* + * Clears the fdsan tag for any file descriptors contained in the supplied + * native_handle_t. Use if this native_handle_t is giving up ownership of its + * fds, but the fdsan tags were previously set. Each fd in the handle must have + * a tag of either 0 (unset) or the tag associated with this handle, otherwise + * an fdsan exception will be triggered. + */ +void native_handle_unset_fdsan_tag(const native_handle_t* handle); + +/* + * Creates a native_handle_t and initializes it from another native_handle_t. + * Must be destroyed with native_handle_delete(). + */ +native_handle_t* native_handle_clone(const native_handle_t* handle); + +/* + * Frees a native_handle_t allocated with native_handle_create(). + * This ONLY frees the memory allocated for the native_handle_t, but doesn't + * close the file descriptors; which can be achieved with native_handle_close(). + * + * return 0 on success, or a negative error code on failure + */ +int native_handle_delete(native_handle_t* h); + + +#ifdef __cplusplus +} +#endif + +#endif /* NATIVE_HANDLE_H_ */ diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 3c7c595..83126fc 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -97,7 +97,10 @@ class Setup FileUtil.applyGitPatchesFromDir('../../patches'); if (platform == 'android') + { + FileUtil.copyFile('../../patches/include/cutils/native_handle.h', 'third_party/SwiftShader/include/cutils/native_handle.h'); FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); + } }); // Print From 342ee751db2a7baacf1a08c6815e4360b551ac09 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 23:27:44 +0300 Subject: [PATCH 17/40] bradar wat is dis --- source/angle/Setup.hx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 83126fc..fa7394e 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -83,10 +83,15 @@ class Setup Sys.command('gclient', ['runhooks']); if (platform == 'android') + { + Sys.command("sed -i '/asmflags = \\[\\]/a\\if (is_android) {\\n cflags += [ \"-DVK_USE_PLATFORM_ANDROID_KHR\" ]\\n}' BUILD.gn"); + FileUtil.copyFile('../../patches/include/cutils/native_handle.h', 'third_party/SwiftShader/include/cutils/native_handle.h'); + FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-subzero', function():Void { FileUtil.copyDirectory('build/Android/include', 'include'); }); + } if (platform == 'windows') FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void @@ -95,12 +100,6 @@ class Setup }); FileUtil.applyGitPatchesFromDir('../../patches'); - - if (platform == 'android') - { - FileUtil.copyFile('../../patches/include/cutils/native_handle.h', 'third_party/SwiftShader/include/cutils/native_handle.h'); - FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); - } }); // Print From e60cb279d9071fc82f30e7217bd446818a2fadc5 Mon Sep 17 00:00:00 2001 From: Homura Date: Tue, 14 Apr 2026 23:43:07 +0300 Subject: [PATCH 18/40] ig we need to import this aswell --- patches/include/vulkan/vk_android_native_buffer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/include/vulkan/vk_android_native_buffer.h b/patches/include/vulkan/vk_android_native_buffer.h index 159b2d5..0387476 100644 --- a/patches/include/vulkan/vk_android_native_buffer.h +++ b/patches/include/vulkan/vk_android_native_buffer.h @@ -19,6 +19,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { From ec35ceb69cc17dd21dd530ce776c71dea4ad1996 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 00:12:03 +0300 Subject: [PATCH 19/40] Update Setup.hx --- source/angle/Setup.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index fa7394e..7f64989 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -84,7 +84,8 @@ class Setup if (platform == 'android') { - Sys.command("sed -i '/asmflags = \\[\\]/a\\if (is_android) {\\n cflags += [ \"-DVK_USE_PLATFORM_ANDROID_KHR\" ]\\n}' BUILD.gn"); + Sys.command("sed -i '/asmflags = \\[\\]/a\\if (is_android) {\\n cflags += [ \"-DVK_USE_PLATFORM_ANDROID_KHR\" ]\\n}' third_party/SwiftShader/BUILD.gn"); + Sys.command("sed", ["-i", "/SUBZERO_TARGET/d", "third_party/SwiftShader/src/Reactor/BUILD.gn"]); FileUtil.copyFile('../../patches/include/cutils/native_handle.h', 'third_party/SwiftShader/include/cutils/native_handle.h'); FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-subzero', function():Void From 9a65e3c3d4e2460bc7356a117aa1e3dae704babc Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 00:31:41 +0300 Subject: [PATCH 20/40] impossible to get swiftshader for android --- patches/include/cutils/native_handle.h | 125 -------- .../include/vulkan/vk_android_native_buffer.h | 293 ------------------ source/angle/Build.hx | 9 +- source/angle/Setup.hx | 11 - 4 files changed, 8 insertions(+), 430 deletions(-) delete mode 100644 patches/include/cutils/native_handle.h delete mode 100644 patches/include/vulkan/vk_android_native_buffer.h diff --git a/patches/include/cutils/native_handle.h b/patches/include/cutils/native_handle.h deleted file mode 100644 index e46e7cd..0000000 --- a/patches/include/cutils/native_handle.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NATIVE_HANDLE_H_ -#define NATIVE_HANDLE_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define NATIVE_HANDLE_MAX_FDS 1024 -#define NATIVE_HANDLE_MAX_INTS 1024 - -/* Declare a char array for use with native_handle_init */ -#define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \ - alignas(native_handle_t) char (name)[ \ - sizeof(native_handle_t) + sizeof(int) * ((maxFds) + (maxInts))] - -typedef struct native_handle -{ - int version; /* sizeof(native_handle_t) */ - int numFds; /* number of file-descriptors at &data[0] */ - int numInts; /* number of ints at &data[numFds] */ -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wzero-length-array" -#endif - int data[0]; /* numFds + numInts ints */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif -} native_handle_t; - -typedef const native_handle_t* buffer_handle_t; - -/* - * Closes the file descriptors contained in this native_handle_t, which may - * either be untagged or tagged for ownership by this native_handle_t via - * native_handle_set_tag(). Mixing untagged and tagged fds in the same - * native_handle_t is not permitted and triggers an fdsan exception, but - * native_handle_set_fdsan_tag() can be used to bring consistency if this is - * intentional. - * - * If it's known that fds are tagged, prefer native_handle_close_with_tag() for - * better safety. - * - * return 0 on success, or a negative error code on failure - */ -int native_handle_close(const native_handle_t* h); - -/* - * Equivalent to native_handle_close(), but throws an fdsan exception if the fds - * are untagged. Use if it's known that the fds in this native_handle_t were - * previously tagged via native_handle_set_tag(). - */ -int native_handle_close_with_tag(const native_handle_t* h); - -/* - * Initializes a native_handle_t from storage. storage must be declared with - * NATIVE_HANDLE_DECLARE_STORAGE. numFds and numInts must not respectively - * exceed maxFds and maxInts used to declare the storage. - */ -native_handle_t* native_handle_init(char* storage, int numFds, int numInts); - -/* - * Creates a native_handle_t and initializes it. Must be destroyed with - * native_handle_delete(). Note that numFds must be <= NATIVE_HANDLE_MAX_FDS, - * numInts must be <= NATIVE_HANDLE_MAX_INTS, and both must be >= 0. - */ -native_handle_t* native_handle_create(int numFds, int numInts); - -/* - * Updates the fdsan tag for any file descriptors contained in the supplied - * handle to indicate that they are owned by this handle and should only be - * closed via native_handle_close()/native_handle_close_with_tag(). Each fd in - * the handle must have a tag of either 0 (unset) or the tag associated with - * this handle, otherwise an fdsan exception will be triggered. - */ -void native_handle_set_fdsan_tag(const native_handle_t* handle); - -/* - * Clears the fdsan tag for any file descriptors contained in the supplied - * native_handle_t. Use if this native_handle_t is giving up ownership of its - * fds, but the fdsan tags were previously set. Each fd in the handle must have - * a tag of either 0 (unset) or the tag associated with this handle, otherwise - * an fdsan exception will be triggered. - */ -void native_handle_unset_fdsan_tag(const native_handle_t* handle); - -/* - * Creates a native_handle_t and initializes it from another native_handle_t. - * Must be destroyed with native_handle_delete(). - */ -native_handle_t* native_handle_clone(const native_handle_t* handle); - -/* - * Frees a native_handle_t allocated with native_handle_create(). - * This ONLY frees the memory allocated for the native_handle_t, but doesn't - * close the file descriptors; which can be achieved with native_handle_close(). - * - * return 0 on success, or a negative error code on failure - */ -int native_handle_delete(native_handle_t* h); - - -#ifdef __cplusplus -} -#endif - -#endif /* NATIVE_HANDLE_H_ */ diff --git a/patches/include/vulkan/vk_android_native_buffer.h b/patches/include/vulkan/vk_android_native_buffer.h deleted file mode 100644 index 0387476..0000000 --- a/patches/include/vulkan/vk_android_native_buffer.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __VK_ANDROID_NATIVE_BUFFER_H__ -#define __VK_ANDROID_NATIVE_BUFFER_H__ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define VK_ANDROID_native_buffer 1 - -#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER 11 -/* - * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 6 - * - * This version of the extension transitions from gralloc0 to gralloc1 usage - * flags (int -> 2x uint64_t). The WSI implementation will temporarily continue - * to fill out deprecated fields in VkNativeBufferANDROID, and will call the - * deprecated vkGetSwapchainGrallocUsageANDROID if the new - * vkGetSwapchainGrallocUsage2ANDROID is not supported. This transitionary - * backwards-compatibility support is temporary, and will likely be removed - * (along with all gralloc0 support) in a future release. - */ -/* - * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8 - * - * This version of the extension doesn't introduce new types or structs, but is - * to accommodate the new struct VkBindImageMemorySwapchainInfoKHR added in - * VK_KHR_swapchain spec version 69. When VkBindImageMemorySwapchainInfoKHR is - * chained in the pNext chain of VkBindImageMemoryInfo, a VkNativeBufferANDROID - * that holds the correct gralloc handle according to the imageIndex specified - * in VkBindImageMemorySwapchainInfoKHR will be additionally chained to the - * pNext chain of VkBindImageMemoryInfo and passed down to the driver. - */ -/* - * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 9 - * - * This version of the extension is largely designed to clean up the mix of - * GrallocUsage and GrallocUsage2 - */ -/* - * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 10 - * - * This version of the extension cleans up a bug introduced in version 9 - */ -/* - * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 - * - * This version of the extension deprecates the last of grallocusage and - * extends VkNativeBufferANDROID to support passing AHardwareBuffer* - */ -#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 -#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer" - -#define VK_ANDROID_NATIVE_BUFFER_ENUM(type, id) \ - ((type)(1000000000 + \ - (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id))) -#define VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID \ - VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 0) -#define VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID \ - VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 1) -#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID \ - VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 2) -#define VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_ANDROID \ - VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 3) -#define VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_2_ANDROID \ - VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 4) - -/* clang-format off */ -typedef enum VkSwapchainImageUsageFlagBitsANDROID { - VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID = 0x00000001, - VK_SWAPCHAIN_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSwapchainImageUsageFlagBitsANDROID; -typedef VkFlags VkSwapchainImageUsageFlagsANDROID; - -/* - * struct VkNativeBufferUsage2ANDROID - * - * consumer: gralloc1 consumer usage flag - * producer: gralloc1 producer usage flag - */ -typedef struct { - uint64_t consumer; - uint64_t producer; -} VkNativeBufferUsage2ANDROID; - -/* - * struct VkNativeBufferANDROID - * - * sType: VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID - * pNext: NULL or a pointer to a structure extending this structure - * handle: buffer handle returned from gralloc alloc() - * stride: stride returned from gralloc alloc() - * format: gralloc format requested when the buffer was allocated - * usage: gralloc usage requested when the buffer was allocated - * usage2: gralloc usage requested when the buffer was allocated - * usage3: gralloc usage requested when the buffer was allocated - * ahb: The AHardwareBuffer* from the actual ANativeWindowBuffer. Caller - * maintains ownership of resource. AHardwareBuffer pointer is only valid - * for the duration of the function call - */ -typedef struct { - VkStructureType sType; - const void* pNext; - buffer_handle_t handle; - int stride; - int format; - int usage; /* DEPRECATED in SPEC_VERSION 6 */ - VkNativeBufferUsage2ANDROID usage2; /* DEPRECATED in SPEC_VERSION 9 */ - uint64_t usage3; /* ADDED in SPEC_VERSION 9 */ - struct AHardwareBuffer* ahb; /* ADDED in SPEC_VERSION 11 */ -} VkNativeBufferANDROID; - -/* - * struct VkSwapchainImageCreateInfoANDROID - * - * sType: VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID - * pNext: NULL or a pointer to a structure extending this structure - * usage: is a bitmask of VkSwapchainImageUsageFlagsANDROID - */ -typedef struct { - VkStructureType sType; - const void* pNext; - VkSwapchainImageUsageFlagsANDROID usage; -} VkSwapchainImageCreateInfoANDROID; - -/* - * struct VkPhysicalDevicePresentationPropertiesANDROID - * - * sType: VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID - * pNext: NULL or a pointer to a structure extending this structure - * sharedImage: specifies if the image can be shared with the display system - */ -typedef struct { - VkStructureType sType; - const void* pNext; - VkBool32 sharedImage; -} VkPhysicalDevicePresentationPropertiesANDROID; - -/* - * struct VkGrallocUsageInfoANDROID - * - * sType: VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_ANDROID - * pNext: NULL or a pointer to a structure extending this structure - * format: value specifying the format the image will be created with - * imageUsage: bitmask of VkImageUsageFlagBits describing intended usage - * - * DEPRECATED in SPEC_VERSION 10 - */ -typedef struct { - VkStructureType sType; - const void* pNext; - VkFormat format; - VkImageUsageFlags imageUsage; -} VkGrallocUsageInfoANDROID; - -/* - * struct VkGrallocUsageInfo2ANDROID - * - * sType: VK_STRUCTURE_TYPE_GRALLOC_USAGE_INFO_2_ANDROID - * pNext: NULL or a pointer to a structure extending this structure - * format: value specifying the format the image will be created with - * imageUsage: bitmask of VkImageUsageFlagBits describing intended usage - * swapchainImageUsage: is a bitmask of VkSwapchainImageUsageFlagsANDROID - * - * DEPRECATED in SPEC_VERSION 11 - */ -typedef struct { - VkStructureType sType; - const void* pNext; - VkFormat format; - VkImageUsageFlags imageUsage; - VkSwapchainImageUsageFlagsANDROID swapchainImageUsage; -} VkGrallocUsageInfo2ANDROID; - -/* DEPRECATED in SPEC_VERSION 6 */ -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)( - VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - int* grallocUsage); - -/* DEPRECATED in SPEC_VERSION 9 */ -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage2ANDROID)( - VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, - uint64_t* grallocConsumerUsage, - uint64_t* grallocProducerUsage); - -/* DEPRECATED in SPEC_VERSION 10 */ -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage3ANDROID)( - VkDevice device, - const VkGrallocUsageInfoANDROID* grallocUsageInfo, - uint64_t* grallocUsage); - -/* DEPRECATED in SPEC_VERSION 11 */ -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage4ANDROID)( - VkDevice device, - const VkGrallocUsageInfo2ANDROID* grallocUsageInfo, - uint64_t* grallocUsage); - -typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageANDROID)( - VkDevice device, - VkImage image, - int nativeFenceFd, - VkSemaphore semaphore, - VkFence fence); - -typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)( - VkQueue queue, - uint32_t waitSemaphoreCount, - const VkSemaphore* pWaitSemaphores, - VkImage image, - int* pNativeFenceFd); - -#ifndef VK_NO_PROTOTYPES - -/* DEPRECATED in SPEC_VERSION 6 */ -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID( - VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - int* grallocUsage -); - -/* DEPRECATED in SPEC_VERSION 9 */ -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID( - VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, - uint64_t* grallocConsumerUsage, - uint64_t* grallocProducerUsage -); - -/* DEPRECATED in SPEC_VERSION 10 */ -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage3ANDROID( - VkDevice device, - const VkGrallocUsageInfoANDROID* grallocUsageInfo, - uint64_t* grallocUsage -); - -/* DEPRECATED in SPEC_VERSION 11 */ -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage4ANDROID( - VkDevice device, - const VkGrallocUsageInfo2ANDROID* grallocUsageInfo, - uint64_t* grallocUsage -); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID( - VkDevice device, - VkImage image, - int nativeFenceFd, - VkSemaphore semaphore, - VkFence fence -); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID( - VkQueue queue, - uint32_t waitSemaphoreCount, - const VkSemaphore* pWaitSemaphores, - VkImage image, - int* pNativeFenceFd -); - -#endif -/* clang-format on */ - -#ifdef __cplusplus -} -#endif - -#endif /* __VK_ANDROID_NATIVE_BUFFER_H__ */ diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 3ca729d..9ecdcfe 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -242,7 +242,14 @@ 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=true'); // Enable SwiftShader + if (buildPlatform != 'android') + { + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader + } + else + { + renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader + } if (buildPlatform == 'windows') { diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index fa7394e..670f27e 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -82,17 +82,6 @@ class Setup Sys.command('gclient', ['sync', '--no-history', '--jobs', '8']); Sys.command('gclient', ['runhooks']); - if (platform == 'android') - { - Sys.command("sed -i '/asmflags = \\[\\]/a\\if (is_android) {\\n cflags += [ \"-DVK_USE_PLATFORM_ANDROID_KHR\" ]\\n}' BUILD.gn"); - FileUtil.copyFile('../../patches/include/cutils/native_handle.h', 'third_party/SwiftShader/include/cutils/native_handle.h'); - FileUtil.copyFile('../../patches/include/vulkan/vk_android_native_buffer.h', 'third_party/SwiftShader/include/vulkan/vk_android_native_buffer.h'); - FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-subzero', function():Void - { - FileUtil.copyDirectory('build/Android/include', 'include'); - }); - } - if (platform == 'windows') FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void { From e0c2e86945add4a63fa37d9df98abf87a2ed6e27 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 01:30:06 +0300 Subject: [PATCH 21/40] I need compile on host for more info --- source/angle/Build.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 9ecdcfe..cd102fe 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -245,10 +245,12 @@ class Build if (buildPlatform != 'android') { renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader + renderingBackends.push('angle_use_custom_libvulkan=false'); } else { renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader + renderingBackends.push('angle_use_custom_libvulkan=true'); } if (buildPlatform == 'windows') @@ -265,7 +267,6 @@ 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 == 'windows') { From eeb58cbfdae4ec131cfe3309f72eb2792d028e5a Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 10:10:59 +0300 Subject: [PATCH 22/40] Update Build.hx --- source/angle/Build.hx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index cd102fe..b9ea7cb 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -97,10 +97,12 @@ class Build // Copy angle's libs. for (buildConfig in buildConfigs) { - final libsToCopy:Array = ANGLE_LIBS; + var libsToCopy:Array = ANGLE_LIBS; if (buildPlatform == 'windows') - libsToCopy.push('d3dcompiler_47'); + libsToCopy = ['d3dcompiler_47', 'libEGL', 'libGLESv2', 'vk_swiftshader', 'vulkan-1']; + else if (buildPlatform == 'linux') + libsToCopy = ['libEGL', 'libGLESv2', 'libvk_swiftshader']; for (lib in libsToCopy) { @@ -145,6 +147,12 @@ class Build iosFrameworksToCombine.get(lib)?.get(buildConfig.environment)?.push(libDestination); } } + + if (buildPlatform == 'windows' || buildPlatform == 'linux') + FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/bin/${buildConfig.cpu}/vk_swiftshader_icd.json'); + + if (buildPlatform == 'linux') + FileUtil.copyFile('angle/${buildConfig.getExportPath()}/libvulkan.so.1', 'build/$buildPlatform/bin/${buildConfig.cpu}/libvulkan.so.1'); } if (buildPlatform == 'macos') From 3c2036b630c2c9e1e3e14571b8c5fd3c6cdaa6a8 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 12:24:17 +0300 Subject: [PATCH 23/40] Update Build.hx --- source/angle/Build.hx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index b9ea7cb..b677896 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -148,11 +148,13 @@ class Build } } - if (buildPlatform == 'windows' || buildPlatform == 'linux') + if (buildPlatform == 'windows') FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/bin/${buildConfig.cpu}/vk_swiftshader_icd.json'); - - if (buildPlatform == 'linux') - FileUtil.copyFile('angle/${buildConfig.getExportPath()}/libvulkan.so.1', 'build/$buildPlatform/bin/${buildConfig.cpu}/libvulkan.so.1'); + else if (buildPlatform == 'linux') + { + FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/lib/${buildConfig.cpu}/vk_swiftshader_icd.json'); + FileUtil.copyFile('angle/${buildConfig.getExportPath()}/libvulkan.so.1', 'build/$buildPlatform/lib/${buildConfig.cpu}/libvulkan.so.1'); + } } if (buildPlatform == 'macos') From d7df2d5e7ea980a4482da0efcfcb3263e14759c9 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 13:41:02 +0300 Subject: [PATCH 24/40] Update Setup.hx --- source/angle/Setup.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 670f27e..59a47b5 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -10,7 +10,7 @@ import angle.util.FileUtil; class Setup { - static final ANGLE_COMMIT:String = '0fe2ac00168e8116a4d2f909326ab54bf1032ec4'; + static final ANGLE_COMMIT:String = '8c9aded1f44e49e2ff8aabc6021f9d39dd615007'; public static function run():Void { From 69cb6d72a0e81eee67337406eb2a76b44a065ee4 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 14:10:29 +0300 Subject: [PATCH 25/40] ok no --- source/angle/Setup.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 59a47b5..670f27e 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -10,7 +10,7 @@ import angle.util.FileUtil; class Setup { - static final ANGLE_COMMIT:String = '8c9aded1f44e49e2ff8aabc6021f9d39dd615007'; + static final ANGLE_COMMIT:String = '0fe2ac00168e8116a4d2f909326ab54bf1032ec4'; public static function run():Void { From 7f53927dcb93d9b373a85ea01b72f718a7921adb Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 14:15:05 +0300 Subject: [PATCH 26/40] screw you gclient --- source/angle/Setup.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 670f27e..a555df6 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -79,7 +79,7 @@ class Setup } // Syncing ANGLE dependencies with gclient... - Sys.command('gclient', ['sync', '--no-history', '--jobs', '8']); + Sys.command('gclient', ['sync', '--force', '--with_branch_heads', '--with_tags', '--jobs', '8']); Sys.command('gclient', ['runhooks']); if (platform == 'windows') From 5ee1815f716120fc2b73a6f1818cbc118f06c5ee Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 14:52:50 +0300 Subject: [PATCH 27/40] Update Setup.hx --- source/angle/Setup.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index a555df6..670f27e 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -79,7 +79,7 @@ class Setup } // Syncing ANGLE dependencies with gclient... - Sys.command('gclient', ['sync', '--force', '--with_branch_heads', '--with_tags', '--jobs', '8']); + Sys.command('gclient', ['sync', '--no-history', '--jobs', '8']); Sys.command('gclient', ['runhooks']); if (platform == 'windows') From 9c6d878f15e43d0ee5e8159246317028e3a4ce8b Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 15:09:01 +0300 Subject: [PATCH 28/40] Update gclient sync command and handle Android platform --- source/angle/Setup.hx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 670f27e..1550da0 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -71,17 +71,42 @@ class Setup 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 == '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', '--jobs', '8']); + Sys.command('gclient', ['sync', '--no-history', '--shallow', '--jobs', '8']); Sys.command('gclient', ['runhooks']); + if (platform == 'android') + 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')) + { + 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']); + } + }); + + // weird MSVC quirk if (platform == 'windows') FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void { From 3e28e68201b098ca7cce6d9872c25c5447cf1707 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 15:19:32 +0300 Subject: [PATCH 29/40] chaos breaking my puh part 2 --- source/angle/Setup.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 1550da0..8903a17 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -105,6 +105,7 @@ class Setup Sys.command('git', ['clone', 'https://github.com/google/cpu_features', 'src', '-b', 'v0.8.0']); } }); + }); // weird MSVC quirk if (platform == 'windows') From f24e3f7d9a0d8a25e0b8f9d92fa059c73eb78c23 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 15:39:48 +0300 Subject: [PATCH 30/40] idk bro --- source/angle/Build.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index b677896..bdfd2b2 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -255,12 +255,10 @@ class Build if (buildPlatform != 'android') { renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader - renderingBackends.push('angle_use_custom_libvulkan=false'); } else { renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader - renderingBackends.push('angle_use_custom_libvulkan=true'); } if (buildPlatform == 'windows') @@ -277,6 +275,14 @@ 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 + if (buildPlatform != 'android') + { + renderingBackends.push('angle_use_custom_libvulkan=true'); // Use ANGLE's Vulkan loader + } + else + { + renderingBackends.push('angle_use_custom_libvulkan=false'); // Use system Vulkan loader + } if (buildPlatform == 'windows') { From a723847153653ef5fe8af77db8c6bf4f3fa0e21c Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 15:42:31 +0300 Subject: [PATCH 31/40] Update Setup.hx --- source/angle/Setup.hx | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/source/angle/Setup.hx b/source/angle/Setup.hx index 8903a17..168eda5 100644 --- a/source/angle/Setup.hx +++ b/source/angle/Setup.hx @@ -71,8 +71,8 @@ class Setup 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 == 'android') + gclientFile.push('target_os = ["android"]'); else if (platform == 'ios') gclientFile.push('target_os = ["ios"]'); File.saveContent('.gclient', gclientFile.join('\n')); @@ -82,31 +82,6 @@ class Setup Sys.command('gclient', ['sync', '--no-history', '--shallow', '--jobs', '8']); Sys.command('gclient', ['runhooks']); - if (platform == 'android') - 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')) - { - 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']); - } - }); - }); - // weird MSVC quirk if (platform == 'windows') FileUtil.goAndBackFromDir('third_party/SwiftShader/third_party/llvm-10.0', function():Void From 8bd064ac9ca160c39b4bb50c97e7f78a1d3a6148 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 16:49:54 +0300 Subject: [PATCH 32/40] Update Build.hx --- source/angle/Build.hx | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index bdfd2b2..471458c 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -100,7 +100,7 @@ class Build var libsToCopy:Array = ANGLE_LIBS; if (buildPlatform == 'windows') - libsToCopy = ['d3dcompiler_47', 'libEGL', 'libGLESv2', 'vk_swiftshader', 'vulkan-1']; + libsToCopy = ['d3dcompiler_47', 'libEGL', 'libGLESv2', 'vk_swiftshader']; else if (buildPlatform == 'linux') libsToCopy = ['libEGL', 'libGLESv2', 'libvk_swiftshader']; @@ -150,11 +150,8 @@ class Build 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') - { + else FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/lib/${buildConfig.cpu}/vk_swiftshader_icd.json'); - FileUtil.copyFile('angle/${buildConfig.getExportPath()}/libvulkan.so.1', 'build/$buildPlatform/lib/${buildConfig.cpu}/libvulkan.so.1'); - } } if (buildPlatform == 'macos') @@ -252,14 +249,7 @@ 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 - if (buildPlatform != 'android') - { - renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader - } - else - { - renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader - } + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader if (buildPlatform == 'windows') { @@ -275,14 +265,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 - if (buildPlatform != 'android') - { - renderingBackends.push('angle_use_custom_libvulkan=true'); // Use ANGLE's Vulkan loader - } - else - { - renderingBackends.push('angle_use_custom_libvulkan=false'); // Use system Vulkan loader - } + renderingBackends.push('angle_use_custom_libvulkan=false'); // Use system Vulkan loader if (buildPlatform == 'windows') { From c8abe2bf21c3699c5dc5470aa27a23d062fe4dd5 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 16:59:19 +0300 Subject: [PATCH 33/40] Update Build.hx --- source/angle/Build.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 471458c..5de45b0 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -350,6 +350,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=true'); // Use ANGLE's Vulkan loader } else { From 032f31669aff92f306d590c93425eaaa26a6eee5 Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 17:21:02 +0300 Subject: [PATCH 34/40] Update Build.hx --- source/angle/Build.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 5de45b0..8260b6b 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -150,7 +150,7 @@ class Build if (buildPlatform == 'windows') FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/bin/${buildConfig.cpu}/vk_swiftshader_icd.json'); - else + else if (buildPlatform == 'linux') FileUtil.copyFile('angle/${buildConfig.getExportPath()}/vk_swiftshader_icd.json', 'build/$buildPlatform/lib/${buildConfig.cpu}/vk_swiftshader_icd.json'); } @@ -249,7 +249,14 @@ 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=true'); // Enable SwiftShader + if (buildPlatform != 'android') + { + renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader + } + else + { + renderingBackends.push('angle_enable_swiftshader=false'); // Disable SwiftShader + } if (buildPlatform == 'windows') { From 63d763811cf4d1d983aa51cb63aac6ffb89284db Mon Sep 17 00:00:00 2001 From: Homura Date: Wed, 15 Apr 2026 18:34:30 +0300 Subject: [PATCH 35/40] macaroniOS --- source/angle/Build.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 8260b6b..b197bc0 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -103,6 +103,8 @@ class Build 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) { From f873d1355fdef7cf86e1cdb0215ef72c44f6727a Mon Sep 17 00:00:00 2001 From: Homura Date: Thu, 16 Apr 2026 02:19:02 +0300 Subject: [PATCH 36/40] remove subzero --- source/angle/Build.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index b197bc0..a3ce190 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -254,6 +254,7 @@ class Build if (buildPlatform != 'android') { renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader + renderingBackends.push('use_swiftshader_with_subzero=false'); // Disable Subzero for SwiftShader } else { From a6c7ba0f5df9deacd241ead6ee11c95e0483de47 Mon Sep 17 00:00:00 2001 From: Homura Date: Thu, 16 Apr 2026 09:10:46 +0300 Subject: [PATCH 37/40] Update Build.hx --- source/angle/Build.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index a3ce190..cd4ca0b 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -254,7 +254,10 @@ class Build if (buildPlatform != 'android') { renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader - renderingBackends.push('use_swiftshader_with_subzero=false'); // Disable Subzero for SwiftShader + if (buildPlatform == 'linux') + { + renderingBackends.push('use_swiftshader_with_subzero=false'); // Disable Subzero for SwiftShader + } } else { From 07d262fe6085802ddb84e3c715f413ae18933884 Mon Sep 17 00:00:00 2001 From: Homura Date: Thu, 16 Apr 2026 09:11:24 +0300 Subject: [PATCH 38/40] Update Build.hx --- source/angle/Build.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index cd4ca0b..42f3552 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -254,7 +254,7 @@ class Build if (buildPlatform != 'android') { renderingBackends.push('angle_enable_swiftshader=true'); // Enable SwiftShader - if (buildPlatform == 'linux') + if (buildPlatform == 'windows') { renderingBackends.push('use_swiftshader_with_subzero=false'); // Disable Subzero for SwiftShader } From 21451a7b0a593df54dc42c5e925a3ef3cce81a75 Mon Sep 17 00:00:00 2001 From: Homura Date: Thu, 16 Apr 2026 19:07:42 +0300 Subject: [PATCH 39/40] 24 --- source/angle/Build.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/angle/Build.hx b/source/angle/Build.hx index 42f3552..a860c86 100644 --- a/source/angle/Build.hx +++ b/source/angle/Build.hx @@ -452,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 From d7e5d08cd5e5dab37bd78620320f8a756b963c05 Mon Sep 17 00:00:00 2001 From: Homura Date: Fri, 17 Apr 2026 00:38:52 +0300 Subject: [PATCH 40/40] upstream patches --- .../0001-metal-drawable-timeout-safety.patch | 40 +++++++++++++++++++ ...ndering-when-backbuffer-just-resized.patch | 26 ++++++++++++ ...t-metal-layer-maximum-drawable-count.patch | 24 +++++++++++ ...for-MAX_TEXTURE_SIZE-unconditionally.patch | 0 ...9-support-for-ANGLE_DEFAULT_PLATFORM.patch | 0 ...ails-from-GL_RENDERER-and-GL_VERSION.patch | 0 ...force-enable-Intel-OpenGL-ES-drivers.patch | 0 7 files changed, 90 insertions(+) create mode 100644 patches/0001-metal-drawable-timeout-safety.patch create mode 100644 patches/0002-metal-skip-rendering-when-backbuffer-just-resized.patch create mode 100644 patches/0003-metal-limit-metal-layer-maximum-drawable-count.patch rename patches/{ => SE}/0001-Bend-ANGLE-rules-for-MAX_TEXTURE_SIZE-unconditionally.patch (100%) rename patches/{ => SE}/0002-Enable-D3D9-support-for-ANGLE_DEFAULT_PLATFORM.patch (100%) rename patches/{ => SE}/0003-Drop-verbose-debug-details-from-GL_RENDERER-and-GL_VERSION.patch (100%) rename patches/{ => SE}/0004-force-enable-Intel-OpenGL-ES-drivers.patch (100%) diff --git a/patches/0001-metal-drawable-timeout-safety.patch b/patches/0001-metal-drawable-timeout-safety.patch new file mode 100644 index 0000000..526b9a8 --- /dev/null +++ b/patches/0001-metal-drawable-timeout-safety.patch @@ -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 + diff --git a/patches/0002-metal-skip-rendering-when-backbuffer-just-resized.patch b/patches/0002-metal-skip-rendering-when-backbuffer-just-resized.patch new file mode 100644 index 0000000..f482fa7 --- /dev/null +++ b/patches/0002-metal-skip-rendering-when-backbuffer-just-resized.patch @@ -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 + diff --git a/patches/0003-metal-limit-metal-layer-maximum-drawable-count.patch b/patches/0003-metal-limit-metal-layer-maximum-drawable-count.patch new file mode 100644 index 0000000..2b184b4 --- /dev/null +++ b/patches/0003-metal-limit-metal-layer-maximum-drawable-count.patch @@ -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 + diff --git a/patches/0001-Bend-ANGLE-rules-for-MAX_TEXTURE_SIZE-unconditionally.patch b/patches/SE/0001-Bend-ANGLE-rules-for-MAX_TEXTURE_SIZE-unconditionally.patch similarity index 100% rename from patches/0001-Bend-ANGLE-rules-for-MAX_TEXTURE_SIZE-unconditionally.patch rename to patches/SE/0001-Bend-ANGLE-rules-for-MAX_TEXTURE_SIZE-unconditionally.patch diff --git a/patches/0002-Enable-D3D9-support-for-ANGLE_DEFAULT_PLATFORM.patch b/patches/SE/0002-Enable-D3D9-support-for-ANGLE_DEFAULT_PLATFORM.patch similarity index 100% rename from patches/0002-Enable-D3D9-support-for-ANGLE_DEFAULT_PLATFORM.patch rename to patches/SE/0002-Enable-D3D9-support-for-ANGLE_DEFAULT_PLATFORM.patch diff --git a/patches/0003-Drop-verbose-debug-details-from-GL_RENDERER-and-GL_VERSION.patch b/patches/SE/0003-Drop-verbose-debug-details-from-GL_RENDERER-and-GL_VERSION.patch similarity index 100% rename from patches/0003-Drop-verbose-debug-details-from-GL_RENDERER-and-GL_VERSION.patch rename to patches/SE/0003-Drop-verbose-debug-details-from-GL_RENDERER-and-GL_VERSION.patch diff --git a/patches/0004-force-enable-Intel-OpenGL-ES-drivers.patch b/patches/SE/0004-force-enable-Intel-OpenGL-ES-drivers.patch similarity index 100% rename from patches/0004-force-enable-Intel-OpenGL-ES-drivers.patch rename to patches/SE/0004-force-enable-Intel-OpenGL-ES-drivers.patch