Merge branch 'master' into text-editor

This commit is contained in:
Héctor Ramón Jiménez 2023-10-27 03:58:45 +02:00
commit 6582387579
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
109 changed files with 370 additions and 413 deletions

View file

@ -87,7 +87,7 @@ impl<T: bytemuck::Pod> Buffer<T> {
/// Clears any temporary data (i.e. offsets) from the buffer.
pub fn clear(&mut self) {
self.offsets.clear()
self.offsets.clear();
}
/// Returns the offset at `index`, if it exists.

View file

@ -12,7 +12,7 @@ pub fn convert(
let sampler = device.create_sampler(&wgpu::SamplerDescriptor {
label: Some("iced_wgpu.offscreen.sampler"),
..Default::default()
..wgpu::SamplerDescriptor::default()
});
//sampler in 0
@ -102,10 +102,10 @@ pub fn convert(
primitive: wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Cw,
..Default::default()
..wgpu::PrimitiveState::default()
},
depth_stencil: None,
multisample: Default::default(),
multisample: wgpu::MultisampleState::default(),
multiview: None,
});

View file

@ -480,7 +480,7 @@ impl Frame {
},
size: self.size,
}),
))
));
}
}
Buffer::Gradient(buffer) => {
@ -493,7 +493,7 @@ impl Frame {
},
size: self.size,
}),
))
));
}
}
}

View file

@ -86,7 +86,7 @@ impl Atlas {
entry
};
log::info!("Allocated atlas entry: {:?}", entry);
log::info!("Allocated atlas entry: {entry:?}");
// It is a webgpu requirement that:
// BufferCopyView.layout.bytes_per_row % wgpu::COPY_BYTES_PER_ROW_ALIGNMENT == 0
@ -104,7 +104,7 @@ impl Atlas {
padded_data[offset..offset + 4 * width as usize].copy_from_slice(
&data[row * 4 * width as usize..(row + 1) * 4 * width as usize],
)
);
}
match &entry {
@ -139,13 +139,13 @@ impl Atlas {
}
}
log::info!("Current atlas: {:?}", self);
log::info!("Current atlas: {self:?}");
Some(entry)
}
pub fn remove(&mut self, entry: &Entry) {
log::info!("Removing atlas entry: {:?}", entry);
log::info!("Removing atlas entry: {entry:?}");
match entry {
Entry::Contiguous(allocation) => {
@ -237,7 +237,7 @@ impl Atlas {
}));
}
}
_ => {}
Layer::Full => {}
}
}
@ -258,7 +258,7 @@ impl Atlas {
}
fn deallocate(&mut self, allocation: &Allocation) {
log::info!("Deallocating atlas: {:?}", allocation);
log::info!("Deallocating atlas: {allocation:?}");
match allocation {
Allocation::Full { layer } => {

View file

@ -152,7 +152,7 @@ impl Cache {
let allocation =
atlas.upload(device, encoder, width, height, &rgba)?;
log::debug!("allocating {} {}x{}", id, width, height);
log::debug!("allocating {id} {width}x{height}");
let _ = self.svg_hits.insert(id);
let _ = self.rasterized_hits.insert(key);

View file

@ -215,7 +215,7 @@ impl<'a> Layer<'a> {
translation,
primitive,
current_layer,
)
);
}
}
Primitive::Clip { bounds, content } => {

View file

@ -26,14 +26,8 @@
//missing_docs,
unsafe_code,
unused_results,
clippy::extra_unused_lifetimes,
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod layer;
pub mod primitive;

View file

@ -61,7 +61,7 @@ impl Pipeline {
self.renderers.push(glyphon::TextRenderer::new(
&mut self.atlas,
device,
Default::default(),
wgpu::MultisampleState::default(),
None,
));
}

View file

@ -329,12 +329,12 @@ impl Pipeline {
fn fragment_target(
texture_format: wgpu::TextureFormat,
) -> Option<wgpu::ColorTargetState> {
Some(wgpu::ColorTargetState {
) -> wgpu::ColorTargetState {
wgpu::ColorTargetState {
format: texture_format,
blend: Some(wgpu::BlendState::ALPHA_BLENDING),
write_mask: wgpu::ColorWrites::ALL,
})
}
}
fn primitive_state() -> wgpu::PrimitiveState {
@ -349,7 +349,7 @@ fn multisample_state(
antialiasing: Option<Antialiasing>,
) -> wgpu::MultisampleState {
wgpu::MultisampleState {
count: antialiasing.map(|a| a.sample_count()).unwrap_or(1),
count: antialiasing.map(Antialiasing::sample_count).unwrap_or(1),
mask: !0,
alpha_to_coverage_enabled: false,
}
@ -521,7 +521,7 @@ mod solid {
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "solid_fs_main",
targets: &[triangle::fragment_target(format)],
targets: &[Some(triangle::fragment_target(format))],
}),
primitive: triangle::primitive_state(),
depth_stencil: None,
@ -698,7 +698,7 @@ mod gradient {
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "gradient_fs_main",
targets: &[triangle::fragment_target(format)],
targets: &[Some(triangle::fragment_target(format))],
}),
primitive: triangle::primitive_state(),
depth_stencil: None,

View file

@ -35,7 +35,7 @@ impl<Theme> Compositor<Theme> {
..Default::default()
});
log::info!("{:#?}", settings);
log::info!("{settings:#?}");
#[cfg(not(target_arch = "wasm32"))]
if log::max_level() >= log::LevelFilter::Info {
@ -43,7 +43,7 @@ impl<Theme> Compositor<Theme> {
.enumerate_adapters(settings.internal_backend)
.map(|adapter| adapter.get_info())
.collect();
log::info!("Available adapters: {:#?}", available_adapters);
log::info!("Available adapters: {available_adapters:#?}");
}
#[allow(unsafe_code)]
@ -83,7 +83,7 @@ impl<Theme> Compositor<Theme> {
})
})?;
log::info!("Selected format: {:?}", format);
log::info!("Selected format: {format:?}");
#[cfg(target_arch = "wasm32")]
let limits = [wgpu::Limits::downlevel_webgl2_defaults()