diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-25 18:05:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-25 18:05:13 +0200 |
commit | 18159a6574e40c36c1aed0d1cae1dc8a32879efa (patch) | |
tree | 1388e203286537b410407a00ea616b8b7c43dbf1 /modules/text_server_fb | |
parent | ce959dc753c2245610e93e2f88eab4cc95bd7d9b (diff) | |
parent | c7255388e185e9f6d4363fc6d6c5cce17e944ba1 (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.cpp | 6 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.h | 5 |
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); } |