You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/notes

57 lines
1.6 KiB

StorageImage
General-purpose image in device memory.
AttachmentImage
ImageAccess whose purpose is to be used as a framebuffer attachment
Hello!
Any of you guys use the Vulkano library? There is this PersistentDescriptorSetBuilder struct
which uses this fun chaining dynamic
```
PersistentDescriptorSet::start(layout, 0)
.add_sampled_image(sampled_image1).unwrap()
.add_sampled_image(sampled_image2).unwrap()
.add_sampled_image(sampled_image3).unwrap()
.build().unwrap();
```
But it modifies the return values template values so I can't store it between loops
```
let mut set_builder = PersistentDescriptorSet::start(layout, 0);
for image in images {
set_builder = set_builder.add_sampled_image(image);
}
let descriptor_set = set_builder.build().unwrap();
```
The gist of the error that I get is something like:
```
expected:
PersistentDescriptorSetBuilder<Arc<GraphicsPipelineAbstract>, ()>
got:
PersistentDescriptorSetBuilder<Arc<GraphicsPipelineAbstract>, ((), PersistentDescriptorSetImg<Arc<ImmutableImage<Format>>>)>
```
So it's adding tuples of tuples of tuples of tuples of tuples each time I chain a
.add_sampled_image() call. I really really want to be able to do this dynamically in
a loop; I've tried this neat iter().fold() thinking that if I didn't explicitly
overwrite the previous returned value, rust would figure it out. It didn't
```
let descriptor_set = images.iter().fold(
PersistentDescriptorSet::start(layout, 0)
,|a, &b| a.add_image(b))
.unwrap()).build().unwrap();
```
How do I do this dynamically?