Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ jobs:
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Download pre-built ANGLE
shell: sh
id: angle-sdk
run: |
if python ./misc/scripts/install_angle.py; then
echo "ANGLE_ENABLED=yes" >> "$GITHUB_OUTPUT"
else
echo "::warning::ANGLE SDK installation failed, building without ANGLE support."
echo "ANGLE_ENABLED=no" >> "$GITHUB_OUTPUT"
fi

- name: Download pre-built AccessKit
shell: sh
id: accesskit-sdk
Expand All @@ -74,14 +85,14 @@ jobs:
- name: Compilation (x86_64)
uses: ./.github/actions/godot-build
with:
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=x86_64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }}
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=x86_64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }}
platform: macos
target: ${{ matrix.target }}

- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=arm64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }}
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} arch=arm64 vulkan=${{ steps.vulkan-sdk.outputs.VULKAN_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }}
platform: macos
target: ${{ matrix.target }}

Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:
dev_mode=yes
module_text_server_fb_enabled=yes
debug_symbols=no
"angle_libs=${{ github.workspace }}/"
SCONS_CACHE_MSVC_CONFIG: true
PYTHONIOENCODING: utf8

Expand Down Expand Up @@ -83,16 +82,16 @@ jobs:
fi
continue-on-error: true

- name: Download pre-built ANGLE static libraries
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: godotengine/godot-angle-static
version: tags/chromium/6601.2
file: godot-angle-static-x86_64-${{ matrix.compiler == 'gcc' && 'gcc' || 'msvc' }}-release.zip
target: angle/angle.zip

- name: Extract pre-built ANGLE static libraries
run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/
- name: Download pre-built ANGLE
shell: sh
id: angle-sdk
run: |
if python ./misc/scripts/install_angle.py; then
echo "ANGLE_ENABLED=yes" >> "$GITHUB_OUTPUT"
else
echo "::warning::ANGLE SDK installation failed, building without ANGLE support."
echo "ANGLE_ENABLED=no" >> "$GITHUB_OUTPUT"
fi

- name: Download pre-built AccessKit
shell: sh
Expand All @@ -108,7 +107,7 @@ jobs:
- name: Compilation
uses: ./.github/actions/godot-build
with:
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} d3d12=${{ steps.d3d12-sdk.outputs.D3D12_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }}
scons-flags: ${{ env.SCONS_FLAGS }} ${{ matrix.scons-flags }} d3d12=${{ steps.d3d12-sdk.outputs.D3D12_ENABLED }} accesskit=${{ steps.accesskit-sdk.outputs.ACCESSKIT_ENABLED }} angle=${{ steps.angle-sdk.outputs.ANGLE_ENABLED }}
platform: windows
target: ${{ matrix.target }}

