Skip to content

Commit 594d9d6

Browse files
committed
Update ANGLE binaries.
- the binaries are pulled from Chrome 131 binary dirs - load the entry points via a loader, using code from ANGLE - use the WebGL compatibility mode extension in ANGLE - replace Linux and Mac gyp builds with binaries Note that currently there are a couple WebGL regressions because of an outdated conformance test suite. This contribution is funded by https://higharc.com/
1 parent c16e31e commit 594d9d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+30817
-483
lines changed

binding.gyp

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@
1616
'sources': [
1717
'src/native/bindings.cc',
1818
'src/native/webgl.cc',
19-
'src/native/procs.cc'
19+
'src/native/angle-loader/egl_loader.cc',
20+
'src/native/angle-loader/gles_loader.cc'
2021
],
2122
'include_dirs': [
2223
"<!(node -e \"require('nan')\")",
2324
'<(module_root_dir)/deps/include',
24-
"angle/include"
25+
"src/native/angle-includes"
2526
],
2627
'library_dirs': [
2728
'<(module_root_dir)/deps/<(platform)'
2829
],
2930
'conditions': [
3031
['OS=="mac"', {
31-
'dependencies':
32-
[
33-
'angle/src/angle.gyp:libEGL',
34-
'angle/src/angle.gyp:libGLESv2'
35-
],
3632
'libraries': [
3733
'-framework QuartzCore',
3834
'-framework Quartz'
@@ -45,22 +41,28 @@
4541
'CLANG_CXX_LANGUAGE_STANDARD':'c++17',
4642
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0'
4743
},
44+
"copies": [
45+
{
46+
'destination': './build',
47+
'files': [
48+
'<(module_root_dir)/deps/darwin/dylib/libEGL.dylib',
49+
'<(module_root_dir)/deps/darwin/dylib/libGLESv2.dylib',
50+
]
51+
}
52+
]
4853
}],
4954
['OS=="linux"', {
50-
'dependencies':
51-
[
52-
'angle/src/angle.gyp:libEGL',
53-
'angle/src/angle.gyp:libGLESv2'
54-
]
55+
"copies": [
56+
{
57+
'destination': './build',
58+
'files': [
59+
'<(module_root_dir)/deps/linux/so/libEGL.so',
60+
'<(module_root_dir)/deps/linux/so/libGLESv2.so',
61+
]
62+
}
63+
]
5564
}],
5665
['OS=="win"', {
57-
'library_dirs': [
58-
'<(module_root_dir)/deps/windows/lib/<(target_arch)',
59-
],
60-
'libraries': [
61-
'libEGL.lib',
62-
'libGLESv2.lib'
63-
],
6466
'defines' : [
6567
'WIN32_LEAN_AND_MEAN',
6668
'VC_EXTRALEAN'
@@ -102,11 +104,11 @@
102104
},
103105
"copies": [
104106
{
105-
'destination': '$(SolutionDir)$(ConfigurationName)',
107+
'destination': '$(SolutionDir)',
106108
'files': [
107-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/libEGL.dll',
108-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/libGLESv2.dll',
109-
'<(module_root_dir)/deps/windows/dll/<(target_arch)/d3dcompiler_47.dll'
109+
'<(module_root_dir)/deps/windows/dll/libEGL.dll',
110+
'<(module_root_dir)/deps/windows/dll/libGLESv2.dll',
111+
'<(module_root_dir)/deps/windows/dll/d3dcompiler_47.dll'
110112
]
111113
}
112114
]

deps/darwin/dylib/libEGL.dylib

479 KB
Binary file not shown.

deps/darwin/dylib/libGLESv2.dylib

14.4 MB
Binary file not shown.

deps/linux/so/libEGL.so

235 KB
Binary file not shown.

deps/linux/so/libGLESv2.so

6.62 MB
Binary file not shown.

deps/windows/dll/d3dcompiler_47.dll

4.69 MB
Binary file not shown.

deps/windows/dll/libEGL.dll

493 KB
Binary file not shown.

deps/windows/dll/libGLESv2.dll

7.86 MB
Binary file not shown.
-3.98 MB
Binary file not shown.

deps/windows/dll/x64/libEGL.dll

-85.5 KB
Binary file not shown.

deps/windows/dll/x64/libGLESv2.dll

-2.6 MB
Binary file not shown.

deps/windows/lib/x64/libEGL.lib

-12.6 KB
Binary file not shown.

deps/windows/lib/x64/libGLESv2.lib

-166 KB
Binary file not shown.

src/native/SharedLibrary.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#pragma once
2+
3+
#include <iostream>
4+
#include <stdexcept>
5+
#include <string>
6+
7+
#ifdef _WIN32
8+
#include <windows.h>
9+
#else
10+
#include <dlfcn.h>
11+
#endif
12+
13+
inline std::string GetSharedLibraryExtension() {
14+
#ifdef _WIN32
15+
return ".dll"; // Windows
16+
#elif __APPLE__
17+
return ".dylib"; // OSX
18+
#elif __linux__
19+
return ".so"; // Linux
20+
#else
21+
#error Unsupported platform
22+
#endif
23+
}
24+
25+
class SharedLibrary {
26+
public:
27+
SharedLibrary() {}
28+
29+
bool open(const std::string& libraryPath) {
30+
const std::string libraryPathWithExt = libraryPath + GetSharedLibraryExtension();
31+
#ifdef _WIN32
32+
handle = LoadLibraryA(libraryPathWithExt.c_str());
33+
#else
34+
handle = dlopen(libraryPathWithExt.c_str(), RTLD_LAZY);
35+
#endif
36+
return handle != nullptr;
37+
}
38+
39+
~SharedLibrary() {
40+
if (handle) {
41+
#ifdef _WIN32
42+
FreeLibrary(static_cast<HMODULE>(handle));
43+
#else
44+
dlclose(handle);
45+
#endif
46+
}
47+
}
48+
49+
template <typename Func>
50+
Func getFunction(const std::string& functionName) {
51+
#ifdef _WIN32
52+
auto func = reinterpret_cast<Func>(GetProcAddress(static_cast<HMODULE>(handle), functionName.c_str()));
53+
#else
54+
auto func = reinterpret_cast<Func>(dlsym(handle, functionName.c_str()));
55+
#endif
56+
return func;
57+
}
58+
59+
private:
60+
void* handle = nullptr;
61+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DisableFormat: true
2+
SortIncludes: false

0 commit comments

Comments
 (0)