Create a WGPU Texture, returning a default TextureView
(
width: u32,
height: u32,
format: TextureFormat,
usage: TextureUsages,
device: &Device,
)
| 28 | |
| 29 | /// Create a WGPU Texture, returning a default TextureView |
| 30 | pub(crate) fn create_texture( |
| 31 | width: u32, |
| 32 | height: u32, |
| 33 | format: TextureFormat, |
| 34 | usage: TextureUsages, |
| 35 | device: &Device, |
| 36 | ) -> TextureView { |
| 37 | let texture = device.create_texture(&wgpu::TextureDescriptor { |
| 38 | label: None, |
| 39 | size: wgpu::Extent3d { |
| 40 | width, |
| 41 | height, |
| 42 | depth_or_array_layers: 1, |
| 43 | }, |
| 44 | mip_level_count: 1, |
| 45 | sample_count: 1, |
| 46 | dimension: wgpu::TextureDimension::D2, |
| 47 | usage, |
| 48 | format, |
| 49 | view_formats: &[], |
| 50 | }); |
| 51 | |
| 52 | texture.create_view(&wgpu::TextureViewDescriptor::default()) |
| 53 | } |