summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/math/dynamic_bvh.cpp4
-rw-r--r--core/math/dynamic_bvh.h2
-rw-r--r--core/templates/paged_allocator.h6
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp1
-rw-r--r--scene/2d/joints_2d.cpp8
5 files changed, 16 insertions, 5 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index e66de5037d..23e713dd2d 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -31,7 +31,7 @@
#include "dynamic_bvh.h"
void DynamicBVH::_delete_node(Node *p_node) {
- memdelete(p_node);
+ node_allocator.free(p_node);
}
void DynamicBVH::_recurse_delete_node(Node *p_node) {
@@ -46,7 +46,7 @@ void DynamicBVH::_recurse_delete_node(Node *p_node) {
}
DynamicBVH::Node *DynamicBVH::_create_node(Node *p_parent, void *p_data) {
- Node *node = memnew(Node);
+ Node *node = node_allocator.alloc();
node->parent = p_parent;
node->data = p_data;
return (node);
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 968badc093..ecf2feb3d8 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -34,6 +34,7 @@
#include "core/math/aabb.h"
#include "core/templates/list.h"
#include "core/templates/local_vector.h"
+#include "core/templates/paged_allocator.h"
#include "core/typedefs.h"
// Based on bullet Dbvh
@@ -217,6 +218,7 @@ private:
}
};
+ PagedAllocator<Node> node_allocator;
// Fields
Node *bvh_root = nullptr;
int lkhd = -1;
diff --git a/core/templates/paged_allocator.h b/core/templates/paged_allocator.h
index 8bd1eecdeb..ab9945dd3b 100644
--- a/core/templates/paged_allocator.h
+++ b/core/templates/paged_allocator.h
@@ -108,7 +108,7 @@ public:
return page_size > 0;
}
- void configure(uint32_t p_page_size, bool p_thread_safe) {
+ void configure(uint32_t p_page_size) {
ERR_FAIL_COND(page_pool != nullptr); //sanity check
ERR_FAIL_COND(p_page_size == 0);
page_size = nearest_power_of_2_templated(p_page_size);
@@ -116,8 +116,8 @@ public:
page_shift = get_shift_from_power_of_2(page_size);
}
- PagedAllocator(uint32_t p_page_size = 4096, bool p_thread_safe = false) { // power of 2 recommended because of alignment with OS page sizes. Even if element is bigger, its still a multiple and get rounded amount of pages
- configure(p_page_size, false);
+ PagedAllocator(uint32_t p_page_size = 4096) { // power of 2 recommended because of alignment with OS page sizes. Even if element is bigger, its still a multiple and get rounded amount of pages
+ configure(p_page_size);
}
~PagedAllocator() {
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index 5d97164dbf..787b6dbf80 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -171,6 +171,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann
if (p_channels == Image::USED_CHANNELS_RG) { //guessing this is a normalmap
flags |= cvtt::Flags::Uniform;
}
+ options.flags = flags;
Image::Format target_format = Image::FORMAT_BPTC_RGBA;
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index f5d13fd641..3e37f2d2bb 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -90,6 +90,14 @@ void Joint2D::_update_joint(bool p_only_free) {
warning = String();
update_configuration_warning();
+ if (body_a) {
+ body_a->force_update_transform();
+ }
+
+ if (body_b) {
+ body_b->force_update_transform();
+ }
+
joint = _configure_joint(body_a, body_b);
ERR_FAIL_COND_MSG(!joint.is_valid(), "Failed to configure the joint.");