1pub fn create_empty_layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
3 device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
4 entries: &[],
5 label: Some("empty_layout"),
6 })
7}
8pub fn create_empty_group(device: &wgpu::Device) -> wgpu::BindGroup {
9 let layout = create_empty_layout(device);
10 device.create_bind_group(&wgpu::BindGroupDescriptor {
11 label: Some("empty_grou["),
12 layout: &layout,
13 entries: &[],
14 })
15}
16
17#[allow(clippy::cast_possible_truncation)]
20#[allow(clippy::cast_sign_loss)]
21#[allow(clippy::cast_precision_loss)]
22pub(crate) fn get_mip_extent(extent: &wgpu::Extent3d, level: u32) -> wgpu::Extent3d {
23 let mip_width = ((extent.width as f32) / (2u32.pow(level) as f32)).floor() as u32;
24 let mip_height = ((extent.height as f32) / (2u32.pow(level) as f32)).floor() as u32;
25 let mip_depth = ((extent.depth_or_array_layers as f32) / (2u32.pow(level) as f32)).floor() as u32;
26 wgpu::Extent3d {
27 width: mip_width.max(1),
28 height: mip_height.max(1),
29 depth_or_array_layers: mip_depth.max(1),
30 }
31}