Expand Down
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver on suppo
opts.Add(BoolVariable("metal", "Enable the Metal rendering driver on supported platforms (Apple arm64 only)", False))
opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
opts.Add(BoolVariable("accesskit", "Enable the AccessKit driver for screen reader support", True))
opts.Add(BoolVariable("angle", "Enable the ANGLE rendering driver for OpenGL ES 3.0 on supported platforms", True))
opts.Add(BoolVariable("sdl", "Enable the SDL3 input driver", True))
opts.Add(
EnumVariable(
Expand Down
14 changes: 8 additions & 6 deletions drivers/gl_context/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ if env["platform"] in ["macos", "windows", "linuxbsd"]:
thirdparty_dir = "#thirdparty/glad/"
thirdparty_sources = ["gl.c"]

if not env.get("angle_libs"):
thirdparty_sources += ["egl.c"]

thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env.Prepend(CPPPATH=[thirdparty_dir])

env.Append(CPPDEFINES=["GLAD_ENABLED"])
env.Append(CPPDEFINES=["EGL_ENABLED"])
if env["platform"] == "linuxbsd":
thirdparty_sources += ["egl.c"]
env.Append(CPPDEFINES=["EGL_ENABLED", "GLAD_GLES2"])
else:
if env["angle"]:
env.Append(CPPDEFINES=["EGL_ENABLED", "GLAD_GLES2"])

thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
Expand Down
2 changes: 2 additions & 0 deletions drivers/gles3/rasterizer_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ RasterizerGLES3::RasterizerGLES3() {
if (!glad_loaded && gladLoaderLoadGL()) {
glad_loaded = true;
}
#ifdef GLES_API_ENABLED
} else {
if (!glad_loaded && gladLoaderLoadGLES2()) {
glad_loaded = true;
}
#endif
}

// FIXME this is an early return from a constructor. Any other code using this instance will crash or the finalizer will crash, because none of
Expand Down
73 changes: 73 additions & 0 deletions misc/scripts/install_angle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python3

import os
import platform
import shutil
import sys
import urllib.request

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../"))

from misc.utility.color import Ansi, color_print

# Base Godot dependencies path
# If cross-compiling (no LOCALAPPDATA), we install in `bin`
deps_folder = os.getenv("LOCALAPPDATA")
if deps_folder:
deps_folder = os.path.join(deps_folder, "Godot", "build_deps")
else:
deps_folder = os.path.join("bin", "build_deps")

# ANGLE
# Check for latest version: https://github.com/godotengine/godot-angle-static/releases/latest
angle_version = "chromium/7219"
angle_folder = os.path.join(deps_folder, "angle")

# Create dependencies folder
if not os.path.exists(deps_folder):
os.makedirs(deps_folder)

# Mesa NIR
print(f"Downloading ANGLE {angle_version} ...")
archs = [
"arm64-llvm",
"x86_32-gcc",
"x86_32-llvm",
"x86_64-gcc",
"x86_64-llvm",
]
if platform.system() == "Windows":
# Only download MSVC libraries if we can build using it.
archs.append("arm64-msvc")
archs.append("x86_32-msvc")
archs.append("x86_64-msvc")
elif platform.system() == "Darwin":
# Only download macOS/iOS libraries if we can build for these platforms.
archs.append("arm64-ios")
archs.append("arm64-ios-sim")
archs.append("arm64-macos")
archs.append("x86_64-macos")

for arch in archs:
angle_filename = f"godot-angle-static-{arch}-release.zip"
angle_archive = os.path.join(deps_folder, angle_filename)
angle_folder = os.path.join(deps_folder, f"angle-{arch}")

if os.path.isfile(angle_archive):
os.remove(angle_archive)
print(f"Downloading ANGLE {angle_filename} ...")
urllib.request.urlretrieve(
f"https://github.com/godotengine/godot-angle-static/releases/download/{angle_version}/{angle_filename}",
angle_archive,
)
if os.path.exists(angle_folder):
print(f"Removing existing local ANGLE installation in {angle_folder} ...")
shutil.rmtree(angle_folder)
print(f"Extracting ANGLE {angle_filename} to {angle_folder} ...")
shutil.unpack_archive(angle_archive, angle_folder)
os.remove(angle_archive)
print("ANGLE installed successfully.\n")

# Complete message
color_print(f'{Ansi.GREEN}All ANGLE components were installed to "{deps_folder}" successfully!')
color_print(f'{Ansi.GREEN}You can now build Godot with statically linked ANGLE by running "scons angle=yes".')
4 changes: 4 additions & 0 deletions platform/linuxbsd/platform_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#define GLES_API_ENABLED // Allow using GLES.
#endif

#ifndef GLAD_GLES2
#define GLAD_GLES2
#endif

// IWYU pragma: begin_exports.
#include <thirdparty/glad/glad/egl.h>
#include <thirdparty/glad/glad/gl.h>
Expand Down
3 changes: 1 addition & 2 deletions platform/linuxbsd/wayland/detect_prime_egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#ifdef EGL_ENABLED

#ifdef GLAD_ENABLED
#include <thirdparty/glad/glad/egl.h>
#include <thirdparty/glad/glad/gl.h>
#include <platform_gl.h>
#else
Comment thread
bruvzg marked this conversation as resolved.
#include <EGL/egl.h>
#include <EGL/eglext.h>
Expand Down
3 changes: 2 additions & 1 deletion platform/linuxbsd/x11/detect_prime_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
#include "core/string/print_string.h"
#include "core/variant/variant.h"

#include <thirdparty/glad/glad/gl.h>
#include <thirdparty/glad/glad/glx.h>

#include <platform_gl.h>

#ifdef SOWRAP_ENABLED
#include "x11/dynwrappers/xlib-so_wrap.h"
#else
Expand Down
4 changes: 3 additions & 1 deletion platform/macos/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ files = [
"dir_access_macos.mm",
"tts_macos.mm",
"rendering_context_driver_vulkan_macos.mm",
"gl_manager_macos_angle.mm",
"gl_manager_macos_legacy.mm",
"godot_progress_view.mm",
]

if env["angle"]:
files += ["gl_manager_macos_angle.mm"]

if env.editor_build:
files += [
"display_server_macos_embedded.mm",
Expand Down
32 changes: 24 additions & 8 deletions platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def get_opts():
"Path to the AccessKit C SDK",
os.path.join(deps_folder, "accesskit"),
),
("angle_libs", "Path to the ANGLE static libraries", ""),
(
"angle_libs",
"Path to the ANGLE static libraries",
os.path.join(deps_folder, "angle"),
),
(
"bundle_sign_identity",
"The 'Full Name', 'Common Name' or SHA-1 hash of the signing identity used to sign editor .app bundle.",
Expand Down Expand Up @@ -279,13 +283,25 @@ def configure(env: "SConsEnvironment"):

if env["opengl3"]:
env.Append(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":
env.AppendUnique(CPPDEFINES=["EGL_STATIC"])
env.Append(LINKFLAGS=["-L" + env["angle_libs"]])
env.Append(LINKFLAGS=["-lANGLE.macos." + env["arch"]])
env.Append(LINKFLAGS=["-lEGL.macos." + env["arch"]])
env.Append(LINKFLAGS=["-lGLES.macos." + env["arch"]])
env.Prepend(CPPPATH=["#thirdparty/angle/include"])
if env["angle"]:
angle_path = env["angle_libs"] + "-" + env["arch"] + "-macos"
print(angle_path)
if os.path.exists(angle_path):
env.Prepend(CPPPATH=["#thirdparty/angle/include"])
env.AppendUnique(CPPDEFINES=["ANGLE_ENABLED", "EGL_STATIC"])
env.Append(LINKFLAGS=["-L" + angle_path])
env.Append(LINKFLAGS=["-lANGLE.macos." + env["arch"]])
env.Append(LINKFLAGS=["-lEGL.macos." + env["arch"]])
env.Append(LINKFLAGS=["-lGLES.macos." + env["arch"]])
else:
print_warning(
"The ANGLE rendering driver requires dependencies to be installed.\n"
f"You can install them by running `python {os.path.join('misc', 'scripts', 'install_angle.py')}`.\n"
"See the documentation for more information:\n"
"\thttps://docs.godotengine.org/en/latest/engine_details/development/compiling/compiling_for_windows.html\n"
"Alternatively, disable this driver by compiling with `angle=no` explicitly."
)
env["angle"] = False

env.Append(LINKFLAGS=["-rpath", "@executable_path/../Frameworks", "-rpath", "@executable_path"])

Expand Down
4 changes: 4 additions & 0 deletions platform/macos/display_server_macos.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#include "display_server_macos_base.h"

#if defined(GLES3_ENABLED)
#if defined(ANGLE_ENABLED)
#include "gl_manager_macos_angle.h"
#endif
#include "gl_manager_macos_legacy.h"
#endif // GLES3_ENABLED

Expand Down Expand Up @@ -167,7 +169,9 @@ class DisplayServerMacOS : public DisplayServerMacOSBase {

#if defined(GLES3_ENABLED)
GLManagerLegacy_MacOS *gl_manager_legacy = nullptr;
#if defined(ANGLE_ENABLED)
GLManagerANGLE_MacOS *gl_manager_angle = nullptr;
#endif
#endif
String rendering_driver;

Expand Down
Loading
Loading