Skip to content

Commit

Permalink
Godot 4 GLES2 2D renderer + linux display manager
Browse files Browse the repository at this point in the history
First implementation with linux display manager
Co-authored-by:clayjohn <claynjohn@gmail.com>
Co-authored-by:Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
  • Loading branch information
lawnjelly committed Dec 22, 2020
1 parent 30d469a commit 1c225cd
Show file tree
Hide file tree
Showing 88 changed files with 35,944 additions and 663 deletions.
22 changes: 22 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ from collections import OrderedDict
# Local
import methods
import glsl_builders
import gles_builders
from platform_methods import run_in_subprocess

# Scan possible build platforms

Expand Down Expand Up @@ -615,6 +617,26 @@ if selected_platform in platform_list:
}
env.Append(BUILDERS=GLSL_BUILDERS)

if not env["platform"] == "server": # FIXME: detect 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(
action=run_in_subprocess(gles_builders.build_gles2_headers),
suffix="glsl.gen.h",
src_suffix=".glsl",
)
}
)

scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
CacheDir(scons_cache_path)
Expand Down
11 changes: 11 additions & 0 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class OS {
bool restart_on_exit = false;
List<String> restart_commandline;

// for the user interface we keep a record of the current display driver
// so we can retrieve the rendering drivers available
int _display_driver_id = -1;
String _current_rendering_driver_name = "";

protected:
void _set_logger(CompositeLogger *p_logger);

Expand Down Expand Up @@ -94,6 +99,9 @@ class OS {
virtual void initialize() = 0;
virtual void initialize_joypads() = 0;

void set_current_rendering_driver_name(String p_driver_name) { _current_rendering_driver_name = p_driver_name; }
void set_display_driver_id(int p_display_driver_id) { _display_driver_id = p_display_driver_id; }

virtual void set_main_loop(MainLoop *p_main_loop) = 0;
virtual void delete_main_loop() = 0;

Expand All @@ -109,6 +117,9 @@ class OS {

static OS *get_singleton();

String get_current_rendering_driver_name() const { return _current_rendering_driver_name; }
int get_display_driver_id() const { return _display_driver_id; }

void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
void print(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
void printerr(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
Expand Down
3 changes: 3 additions & 0 deletions drivers/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ SConscript("winmidi/SCsub")
# Graphics drivers
if env["platform"] != "server" and env["platform"] != "javascript":
SConscript("vulkan/SCsub")
SConscript("gles2/SCsub")
SConscript("gles_common/SCsub")
SConscript("gl_context/SCsub")
else:
SConscript("dummy/SCsub")

Expand Down
23 changes: 23 additions & 0 deletions drivers/gl_context/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python

Import("env")

if env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]:
# Thirdparty source files
thirdparty_dir = "#thirdparty/glad/"
thirdparty_sources = [
"glad.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env.Prepend(CPPPATH=[thirdparty_dir])

env.Append(CPPDEFINES=["GLAD_ENABLED"])
env.Append(CPPDEFINES=["GLES_OVER_GL"])

env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources)

# Godot source files
env.add_source_files(env.drivers_sources, "*.cpp")
7 changes: 7 additions & 0 deletions drivers/gles2/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python

Import("env")

env.add_source_files(env.drivers_sources, "*.cpp")

SConscript("shaders/SCsub")
Loading

0 comments on commit 1c225cd

Please sign in to comment.