Update wgpu to 0.14 and wgpu_glyph to 0.18

This commit is contained in:
Wyatt Herkamp 2022-10-07 09:03:41 -04:00 committed by Héctor Ramón Jiménez
parent ac6a3cf8eb
commit 0a12590b6f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 16 additions and 11 deletions

View file

@ -16,6 +16,7 @@ use winit::{
event_loop::{ControlFlow, EventLoop},
};
use crate::wgpu::CompositeAlphaMode;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::JsCast;
#[cfg(target_arch = "wasm32")]
@ -119,6 +120,7 @@ pub fn main() {
width: physical_size.width,
height: physical_size.height,
present_mode: wgpu::PresentMode::AutoVsync,
alpha_mode: CompositeAlphaMode::Auto,
},
);
@ -213,6 +215,7 @@ pub fn main() {
width: size.width,
height: size.height,
present_mode: wgpu::PresentMode::AutoVsync,
alpha_mode: CompositeAlphaMode::Auto
},
);

View file

@ -20,7 +20,7 @@ opengl = []
[dependencies]
glam = "0.10"
raw-window-handle = "0.4"
raw-window-handle = "0.5"
thiserror = "1.0"
[dependencies.bytemuck]

View file

@ -2,7 +2,7 @@
//! surfaces.
use crate::{Color, Error, Viewport};
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use thiserror::Error;
/// A graphics compositor that can draw to windows.
@ -17,7 +17,7 @@ pub trait Compositor: Sized {
type Surface;
/// Creates a new [`Compositor`].
fn new<W: HasRawWindowHandle>(
fn new<W: HasRawWindowHandle + HasRawDisplayHandle>(
settings: Self::Settings,
compatible_window: Option<&W>,
) -> Result<(Self, Self::Renderer), Error>;
@ -25,7 +25,7 @@ pub trait Compositor: Sized {
/// Crates a new [`Surface`] for the given window.
///
/// [`Surface`]: Self::Surface
fn create_surface<W: HasRawWindowHandle>(
fn create_surface<W: HasRawWindowHandle + HasRawDisplayHandle>(
&mut self,
window: &W,
) -> Self::Surface;

View file

@ -28,10 +28,10 @@ spirv = ["wgpu/spirv"]
webgl = ["wgpu/webgl"]
[dependencies]
wgpu = "0.13"
wgpu_glyph = "0.17"
wgpu = "0.14"
wgpu_glyph = "0.18"
glyph_brush = "0.7"
raw-window-handle = "0.4"
raw-window-handle = "0.5.0"
log = "0.4"
guillotiere = "0.6"
futures = "0.3"

View file

@ -4,9 +4,10 @@ use futures::stream::{self, StreamExt};
use iced_graphics::compositor;
use iced_native::futures;
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use std::marker::PhantomData;
use wgpu::CompositeAlphaMode;
/// A window graphics backend for iced powered by `wgpu`.
#[allow(missing_debug_implementations)]
@ -27,7 +28,7 @@ impl<Theme> Compositor<Theme> {
/// Requests a new [`Compositor`] with the given [`Settings`].
///
/// Returns `None` if no compatible graphics adapter could be found.
pub async fn request<W: HasRawWindowHandle>(
pub async fn request<W: HasRawWindowHandle + HasRawDisplayHandle>(
settings: Settings,
compatible_window: Option<&W>,
) -> Option<Self> {
@ -123,7 +124,7 @@ impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
type Renderer = Renderer<Theme>;
type Surface = wgpu::Surface;
fn new<W: HasRawWindowHandle>(
fn new<W: HasRawWindowHandle + HasRawDisplayHandle>(
settings: Self::Settings,
compatible_window: Option<&W>,
) -> Result<(Self, Self::Renderer), Error> {
@ -138,7 +139,7 @@ impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
Ok((compositor, Renderer::new(backend)))
}
fn create_surface<W: HasRawWindowHandle>(
fn create_surface<W: HasRawWindowHandle + HasRawDisplayHandle>(
&mut self,
window: &W,
) -> wgpu::Surface {
@ -162,6 +163,7 @@ impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
present_mode: self.settings.present_mode,
width,
height,
alpha_mode: CompositeAlphaMode::Auto,
},
);
}