Update to wgpu 0.13

This commit is contained in:
grovesNL 2022-07-13 09:34:49 -02:30 committed by Josh Groves
parent bbc5f18cdd
commit 3c7789cd3b
3 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ repository = "https://github.com/grovesNL/glyphon"
license = "MIT OR Apache-2.0 OR Zlib" license = "MIT OR Apache-2.0 OR Zlib"
[dependencies] [dependencies]
wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "8e62ca0" } wgpu = "0.13.1"
fontdue = "0.7.2" fontdue = "0.7.2"
etagere = "0.2.6" etagere = "0.2.6"

View file

@ -56,7 +56,7 @@ async fn run() {
let window = Window::new(&event_loop).unwrap(); let window = Window::new(&event_loop).unwrap();
let surface = unsafe { instance.create_surface(&window) }; let surface = unsafe { instance.create_surface(&window) };
let size = window.inner_size(); let size = window.inner_size();
let swapchain_format = surface.get_preferred_format(&adapter).unwrap(); let swapchain_format = surface.get_supported_formats(&adapter)[0];
let mut config = SurfaceConfiguration { let mut config = SurfaceConfiguration {
usage: TextureUsages::RENDER_ATTACHMENT, usage: TextureUsages::RENDER_ATTACHMENT,
format: swapchain_format, format: swapchain_format,
@ -127,14 +127,14 @@ async fn run() {
{ {
let mut pass = encoder.begin_render_pass(&RenderPassDescriptor { let mut pass = encoder.begin_render_pass(&RenderPassDescriptor {
label: None, label: None,
color_attachments: &[RenderPassColorAttachment { color_attachments: &[Some(RenderPassColorAttachment {
view: &view, view: &view,
resolve_target: None, resolve_target: None,
ops: Operations { ops: Operations {
load: LoadOp::Clear(wgpu::Color::BLACK), load: LoadOp::Clear(wgpu::Color::BLACK),
store: true, store: true,
}, },
}], })],
depth_stencil_attachment: None, depth_stencil_attachment: None,
}); });

View file

@ -170,7 +170,7 @@ impl TextAtlas {
let glyph_cache = RecentlyUsedMap::new(); let glyph_cache = RecentlyUsedMap::new();
// Create a render pipeline to use for rendering later // Create a render pipeline to use for rendering later
let shader = device.create_shader_module(&ShaderModuleDescriptor { let shader = device.create_shader_module(ShaderModuleDescriptor {
label: Some("glyphon shader"), label: Some("glyphon shader"),
source: ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), source: ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))),
}); });
@ -285,11 +285,11 @@ impl TextAtlas {
fragment: Some(FragmentState { fragment: Some(FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: "fs_main",
targets: &[ColorTargetState { targets: &[Some(ColorTargetState {
format, format,
blend: Some(BlendState::PREMULTIPLIED_ALPHA_BLENDING), blend: Some(BlendState::PREMULTIPLIED_ALPHA_BLENDING),
write_mask: ColorWrites::default(), write_mask: ColorWrites::default(),
}], })],
}), }),
primitive: PrimitiveState::default(), primitive: PrimitiveState::default(),
depth_stencil: None, depth_stencil: None,