From 6e75955afdaecb7d19569840897c1536e60a1b55 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 12 Aug 2020 06:57:26 -0700 Subject: [PATCH] Add optional ANGLE support for Windows destop. Originally From https://github.com/EIRTeam/godot.git Some precision fixes by iFire at https://github.com/V-Sekai/godot.git Put the self-compiled angle folder in thirdparty. The release folder should be `thirdparty/angle/out/Release`. --- drivers/gl_context/SCsub | 7 +- drivers/gles2/rasterizer_storage_gles2.cpp | 3 + drivers/gles3/shaders/blend_shape.glsl | 2 +- drivers/gles3/shaders/scene.glsl | 8 +- gles_builders.py | 3 +- platform/windows/SCsub | 6 +- platform/windows/context_gl_windows_angle.cpp | 334 ++++++++++++++++++ platform/windows/context_gl_windows_angle.h | 95 +++++ platform/windows/detect.py | 12 +- platform/windows/os_windows.h | 4 + platform/windows/platform_config.h | 5 + 11 files changed, 470 insertions(+), 9 deletions(-) create mode 100644 platform/windows/context_gl_windows_angle.cpp create mode 100644 platform/windows/context_gl_windows_angle.h diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index e2e499f5c2af0..c07988abeec2a 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -2,7 +2,12 @@ Import("env") -if env["platform"] in ["haiku", "osx", "windows", "x11"]: +if env["platform"] in ["windows"] and env["use_angle"]: + # ANGLE on windows desktop + thirdparty_dir = "#thirdparty/angle/include" + env.Prepend(CPPPATH=[thirdparty_dir]) + env.Append(LIBPATH=["#thirdparty/angle/out/Release"]) +elif env["platform"] in ["windows", "haiku", "osx", "x11"]: # Thirdparty source files thirdparty_dir = "#thirdparty/glad/" thirdparty_sources = [ diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 322f63488cbfb..8535f8cf63eca 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -88,7 +88,10 @@ GLuint RasterizerStorageGLES2::system_fbo = 0; // enable extensions manually for android and ios #ifndef UWP_ENABLED +#ifndef WINDOWS_ENABLED #include // needed to load extensions + +#endif // !WINDOWS_ENABLED #endif #ifdef IPHONE_ENABLED diff --git a/drivers/gles3/shaders/blend_shape.glsl b/drivers/gles3/shaders/blend_shape.glsl index a1e954e33d2ff..c85db7117cc77 100644 --- a/drivers/gles3/shaders/blend_shape.glsl +++ b/drivers/gles3/shaders/blend_shape.glsl @@ -103,7 +103,7 @@ out vec2 uv2_out; //tfb:ENABLE_UV2 #endif #ifdef ENABLE_SKELETON -out ivec4 bone_out; //tfb:ENABLE_SKELETON +flat out ivec4 bone_out; //tfb:ENABLE_SKELETON out vec4 weight_out; //tfb:ENABLE_SKELETON #endif diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index a45ac2eb8a60f..65df42ac78171 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -114,7 +114,7 @@ uniform highp mat4 world_transform; layout(std140) uniform DirectionalLightData { //ubo:3 highp vec4 light_pos_inv_radius; - mediump vec4 light_direction_attenuation; + highp vec4 light_direction_attenuation; mediump vec4 light_color_energy; mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; @@ -134,7 +134,7 @@ layout(std140) uniform DirectionalLightData { //ubo:3 struct LightData { highp vec4 light_pos_inv_radius; - mediump vec4 light_direction_attenuation; + highp vec4 light_direction_attenuation; mediump vec4 light_color_energy; mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; @@ -752,7 +752,7 @@ layout(std140) uniform SceneData { layout(std140) uniform DirectionalLightData { highp vec4 light_pos_inv_radius; - mediump vec4 light_direction_attenuation; + highp vec4 light_direction_attenuation; mediump vec4 light_color_energy; mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; @@ -777,7 +777,7 @@ in vec4 specular_light_interp; struct LightData { highp vec4 light_pos_inv_radius; - mediump vec4 light_direction_attenuation; + highp vec4 light_direction_attenuation; mediump vec4 light_color_energy; mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; diff --git a/gles_builders.py b/gles_builders.py index dda3922ed3fb9..388f3fb4057c9 100644 --- a/gles_builders.py +++ b/gles_builders.py @@ -158,8 +158,9 @@ def include_file_in_legacygl_header(filename, header_data, depth): bind = bind.replace("attrib:", "").strip() header_data.attributes += [(name, bind)] - if line.strip().find("out ") == 0 and line.find("tfb:") != -1: + if (line.strip().find("out ") == 0 or line.strip().find("flat out ") == 0) and line.find("tfb:") != -1: uline = line.replace("out ", "") + uline = uline.replace("flat ", "") uline = uline.replace("highp ", "") uline = uline.replace(";", "") uline = uline[uline.find(" ") :].strip() diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 5cfaa69628906..e24d5acee8b34 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -8,7 +8,6 @@ import platform_windows_builders common_win = [ "godot_windows.cpp", - "context_gl_windows.cpp", "crash_handler_windows.cpp", "os_windows.cpp", "key_mapping_windows.cpp", @@ -17,6 +16,11 @@ common_win = [ "windows_terminal_logger.cpp", ] +if env["use_angle"]: + common_win.append("context_gl_windows_angle.cpp") +else: + common_win.append("context_gl_windows.cpp") + res_file = "godot_res.rc" res_target = "godot_res" + env["OBJSUFFIX"] res_obj = env.RES(res_target, res_file) diff --git a/platform/windows/context_gl_windows_angle.cpp b/platform/windows/context_gl_windows_angle.cpp new file mode 100644 index 0000000000000..feac81f66b9ef --- /dev/null +++ b/platform/windows/context_gl_windows_angle.cpp @@ -0,0 +1,334 @@ +/*************************************************************************/ +/* context_gl_windows_angle.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) + +// Author: Juan Linietsky , (C) 2008 + +#include "context_gl_windows_angle.h" +#include +#include +#define WGL_EXT_swap_control 1 +#include + +#include + +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 + +#if defined(__GNUC__) +// Workaround GCC warning from -Wcast-function-type. +#define wglGetProcAddress (void *)wglGetProcAddress +#endif + +typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *); + +void ContextGL_Windows::release_current() { + eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mEglContext); +} + +void ContextGL_Windows::make_current() { + eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext); +} + +HDC ContextGL_Windows::get_hdc() { + return hDC; +} + +HGLRC ContextGL_Windows::get_hglrc() { + return hRC; +} + +int ContextGL_Windows::get_window_width() { + + return OS::get_singleton()->get_video_mode().width; +} + +int ContextGL_Windows::get_window_height() { + + return OS::get_singleton()->get_video_mode().height; +} + +bool ContextGL_Windows::should_vsync_via_compositor() { + + if (OS::get_singleton()->is_window_fullscreen() || !OS::get_singleton()->is_vsync_via_compositor_enabled()) { + return false; + } + + // Note: All Windows versions supported by Godot have a compositor. + // It can be disabled on earlier Windows versions. + BOOL dwm_enabled; + + if (SUCCEEDED(DwmIsCompositionEnabled(&dwm_enabled))) { + return dwm_enabled; + } + + return false; +} + +void ContextGL_Windows::swap_buffers() { + + if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE) { + cleanup(); + + initialize(); + + // tell rasterizer to reload textures and stuff? + } + + if (use_vsync) { + bool vsync_via_compositor_now = should_vsync_via_compositor(); + + if (vsync_via_compositor_now && wglGetSwapIntervalEXT() == 0) { + DwmFlush(); + } + + if (vsync_via_compositor_now != vsync_via_compositor) { + // The previous frame had a different operating mode than this + // frame. Set the 'vsync_via_compositor' member variable and the + // OpenGL swap interval to their proper values. + set_use_vsync(true); + } + } +} + +void ContextGL_Windows::set_use_vsync(bool p_use) { + use_vsync = p_use; + if (!p_use) { + eglSwapInterval(mEglDisplay, 0); + } else { + eglSwapInterval(mEglDisplay, 1); + } +} + +bool ContextGL_Windows::is_using_vsync() const { + + return use_vsync; +} + +void ContextGL_Windows::cleanup() { + if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE) { + eglDestroySurface(mEglDisplay, mEglSurface); + mEglSurface = EGL_NO_SURFACE; + } + + if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mEglContext); + mEglContext = EGL_NO_CONTEXT; + } + + if (mEglDisplay != EGL_NO_DISPLAY) { + eglTerminate(mEglDisplay); + mEglDisplay = EGL_NO_DISPLAY; + } +}; + +#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 + +EGLDisplay get_egl_display(EGLint platform_type) { + EGLDisplay display = EGL_NO_DISPLAY; + if (platform_type == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) { + EGLint display_attributes[] = { + /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9, + EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3, + EGL_NONE,*/ + // These are the default display attributes, used to request ANGLE's D3D11 renderer. + // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+. + EGL_PLATFORM_ANGLE_TYPE_ANGLE, + platform_type, + + EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, + EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE, + + EGL_NONE, + }; + display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, display_attributes); + } else { + EGLint display_attributes[] = { + /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9, + EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3, + EGL_NONE,*/ + // These are the default display attributes, used to request ANGLE's D3D11 renderer. + // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+. + EGL_PLATFORM_ANGLE_TYPE_ANGLE, + platform_type, + + EGL_NONE, + }; + display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, display_attributes); + }; + return display; +} + +Error ContextGL_Windows::initialize() { + + EGLint configAttribList[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 8, + EGL_STENCIL_SIZE, 8, + EGL_SAMPLE_BUFFERS, 0, + EGL_NONE + }; + + EGLint surfaceAttribList[] = { + EGL_NONE, EGL_NONE + }; + + EGLint numConfigs = 0; + EGLint majorVersion = 1; + EGLint minorVersion; + minorVersion = 5; + EGLDisplay display = EGL_NO_DISPLAY; + EGLContext context = EGL_NO_CONTEXT; + EGLSurface surface = EGL_NO_SURFACE; + EGLConfig config = nullptr; + EGLint contextAttribs[3]; + + contextAttribs[0] = EGL_CONTEXT_CLIENT_VERSION; + contextAttribs[1] = 3; + contextAttribs[2] = EGL_NONE; + + try { + + int platform_type = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE; + + List args = OS::get_singleton()->get_cmdline_args(); + List::Element *I = args.front(); + bool backend_forced_by_user = false; + while (I) { + if (I->get() == "--angle-backend") { + String backend = I->next()->get().to_lower(); + if (backend == "vulkan") { + platform_type = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE; + backend_forced_by_user = true; + } else if (backend == "d3d11") { + platform_type = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE; + backend_forced_by_user = true; + } else if (backend == "opengl") { + platform_type = EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE; + backend_forced_by_user = true; + } + } + I = I->next(); + } + + display = EGL_NO_DISPLAY; + + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast(eglGetProcAddress("eglGetPlatformDisplayEXT")); + + if (!eglGetPlatformDisplayEXT) { + throw "Failed to get function eglGetPlatformDisplayEXT"; + } + + // When the user doesn't force a specific backend through the command line argument + // --angle-backend we try to use vulkan, d3d11 and opengl in that order. + if (!backend_forced_by_user) { + const EGLint platform_fallbacks[] = { + EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE, + EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, + }; + + for (int i = 0; i < sizeof(platform_fallbacks); i++) { + platform_type = platform_fallbacks[i]; + display = get_egl_display(platform_type); + if (display != EGL_NO_DISPLAY) { + break; + } + } + } else { + display = get_egl_display(platform_type); + } + + if (display == EGL_NO_DISPLAY) { + throw "Failed to get EGL display"; + } + + if (eglInitialize(display, &majorVersion, &minorVersion) == EGL_FALSE) { + throw "Failed to initialize EGL"; + } + + if (eglGetConfigs(display, NULL, 0, &numConfigs) == EGL_FALSE) { + throw "Failed to get EGLConfig count"; + } + + if (eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) == EGL_FALSE) { + throw "Failed to choose first EGLConfig count"; + } + + surface = eglCreateWindowSurface(display, config, hWnd, surfaceAttribList); + if (surface == EGL_NO_SURFACE) { + throw "Failed to create EGL fullscreen surface"; + } + + context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs); + if (context == EGL_NO_CONTEXT) { + throw "Failed to create EGL context"; + } + + if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { + throw "Failed to make fullscreen EGLSurface current"; + } + } catch (const char *err) { + print_error(String(err)); + return FAILED; + }; + + mEglDisplay = display; + mEglSurface = surface; + mEglContext = context; + + eglQuerySurface(display, surface, EGL_WIDTH, &width); + eglQuerySurface(display, surface, EGL_HEIGHT, &height); + + return OK; +} + +ContextGL_Windows::ContextGL_Windows(HWND hwnd, bool p_opengl_3_context) { + + opengl_3_context = p_opengl_3_context; + hWnd = hwnd; + use_vsync = false; + vsync_via_compositor = false; +} + +ContextGL_Windows::~ContextGL_Windows() { +} + +#endif diff --git a/platform/windows/context_gl_windows_angle.h b/platform/windows/context_gl_windows_angle.h new file mode 100644 index 0000000000000..7fb9c052367cf --- /dev/null +++ b/platform/windows/context_gl_windows_angle.h @@ -0,0 +1,95 @@ +/*************************************************************************/ +/* context_gl_windows_angle.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) + +// Author: Juan Linietsky , (C) 2008 + +#ifndef CONTEXT_GL_WIN_H +#define CONTEXT_GL_WIN_H + +#include "core/error_list.h" +#include "core/os/os.h" + +#include + +#include +#include + +typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval); +typedef int(APIENTRY *PFNWGLGETSWAPINTERVALEXTPROC)(void); + +class ContextGL_Windows { + + HDC hDC; + HGLRC hRC; + unsigned int pixel_format; + HWND hWnd; + bool opengl_3_context; + bool use_vsync; + bool vsync_via_compositor; + + PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; + PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT; + + static bool should_vsync_via_compositor(); + +public: + void release_current(); + + void make_current(); + + HDC get_hdc(); + HGLRC get_hglrc(); + + int get_window_width(); + int get_window_height(); + void swap_buffers(); + + Error initialize(); + void cleanup(); + + void set_use_vsync(bool p_use); + bool is_using_vsync() const; + + ContextGL_Windows(HWND hwnd, bool p_opengl_3_context); + ~ContextGL_Windows(); + +private: + EGLDisplay mEglDisplay; + EGLContext mEglContext; + EGLSurface mEglSurface; + + EGLint width; + EGLint height; +}; + +#endif +#endif diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 86943af309020..e28e4af23988e 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -71,6 +71,7 @@ def get_opts(): BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_thinlto", "Use ThinLTO", False), BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True), + BoolVariable("use_angle", "Build using ANGLE instead of native GL", False), ] @@ -244,7 +245,6 @@ def configure_msvc(env, manual_msvc_config): LIBS = [ "winmm", - "opengl32", "dsound", "kernel32", "ole32", @@ -264,6 +264,16 @@ def configure_msvc(env, manual_msvc_config): "Avrt", "dwmapi", ] + + if env["use_angle"]: + LIBS += ["libEGL.dll", "libGLESv2.dll"] + angle_include_dir = "#thirdparty/angle/include" + env.Prepend(CPPPATH=[angle_include_dir]) + env.Append(LIBPATH=["#thirdparty/angle/out/Release"]) + env.Append(CPPDEFINES=["GL_GLEXT_PROTOTYPES", "EGL_EGLEXT_PROTOTYPES", "ANGLE_ENABLED"]) + else: + LIBS.append("opengl32") + env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS]) if manual_msvc_config: diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index a073bcc431d5c..65f168f1088e2 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -31,7 +31,11 @@ #ifndef OS_WINDOWS_H #define OS_WINDOWS_H +#ifdef ANGLE_ENABLED +#include "context_gl_windows_angle.h" +#else #include "context_gl_windows.h" +#endif #include "core/os/input.h" #include "core/os/os.h" #include "core/project_settings.h" diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 04653ee56cee0..5da871202568c 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -32,5 +32,10 @@ //#else //#include //#endif +#ifdef ANGLE_ENABLED +#define GLES3_INCLUDE_H +#define GLES2_INCLUDE_H +#else #define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h" #define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" +#endif