1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use {
super::{
Buffer, BufferInfo, ComputePipeline, ComputePipelineInfo, Device, GraphicPipeline,
GraphicPipelineInfo, Image, ImageInfo, RayTracePipeline, RayTracePipelineInfo, Shader,
},
crate::{graph::ImageBinding, ptr::Shared},
archery::SharedPointerKind,
};
impl<'a, P> Shared<Device<P>, P>
where
P: SharedPointerKind,
{
pub fn new_buffer(&self, info: impl Into<BufferInfo>) -> Shared<Buffer<P>, P> {
Shared::new(Buffer::create(self, info).unwrap())
}
pub fn new_compute_pipeline(
&self,
info: impl Into<ComputePipelineInfo>,
) -> Shared<ComputePipeline<P>, P> {
Shared::new(ComputePipeline::create(self, info).unwrap())
}
pub fn new_image(&self, info: impl Into<ImageInfo>) -> ImageBinding<P> {
ImageBinding::new(self.new_image_raw(info))
}
pub fn new_image_raw(&self, info: impl Into<ImageInfo>) -> Image<P> {
Image::create(self, info).unwrap()
}
pub fn new_graphic_pipeline<S>(
&self,
info: impl Into<GraphicPipelineInfo>,
shaders: impl IntoIterator<Item = S>,
) -> Shared<GraphicPipeline<P>, P>
where
S: Into<Shader>,
{
Shared::new(GraphicPipeline::create(self, info, shaders).unwrap())
}
pub fn new_ray_trace_pipeline<S>(
&self,
info: impl Into<RayTracePipelineInfo>,
shaders: impl IntoIterator<Item = S>,
) -> Shared<RayTracePipeline<P>, P>
where
S: Into<Shader>,
{
Shared::new(RayTracePipeline::create(self, info, shaders).unwrap())
}
}