text_renderer: clear VkImage before growing, implement island padding in texture atlas (fix graphical artifacts)

This commit is contained in:
Aleksander
2025-11-08 12:08:48 +01:00
parent 6f41ffe59c
commit a59a4c2870
3 changed files with 51 additions and 15 deletions

View File

@@ -4,11 +4,11 @@ use vulkano::{
DeviceSize,
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
AutoCommandBufferBuilder, CommandBufferExecFuture, CopyBufferToImageInfo, CopyImageInfo, PrimaryAutoCommandBuffer,
PrimaryCommandBufferAbstract, RenderingAttachmentInfo, RenderingInfo, SubpassContents,
AutoCommandBufferBuilder, ClearColorImageInfo, CommandBufferExecFuture, CopyBufferToImageInfo, CopyImageInfo,
PrimaryAutoCommandBuffer, PrimaryCommandBufferAbstract, RenderingAttachmentInfo, RenderingInfo, SubpassContents,
},
device::Queue,
format::{ClearValue, Format},
format::{ClearColorValue, ClearValue, Format},
image::{Image, ImageCreateInfo, ImageType, ImageUsage, view::ImageView},
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter},
render_pass::{AttachmentLoadOp, AttachmentStoreOp},
@@ -128,6 +128,16 @@ impl WCommandBuffer<CmdBufXfer> {
Ok(image)
}
pub fn clear_image(&mut self, image: &Arc<Image>) -> anyhow::Result<()> {
let clear_info = ClearColorImageInfo {
clear_value: ClearColorValue::Uint([0, 0, 0, 0]),
..ClearColorImageInfo::image(image.clone())
};
self.command_buffer.clear_color_image(clear_info)?;
Ok(())
}
pub fn update_image(
&mut self,
image: &Arc<Image>,