From 97359042dbedc2bf5a9a4f2637637cb6f799c11a Mon Sep 17 00:00:00 2001 From: Imbris Date: Wed, 31 Mar 2021 20:25:34 -0400 Subject: [PATCH] Update wgpu --- Cargo.lock | 58 ++++++++++----------- Cargo.toml | 2 +- voxygen/src/render/pipelines/lod_terrain.rs | 2 +- voxygen/src/render/pipelines/shadow.rs | 2 +- voxygen/src/render/pipelines/sprite.rs | 2 +- voxygen/src/render/renderer.rs | 16 +++--- voxygen/src/render/renderer/drawer.rs | 40 +++++++------- voxygen/src/render/renderer/screenshot.rs | 12 ++--- voxygen/src/render/texture.rs | 21 ++++---- voxygen/src/scene/terrain.rs | 2 +- 10 files changed, 79 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c7c23c3d1..0dcb2fea1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1889,7 +1889,7 @@ dependencies = [ [[package]] name = "gfx-auxil" version = "0.8.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "fxhash", "gfx-hal", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "arrayvec", "bitflags", @@ -1920,7 +1920,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "arrayvec", "bit-set", @@ -1941,7 +1941,7 @@ dependencies = [ [[package]] name = "gfx-backend-empty" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "gfx-hal", "log", @@ -1951,7 +1951,7 @@ dependencies = [ [[package]] name = "gfx-backend-gl" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "arrayvec", "bitflags", @@ -1974,7 +1974,7 @@ dependencies = [ [[package]] name = "gfx-backend-metal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "arrayvec", "bitflags", @@ -1999,7 +1999,7 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "arrayvec", "ash", @@ -2019,7 +2019,7 @@ dependencies = [ [[package]] name = "gfx-hal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" dependencies = [ "bitflags", "naga", @@ -2620,9 +2620,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" dependencies = [ "wasm-bindgen", ] @@ -3066,7 +3066,7 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" [[package]] name = "naga" version = "0.3.1" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-15#196523de7820d4907a14bd22517c4d572d26b0be" +source = "git+https://github.com/gfx-rs/naga?tag=gfx-18#e87f57d82c44b12fe0288d876b050e9ddd1d6e1b" dependencies = [ "bit-set", "bitflags", @@ -4159,7 +4159,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.2" -source = "git+https://github.com/gfx-rs/gfx?rev=2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45#2125c1d96b09f97faaa0d7a8a0d1c5315acc8c45" +source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" [[package]] name = "raw-window-handle" @@ -6183,9 +6183,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -6193,9 +6193,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ "bumpalo", "lazy_static", @@ -6208,9 +6208,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" +checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -6220,9 +6220,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" dependencies = [ "quote 1.0.9", "wasm-bindgen-macro-support", @@ -6230,9 +6230,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" dependencies = [ "proc-macro2 1.0.26", "quote 1.0.9", @@ -6243,9 +6243,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" [[package]] name = "wasmer" @@ -6590,9 +6590,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" dependencies = [ "js-sys", "wasm-bindgen", @@ -6621,7 +6621,7 @@ dependencies = [ [[package]] name = "wgpu" version = "0.7.0" -source = "git+https://github.com/gfx-rs/wgpu-rs.git?rev=a7e03546c1584cefef5b926f923108ea2cd1c146#a7e03546c1584cefef5b926f923108ea2cd1c146" +source = "git+https://github.com/gfx-rs/wgpu-rs.git?rev=c5ee9cd98310aee66fb49bc98f4f65590304e4aa#c5ee9cd98310aee66fb49bc98f4f65590304e4aa" dependencies = [ "arrayvec", "js-sys", @@ -6640,7 +6640,7 @@ dependencies = [ [[package]] name = "wgpu-core" version = "0.7.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=2f3b398e3887a336c963c43e7954f94cae42dd31#2f3b398e3887a336c963c43e7954f94cae42dd31" +source = "git+https://github.com/gfx-rs/wgpu?rev=b7ba481a9170e5b9c6364b2eb16080e527462039#b7ba481a9170e5b9c6364b2eb16080e527462039" dependencies = [ "arrayvec", "bitflags", @@ -6679,7 +6679,7 @@ dependencies = [ [[package]] name = "wgpu-types" version = "0.7.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=2f3b398e3887a336c963c43e7954f94cae42dd31#2f3b398e3887a336c963c43e7954f94cae42dd31" +source = "git+https://github.com/gfx-rs/wgpu?rev=b7ba481a9170e5b9c6364b2eb16080e527462039#b7ba481a9170e5b9c6364b2eb16080e527462039" dependencies = [ "bitflags", ] diff --git a/Cargo.toml b/Cargo.toml index 92bdb4a46c..9668b739b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,7 +111,7 @@ nativeBuildInputs = ["pkg-config"] winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" } vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics2" } # patch wgpu so we can use wgpu-profiler crate -wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "a7e03546c1584cefef5b926f923108ea2cd1c146" } +wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "c5ee9cd98310aee66fb49bc98f4f65590304e4aa" } # # Uncomment this to use a local fork of wgpu (for testing purposes) # [patch.'https://github.com/gfx-rs/wgpu'] diff --git a/voxygen/src/render/pipelines/lod_terrain.rs b/voxygen/src/render/pipelines/lod_terrain.rs index e3effc8334..6e903741ec 100644 --- a/voxygen/src/render/pipelines/lod_terrain.rs +++ b/voxygen/src/render/pipelines/lod_terrain.rs @@ -100,7 +100,7 @@ impl LodData { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; diff --git a/voxygen/src/render/pipelines/shadow.rs b/voxygen/src/render/pipelines/shadow.rs index 88cce391c3..b83da71316 100644 --- a/voxygen/src/render/pipelines/shadow.rs +++ b/voxygen/src/render/pipelines/shadow.rs @@ -111,7 +111,7 @@ pub fn create_col_lights( dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; diff --git a/voxygen/src/render/pipelines/sprite.rs b/voxygen/src/render/pipelines/sprite.rs index 21dd521405..2cf3dddacc 100644 --- a/voxygen/src/render/pipelines/sprite.rs +++ b/voxygen/src/render/pipelines/sprite.rs @@ -136,7 +136,7 @@ pub fn create_verts_buffer(renderer: &mut Renderer, mut mesh: Mesh) -> B dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index 473640823a..0d9d30f492 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -547,7 +547,7 @@ impl Renderer { // TODO: why is this not Color? aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }) @@ -575,7 +575,7 @@ impl Renderer { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }); @@ -600,7 +600,7 @@ impl Renderer { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }); @@ -635,7 +635,7 @@ impl Renderer { dimension: Some(view_dim), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; @@ -666,8 +666,8 @@ impl Renderer { encoder.begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("Clear dummy shadow texture"), color_attachments: &[], - depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &tex.view, + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: &tex.view, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: true, @@ -762,7 +762,7 @@ impl Renderer { dimension: Some(wgpu::TextureViewDimension::Cube), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; @@ -787,7 +787,7 @@ impl Renderer { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; diff --git a/voxygen/src/render/renderer/drawer.rs b/voxygen/src/render/renderer/drawer.rs index 2a9f3a83be..f73fbaccac 100644 --- a/voxygen/src/render/renderer/drawer.rs +++ b/voxygen/src/render/renderer/drawer.rs @@ -93,8 +93,8 @@ impl<'frame> Drawer<'frame> { label: Some("shadow pass"), color_attachments: &[], depth_stencil_attachment: Some( - wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &shadow_renderer.directed_depth.view, + wgpu::RenderPassDepthStencilAttachment { + view: &shadow_renderer.directed_depth.view, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: true, @@ -122,16 +122,16 @@ impl<'frame> Drawer<'frame> { let mut render_pass = encoder.scoped_render_pass("first_pass", device, &wgpu::RenderPassDescriptor { label: Some("first pass"), - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { - attachment: &self.borrow.views.tgt_color, + color_attachments: &[wgpu::RenderPassColorAttachment { + view: &self.borrow.views.tgt_color, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), store: true, }, }], - depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &self.borrow.views.tgt_depth, + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: &self.borrow.views.tgt_depth, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(0.0), store: true, @@ -156,8 +156,8 @@ impl<'frame> Drawer<'frame> { let mut render_pass = encoder.scoped_render_pass("second_pass", device, &wgpu::RenderPassDescriptor { label: Some("second pass (clouds)"), - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { - attachment: &self.borrow.views.tgt_color_pp, + color_attachments: &[wgpu::RenderPassColorAttachment { + view: &self.borrow.views.tgt_color_pp, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), @@ -182,10 +182,10 @@ impl<'frame> Drawer<'frame> { let mut render_pass = encoder.scoped_render_pass("third_pass", device, &wgpu::RenderPassDescriptor { label: Some("third pass (postprocess + ui)"), - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { + color_attachments: &[wgpu::RenderPassColorAttachment { // If a screenshot was requested render to that as an intermediate texture // instead - attachment: self + view: self .taking_screenshot .as_ref() .map_or(&self.swap_tex.view, |s| s.texture_view()), @@ -234,7 +234,7 @@ impl<'frame> Drawer<'frame> { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: face, array_layer_count: NonZeroU32::new(1), }); @@ -245,8 +245,8 @@ impl<'frame> Drawer<'frame> { label: Some(&label), color_attachments: &[], depth_stencil_attachment: Some( - wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &view, + wgpu::RenderPassDepthStencilAttachment { + view: &view, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: true, @@ -295,8 +295,8 @@ impl<'frame> Drawer<'frame> { label: Some("clear directed shadow pass"), color_attachments: &[], depth_stencil_attachment: Some( - wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &shadow_renderer.directed_depth.view, + wgpu::RenderPassDepthStencilAttachment { + view: &shadow_renderer.directed_depth.view, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: true, @@ -319,7 +319,7 @@ impl<'frame> Drawer<'frame> { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::DepthOnly, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: face, array_layer_count: NonZeroU32::new(1), }); @@ -329,8 +329,8 @@ impl<'frame> Drawer<'frame> { label: Some(&label), color_attachments: &[], depth_stencil_attachment: Some( - wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &view, + wgpu::RenderPassDepthStencilAttachment { + view: &view, depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: true, @@ -358,8 +358,8 @@ impl<'frame> Drop for Drawer<'frame> { self.borrow.device, &wgpu::RenderPassDescriptor { label: Some("Blit screenshot pass"), - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { - attachment: &self.swap_tex.view, + color_attachments: &[wgpu::RenderPassColorAttachment { + view: &self.swap_tex.view, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), diff --git a/voxygen/src/render/renderer/screenshot.rs b/voxygen/src/render/renderer/screenshot.rs index cd52438c5e..484b83ef4d 100644 --- a/voxygen/src/render/renderer/screenshot.rs +++ b/voxygen/src/render/renderer/screenshot.rs @@ -48,7 +48,7 @@ impl TakeScreenshot { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }); @@ -92,17 +92,17 @@ impl TakeScreenshot { let padded_bytes_per_row = padded_bytes_per_row(self.width, self.bytes_per_pixel); // Copy image to a buffer encoder.copy_texture_to_buffer( - wgpu::TextureCopyView { + wgpu::ImageCopyTexture { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d::ZERO, }, - wgpu::BufferCopyView { + wgpu::ImageCopyBuffer { buffer: &self.buffer, - layout: wgpu::TextureDataLayout { + layout: wgpu::ImageDataLayout { offset: 0, - bytes_per_row: padded_bytes_per_row, - rows_per_image: 0, + bytes_per_row: core::num::NonZeroU32::new(padded_bytes_per_row), + rows_per_image: None, }, }, wgpu::Extent3d { diff --git a/voxygen/src/render/texture.rs b/voxygen/src/render/texture.rs index 293b47621c..e70fbbd144 100644 --- a/voxygen/src/render/texture.rs +++ b/voxygen/src/render/texture.rs @@ -1,6 +1,7 @@ use super::RenderError; use image::{DynamicImage, GenericImageView}; use wgpu::Extent3d; +use core::num::NonZeroU32; /// Represents an image that has been uploaded to the GPU. pub struct Texture { @@ -60,16 +61,16 @@ impl Texture { device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); queue.write_texture( - wgpu::TextureCopyViewBase { + wgpu::ImageCopyTexture { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, }, buffer.as_slice(), - wgpu::TextureDataLayout { + wgpu::ImageDataLayout { offset: 0, - bytes_per_row: image.width() * bytes_per_pixel, - rows_per_image: image.height(), + bytes_per_row: NonZeroU32::new(image.width() * bytes_per_pixel), + rows_per_image: NonZeroU32::new(image.height()), }, wgpu::Extent3d { width: image.width(), @@ -95,7 +96,7 @@ impl Texture { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }); @@ -143,7 +144,7 @@ impl Texture { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, }; @@ -186,7 +187,7 @@ impl Texture { ); // TODO: Only works for 2D images queue.write_texture( - wgpu::TextureCopyViewBase { + wgpu::ImageCopyTexture { texture: &self.tex, mip_level: 0, origin: wgpu::Origin3d { @@ -196,10 +197,10 @@ impl Texture { }, }, data, - wgpu::TextureDataLayout { + wgpu::ImageDataLayout { offset: 0, - bytes_per_row: size[0] * BYTES_PER_PIXEL, - rows_per_image: size[1], + bytes_per_row: NonZeroU32::new(size[0] * BYTES_PER_PIXEL), + rows_per_image: NonZeroU32::new(size[1]), }, wgpu::Extent3d { width: size[0], diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index 2f42463f1b..14de830361 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -644,7 +644,7 @@ impl Terrain { dimension: Some(wgpu::TextureViewDimension::D2), aspect: wgpu::TextureAspect::All, base_mip_level: 0, - level_count: None, + mip_level_count: None, base_array_layer: 0, array_layer_count: None, },