Skip to content

Commit

Permalink
Add optional ANGLE support for Windows destop.
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
fire authored and EIREXE committed Jan 2, 2021
1 parent 68013d2 commit 6e75955
Show file tree
Hide file tree
Showing 11 changed files with 470 additions and 9 deletions.
7 changes: 6 additions & 1 deletion drivers/gl_context/SCsub
Expand Up @@ -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 = [
Expand Down
3 changes: 3 additions & 0 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Expand Up @@ -88,7 +88,10 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;

// enable extensions manually for android and ios
#ifndef UWP_ENABLED
#ifndef WINDOWS_ENABLED
#include <dlfcn.h> // needed to load extensions

#endif // !WINDOWS_ENABLED
#endif

#ifdef IPHONE_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/shaders/blend_shape.glsl
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions drivers/gles3/shaders/scene.glsl
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion gles_builders.py
Expand Up @@ -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()
Expand Down
6 changes: 5 additions & 1 deletion platform/windows/SCsub
Expand Up @@ -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",
Expand All @@ -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)
Expand Down

0 comments on commit 6e75955

Please sign in to comment.