outline schtuff
Some checks failed
Format / all (push) Has been cancelled
Lint / all (push) Has been cancelled
Test / all (macOS-latest, beta) (push) Has been cancelled
Test / all (macOS-latest, stable) (push) Has been cancelled
Test / all (ubuntu-latest, beta) (push) Has been cancelled
Test / all (ubuntu-latest, stable) (push) Has been cancelled
Test / all (windows-latest, beta) (push) Has been cancelled
Test / all (windows-latest, stable) (push) Has been cancelled

This commit is contained in:
Chris Cochrun 2025-07-10 17:07:22 -05:00
parent da3b02cf8a
commit 7e2b1612b9
5 changed files with 216 additions and 68 deletions

View file

@ -244,6 +244,7 @@ pub enum ColorMode {
pub struct TextAtlas {
cache: Cache,
pub(crate) bind_group: BindGroup,
pub(crate) stroke_bind_group: BindGroup,
pub(crate) color_atlas: InnerAtlas,
pub(crate) mask_atlas: InnerAtlas,
pub(crate) format: TextureFormat,
@ -282,9 +283,34 @@ impl TextAtlas {
&mask_atlas.texture_view,
);
// stroke color buffer
let stroke_color_buffer = device.create_buffer(&wgpu::BufferDescriptor {
label: Some("Stroke Color Buffer"),
size: 16,
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
// stroke width buffer
let stroke_width_buffer = device.create_buffer(&wgpu::BufferDescriptor {
label: Some("Stroke Width Buffer"),
size: 4,
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
let stroke_bind_group = cache.create_stroke_bind_group(
device,
&mask_atlas.texture_view,
&stroke_color_buffer,
&stroke_width_buffer,
);
Self {
cache: cache.clone(),
bind_group,
stroke_bind_group,
color_atlas,
mask_atlas,
format,
@ -334,6 +360,16 @@ impl TextAtlas {
.get_or_create_pipeline(device, self.format, multisample, depth_stencil)
}
pub(crate) fn get_or_create_stroke_pipeline(
&self,
device: &Device,
multisample: MultisampleState,
depth_stencil: Option<DepthStencilState>,
) -> RenderPipeline {
self.cache
.get_or_create_stroke_pipeline(device, self.format, multisample, depth_stencil)
}
fn rebind(&mut self, device: &wgpu::Device) {
self.bind_group = self.cache.create_atlas_bind_group(
device,