diff --git a/src/tz/gl/impl/vulkan/detail/fence.cpp b/src/tz/gl/impl/vulkan/detail/fence.cpp index d375f2769a..2fd580d965 100644 --- a/src/tz/gl/impl/vulkan/detail/fence.cpp +++ b/src/tz/gl/impl/vulkan/detail/fence.cpp @@ -71,7 +71,8 @@ namespace tz::gl::vk2 void Fence::wait_until_signalled() const { - vkWaitForFences(this->get_device().native(), 1, &this->fence, VK_FALSE, std::numeric_limits::max()); + VkResult res = vkWaitForFences(this->get_device().native(), 1, &this->fence, VK_FALSE, std::numeric_limits::max()); + tz::assert(res == VK_SUCCESS); } void Fence::unsignal() diff --git a/src/tz/ren/text.cpp b/src/tz/ren/text.cpp index e6e7b4c0bd..9ace992602 100644 --- a/src/tz/ren/text.cpp +++ b/src/tz/ren/text.cpp @@ -57,7 +57,7 @@ namespace tz::ren const std::size_t old_capacity = this->get_char_capacity(rh); // double or add by string size, whichever is larger. const std::size_t new_capacity = std::max(old_capacity + str.size(), old_capacity * 2); - this->set_char_capacity(rh, new_capacity); + this->set_char_capacity(rh, ch, new_capacity); maybe_region = this->try_find_char_region(str.size(), rh); tz::assert(maybe_region.has_value()); } @@ -93,7 +93,7 @@ namespace tz::ren if(string_id >= this->get_string_capacity(rh)) { // expand. double capacity. - this->set_string_capacity(rh, capacity * 2); + this->set_string_capacity(rh, ch, capacity * 2); } this->write_string_locator(rh, ch, string_id, loc); this->string_cursor++; @@ -253,9 +253,9 @@ namespace tz::ren std::size_t char_storage::get_char_occupancy(tz::gl::renderer_handle rh) const { std::size_t total_char_count = 0; - std::vector locators(this->get_string_capacity(rh)); + std::vector locators(this->string_cursor); auto resource_data = tz::gl::get_device().get_renderer(rh).get_resource(this->string_buffer)->data_as(); - std::copy(resource_data.begin(), resource_data.end(), locators.begin()); + std::copy(resource_data.begin(), resource_data.begin() + this->string_cursor, locators.begin()); for(const auto& loc : locators) { total_char_count += loc.count; @@ -272,7 +272,7 @@ namespace tz::ren //-------------------------------------------------------------------------------------------------- - void char_storage::set_char_capacity(tz::gl::renderer_handle rh, std::size_t char_count) + void char_storage::set_char_capacity(tz::gl::renderer_handle rh, tz::gl::renderer_handle ch, std::size_t char_count) { std::size_t old_cap = this->get_char_capacity(rh); if(old_cap <= char_count) @@ -288,6 +288,16 @@ namespace tz::ren }) .build() ); + tz::gl::get_device().get_renderer(ch).edit( + tz::gl::RendererEditBuilder{} + .mark_dirty + ({ + .work_commands = true, + .buffers = true, + }) + .build() + ); + tz::assert(this->get_char_capacity(rh) == char_count); } @@ -300,7 +310,7 @@ namespace tz::ren //-------------------------------------------------------------------------------------------------- - void char_storage::set_string_capacity(tz::gl::renderer_handle rh, std::size_t string_count) + void char_storage::set_string_capacity(tz::gl::renderer_handle rh, tz::gl::renderer_handle ch, std::size_t string_count) { std::size_t old_cap = this->get_string_capacity(rh); if(old_cap >= string_count) @@ -316,6 +326,15 @@ namespace tz::ren }) .build() ); + tz::gl::get_device().get_renderer(ch).edit( + tz::gl::RendererEditBuilder{} + .mark_dirty + ({ + .work_commands = true, + .buffers = true, + }) + .build() + ); tz::assert(this->get_string_capacity(rh) == string_count); } diff --git a/src/tz/ren/text.hpp b/src/tz/ren/text.hpp index 81c472a4c8..0fbe72611b 100644 --- a/src/tz/ren/text.hpp +++ b/src/tz/ren/text.hpp @@ -56,9 +56,9 @@ namespace tz::ren void write_string_locator(tz::gl::renderer_handle rh, tz::gl::renderer_handle ch, std::size_t string_id, const string_locator& loc); std::size_t get_char_occupancy(tz::gl::renderer_handle rh) const; std::size_t get_char_capacity(tz::gl::renderer_handle rh) const; - void set_char_capacity(tz::gl::renderer_handle rh, std::size_t char_count); + void set_char_capacity(tz::gl::renderer_handle rh, tz::gl::renderer_handle ch, std::size_t char_count); std::size_t get_string_capacity(tz::gl::renderer_handle rh) const; - void set_string_capacity(tz::gl::renderer_handle rh, std::size_t string_count); + void set_string_capacity(tz::gl::renderer_handle rh, tz::gl::renderer_handle ch, std::size_t string_count); // convert ascii chars into alphabet indices (in-place) static constexpr void format(std::span ascii_str) {