summaryrefslogtreecommitdiff
path: root/modules/text_server_fb
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-25 18:05:13 +0200
committerGitHub <noreply@github.com>2022-07-25 18:05:13 +0200
commit18159a6574e40c36c1aed0d1cae1dc8a32879efa (patch)
tree1388e203286537b410407a00ea616b8b7c43dbf1 /modules/text_server_fb
parentce959dc753c2245610e93e2f88eab4cc95bd7d9b (diff)
parentc7255388e185e9f6d4363fc6d6c5cce17e944ba1 (diff)
Merge pull request #63354 from reduz/replace-thread-work-pool
Remove ThreadWorkPool, replace by WorkerThreadPool
Diffstat (limited to 'modules/text_server_fb')
-rw-r--r--modules/text_server_fb/text_server_fb.cpp6
-rw-r--r--modules/text_server_fb/text_server_fb.h5
2 files changed, 3 insertions, 8 deletions
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index b845beb158..50ea4677b1 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -461,10 +461,8 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_msdf(
td.projection = &projection;
td.distancePixelConversion = &distancePixelConversion;
- if (p_font_data->work_pool.get_thread_count() == 0) {
- p_font_data->work_pool.init();
- }
- p_font_data->work_pool.do_work(h, this, &TextServerFallback::_generateMTSDF_threaded, &td);
+ WorkerThreadPool::GroupID group_id = WorkerThreadPool::get_singleton()->add_template_group_task(this, &TextServerFallback::_generateMTSDF_threaded, &td, h, -1, true, SNAME("TextServerFBRenderMSDF"));
+ WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_id);
msdfgen::msdfErrorCorrection(image, shape, projection, p_pixel_range, config);
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index b3ec4ffb38..adb5cbb817 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -79,9 +79,9 @@ using namespace godot;
#include "servers/text/text_server_extension.h"
+#include "core/object/worker_thread_pool.h"
#include "core/templates/hash_map.h"
#include "core/templates/rid_owner.h"
-#include "core/templates/thread_work_pool.h"
#include "scene/resources/texture.h"
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen.
@@ -208,10 +208,7 @@ class TextServerFallback : public TextServerExtension {
size_t data_size;
int face_index = 0;
- mutable ThreadWorkPool work_pool;
-
~FontFallback() {
- work_pool.finish();
for (const KeyValue<Vector2i, FontForSizeFallback *> &E : cache) {
memdelete(E.value);
}