Skip to content

Commit 2da9fdc

Browse files
committed
Remove adapter argument introduced to Backend in iced_wgpu
1 parent c1f41a4 commit 2da9fdc

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

examples/integration/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
8787
});
8888
let surface = instance.create_surface(window.clone())?;
8989

90-
let (format, adapter, device, queue) =
90+
let (format, _adapter, device, queue) =
9191
futures::futures::executor::block_on(async {
9292
let adapter = wgpu::util::initialize_adapter_from_env_or_default(
9393
&instance,
@@ -157,7 +157,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
157157
// Initialize iced
158158
let mut debug = Debug::new();
159159
let mut renderer = Renderer::new(
160-
Backend::new(&adapter, &device, &queue, Settings::default(), format),
160+
Backend::new(&device, &queue, Settings::default(), format),
161161
Font::default(),
162162
Pixels(16.0),
163163
);

wgpu/src/backend.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub struct Backend {
3434
impl Backend {
3535
/// Creates a new [`Backend`].
3636
pub fn new(
37-
_adapter: &wgpu::Adapter,
3837
device: &wgpu::Device,
3938
queue: &wgpu::Queue,
4039
settings: Settings,
@@ -46,11 +45,7 @@ impl Backend {
4645
triangle::Pipeline::new(device, format, settings.antialiasing);
4746

4847
#[cfg(any(feature = "image", feature = "svg"))]
49-
let image_pipeline = {
50-
let backend = _adapter.get_info().backend;
51-
52-
image::Pipeline::new(device, format, backend)
53-
};
48+
let image_pipeline = image::Pipeline::new(device, format);
5449

5550
Self {
5651
quad_pipeline,

wgpu/src/image.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,7 @@ impl Data {
176176
}
177177

178178
impl Pipeline {
179-
pub fn new(
180-
device: &wgpu::Device,
181-
format: wgpu::TextureFormat,
182-
backend: wgpu::Backend,
183-
) -> Self {
179+
pub fn new(device: &wgpu::Device, format: wgpu::TextureFormat) -> Self {
184180
let nearest_sampler = device.create_sampler(&wgpu::SamplerDescriptor {
185181
address_mode_u: wgpu::AddressMode::ClampToEdge,
186182
address_mode_v: wgpu::AddressMode::ClampToEdge,
@@ -322,7 +318,7 @@ impl Pipeline {
322318
multiview: None,
323319
});
324320

325-
let texture_atlas = Atlas::new(device, backend);
321+
let texture_atlas = Atlas::new(device);
326322

327323
let texture = device.create_bind_group(&wgpu::BindGroupDescriptor {
328324
label: Some("iced_wgpu::image texture atlas bind group"),

wgpu/src/image/atlas.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ pub struct Atlas {
2323
}
2424

2525
impl Atlas {
26-
pub fn new(device: &wgpu::Device, backend: wgpu::Backend) -> Self {
27-
let layers = match backend {
28-
// On the GL backend we start with 2 layers, to help wgpu figure
29-
// out that this texture is `GL_TEXTURE_2D_ARRAY` rather than `GL_TEXTURE_2D`
30-
// https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371
31-
wgpu::Backend::Gl => vec![Layer::Empty, Layer::Empty],
32-
_ => vec![Layer::Empty],
33-
};
26+
pub fn new(device: &wgpu::Device) -> Self {
27+
// On the GL backend we start with 2 layers, to help wgpu figure
28+
// out that this texture is `GL_TEXTURE_2D_ARRAY` rather than `GL_TEXTURE_2D`
29+
// https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371
30+
let layers = vec![Layer::Empty, Layer::Empty];
3431

3532
let extent = wgpu::Extent3d {
3633
width: SIZE,

wgpu/src/window/compositor.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,7 @@ impl Compositor {
146146

147147
/// Creates a new rendering [`Backend`] for this [`Compositor`].
148148
pub fn create_backend(&self) -> Backend {
149-
Backend::new(
150-
&self.adapter,
151-
&self.device,
152-
&self.queue,
153-
self.settings,
154-
self.format,
155-
)
149+
Backend::new(&self.device, &self.queue, self.settings, self.format)
156150
}
157151
}
158152

0 commit comments

Comments
 (0)