diff --git a/code/beginner/tutorial6-uniforms/src/challenge.rs b/code/beginner/tutorial6-uniforms/src/challenge.rs index 3119be2c..9b3d2d21 100644 --- a/code/beginner/tutorial6-uniforms/src/challenge.rs +++ b/code/beginner/tutorial6-uniforms/src/challenge.rs @@ -52,7 +52,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -74,7 +74,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial6-uniforms/src/main.rs b/code/beginner/tutorial6-uniforms/src/main.rs index 41109af2..81a72286 100644 --- a/code/beginner/tutorial6-uniforms/src/main.rs +++ b/code/beginner/tutorial6-uniforms/src/main.rs @@ -52,7 +52,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -74,7 +74,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/examples/array_instances.rs b/code/beginner/tutorial7-instancing/examples/array_instances.rs index 6762c64d..3d6f2354 100644 --- a/code/beginner/tutorial7-instancing/examples/array_instances.rs +++ b/code/beginner/tutorial7-instancing/examples/array_instances.rs @@ -57,7 +57,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -79,7 +79,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/examples/naive.rs b/code/beginner/tutorial7-instancing/examples/naive.rs index 461b8dee..61158a8e 100644 --- a/code/beginner/tutorial7-instancing/examples/naive.rs +++ b/code/beginner/tutorial7-instancing/examples/naive.rs @@ -53,7 +53,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -75,7 +75,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/examples/storage_instances.rs b/code/beginner/tutorial7-instancing/examples/storage_instances.rs index ed9a16f4..1272ca7e 100644 --- a/code/beginner/tutorial7-instancing/examples/storage_instances.rs +++ b/code/beginner/tutorial7-instancing/examples/storage_instances.rs @@ -57,7 +57,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -79,7 +79,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/examples/texture_instances.rs b/code/beginner/tutorial7-instancing/examples/texture_instances.rs index 5e328822..08026540 100644 --- a/code/beginner/tutorial7-instancing/examples/texture_instances.rs +++ b/code/beginner/tutorial7-instancing/examples/texture_instances.rs @@ -61,7 +61,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -83,7 +83,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/examples/vertex_instances.rs b/code/beginner/tutorial7-instancing/examples/vertex_instances.rs index 0bcfd669..90520077 100644 --- a/code/beginner/tutorial7-instancing/examples/vertex_instances.rs +++ b/code/beginner/tutorial7-instancing/examples/vertex_instances.rs @@ -61,7 +61,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -83,7 +83,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/src/challenge.rs b/code/beginner/tutorial7-instancing/src/challenge.rs index 644d07b4..e9d0b840 100644 --- a/code/beginner/tutorial7-instancing/src/challenge.rs +++ b/code/beginner/tutorial7-instancing/src/challenge.rs @@ -53,7 +53,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -79,7 +79,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial7-instancing/src/main.rs b/code/beginner/tutorial7-instancing/src/main.rs index ca6a48c7..d5abbbb7 100644 --- a/code/beginner/tutorial7-instancing/src/main.rs +++ b/code/beginner/tutorial7-instancing/src/main.rs @@ -57,7 +57,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -83,7 +83,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial8-depth/src/challenge.rs b/code/beginner/tutorial8-depth/src/challenge.rs index 25105df2..28d50b20 100644 --- a/code/beginner/tutorial8-depth/src/challenge.rs +++ b/code/beginner/tutorial8-depth/src/challenge.rs @@ -65,7 +65,7 @@ const DEPTH_INDICES: &[u16] = &[ 0, 2, 3, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -93,7 +93,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial8-depth/src/main.rs b/code/beginner/tutorial8-depth/src/main.rs index 6cc8d217..68908e3f 100644 --- a/code/beginner/tutorial8-depth/src/main.rs +++ b/code/beginner/tutorial8-depth/src/main.rs @@ -53,7 +53,7 @@ const INDICES: &[u16] = &[ 2, 3, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -81,7 +81,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/beginner/tutorial9-models/src/main.rs b/code/beginner/tutorial9-models/src/main.rs index 56269d2c..fdbca4ab 100644 --- a/code/beginner/tutorial9-models/src/main.rs +++ b/code/beginner/tutorial9-models/src/main.rs @@ -10,7 +10,7 @@ mod texture; use model::{DrawModel, Vertex}; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -34,7 +34,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/intermediate/tutorial10-lighting/src/main.rs b/code/intermediate/tutorial10-lighting/src/main.rs index cebdcfda..7891c506 100644 --- a/code/intermediate/tutorial10-lighting/src/main.rs +++ b/code/intermediate/tutorial10-lighting/src/main.rs @@ -10,7 +10,7 @@ mod texture; use model::{DrawLight, DrawModel, Vertex}; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -34,7 +34,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/intermediate/tutorial11-normals/src/main.rs b/code/intermediate/tutorial11-normals/src/main.rs index 09c39fab..a02a8ce9 100644 --- a/code/intermediate/tutorial11-normals/src/main.rs +++ b/code/intermediate/tutorial11-normals/src/main.rs @@ -10,7 +10,7 @@ mod texture; use model::{DrawLight, DrawModel, Vertex}; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -34,7 +34,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/code/intermediate/tutorial12-camera/src/camera.rs b/code/intermediate/tutorial12-camera/src/camera.rs index 5d0a9cce..9751302b 100644 --- a/code/intermediate/tutorial12-camera/src/camera.rs +++ b/code/intermediate/tutorial12-camera/src/camera.rs @@ -4,7 +4,7 @@ use winit::dpi::LogicalPosition; use std::time::Duration; use std::f32::consts::FRAC_PI_2; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, diff --git a/code/research/camera/src/camera.rs b/code/research/camera/src/camera.rs index 792451e7..e235f511 100644 --- a/code/research/camera/src/camera.rs +++ b/code/research/camera/src/camera.rs @@ -4,7 +4,7 @@ use winit::event::*; use std::time::Duration; use std::f32::consts::FRAC_PI_2; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, diff --git a/code/research/performance/src/main.rs b/code/research/performance/src/main.rs index 9768262b..67ef1b16 100644 --- a/code/research/performance/src/main.rs +++ b/code/research/performance/src/main.rs @@ -14,7 +14,7 @@ mod texture; use model::{DrawLight, DrawModel, Vertex}; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -38,7 +38,7 @@ impl Camera { fn build_view_projection_matrix(&self) -> cgmath::Matrix4 { let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up); let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar); - return proj * view; + proj * view } } diff --git a/docs/beginner/tutorial2-swapchain/README.md b/docs/beginner/tutorial2-swapchain/README.md index 6d44ecc1..ce0be159 100644 --- a/docs/beginner/tutorial2-swapchain/README.md +++ b/docs/beginner/tutorial2-swapchain/README.md @@ -163,14 +163,18 @@ We call this method in `main()` in the event loop for the following events. match event { // ... - WindowEvent::Resized(physical_size) => { - state.resize(*physical_size); - } - WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { - // new_inner_size is &mut so w have to dereference it twice - state.resize(**new_inner_size); - } - // ... + } if window_id == window.id() => if !state.input(event) { + match event { + // ... + + WindowEvent::Resized(physical_size) => { + state.resize(*physical_size); + } + WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { + // new_inner_size is &mut so we have to dereference it twice + state.resize(**new_inner_size); + } + // ... } ``` diff --git a/docs/beginner/tutorial4-buffer/README.md b/docs/beginner/tutorial4-buffer/README.md index 722cca22..e133eccd 100644 --- a/docs/beginner/tutorial4-buffer/README.md +++ b/docs/beginner/tutorial4-buffer/README.md @@ -331,6 +331,7 @@ All we have to do now is update the `render()` method to use the `index_buffer`. ```rust // render() +render_pass.set_vertex_buffer(0, &self.vertex_buffer, 0, 0); render_pass.set_index_buffer(&self.index_buffer, 0, 0); // 1. render_pass.draw_indexed(0..self.num_indices, 0, 0..1); // 2. ``` diff --git a/docs/beginner/tutorial5-textures/README.md b/docs/beginner/tutorial5-textures/README.md index 71ef026a..2b1b48b6 100644 --- a/docs/beginner/tutorial5-textures/README.md +++ b/docs/beginner/tutorial5-textures/README.md @@ -60,10 +60,10 @@ let buffer = device.create_buffer_with_data( ); ``` -We specified our `diffuse_buffer` to be `COPY_SRC` so that we can copy it to our `diffuse_texture`. We preform the copy using a `CommandEncoder`. We'll need to change `queue`'s mutablility so we can submit the resulting `CommandBuffer`. +We specified our `diffuse_buffer` to be `COPY_SRC` so that we can copy it to our `diffuse_texture`. We preform the copy using a `CommandEncoder`. ```rust -let (device, mut queue) = // ... +let (device, queue) = // ... // ... @@ -467,7 +467,7 @@ impl Texture { ``` 1. We're using the [failure](https://docs.rs/failure/0.1.6/failure/) crate to simplify error handling. -2. In order to prevent importing `queue` as `&mut`, we're returning a `CommandBuffer` with our texture. This means we could load multiple textures at the same time, and then submit all there command buffers at once. +2. We're returning a `CommandBuffer` with our texture. This means we could load multiple textures at the same time, and then submit all there command buffers at once. We need to import `texture.rs` as a module, so somewhere at the top of `main.rs` add the following. diff --git a/docs/beginner/tutorial6-uniforms/README.md b/docs/beginner/tutorial6-uniforms/README.md index 7fc3c0f3..d699e5cb 100644 --- a/docs/beginner/tutorial6-uniforms/README.md +++ b/docs/beginner/tutorial6-uniforms/README.md @@ -38,7 +38,7 @@ The `build_view_projection_matrix` is where the magic happens. 3. The coordinate system in Wgpu is based on DirectX, and Metal's coordinate systems. That means that in [normalized device coordinates](https://github.com/gfx-rs/gfx/tree/master/src/backend/dx12#normalized-coordinates) the x axis and y axis are in the range of -1.0 to +1.0, and the z axis is 0.0 to +1.0. The `cgmath` crate (as well as most game math crates) are built for OpenGL's coordinate system. This matrix will scale and translate our scene from OpenGL's coordinate sytem to WGPU's. We'll define it as follows. ```rust -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, diff --git a/docs/beginner/tutorial7-instancing/README.md b/docs/beginner/tutorial7-instancing/README.md index 7118b8a0..d66e5f08 100644 --- a/docs/beginner/tutorial7-instancing/README.md +++ b/docs/beginner/tutorial7-instancing/README.md @@ -1,6 +1,6 @@ # Instancing -Up to this point we've been drawing just one object. Most games have hundreds of objects on screen at the same time. If we wanted to draw multiple instances of our model, we could copy the vertex buffer and modify it's vertices to be in the right place, but this would be hilariously inefficient. We have our model, and we now how to position it in 3d space with a matrix, like we did the camera, so all we have to do is change the matrix we're using when we draw. +Up to this point we've been drawing just one object. Most games have hundreds of objects on screen at the same time. If we wanted to draw multiple instances of our model, we could copy the vertex buffer and modify it's vertices to be in the right place, but this would be hilariously inefficient. We have our model, and we know how to position it in 3d space with a matrix, like we did the camera, so all we have to do is change the matrix we're using when we draw. ## The naive method @@ -253,7 +253,7 @@ This technique has its drawbacks. A storage buffer gives us the flexibility that arrays did not. We don't have to specify it's size in the shader, and we can even use a `Vec` to create it! -Since we're using `bytemuck` for casting our data to `&[u8]`, we're going to need to define a custom scruct to store the `cgmath::Matrix4`s. We need to do this because we can't implement `bytemuck::Pod`, and `bytemuck::Zeroable`, on `cgmath::Matrix4` because we don't that type. +Since we're using `bytemuck` for casting our data to `&[u8]`, we're going to need to define a custom scruct to store the `cgmath::Matrix4`s. We need to do this because we can't implement `bytemuck::Pod`, and `bytemuck::Zeroable`, on `cgmath::Matrix4` as it is an external type. ```rust // UPDATED! diff --git a/docs/intermediate/tutorial12-camera/README.md b/docs/intermediate/tutorial12-camera/README.md index 0bb29952..24ba794b 100644 --- a/docs/intermediate/tutorial12-camera/README.md +++ b/docs/intermediate/tutorial12-camera/README.md @@ -11,7 +11,7 @@ use winit::dpi::LogicalPosition; use std::time::Duration; use std::f32::consts::FRAC_PI_2; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, diff --git a/docs/showcase/windowless/README.md b/docs/showcase/windowless/README.md index 506f6cbf..d8b4afe7 100644 --- a/docs/showcase/windowless/README.md +++ b/docs/showcase/windowless/README.md @@ -19,7 +19,7 @@ let (device, queue) = adapter.request_device(&Default::default()).await; ## A triangle without a window -Now we've talked about not needing to see what the gpu is doing, but we do need to see the results at some point. If we look back to talking about the [swap chain](/beginner/tutorial2-swapchain/#render) we see that we use `swap_chain.get_next_texture()` to grab a texture to draw to. We'll skip that step by creating the texture ourselves. +Now we've talked about not needing to see what the gpu is doing, but we do need to see the results at some point. If we look back to talking about the [swap chain](/beginner/tutorial2-swapchain/#render) we see that we use `swap_chain.get_next_texture()` to grab a texture to draw to. We'll skip that step by creating the texture ourselves. One thing to note here is we need to specify `wgpu::TextureFormat::Rgba8UnormSrgb` to `format` instead of `wgpu::TextureFormat::Bgra8UnormSrgb` since PNG uses RGBA, not BGRA. ```rust let texture_size = 256u32; diff --git a/package-lock.json b/package-lock.json index 4c719618..49fa79f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3946,9 +3946,9 @@ "dev": true }, "elliptic": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", - "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", @@ -6463,9 +6463,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lodash._reinterpolate": {