From cce91ce6e09f65a80808d335e983a3006d2387af Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 17 Nov 2021 12:50:25 +0100 Subject: [PATCH 01/31] Mention how to add margins to Button's icon (cherry picked from commit 2341c7bbd93e934647e25428b3656e439ade2b99) --- doc/classes/Button.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index 0ae10b3bcb5..e850f6a32db 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -41,6 +41,7 @@ Button's icon, if text is present the icon will be placed before the text. + To edit margin and spacing of the icon, use [code]hseparation[/code] theme property of [Button] and [code]content_margin_*[/code] properties of the used [StyleBox]es. The button's text that will be displayed inside the button's area. From 0a519fed25413c423ffa2f28f5c138f8b64dc925 Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 17 Nov 2021 17:35:16 +0100 Subject: [PATCH 02/31] Fix TileSet editor workspace breaking (cherry picked from commit f3d5ef6f7b87e5ec2eab8328e949e1a84f873da5) --- editor/plugins/tile_set_editor_plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 17ab99d2887..cab2d9983df 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -3336,9 +3336,10 @@ void TileSetEditor::update_workspace_minsize() { } } - workspace->set_custom_minimum_size(workspace_min_size + WORKSPACE_MARGIN * 2); workspace_container->set_custom_minimum_size(workspace_min_size * workspace->get_scale() + WORKSPACE_MARGIN * 2); workspace_overlay->set_custom_minimum_size(workspace_min_size * workspace->get_scale() + WORKSPACE_MARGIN * 2); + // Make sure workspace size is initialized last (otherwise it might be incorrect). + workspace->call_deferred("set_custom_minimum_size", workspace_min_size + WORKSPACE_MARGIN * 2); } void TileSetEditor::update_edited_region(const Vector2 &end_point) { From e2cf1515601fa1c90178e12c8e88e628fdba6508 Mon Sep 17 00:00:00 2001 From: Will Jordan Date: Tue, 16 Nov 2021 21:10:19 +0100 Subject: [PATCH 03/31] Fix crash on macOS (AS) when dualshock4 is removed (cherry picked from commit 283e31a3e23a2b11ccbb9879b4832abef6ded50f) --- platform/osx/joypad_osx.cpp | 7 +++++-- platform/osx/joypad_osx.h | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 3346c1ce1bb..e48799aa528 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -66,6 +66,7 @@ void joypad::free() { if (ff_device) { FFDeviceReleaseEffect(ff_device, ff_object); FFReleaseDevice(ff_device); + ff_device = nullptr; memfree(ff_axes); memfree(ff_directions); } @@ -250,7 +251,7 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) { if (is_joypad(p_device)) { configure_joypad(p_device, &new_joypad); #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (IOHIDDeviceGetService != NULL) { + if (IOHIDDeviceGetService) { #endif const io_service_t ioservice = IOHIDDeviceGetService(p_device); if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) { @@ -355,6 +356,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { { \ if (ret != FF_OK) { \ FFReleaseDevice(ff_device); \ + ff_device = nullptr; \ return false; \ } \ } @@ -374,6 +376,7 @@ bool joypad::config_force_feedback(io_service_t p_service) { return true; } FFReleaseDevice(ff_device); + ff_device = nullptr; return false; } #undef FF_ERR @@ -608,7 +611,7 @@ JoypadOSX::JoypadOSX() { if (array) { hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - if (hid_manager != NULL) { + if (hid_manager) { config_hid_manager(array); } CFRelease(array); diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index 0ec0bb72ead..cd7d863108d 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -66,14 +66,14 @@ struct joypad { int id = 0; bool offset_hat = false; - io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ + io_service_t ffservice = 0; /* Interface for force feedback, 0 = no ff */ FFCONSTANTFORCE ff_constant_force; - FFDeviceObjectReference ff_device; - FFEffectObjectReference ff_object; - uint64_t ff_timestamp; - LONG *ff_directions; + FFDeviceObjectReference ff_device = nullptr; + FFEffectObjectReference ff_object = nullptr; + uint64_t ff_timestamp = 0; + LONG *ff_directions = nullptr; FFEFFECT ff_effect; - DWORD *ff_axes; + DWORD *ff_axes = nullptr; void add_hid_elements(CFArrayRef p_array); void add_hid_element(IOHIDElementRef p_element); From 100c6d8ccd80697f4fd4374026cd6b6fd5fd9b63 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Thu, 18 Nov 2021 07:42:00 +0000 Subject: [PATCH 04/31] BVH - fix typename compiler warning Some versions of microsoft compiler flag a warning that they want a typename keyword in templates in more places than clang / gcc. (cherry picked from commit 9315b4fb51b86a81358cca843ba2c231d3cf1f0a) --- core/math/bvh_abb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/math/bvh_abb.h b/core/math/bvh_abb.h index bd9a01a87e3..bf1f07fb714 100644 --- a/core/math/bvh_abb.h +++ b/core/math/bvh_abb.h @@ -104,7 +104,7 @@ struct BVH_ABB { return (get_proximity_to(p_a) < get_proximity_to(p_b) ? 0 : 1); } - uint32_t find_cutting_planes(const BVH_ABB::ConvexHull &p_hull, uint32_t *p_plane_ids) const { + uint32_t find_cutting_planes(const typename BVH_ABB::ConvexHull &p_hull, uint32_t *p_plane_ids) const { uint32_t count = 0; for (int n = 0; n < p_hull.num_planes; n++) { From 27f0a9547f26c13007ed842ef609200f6bb27107 Mon Sep 17 00:00:00 2001 From: Giwayume Date: Thu, 18 Nov 2021 10:02:24 -0500 Subject: [PATCH 05/31] Fix texture atlas generation when source sprite is larger than generated atlas (cherry picked from commit 0093bda767a2846bd9c519be4c3cedbf02d7a1ad) --- editor/import/resource_importer_texture_atlas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 2a7534aba44..a7e1986b3f4 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -131,7 +131,7 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr int max_y = MIN(y[2], height - p_offset.y - 1); for (int yi = y[0]; yi < max_y; yi++) { if (yi >= 0) { - for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt < width ? xt : width - 1); xi++) { + for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt < src_width ? xt : src_width - 1); xi++) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1); @@ -153,7 +153,7 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr p_image->set_pixel(px, py, color); } - for (int xi = (xf < width ? int(xf) : width - 1); xi >= (xt > 0 ? xt : 0); xi--) { + for (int xi = (xf < src_width ? int(xf) : src_width - 1); xi >= (xt > 0 ? xt : 0); xi--) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1); From fd558de9723c3e10dc398874056fdaf4446f9840 Mon Sep 17 00:00:00 2001 From: Giwayume Date: Mon, 22 Nov 2021 11:10:39 -0500 Subject: [PATCH 06/31] Fix edge case where 1px cut off from right of image Backward loop should remain -1 (cherry picked from commit 88c1411051462846e15fdd8ed29da59564c11432) --- editor/import/resource_importer_texture_atlas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index a7e1986b3f4..115aab70cba 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -131,7 +131,7 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr int max_y = MIN(y[2], height - p_offset.y - 1); for (int yi = y[0]; yi < max_y; yi++) { if (yi >= 0) { - for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt < src_width ? xt : src_width - 1); xi++) { + for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt <= src_width ? xt : src_width); xi++) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1); From 5eb644fab513b5272e8dc124cea3d40c4bc40bd2 Mon Sep 17 00:00:00 2001 From: David Sichma Date: Thu, 18 Nov 2021 19:29:17 +0100 Subject: [PATCH 07/31] Fixed pre-commit-black file extensions Now hook can find .py files. (cherry picked from commit 3fe10c7e9d5578e289ac11b1535b601d8ed3f86a) --- misc/hooks/pre-commit-black | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black index 76d97294da5..8e22e6068e7 100755 --- a/misc/hooks/pre-commit-black +++ b/misc/hooks/pre-commit-black @@ -14,7 +14,7 @@ DELETE_OLD_PATCHES=false # File types to parse. FILE_NAMES="SConstruct SCsub" -FILE_EXTS="py" +FILE_EXTS=".py" # Use pygmentize instead of cat to parse diff with highlighting. # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) From 1698dbe30e1c7e6dc6679a9c81afeae9e4a8e8b9 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Wed, 17 Nov 2021 06:33:45 +0000 Subject: [PATCH 08/31] BVH - detect shrinkage within expanded bounds Although the expanded bounds were working in normal use, for moving and growing objects, there was one case which was not dealt with properly - significant shrinkage of exact bounds within an expanded bound. This PR detects significant shrinkage and forces a new expanded bound to be created. (cherry picked from commit ed4757026609e0dd20f213878dae55e7d738faaf) --- core/math/bvh.h | 53 ++++++++++++++++--------------- core/math/bvh_abb.h | 50 +++++++++++++++--------------- core/math/bvh_cull.inc | 2 +- core/math/bvh_debug.inc | 4 +-- core/math/bvh_pair.inc | 4 +-- core/math/bvh_public.inc | 65 ++++++++++++++++++++++++++++++++++++--- core/math/bvh_split.inc | 18 +++++------ core/math/bvh_structs.inc | 16 ++++++---- core/math/bvh_tree.h | 11 +++++-- 9 files changed, 146 insertions(+), 77 deletions(-) diff --git a/core/math/bvh.h b/core/math/bvh.h index 3f64425def9..8d0134f78ba 100644 --- a/core/math/bvh.h +++ b/core/math/bvh.h @@ -49,10 +49,10 @@ #include "bvh_tree.h" #include "core/os/mutex.h" -#define BVHTREE_CLASS BVH_Tree +#define BVHTREE_CLASS BVH_Tree #define BVH_LOCKED_FUNCTION BVHLockedFunction(&_mutex, BVH_THREAD_SAFE &&_thread_safe); -template +template class BVH_Manager { public: // note we are using uint32_t instead of BVHHandle, losing type safety, but this @@ -80,12 +80,7 @@ public: void params_set_pairing_expansion(real_t p_value) { BVH_LOCKED_FUNCTION - if (p_value >= 0.0) { - tree._pairing_expansion = p_value; - tree._auto_pairing_expansion = false; - } else { - tree._auto_pairing_expansion = true; - } + tree.params_set_pairing_expansion(p_value); } void set_pair_callback(PairCallback p_callback, void *p_userdata) { @@ -104,7 +99,7 @@ public: check_pair_callback_userdata = p_userdata; } - BVHHandle create(T *p_userdata, bool p_active, const Bounds &p_aabb = Bounds(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t p_pairable_mask = 1) { + BVHHandle create(T *p_userdata, bool p_active, const BOUNDS &p_aabb = BOUNDS(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t p_pairable_mask = 1) { BVH_LOCKED_FUNCTION // not sure if absolutely necessary to flush collisions here. It will cost performance to, instead @@ -125,7 +120,7 @@ public: if (USE_PAIRS) { // for safety initialize the expanded AABB - Bounds &expanded_aabb = tree._pairs[h.id()].expanded_aabb; + BOUNDS &expanded_aabb = tree._pairs[h.id()].expanded_aabb; expanded_aabb = p_aabb; expanded_aabb.grow_by(tree._pairing_expansion); @@ -142,7 +137,7 @@ public: //////////////////////////////////////////////////// // wrapper versions that use uint32_t instead of handle // for backward compatibility. Less type safe - void move(uint32_t p_handle, const Bounds &p_aabb) { + void move(uint32_t p_handle, const BOUNDS &p_aabb) { BVHHandle h; h.set(p_handle); move(h, p_aabb); @@ -166,7 +161,7 @@ public: force_collision_check(h); } - bool activate(uint32_t p_handle, const Bounds &p_aabb, bool p_delay_collision_check = false) { + bool activate(uint32_t p_handle, const BOUNDS &p_aabb, bool p_delay_collision_check = false) { BVHHandle h; h.set(p_handle); return activate(h, p_aabb, p_delay_collision_check); @@ -203,7 +198,7 @@ public: //////////////////////////////////////////////////// - void move(BVHHandle p_handle, const Bounds &p_aabb) { + void move(BVHHandle p_handle, const BOUNDS &p_aabb) { BVH_LOCKED_FUNCTION if (tree.item_move(p_handle, p_aabb)) { if (USE_PAIRS) { @@ -239,7 +234,7 @@ public: BVH_LOCKED_FUNCTION if (USE_PAIRS) { // the aabb should already be up to date in the BVH - Bounds aabb; + BOUNDS aabb; item_get_AABB(p_handle, aabb); // add it as changed even if aabb not different @@ -253,7 +248,7 @@ public: // these should be read as set_visible for render trees, // but generically this makes items add or remove from the // tree internally, to speed things up by ignoring inactive items - bool activate(BVHHandle p_handle, const Bounds &p_aabb, bool p_delay_collision_check = false) { + bool activate(BVHHandle p_handle, const BOUNDS &p_aabb, bool p_delay_collision_check = false) { BVH_LOCKED_FUNCTION // sending the aabb here prevents the need for the BVH to maintain // a redundant copy of the aabb. @@ -331,7 +326,7 @@ public: // when the pairable state changes, we need to force a collision check because newly pairable // items may be in collision, and unpairable items might move out of collision. // We cannot depend on waiting for the next update, because that may come much later. - Bounds aabb; + BOUNDS aabb; item_get_AABB(p_handle, aabb); // passing false disables the optimization which prevents collision checks if @@ -348,7 +343,7 @@ public: } // cull tests - int cull_aabb(const Bounds &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { + int cull_aabb(const BOUNDS &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { BVH_LOCKED_FUNCTION typename BVHTREE_CLASS::CullParams params; @@ -366,7 +361,7 @@ public: return params.result_count_overall; } - int cull_segment(const Point &p_from, const Point &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { + int cull_segment(const POINT &p_from, const POINT &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { BVH_LOCKED_FUNCTION typename BVHTREE_CLASS::CullParams params; @@ -385,7 +380,7 @@ public: return params.result_count_overall; } - int cull_point(const Point &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { + int cull_point(const POINT &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF) { BVH_LOCKED_FUNCTION typename BVHTREE_CLASS::CullParams params; @@ -439,7 +434,7 @@ private: return; } - Bounds bb; + BOUNDS bb; typename BVHTREE_CLASS::CullParams params; @@ -454,7 +449,7 @@ private: const BVHHandle &h = changed_items[n]; // use the expanded aabb for pairing - const Bounds &expanded_aabb = tree._pairs[h.id()].expanded_aabb; + const BOUNDS &expanded_aabb = tree._pairs[h.id()].expanded_aabb; BVHABB_CLASS abb; abb.from(expanded_aabb); @@ -501,7 +496,7 @@ private: } public: - void item_get_AABB(BVHHandle p_handle, Bounds &r_aabb) { + void item_get_AABB(BVHHandle p_handle, BOUNDS &r_aabb) { BVHABB_CLASS abb; tree.item_get_ABB(p_handle, abb); abb.to(r_aabb); @@ -530,6 +525,10 @@ private: void *ud_from = pairs_from.remove_pair_to(p_to); pairs_to.remove_pair_to(p_from); +#ifdef BVH_VERBOSE_PAIRING + print_line("_unpair " + itos(p_from.id()) + " from " + itos(p_to.id())); +#endif + // callback if (unpair_callback) { unpair_callback(pair_callback_userdata, p_from, exa.userdata, exa.subindex, p_to, exb.userdata, exb.subindex, ud_from); @@ -637,6 +636,10 @@ private: // callback void *callback_userdata = nullptr; +#ifdef BVH_VERBOSE_PAIRING + print_line("_pair " + itos(p_ha.id()) + " to " + itos(p_hb.id())); +#endif + if (pair_callback) { callback_userdata = pair_callback(pair_callback_userdata, p_ha, exa.userdata, exa.subindex, p_hb, exb.userdata, exb.subindex); } @@ -697,19 +700,19 @@ private: _tick++; } - void _add_changed_item(BVHHandle p_handle, const Bounds &aabb, bool p_check_aabb = true) { + void _add_changed_item(BVHHandle p_handle, const BOUNDS &aabb, bool p_check_aabb = true) { // Note that non pairable items can pair with pairable, // so all types must be added to the list // aabb check with expanded aabb. This greatly decreases processing // at the cost of slightly less accurate pairing checks // Note this pairing AABB is separate from the AABB in the actual tree - Bounds &expanded_aabb = tree._pairs[p_handle.id()].expanded_aabb; + BOUNDS &expanded_aabb = tree._pairs[p_handle.id()].expanded_aabb; // passing p_check_aabb false disables the optimization which prevents collision checks if // the aabb hasn't changed. This is needed where set_pairable has been called, but the position // has not changed. - if (p_check_aabb && expanded_aabb.encloses(aabb)) { + if (p_check_aabb && tree.expanded_aabb_encloses_not_shrink(expanded_aabb, aabb)) { return; } diff --git a/core/math/bvh_abb.h b/core/math/bvh_abb.h index bf1f07fb714..ef39aaa0093 100644 --- a/core/math/bvh_abb.h +++ b/core/math/bvh_abb.h @@ -32,7 +32,7 @@ #define BVH_ABB_H // special optimized version of axis aligned bounding box -template +template struct BVH_ABB { struct ConvexHull { // convex hulls (optional) @@ -43,8 +43,8 @@ struct BVH_ABB { }; struct Segment { - Point from; - Point to; + POINT from; + POINT to; }; enum IntersectResult { @@ -54,47 +54,47 @@ struct BVH_ABB { }; // we store mins with a negative value in order to test them with SIMD - Point min; - Point neg_max; + POINT min; + POINT neg_max; bool operator==(const BVH_ABB &o) const { return (min == o.min) && (neg_max == o.neg_max); } bool operator!=(const BVH_ABB &o) const { return (*this == o) == false; } - void set(const Point &_min, const Point &_max) { + void set(const POINT &_min, const POINT &_max) { min = _min; neg_max = -_max; } // to and from standard AABB - void from(const Bounds &p_aabb) { + void from(const BOUNDS &p_aabb) { min = p_aabb.position; neg_max = -(p_aabb.position + p_aabb.size); } - void to(Bounds &r_aabb) const { + void to(BOUNDS &r_aabb) const { r_aabb.position = min; r_aabb.size = calculate_size(); } void merge(const BVH_ABB &p_o) { - for (int axis = 0; axis < Point::AXIS_COUNT; ++axis) { + for (int axis = 0; axis < POINT::AXIS_COUNT; ++axis) { neg_max[axis] = MIN(neg_max[axis], p_o.neg_max[axis]); min[axis] = MIN(min[axis], p_o.min[axis]); } } - Point calculate_size() const { + POINT calculate_size() const { return -neg_max - min; } - Point calculate_centre() const { - return Point((calculate_size() * 0.5) + min); + POINT calculate_centre() const { + return POINT((calculate_size() * 0.5) + min); } real_t get_proximity_to(const BVH_ABB &p_b) const { - const Point d = (min - neg_max) - (p_b.min - p_b.neg_max); + const POINT d = (min - neg_max) - (p_b.min - p_b.neg_max); real_t proximity = 0.0; - for (int axis = 0; axis < Point::AXIS_COUNT; ++axis) { + for (int axis = 0; axis < POINT::AXIS_COUNT; ++axis) { proximity += Math::abs(d[axis]); } return proximity; @@ -162,7 +162,7 @@ struct BVH_ABB { } bool intersects_convex_partial(const ConvexHull &p_hull) const { - Bounds bb; + BOUNDS bb; to(bb); return bb.intersects_convex_shape(p_hull.planes, p_hull.num_planes, p_hull.points, p_hull.num_points); } @@ -182,7 +182,7 @@ struct BVH_ABB { bool is_within_convex(const ConvexHull &p_hull) const { // use half extents routine - Bounds bb; + BOUNDS bb; to(bb); return bb.inside_convex_shape(p_hull.planes, p_hull.num_planes); } @@ -197,12 +197,12 @@ struct BVH_ABB { } bool intersects_segment(const Segment &p_s) const { - Bounds bb; + BOUNDS bb; to(bb); return bb.intersects_segment(p_s.from, p_s.to); } - bool intersects_point(const Point &p_pt) const { + bool intersects_point(const POINT &p_pt) const { if (_any_lessthan(-p_pt, neg_max)) { return false; } @@ -232,20 +232,20 @@ struct BVH_ABB { return true; } - void grow(const Point &p_change) { + void grow(const POINT &p_change) { neg_max -= p_change; min -= p_change; } void expand(real_t p_change) { - Point change; + POINT change; change.set_all(p_change); grow(change); } // Actually surface area metric. float get_area() const { - Point d = calculate_size(); + POINT d = calculate_size(); return 2.0f * (d.x * d.y + d.y * d.z + d.z * d.x); } @@ -254,8 +254,8 @@ struct BVH_ABB { min = neg_max; } - bool _any_morethan(const Point &p_a, const Point &p_b) const { - for (int axis = 0; axis < Point::AXIS_COUNT; ++axis) { + bool _any_morethan(const POINT &p_a, const POINT &p_b) const { + for (int axis = 0; axis < POINT::AXIS_COUNT; ++axis) { if (p_a[axis] > p_b[axis]) { return true; } @@ -263,8 +263,8 @@ struct BVH_ABB { return false; } - bool _any_lessthan(const Point &p_a, const Point &p_b) const { - for (int axis = 0; axis < Point::AXIS_COUNT; ++axis) { + bool _any_lessthan(const POINT &p_a, const POINT &p_b) const { + for (int axis = 0; axis < POINT::AXIS_COUNT; ++axis) { if (p_a[axis] < p_b[axis]) { return true; } diff --git a/core/math/bvh_cull.inc b/core/math/bvh_cull.inc index d7edc8a8843..38b6fc026f9 100644 --- a/core/math/bvh_cull.inc +++ b/core/math/bvh_cull.inc @@ -14,7 +14,7 @@ struct CullParams { uint32_t pairable_type; // optional components for different tests - Point point; + POINT point; BVHABB_CLASS abb; typename BVHABB_CLASS::ConvexHull hull; typename BVHABB_CLASS::Segment segment; diff --git a/core/math/bvh_debug.inc b/core/math/bvh_debug.inc index 55db794ee35..ea31a154a34 100644 --- a/core/math/bvh_debug.inc +++ b/core/math/bvh_debug.inc @@ -6,12 +6,12 @@ void _debug_recursive_print_tree(int p_tree_id) const { } String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const { - Point size = aabb.calculate_size(); + POINT size = aabb.calculate_size(); String sz; float vol = 0.0; - for (int i = 0; i < Point::AXES_COUNT; ++i) { + for (int i = 0; i < POINT::AXIS_COUNT; ++i) { sz += "("; sz += itos(aabb.min[i]); sz += " ~ "; diff --git a/core/math/bvh_pair.inc b/core/math/bvh_pair.inc index 839db59a3aa..7175edbfe16 100644 --- a/core/math/bvh_pair.inc +++ b/core/math/bvh_pair.inc @@ -14,10 +14,10 @@ struct ItemPairs { void clear() { num_pairs = 0; extended_pairs.reset(); - expanded_aabb = Bounds(); + expanded_aabb = BOUNDS(); } - Bounds expanded_aabb; + BOUNDS expanded_aabb; // maybe we can just use the number in the vector TODO int32_t num_pairs; diff --git a/core/math/bvh_public.inc b/core/math/bvh_public.inc index 2c1e4067126..6a8ecb05555 100644 --- a/core/math/bvh_public.inc +++ b/core/math/bvh_public.inc @@ -1,5 +1,5 @@ public: -BVHHandle item_add(T *p_userdata, bool p_active, const Bounds &p_aabb, int32_t p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask, bool p_invisible = false) { +BVHHandle item_add(T *p_userdata, bool p_active, const BOUNDS &p_aabb, int32_t p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask, bool p_invisible = false) { #ifdef BVH_VERBOSE_TREE VERBOSE_PRINT("\nitem_add BEFORE"); _debug_recursive_print_tree(0); @@ -103,7 +103,7 @@ void _debug_print_refs() { } // returns false if noop -bool item_move(BVHHandle p_handle, const Bounds &p_aabb) { +bool item_move(BVHHandle p_handle, const BOUNDS &p_aabb) { uint32_t ref_id = p_handle.id(); // get the reference @@ -118,7 +118,7 @@ bool item_move(BVHHandle p_handle, const Bounds &p_aabb) { BVH_ASSERT(ref.tnode_id != BVHCommon::INVALID); TNode &tnode = _nodes[ref.tnode_id]; - // does it fit within the current aabb? + // does it fit within the current leaf aabb? if (tnode.aabb.is_other_within(abb)) { // do nothing .. fast path .. not moved enough to need refit @@ -133,12 +133,20 @@ bool item_move(BVHHandle p_handle, const Bounds &p_aabb) { return false; } +#ifdef BVH_VERBOSE_MOVES + print_line("item_move " + itos(p_handle.id()) + "(within tnode aabb) : " + _debug_aabb_to_string(abb)); +#endif + leaf_abb = abb; _integrity_check_all(); return true; } +#ifdef BVH_VERBOSE_MOVES + print_line("item_move " + itos(p_handle.id()) + "(outside tnode aabb) : " + _debug_aabb_to_string(abb)); +#endif + uint32_t tree_id = _handle_get_tree_id(p_handle); // remove and reinsert @@ -206,7 +214,7 @@ void item_remove(BVHHandle p_handle) { } // returns success -bool item_activate(BVHHandle p_handle, const Bounds &p_aabb) { +bool item_activate(BVHHandle p_handle, const BOUNDS &p_aabb) { uint32_t ref_id = p_handle.id(); ItemRef &ref = _refs[ref_id]; if (ref.is_active()) { @@ -403,7 +411,7 @@ void update() { // if there are no nodes, do nothing, but if there are... if (bound_valid) { - Bounds bb; + BOUNDS bb; world_bound.to(bb); real_t size = bb.get_longest_axis_size(); @@ -421,3 +429,50 @@ void update() { } #endif } + +void params_set_pairing_expansion(real_t p_value) { + if (p_value < 0.0) { +#ifdef BVH_ALLOW_AUTO_EXPANSION + _auto_pairing_expansion = true; +#endif + return; + } +#ifdef BVH_ALLOW_AUTO_EXPANSION + _auto_pairing_expansion = false; +#endif + + _pairing_expansion = p_value; + + // calculate shrinking threshold + const real_t fudge_factor = 1.1; + _aabb_shrinkage_threshold = _pairing_expansion * POINT::AXIS_COUNT * 2.0 * fudge_factor; +} + +// This routine is not just an enclose check, it also checks for special case of shrinkage +bool expanded_aabb_encloses_not_shrink(const BOUNDS &p_expanded_aabb, const BOUNDS &p_aabb) const { + if (!p_expanded_aabb.encloses(p_aabb)) { + return false; + } + + // Check for special case of shrinkage. If the aabb has shrunk + // significantly we want to create a new expanded bound, because + // the previous expanded bound will have diverged significantly. + const POINT &exp_size = p_expanded_aabb.size; + const POINT &new_size = p_aabb.size; + + real_t exp_l = 0.0; + real_t new_l = 0.0; + + for (int i = 0; i < POINT::AXIS_COUNT; ++i) { + exp_l += exp_size[i]; + new_l += new_size[i]; + } + + // is difference above some metric + real_t diff = exp_l - new_l; + if (diff < _aabb_shrinkage_threshold) { + return true; + } + + return false; +} diff --git a/core/math/bvh_split.inc b/core/math/bvh_split.inc index 72c37abe0ec..c77b525b14a 100644 --- a/core/math/bvh_split.inc +++ b/core/math/bvh_split.inc @@ -25,16 +25,16 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u return; } - Point centre = full_bound.calculate_centre(); - Point size = full_bound.calculate_size(); + POINT centre = full_bound.calculate_centre(); + POINT size = full_bound.calculate_size(); - int order[Point::AXIS_COUNT]; + int order[POINT::AXIS_COUNT]; order[0] = size.min_axis(); - order[Point::AXIS_COUNT - 1] = size.max_axis(); + order[POINT::AXIS_COUNT - 1] = size.max_axis(); - static_assert(Point::AXIS_COUNT <= 3, "BVH Point::AXIS_COUNT has unexpected size"); - if (Point::AXIS_COUNT == 3) { + static_assert(POINT::AXIS_COUNT <= 3, "BVH POINT::AXIS_COUNT has unexpected size"); + if (POINT::AXIS_COUNT == 3) { order[1] = 3 - (order[0] + order[2]); } @@ -58,7 +58,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u // detect when split on longest axis failed int min_threshold = MAX_ITEMS / 4; - int min_group_size[Point::AXIS_COUNT]; + int min_group_size[POINT::AXIS_COUNT]; min_group_size[0] = MIN(num_a, num_b); if (min_group_size[0] < min_threshold) { // slow but sure .. first move everything back into a @@ -68,7 +68,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u num_b = 0; // now calculate the best split - for (int axis = 1; axis < Point::AXIS_COUNT; axis++) { + for (int axis = 1; axis < POINT::AXIS_COUNT; axis++) { split_axis = order[axis]; int count = 0; @@ -86,7 +86,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u // best axis int best_axis = 0; int best_min = min_group_size[0]; - for (int axis = 1; axis < Point::AXIS_COUNT; axis++) { + for (int axis = 1; axis < POINT::AXIS_COUNT; axis++) { if (min_group_size[axis] > best_min) { best_min = min_group_size[axis]; best_axis = axis; diff --git a/core/math/bvh_structs.inc b/core/math/bvh_structs.inc index 1d1e0e64680..f6f28ab71c8 100644 --- a/core/math/bvh_structs.inc +++ b/core/math/bvh_structs.inc @@ -29,12 +29,6 @@ struct ItemExtra { T *userdata; }; -// this is an item OR a child node depending on whether a leaf node -struct Item { - BVHABB_CLASS aabb; - uint32_t item_ref_id; -}; - // tree leaf struct TLeaf { uint16_t num_items; @@ -177,4 +171,14 @@ bool _auto_node_expansion = true; // larger values gives more 'sticky' pairing, and is less likely to exhibit tunneling // we can either use auto mode, where the expansion is based on the root node size, or specify manually real_t _pairing_expansion = 0.1; + +#ifdef BVH_ALLOW_AUTO_EXPANSION bool _auto_pairing_expansion = true; +#endif + +// when using an expanded bound, we must detect the condition where a new AABB +// is significantly smaller than the expanded bound, as this is a special case where we +// should override the optimization and create a new expanded bound. +// This threshold is derived from the _pairing_expansion, and should be recalculated +// if _pairing_expansion is changed. +real_t _aabb_shrinkage_threshold = 0.0; diff --git a/core/math/bvh_tree.h b/core/math/bvh_tree.h index c10848c2411..8acf076cc4f 100644 --- a/core/math/bvh_tree.h +++ b/core/math/bvh_tree.h @@ -48,12 +48,14 @@ #include "core/print_string.h" #include -#define BVHABB_CLASS BVH_ABB +#define BVHABB_CLASS BVH_ABB // never do these checks in release #if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED) //#define BVH_VERBOSE //#define BVH_VERBOSE_TREE +//#define BVH_VERBOSE_PAIRING +//#define BVH_VERBOSE_MOVES //#define BVH_VERBOSE_FRAME //#define BVH_CHECKS @@ -148,7 +150,7 @@ public: } }; -template +template class BVH_Tree { friend class BVH; @@ -165,6 +167,11 @@ public: // (as these ids are stored as negative numbers in the node) uint32_t dummy_leaf_id; _leaves.request(dummy_leaf_id); + + // In many cases you may want to change this default in the client code, + // or expose this value to the user. + // This default may make sense for a typically scaled 3d game, but maybe not for 2d on a pixel scale. + params_set_pairing_expansion(0.1); } private: From d70461b27e8a54eadc9da537c2fa10bcaf415332 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 19 Nov 2021 03:46:04 +0100 Subject: [PATCH 09/31] [HTML5] Fix input not focusing canvas. mousedown and touchstart should focus the canvas to ensure correct application lifecycle. (cherry picked from commit f13c7fc83e767da72accea125482fa130fb52cd3) --- platform/javascript/js/libs/library_godot_input.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/javascript/js/libs/library_godot_input.js b/platform/javascript/js/libs/library_godot_input.js index 587c320f355..5c7400d5994 100644 --- a/platform/javascript/js/libs/library_godot_input.js +++ b/platform/javascript/js/libs/library_godot_input.js @@ -389,6 +389,9 @@ const GodotInput = { const rect = canvas.getBoundingClientRect(); const pos = GodotInput.computePosition(evt, rect); const modifiers = GodotInput.getModifiers(evt); + if (p_pressed && document.activeElement !== GodotConfig.canvas) { + GodotConfig.canvas.focus(); + } if (func(p_pressed, evt.button, pos[0], pos[1], modifiers)) { evt.preventDefault(); } @@ -405,6 +408,9 @@ const GodotInput = { const func = GodotRuntime.get_func(callback); const canvas = GodotConfig.canvas; function touch_cb(type, evt) { + if (type === 0 && document.activeElement !== GodotConfig.canvas) { + GodotConfig.canvas.focus(); + } const rect = canvas.getBoundingClientRect(); const touches = evt.changedTouches; for (let i = 0; i < touches.length; i++) { From 2a4efa3bcd1a757b48692c8f1560c186d12d05b4 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 19 Nov 2021 02:53:23 +0100 Subject: [PATCH 10/31] [HTML5] Add checks to Gamepad API events. In some conditions the events might be generated even when the `gamepad` object is not accessible due to Security Context requirements. This commit adds a check to avoid firing the handler in those cases. (cherry picked from commit 91dbc288ccd7cab7d50feccba82ebfb99b5f2b69) --- platform/javascript/js/libs/library_godot_input.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/javascript/js/libs/library_godot_input.js b/platform/javascript/js/libs/library_godot_input.js index 5c7400d5994..d85d0d5335b 100644 --- a/platform/javascript/js/libs/library_godot_input.js +++ b/platform/javascript/js/libs/library_godot_input.js @@ -104,10 +104,14 @@ const GodotInputGamepads = { } } GodotEventListeners.add(window, 'gamepadconnected', function (evt) { - add(evt.gamepad); + if (evt.gamepad) { + add(evt.gamepad); + } }, false); GodotEventListeners.add(window, 'gamepaddisconnected', function (evt) { - onchange(evt.gamepad.index, 0); + if (evt.gamepad) { + onchange(evt.gamepad.index, 0); + } }, false); }, From 9d6e01a5a311ee4c898898a539628a3c22a1fb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 19 Nov 2021 18:45:10 +0100 Subject: [PATCH 11/31] certs: Sync with Mozilla bundle as of Nov 1, 2021 https://github.com/bagder/ca-bundle/commit/edd798d35abc8cc32519b08b3d8485780bb0fd20 (cherry picked from commit 07f8996b1c8b030e4090d31f2aa4d31aff06e5db) --- thirdparty/certs/ca-certificates.crt | 159 ++++++++++++++++++++------- 1 file changed, 118 insertions(+), 41 deletions(-) diff --git a/thirdparty/certs/ca-certificates.crt b/thirdparty/certs/ca-certificates.crt index 7d5ea3bef13..7f89e81d011 100644 --- a/thirdparty/certs/ca-certificates.crt +++ b/thirdparty/certs/ca-certificates.crt @@ -1,7 +1,7 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla as of: Mon Jul 5 21:36:52 2021 GMT +## Certificate data from Mozilla as of: Mon Nov 1 15:39:58 2021 GMT ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates @@ -14,7 +14,7 @@ ## Just configure this file as the SSLCACertificateFile. ## ## Conversion done with mk-ca-bundle.pl version 1.28. -## SHA256: c8f6733d1ff4e6a4769c182971a1234f95ae079247a9c439a13423fe8ba5c24f +## SHA256: bb36818a81feaa4cca61101e6d6276cd09e972efcb08112dfed846918ca41d7f ## @@ -381,26 +381,6 @@ mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K -----END CERTIFICATE----- -DST Root CA X3 -============== ------BEGIN CERTIFICATE----- -MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK -ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X -DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1 -cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT -rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9 -UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy -xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d -utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ -MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug -dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE -GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw -RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS -fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ ------END CERTIFICATE----- - SwissSign Gold CA - G2 ====================== -----BEGIN CERTIFICATE----- @@ -2713,7 +2693,8 @@ CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7 jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj -----END CERTIFICATE----- -# emSign Root CA - C1 +emSign Root CA - C1 +=================== -----BEGIN CERTIFICATE----- MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp @@ -2733,7 +2714,8 @@ wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI= -----END CERTIFICATE----- -# emSign ECC Root CA - C3 +emSign ECC Root CA - C3 +======================= -----BEGIN CERTIFICATE----- MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF @@ -2747,7 +2729,8 @@ MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== -----END CERTIFICATE----- -# Hongkong Post Root CA 3 +Hongkong Post Root CA 3 +======================= -----BEGIN CERTIFICATE----- MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK @@ -2778,7 +2761,8 @@ hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB dBb9HxEGmpv0 -----END CERTIFICATE----- -# Entrust Root Certification Authority - G4 +Entrust Root Certification Authority - G4 +========================================= -----BEGIN CERTIFICATE----- MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu @@ -2811,7 +2795,8 @@ JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G kcpG2om3PVODLAgfi49T3f+sHw== -----END CERTIFICATE----- -# Microsoft ECC Root Certificate Authority 2017 +Microsoft ECC Root Certificate Authority 2017 +============================================= -----BEGIN CERTIFICATE----- MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND @@ -2826,7 +2811,8 @@ Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= -----END CERTIFICATE----- -# Microsoft RSA Root Certificate Authority 2017 +Microsoft RSA Root Certificate Authority 2017 +============================================= -----BEGIN CERTIFICATE----- MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg @@ -2856,7 +2842,8 @@ c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E -----END CERTIFICATE----- -# e-Szigno Root CA 2017 +e-Szigno Root CA 2017 +===================== -----BEGIN CERTIFICATE----- MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt @@ -2871,7 +2858,8 @@ tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO svxyqltZ+efcMQ== -----END CERTIFICATE----- -# certSIGN Root CA G2 +certSIGN Root CA G2 +=================== -----BEGIN CERTIFICATE----- MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy @@ -2899,7 +2887,8 @@ NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc= -----END CERTIFICATE----- -# Trustwave Global Certification Authority +Trustwave Global Certification Authority +======================================== -----BEGIN CERTIFICATE----- MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2 @@ -2930,7 +2919,8 @@ Yj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu 29FpHOTKyeC2nOnOcXHebD8WpHk= -----END CERTIFICATE----- -# Trustwave Global ECC P256 Certification Authority +Trustwave Global ECC P256 Certification Authority +================================================= -----BEGIN CERTIFICATE----- MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJVUzER MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI @@ -2945,7 +2935,8 @@ P62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt RM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 -----END CERTIFICATE----- -# Trustwave Global ECC P384 Certification Authority +Trustwave Global ECC P384 Certification Authority +================================================= -----BEGIN CERTIFICATE----- MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQGEwJVUzER MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI @@ -2961,7 +2952,8 @@ ADBkAjA3AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsCMGcl CrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVuSw== -----END CERTIFICATE----- -# NAVER Global Root Certification Authority +NAVER Global Root Certification Authority +========================================= -----BEGIN CERTIFICATE----- MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEMBQAwaTELMAkG A1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRGT1JNIENvcnAuMTIwMAYDVQQD @@ -2991,7 +2983,8 @@ I/hGoiLtk/bdmuYqh7GYVPEi92tF4+KOdh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmg kpzNNIaRkPpkUZ3+/uul9XXeifdy -----END CERTIFICATE----- -# AC RAIZ FNMT-RCM SERVIDORES SEGUROS +AC RAIZ FNMT-RCM SERVIDORES SEGUROS +=================================== -----BEGIN CERTIFICATE----- MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQswCQYDVQQGEwJF UzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgwFgYDVQRhDA9WQVRFUy1RMjgy @@ -3006,7 +2999,8 @@ SM49BAMDA2kAMGYCMQCuSuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoD zBOQn5ICMQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJyv+c= -----END CERTIFICATE----- -# GlobalSign Root R46 +GlobalSign Root R46 +=================== -----BEGIN CERTIFICATE----- MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUAMEYxCzAJBgNV BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJv @@ -3035,7 +3029,8 @@ DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3vouXsXgxT7PntgMTzlSdriVZzH81Xwj3 QEUxeCp6 -----END CERTIFICATE----- -# GlobalSign Root E46 +GlobalSign Root E46 +=================== -----BEGIN CERTIFICATE----- MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJvb3Qg @@ -3049,7 +3044,8 @@ vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+ CAezNIm8BZ/3Hobui3A= -----END CERTIFICATE----- -# GLOBALTRUST 2020 +GLOBALTRUST 2020 +================ -----BEGIN CERTIFICATE----- MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT @@ -3078,7 +3074,8 @@ YqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+IaFvowdlxfv1k7/9nR4hYJS8+hge9+6jl gqispdNpQ80xiEmEU5LAsTkbOYMBMMTyqfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg== -----END CERTIFICATE----- -# ANF Secure Server Root CA +ANF Secure Server Root CA +========================= -----BEGIN CERTIFICATE----- MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNVBAUTCUc2MzI4 NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lv @@ -3109,7 +3106,8 @@ g77FGr8H6lnco4g175x2MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3 r5+qPeoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= -----END CERTIFICATE----- -# Certum EC-384 CA +Certum EC-384 CA +================ -----BEGIN CERTIFICATE----- MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy @@ -3124,7 +3122,8 @@ ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0 QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= -----END CERTIFICATE----- -# Certum Trusted Root CA +Certum Trusted Root CA +====================== -----BEGIN CERTIFICATE----- MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG EwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0g @@ -3153,3 +3152,81 @@ WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb -----END CERTIFICATE----- + +TunTrust Root CA +================ +-----BEGIN CERTIFICATE----- +MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQELBQAwYTELMAkG +A1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUgQ2VydGlmaWNhdGlvbiBFbGVj +dHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJvb3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQw +NDI2MDg1NzU2WjBhMQswCQYDVQQGEwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBD +ZXJ0aWZpY2F0aW9uIEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZn56eY+hz +2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd2JQDoOw05TDENX37Jk0b +bjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgFVwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7 +NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZGoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAd +gjH8KcwAWJeRTIAAHDOFli/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViW +VSHbhlnUr8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2eY8f +Tpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIbMlEsPvLfe/ZdeikZ +juXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISgjwBUFfyRbVinljvrS5YnzWuioYas +DXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwS +VXAkPcvCFDVDXSdOvsC9qnyW5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI +04Y+oXNZtPdEITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 +90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+zxiD2BkewhpMl +0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYuQEkHDVneixCwSQXi/5E/S7fd +Ao74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRY +YdZ2vyJ/0Adqp2RT8JeNnYA/u8EH22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJp +adbGNjHh/PqAulxPxOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65x +xBzndFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5Xc0yGYuP +jCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7bnV2UqL1g52KAdoGDDIzM +MEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQCvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9z +ZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZHu/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3r +AZ3r2OvEhJn7wAzMMujjd9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= +-----END CERTIFICATE----- + +HARICA TLS RSA Root CA 2021 +=========================== +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQG +EwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u +cyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0EgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUz +OFoXDTQ1MDIxMzEwNTUzN1owbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRl +bWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNB +IFJvb3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569lmwVnlskN +JLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE4VGC/6zStGndLuwRo0Xu +a2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uva9of08WRiFukiZLRgeaMOVig1mlDqa2Y +Ulhu2wr7a89o+uOkXjpFc5gH6l8Cct4MpbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K +5FrZx40d/JiZ+yykgmvwKh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEv +dmn8kN3bLW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcYAuUR +0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqBAGMUuTNe3QvboEUH +GjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYqE613TBoYm5EPWNgGVMWX+Ko/IIqm +haZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHrW2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQ +CPxrvrNQKlr9qEgYRtaQQJKQCoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8G +A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAUX15QvWiWkKQU +EapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3f5Z2EMVGpdAgS1D0NTsY9FVq +QRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxajaH6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxD +QpSbIPDRzbLrLFPCU3hKTwSUQZqPJzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcR +j88YxeMn/ibvBZ3PzzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5 +vZStjBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0/L5H9MG0 +qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pTBGIBnfHAT+7hOtSLIBD6 +Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79aPib8qXPMThcFarmlwDB31qlpzmq6YR/ +PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YWxw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnn +kf3/W9b3raYvAwtt41dU63ZTGI0RmLo= +-----END CERTIFICATE----- + +HARICA TLS ECC Root CA 2021 +=========================== +-----BEGIN CERTIFICATE----- +MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQswCQYDVQQGEwJH +UjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBD +QTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoX +DTQ1MDIxMzExMDEwOVowbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWlj +IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJv +b3QgQ0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7KKrxcm1l +AEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9YSTHMmE5gEYd103KUkE+b +ECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW +0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAi +rcJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/Qw +CZ61IygNnxS2PFOiTAZpffpskcYqSUXm7LcT4Tps +-----END CERTIFICATE----- From fee4142425d99079e914fc2e50155440acb57094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 19 Nov 2021 12:32:07 +0100 Subject: [PATCH 12/31] libogg: Update to upstream 1.3.5 Mostly a cosmetic update, we were already on a commit close to what ended up being tagged as 1.3.5. Adds an extra buffer overflow fix. (cherry picked from commit 77efd406bfde63f2d0ac2077dfbec48a75bb1e22) --- thirdparty/README.md | 6 +++--- thirdparty/libogg/framing.c | 9 +++++++-- thirdparty/libogg/ogg/config_types.h | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/thirdparty/README.md b/thirdparty/README.md index 87e9b666009..a1002d54114 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -153,14 +153,14 @@ Files extracted from upstream source: ## libogg - Upstream: https://www.xiph.org/ogg -- Version: git (c8fca6b4a02d695b1ceea39b330d4406001c03ed, 2019) +- Version: 1.3.5 (e1774cd77f471443541596e09078e78fdc342e4f, 2021) - License: BSD-3-Clause Files extracted from upstream source: - `src/*.{c,h}` -- `include/ogg/*.h` in ogg/ -- COPYING +- `include/ogg/*.h` in `ogg/` (run `configure` to generate `config_types.h`) +- `COPYING` ## libpng diff --git a/thirdparty/libogg/framing.c b/thirdparty/libogg/framing.c index 83601199ad8..724d116d7f0 100644 --- a/thirdparty/libogg/framing.c +++ b/thirdparty/libogg/framing.c @@ -597,9 +597,14 @@ char *ogg_sync_buffer(ogg_sync_state *oy, long size){ if(size>oy->storage-oy->fill){ /* We need to extend the internal buffer */ - long newsize=size+oy->fill+4096; /* an extra page to be nice */ + long newsize; void *ret; + if(size>INT_MAX-4096-oy->fill){ + ogg_sync_clear(oy); + return NULL; + } + newsize=size+oy->fill+4096; /* an extra page to be nice */ if(oy->data) ret=_ogg_realloc(oy->data,newsize); else @@ -1564,7 +1569,7 @@ void test_pack(const int *pl, const int **headers, int byteskip, byteskipcount=byteskip; } - ogg_sync_wrote(&oy,next-buf); + ogg_sync_wrote(&oy,(long)(next-buf)); while(1){ int ret=ogg_sync_pageout(&oy,&og_de); diff --git a/thirdparty/libogg/ogg/config_types.h b/thirdparty/libogg/ogg/config_types.h index 3574a8ad448..1a87df64234 100644 --- a/thirdparty/libogg/ogg/config_types.h +++ b/thirdparty/libogg/ogg/config_types.h @@ -1,7 +1,20 @@ #ifndef __CONFIG_TYPES_H__ #define __CONFIG_TYPES_H__ -#include "core/int_types.h" +/* these are filled in by configure or cmake*/ +#define INCLUDE_INTTYPES_H 1 +#define INCLUDE_STDINT_H 1 +#define INCLUDE_SYS_TYPES_H 1 + +#if INCLUDE_INTTYPES_H +# include +#endif +#if INCLUDE_STDINT_H +# include +#endif +#if INCLUDE_SYS_TYPES_H +# include +#endif typedef int16_t ogg_int16_t; typedef uint16_t ogg_uint16_t; From 1b3c02eba6afe8d7a463d2b2a3bb56b437d49295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 19 Nov 2021 14:08:06 +0100 Subject: [PATCH 13/31] libvorbis: Sync with upstream 1.3.7 Fixes various bugs, including several ones with security relevance. Changes: https://github.com/xiph/vorbis/releases/tag/v1.3.7 (cherry picked from commit 28ad2e8c72b81beefa65d37f94fa45a8a4604d09) --- thirdparty/README.md | 8 +++--- thirdparty/libvorbis/COPYING | 2 +- thirdparty/libvorbis/analysis.c | 2 +- thirdparty/libvorbis/backends.h | 2 +- thirdparty/libvorbis/barkmel.c | 2 +- thirdparty/libvorbis/bitrate.c | 2 +- thirdparty/libvorbis/bitrate.h | 2 +- thirdparty/libvorbis/block.c | 2 +- .../libvorbis/books/coupled/res_books_51.h | 2 +- .../books/coupled/res_books_stereo.h | 2 +- .../libvorbis/books/floor/floor_books.h | 2 +- .../books/uncoupled/res_books_uncoupled.h | 2 +- thirdparty/libvorbis/codebook.c | 2 +- thirdparty/libvorbis/codebook.h | 2 +- thirdparty/libvorbis/codec_internal.h | 2 +- thirdparty/libvorbis/envelope.c | 2 +- thirdparty/libvorbis/envelope.h | 2 +- thirdparty/libvorbis/floor0.c | 2 +- thirdparty/libvorbis/floor1.c | 2 +- thirdparty/libvorbis/highlevel.h | 2 +- thirdparty/libvorbis/info.c | 22 +++++++++++----- thirdparty/libvorbis/lookup.c | 2 +- thirdparty/libvorbis/lookup.h | 2 +- thirdparty/libvorbis/lookup_data.h | 2 +- thirdparty/libvorbis/lpc.c | 2 +- thirdparty/libvorbis/lpc.h | 2 +- thirdparty/libvorbis/lsp.c | 5 ++-- thirdparty/libvorbis/lsp.h | 2 +- thirdparty/libvorbis/mapping0.c | 2 +- thirdparty/libvorbis/masking.h | 2 +- thirdparty/libvorbis/mdct.c | 2 +- thirdparty/libvorbis/mdct.h | 2 +- thirdparty/libvorbis/misc.h | 2 +- thirdparty/libvorbis/modes/floor_all.h | 2 +- thirdparty/libvorbis/modes/psych_11.h | 2 +- thirdparty/libvorbis/modes/psych_16.h | 2 +- thirdparty/libvorbis/modes/psych_44.h | 2 +- thirdparty/libvorbis/modes/psych_8.h | 2 +- thirdparty/libvorbis/modes/residue_16.h | 2 +- thirdparty/libvorbis/modes/residue_44.h | 2 +- thirdparty/libvorbis/modes/residue_44p51.h | 2 +- thirdparty/libvorbis/modes/residue_44u.h | 2 +- thirdparty/libvorbis/modes/residue_8.h | 2 +- thirdparty/libvorbis/modes/setup_11.h | 2 +- thirdparty/libvorbis/modes/setup_16.h | 2 +- thirdparty/libvorbis/modes/setup_22.h | 2 +- thirdparty/libvorbis/modes/setup_32.h | 2 +- thirdparty/libvorbis/modes/setup_44.h | 2 +- thirdparty/libvorbis/modes/setup_44p51.h | 2 +- thirdparty/libvorbis/modes/setup_44u.h | 2 +- thirdparty/libvorbis/modes/setup_8.h | 2 +- thirdparty/libvorbis/modes/setup_X.h | 2 +- thirdparty/libvorbis/os.h | 13 +++++----- thirdparty/libvorbis/psy.c | 26 +++++++++++-------- thirdparty/libvorbis/psy.h | 2 +- thirdparty/libvorbis/psytune.c | 2 +- thirdparty/libvorbis/registry.c | 2 +- thirdparty/libvorbis/registry.h | 2 +- thirdparty/libvorbis/res0.c | 5 +--- thirdparty/libvorbis/scales.h | 2 +- thirdparty/libvorbis/sharedbook.c | 17 +++++++++--- thirdparty/libvorbis/smallft.c | 2 +- thirdparty/libvorbis/smallft.h | 2 +- thirdparty/libvorbis/synthesis.c | 2 +- thirdparty/libvorbis/vorbis/codec.h | 2 +- thirdparty/libvorbis/vorbis/vorbisenc.h | 2 +- thirdparty/libvorbis/vorbis/vorbisfile.h | 2 +- thirdparty/libvorbis/vorbisenc.c | 5 ++-- thirdparty/libvorbis/vorbisfile.c | 25 ++++++++++-------- thirdparty/libvorbis/window.c | 2 +- thirdparty/libvorbis/window.h | 2 +- 71 files changed, 136 insertions(+), 114 deletions(-) diff --git a/thirdparty/README.md b/thirdparty/README.md index a1002d54114..f67fa2b7c2e 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -216,14 +216,14 @@ on top of the 1.1.1 source (not included in any stable release yet). ## libvorbis - Upstream: https://www.xiph.org/vorbis -- Version: 1.3.6 (2018) +- Version: 1.3.7 (0657aee69dec8508a0011f47f3b69d7538e9d262, 2020) - License: BSD-3-Clause Files extracted from upstream source: -- `src/*` except from: `lookups.pl`, `Makefile.*` -- `include/vorbis/*.h` as vorbis/ -- COPYING +- `lib/*` except from: `lookups.pl`, `Makefile.*` +- `include/vorbis/*.h` as `vorbis/` +- `COPYING` ## libvpx diff --git a/thirdparty/libvorbis/COPYING b/thirdparty/libvorbis/COPYING index 153b926a152..fb456a87bdf 100644 --- a/thirdparty/libvorbis/COPYING +++ b/thirdparty/libvorbis/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2002-2018 Xiph.org Foundation +Copyright (c) 2002-2020 Xiph.org Foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/thirdparty/libvorbis/analysis.c b/thirdparty/libvorbis/analysis.c index 0e11a167be8..14919737eb5 100644 --- a/thirdparty/libvorbis/analysis.c +++ b/thirdparty/libvorbis/analysis.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/backends.h b/thirdparty/libvorbis/backends.h index 22809d46d52..670b0b902eb 100644 --- a/thirdparty/libvorbis/backends.h +++ b/thirdparty/libvorbis/backends.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/barkmel.c b/thirdparty/libvorbis/barkmel.c index 4b19935f30a..f833c302117 100644 --- a/thirdparty/libvorbis/barkmel.c +++ b/thirdparty/libvorbis/barkmel.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/bitrate.c b/thirdparty/libvorbis/bitrate.c index 96055140f71..132553cbee7 100644 --- a/thirdparty/libvorbis/bitrate.c +++ b/thirdparty/libvorbis/bitrate.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/bitrate.h b/thirdparty/libvorbis/bitrate.h index 655a68cc09f..48fa150596f 100644 --- a/thirdparty/libvorbis/bitrate.h +++ b/thirdparty/libvorbis/bitrate.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/block.c b/thirdparty/libvorbis/block.c index db245b3e696..6a50da08434 100644 --- a/thirdparty/libvorbis/block.c +++ b/thirdparty/libvorbis/block.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/books/coupled/res_books_51.h b/thirdparty/libvorbis/books/coupled/res_books_51.h index 47df4b221b8..eb569c6f046 100644 --- a/thirdparty/libvorbis/books/coupled/res_books_51.h +++ b/thirdparty/libvorbis/books/coupled/res_books_51.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** * diff --git a/thirdparty/libvorbis/books/coupled/res_books_stereo.h b/thirdparty/libvorbis/books/coupled/res_books_stereo.h index 61d934046dc..7b53cb972ba 100644 --- a/thirdparty/libvorbis/books/coupled/res_books_stereo.h +++ b/thirdparty/libvorbis/books/coupled/res_books_stereo.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/books/floor/floor_books.h b/thirdparty/libvorbis/books/floor/floor_books.h index 67d5f31a3bd..d26664f766c 100644 --- a/thirdparty/libvorbis/books/floor/floor_books.h +++ b/thirdparty/libvorbis/books/floor/floor_books.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h index 3d658ec4703..107e22f9e35 100644 --- a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h +++ b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/codebook.c b/thirdparty/libvorbis/codebook.c index 78672e222d8..7a0c206783f 100644 --- a/thirdparty/libvorbis/codebook.c +++ b/thirdparty/libvorbis/codebook.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/codebook.h b/thirdparty/libvorbis/codebook.h index 08440c6962a..7d4e2aae4f7 100644 --- a/thirdparty/libvorbis/codebook.h +++ b/thirdparty/libvorbis/codebook.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/codec_internal.h b/thirdparty/libvorbis/codec_internal.h index e522be18da1..2ecf5e5c73c 100644 --- a/thirdparty/libvorbis/codec_internal.h +++ b/thirdparty/libvorbis/codec_internal.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/envelope.c b/thirdparty/libvorbis/envelope.c index da752375428..22d39aa6e0b 100644 --- a/thirdparty/libvorbis/envelope.c +++ b/thirdparty/libvorbis/envelope.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/envelope.h b/thirdparty/libvorbis/envelope.h index f466efde8a7..2ef60a82ca2 100644 --- a/thirdparty/libvorbis/envelope.h +++ b/thirdparty/libvorbis/envelope.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/floor0.c b/thirdparty/libvorbis/floor0.c index 443c0e5a96f..f4a6d4d559a 100644 --- a/thirdparty/libvorbis/floor0.c +++ b/thirdparty/libvorbis/floor0.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/floor1.c b/thirdparty/libvorbis/floor1.c index 673e954c53a..c4fe3ea7e7b 100644 --- a/thirdparty/libvorbis/floor1.c +++ b/thirdparty/libvorbis/floor1.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/highlevel.h b/thirdparty/libvorbis/highlevel.h index 337b75bfa47..7690e3ebfb9 100644 --- a/thirdparty/libvorbis/highlevel.h +++ b/thirdparty/libvorbis/highlevel.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/info.c b/thirdparty/libvorbis/info.c index 3fbb7c757aa..f2e39e387e6 100644 --- a/thirdparty/libvorbis/info.c +++ b/thirdparty/libvorbis/info.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -19,7 +19,6 @@ #include #include -#include #include #include "vorbis/codec.h" #include "codec_internal.h" @@ -30,8 +29,8 @@ #include "misc.h" #include "os.h" -#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.6" -#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20180316 (Now 100% fewer shells)" +#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.7" +#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20200704 (Reducing Environment)" /* helpers */ static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){ @@ -47,6 +46,10 @@ static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){ } } +static int _v_toupper(int c) { + return (c >= 'a' && c <= 'z') ? (c & ~('a' - 'A')) : c; +} + void vorbis_comment_init(vorbis_comment *vc){ memset(vc,0,sizeof(*vc)); } @@ -78,7 +81,7 @@ void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *con static int tagcompare(const char *s1, const char *s2, int n){ int c=0; while(c < n){ - if(toupper(s1[c]) != toupper(s2[c])) + if(_v_toupper(s1[c]) != _v_toupper(s2[c])) return !0; c++; } @@ -203,6 +206,7 @@ void vorbis_info_clear(vorbis_info *vi){ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=vi->codec_setup; + int bs; if(!ci)return(OV_EFAULT); vi->version=oggpack_read(opb,32); @@ -215,8 +219,12 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ vi->bitrate_nominal=(ogg_int32_t)oggpack_read(opb,32); vi->bitrate_lower=(ogg_int32_t)oggpack_read(opb,32); - ci->blocksizes[0]=1<blocksizes[1]=1<blocksizes[0]=1<blocksizes[1]=1<rate<1)goto err_out; if(vi->channels<1)goto err_out; diff --git a/thirdparty/libvorbis/lookup.c b/thirdparty/libvorbis/lookup.c index 1cc1f88ee94..7cd01a44d38 100644 --- a/thirdparty/libvorbis/lookup.c +++ b/thirdparty/libvorbis/lookup.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/lookup.h b/thirdparty/libvorbis/lookup.h index 4bc0f3a206b..ec05014f44b 100644 --- a/thirdparty/libvorbis/lookup.h +++ b/thirdparty/libvorbis/lookup.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/lookup_data.h b/thirdparty/libvorbis/lookup_data.h index 5de3cfdc7ea..7935715a70c 100644 --- a/thirdparty/libvorbis/lookup_data.h +++ b/thirdparty/libvorbis/lookup_data.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/lpc.c b/thirdparty/libvorbis/lpc.c index 798f4cf0766..877da47f8ef 100644 --- a/thirdparty/libvorbis/lpc.c +++ b/thirdparty/libvorbis/lpc.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/lpc.h b/thirdparty/libvorbis/lpc.h index 9cc79451b60..4f59e6d32de 100644 --- a/thirdparty/libvorbis/lpc.h +++ b/thirdparty/libvorbis/lpc.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/lsp.c b/thirdparty/libvorbis/lsp.c index 85880545159..8afa305f50a 100644 --- a/thirdparty/libvorbis/lsp.c +++ b/thirdparty/libvorbis/lsp.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -15,9 +15,10 @@ The LSP generation code is taken (with minimal modification and a few bugfixes) from "On the Computation of the LSP Frequencies" by Joseph Rothweiler (see http://www.rothweiler.us for contact info). + The paper is available at: - http://www.myown1.com/joe/lsf + https://web.archive.org/web/20110810174000/http://home.myfairpoint.net/vzenxj75/myown1/joe/lsf/index.html ********************************************************************/ diff --git a/thirdparty/libvorbis/lsp.h b/thirdparty/libvorbis/lsp.h index 8a8d10e978a..68b38daf169 100644 --- a/thirdparty/libvorbis/lsp.h +++ b/thirdparty/libvorbis/lsp.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/mapping0.c b/thirdparty/libvorbis/mapping0.c index ccb4493d4cd..efa0fbcd93b 100644 --- a/thirdparty/libvorbis/mapping0.c +++ b/thirdparty/libvorbis/mapping0.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/masking.h b/thirdparty/libvorbis/masking.h index 955e18c719b..7a196a37eb1 100644 --- a/thirdparty/libvorbis/masking.h +++ b/thirdparty/libvorbis/masking.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/mdct.c b/thirdparty/libvorbis/mdct.c index f3f1ed805b5..2a0ff8d01ba 100644 --- a/thirdparty/libvorbis/mdct.c +++ b/thirdparty/libvorbis/mdct.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/mdct.h b/thirdparty/libvorbis/mdct.h index 3b8c9ba4a23..ceaea617a34 100644 --- a/thirdparty/libvorbis/mdct.h +++ b/thirdparty/libvorbis/mdct.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/misc.h b/thirdparty/libvorbis/misc.h index 13788445a34..eac5160e88a 100644 --- a/thirdparty/libvorbis/misc.h +++ b/thirdparty/libvorbis/misc.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/floor_all.h b/thirdparty/libvorbis/modes/floor_all.h index 20928aac877..2e3d4a50123 100644 --- a/thirdparty/libvorbis/modes/floor_all.h +++ b/thirdparty/libvorbis/modes/floor_all.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/psych_11.h b/thirdparty/libvorbis/modes/psych_11.h index cc5eea2402a..9d8ed357eea 100644 --- a/thirdparty/libvorbis/modes/psych_11.h +++ b/thirdparty/libvorbis/modes/psych_11.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/psych_16.h b/thirdparty/libvorbis/modes/psych_16.h index 477cb4d90f1..49cbf7c4b27 100644 --- a/thirdparty/libvorbis/modes/psych_16.h +++ b/thirdparty/libvorbis/modes/psych_16.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/psych_44.h b/thirdparty/libvorbis/modes/psych_44.h index 6c9eaa4e5f7..d15509b71dc 100644 --- a/thirdparty/libvorbis/modes/psych_44.h +++ b/thirdparty/libvorbis/modes/psych_44.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/psych_8.h b/thirdparty/libvorbis/modes/psych_8.h index 277db8436c4..a19817f7602 100644 --- a/thirdparty/libvorbis/modes/psych_8.h +++ b/thirdparty/libvorbis/modes/psych_8.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/residue_16.h b/thirdparty/libvorbis/modes/residue_16.h index 3e05471cec1..15e161c8629 100644 --- a/thirdparty/libvorbis/modes/residue_16.h +++ b/thirdparty/libvorbis/modes/residue_16.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/residue_44.h b/thirdparty/libvorbis/modes/residue_44.h index e89bc0e4861..3f982695a73 100644 --- a/thirdparty/libvorbis/modes/residue_44.h +++ b/thirdparty/libvorbis/modes/residue_44.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/residue_44p51.h b/thirdparty/libvorbis/modes/residue_44p51.h index 7f33e250e27..8ac5f65e625 100644 --- a/thirdparty/libvorbis/modes/residue_44p51.h +++ b/thirdparty/libvorbis/modes/residue_44p51.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/residue_44u.h b/thirdparty/libvorbis/modes/residue_44u.h index e55ac12548d..2f3595e49fa 100644 --- a/thirdparty/libvorbis/modes/residue_44u.h +++ b/thirdparty/libvorbis/modes/residue_44u.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/residue_8.h b/thirdparty/libvorbis/modes/residue_8.h index ae123a276a8..b836f79c84c 100644 --- a/thirdparty/libvorbis/modes/residue_8.h +++ b/thirdparty/libvorbis/modes/residue_8.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_11.h b/thirdparty/libvorbis/modes/setup_11.h index 0cbcaafcb26..5ade5dd1699 100644 --- a/thirdparty/libvorbis/modes/setup_11.h +++ b/thirdparty/libvorbis/modes/setup_11.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_16.h b/thirdparty/libvorbis/modes/setup_16.h index d59ad70d2e3..8b2daafa3fc 100644 --- a/thirdparty/libvorbis/modes/setup_16.h +++ b/thirdparty/libvorbis/modes/setup_16.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_22.h b/thirdparty/libvorbis/modes/setup_22.h index bc38af9630e..eef5a4e7da1 100644 --- a/thirdparty/libvorbis/modes/setup_22.h +++ b/thirdparty/libvorbis/modes/setup_22.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_32.h b/thirdparty/libvorbis/modes/setup_32.h index f66a0bcd002..f87cb767d07 100644 --- a/thirdparty/libvorbis/modes/setup_32.h +++ b/thirdparty/libvorbis/modes/setup_32.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_44.h b/thirdparty/libvorbis/modes/setup_44.h index a189b5fb953..12d592808e9 100644 --- a/thirdparty/libvorbis/modes/setup_44.h +++ b/thirdparty/libvorbis/modes/setup_44.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_44p51.h b/thirdparty/libvorbis/modes/setup_44p51.h index 3bde7b340cb..4d49173ffb8 100644 --- a/thirdparty/libvorbis/modes/setup_44p51.h +++ b/thirdparty/libvorbis/modes/setup_44p51.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_44u.h b/thirdparty/libvorbis/modes/setup_44u.h index 7ae3af6b2a9..2dd8bf701f3 100644 --- a/thirdparty/libvorbis/modes/setup_44u.h +++ b/thirdparty/libvorbis/modes/setup_44u.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_8.h b/thirdparty/libvorbis/modes/setup_8.h index 7502556879d..16b02e01b70 100644 --- a/thirdparty/libvorbis/modes/setup_8.h +++ b/thirdparty/libvorbis/modes/setup_8.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/modes/setup_X.h b/thirdparty/libvorbis/modes/setup_X.h index 2229a5ef2fd..27807c10b42 100644 --- a/thirdparty/libvorbis/modes/setup_X.h +++ b/thirdparty/libvorbis/modes/setup_X.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/os.h b/thirdparty/libvorbis/os.h index 416a401dd1b..9ded7358d42 100644 --- a/thirdparty/libvorbis/os.h +++ b/thirdparty/libvorbis/os.h @@ -8,7 +8,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -60,7 +60,7 @@ void *_alloca(size_t size); # define FAST_HYPOT hypot #endif -#endif +#endif /* _V_IFDEFJAIL_H_ */ #ifdef HAVE_ALLOCA_H # include @@ -80,7 +80,7 @@ void *_alloca(size_t size); /* Special i386 GCC implementation */ -#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) +#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) && !defined(__SSE2_MATH__) # define VORBIS_FPU_CONTROL /* both GCC and MSVC are kinda stupid about rounding/casting to int. Because of encapsulation constraints (GCC can't see inside the asm @@ -119,8 +119,7 @@ static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise, /* MSVC inline assembly. 32 bit only; inline ASM isn't implemented in the * 64 bit compiler and doesn't work on arm. */ -#if defined(_MSC_VER) && !defined(_WIN64) && \ - !defined(_WIN32_WCE) && !defined(_M_ARM) +#if defined(_MSC_VER) && defined(_M_IX86) && !defined(_WIN32_WCE) # define VORBIS_FPU_CONTROL typedef ogg_int16_t vorbis_fpu_control; @@ -147,7 +146,7 @@ static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ /* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be done safely because all x86_64 CPUs supports SSE2. */ -#if (defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__)) +#if (defined(_MSC_VER) && defined(_M_X64)) || (defined(__GNUC__) && defined (__SSE2_MATH__)) # define VORBIS_FPU_CONTROL typedef ogg_int16_t vorbis_fpu_control; @@ -174,7 +173,7 @@ static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ typedef int vorbis_fpu_control; -static int vorbis_ftoi(double f){ +STIN int vorbis_ftoi(double f){ /* Note: MSVC and GCC (at least on some systems) round towards zero, thus, the floor() call is required to ensure correct roudning of negative numbers */ diff --git a/thirdparty/libvorbis/psy.c b/thirdparty/libvorbis/psy.c index 422c6f1e412..036b094aa76 100644 --- a/thirdparty/libvorbis/psy.c +++ b/thirdparty/libvorbis/psy.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -599,11 +599,12 @@ static void bark_noise_hybridmp(int n,const long *b, XY[i] = tXY; } - for (i = 0, x = 0.f;; i++, x += 1.f) { + for (i = 0, x = 0.f; i < n; i++, x += 1.f) { lo = b[i] >> 16; - if( lo>=0 ) break; hi = b[i] & 0xffff; + if( lo>=0 || -lo>=n ) break; + if( hi>=n ) break; tN = N[hi] + N[-lo]; tX = X[hi] - X[-lo]; @@ -615,17 +616,17 @@ static void bark_noise_hybridmp(int n,const long *b, B = tN * tXY - tX * tY; D = tN * tXX - tX * tX; R = (A + x * B) / D; - if (R < 0.f) - R = 0.f; + if (R < 0.f) R = 0.f; noise[i] = R - offset; } - for ( ;; i++, x += 1.f) { + for ( ; i < n; i++, x += 1.f) { lo = b[i] >> 16; hi = b[i] & 0xffff; - if(hi>=n)break; + if( lo<0 || lo>=n ) break; + if( hi>=n ) break; tN = N[hi] - N[lo]; tX = X[hi] - X[lo]; @@ -641,6 +642,7 @@ static void bark_noise_hybridmp(int n,const long *b, noise[i] = R - offset; } + for ( ; i < n; i++, x += 1.f) { R = (A + x * B) / D; @@ -651,10 +653,11 @@ static void bark_noise_hybridmp(int n,const long *b, if (fixed <= 0) return; - for (i = 0, x = 0.f;; i++, x += 1.f) { + for (i = 0, x = 0.f; i < n; i++, x += 1.f) { hi = i + fixed / 2; lo = hi - fixed; - if(lo>=0)break; + if ( hi>=n ) break; + if ( lo>=0 ) break; tN = N[hi] + N[-lo]; tX = X[hi] - X[-lo]; @@ -670,11 +673,12 @@ static void bark_noise_hybridmp(int n,const long *b, if (R - offset < noise[i]) noise[i] = R - offset; } - for ( ;; i++, x += 1.f) { + for ( ; i < n; i++, x += 1.f) { hi = i + fixed / 2; lo = hi - fixed; - if(hi>=n)break; + if ( hi>=n ) break; + if ( lo<0 ) break; tN = N[hi] - N[lo]; tX = X[hi] - X[lo]; diff --git a/thirdparty/libvorbis/psy.h b/thirdparty/libvorbis/psy.h index ab2534db3a8..d9a04e8b74d 100644 --- a/thirdparty/libvorbis/psy.h +++ b/thirdparty/libvorbis/psy.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/psytune.c b/thirdparty/libvorbis/psytune.c index 6952136c6b9..67223e51187 100644 --- a/thirdparty/libvorbis/psytune.c +++ b/thirdparty/libvorbis/psytune.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/registry.c b/thirdparty/libvorbis/registry.c index 74f7ef0396b..db0f67b2e28 100644 --- a/thirdparty/libvorbis/registry.c +++ b/thirdparty/libvorbis/registry.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/registry.h b/thirdparty/libvorbis/registry.h index 599d9599426..b823aa60911 100644 --- a/thirdparty/libvorbis/registry.h +++ b/thirdparty/libvorbis/registry.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/res0.c b/thirdparty/libvorbis/res0.c index 6d623d730fb..c931aded387 100644 --- a/thirdparty/libvorbis/res0.c +++ b/thirdparty/libvorbis/res0.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -30,9 +30,6 @@ #include "misc.h" #include "os.h" -//#define TRAIN_RES 1 -//#define TRAIN_RESAUX 1 - #if defined(TRAIN_RES) || defined (TRAIN_RESAUX) #include #endif diff --git a/thirdparty/libvorbis/scales.h b/thirdparty/libvorbis/scales.h index 18bc4e75186..3c2ae48d9e9 100644 --- a/thirdparty/libvorbis/scales.h +++ b/thirdparty/libvorbis/scales.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/sharedbook.c b/thirdparty/libvorbis/sharedbook.c index 4545d4f4590..62a9a00afb8 100644 --- a/thirdparty/libvorbis/sharedbook.c +++ b/thirdparty/libvorbis/sharedbook.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -50,7 +50,7 @@ long _float32_pack(float val){ sign=0x80000000; val= -val; } - exp= floor(log(val)/log(2.f)+.001); //+epsilon + exp= floor(log(val)/log(2.f)+.001); /* +epsilon */ mant=rint(ldexp(val,(VQ_FMAN-1)-exp)); exp=(exp+VQ_FEXP_BIAS)<>VQ_FMAN; if(sign)mant= -mant; - return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS)); + exp=exp-(VQ_FMAN-1)-VQ_FEXP_BIAS; + /* clamp excessive exponent values */ + if (exp>63){ + exp=63; + } + if (exp<-63){ + exp=-63; + } + return(ldexp(mant,exp)); } /* given a list of word lengths, generate a list of codewords. Works @@ -294,7 +302,7 @@ int vorbis_book_init_encode(codebook *c,const static_codebook *s){ c->used_entries=s->entries; c->dim=s->dim; c->codelist=_make_words(s->lengthlist,s->entries,0); - //c->valuelist=_book_unquantize(s,s->entries,NULL); + /* c->valuelist=_book_unquantize(s,s->entries,NULL); */ c->quantvals=_book_maptype1_quantvals(s); c->minval=(int)rint(_float32_unpack(s->q_min)); c->delta=(int)rint(_float32_unpack(s->q_delta)); @@ -573,6 +581,7 @@ void run_test(static_codebook *b,float *comp){ exit(1); } } + free(out); } int main(){ diff --git a/thirdparty/libvorbis/smallft.c b/thirdparty/libvorbis/smallft.c index 6d528af423d..4ffabab4bb6 100644 --- a/thirdparty/libvorbis/smallft.c +++ b/thirdparty/libvorbis/smallft.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/smallft.h b/thirdparty/libvorbis/smallft.h index 9e867c67d22..02fe8f9cd41 100644 --- a/thirdparty/libvorbis/smallft.h +++ b/thirdparty/libvorbis/smallft.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/synthesis.c b/thirdparty/libvorbis/synthesis.c index 5f6092c3d30..3e2d6812704 100644 --- a/thirdparty/libvorbis/synthesis.c +++ b/thirdparty/libvorbis/synthesis.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/vorbis/codec.h b/thirdparty/libvorbis/vorbis/codec.h index 42aa29138e5..f8a912bc26c 100644 --- a/thirdparty/libvorbis/vorbis/codec.h +++ b/thirdparty/libvorbis/vorbis/codec.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * ******************************************************************** diff --git a/thirdparty/libvorbis/vorbis/vorbisenc.h b/thirdparty/libvorbis/vorbis/vorbisenc.h index 55f3b4a6672..085b15e669f 100644 --- a/thirdparty/libvorbis/vorbis/vorbisenc.h +++ b/thirdparty/libvorbis/vorbis/vorbisenc.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/vorbis/vorbisfile.h b/thirdparty/libvorbis/vorbis/vorbisfile.h index 56626119bbd..3d65393f52f 100644 --- a/thirdparty/libvorbis/vorbis/vorbisfile.h +++ b/thirdparty/libvorbis/vorbis/vorbisfile.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/vorbisenc.c b/thirdparty/libvorbis/vorbisenc.c index 4a4607cb413..cf3806a6e19 100644 --- a/thirdparty/libvorbis/vorbisenc.c +++ b/thirdparty/libvorbis/vorbisenc.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -684,6 +684,7 @@ int vorbis_encode_setup_init(vorbis_info *vi){ highlevel_encode_setup *hi=&ci->hi; if(ci==NULL)return(OV_EINVAL); + if(vi->channels<1||vi->channels>255)return(OV_EINVAL); if(!hi->impulse_block_p)i0=1; /* too low/high an ATH floater is nonsensical, but doesn't break anything */ @@ -1210,7 +1211,7 @@ int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){ hi->req, hi->managed, &new_base); - if(!hi->setup)return OV_EIMPL; + if(!new_template)return OV_EIMPL; hi->setup=new_template; hi->base_setting=new_base; vorbis_encode_setup_setting(vi,vi->channels,vi->rate); diff --git a/thirdparty/libvorbis/vorbisfile.c b/thirdparty/libvorbis/vorbisfile.c index b570c3c5f6d..9219c2f2dc6 100644 --- a/thirdparty/libvorbis/vorbisfile.c +++ b/thirdparty/libvorbis/vorbisfile.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** @@ -264,6 +264,10 @@ static ogg_int64_t _get_prev_page_serial(OggVorbis_File *vf, ogg_int64_t begin, } } } + /*We started from the beginning of the stream and found nothing. + This should be impossible unless the contents of the stream changed out + from under us after we read from it.*/ + if(!begin&&vf->offset<0)return OV_EBADLINK; } /* we're not interested in the page... just the serialno and granpos. */ @@ -1230,7 +1234,6 @@ double ov_time_total(OggVorbis_File *vf,int i){ int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){ ogg_stream_state work_os; - int ret; if(vf->ready_stateseekable) @@ -1253,8 +1256,12 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){ vf->current_serialno); /* must set serialno */ vorbis_synthesis_restart(&vf->vd); - ret=_seek_helper(vf,pos); - if(ret)goto seek_error; + if(_seek_helper(vf,pos)) { + /* dump the machine so we're in a known state */ + vf->pcm_offset=-1; + _decode_clear(vf); + return OV_EBADLINK; + } /* we need to make sure the pcm_offset is set, but we don't want to advance the raw cursor past good packets just to get to the first @@ -1388,13 +1395,6 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){ vf->bittrack=0.f; vf->samptrack=0.f; return(0); - - seek_error: - /* dump the machine so we're in a known state */ - vf->pcm_offset=-1; - ogg_stream_clear(&work_os); - _decode_clear(vf); - return OV_EBADLINK; } /* Page granularity seek (faster than sample granularity because we @@ -1964,6 +1964,7 @@ long ov_read_filter(OggVorbis_File *vf,char *buffer,int length, long samples; if(vf->ready_stateready_state==INITSET){ @@ -1989,6 +1990,8 @@ long ov_read_filter(OggVorbis_File *vf,char *buffer,int length, long channels=ov_info(vf,-1)->channels; long bytespersample=word * channels; vorbis_fpu_control fpu; + + if(channels<1||channels>255)return(OV_EINVAL); if(samples>length/bytespersample)samples=length/bytespersample; if(samples <= 0) diff --git a/thirdparty/libvorbis/window.c b/thirdparty/libvorbis/window.c index b3b7ce0163c..2151b278d14 100644 --- a/thirdparty/libvorbis/window.c +++ b/thirdparty/libvorbis/window.c @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** diff --git a/thirdparty/libvorbis/window.h b/thirdparty/libvorbis/window.h index 6ac260749ee..33d83f85f9a 100644 --- a/thirdparty/libvorbis/window.h +++ b/thirdparty/libvorbis/window.h @@ -6,7 +6,7 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * + * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** From 5e95d317e6100947f13b1b82eeb512a11f784969 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Thu, 11 Nov 2021 20:44:54 -0800 Subject: [PATCH 14/31] Update CanvasItem when MultiMesh instance transform changes (cherry picked from commit b54d4a93be231344940a2aee16ca1dbe3dc3e2b6) --- scene/2d/multimesh_instance_2d.cpp | 10 ++++++++++ scene/resources/multimesh.cpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp index 66fc10ba058..972dce2c4d7 100644 --- a/scene/2d/multimesh_instance_2d.cpp +++ b/scene/2d/multimesh_instance_2d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "multimesh_instance_2d.h" +#include "core/core_string_names.h" void MultiMeshInstance2D::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { @@ -56,7 +57,16 @@ void MultiMeshInstance2D::_bind_methods() { } void MultiMeshInstance2D::set_multimesh(const Ref &p_multimesh) { + // Cleanup previous connection if any. + if (multimesh.is_valid()) { + multimesh->disconnect(CoreStringNames::get_singleton()->changed, this, "update"); + } multimesh = p_multimesh; + + // Connect to the multimesh so the AABB can update when instance transforms are changed. + if (multimesh.is_valid()) { + multimesh->connect(CoreStringNames::get_singleton()->changed, this, "update"); + } update(); } diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 1220cd59bc0..43c270c9f33 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "multimesh.h" + #include "servers/visual_server.h" void MultiMesh::_set_transform_array(const PoolVector &p_array) { @@ -225,6 +226,7 @@ void MultiMesh::set_instance_transform(int p_instance, const Transform &p_transf void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) { VisualServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform); + emit_changed(); } Transform MultiMesh::get_instance_transform(int p_instance) const { From 2a12784498032f65d8826e93b907e6df6d7aad0e Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Fri, 19 Nov 2021 13:15:01 -0800 Subject: [PATCH 15/31] Add support for OpenXR export configurations. (cherry picked from commit 9c50bcabedbdd8fb25870fc2377ffda16253ce8e) --- platform/android/export/export_plugin.cpp | 46 ++++++++++++++----- .../android/export/gradle_export_util.cpp | 20 ++++++-- platform/android/export/gradle_export_util.h | 16 +++++++ .../lib/src/org/godotengine/godot/Godot.java | 2 + .../src/org/godotengine/godot/GodotView.java | 1 + .../src/org/godotengine/godot/xr/XRMode.java | 3 +- 6 files changed, 70 insertions(+), 18 deletions(-) diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 9d56dbc15dd..8a21235a147 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -755,9 +755,9 @@ void EditorExportPlatformAndroid::_get_permissions(const Ref } int xr_mode_index = p_preset->get("xr_features/xr_mode"); - if (xr_mode_index == 1 /* XRMode.OVR */) { + if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index > 0) { + if (hand_tracking_index > XR_HAND_TRACKING_NONE) { if (r_permissions.find("com.oculus.permission.HAND_TRACKING") == -1) { r_permissions.push_back("com.oculus.permission.HAND_TRACKING"); } @@ -976,14 +976,14 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") { // Update the meta-data 'android:name' attribute based on the selected XR mode. - if (xr_mode_index == 1 /* XRMode.OVR */) { + if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { string_table.write[attr_value] = "com.samsung.android.vr.application.mode"; } } if (tname == "meta-data" && attrname == "value" && value == "xr_mode_metadata_value") { // Update the meta-data 'android:value' attribute based on the selected XR mode. - if (xr_mode_index == 1 /* XRMode.OVR */) { + if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { string_table.write[attr_value] = "vr_only"; } } @@ -1002,7 +1002,7 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p Vector feature_required_list; Vector feature_versions; - if (xr_mode_index == 1 /* XRMode.OVR */) { + if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { // Set degrees of freedom feature_names.push_back("android.hardware.vr.headtracking"); feature_required_list.push_back(true); @@ -1010,11 +1010,21 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p // Check for hand tracking int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index > 0) { + if (hand_tracking_index > XR_HAND_TRACKING_NONE) { feature_names.push_back("oculus.software.handtracking"); - feature_required_list.push_back(hand_tracking_index == 2); + feature_required_list.push_back(hand_tracking_index == XR_HAND_TRACKING_REQUIRED); feature_versions.push_back(-1); // no version attribute should be added. } + + if (xr_mode_index == XR_MODE_OPENXR) { + // Check for passthrough + int passthrough_mode = p_preset->get("xr_features/passthrough"); + if (passthrough_mode > XR_PASSTHROUGH_NONE) { + feature_names.push_back("com.oculus.feature.PASSTHROUGH"); + feature_required_list.push_back(passthrough_mode == XR_PASSTHROUGH_REQUIRED); + feature_versions.push_back(-1); + } + } } if (feature_names.size() > 0) { @@ -1694,8 +1704,9 @@ void EditorExportPlatformAndroid::get_export_options(List *r_optio r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/opengl_debug"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VrApi (Deprecated),OpenXR"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/hand_tracking", PROPERTY_HINT_ENUM, "None,Optional,Required"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/passthrough", PROPERTY_HINT_ENUM, "None,Optional,Required"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/immersive_mode"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_small"), true)); @@ -2184,10 +2195,19 @@ bool EditorExportPlatformAndroid::can_export(const Ref &p_pr // Validate the Xr features are properly populated int xr_mode_index = p_preset->get("xr_features/xr_mode"); int hand_tracking = p_preset->get("xr_features/hand_tracking"); - if (xr_mode_index != /* XRMode.OVR*/ 1) { - if (hand_tracking > 0) { + int passthrough_mode = p_preset->get("xr_features/passthrough"); + if (xr_mode_index != XR_MODE_OVR && xr_mode_index != XR_MODE_OPENXR) { + if (hand_tracking > XR_HAND_TRACKING_NONE) { valid = false; - err += TTR("\"Hand Tracking\" is only valid when \"Xr Mode\" is \"Oculus Mobile VR\"."); + err += TTR("\"Hand Tracking\" is only valid when \"Xr Mode\" is \"Oculus Mobile VrApi\" or \"OpenXR\"."); + err += "\n"; + } + } + + if (xr_mode_index != XR_MODE_OPENXR) { + if (passthrough_mode > XR_PASSTHROUGH_NONE) { + valid = false; + err += TTR("\"Passthrough\" is only valid when \"Xr Mode\" is \"OpenXR\"."); err += "\n"; } } @@ -2524,8 +2544,10 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Refget("xr_features/xr_mode"); - if (xr_mode_index == 1) { + if (xr_mode_index == XR_MODE_OVR) { command_line_strings.push_back("--xr_mode_ovr"); + } else if (xr_mode_index == XR_MODE_OPENXR) { + command_line_strings.push_back("--xr_mode_openxr"); } else { // XRMode.REGULAR is the default. command_line_strings.push_back("--xr_mode_regular"); } diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 1b9e17cf14d..9120f252fb7 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -211,16 +211,24 @@ String _get_screen_sizes_tag(const Ref &p_preset) { String _get_xr_features_tag(const Ref &p_preset) { String manifest_xr_features; - bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1; + int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); + bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; if (uses_xr) { manifest_xr_features += " \n"; int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index == 1) { + if (hand_tracking_index == XR_HAND_TRACKING_OPTIONAL) { manifest_xr_features += " \n"; - } else if (hand_tracking_index == 2) { + } else if (hand_tracking_index == XR_HAND_TRACKING_REQUIRED) { manifest_xr_features += " \n"; } + + int passthrough_mode = p_preset->get("xr_features/passthrough"); + if (passthrough_mode == XR_PASSTHROUGH_OPTIONAL) { + manifest_xr_features += " \n"; + } else if (passthrough_mode == XR_PASSTHROUGH_REQUIRED) { + manifest_xr_features += " \n"; + } } return manifest_xr_features; } @@ -239,7 +247,8 @@ String _get_instrumentation_tag(const Ref &p_preset) { } String _get_activity_tag(const Ref &p_preset) { - bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1; + int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); + bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; String orientation = _get_android_orientation_label( OS::get_singleton()->get_screen_orientation_from_string(GLOBAL_GET("display/window/handheld/orientation"))); String manifest_activity_text = vformat( @@ -257,7 +266,8 @@ String _get_activity_tag(const Ref &p_preset) { } String _get_application_tag(const Ref &p_preset, bool p_has_storage_permission) { - bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1; + int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); + bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; String manifest_application_text = vformat( " Date: Sun, 21 Nov 2021 11:37:09 +0000 Subject: [PATCH 16/31] Fix Android `get_screen_orientation()` not returning valid values (cherry picked from commit 05744ee0e2cbed383bf10f71c53b0fb4f109feee) --- .../src/org/godotengine/godot/GodotIO.java | 31 +++++++++++++++++-- platform/android/os_android.cpp | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java index 7547939f943..4d490f98702 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -285,10 +285,37 @@ public class GodotIO { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); } break; } - }; + } public int getScreenOrientation() { - return activity.getRequestedOrientation(); + int orientation = activity.getRequestedOrientation(); + switch (orientation) { + case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: + return SCREEN_LANDSCAPE; + case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: + return SCREEN_PORTRAIT; + case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE: + return SCREEN_REVERSE_LANDSCAPE; + case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT: + return SCREEN_REVERSE_PORTRAIT; + case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE: + case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE: + return SCREEN_SENSOR_LANDSCAPE; + case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT: + case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT: + return SCREEN_SENSOR_PORTRAIT; + case ActivityInfo.SCREEN_ORIENTATION_SENSOR: + case ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR: + case ActivityInfo.SCREEN_ORIENTATION_FULL_USER: + return SCREEN_SENSOR; + case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: + case ActivityInfo.SCREEN_ORIENTATION_USER: + case ActivityInfo.SCREEN_ORIENTATION_BEHIND: + case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR: + case ActivityInfo.SCREEN_ORIENTATION_LOCKED: + default: + return -1; + } } public void setEdit(GodotEditText _edit) { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index ec3d1210251..61abf480e85 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -466,6 +466,7 @@ void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) { OS::ScreenOrientation OS_Android::get_screen_orientation() const { const int orientation = godot_io_java->get_screen_orientation(); + ERR_FAIL_INDEX_V_MSG(orientation, 7, OS::ScreenOrientation(0), "Unrecognized screen orientation."); return OS::ScreenOrientation(orientation); } From 58dc743a2c08b31e2459083ca048057aad0370a8 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 21 Nov 2021 21:34:30 +0800 Subject: [PATCH 17/31] Allow toggle TextEdit bookmark gutter (cherry picked from commit eb6f74855f3cc9fd29ea3cbefc3c2a31c450b610) --- doc/classes/TextEdit.xml | 3 +++ scene/gui/text_edit.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 1f856eb8723..8556f91281f 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -384,6 +384,9 @@ + + If [code]true[/code], the bookmark gutter is visible. + If [code]true[/code], the breakpoint gutter is visible. diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2cafd4d83f6..be8b086f5f2 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7176,6 +7176,8 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_drawing_tabs"), &TextEdit::is_drawing_tabs); ClassDB::bind_method(D_METHOD("set_draw_spaces"), &TextEdit::set_draw_spaces); ClassDB::bind_method(D_METHOD("is_drawing_spaces"), &TextEdit::is_drawing_spaces); + ClassDB::bind_method(D_METHOD("set_bookmark_gutter_enabled", "enable"), &TextEdit::set_bookmark_gutter_enabled); + ClassDB::bind_method(D_METHOD("is_bookmark_gutter_enabled"), &TextEdit::is_bookmark_gutter_enabled); ClassDB::bind_method(D_METHOD("set_breakpoint_gutter_enabled", "enable"), &TextEdit::set_breakpoint_gutter_enabled); ClassDB::bind_method(D_METHOD("is_breakpoint_gutter_enabled"), &TextEdit::is_breakpoint_gutter_enabled); ClassDB::bind_method(D_METHOD("set_draw_fold_gutter"), &TextEdit::set_draw_fold_gutter); @@ -7237,6 +7239,7 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_tabs"), "set_draw_tabs", "is_drawing_tabs"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_spaces"), "set_draw_spaces", "is_drawing_spaces"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bookmark_gutter"), "set_bookmark_gutter_enabled", "is_bookmark_gutter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "breakpoint_gutter"), "set_breakpoint_gutter_enabled", "is_breakpoint_gutter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fold_gutter"), "set_draw_fold_gutter", "is_drawing_fold_gutter"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled"); From f667afc8b2adf026bfc533388324a331fef8448a Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 22 Nov 2021 12:54:05 +0100 Subject: [PATCH 18/31] Show tooltips even when paused or time_scale is 0 (cherry picked from commit 5b55599211317dc0420b2248ffb87d297cbc06dd) --- scene/main/scene_tree.cpp | 15 ++++++++++++++- scene/main/scene_tree.h | 4 ++++ scene/main/viewport.cpp | 24 +++++++++++------------- scene/main/viewport.h | 3 ++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 7b3dc332c69..f803e301c14 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -80,6 +80,14 @@ bool SceneTreeTimer::is_pause_mode_process() { return process_pause; } +void SceneTreeTimer::set_ignore_time_scale(bool p_ignore) { + ignore_time_scale = p_ignore; +} + +bool SceneTreeTimer::is_ignore_time_scale() { + return ignore_time_scale; +} + void SceneTreeTimer::release_connections() { List connections; get_all_signal_connections(&connections); @@ -557,8 +565,13 @@ bool SceneTree::idle(float p_time) { E = N; continue; } + float time_left = E->get()->get_time_left(); - time_left -= p_time; + if (E->get()->is_ignore_time_scale()) { + time_left -= Engine::get_singleton()->get_idle_frame_step(); + } else { + time_left -= p_time; + } E->get()->set_time_left(time_left); if (time_left < 0) { diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 83f1bd909ff..9382540fb16 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -50,6 +50,7 @@ class SceneTreeTimer : public Reference { float time_left; bool process_pause; + bool ignore_time_scale = false; protected: static void _bind_methods(); @@ -61,6 +62,9 @@ public: void set_pause_mode_process(bool p_pause_mode_process); bool is_pause_mode_process(); + void set_ignore_time_scale(bool p_ignore); + bool is_ignore_time_scale(); + void release_connections(); SceneTreeTimer(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 3cc35ef094f..0c519222285 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -333,7 +333,6 @@ void Viewport::_notification(int p_what) { #endif // Enable processing for tooltips, collision debugging, physics object picking, etc. - set_process_internal(true); set_physics_process_internal(true); } break; @@ -361,16 +360,6 @@ void Viewport::_notification(int p_what) { remove_from_group("_viewports"); VS::get_singleton()->viewport_set_active(viewport, false); - - } break; - case NOTIFICATION_INTERNAL_PROCESS: { - if (gui.tooltip_timer >= 0) { - gui.tooltip_timer -= get_process_delta_time(); - if (gui.tooltip_timer < 0) { - _gui_show_tooltip(); - } - } - } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) { @@ -1499,7 +1488,10 @@ void Viewport::_gui_sort_roots() { void Viewport::_gui_cancel_tooltip() { gui.tooltip_control = nullptr; - gui.tooltip_timer = -1; + if (gui.tooltip_timer.is_valid()) { + gui.tooltip_timer->release_connections(); + gui.tooltip_timer = Ref(); + } if (gui.tooltip_popup) { gui.tooltip_popup->queue_delete(); gui.tooltip_popup = nullptr; @@ -2240,9 +2232,15 @@ void Viewport::_gui_input_event(Ref p_event) { } if (can_tooltip && !is_tooltip_shown) { + if (gui.tooltip_timer.is_valid()) { + gui.tooltip_timer->release_connections(); + gui.tooltip_timer = Ref(); + } gui.tooltip_control = over; gui.tooltip_pos = mpos; - gui.tooltip_timer = gui.tooltip_delay; + gui.tooltip_timer = get_tree()->create_timer(gui.tooltip_delay); + gui.tooltip_timer->set_ignore_time_scale(true); + gui.tooltip_timer->connect("timeout", this, "_gui_show_tooltip"); } } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 4f92a13db5d..77890f8147d 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -49,6 +49,7 @@ class Label; class Timer; class Viewport; class CollisionObject; +class SceneTreeTimer; class ViewportTexture : public Texture { GDCLASS(ViewportTexture, Texture); @@ -308,7 +309,7 @@ private: bool drag_attempted; Variant drag_data; ObjectID drag_preview_id; - float tooltip_timer; + Ref tooltip_timer; float tooltip_delay; List modal_stack; Transform2D focus_inv_xform; From 07e5022cce2e059320bf7c1b62d073e04a635513 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Thu, 18 Nov 2021 14:32:33 +0000 Subject: [PATCH 19/31] BVH - add option for expanded AABBs in leaves This PR adds a define BVH_EXPAND_LEAF_AABBS which is set, which stores expanded AABBs in the tree instead of exact AABBs. This makes the logic less error prone when considering reciprocal collisions in the pairing, as all collision detect is now taking place between expanded AABB against expanded AABB, rather than expanded AABB against exact AABB. The flip side of this is that the intersection tests will now be less exact when expanded margins are set. All margins are now user customizable via project settings, and take account of collision pairing density to adjust the margin dynamically. (cherry picked from commit 211dc8cd2d64a9472c1b4cdb53b11535e1d53be1) --- core/math/bvh.h | 6 +++++ core/math/bvh_pair.inc | 10 ++++++++ core/math/bvh_public.inc | 27 +++++++++++++++++++++ core/math/bvh_tree.h | 3 +++ doc/classes/ProjectSettings.xml | 16 ++++++++++++ main/main.cpp | 5 +++- servers/physics/broad_phase_bvh.cpp | 1 + servers/physics_2d/broad_phase_2d_bvh.cpp | 1 + servers/physics_2d/physics_2d_server_sw.cpp | 2 ++ servers/visual/visual_server_scene.cpp | 4 +++ 10 files changed, 74 insertions(+), 1 deletion(-) diff --git a/core/math/bvh.h b/core/math/bvh.h index 8d0134f78ba..90052a46aa8 100644 --- a/core/math/bvh.h +++ b/core/math/bvh.h @@ -704,6 +704,11 @@ private: // Note that non pairable items can pair with pairable, // so all types must be added to the list +#ifdef BVH_EXPAND_LEAF_AABBS + // if using expanded AABB in the leaf, the redundancy check will already have been made + BOUNDS &expanded_aabb = tree._pairs[p_handle.id()].expanded_aabb; + item_get_AABB(p_handle, expanded_aabb); +#else // aabb check with expanded aabb. This greatly decreases processing // at the cost of slightly less accurate pairing checks // Note this pairing AABB is separate from the AABB in the actual tree @@ -720,6 +725,7 @@ private: // this tick, because it is vital that the AABB is kept up to date expanded_aabb = aabb; expanded_aabb.grow_by(tree._pairing_expansion); +#endif // this code is to ensure that changed items only appear once on the updated list // collision checking them multiple times is not needed, and repeats the same thing diff --git a/core/math/bvh_pair.inc b/core/math/bvh_pair.inc index 7175edbfe16..e6f1d6bd490 100644 --- a/core/math/bvh_pair.inc +++ b/core/math/bvh_pair.inc @@ -59,4 +59,14 @@ struct ItemPairs { return userdata; } + + // experiment : scale the pairing expansion by the number of pairs. + // when the number of pairs is high, the density is high and a lower collision margin is better. + // when there are few local pairs, a larger margin is more optimal. + real_t scale_expansion_margin(real_t p_margin) const { + real_t x = real_t(num_pairs) * (1.0 / 9.0); + x = MIN(x, 1.0); + x = 1.0 - x; + return p_margin * x; + } }; diff --git a/core/math/bvh_public.inc b/core/math/bvh_public.inc index 6a8ecb05555..db4de03b39d 100644 --- a/core/math/bvh_public.inc +++ b/core/math/bvh_public.inc @@ -9,6 +9,13 @@ BVHHandle item_add(T *p_userdata, bool p_active, const BOUNDS &p_aabb, int32_t p BVHABB_CLASS abb; abb.from(p_aabb); + // NOTE that we do not expand the AABB for the first create even if + // leaf expansion is switched on. This is for two reasons: + // (1) We don't know if this object will move in future, in which case a non-expanded + // bound would be better... + // (2) We don't yet know how many objects will be paired, which is used to modify + // the expansion margin. + // handle to be filled with the new item ref BVHHandle handle; @@ -115,6 +122,15 @@ bool item_move(BVHHandle p_handle, const BOUNDS &p_aabb) { BVHABB_CLASS abb; abb.from(p_aabb); +#ifdef BVH_EXPAND_LEAF_AABBS + if (USE_PAIRS) { + // scale the pairing expansion by the number of pairs. + abb.expand(_pairs[ref_id].scale_expansion_margin(_pairing_expansion)); + } else { + abb.expand(_pairing_expansion); + } +#endif + BVH_ASSERT(ref.tnode_id != BVHCommon::INVALID); TNode &tnode = _nodes[ref.tnode_id]; @@ -129,9 +145,20 @@ bool item_move(BVHHandle p_handle, const BOUNDS &p_aabb) { BVHABB_CLASS &leaf_abb = leaf.get_aabb(ref.item_id); // no change? +#ifdef BVH_EXPAND_LEAF_AABBS + BOUNDS leaf_aabb; + leaf_abb.to(leaf_aabb); + + // This test should pass in a lot of cases, and by returning false we can avoid + // collision pairing checks later, which greatly reduces processing. + if (expanded_aabb_encloses_not_shrink(leaf_aabb, p_aabb)) { + return false; + } +#else if (leaf_abb == abb) { return false; } +#endif #ifdef BVH_VERBOSE_MOVES print_line("item_move " + itos(p_handle.id()) + "(within tnode aabb) : " + _debug_aabb_to_string(abb)); diff --git a/core/math/bvh_tree.h b/core/math/bvh_tree.h index 8acf076cc4f..1751837fa38 100644 --- a/core/math/bvh_tree.h +++ b/core/math/bvh_tree.h @@ -50,6 +50,9 @@ #define BVHABB_CLASS BVH_ABB +// not sure if this is better yet so making optional +#define BVH_EXPAND_LEAF_AABBS + // never do these checks in release #if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED) //#define BVH_VERBOSE diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 3c84df2eb5f..d60e0c05860 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1016,6 +1016,11 @@ Size of the hash table used for the broad-phase 2D hash grid algorithm. [b]Note:[/b] Not used if [member ProjectSettings.physics/2d/use_bvh] is enabled. + + Additional expansion applied to object bounds in the 2D physics bounding volume hierarchy. This can reduce BVH processing at the cost of a slightly coarser broadphase, which can stress the physics more in some situations. + The default value will work well in most situations. A value of 0.0 will turn this optimization off, and larger values may work better for larger, faster moving objects. + [b]Note:[/b] Used only if [member ProjectSettings.physics/2d/use_bvh] is enabled. + Cell size used for the broad-phase 2D hash grid algorithm (in pixels). [b]Note:[/b] Not used if [member ProjectSettings.physics/2d/use_bvh] is enabled. @@ -1095,6 +1100,11 @@ The default linear damp in 3D. [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration. + + Additional expansion applied to object bounds in the 3D physics bounding volume hierarchy. This can reduce BVH processing at the cost of a slightly coarser broadphase, which can stress the physics more in some situations. + The default value will work well in most situations. A value of 0.0 will turn this optimization off, and larger values may work better for larger, faster moving objects. + [b]Note:[/b] Used only if [member ProjectSettings.physics/3d/godot_physics/use_bvh] is enabled. + Enables the use of bounding volume hierarchy instead of octree for 3D physics spatial partitioning. This may give better performance. @@ -1430,9 +1440,15 @@ See also [member rendering/quality/skinning/force_software_skinning]. [b]Note:[/b] When the software skinning fallback is triggered, custom vertex shaders will behave in a different way, because the bone transform will be already applied to the modelview matrix. + + Additional expansion applied to object bounds in the 3D rendering bounding volume hierarchy. This can reduce BVH processing at the cost of a slightly reduced accuracy. + The default value will work well in most situations. A value of 0.0 will turn this optimization off, and larger values may work better for larger, faster moving objects. + [b]Note:[/b] Used only if [member ProjectSettings.rendering/quality/spatial_partitioning/use_bvh] is enabled. + The rendering octree balance can be changed to favor smaller ([code]0[/code]), or larger ([code]1[/code]) branches. Larger branches can increase performance significantly in some projects. + [b]Note:[/b] Not used if [member ProjectSettings.rendering/quality/spatial_partitioning/use_bvh] is enabled. Enables the use of bounding volume hierarchy instead of octree for rendering spatial partitioning. This may give better performance. diff --git a/main/main.cpp b/main/main.cpp index b4d111d3507..442774a2648 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -175,8 +175,11 @@ static String get_full_version_string() { // FIXME: Could maybe be moved to PhysicsServerManager and Physics2DServerManager directly // to have less code in main.cpp. void initialize_physics() { - // This must be defined BEFORE the 3d physics server is created + // This must be defined BEFORE the 3d physics server is created, + // otherwise it won't always show up in the project settings page. GLOBAL_DEF("physics/3d/godot_physics/use_bvh", true); + GLOBAL_DEF("physics/3d/godot_physics/bvh_collision_margin", 0.1); + ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/godot_physics/bvh_collision_margin", PropertyInfo(Variant::REAL, "physics/3d/godot_physics/bvh_collision_margin", PROPERTY_HINT_RANGE, "0.0,2.0,0.01")); /// 3D Physics Server physics_server = PhysicsServerManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServerManager::setting_property_name)); diff --git a/servers/physics/broad_phase_bvh.cpp b/servers/physics/broad_phase_bvh.cpp index 0154a931c57..162684dfa8a 100644 --- a/servers/physics/broad_phase_bvh.cpp +++ b/servers/physics/broad_phase_bvh.cpp @@ -127,6 +127,7 @@ BroadPhaseSW *BroadPhaseBVH::_create() { BroadPhaseBVH::BroadPhaseBVH() { bvh.params_set_thread_safe(GLOBAL_GET("rendering/threads/thread_safe_bvh")); + bvh.params_set_pairing_expansion(GLOBAL_GET("physics/3d/godot_physics/bvh_collision_margin")); bvh.set_pair_callback(_pair_callback, this); bvh.set_unpair_callback(_unpair_callback, this); bvh.set_check_pair_callback(_check_pair_callback, this); diff --git a/servers/physics_2d/broad_phase_2d_bvh.cpp b/servers/physics_2d/broad_phase_2d_bvh.cpp index 6b2fe8a812e..83a5a98a713 100644 --- a/servers/physics_2d/broad_phase_2d_bvh.cpp +++ b/servers/physics_2d/broad_phase_2d_bvh.cpp @@ -123,6 +123,7 @@ BroadPhase2DSW *BroadPhase2DBVH::_create() { BroadPhase2DBVH::BroadPhase2DBVH() { bvh.params_set_thread_safe(GLOBAL_GET("rendering/threads/thread_safe_bvh")); + bvh.params_set_pairing_expansion(GLOBAL_GET("physics/2d/bvh_collision_margin")); bvh.set_pair_callback(_pair_callback, this); bvh.set_unpair_callback(_unpair_callback, this); bvh.set_check_pair_callback(_check_pair_callback, this); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 21c9be258f5..2912053a3f3 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -1325,6 +1325,8 @@ Physics2DServerSW::Physics2DServerSW() { GLOBAL_DEF("physics/2d/bp_hash_table_size", 4096); GLOBAL_DEF("physics/2d/cell_size", 128); GLOBAL_DEF("physics/2d/large_object_surface_threshold_in_cells", 512); + GLOBAL_DEF("physics/2d/bvh_collision_margin", 1.0); + ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/bvh_collision_margin", PropertyInfo(Variant::REAL, "physics/2d/bvh_collision_margin", PROPERTY_HINT_RANGE, "0.0,20.0,0.1")); bool use_bvh = GLOBAL_GET("physics/2d/use_bvh"); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 639d3d51076..1a87d7f5bcf 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -100,6 +100,7 @@ void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera, bool p_enab VisualServerScene::SpatialPartitioningScene_BVH::SpatialPartitioningScene_BVH() { _bvh.params_set_thread_safe(GLOBAL_GET("rendering/threads/thread_safe_bvh")); + _bvh.params_set_pairing_expansion(GLOBAL_GET("rendering/quality/spatial_partitioning/bvh_collision_margin")); } VisualServerScene::SpatialPartitionID VisualServerScene::SpatialPartitioningScene_BVH::create(Instance *p_userdata, const AABB &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) { @@ -4095,6 +4096,9 @@ VisualServerScene::VisualServerScene() { render_pass = 1; singleton = this; _use_bvh = GLOBAL_DEF("rendering/quality/spatial_partitioning/use_bvh", true); + GLOBAL_DEF("rendering/quality/spatial_partitioning/bvh_collision_margin", 0.1); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/spatial_partitioning/bvh_collision_margin", PropertyInfo(Variant::REAL, "rendering/quality/spatial_partitioning/bvh_collision_margin", PROPERTY_HINT_RANGE, "0.0,2.0,0.01")); + _visual_server_callbacks = nullptr; } From b9d6d5474622180e8fd129cb7892bd325e8d67fb Mon Sep 17 00:00:00 2001 From: jitspoe Date: Mon, 22 Nov 2021 22:44:30 -0500 Subject: [PATCH 20/31] Fix crash when exporting gltf mesh that has no skin. (cherry picked from commit 734b4a46bcb69cdd45e1e285badbdd9a3beb4bcd) --- modules/gltf/gltf_document.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 049f0bfe1be..8e369525466 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6068,7 +6068,10 @@ void GLTFDocument::_convert_mesh_instances(Ref state) { int bone_cnt = skeleton->get_bone_count(); ERR_FAIL_COND(bone_cnt != gltf_skeleton->joints.size()); - ObjectID gltf_skin_key = skin->get_instance_id(); + ObjectID gltf_skin_key = 0; + if (skin.is_valid()) { + gltf_skin_key = skin->get_instance_id(); + } ObjectID gltf_skel_key = godot_skeleton->get_instance_id(); GLTFSkinIndex skin_gltf_i = -1; GLTFNodeIndex root_gltf_i = -1; From ac56f95685103bc48adb89d5466bcb713858e084 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Tue, 23 Nov 2021 14:49:37 +0100 Subject: [PATCH 21/31] TileSetEditor Fix selecting next/previous subtile (cherry picked from commit 97e9165de47301dbb96421a29d8eb492b46998e1) --- editor/plugins/tile_set_editor_plugin.cpp | 38 +++++++++++------------ editor/plugins/tile_set_editor_plugin.h | 1 + 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index cab2d9983df..1e2542a5465 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1227,12 +1227,10 @@ void TileSetEditor::_on_scroll_container_input(const Ref &p_event) { // to allow performing this action anywhere, even if the cursor isn't // hovering the texture in the workspace. if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { - print_line("zooming in"); _zoom_in(); // Don't scroll up after zooming in. accept_event(); } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { - print_line("zooming out"); _zoom_out(); // Don't scroll down after zooming out. accept_event(); @@ -2027,9 +2025,7 @@ void TileSetEditor::_update_tile_data() { data.occlusion_shape = tileset->tile_get_light_occluder(get_current_tile()); current_tile_data[Vector2i()] = data; } else { - int spacing = tileset->autotile_get_spacing(get_current_tile()); - Vector2 size = tileset->tile_get_region(get_current_tile()).size; - Vector2 cell_count = (size / (tileset->autotile_get_size(get_current_tile()) + Vector2(spacing, spacing))).floor(); + Vector2 cell_count = _get_subtiles_count(get_current_tile()); for (int y = 0; y < cell_count.y; y++) { for (int x = 0; x < cell_count.x; x++) { SubtileData data; @@ -2129,10 +2125,7 @@ void TileSetEditor::_select_previous_tile() { case EDITMODE_NAVIGATION: case EDITMODE_PRIORITY: case EDITMODE_Z_INDEX: { - int spacing = tileset->autotile_get_spacing(get_current_tile()); - Vector2 size = tileset->tile_get_region(get_current_tile()).size; - Vector2 cell_count = (size / (tileset->autotile_get_size(get_current_tile()) + Vector2(spacing, spacing))).floor(); - edited_shape_coord = cell_count; + edited_shape_coord = _get_subtiles_count(get_current_tile()) - Vector2(1, 1); _select_edited_shape_coord(); } break; default: { @@ -2175,6 +2168,17 @@ bool TileSetEditor::_sort_tiles(Variant p_a, Variant p_b) { } } +Vector2 TileSetEditor::_get_subtiles_count(int p_tile_id) { + const int spacing = tileset->autotile_get_spacing(p_tile_id); + const Vector2 region_size = tileset->tile_get_region(p_tile_id).size; + const Vector2 subtile_size = tileset->autotile_get_size(p_tile_id); + // In case of not perfect fit the last row/column is allowed to exceed the tile region. + // The return value is the biggest integer-only `(m, n)` satisfying the formula: + // (m, n) * subtile_size + (m - 1, n - 1) * spacing < region_size + subtile_size + Vector2 mn = Vector2(1, 1) + (region_size / (subtile_size + Vector2(spacing, spacing))); + return mn == mn.floor() ? mn.floor() - Vector2(1, 1) : mn.floor(); +} + void TileSetEditor::_select_next_subtile() { if (get_current_tile() == -1) { _select_next_tile(); @@ -2185,14 +2189,12 @@ void TileSetEditor::_select_next_subtile() { } else if (edit_mode == EDITMODE_REGION || edit_mode == EDITMODE_BITMASK || edit_mode == EDITMODE_ICON) { _select_next_tile(); } else { - int spacing = tileset->autotile_get_spacing(get_current_tile()); - Vector2 size = tileset->tile_get_region(get_current_tile()).size; - Vector2 cell_count = (size / (tileset->autotile_get_size(get_current_tile()) + Vector2(spacing, spacing))).floor(); - if (edited_shape_coord.x > cell_count.x - 1 && edited_shape_coord.y > cell_count.y - 1) { + Vector2 cell_count = _get_subtiles_count(get_current_tile()); + if (edited_shape_coord.x >= cell_count.x - 1 && edited_shape_coord.y >= cell_count.y - 1) { _select_next_tile(); } else { edited_shape_coord.x++; - if (edited_shape_coord.x > cell_count.x) { + if (edited_shape_coord.x > cell_count.x - 1) { edited_shape_coord.x = 0; edited_shape_coord.y++; } @@ -2211,15 +2213,13 @@ void TileSetEditor::_select_previous_subtile() { } else if (edit_mode == EDITMODE_REGION || edit_mode == EDITMODE_BITMASK || edit_mode == EDITMODE_ICON) { _select_previous_tile(); } else { - int spacing = tileset->autotile_get_spacing(get_current_tile()); - Vector2 size = tileset->tile_get_region(get_current_tile()).size; - Vector2 cell_count = (size / (tileset->autotile_get_size(get_current_tile()) + Vector2(spacing, spacing))).floor(); + Vector2 cell_count = _get_subtiles_count(get_current_tile()); if (edited_shape_coord.x <= 0 && edited_shape_coord.y <= 0) { _select_previous_tile(); } else { edited_shape_coord.x--; - if (edited_shape_coord.x == -1) { - edited_shape_coord.x = cell_count.x; + if (edited_shape_coord.x < 0) { + edited_shape_coord.x = cell_count.x - 1; edited_shape_coord.y--; } _select_edited_shape_coord(); diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index cee3ff8f787..c950d78def7 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -215,6 +215,7 @@ private: void _select_previous_tile(); Array _get_tiles_in_current_texture(bool sorted = false); bool _sort_tiles(Variant p_a, Variant p_b); + Vector2 _get_subtiles_count(int p_tile_id); void _select_next_subtile(); void _select_previous_subtile(); void _select_next_shape(); From c6927a9790031ea98c3dc260f6dfaf3911c70244 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 21 Nov 2021 18:39:46 +0800 Subject: [PATCH 22/31] Fix Theme Editor crash when clicking the element picker (cherry picked from commit abd41dedb00b8526517ab2e5231c2065e7b96768) --- editor/plugins/theme_editor_preview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index de32e3f0aa7..5f7e5a87483 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -71,6 +71,9 @@ void ThemeEditorPreview::_preview_visibility_changed() { void ThemeEditorPreview::_picker_button_cbk() { picker_overlay->set_visible(picker_button->is_pressed()); + if (picker_button->is_pressed()) { + _reset_picker_overlay(); + } } Control *ThemeEditorPreview::_find_hovered_control(Control *p_parent, Vector2 p_mouse_position) { From 6516f269483e647af4d8a66834bd969ac4f5ae42 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 21 Nov 2021 20:14:59 +0800 Subject: [PATCH 23/31] Fix crash when executing PackedDataContainer._iter_init (cherry picked from commit 8253a45a1abf1ea5d82a9e1624af73818ce6c12a) --- core/packed_data_container.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 7be91c6c230..78ccd419ef6 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -97,6 +97,7 @@ Variant PackedDataContainer::_iter_get_ofs(const Variant &p_iter, uint32_t p_off } Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, bool &err) const { + ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), Variant()); uint32_t type = decode_uint32(p_buf + p_ofs); if (type == TYPE_ARRAY || type == TYPE_DICT) { @@ -119,6 +120,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b } uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { + ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), 0); PoolVector::Read rd = data.read(); ERR_FAIL_COND_V(!rd.ptr(), 0); const uint8_t *r = &rd[p_ofs]; @@ -128,6 +130,7 @@ uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { }; int PackedDataContainer::_size(uint32_t p_ofs) const { + ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), 0); PoolVector::Read rd = data.read(); ERR_FAIL_COND_V(!rd.ptr(), 0); const uint8_t *r = &rd[p_ofs]; @@ -146,6 +149,7 @@ int PackedDataContainer::_size(uint32_t p_ofs) const { }; Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const { + ERR_FAIL_COND_V(p_ofs + 4 > (uint32_t)data.size(), Variant()); PoolVector::Read rd = data.read(); if (!rd.ptr()) { err = true; From 60d1200a265a26c5034f4074ffc507ea52bef526 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 21 Nov 2021 17:32:15 +0100 Subject: [PATCH 24/31] Print a warning with unknown SCons variables to ease troubleshooting When disabling specific modules, misspellings can occur. Additionally, when switching between the `3.x` and `master` branches frequently, it's possible to forget about renamed modules such as `lightmapper_cpu` versus `lightmapper_rd`. (cherry picked from commit 69b2d3f7914e5823e4e0848c1bcc3d15a1cfa7a1) --- SConstruct | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SConstruct b/SConstruct index 8eccce9d382..da20169f256 100644 --- a/SConstruct +++ b/SConstruct @@ -289,6 +289,13 @@ opts.Update(env_base) env_base["platform"] = selected_platform # Must always be re-set after calling opts.Update(). Help(opts.GenerateHelpText(env_base)) +# Detect and print a warning listing unknown SCons variables to ease troubleshooting. +unknown = opts.UnknownVariables() +if unknown: + print("WARNING: Unknown SCons variables were passed and will be ignored:") + for item in unknown.items(): + print(" " + item[0] + "=" + item[1]) + # add default include paths env_base.Prepend(CPPPATH=["#"]) From 4876686cf75f833bfbed42678481210900979c2b Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 21 Nov 2021 21:29:34 +0100 Subject: [PATCH 25/31] Improved some editor checkboxes (cherry picked from commit 5dc7346ab4d9353c7fa881b0f82a06e7d4fbe938) --- editor/editor_node.cpp | 2 ++ editor/project_export.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 7c20080e6ef..1c20cd8d863 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6760,10 +6760,12 @@ EditorNode::EditorNode() { file_export_lib->connect("file_selected", this, "_dialog_action"); file_export_lib_merge = memnew(CheckBox); file_export_lib_merge->set_text(TTR("Merge With Existing")); + file_export_lib_merge->set_h_size_flags(Control::SIZE_SHRINK_CENTER); file_export_lib_merge->set_pressed(true); file_export_lib->get_vbox()->add_child(file_export_lib_merge); file_export_lib_apply_xforms = memnew(CheckBox); file_export_lib_apply_xforms->set_text(TTR("Apply MeshInstance Transforms")); + file_export_lib_apply_xforms->set_h_size_flags(Control::SIZE_SHRINK_CENTER); file_export_lib_apply_xforms->set_pressed(false); file_export_lib->get_vbox()->add_child(file_export_lib_apply_xforms); gui_base->add_child(file_export_lib); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 746d0670ec9..1c433f1f576 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -1174,11 +1174,13 @@ ProjectExportDialog::ProjectExportDialog() { export_debug = memnew(CheckBox); export_debug->set_text(TTR("Export With Debug")); export_debug->set_pressed(true); + export_debug->set_h_size_flags(Control::SIZE_SHRINK_CENTER); export_project->get_vbox()->add_child(export_debug); export_pck_zip_debug = memnew(CheckBox); export_pck_zip_debug->set_text(TTR("Export With Debug")); export_pck_zip_debug->set_pressed(true); + export_pck_zip_debug->set_h_size_flags(Control::SIZE_SHRINK_CENTER); export_pck_zip->get_vbox()->add_child(export_pck_zip_debug); set_hide_on_ok(false); From b8bda1fb67b3cdb68b294042fda4a9a63ef6a09c Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 22 Nov 2021 01:26:55 +0100 Subject: [PATCH 26/31] Clarify get_indexed in relation to Nodes (cherry picked from commit 4ea6709558ae715df45b4b5137f4ae554922cad4) --- doc/classes/Object.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 33ff51f1bc9..a10e94e1db6 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -201,6 +201,7 @@ Gets the object's property indexed by the given [NodePath]. The node path should be relative to the current object and can use the colon character ([code]:[/code]) to access nested properties. Examples: [code]"position:x"[/code] or [code]"material:next_pass:blend_mode"[/code]. + [b]Note:[/b] Even though the method takes [NodePath] argument, it doesn't support actual paths to [Node]s in the scene tree, only colon-separated sub-property paths. For the purpose of nodes, use [method Node.get_node_and_resource] instead. From f2ef3e67a1af1555c8a2d3dac47f1a2cc501830e Mon Sep 17 00:00:00 2001 From: Gergely Kis Date: Mon, 22 Nov 2021 18:05:24 +0100 Subject: [PATCH 27/31] Fix debug build for iphone printf() does not have a version that accepts std::string as format string parameter. (cherry picked from commit a1a3e79ea51622e00cbe8c4f7a94f1f2a44e4953) --- thirdparty/embree/common/sys/platform.h | 2 +- thirdparty/embree/kernels/common/rtcore.h | 2 +- thirdparty/embree/patches/godot-changes-noexcept.patch | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h index 697e07bb86b..3e386c4944e 100644 --- a/thirdparty/embree/common/sys/platform.h +++ b/thirdparty/embree/common/sys/platform.h @@ -183,7 +183,7 @@ // #define THROW_RUNTIME_ERROR(str) // throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); #define THROW_RUNTIME_ERROR(str) \ - printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort(); + printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); // -- GODOT end -- #else // -- GODOT start -- diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h index 373e49a6896..f8aad7c7cb8 100644 --- a/thirdparty/embree/kernels/common/rtcore.h +++ b/thirdparty/embree/kernels/common/rtcore.h @@ -126,7 +126,7 @@ namespace embree // #define throw_RTCError(error,str) \ // throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); #define throw_RTCError(error,str) \ - printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort(); + printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); // -- GODOT end -- #else // -- GODOT begin -- diff --git a/thirdparty/embree/patches/godot-changes-noexcept.patch b/thirdparty/embree/patches/godot-changes-noexcept.patch index c587a0e2be9..598a7f2ddc0 100644 --- a/thirdparty/embree/patches/godot-changes-noexcept.patch +++ b/thirdparty/embree/patches/godot-changes-noexcept.patch @@ -259,7 +259,7 @@ index 8a6d9fa0a9..697e07bb86 100644 + // throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); #define THROW_RUNTIME_ERROR(str) \ - throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); -+ printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort(); ++ printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); + // -- GODOT end -- #else + // -- GODOT start -- @@ -583,7 +583,7 @@ index 4e4b24e9c2..373e49a689 100644 + // throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); #define throw_RTCError(error,str) \ - throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); -+ printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort(); ++ printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); + // -- GODOT end -- #else + // -- GODOT begin -- From 5555a69b5e71fbc15ac745042b52a77a0aeccb69 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 23 Nov 2021 00:56:43 +0100 Subject: [PATCH 28/31] Document the engine's use of internal groups in Node (cherry picked from commit f8d9e4afdbc6dd7a35076e91d976daf3841de6a3) --- doc/classes/Node.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index dd2af727861..026ac2a2975 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -202,6 +202,14 @@ Returns an array listing the groups that the node is a member of. [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. + [b]Note:[/b] The engine uses some group names internally (all starting with an underscore). To avoid conflicts with internal groups, do not add custom groups whose name starts with an underscore. To exclude internal groups while looping over [method get_groups], use the following snippet: + [codeblock] + # Stores the node's non-internal groups only (as an array of Strings). + var non_internal_groups = [] + for group in get_groups(): + if not group.begins_with("_"): + non_internal_groups.push_back(group) + [/codeblock] From b8f888a43b00b38b0f721f8ba7c53018f201cf16 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:14:19 +0200 Subject: [PATCH 29/31] Add Input.is_physical_key_pressed method. (cherry picked from commit 9877d91c4a573a7538c042f7f01b5c97e17dcd2d) --- core/os/input.cpp | 1 + core/os/input.h | 1 + doc/classes/Input.xml | 7 +++++++ main/input_default.cpp | 13 +++++++++++++ main/input_default.h | 2 ++ 5 files changed, 24 insertions(+) diff --git a/core/os/input.cpp b/core/os/input.cpp index 0eee3b08692..28a599e6b04 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -55,6 +55,7 @@ Input::MouseMode Input::get_mouse_mode() const { void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("is_key_pressed", "scancode"), &Input::is_key_pressed); + ClassDB::bind_method(D_METHOD("is_physical_key_pressed", "scancode"), &Input::is_physical_key_pressed); ClassDB::bind_method(D_METHOD("is_mouse_button_pressed", "button"), &Input::is_mouse_button_pressed); ClassDB::bind_method(D_METHOD("is_joy_button_pressed", "device", "button"), &Input::is_joy_button_pressed); ClassDB::bind_method(D_METHOD("is_action_pressed", "action", "exact"), &Input::is_action_pressed, DEFVAL(false)); diff --git a/core/os/input.h b/core/os/input.h index 8489fcb78df..2d75c9d21ad 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -79,6 +79,7 @@ public: static Input *get_singleton(); virtual bool is_key_pressed(int p_scancode) const = 0; + virtual bool is_physical_key_pressed(int p_scancode) const = 0; virtual bool is_mouse_button_pressed(int p_button) const = 0; virtual bool is_joy_button_pressed(int p_device, int p_button) const = 0; virtual bool is_action_pressed(const StringName &p_action, bool p_exact = false) const = 0; diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index b8f17d5bae6..64ff22bdde5 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -264,6 +264,13 @@ Returns [code]true[/code] if you are pressing the mouse button specified with [enum ButtonList]. + + + + + Returns [code]true[/code] if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass a [enum KeyList] constant. + + diff --git a/main/input_default.cpp b/main/input_default.cpp index 5e1555fd82c..7ca580f8ede 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -76,6 +76,11 @@ bool InputDefault::is_key_pressed(int p_scancode) const { return keys_pressed.has(p_scancode); } +bool InputDefault::is_physical_key_pressed(int p_scancode) const { + _THREAD_SAFE_METHOD_ + return physical_keys_pressed.has(p_scancode); +} + bool InputDefault::is_mouse_button_pressed(int p_button) const { _THREAD_SAFE_METHOD_ return (mouse_button_mask & (1 << (p_button - 1))) != 0; @@ -316,6 +321,13 @@ void InputDefault::_parse_input_event_impl(const Ref &p_event, bool keys_pressed.erase(k->get_scancode()); } } + if (k.is_valid() && !k->is_echo() && k->get_physical_scancode() != 0) { + if (k->is_pressed()) { + physical_keys_pressed.insert(k->get_physical_scancode()); + } else { + physical_keys_pressed.erase(k->get_physical_scancode()); + } + } Ref mb = p_event; @@ -716,6 +728,7 @@ void InputDefault::release_pressed_events() { flush_buffered_events(); // this is needed to release actions strengths keys_pressed.clear(); + physical_keys_pressed.clear(); joy_buttons_pressed.clear(); _joy_axis.clear(); diff --git a/main/input_default.h b/main/input_default.h index 7efa0450b4f..defdb43a900 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -39,6 +39,7 @@ class InputDefault : public Input { int mouse_button_mask; + Set physical_keys_pressed; Set keys_pressed; Set joy_buttons_pressed; Map _joy_axis; @@ -221,6 +222,7 @@ protected: public: virtual bool is_key_pressed(int p_scancode) const; + virtual bool is_physical_key_pressed(int p_scancode) const; virtual bool is_mouse_button_pressed(int p_button) const; virtual bool is_joy_button_pressed(int p_device, int p_button) const; virtual bool is_action_pressed(const StringName &p_action, bool p_exact = false) const; From f5ea27e587ca8d96314aefb6f188e9af14000066 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 23 Nov 2021 12:53:31 +0100 Subject: [PATCH 30/31] Mention that replace_by doesn't free the node (cherry picked from commit 58a3ea545338eb237ed17993e264b632a53a5e10) --- doc/classes/Node.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 026ac2a2975..5a1fd5af140 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -521,6 +521,7 @@ Replaces a node in a scene by the given one. Subscriptions that pass through this node will be lost. + Note that the replaced node is not automatically freed, so you either need to keep it in a variable for later use or free it using [method Object.free]. From e2039108043b94bda34d5a9e4f6266a12cf17324 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 23 Nov 2021 14:32:43 +0100 Subject: [PATCH 31/31] Correct the doc about ease() (cherry picked from commit 44e6655924839306e8b97d4598bb438b5ecc276e) --- modules/gdscript/doc_classes/@GDScript.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 9bdf869e031..b8aca81da29 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -259,9 +259,9 @@ - 1.0: Linear - Between -1.0 and 0.0 (exclusive): Ease out-in - 0.0: Constant - - Between 0.0 to 1.0 (exclusive): Ease in + - Between 0.0 to 1.0 (exclusive): Ease out - 1.0: Linear - - Greater than 1.0 (exclusive): Ease out + - Greater than 1.0 (exclusive): Ease in [/codeblock] [url=https://raw.githubusercontent.com/godotengine/godot-docs/3.4/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url] See also [method smoothstep]. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer].