1use crate::types::*;
2use dawn_rs::*;
3
4#[derive(Debug, Clone)]
5pub struct DawnIntoWgpu<T>(T);
6
7impl<T> DawnIntoWgpu<T> {
8 pub fn into_inner(self) -> T {
9 self.0
10 }
11}
12
13impl<T> From<T> for DawnIntoWgpu<T> {
14 fn from(value: T) -> Self {
15 Self(value)
16 }
17}
18
19#[derive(Debug, Clone)]
20pub struct DawnTextureIntoWgpu<'a> {
21 texture: Texture,
22 desc: &'a wgpu::TextureDescriptor<'a>,
23}
24
25impl<'a> DawnTextureIntoWgpu<'a> {
26 pub fn new(texture: Texture, desc: &'a wgpu::TextureDescriptor<'a>) -> Self {
27 Self { texture, desc }
28 }
29}
30
31impl From<DawnIntoWgpu<Device>> for wgpu::Device {
32 fn from(value: DawnIntoWgpu<Device>) -> Self {
33 wgpu::Device::from_custom(DawnDevice::new(value.0))
34 }
35}
36
37impl From<DawnIntoWgpu<Queue>> for wgpu::Queue {
38 fn from(value: DawnIntoWgpu<Queue>) -> Self {
39 wgpu::Queue::from_custom(DawnQueue { inner: value.0 })
40 }
41}
42
43impl From<DawnTextureIntoWgpu<'_>> for wgpu::Texture {
44 fn from(value: DawnTextureIntoWgpu<'_>) -> Self {
45 wgpu::Texture::from_custom(
46 DawnTexture {
47 inner: value.texture,
48 },
49 value.desc,
50 )
51 }
52}