Skip to content

Commit

Permalink
Adding back the GLES3 renderer pt1. Unlike in godot it can be disable…
Browse files Browse the repository at this point in the history
…d compile time. It will be enabled afer if works.
  • Loading branch information
Relintai committed Jul 15, 2024
1 parent 71e6670 commit 9d6680c
Show file tree
Hide file tree
Showing 60 changed files with 31,207 additions and 13 deletions.
14 changes: 14 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ opts.Add(
False,
)
)
opts.Add(BoolVariable("disable_gles3", "Disable the gles3 video driver.", True))
opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True))
Expand Down Expand Up @@ -699,6 +700,9 @@ if selected_platform in platform_list:
if env["tools"]:
env.Append(CPPDEFINES=["TOOLS_ENABLED"])

if env["disable_gles3"]:
env.Append(CPPDEFINES=["GLES3_DISABLED"])

if env["disable_3d"]:
if env["tools"]:
print(
Expand All @@ -709,6 +713,7 @@ if selected_platform in platform_list:
else:
env.Append(CPPDEFINES=["_3D_DISABLED"])


if env["disable_advanced_gui"]:
if env["tools"]:
print(
Expand All @@ -725,6 +730,15 @@ if selected_platform in platform_list:
methods.no_verbose(sys, env)

if not env["platform"] == "server":
if not env["disable_gles3"]:
env.Append(
BUILDERS={
"GLES3_GLSL": env.Builder(
action=run_in_subprocess(gles_builders.build_gles3_headers), suffix="glsl.gen.h", src_suffix=".glsl"
)
}
)

env.Append(
BUILDERS={
"GLES2_GLSL": env.Builder(
Expand Down
3 changes: 3 additions & 0 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,9 @@ void _OS::_bind_methods() {
ADD_PROPERTY_DEFAULT("window_size", Vector2());

BIND_ENUM_CONSTANT(VIDEO_DRIVER_GLES2);
#ifndef GLES3_DISABLED
BIND_ENUM_CONSTANT(VIDEO_DRIVER_GLES3);
#endif

BIND_ENUM_CONSTANT(DAY_SUNDAY);
BIND_ENUM_CONSTANT(DAY_MONDAY);
Expand Down
3 changes: 3 additions & 0 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class _OS : public Object {
public:
enum VideoDriver {
VIDEO_DRIVER_GLES2,
#ifndef GLES3_DISABLED
VIDEO_DRIVER_GLES3,
#endif
};

enum PowerState {
Expand Down
4 changes: 4 additions & 0 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ const char *OS::get_video_driver_name(int p_driver) const {
switch (p_driver) {
case VIDEO_DRIVER_GLES2:
return "GLES2";
#ifndef GLES3_DISABLED
case VIDEO_DRIVER_GLES3:
return "GLES3";
#endif
default:
return "GLES2";
}
Expand Down
3 changes: 3 additions & 0 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ class OS {
// This should be customizable
enum VideoDriver {
VIDEO_DRIVER_GLES2,
#ifndef GLES3_DISABLED
VIDEO_DRIVER_GLES3,
#endif
VIDEO_DRIVER_MAX,
};

Expand Down
4 changes: 4 additions & 0 deletions drivers/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ SConscript("winmidi/SCsub")
# Graphics drivers
if env["platform"] != "server":
SConscript("gles2/SCsub")

if not env["disable_gles3"]:
SConscript("gles3/SCsub")

SConscript("gles_common/SCsub")
SConscript("gl_context/SCsub")
else:
Expand Down
8 changes: 8 additions & 0 deletions drivers/gles3/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python

Import("env")

if not env["disable_gles3"]:
env.add_source_files(env.drivers_sources, "*.cpp")

SConscript("shaders/SCsub")
Loading

0 comments on commit 9d6680c

Please sign in to comment.