Skip to main content

dear_imgui_wgpu/texture/
resource.rs

1use super::*;
2
3/// WGPU texture resource
4///
5/// This corresponds to ImGui_ImplWGPU_Texture in the C++ implementation
6#[derive(Debug)]
7pub struct WgpuTexture {
8    /// WGPU texture object
9    pub texture: Texture,
10    /// Texture view for binding
11    pub texture_view: TextureView,
12}
13
14impl WgpuTexture {
15    /// Create a new WGPU texture
16    pub fn new(texture: Texture, texture_view: TextureView) -> Self {
17        Self {
18            texture,
19            texture_view,
20        }
21    }
22
23    /// Get the texture view for binding
24    pub fn view(&self) -> &TextureView {
25        &self.texture_view
26    }
27
28    /// Get the texture object
29    pub fn texture(&self) -> &Texture {
30        &self.texture
31    }
32}