mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Merge #488
488: Update wgpu with view descriptor changes r=kvark a=kvark Includes https://github.com/gfx-rs/wgpu/pull/846 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
@@ -27,14 +27,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "5bd24d50852eb9932535eb258c216a5e4a79808f"
|
||||
rev = "9929b8719ff9c15a96adbf279fcbf3e943f23c78"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "5bd24d50852eb9932535eb258c216a5e4a79808f"
|
||||
rev = "9929b8719ff9c15a96adbf279fcbf3e943f23c78"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
mod framework;
|
||||
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::borrow::Cow::Borrowed;
|
||||
use std::{borrow::Cow::Borrowed, num::NonZeroU32};
|
||||
|
||||
const TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb;
|
||||
|
||||
@@ -159,9 +159,9 @@ impl Example {
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
base_mip_level: mip,
|
||||
level_count: 1,
|
||||
level_count: NonZeroU32::new(1),
|
||||
base_array_layer: 0,
|
||||
array_layer_count: 1,
|
||||
array_layer_count: None,
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{borrow::Cow::Borrowed, iter, mem, ops::Range, rc::Rc};
|
||||
use std::{borrow::Cow::Borrowed, iter, mem, num::NonZeroU32, ops::Range, rc::Rc};
|
||||
|
||||
#[path = "../framework.rs"]
|
||||
mod framework;
|
||||
@@ -380,9 +380,9 @@ impl framework::Example for Example {
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
base_mip_level: 0,
|
||||
level_count: 1,
|
||||
level_count: None,
|
||||
base_array_layer: i as u32,
|
||||
array_layer_count: 1,
|
||||
array_layer_count: NonZeroU32::new(1),
|
||||
}))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -208,9 +208,9 @@ impl framework::Example for Skybox {
|
||||
dimension: wgpu::TextureViewDimension::Cube,
|
||||
aspect: wgpu::TextureAspect::default(),
|
||||
base_mip_level: 0,
|
||||
level_count: 1,
|
||||
level_count: None,
|
||||
base_array_layer: 0,
|
||||
array_layer_count: 6,
|
||||
array_layer_count: None,
|
||||
});
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
|
||||
@@ -1195,13 +1195,17 @@ impl crate::Context for Context {
|
||||
Sendable(match desc {
|
||||
Some(d) => {
|
||||
let mut mapped_desc = web_sys::GpuTextureViewDescriptor::new();
|
||||
mapped_desc.array_layer_count(d.array_layer_count);
|
||||
mapped_desc.aspect(map_texture_aspect(d.aspect));
|
||||
mapped_desc.base_array_layer(d.base_array_layer);
|
||||
mapped_desc.base_mip_level(d.base_mip_level);
|
||||
mapped_desc.dimension(map_texture_view_dimension(d.dimension));
|
||||
mapped_desc.format(map_texture_format(d.format));
|
||||
mapped_desc.mip_level_count(d.level_count);
|
||||
mapped_desc.aspect(map_texture_aspect(d.aspect));
|
||||
mapped_desc.base_array_layer(d.base_array_layer);
|
||||
if let Some(count) = d.array_layer_count {
|
||||
mapped_desc.array_layer_count(count.get());
|
||||
}
|
||||
mapped_desc.base_mip_level(d.base_mip_level);
|
||||
if let Some(count) = d.level_count {
|
||||
mapped_desc.mip_level_count(count.get());
|
||||
}
|
||||
// TODO: label
|
||||
texture.0.create_view_with_descriptor(&mapped_desc)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user