summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml18
-rw-r--r--core/os/os.cpp36
-rw-r--r--core/os/os.h3
-rw-r--r--drivers/dummy/rasterizer_dummy.h33
-rw-r--r--editor/editor_help_search.cpp19
-rw-r--r--main/main.cpp34
-rw-r--r--main/main.h1
-rw-r--r--scene/gui/dialogs.cpp5
-rw-r--r--scene/gui/dialogs.h1
-rw-r--r--scene/main/window.cpp12
10 files changed, 99 insertions, 63 deletions
diff --git a/.travis.yml b/.travis.yml
index 9376fbcc06..2639cf9661 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -100,15 +100,15 @@ matrix:
packages:
- *linux_deps
-# - name: Javascript export template (release, emscripten latest)
-# stage: build
-# env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes"
-# os: linux
-# compiler: clang
-# addons:
-# apt:
-# packages:
-# - *linux_deps
+ - name: JavaScript export template (release, emscripten latest)
+ stage: build
+ env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes"
+ os: linux
+ compiler: clang
+ addons:
+ apt:
+ packages:
+ - *linux_deps
before_install:
- eval "${MATRIX_EVAL}"
diff --git a/core/os/os.cpp b/core/os/os.cpp
index c842be333c..231069fcfb 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -41,6 +41,7 @@
#include <stdarg.h>
OS *OS::singleton = nullptr;
+uint64_t OS::target_ticks = 0;
OS *OS::get_singleton() {
return singleton;
@@ -468,6 +469,41 @@ void OS::close_midi_inputs() {
}
}
+void OS::add_frame_delay(bool p_can_draw) {
+ const uint32_t frame_delay = Engine::get_singleton()->get_frame_delay();
+ if (frame_delay) {
+ // Add fixed frame delay to decrease CPU/GPU usage. This doesn't take
+ // the actual frame time into account.
+ // Due to the high fluctuation of the actual sleep duration, it's not recommended
+ // to use this as a FPS limiter.
+ delay_usec(frame_delay * 1000);
+ }
+
+ // Add a dynamic frame delay to decrease CPU/GPU usage. This takes the
+ // previous frame time into account for a smoother result.
+ uint64_t dynamic_delay = 0;
+ if (is_in_low_processor_usage_mode() || !p_can_draw) {
+ dynamic_delay = get_low_processor_usage_mode_sleep_usec();
+ }
+ const int target_fps = Engine::get_singleton()->get_target_fps();
+ if (target_fps > 0 && !Engine::get_singleton()->is_editor_hint()) {
+ // Override the low processor usage mode sleep delay if the target FPS is lower.
+ dynamic_delay = MAX(dynamic_delay, (uint64_t)(1000000 / target_fps));
+ }
+
+ if (dynamic_delay > 0) {
+ target_ticks += dynamic_delay;
+ uint64_t current_ticks = get_ticks_usec();
+
+ if (current_ticks < target_ticks) {
+ delay_usec(target_ticks - current_ticks);
+ }
+
+ current_ticks = get_ticks_usec();
+ target_ticks = MIN(MAX(target_ticks, current_ticks - dynamic_delay), current_ticks + dynamic_delay);
+ }
+}
+
OS::OS() {
void *volatile stack_bottom;
diff --git a/core/os/os.h b/core/os/os.h
index 04e10518dc..f21c0d4df7 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -43,6 +43,7 @@
class OS {
static OS *singleton;
+ static uint64_t target_ticks;
String _execpath;
List<String> _cmdline;
bool _keep_screen_on = true; // set default value to true, because this had been true before godot 2.0.
@@ -212,6 +213,8 @@ public:
virtual double get_unix_time() const;
virtual void delay_usec(uint32_t p_usec) const = 0;
+ virtual void add_frame_delay(bool p_can_draw);
+
virtual uint64_t get_ticks_usec() const = 0;
uint32_t get_ticks_msec() const;
uint64_t get_splash_tick_msec() const;
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index 7af7678f63..636a885c89 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -51,6 +51,14 @@ public:
int get_directional_light_shadow_size(RID p_light_intance) { return 0; }
void set_directional_shadow_count(int p_count) {}
+ /* SDFGI UPDATE */
+
+ virtual void sdfgi_update(RID p_render_buffers, RID p_environment, const Vector3 &p_world_position) {}
+ virtual int sdfgi_get_pending_region_count(RID p_render_buffers) const { return 0; }
+ virtual AABB sdfgi_get_pending_region_bounds(RID p_render_buffers, int p_region) const { return AABB(); }
+ virtual uint32_t sdfgi_get_pending_region_cascade(RID p_render_buffers, int p_region) const { return 0; }
+ virtual void sdfgi_update_probes(RID p_render_buffers, RID p_environment, const RID *p_directional_light_instances, uint32_t p_directional_light_count, const RID *p_positional_light_instances, uint32_t p_positional_light_count) {}
+
/* SKY API */
RID sky_create() { return RID(); }
@@ -87,6 +95,11 @@ public:
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {}
virtual void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size) {}
+ virtual void environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, bool p_enhance_ssr, float p_energy, float p_normal_bias, float p_probe_bias) {}
+
+ virtual void environment_set_sdfgi_ray_count(RS::EnvironmentSDFGIRayCount p_ray_count) {}
+ virtual void environment_set_sdfgi_frames_to_converge(RS::EnvironmentSDFGIFramesToConverge p_frames) {}
+
void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {}
void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {}
@@ -114,6 +127,7 @@ public:
RID light_instance_create(RID p_light) { return RID(); }
void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {}
+ virtual void light_instance_set_aabb(RID p_light_instance, const AABB &p_aabb) {}
void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_shadow_texel_size, float p_bias_scale = 1.0, float p_range_begin = 0, const Vector2 &p_uv_scale = Vector2()) {}
void light_instance_mark_visible(RID p_light_instance) {}
@@ -137,9 +151,13 @@ public:
virtual bool gi_probe_needs_update(RID p_probe) const { return false; }
virtual void gi_probe_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, int p_dynamic_object_count, InstanceBase **p_dynamic_objects) {}
+ virtual void gi_probe_set_quality(RS::GIProbeQuality) {}
+
virtual void render_scene(RID p_render_buffers, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID *p_gi_probe_cull_result, int p_gi_probe_cull_count, RID *p_decal_cull_result, int p_decal_cull_count, InstanceBase **p_lightmap_cull_result, int p_lightmap_cull_count, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {}
void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {}
virtual void render_material(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID p_framebuffer, const Rect2i &p_region) {}
+ virtual void render_sdfgi(RID p_render_buffers, int p_region, InstanceBase **p_cull_result, int p_cull_count) {}
+ virtual void render_sdfgi_static_lights(RID p_render_buffers, uint32_t p_cascade_count, const uint32_t *p_cascade_indices, const RID **p_positional_light_cull_result, const uint32_t *p_positional_light_cull_count) {}
void set_scene_pass(uint64_t p_pass) {}
virtual void set_time(double p_time, double p_step) {}
@@ -148,7 +166,7 @@ public:
virtual RID render_buffers_create() { return RID(); }
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa) {}
- virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_curve) {}
+ virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) {}
virtual bool screen_space_roughness_limiter_is_active() const { return false; }
virtual void sub_surface_scattering_set_quality(RS::SubSurfaceScatteringQuality p_quality) {}
@@ -158,6 +176,7 @@ public:
bool free(RID p_rid) { return true; }
virtual void update() {}
+ virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) {}
RasterizerSceneDummy() {}
~RasterizerSceneDummy() {}
@@ -576,7 +595,8 @@ public:
void light_set_negative(RID p_light, bool p_enable) {}
void light_set_cull_mask(RID p_light, uint32_t p_mask) {}
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}
- void light_set_use_gi(RID p_light, bool p_enabled) {}
+ void light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mode) {}
+ void light_set_max_sdfgi_cascade(RID p_light, uint32_t p_cascade) {}
void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {}
@@ -595,7 +615,8 @@ public:
AABB light_get_aabb(RID p_light) const { return AABB(); }
float light_get_param(RID p_light, RS::LightParam p_param) { return 0.0; }
Color light_get_color(RID p_light) { return Color(); }
- bool light_get_use_gi(RID p_light) { return false; }
+ virtual RS::LightBakeMode light_get_bake_mode(RID p_light) { return RS::LIGHT_BAKE_DISABLED; }
+ virtual uint32_t light_get_max_sdfgi_cascade(RID p_light) { return 0; }
uint64_t light_get_version(RID p_light) const { return 0; }
/* PROBE API */
@@ -604,9 +625,9 @@ public:
void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {}
void reflection_probe_set_intensity(RID p_probe, float p_intensity) {}
- void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient) {}
- void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) {}
- void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) {}
+ void reflection_probe_set_ambient_mode(RID p_probe, RS::ReflectionProbeAmbientMode p_mode) {}
+ void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) {}
+ void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) {}
void reflection_probe_set_max_distance(RID p_probe, float p_distance) {}
void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {}
void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {}
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index d2b9405552..4392538737 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -332,17 +332,10 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
if (search_flags & SEARCH_METHODS) {
for (int i = 0; i < class_doc.methods.size(); i++) {
String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower();
- String aux_term = (search_flags & SEARCH_CASE_SENSITIVE) ? term : term.to_lower();
-
- if (aux_term.begins_with(".")) {
- aux_term = aux_term.right(1);
- }
-
- if (aux_term.ends_with("(")) {
- aux_term = aux_term.left(aux_term.length() - 1).strip_edges();
- }
-
- if (aux_term.is_subsequence_of(method_name)) {
+ if (method_name.find(term) > -1 ||
+ (term.begins_with(".") && method_name.begins_with(term.right(1))) ||
+ (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
+ (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i]));
}
}
@@ -448,9 +441,9 @@ bool EditorHelpSearch::Runner::_phase_select_match() {
bool EditorHelpSearch::Runner::_match_string(const String &p_term, const String &p_string) const {
if (search_flags & SEARCH_CASE_SENSITIVE) {
- return p_term.is_subsequence_of(p_string);
+ return p_string.find(p_term) > -1;
} else {
- return p_term.is_subsequence_ofi(p_string);
+ return p_string.findn(p_term) > -1;
}
}
diff --git a/main/main.cpp b/main/main.cpp
index 00760b39b0..0cccccdab3 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2115,7 +2115,6 @@ bool Main::start() {
*/
uint64_t Main::last_ticks = 0;
-uint64_t Main::target_ticks = 0;
uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
@@ -2266,38 +2265,7 @@ bool Main::iteration() {
return exit;
}
- const uint32_t frame_delay = Engine::get_singleton()->get_frame_delay();
- if (frame_delay) {
- // Add fixed frame delay to decrease CPU/GPU usage. This doesn't take
- // the actual frame time into account.
- // Due to the high fluctuation of the actual sleep duration, it's not recommended
- // to use this as a FPS limiter.
- OS::get_singleton()->delay_usec(frame_delay * 1000);
- }
-
- // Add a dynamic frame delay to decrease CPU/GPU usage. This takes the
- // previous frame time into account for a smoother result.
- uint64_t dynamic_delay = 0;
- if (OS::get_singleton()->is_in_low_processor_usage_mode() || !DisplayServer::get_singleton()->window_can_draw()) {
- dynamic_delay = OS::get_singleton()->get_low_processor_usage_mode_sleep_usec();
- }
- const int target_fps = Engine::get_singleton()->get_target_fps();
- if (target_fps > 0 && !Engine::get_singleton()->is_editor_hint()) {
- // Override the low processor usage mode sleep delay if the target FPS is lower.
- dynamic_delay = MAX(dynamic_delay, (uint64_t)(1000000 / target_fps));
- }
-
- if (dynamic_delay > 0) {
- target_ticks += dynamic_delay;
- uint64_t current_ticks = OS::get_singleton()->get_ticks_usec();
-
- if (current_ticks < target_ticks) {
- OS::get_singleton()->delay_usec(target_ticks - current_ticks);
- }
-
- current_ticks = OS::get_singleton()->get_ticks_usec();
- target_ticks = MIN(MAX(target_ticks, current_ticks - dynamic_delay), current_ticks + dynamic_delay);
- }
+ OS::get_singleton()->add_frame_delay(DisplayServer::get_singleton()->window_can_draw());
#ifdef TOOLS_ENABLED
if (auto_build_solutions) {
diff --git a/main/main.h b/main/main.h
index ab6917a65c..308128735c 100644
--- a/main/main.h
+++ b/main/main.h
@@ -38,7 +38,6 @@
class Main {
static void print_help(const char *p_binary);
static uint64_t last_ticks;
- static uint64_t target_ticks;
static uint32_t frames;
static uint32_t frame;
static bool force_redraw_requested;
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index c6897fc684..bacc65c7bf 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -51,7 +51,9 @@ void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
}
void AcceptDialog::_parent_focused() {
- _cancel_pressed();
+ if (!is_exclusive()) {
+ _cancel_pressed();
+ }
}
void AcceptDialog::_notification(int p_what) {
@@ -295,6 +297,7 @@ AcceptDialog::AcceptDialog() {
set_wrap_controls(true);
set_visible(false);
set_transient(true);
+ set_exclusive(true);
bg = memnew(Panel);
add_child(bg);
diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h
index 5d7b6272bf..81664733a3 100644
--- a/scene/gui/dialogs.h
+++ b/scene/gui/dialogs.h
@@ -44,6 +44,7 @@ class LineEdit;
class AcceptDialog : public Window {
GDCLASS(AcceptDialog, Window);
+public:
Window *parent_visible;
Panel *bg;
HBoxContainer *hbc;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index da02f932f1..7f2160c6a5 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -398,6 +398,18 @@ void Window::set_visible(bool p_visible) {
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
RS::get_singleton()->viewport_set_active(get_viewport_rid(), visible);
+
+ //update transient exclusive
+ if (transient_parent) {
+ if (exclusive && visible) {
+ ERR_FAIL_COND_MSG(transient_parent->exclusive_child && transient_parent->exclusive_child != this, "Transient parent has another exclusive child.");
+ transient_parent->exclusive_child = this;
+ } else {
+ if (transient_parent->exclusive_child == this) {
+ transient_parent->exclusive_child = nullptr;
+ }
+ }
+ }
}
void Window::_clear_transient() {