I have kinda given up trying to wrangle this descriptorsetbuilder. Going to read more on how sprites are best handled in regards to their textures
This commit is contained in:
48
notes
48
notes
@@ -7,3 +7,51 @@ StorageImage
|
||||
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?
|
||||
Reference in New Issue
Block a user