chore: update to wgpu 28 and cosmic-text 0.19
This commit is contained in:
parent
aa2a870c35
commit
90d2c418a7
17 changed files with 113 additions and 185 deletions
|
|
@ -63,7 +63,6 @@ impl<T: bytemuck::Pod> Buffer<T> {
|
|||
/// Returns the size of the written bytes.
|
||||
pub fn write(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut wgpu::CommandEncoder,
|
||||
belt: &mut wgpu::util::StagingBelt,
|
||||
offset: usize,
|
||||
|
|
@ -79,7 +78,6 @@ impl<T: bytemuck::Pod> Buffer<T> {
|
|||
&self.raw,
|
||||
(offset + bytes_written) as u64,
|
||||
MAX_WRITE_SIZE_U64,
|
||||
device,
|
||||
)
|
||||
.copy_from_slice(
|
||||
&bytes[bytes_written..bytes_written + MAX_WRITE_SIZE],
|
||||
|
|
@ -100,7 +98,6 @@ impl<T: bytemuck::Pod> Buffer<T> {
|
|||
&self.raw,
|
||||
(offset + bytes_written) as u64,
|
||||
bytes_left,
|
||||
device,
|
||||
)
|
||||
.copy_from_slice(&bytes[bytes_written..]);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ pub fn convert(
|
|||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu.offscreen.blit.pipeline_layout"),
|
||||
bind_group_layouts: &[&constant_layout, &texture_layout],
|
||||
push_constant_ranges: &[],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
||||
|
|
@ -149,7 +149,7 @@ pub fn convert(
|
|||
},
|
||||
depth_stencil: None,
|
||||
multisample: wgpu::MultisampleState::default(),
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
});
|
||||
|
||||
|
|
@ -194,6 +194,7 @@ pub fn convert(
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
});
|
||||
|
||||
pass.set_pipeline(&pipeline);
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ impl Atlas {
|
|||
match &entry {
|
||||
Entry::Contiguous(allocation) => {
|
||||
self.upload_allocation(
|
||||
pixels, width, 0, allocation, device, encoder, belt,
|
||||
pixels, width, 0, allocation, encoder, belt,
|
||||
);
|
||||
}
|
||||
Entry::Fragmented { fragments, .. } => {
|
||||
|
|
@ -145,7 +145,6 @@ impl Atlas {
|
|||
width,
|
||||
offset,
|
||||
&fragment.allocation,
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
);
|
||||
|
|
@ -312,7 +311,6 @@ impl Atlas {
|
|||
image_width: u32,
|
||||
offset: usize,
|
||||
allocation: &Allocation,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut wgpu::CommandEncoder,
|
||||
belt: &mut wgpu::util::StagingBelt,
|
||||
) {
|
||||
|
|
@ -334,7 +332,6 @@ impl Atlas {
|
|||
let buffer_slice = belt.allocate(
|
||||
wgpu::BufferSize::new(total_bytes as u64).unwrap(),
|
||||
wgpu::BufferSize::new(8 * 4).unwrap(),
|
||||
device,
|
||||
);
|
||||
|
||||
const PIXEL: usize = 4;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ impl Cache {
|
|||
raster: Raster {
|
||||
cache: crate::image::raster::Cache::default(),
|
||||
pending: HashMap::new(),
|
||||
belt: wgpu::util::StagingBelt::new(2 * 1024 * 1024),
|
||||
belt: wgpu::util::StagingBelt::new(
|
||||
device.clone(),
|
||||
2 * 1024 * 1024,
|
||||
),
|
||||
},
|
||||
#[cfg(feature = "svg")]
|
||||
vector: crate::image::vector::Cache::default(),
|
||||
|
|
@ -451,7 +454,10 @@ mod worker {
|
|||
backend,
|
||||
texture_layout,
|
||||
shell: shell.clone(),
|
||||
belt: wgpu::util::StagingBelt::new(4 * 1024 * 1024),
|
||||
belt: wgpu::util::StagingBelt::new(
|
||||
device.clone(),
|
||||
4 * 1024 * 1024,
|
||||
),
|
||||
jobs: jobs_receiver,
|
||||
output: work_sender,
|
||||
quit: quit_receiver,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ impl Pipeline {
|
|||
address_mode_w: wgpu::AddressMode::ClampToEdge,
|
||||
min_filter: wgpu::FilterMode::Nearest,
|
||||
mag_filter: wgpu::FilterMode::Nearest,
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
mipmap_filter: wgpu::MipmapFilterMode::Nearest,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ impl Pipeline {
|
|||
address_mode_w: wgpu::AddressMode::ClampToEdge,
|
||||
min_filter: wgpu::FilterMode::Linear,
|
||||
mag_filter: wgpu::FilterMode::Linear,
|
||||
mipmap_filter: wgpu::FilterMode::Linear,
|
||||
mipmap_filter: wgpu::MipmapFilterMode::Linear,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ impl Pipeline {
|
|||
let layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu::image pipeline layout"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[&constant_layout, &texture_layout],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
let shader =
|
||||
|
|
@ -191,7 +191,7 @@ impl Pipeline {
|
|||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
});
|
||||
|
||||
|
|
@ -528,7 +528,6 @@ impl Layer {
|
|||
&self.uniforms,
|
||||
0,
|
||||
(bytes.len() as u64).try_into().expect("Sized uniforms"),
|
||||
device,
|
||||
)
|
||||
.copy_from_slice(bytes);
|
||||
|
||||
|
|
@ -539,11 +538,11 @@ impl Layer {
|
|||
let mut offset = 0;
|
||||
|
||||
if !nearest.is_empty() {
|
||||
offset += self.instances.write(device, encoder, belt, 0, nearest);
|
||||
offset += self.instances.write(encoder, belt, 0, nearest);
|
||||
}
|
||||
|
||||
if !linear.is_empty() {
|
||||
let _ = self.instances.write(device, encoder, belt, offset, linear);
|
||||
let _ = self.instances.write(encoder, belt, offset, linear);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ impl Renderer {
|
|||
// It would be great if the `StagingBelt` API exposed methods
|
||||
// for introspection to detect when a resize may be worth it.
|
||||
staging_belt: wgpu::util::StagingBelt::new(
|
||||
engine.device.clone(),
|
||||
buffer::MAX_WRITE_SIZE as u64,
|
||||
),
|
||||
|
||||
|
|
@ -454,6 +455,7 @@ impl Renderer {
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
},
|
||||
));
|
||||
|
||||
|
|
@ -528,6 +530,7 @@ impl Renderer {
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
|
@ -621,6 +624,7 @@ impl Renderer {
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ impl Layer {
|
|||
transformation: Transformation,
|
||||
scale: f32,
|
||||
) {
|
||||
self.update(device, encoder, belt, transformation, scale);
|
||||
self.update(encoder, belt, transformation, scale);
|
||||
|
||||
if !quads.solids.is_empty() {
|
||||
self.solid.prepare(device, encoder, belt, &quads.solids);
|
||||
|
|
@ -223,7 +223,6 @@ impl Layer {
|
|||
|
||||
pub fn update(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut wgpu::CommandEncoder,
|
||||
belt: &mut wgpu::util::StagingBelt,
|
||||
transformation: Transformation,
|
||||
|
|
@ -237,7 +236,6 @@ impl Layer {
|
|||
&self.constants_buffer,
|
||||
0,
|
||||
(bytes.len() as u64).try_into().expect("Sized uniforms"),
|
||||
device,
|
||||
)
|
||||
.copy_from_slice(bytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl Layer {
|
|||
instances: &[Gradient],
|
||||
) {
|
||||
let _ = self.instances.resize(device, instances.len());
|
||||
let _ = self.instances.write(device, encoder, belt, 0, instances);
|
||||
let _ = self.instances.write(encoder, belt, 0, instances);
|
||||
|
||||
self.instance_count = instances.len();
|
||||
}
|
||||
|
|
@ -75,8 +75,8 @@ impl Pipeline {
|
|||
let layout = device.create_pipeline_layout(
|
||||
&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu.quad.gradient.pipeline"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[constants_layout],
|
||||
immediate_size: 0,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ impl Pipeline {
|
|||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ impl Layer {
|
|||
instances: &[Solid],
|
||||
) {
|
||||
let _ = self.instances.resize(device, instances.len());
|
||||
let _ = self.instances.write(device, encoder, belt, 0, instances);
|
||||
let _ = self.instances.write(encoder, belt, 0, instances);
|
||||
|
||||
self.instance_count = instances.len();
|
||||
}
|
||||
|
|
@ -65,8 +65,8 @@ impl Pipeline {
|
|||
let layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu.quad.solid.pipeline"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[constants_layout],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
let shader =
|
||||
|
|
@ -139,7 +139,7 @@ impl Pipeline {
|
|||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ fn prepare(
|
|||
)?;
|
||||
|
||||
Some(cryoglyph::TextArea {
|
||||
buffer,
|
||||
text: buffer.layout_runs(),
|
||||
left: position.x,
|
||||
top: position.y,
|
||||
scale: transformation.scale_factor()
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ fn render<'a>(
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
})
|
||||
};
|
||||
|
||||
|
|
@ -425,18 +426,13 @@ impl Layer {
|
|||
|
||||
let indices = mesh.indices();
|
||||
|
||||
index_offset += self.index_buffer.write(
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
index_offset,
|
||||
indices,
|
||||
);
|
||||
index_offset +=
|
||||
self.index_buffer
|
||||
.write(encoder, belt, index_offset, indices);
|
||||
|
||||
match mesh {
|
||||
Mesh::Solid { buffers, .. } => {
|
||||
solid_vertex_offset += self.solid.vertices.write(
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
solid_vertex_offset,
|
||||
|
|
@ -444,16 +440,14 @@ impl Layer {
|
|||
);
|
||||
|
||||
solid_uniform_offset += self.solid.uniforms.write(
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
solid_uniform_offset,
|
||||
&[uniforms],
|
||||
);
|
||||
)
|
||||
}
|
||||
Mesh::Gradient { buffers, .. } => {
|
||||
gradient_vertex_offset += self.gradient.vertices.write(
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
gradient_vertex_offset,
|
||||
|
|
@ -461,7 +455,6 @@ impl Layer {
|
|||
);
|
||||
|
||||
gradient_uniform_offset += self.gradient.uniforms.write(
|
||||
device,
|
||||
encoder,
|
||||
belt,
|
||||
gradient_uniform_offset,
|
||||
|
|
@ -731,7 +724,7 @@ mod solid {
|
|||
&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu.triangle.solid.pipeline_layout"),
|
||||
bind_group_layouts: &[&constants_layout],
|
||||
push_constant_ranges: &[],
|
||||
immediate_size: 0,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -784,7 +777,7 @@ mod solid {
|
|||
primitive: triangle::primitive_state(),
|
||||
depth_stencil: None,
|
||||
multisample: triangle::multisample_state(antialiasing),
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
},
|
||||
);
|
||||
|
|
@ -886,7 +879,7 @@ mod gradient {
|
|||
&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu.triangle.gradient.pipeline_layout"),
|
||||
bind_group_layouts: &[&constants_layout],
|
||||
push_constant_ranges: &[],
|
||||
immediate_size: 0,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -949,7 +942,7 @@ mod gradient {
|
|||
primitive: triangle::primitive_state(),
|
||||
depth_stencil: None,
|
||||
multisample: triangle::multisample_state(antialiasing),
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ impl Pipeline {
|
|||
let layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("iced_wgpu::triangle::msaa pipeline layout"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[&constant_layout, &texture_layout],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
let shader =
|
||||
|
|
@ -116,7 +116,7 @@ impl Pipeline {
|
|||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
multiview_mask: None,
|
||||
cache: None,
|
||||
});
|
||||
|
||||
|
|
@ -177,6 +177,7 @@ impl Pipeline {
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -320,7 +321,6 @@ impl State {
|
|||
0,
|
||||
NonZeroU64::new(std::mem::size_of::<Ratio>() as u64)
|
||||
.expect("non-empty ratio"),
|
||||
device,
|
||||
)
|
||||
.copy_from_slice(bytemuck::bytes_of(&ratio));
|
||||
|
||||
|
|
@ -351,6 +351,7 @@ impl State {
|
|||
depth_stencil_attachment: None,
|
||||
timestamp_writes: None,
|
||||
occlusion_query_set: None,
|
||||
multiview_mask: None,
|
||||
});
|
||||
|
||||
render_pass.set_pipeline(&pipeline.raw);
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ impl Compositor {
|
|||
// if log::max_level() >= log::LevelFilter::Info {
|
||||
// let available_adapters: Vec<_> = instance
|
||||
// .enumerate_adapters(settings.backends)
|
||||
// .await
|
||||
// .iter()
|
||||
// .map(wgpu::Adapter::get_info)
|
||||
// .collect();
|
||||
|
|
@ -155,6 +156,7 @@ impl Compositor {
|
|||
if let Some((vendor_id, device_id)) = ids {
|
||||
adapter = instance
|
||||
.enumerate_adapters(settings.backends)
|
||||
.await
|
||||
.into_iter()
|
||||
.filter(|adapter| {
|
||||
let info = adapter.get_info();
|
||||
|
|
@ -172,6 +174,7 @@ impl Compositor {
|
|||
} else if let Ok(name) = std::env::var("WGPU_ADAPTER_NAME") {
|
||||
adapter = instance
|
||||
.enumerate_adapters(settings.backends)
|
||||
.await
|
||||
.into_iter()
|
||||
.filter(|adapter| {
|
||||
let info = adapter.get_info();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue