Update wgpu

This commit is contained in:
Imbris 2021-03-31 20:25:34 -04:00 committed by Avi Weinstock
parent 4c73433ecb
commit 97359042db
10 changed files with 79 additions and 78 deletions

58
Cargo.lock generated
View File

@ -1889,7 +1889,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.8.0" 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 = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -1899,7 +1899,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1920,7 +1920,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -1941,7 +1941,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.7.0" 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 = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -1951,7 +1951,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1974,7 +1974,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1999,7 +1999,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -2019,7 +2019,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.7.0" 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 = [ dependencies = [
"bitflags", "bitflags",
"naga", "naga",
@ -2620,9 +2620,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.46" version = "0.3.49"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -3066,7 +3066,7 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.3.1" 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 = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
@ -4159,7 +4159,7 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.2" 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]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
@ -6183,9 +6183,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.69" version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -6193,9 +6193,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.69" version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -6208,9 +6208,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.19" version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -6220,9 +6220,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.69" version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
dependencies = [ dependencies = [
"quote 1.0.9", "quote 1.0.9",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -6230,9 +6230,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.69" version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
@ -6243,9 +6243,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.69" version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"
[[package]] [[package]]
name = "wasmer" name = "wasmer"
@ -6590,9 +6590,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.46" version = "0.3.49"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -6621,7 +6621,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"js-sys", "js-sys",
@ -6640,7 +6640,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.7.0" 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 = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -6679,7 +6679,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.7.0" 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 = [ dependencies = [
"bitflags", "bitflags",
] ]

View File

@ -111,7 +111,7 @@ nativeBuildInputs = ["pkg-config"]
winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" } winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" }
vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics2" } vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics2" }
# patch wgpu so we can use wgpu-profiler crate # 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) # # Uncomment this to use a local fork of wgpu (for testing purposes)
# [patch.'https://github.com/gfx-rs/wgpu'] # [patch.'https://github.com/gfx-rs/wgpu']

View File

@ -100,7 +100,7 @@ impl LodData {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };

View File

@ -111,7 +111,7 @@ pub fn create_col_lights(
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };

View File

@ -136,7 +136,7 @@ pub fn create_verts_buffer(renderer: &mut Renderer, mut mesh: Mesh<Vertex>) -> B
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };

View File

@ -547,7 +547,7 @@ impl Renderer {
// TODO: why is this not Color? // TODO: why is this not Color?
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}) })
@ -575,7 +575,7 @@ impl Renderer {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}); });
@ -600,7 +600,7 @@ impl Renderer {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}); });
@ -635,7 +635,7 @@ impl Renderer {
dimension: Some(view_dim), dimension: Some(view_dim),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };
@ -666,8 +666,8 @@ impl Renderer {
encoder.begin_render_pass(&wgpu::RenderPassDescriptor { encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Clear dummy shadow texture"), label: Some("Clear dummy shadow texture"),
color_attachments: &[], color_attachments: &[],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
attachment: &tex.view, view: &tex.view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, store: true,
@ -762,7 +762,7 @@ impl Renderer {
dimension: Some(wgpu::TextureViewDimension::Cube), dimension: Some(wgpu::TextureViewDimension::Cube),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };
@ -787,7 +787,7 @@ impl Renderer {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };

View File

@ -93,8 +93,8 @@ impl<'frame> Drawer<'frame> {
label: Some("shadow pass"), label: Some("shadow pass"),
color_attachments: &[], color_attachments: &[],
depth_stencil_attachment: Some( depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachmentDescriptor { wgpu::RenderPassDepthStencilAttachment {
attachment: &shadow_renderer.directed_depth.view, view: &shadow_renderer.directed_depth.view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, store: true,
@ -122,16 +122,16 @@ impl<'frame> Drawer<'frame> {
let mut render_pass = let mut render_pass =
encoder.scoped_render_pass("first_pass", device, &wgpu::RenderPassDescriptor { encoder.scoped_render_pass("first_pass", device, &wgpu::RenderPassDescriptor {
label: Some("first pass"), label: Some("first pass"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: &self.borrow.views.tgt_color, view: &self.borrow.views.tgt_color,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: true, store: true,
}, },
}], }],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
attachment: &self.borrow.views.tgt_depth, view: &self.borrow.views.tgt_depth,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(0.0), load: wgpu::LoadOp::Clear(0.0),
store: true, store: true,
@ -156,8 +156,8 @@ impl<'frame> Drawer<'frame> {
let mut render_pass = let mut render_pass =
encoder.scoped_render_pass("second_pass", device, &wgpu::RenderPassDescriptor { encoder.scoped_render_pass("second_pass", device, &wgpu::RenderPassDescriptor {
label: Some("second pass (clouds)"), label: Some("second pass (clouds)"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: &self.borrow.views.tgt_color_pp, view: &self.borrow.views.tgt_color_pp,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
@ -182,10 +182,10 @@ impl<'frame> Drawer<'frame> {
let mut render_pass = let mut render_pass =
encoder.scoped_render_pass("third_pass", device, &wgpu::RenderPassDescriptor { encoder.scoped_render_pass("third_pass", device, &wgpu::RenderPassDescriptor {
label: Some("third pass (postprocess + ui)"), 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 // If a screenshot was requested render to that as an intermediate texture
// instead // instead
attachment: self view: self
.taking_screenshot .taking_screenshot
.as_ref() .as_ref()
.map_or(&self.swap_tex.view, |s| s.texture_view()), .map_or(&self.swap_tex.view, |s| s.texture_view()),
@ -234,7 +234,7 @@ impl<'frame> Drawer<'frame> {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: face, base_array_layer: face,
array_layer_count: NonZeroU32::new(1), array_layer_count: NonZeroU32::new(1),
}); });
@ -245,8 +245,8 @@ impl<'frame> Drawer<'frame> {
label: Some(&label), label: Some(&label),
color_attachments: &[], color_attachments: &[],
depth_stencil_attachment: Some( depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachmentDescriptor { wgpu::RenderPassDepthStencilAttachment {
attachment: &view, view: &view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, store: true,
@ -295,8 +295,8 @@ impl<'frame> Drawer<'frame> {
label: Some("clear directed shadow pass"), label: Some("clear directed shadow pass"),
color_attachments: &[], color_attachments: &[],
depth_stencil_attachment: Some( depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachmentDescriptor { wgpu::RenderPassDepthStencilAttachment {
attachment: &shadow_renderer.directed_depth.view, view: &shadow_renderer.directed_depth.view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, store: true,
@ -319,7 +319,7 @@ impl<'frame> Drawer<'frame> {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::DepthOnly, aspect: wgpu::TextureAspect::DepthOnly,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: face, base_array_layer: face,
array_layer_count: NonZeroU32::new(1), array_layer_count: NonZeroU32::new(1),
}); });
@ -329,8 +329,8 @@ impl<'frame> Drawer<'frame> {
label: Some(&label), label: Some(&label),
color_attachments: &[], color_attachments: &[],
depth_stencil_attachment: Some( depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachmentDescriptor { wgpu::RenderPassDepthStencilAttachment {
attachment: &view, view: &view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, store: true,
@ -358,8 +358,8 @@ impl<'frame> Drop for Drawer<'frame> {
self.borrow.device, self.borrow.device,
&wgpu::RenderPassDescriptor { &wgpu::RenderPassDescriptor {
label: Some("Blit screenshot pass"), label: Some("Blit screenshot pass"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: &self.swap_tex.view, view: &self.swap_tex.view,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),

View File

@ -48,7 +48,7 @@ impl TakeScreenshot {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, 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); let padded_bytes_per_row = padded_bytes_per_row(self.width, self.bytes_per_pixel);
// Copy image to a buffer // Copy image to a buffer
encoder.copy_texture_to_buffer( encoder.copy_texture_to_buffer(
wgpu::TextureCopyView { wgpu::ImageCopyTexture {
texture: &self.texture, texture: &self.texture,
mip_level: 0, mip_level: 0,
origin: wgpu::Origin3d::ZERO, origin: wgpu::Origin3d::ZERO,
}, },
wgpu::BufferCopyView { wgpu::ImageCopyBuffer {
buffer: &self.buffer, buffer: &self.buffer,
layout: wgpu::TextureDataLayout { layout: wgpu::ImageDataLayout {
offset: 0, offset: 0,
bytes_per_row: padded_bytes_per_row, bytes_per_row: core::num::NonZeroU32::new(padded_bytes_per_row),
rows_per_image: 0, rows_per_image: None,
}, },
}, },
wgpu::Extent3d { wgpu::Extent3d {

View File

@ -1,6 +1,7 @@
use super::RenderError; use super::RenderError;
use image::{DynamicImage, GenericImageView}; use image::{DynamicImage, GenericImageView};
use wgpu::Extent3d; use wgpu::Extent3d;
use core::num::NonZeroU32;
/// Represents an image that has been uploaded to the GPU. /// Represents an image that has been uploaded to the GPU.
pub struct Texture { pub struct Texture {
@ -60,16 +61,16 @@ impl Texture {
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
queue.write_texture( queue.write_texture(
wgpu::TextureCopyViewBase { wgpu::ImageCopyTexture {
texture: &tex, texture: &tex,
mip_level: 0, mip_level: 0,
origin: wgpu::Origin3d::ZERO, origin: wgpu::Origin3d::ZERO,
}, },
buffer.as_slice(), buffer.as_slice(),
wgpu::TextureDataLayout { wgpu::ImageDataLayout {
offset: 0, offset: 0,
bytes_per_row: image.width() * bytes_per_pixel, bytes_per_row: NonZeroU32::new(image.width() * bytes_per_pixel),
rows_per_image: image.height(), rows_per_image: NonZeroU32::new(image.height()),
}, },
wgpu::Extent3d { wgpu::Extent3d {
width: image.width(), width: image.width(),
@ -95,7 +96,7 @@ impl Texture {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}); });
@ -143,7 +144,7 @@ impl Texture {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}; };
@ -186,7 +187,7 @@ impl Texture {
); );
// TODO: Only works for 2D images // TODO: Only works for 2D images
queue.write_texture( queue.write_texture(
wgpu::TextureCopyViewBase { wgpu::ImageCopyTexture {
texture: &self.tex, texture: &self.tex,
mip_level: 0, mip_level: 0,
origin: wgpu::Origin3d { origin: wgpu::Origin3d {
@ -196,10 +197,10 @@ impl Texture {
}, },
}, },
data, data,
wgpu::TextureDataLayout { wgpu::ImageDataLayout {
offset: 0, offset: 0,
bytes_per_row: size[0] * BYTES_PER_PIXEL, bytes_per_row: NonZeroU32::new(size[0] * BYTES_PER_PIXEL),
rows_per_image: size[1], rows_per_image: NonZeroU32::new(size[1]),
}, },
wgpu::Extent3d { wgpu::Extent3d {
width: size[0], width: size[0],

View File

@ -644,7 +644,7 @@ impl<V: RectRasterableVol> Terrain<V> {
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
base_mip_level: 0, base_mip_level: 0,
level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
array_layer_count: None, array_layer_count: None,
}, },