simple_wgpu/
render_texture.rs1#[derive(Clone, Debug)]
3pub struct RenderTexture {
4 pub(crate) view: wgpu::TextureView,
5 pub(crate) format: wgpu::TextureFormat,
6}
7
8impl RenderTexture {
9 pub fn from_surface_texture(surface_texture: &wgpu::SurfaceTexture) -> Self {
13 Self {
14 view: surface_texture
15 .texture
16 .create_view(&wgpu::TextureViewDescriptor::default()),
17
18 format: surface_texture.texture.format(),
19 }
20 }
21
22 pub fn from_texture_view(
24 texture_view: &wgpu::TextureView,
25 format: &wgpu::TextureFormat,
26 ) -> Self {
27 Self {
28 view: texture_view.clone(),
29 format: *format,
30 }
31 }
32}