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<Instance>> for wgpu::Instance {
32 fn from(value: DawnIntoWgpu<Instance>) -> Self {
33 wgpu::Instance::from_custom(DawnInstance::from_instance(value.0))
34 }
35}
36
37impl From<DawnIntoWgpu<Adapter>> for wgpu::Adapter {
38 fn from(value: DawnIntoWgpu<Adapter>) -> Self {
39 wgpu::Adapter::from_custom(DawnAdapter {
40 inner: value.0,
41 })
42 }
43}
44
45impl From<DawnIntoWgpu<Device>> for wgpu::Device {
46 fn from(value: DawnIntoWgpu<Device>) -> Self {
47 wgpu::Device::from_custom(DawnDevice { inner: value.0 })
48 }
49}
50
51impl From<DawnIntoWgpu<Queue>> for wgpu::Queue {
52 fn from(value: DawnIntoWgpu<Queue>) -> Self {
53 wgpu::Queue::from_custom(DawnQueue { inner: value.0 })
54 }
55}
56
57impl From<DawnTextureIntoWgpu<'_>> for wgpu::Texture {
58 fn from(value: DawnTextureIntoWgpu<'_>) -> Self {
59 wgpu::Texture::from_custom(
60 DawnTexture {
61 inner: value.texture,
62 },
63 value.desc,
64 )
65 }
66}