diff options
author | lawnjelly <lawnjelly@gmail.com> | 2020-11-18 18:11:30 +0000 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-10-30 02:05:48 +0200 |
commit | e3491a37445014cc3527d6f2c1467063222b2dd8 (patch) | |
tree | 7f8250aee66fbc382040f0c843a91a5f85238d45 /servers | |
parent | d046817536a21358f9c51bf5b932d0a6615ee76a (diff) |
Add GLES2 2D renderer + Linux display manager
First implementation with Linux display manager.
- Add single-threaded mode for EditorResourcePreview (needed for OpenGL).
Co-authored-by: clayjohn <claynjohn@gmail.com>
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Diffstat (limited to 'servers')
-rw-r--r-- | servers/display_server.cpp | 4 | ||||
-rw-r--r-- | servers/display_server.h | 3 | ||||
-rw-r--r-- | servers/rendering/renderer_scene_cull.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_viewport.cpp | 3 |
4 files changed, 14 insertions, 0 deletions
diff --git a/servers/display_server.cpp b/servers/display_server.cpp index 3fb47e8f05..7bf5673663 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -208,6 +208,10 @@ void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region ERR_FAIL_MSG("Mouse passthrough not supported by this display server."); } +void DisplayServer::gl_window_make_current(DisplayServer::WindowID p_window_id) { + // noop except in gles +} + void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) { WARN_PRINT("IME not supported by this display server."); } diff --git a/servers/display_server.h b/servers/display_server.h index 2595cf2eb8..2d837dbef9 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -298,6 +298,9 @@ public: virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID); virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID); + // necessary for GL focus, may be able to use one of the existing functions for this, not sure yet + virtual void gl_window_make_current(DisplayServer::WindowID p_window_id); + virtual Point2i ime_get_selection() const; virtual String ime_get_text() const; diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 8421938507..e338e526a0 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -3855,6 +3855,10 @@ void RendererSceneCull::update() { } bool RendererSceneCull::free(RID p_rid) { + if (p_rid.is_null()) { + return true; + } + if (scene_render->free(p_rid)) { return true; } diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index 347238cdaa..f312c2501f 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -129,6 +129,9 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { timestamp_vp_map[rt_id] = p_viewport->self; } + // This is currently needed for GLES to keep the current window being rendered to up to date + DisplayServer::get_singleton()->gl_window_make_current(p_viewport->viewport_to_screen); + /* Camera should always be BEFORE any other 3D */ bool scenario_draw_canvas_bg = false; //draw canvas, or some layer of it, as BG for 3D instead of in front |