From ea633b930f9a7a4a8c6c75d5e21a4c76bc064953 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 15 Aug 2025 10:36:27 +0200 Subject: [PATCH] Fix #143989: Vulkan: Text drawing performance Text drawing can be improved. At this moment a vertex buffer is allocated for 2048 chars. When drawing a string the vertex buffer is filled from the beginning with the string to draw. The next string will replace the chars of the previous string. This locks up GPUs as the data can only be overwritten when the buffer isn't used anymore. Vulkan backend had an issue that uploading the new data would always send over 2048 chars even when some chars were only used. By fixing this the scene in the report went from 0.6 fps to 2.6 fps. OpenGL is 6 fps as vulkan has to manage a rendergraph with 100.000 of nodes. Text drawing performance can be improved by continue using the space of the vertex buffers. In this case more drawing calls can be done, before the vertex buffer needs to be updated. Pull Request: https://projects.blender.org/blender/blender/pulls/144604 --- source/blender/gpu/vulkan/vk_vertex_buffer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/vulkan/vk_vertex_buffer.cc b/source/blender/gpu/vulkan/vk_vertex_buffer.cc index bddb12597cd..42223fd9ef0 100644 --- a/source/blender/gpu/vulkan/vk_vertex_buffer.cc +++ b/source/blender/gpu/vulkan/vk_vertex_buffer.cc @@ -150,7 +150,8 @@ void VKVertexBuffer::upload_data_direct(const VKBuffer &host_buffer) void VKVertexBuffer::upload_data_via_staging_buffer(VKContext &context) { - VKStagingBuffer staging_buffer(buffer_, VKStagingBuffer::Direction::HostToDevice); + VKStagingBuffer staging_buffer( + buffer_, VKStagingBuffer::Direction::HostToDevice, 0, this->size_used_get()); VKBuffer &buffer = staging_buffer.host_buffer_get(); if (buffer.is_allocated()) { upload_data_direct(buffer);