mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Descriptor set revamp (#2404)
* Descriptor set revamp * Fix tests * Fix examples * Add `DescriptorSet::update_unchecked` * Fix docs * Add `Debug` impls * Add `DescriptorSet::update_by_ref[_unchecked]` * Rename `UnsafeDescriptorSet` to `RawDescriptorSet` * Fix outdated docs for `DescriptorPool`
This commit is contained in:
parent
6b951709e5
commit
63a53f1b93
@ -47,7 +47,7 @@ use vulkano::{
|
|||||||
PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
||||||
@ -486,7 +486,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
let uniform_buffer_sets = uniform_buffers
|
let uniform_buffer_sets = uniform_buffers
|
||||||
.iter()
|
.iter()
|
||||||
.map(|buffer| {
|
.map(|buffer| {
|
||||||
PersistentDescriptorSet::new(
|
DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
pipeline.layout().set_layouts()[0].clone(),
|
pipeline.layout().set_layouts()[0].clone(),
|
||||||
[WriteDescriptorSet::buffer(0, buffer.clone())],
|
[WriteDescriptorSet::buffer(0, buffer.clone())],
|
||||||
@ -499,7 +499,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
// Create the descriptor sets for sampling the textures.
|
// Create the descriptor sets for sampling the textures.
|
||||||
let sampler = Sampler::new(device.clone(), SamplerCreateInfo::simple_repeat_linear()).unwrap();
|
let sampler = Sampler::new(device.clone(), SamplerCreateInfo::simple_repeat_linear()).unwrap();
|
||||||
let sampler_sets = textures.map(|texture| {
|
let sampler_sets = textures.map(|texture| {
|
||||||
PersistentDescriptorSet::new(
|
DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
pipeline.layout().set_layouts()[1].clone(),
|
pipeline.layout().set_layouts()[1].clone(),
|
||||||
[
|
[
|
||||||
|
@ -11,7 +11,7 @@ use vulkano::{
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -184,7 +184,7 @@ fn main() {
|
|||||||
// If you want to run the pipeline on multiple different buffers, you need to create multiple
|
// If you want to run the pipeline on multiple different buffers, you need to create multiple
|
||||||
// descriptor sets that each contain the buffer you want to run the shader on.
|
// descriptor sets that each contain the buffer you want to run the shader on.
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
@ -6,7 +6,7 @@ use vulkano::{
|
|||||||
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::view::ImageView,
|
image::view::ImageView,
|
||||||
@ -168,7 +168,7 @@ impl AmbientLightingSystem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let descriptor_set = PersistentDescriptorSet::new(
|
let descriptor_set = DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::image_view(0, color_input)],
|
[WriteDescriptorSet::image_view(0, color_input)],
|
||||||
|
@ -7,7 +7,7 @@ use vulkano::{
|
|||||||
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::view::ImageView,
|
image::view::ImageView,
|
||||||
@ -179,7 +179,7 @@ impl DirectionalLightingSystem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let descriptor_set = PersistentDescriptorSet::new(
|
let descriptor_set = DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -7,7 +7,7 @@ use vulkano::{
|
|||||||
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::view::ImageView,
|
image::view::ImageView,
|
||||||
@ -191,7 +191,7 @@ impl PointLightingSystem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let descriptor_set = PersistentDescriptorSet::new(
|
let descriptor_set = DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -12,7 +12,7 @@ use vulkano::{
|
|||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, layout::DescriptorType, DescriptorBufferInfo,
|
allocator::StandardDescriptorSetAllocator, layout::DescriptorType, DescriptorBufferInfo,
|
||||||
DescriptorSet, PersistentDescriptorSet, WriteDescriptorSet,
|
DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -212,7 +212,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -12,7 +12,7 @@ use vulkano::{
|
|||||||
CopyImageToBufferInfo,
|
CopyImageToBufferInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -224,7 +224,7 @@ fn main() {
|
|||||||
let view = ImageView::new_default(image.clone()).unwrap();
|
let view = ImageView::new_default(image.clone()).unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::image_view(0, view)],
|
[WriteDescriptorSet::image_view(0, view)],
|
||||||
|
@ -24,7 +24,7 @@ mod linux {
|
|||||||
CommandBufferUsage, RenderPassBeginInfo, SemaphoreSubmitInfo, SubmitInfo,
|
CommandBufferUsage, RenderPassBeginInfo, SemaphoreSubmitInfo, SubmitInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
||||||
@ -278,7 +278,7 @@ mod linux {
|
|||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
|
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -7,7 +7,7 @@ use vulkano::{
|
|||||||
CopyImageInfo, ImageBlit, ImageCopy, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyImageInfo, ImageBlit, ImageCopy, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -380,7 +380,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -6,7 +6,7 @@ use vulkano::{
|
|||||||
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -328,7 +328,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -15,7 +15,7 @@ use vulkano::{
|
|||||||
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -349,7 +349,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
|
|
||||||
// Use `image_view` instead of `image_view_sampler`, since the sampler is already in the
|
// Use `image_view` instead of `image_view_sampler`, since the sampler is already in the
|
||||||
// layout.
|
// layout.
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::image_view(1, texture)],
|
[WriteDescriptorSet::image_view(1, texture)],
|
||||||
|
@ -25,7 +25,7 @@ use vulkano::{
|
|||||||
DrawIndirectCommand, RenderPassBeginInfo,
|
DrawIndirectCommand, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -454,7 +454,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
|
|
||||||
// Pass the two buffers to the compute shader.
|
// Pass the two buffers to the compute shader.
|
||||||
let layout = compute_pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = compute_pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let cs_desciptor_set = PersistentDescriptorSet::new(
|
let cs_desciptor_set = DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -8,7 +8,7 @@ use vulkano::{
|
|||||||
PrimaryCommandBufferAbstract,
|
PrimaryCommandBufferAbstract,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::view::ImageView,
|
image::view::ImageView,
|
||||||
@ -138,7 +138,7 @@ impl FractalComputePipeline {
|
|||||||
let image_extent = image_view.image().extent();
|
let image_extent = image_view.image().extent();
|
||||||
let pipeline_layout = self.pipeline.layout();
|
let pipeline_layout = self.pipeline.layout();
|
||||||
let desc_layout = pipeline_layout.set_layouts().get(0).unwrap();
|
let desc_layout = pipeline_layout.set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
desc_layout.clone(),
|
desc_layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -6,7 +6,7 @@ use vulkano::{
|
|||||||
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::{
|
image::{
|
||||||
@ -172,7 +172,7 @@ impl PixelsDrawPipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_descriptor_set(&self, image: Arc<ImageView>) -> Arc<PersistentDescriptorSet> {
|
fn create_descriptor_set(&self, image: Arc<ImageView>) -> Arc<DescriptorSet> {
|
||||||
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let sampler = Sampler::new(
|
let sampler = Sampler::new(
|
||||||
self.gfx_queue.device().clone(),
|
self.gfx_queue.device().clone(),
|
||||||
@ -186,7 +186,7 @@ impl PixelsDrawPipeline {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
PersistentDescriptorSet::new(
|
DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -9,7 +9,7 @@ use vulkano::{
|
|||||||
PrimaryAutoCommandBuffer,
|
PrimaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
format::Format,
|
format::Format,
|
||||||
@ -173,7 +173,7 @@ impl GameOfLifeComputePipeline {
|
|||||||
let image_extent = self.image.image().extent();
|
let image_extent = self.image.image().extent();
|
||||||
let pipeline_layout = self.compute_life_pipeline.layout();
|
let pipeline_layout = self.compute_life_pipeline.layout();
|
||||||
let desc_layout = pipeline_layout.set_layouts().get(0).unwrap();
|
let desc_layout = pipeline_layout.set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
desc_layout.clone(),
|
desc_layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -7,7 +7,7 @@ use vulkano::{
|
|||||||
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
CommandBufferInheritanceInfo, CommandBufferUsage, SecondaryAutoCommandBuffer,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::Queue,
|
device::Queue,
|
||||||
image::{
|
image::{
|
||||||
@ -168,7 +168,7 @@ impl PixelsDrawPipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_image_sampler_nearest(&self, image: Arc<ImageView>) -> Arc<PersistentDescriptorSet> {
|
fn create_image_sampler_nearest(&self, image: Arc<ImageView>) -> Arc<DescriptorSet> {
|
||||||
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = self.pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let sampler = Sampler::new(
|
let sampler = Sampler::new(
|
||||||
self.gfx_queue.device().clone(),
|
self.gfx_queue.device().clone(),
|
||||||
@ -182,7 +182,7 @@ impl PixelsDrawPipeline {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
PersistentDescriptorSet::new(
|
DescriptorSet::new(
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -10,7 +10,7 @@ use vulkano::{
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -156,7 +156,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
@ -6,8 +6,8 @@ use vulkano::{
|
|||||||
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, layout::DescriptorBindingFlags,
|
allocator::StandardDescriptorSetAllocator, layout::DescriptorBindingFlags, DescriptorSet,
|
||||||
PersistentDescriptorSet, WriteDescriptorSet,
|
WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Features,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Features,
|
||||||
@ -448,7 +448,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new_variable(
|
let set = DescriptorSet::new_variable(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
2,
|
2,
|
||||||
|
@ -10,7 +10,7 @@ use vulkano::{
|
|||||||
CommandBufferUsage, CopyBufferInfoTyped,
|
CommandBufferUsage, CopyBufferInfoTyped,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -152,7 +152,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
@ -9,7 +9,7 @@ use vulkano::{
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -156,7 +156,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
@ -23,7 +23,7 @@ use vulkano::{
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
||||||
@ -184,7 +184,7 @@ fn main() {
|
|||||||
descriptor_set_allocator: Arc<StandardDescriptorSetAllocator>,
|
descriptor_set_allocator: Arc<StandardDescriptorSetAllocator>,
|
||||||
) {
|
) {
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer)],
|
[WriteDescriptorSet::buffer(0, data_buffer)],
|
||||||
|
@ -11,7 +11,7 @@ use vulkano::{
|
|||||||
CopyBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -432,7 +432,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
|
|
||||||
// Create a new descriptor set for binding vertices as a storage buffer.
|
// Create a new descriptor set for binding vertices as a storage buffer.
|
||||||
use vulkano::pipeline::Pipeline; // Required to access the `layout` method of pipeline.
|
use vulkano::pipeline::Pipeline; // Required to access the `layout` method of pipeline.
|
||||||
let descriptor_set = PersistentDescriptorSet::new(
|
let descriptor_set = DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
compute_pipeline
|
compute_pipeline
|
||||||
.layout()
|
.layout()
|
||||||
|
@ -7,7 +7,7 @@ use vulkano::{
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -157,7 +157,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
@ -11,7 +11,7 @@ use vulkano::{
|
|||||||
RenderPassBeginInfo,
|
RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceOwned,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceOwned,
|
||||||
@ -341,7 +341,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[WriteDescriptorSet::buffer(0, uniform_buffer_subbuffer)],
|
[WriteDescriptorSet::buffer(0, uniform_buffer_subbuffer)],
|
||||||
|
@ -6,7 +6,7 @@ use vulkano::{
|
|||||||
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{
|
device::{
|
||||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
|
||||||
@ -339,7 +339,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
descriptor_set_allocator,
|
descriptor_set_allocator,
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
|
@ -39,7 +39,7 @@ use crate::{
|
|||||||
DeviceSize, Validated, ValidationError, VulkanError,
|
DeviceSize, Validated, ValidationError, VulkanError,
|
||||||
};
|
};
|
||||||
use ahash::HashMap;
|
use ahash::HashMap;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::{Mutex, RwLockReadGuard};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{
|
use std::{
|
||||||
collections::hash_map::Entry,
|
collections::hash_map::Entry,
|
||||||
@ -1730,10 +1730,10 @@ pub(in crate::command_buffer) enum SetOrPush {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SetOrPush {
|
impl SetOrPush {
|
||||||
pub(in crate::command_buffer) fn resources(&self) -> &DescriptorSetResources {
|
pub(in crate::command_buffer) fn resources(&self) -> SetOrPushResources<'_> {
|
||||||
match self {
|
match self {
|
||||||
Self::Set(set) => set.as_ref().0.resources(),
|
Self::Set(set) => SetOrPushResources::Set(set.as_ref().0.resources()),
|
||||||
Self::Push(resources) => resources,
|
Self::Push(resources) => SetOrPushResources::Push(resources),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1746,6 +1746,22 @@ impl SetOrPush {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(in crate::command_buffer) enum SetOrPushResources<'a> {
|
||||||
|
Set(RwLockReadGuard<'a, DescriptorSetResources>),
|
||||||
|
Push(&'a DescriptorSetResources),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::ops::Deref for SetOrPushResources<'_> {
|
||||||
|
type Target = DescriptorSetResources;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
match self {
|
||||||
|
Self::Set(guard) => guard,
|
||||||
|
Self::Push(r) => r,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
pub(in crate::command_buffer) struct StencilStateDynamic {
|
pub(in crate::command_buffer) struct StencilStateDynamic {
|
||||||
pub(in crate::command_buffer) front: Option<u32>,
|
pub(in crate::command_buffer) front: Option<u32>,
|
||||||
|
@ -326,7 +326,7 @@ mod tests {
|
|||||||
DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutCreateInfo,
|
DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutCreateInfo,
|
||||||
DescriptorType,
|
DescriptorType,
|
||||||
},
|
},
|
||||||
PersistentDescriptorSet, WriteDescriptorSet,
|
DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{Device, DeviceCreateInfo, QueueCreateInfo},
|
device::{Device, DeviceCreateInfo, QueueCreateInfo},
|
||||||
image::sampler::{Sampler, SamplerCreateInfo},
|
image::sampler::{Sampler, SamplerCreateInfo},
|
||||||
@ -785,7 +785,7 @@ mod tests {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
));
|
));
|
||||||
|
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
ds_allocator.clone(),
|
ds_allocator.clone(),
|
||||||
set_layout.clone(),
|
set_layout.clone(),
|
||||||
[WriteDescriptorSet::sampler(
|
[WriteDescriptorSet::sampler(
|
||||||
@ -856,8 +856,8 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
ds_allocator.clone(),
|
ds_allocator,
|
||||||
set_layout,
|
set_layout,
|
||||||
[WriteDescriptorSet::sampler(
|
[WriteDescriptorSet::sampler(
|
||||||
0,
|
0,
|
||||||
|
@ -582,7 +582,8 @@ where
|
|||||||
let dynamic_offsets = &dynamic_offsets_remaining[..split_index];
|
let dynamic_offsets = &dynamic_offsets_remaining[..split_index];
|
||||||
dynamic_offsets_remaining = &dynamic_offsets_remaining[split_index..];
|
dynamic_offsets_remaining = &dynamic_offsets_remaining[split_index..];
|
||||||
|
|
||||||
let elements = match set.resources().binding(binding_num) {
|
let resources = set.resources();
|
||||||
|
let elements = match resources.binding(binding_num) {
|
||||||
Some(DescriptorBindingResources::Buffer(elements)) => elements.as_slice(),
|
Some(DescriptorBindingResources::Buffer(elements)) => elements.as_slice(),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
@ -1279,28 +1279,29 @@ where
|
|||||||
{
|
{
|
||||||
// Check sampler-image compatibility. Only done for separate samplers;
|
// Check sampler-image compatibility. Only done for separate samplers;
|
||||||
// combined image samplers are checked when updating the descriptor set.
|
// combined image samplers are checked when updating the descriptor set.
|
||||||
|
for id in &desc_reqs.sampler_with_images {
|
||||||
// If the image view isn't actually present in the resources, then just skip it.
|
|
||||||
// It will be caught later by check_resources.
|
|
||||||
let iter = desc_reqs.sampler_with_images.iter().filter_map(|id| {
|
|
||||||
descriptor_set_state
|
|
||||||
.descriptor_sets
|
|
||||||
.get(&id.set)
|
|
||||||
.and_then(|set| set.resources().binding(id.binding))
|
|
||||||
.and_then(|res| match res {
|
|
||||||
DescriptorBindingResources::ImageView(elements) => elements
|
|
||||||
.get(id.index as usize)
|
|
||||||
.and_then(|opt| opt.as_ref().map(|opt| (id, opt))),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
for (id, image_view_info) in iter {
|
|
||||||
let DescriptorIdentifier {
|
let DescriptorIdentifier {
|
||||||
set: iset_num,
|
set: iset_num,
|
||||||
binding: ibinding_num,
|
binding: ibinding_num,
|
||||||
index: iindex,
|
index: iindex,
|
||||||
} = id;
|
} = id;
|
||||||
|
|
||||||
|
// If the image view isn't actually present in the resources, then just
|
||||||
|
// skip it. It will be caught later by check_resources.
|
||||||
|
let Some(set) = descriptor_set_state.descriptor_sets.get(iset_num)
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let resources = set.resources();
|
||||||
|
let Some(DescriptorBindingResources::ImageView(elements)) =
|
||||||
|
resources.binding(*ibinding_num)
|
||||||
|
else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(Some(image_view_info)) = elements.get(*iindex as usize) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
let DescriptorImageViewInfo {
|
let DescriptorImageViewInfo {
|
||||||
image_view,
|
image_view,
|
||||||
image_layout: _,
|
image_layout: _,
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Creating a descriptor set
|
//! ## Creating a descriptor set
|
||||||
//!
|
//!
|
||||||
//! TODO: write example for: PersistentDescriptorSet::start(layout.clone()).add_buffer(data_buffer.clone())
|
//! TODO: write
|
||||||
//!
|
//!
|
||||||
//! ## Passing the descriptor set when drawing
|
//! ## Passing the descriptor set when drawing
|
||||||
//!
|
//!
|
||||||
@ -31,9 +31,8 @@
|
|||||||
//!
|
//!
|
||||||
//! # When drawing
|
//! # When drawing
|
||||||
//!
|
//!
|
||||||
//! When you call a function that adds a draw command to a command buffer, one of the parameters
|
//! When you call a function that adds a draw command to a command buffer, vulkano will check that
|
||||||
//! corresponds to the list of descriptor sets to use. Vulkano will check that what you passed is
|
//! the descriptor sets you bound are compatible with the layout of the pipeline.
|
||||||
//! compatible with the layout of the pipeline.
|
|
||||||
//!
|
//!
|
||||||
//! TODO: talk about perfs of changing sets
|
//! TODO: talk about perfs of changing sets
|
||||||
//!
|
//!
|
||||||
@ -41,59 +40,60 @@
|
|||||||
//!
|
//!
|
||||||
//! There are three concepts in Vulkan related to descriptor sets:
|
//! There are three concepts in Vulkan related to descriptor sets:
|
||||||
//!
|
//!
|
||||||
//! - A `DescriptorSetLayout` is a Vulkan object that describes to the Vulkan implementation the
|
//! - A `VkDescriptorSetLayout` is a Vulkan object that describes to the Vulkan implementation the
|
||||||
//! layout of a future descriptor set. When you allocate a descriptor set, you have to pass an
|
//! layout of a future descriptor set. When you allocate a descriptor set, you have to pass an
|
||||||
//! instance of this object. This is represented with the [`DescriptorSetLayout`] type in
|
//! instance of this object. This is represented with the [`DescriptorSetLayout`] type in
|
||||||
//! vulkano.
|
//! vulkano.
|
||||||
//! - A `DescriptorPool` is a Vulkan object that holds the memory of descriptor sets and that can
|
//! - A `VkDescriptorPool` is a Vulkan object that holds the memory of descriptor sets and that can
|
||||||
//! be used to allocate and free individual descriptor sets. This is represented with the
|
//! be used to allocate and free individual descriptor sets. This is represented with the
|
||||||
//! [`DescriptorPool`] type in vulkano.
|
//! [`DescriptorPool`] type in vulkano.
|
||||||
//! - A `DescriptorSet` contains the bindings to resources and is allocated from a pool. This is
|
//! - A `VkDescriptorSet` contains the bindings to resources and is allocated from a pool. This is
|
||||||
//! represented with the [`UnsafeDescriptorSet`] type in vulkano.
|
//! represented with the [`RawDescriptorSet`] type in vulkano.
|
||||||
//!
|
//!
|
||||||
//! In addition to this, vulkano defines the following:
|
//! In addition to this, vulkano defines the following:
|
||||||
//!
|
//!
|
||||||
//! - The [`DescriptorSetAllocator`] trait can be implemented on types from which you can allocate
|
//! - The [`DescriptorSetAllocator`] trait can be implemented on types from which you can allocate
|
||||||
//! and free descriptor sets. However it is different from Vulkan descriptor pools in the sense
|
//! and free descriptor sets. However it is different from Vulkan descriptor pools in the sense
|
||||||
//! that an implementation of the [`DescriptorSetAllocator`] trait can manage multiple Vulkan
|
//! that an implementation of the `DescriptorSetAllocator` trait can manage multiple Vulkan
|
||||||
//! descriptor pools.
|
//! descriptor pools.
|
||||||
//! - The [`StandardDescriptorSetAllocator`] type is a default implementation of the
|
//! - The [`StandardDescriptorSetAllocator`] type is a default implementation of the
|
||||||
//! [`DescriptorSetAllocator`] trait.
|
//! [`DescriptorSetAllocator`] trait.
|
||||||
//! - The [`DescriptorSet`] trait is implemented on types that wrap around Vulkan descriptor sets in
|
//! - The [`DescriptorSet`] type wraps around an `RawDescriptorSet` a safe way. A Vulkan descriptor
|
||||||
//! a safe way. A Vulkan descriptor set is inherently unsafe, so we need safe wrappers around
|
//! set is inherently unsafe, so we need safe wrappers around them.
|
||||||
//! them.
|
//! - The [`DescriptorSetsCollection`] trait is implemented on collections of descriptor sets. It
|
||||||
//! - The [`DescriptorSetsCollection`] trait is implemented on collections of types that implement
|
//! is what you pass to the bind function.
|
||||||
//! [`DescriptorSet`]. It is what you pass to the draw functions.
|
|
||||||
//!
|
//!
|
||||||
//! [`DescriptorPool`]: pool::DescriptorPool
|
//! [`DescriptorPool`]: pool::DescriptorPool
|
||||||
//! [`UnsafeDescriptorSet`]: sys::UnsafeDescriptorSet
|
//! [`RawDescriptorSet`]: sys::RawDescriptorSet
|
||||||
//! [`DescriptorSetAllocator`]: allocator::DescriptorSetAllocator
|
//! [`DescriptorSetAllocator`]: allocator::DescriptorSetAllocator
|
||||||
//! [`StandardDescriptorSetAllocator`]: allocator::StandardDescriptorSetAllocator
|
//! [`StandardDescriptorSetAllocator`]: allocator::StandardDescriptorSetAllocator
|
||||||
|
|
||||||
pub(crate) use self::update::DescriptorWriteInfo;
|
pub(crate) use self::update::DescriptorWriteInfo;
|
||||||
|
use self::{
|
||||||
|
allocator::DescriptorSetAllocator,
|
||||||
|
layout::DescriptorSetLayout,
|
||||||
|
pool::{DescriptorPool, DescriptorPoolAlloc},
|
||||||
|
sys::RawDescriptorSet,
|
||||||
|
};
|
||||||
pub use self::{
|
pub use self::{
|
||||||
collection::DescriptorSetsCollection,
|
collection::DescriptorSetsCollection,
|
||||||
persistent::PersistentDescriptorSet,
|
|
||||||
update::{
|
update::{
|
||||||
CopyDescriptorSet, DescriptorBufferInfo, DescriptorImageViewInfo, WriteDescriptorSet,
|
CopyDescriptorSet, DescriptorBufferInfo, DescriptorImageViewInfo, WriteDescriptorSet,
|
||||||
WriteDescriptorSetElements,
|
WriteDescriptorSetElements,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use self::{
|
|
||||||
layout::DescriptorSetLayout,
|
|
||||||
pool::{DescriptorPool, DescriptorPoolAlloc},
|
|
||||||
};
|
|
||||||
use crate::{
|
use crate::{
|
||||||
acceleration_structure::AccelerationStructure,
|
acceleration_structure::AccelerationStructure,
|
||||||
buffer::view::BufferView,
|
buffer::view::BufferView,
|
||||||
descriptor_set::layout::{
|
descriptor_set::layout::{
|
||||||
DescriptorBindingFlags, DescriptorSetLayoutCreateFlags, DescriptorType,
|
DescriptorBindingFlags, DescriptorSetLayoutCreateFlags, DescriptorType,
|
||||||
},
|
},
|
||||||
device::DeviceOwned,
|
device::{Device, DeviceOwned},
|
||||||
image::{sampler::Sampler, ImageLayout},
|
image::{sampler::Sampler, ImageLayout},
|
||||||
VulkanObject,
|
Validated, ValidationError, VulkanError, VulkanObject,
|
||||||
};
|
};
|
||||||
use ahash::HashMap;
|
use ahash::HashMap;
|
||||||
|
use parking_lot::{RwLock, RwLockReadGuard};
|
||||||
use smallvec::{smallvec, SmallVec};
|
use smallvec::{smallvec, SmallVec};
|
||||||
use std::{
|
use std::{
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
@ -103,67 +103,225 @@ use std::{
|
|||||||
pub mod allocator;
|
pub mod allocator;
|
||||||
mod collection;
|
mod collection;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
pub mod persistent;
|
|
||||||
pub mod pool;
|
pub mod pool;
|
||||||
pub mod sys;
|
pub mod sys;
|
||||||
mod update;
|
mod update;
|
||||||
|
|
||||||
/// Trait for objects that contain a collection of resources that will be accessible by shaders.
|
/// An object that contains a collection of resources that will be accessible by shaders.
|
||||||
///
|
///
|
||||||
/// Objects of this type can be passed when submitting a draw command.
|
/// Descriptor sets can be bound when recording a command buffer.
|
||||||
pub unsafe trait DescriptorSet:
|
#[derive(Debug)]
|
||||||
VulkanObject<Handle = ash::vk::DescriptorSet> + DeviceOwned + Send + Sync
|
pub struct DescriptorSet {
|
||||||
{
|
inner: RawDescriptorSet,
|
||||||
|
resources: RwLock<DescriptorSetResources>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DescriptorSet {
|
||||||
|
/// Creates and returns a new descriptor set with a variable descriptor count of 0.
|
||||||
|
pub fn new(
|
||||||
|
allocator: Arc<dyn DescriptorSetAllocator>,
|
||||||
|
layout: Arc<DescriptorSetLayout>,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) -> Result<Arc<DescriptorSet>, Validated<VulkanError>> {
|
||||||
|
Self::new_variable(allocator, layout, 0, descriptor_writes, descriptor_copies)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates and returns a new descriptor set with the requested variable descriptor count.
|
||||||
|
pub fn new_variable(
|
||||||
|
allocator: Arc<dyn DescriptorSetAllocator>,
|
||||||
|
layout: Arc<DescriptorSetLayout>,
|
||||||
|
variable_descriptor_count: u32,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) -> Result<Arc<DescriptorSet>, Validated<VulkanError>> {
|
||||||
|
let mut set = DescriptorSet {
|
||||||
|
inner: RawDescriptorSet::new(allocator, &layout, variable_descriptor_count)?,
|
||||||
|
resources: RwLock::new(DescriptorSetResources::new(
|
||||||
|
&layout,
|
||||||
|
variable_descriptor_count,
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
|
||||||
|
set.update(descriptor_writes, descriptor_copies)?;
|
||||||
|
|
||||||
|
Ok(Arc::new(set))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the allocation of the descriptor set.
|
/// Returns the allocation of the descriptor set.
|
||||||
fn alloc(&self) -> &DescriptorPoolAlloc;
|
#[inline]
|
||||||
|
pub fn alloc(&self) -> &DescriptorPoolAlloc {
|
||||||
|
&self.inner.alloc().inner
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the descriptor pool that the descriptor set was allocated from.
|
/// Returns the descriptor pool that the descriptor set was allocated from.
|
||||||
fn pool(&self) -> &DescriptorPool;
|
#[inline]
|
||||||
|
pub fn pool(&self) -> &DescriptorPool {
|
||||||
|
self.inner.pool()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the layout of this descriptor set.
|
/// Returns the layout of this descriptor set.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn layout(&self) -> &Arc<DescriptorSetLayout> {
|
pub fn layout(&self) -> &Arc<DescriptorSetLayout> {
|
||||||
self.alloc().layout()
|
self.alloc().layout()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the variable descriptor count that this descriptor set was allocated with.
|
/// Returns the variable descriptor count that this descriptor set was allocated with.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn variable_descriptor_count(&self) -> u32 {
|
pub fn variable_descriptor_count(&self) -> u32 {
|
||||||
self.alloc().variable_descriptor_count()
|
self.alloc().variable_descriptor_count()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a [`DescriptorSetWithOffsets`] with the given dynamic offsets.
|
/// Creates a [`DescriptorSetWithOffsets`] with the given dynamic offsets.
|
||||||
fn offsets(
|
pub fn offsets(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
dynamic_offsets: impl IntoIterator<Item = u32>,
|
dynamic_offsets: impl IntoIterator<Item = u32>,
|
||||||
) -> DescriptorSetWithOffsets
|
) -> DescriptorSetWithOffsets {
|
||||||
where
|
|
||||||
Self: Sized + 'static,
|
|
||||||
{
|
|
||||||
DescriptorSetWithOffsets::new(self, dynamic_offsets)
|
DescriptorSetWithOffsets::new(self, dynamic_offsets)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the resources bound to this descriptor set.
|
/// Returns the resources bound to this descriptor set.
|
||||||
fn resources(&self) -> &DescriptorSetResources;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialEq for dyn DescriptorSet {
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &Self) -> bool {
|
pub fn resources(&self) -> RwLockReadGuard<'_, DescriptorSetResources> {
|
||||||
self.alloc() == other.alloc()
|
self.resources.read()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the descriptor set with new values.
|
||||||
|
pub fn update(
|
||||||
|
&mut self,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) -> Result<(), Box<ValidationError>> {
|
||||||
|
let descriptor_writes: SmallVec<[_; 8]> = descriptor_writes.into_iter().collect();
|
||||||
|
let descriptor_copies: SmallVec<[_; 8]> = descriptor_copies.into_iter().collect();
|
||||||
|
|
||||||
|
self.inner
|
||||||
|
.validate_update(&descriptor_writes, &descriptor_copies)?;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
Self::update_inner(
|
||||||
|
&self.inner,
|
||||||
|
self.resources.get_mut(),
|
||||||
|
&descriptor_writes,
|
||||||
|
&descriptor_copies,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
|
pub unsafe fn update_unchecked(
|
||||||
|
&mut self,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) {
|
||||||
|
let descriptor_writes: SmallVec<[_; 8]> = descriptor_writes.into_iter().collect();
|
||||||
|
let descriptor_copies: SmallVec<[_; 8]> = descriptor_copies.into_iter().collect();
|
||||||
|
|
||||||
|
Self::update_inner(
|
||||||
|
&self.inner,
|
||||||
|
self.resources.get_mut(),
|
||||||
|
&descriptor_writes,
|
||||||
|
&descriptor_copies,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the descriptor set with new values.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// - Host access to the descriptor set must be externally synchronized.
|
||||||
|
pub unsafe fn update_by_ref(
|
||||||
|
&self,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) -> Result<(), Box<ValidationError>> {
|
||||||
|
let descriptor_writes: SmallVec<[_; 8]> = descriptor_writes.into_iter().collect();
|
||||||
|
let descriptor_copies: SmallVec<[_; 8]> = descriptor_copies.into_iter().collect();
|
||||||
|
|
||||||
|
self.inner
|
||||||
|
.validate_update(&descriptor_writes, &descriptor_copies)?;
|
||||||
|
|
||||||
|
Self::update_inner(
|
||||||
|
&self.inner,
|
||||||
|
&mut self.resources.write(),
|
||||||
|
&descriptor_writes,
|
||||||
|
&descriptor_copies,
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
|
pub unsafe fn update_by_ref_unchecked(
|
||||||
|
&self,
|
||||||
|
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
||||||
|
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
||||||
|
) {
|
||||||
|
let descriptor_writes: SmallVec<[_; 8]> = descriptor_writes.into_iter().collect();
|
||||||
|
let descriptor_copies: SmallVec<[_; 8]> = descriptor_copies.into_iter().collect();
|
||||||
|
|
||||||
|
Self::update_inner(
|
||||||
|
&self.inner,
|
||||||
|
&mut self.resources.write(),
|
||||||
|
&descriptor_writes,
|
||||||
|
&descriptor_copies,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn update_inner(
|
||||||
|
inner: &RawDescriptorSet,
|
||||||
|
resources: &mut DescriptorSetResources,
|
||||||
|
descriptor_writes: &[WriteDescriptorSet],
|
||||||
|
descriptor_copies: &[CopyDescriptorSet],
|
||||||
|
) {
|
||||||
|
inner.update_unchecked(descriptor_writes, descriptor_copies);
|
||||||
|
|
||||||
|
for write in descriptor_writes {
|
||||||
|
resources.write(write, inner.layout());
|
||||||
|
}
|
||||||
|
|
||||||
|
for copy in descriptor_copies {
|
||||||
|
resources.copy(copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for dyn DescriptorSet {}
|
unsafe impl VulkanObject for DescriptorSet {
|
||||||
|
type Handle = ash::vk::DescriptorSet;
|
||||||
|
|
||||||
impl Hash for dyn DescriptorSet {
|
#[inline]
|
||||||
|
fn handle(&self) -> Self::Handle {
|
||||||
|
self.inner.handle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl DeviceOwned for DescriptorSet {
|
||||||
|
#[inline]
|
||||||
|
fn device(&self) -> &Arc<Device> {
|
||||||
|
self.inner.device()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq for DescriptorSet {
|
||||||
|
#[inline]
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.inner == other.inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Eq for DescriptorSet {}
|
||||||
|
|
||||||
|
impl Hash for DescriptorSet {
|
||||||
|
#[inline]
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.alloc().hash(state);
|
self.inner.hash(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The resources that are bound to a descriptor set.
|
/// The resources that are bound to a descriptor set.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DescriptorSetResources {
|
pub struct DescriptorSetResources {
|
||||||
binding_resources: HashMap<u32, DescriptorBindingResources>,
|
binding_resources: HashMap<u32, DescriptorBindingResources>,
|
||||||
}
|
}
|
||||||
@ -262,9 +420,8 @@ impl DescriptorSetResources {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn copy(&mut self, copy: &CopyDescriptorSet) {
|
pub(crate) fn copy(&mut self, copy: &CopyDescriptorSet) {
|
||||||
let src = copy
|
let resources = copy.src_set.resources();
|
||||||
.src_set
|
let src = resources
|
||||||
.resources()
|
|
||||||
.binding_resources
|
.binding_resources
|
||||||
.get(©.src_binding)
|
.get(©.src_binding)
|
||||||
.expect("descriptor copy has invalid src_binding number");
|
.expect("descriptor copy has invalid src_binding number");
|
||||||
@ -281,7 +438,7 @@ impl DescriptorSetResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The resources that are bound to a single descriptor set binding.
|
/// The resources that are bound to a single descriptor set binding.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum DescriptorBindingResources {
|
pub enum DescriptorBindingResources {
|
||||||
None(Elements<()>),
|
None(Elements<()>),
|
||||||
Buffer(Elements<DescriptorBufferInfo>),
|
Buffer(Elements<DescriptorBufferInfo>),
|
||||||
@ -471,13 +628,13 @@ impl DescriptorBindingResources {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct DescriptorSetWithOffsets {
|
pub struct DescriptorSetWithOffsets {
|
||||||
descriptor_set: Arc<dyn DescriptorSet>,
|
descriptor_set: Arc<DescriptorSet>,
|
||||||
dynamic_offsets: SmallVec<[u32; 4]>,
|
dynamic_offsets: SmallVec<[u32; 4]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DescriptorSetWithOffsets {
|
impl DescriptorSetWithOffsets {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
descriptor_set: Arc<dyn DescriptorSet>,
|
descriptor_set: Arc<DescriptorSet>,
|
||||||
dynamic_offsets: impl IntoIterator<Item = u32>,
|
dynamic_offsets: impl IntoIterator<Item = u32>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -487,21 +644,19 @@ impl DescriptorSetWithOffsets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_ref(&self) -> (&Arc<dyn DescriptorSet>, &[u32]) {
|
pub fn as_ref(&self) -> (&Arc<DescriptorSet>, &[u32]) {
|
||||||
(&self.descriptor_set, &self.dynamic_offsets)
|
(&self.descriptor_set, &self.dynamic_offsets)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn into_tuple(self) -> (Arc<dyn DescriptorSet>, impl ExactSizeIterator<Item = u32>) {
|
pub fn into_tuple(self) -> (Arc<DescriptorSet>, impl ExactSizeIterator<Item = u32>) {
|
||||||
(self.descriptor_set, self.dynamic_offsets.into_iter())
|
(self.descriptor_set, self.dynamic_offsets.into_iter())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> From<Arc<S>> for DescriptorSetWithOffsets
|
impl From<Arc<DescriptorSet>> for DescriptorSetWithOffsets {
|
||||||
where
|
#[inline]
|
||||||
S: DescriptorSet + 'static,
|
fn from(descriptor_set: Arc<DescriptorSet>) -> Self {
|
||||||
{
|
|
||||||
fn from(descriptor_set: Arc<S>) -> Self {
|
|
||||||
DescriptorSetWithOffsets::new(descriptor_set, std::iter::empty())
|
DescriptorSetWithOffsets::new(descriptor_set, std::iter::empty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,151 +0,0 @@
|
|||||||
//! A simple, immutable descriptor set that is expected to be long-lived.
|
|
||||||
//!
|
|
||||||
//! Creating a persistent descriptor set allocates from a pool, and can't be modified once created.
|
|
||||||
//! You are therefore encouraged to create them at initialization and not the during
|
|
||||||
//! performance-critical paths.
|
|
||||||
//!
|
|
||||||
//! > **Note**: You can control of the pool that is used to create the descriptor set, if you wish
|
|
||||||
//! > so. By creating a implementation of the `DescriptorPool` trait that doesn't perform any
|
|
||||||
//! > actual allocation, you can skip this allocation and make it acceptable to use a persistent
|
|
||||||
//! > descriptor set in performance-critical paths..
|
|
||||||
//!
|
|
||||||
//! # Examples
|
|
||||||
//! TODO:
|
|
||||||
|
|
||||||
use super::{
|
|
||||||
pool::{DescriptorPool, DescriptorPoolAlloc},
|
|
||||||
sys::UnsafeDescriptorSet,
|
|
||||||
CopyDescriptorSet,
|
|
||||||
};
|
|
||||||
use crate::{
|
|
||||||
descriptor_set::{
|
|
||||||
allocator::DescriptorSetAllocator, update::WriteDescriptorSet, DescriptorSet,
|
|
||||||
DescriptorSetLayout, DescriptorSetResources,
|
|
||||||
},
|
|
||||||
device::{Device, DeviceOwned},
|
|
||||||
Validated, ValidationError, VulkanError, VulkanObject,
|
|
||||||
};
|
|
||||||
use smallvec::SmallVec;
|
|
||||||
use std::{
|
|
||||||
hash::{Hash, Hasher},
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A simple, immutable descriptor set that is expected to be long-lived.
|
|
||||||
pub struct PersistentDescriptorSet {
|
|
||||||
inner: UnsafeDescriptorSet,
|
|
||||||
resources: DescriptorSetResources,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PersistentDescriptorSet {
|
|
||||||
/// Creates and returns a new descriptor set with a variable descriptor count of 0.
|
|
||||||
///
|
|
||||||
/// See `new_with_pool` for more.
|
|
||||||
#[inline]
|
|
||||||
pub fn new(
|
|
||||||
allocator: Arc<dyn DescriptorSetAllocator>,
|
|
||||||
layout: Arc<DescriptorSetLayout>,
|
|
||||||
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
|
||||||
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
|
||||||
) -> Result<Arc<PersistentDescriptorSet>, Validated<VulkanError>> {
|
|
||||||
Self::new_variable(allocator, layout, 0, descriptor_writes, descriptor_copies)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates and returns a new descriptor set with the requested variable descriptor count,
|
|
||||||
/// allocating it from the provided pool.
|
|
||||||
///
|
|
||||||
/// # Panics
|
|
||||||
///
|
|
||||||
/// - Panics if `layout` was created for push descriptors rather than descriptor sets.
|
|
||||||
/// - Panics if `variable_descriptor_count` is too large for the given `layout`.
|
|
||||||
pub fn new_variable(
|
|
||||||
allocator: Arc<dyn DescriptorSetAllocator>,
|
|
||||||
layout: Arc<DescriptorSetLayout>,
|
|
||||||
variable_descriptor_count: u32,
|
|
||||||
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
|
||||||
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
|
||||||
) -> Result<Arc<PersistentDescriptorSet>, Validated<VulkanError>> {
|
|
||||||
let mut set = PersistentDescriptorSet {
|
|
||||||
inner: UnsafeDescriptorSet::new(allocator, &layout, variable_descriptor_count)?,
|
|
||||||
resources: DescriptorSetResources::new(&layout, variable_descriptor_count),
|
|
||||||
};
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
set.update(descriptor_writes, descriptor_copies)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Arc::new(set))
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn update(
|
|
||||||
&mut self,
|
|
||||||
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>,
|
|
||||||
descriptor_copies: impl IntoIterator<Item = CopyDescriptorSet>,
|
|
||||||
) -> Result<(), Box<ValidationError>> {
|
|
||||||
let descriptor_writes: SmallVec<[_; 8]> = descriptor_writes.into_iter().collect();
|
|
||||||
let descriptor_copies: SmallVec<[_; 8]> = descriptor_copies.into_iter().collect();
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
self.inner.update(&descriptor_writes, &descriptor_copies)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
for write in descriptor_writes {
|
|
||||||
self.resources.write(&write, self.inner.layout());
|
|
||||||
}
|
|
||||||
|
|
||||||
for copy in descriptor_copies {
|
|
||||||
self.resources.copy(©);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl DescriptorSet for PersistentDescriptorSet {
|
|
||||||
#[inline]
|
|
||||||
fn alloc(&self) -> &DescriptorPoolAlloc {
|
|
||||||
&self.inner.alloc().inner
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn pool(&self) -> &DescriptorPool {
|
|
||||||
&self.inner.alloc().pool
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn resources(&self) -> &DescriptorSetResources {
|
|
||||||
&self.resources
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl VulkanObject for PersistentDescriptorSet {
|
|
||||||
type Handle = ash::vk::DescriptorSet;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn handle(&self) -> Self::Handle {
|
|
||||||
self.inner.handle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl DeviceOwned for PersistentDescriptorSet {
|
|
||||||
#[inline]
|
|
||||||
fn device(&self) -> &Arc<Device> {
|
|
||||||
self.layout().device()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialEq for PersistentDescriptorSet {
|
|
||||||
#[inline]
|
|
||||||
fn eq(&self, other: &Self) -> bool {
|
|
||||||
self.inner == other.inner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Eq for PersistentDescriptorSet {}
|
|
||||||
|
|
||||||
impl Hash for PersistentDescriptorSet {
|
|
||||||
#[inline]
|
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
|
||||||
self.inner.hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
layout::{DescriptorSetLayout, DescriptorSetLayoutCreateFlags, DescriptorType},
|
layout::{DescriptorSetLayout, DescriptorSetLayoutCreateFlags, DescriptorType},
|
||||||
sys::UnsafeDescriptorSet,
|
sys::RawDescriptorSet,
|
||||||
},
|
},
|
||||||
device::{Device, DeviceOwned, DeviceOwnedDebugWrapper},
|
device::{Device, DeviceOwned, DeviceOwnedDebugWrapper},
|
||||||
instance::InstanceOwnedDebugWrapper,
|
instance::InstanceOwnedDebugWrapper,
|
||||||
@ -345,7 +345,7 @@ impl DescriptorPool {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn free_descriptor_sets(
|
pub unsafe fn free_descriptor_sets(
|
||||||
&self,
|
&self,
|
||||||
descriptor_sets: impl IntoIterator<Item = UnsafeDescriptorSet>,
|
descriptor_sets: impl IntoIterator<Item = RawDescriptorSet>,
|
||||||
) -> Result<(), Validated<VulkanError>> {
|
) -> Result<(), Validated<VulkanError>> {
|
||||||
self.validate_free_descriptor_sets()?;
|
self.validate_free_descriptor_sets()?;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ impl DescriptorPool {
|
|||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn free_descriptor_sets_unchecked(
|
pub unsafe fn free_descriptor_sets_unchecked(
|
||||||
&self,
|
&self,
|
||||||
descriptor_sets: impl IntoIterator<Item = UnsafeDescriptorSet>,
|
descriptor_sets: impl IntoIterator<Item = RawDescriptorSet>,
|
||||||
) -> Result<(), VulkanError> {
|
) -> Result<(), VulkanError> {
|
||||||
let sets: SmallVec<[_; 8]> = descriptor_sets.into_iter().map(|s| s.handle()).collect();
|
let sets: SmallVec<[_; 8]> = descriptor_sets.into_iter().map(|s| s.handle()).collect();
|
||||||
if !sets.is_empty() {
|
if !sets.is_empty() {
|
||||||
@ -440,7 +440,7 @@ unsafe impl DeviceOwned for DescriptorPool {
|
|||||||
|
|
||||||
impl_id_counter!(DescriptorPool);
|
impl_id_counter!(DescriptorPool);
|
||||||
|
|
||||||
/// Parameters to create a new `UnsafeDescriptorPool`.
|
/// Parameters to create a new `DescriptorPool`.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DescriptorPoolCreateInfo {
|
pub struct DescriptorPoolCreateInfo {
|
||||||
/// Additional properties of the descriptor pool.
|
/// Additional properties of the descriptor pool.
|
||||||
@ -598,7 +598,7 @@ vulkan_bitflags! {
|
|||||||
]), */
|
]), */
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parameters to allocate a new `UnsafeDescriptorSet` from an `UnsafeDescriptorPool`.
|
/// Parameters to allocate a new `DescriptorPoolAlloc` from a `DescriptorPool`.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DescriptorSetAllocateInfo {
|
pub struct DescriptorSetAllocateInfo {
|
||||||
/// The descriptor set layout to create the set for.
|
/// The descriptor set layout to create the set for.
|
||||||
|
@ -21,27 +21,27 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Low-level descriptor set.
|
/// A raw descriptor set corresponding directly to a `VkDescriptorSet`.
|
||||||
///
|
///
|
||||||
/// This descriptor set does not keep track of synchronization,
|
/// This descriptor set does not keep track of synchronization, nor does it store any information
|
||||||
/// nor does it store any information on what resources have been written to each descriptor.
|
/// on what resources have been written to each descriptor.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UnsafeDescriptorSet {
|
pub struct RawDescriptorSet {
|
||||||
allocation: ManuallyDrop<DescriptorSetAlloc>,
|
allocation: ManuallyDrop<DescriptorSetAlloc>,
|
||||||
allocator: Arc<dyn DescriptorSetAllocator>,
|
allocator: Arc<dyn DescriptorSetAllocator>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnsafeDescriptorSet {
|
impl RawDescriptorSet {
|
||||||
/// Allocates a new descriptor set and returns it.
|
/// Allocates a new descriptor set and returns it.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
allocator: Arc<dyn DescriptorSetAllocator>,
|
allocator: Arc<dyn DescriptorSetAllocator>,
|
||||||
layout: &Arc<DescriptorSetLayout>,
|
layout: &Arc<DescriptorSetLayout>,
|
||||||
variable_descriptor_count: u32,
|
variable_descriptor_count: u32,
|
||||||
) -> Result<UnsafeDescriptorSet, Validated<VulkanError>> {
|
) -> Result<RawDescriptorSet, Validated<VulkanError>> {
|
||||||
let allocation = allocator.allocate(layout, variable_descriptor_count)?;
|
let allocation = allocator.allocate(layout, variable_descriptor_count)?;
|
||||||
|
|
||||||
Ok(UnsafeDescriptorSet {
|
Ok(RawDescriptorSet {
|
||||||
allocation: ManuallyDrop::new(allocation),
|
allocation: ManuallyDrop::new(allocation),
|
||||||
allocator,
|
allocator,
|
||||||
})
|
})
|
||||||
@ -77,11 +77,12 @@ impl UnsafeDescriptorSet {
|
|||||||
///
|
///
|
||||||
/// - The resources in `descriptor_writes` and `descriptor_copies` must be kept alive for as
|
/// - The resources in `descriptor_writes` and `descriptor_copies` must be kept alive for as
|
||||||
/// long as `self` is in use.
|
/// long as `self` is in use.
|
||||||
/// - The descriptor set must not be in use by the device,
|
/// - The descriptor set must not be in use by the device, or be recorded to a command buffer
|
||||||
/// or be recorded to a command buffer as part of a bind command.
|
/// as part of a bind command.
|
||||||
|
/// - Host access to the descriptor set must be externally synchronized.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn update(
|
pub unsafe fn update(
|
||||||
&mut self,
|
&self,
|
||||||
descriptor_writes: &[WriteDescriptorSet],
|
descriptor_writes: &[WriteDescriptorSet],
|
||||||
descriptor_copies: &[CopyDescriptorSet],
|
descriptor_copies: &[CopyDescriptorSet],
|
||||||
) -> Result<(), Box<ValidationError>> {
|
) -> Result<(), Box<ValidationError>> {
|
||||||
@ -91,7 +92,7 @@ impl UnsafeDescriptorSet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_update(
|
pub(super) fn validate_update(
|
||||||
&self,
|
&self,
|
||||||
descriptor_writes: &[WriteDescriptorSet],
|
descriptor_writes: &[WriteDescriptorSet],
|
||||||
descriptor_copies: &[CopyDescriptorSet],
|
descriptor_copies: &[CopyDescriptorSet],
|
||||||
@ -112,7 +113,7 @@ impl UnsafeDescriptorSet {
|
|||||||
|
|
||||||
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
|
||||||
pub unsafe fn update_unchecked(
|
pub unsafe fn update_unchecked(
|
||||||
&mut self,
|
&self,
|
||||||
descriptor_writes: &[WriteDescriptorSet],
|
descriptor_writes: &[WriteDescriptorSet],
|
||||||
descriptor_copies: &[CopyDescriptorSet],
|
descriptor_copies: &[CopyDescriptorSet],
|
||||||
) {
|
) {
|
||||||
@ -206,7 +207,7 @@ impl UnsafeDescriptorSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for UnsafeDescriptorSet {
|
impl Drop for RawDescriptorSet {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let allocation = unsafe { ManuallyDrop::take(&mut self.allocation) };
|
let allocation = unsafe { ManuallyDrop::take(&mut self.allocation) };
|
||||||
@ -214,7 +215,7 @@ impl Drop for UnsafeDescriptorSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl VulkanObject for UnsafeDescriptorSet {
|
unsafe impl VulkanObject for RawDescriptorSet {
|
||||||
type Handle = ash::vk::DescriptorSet;
|
type Handle = ash::vk::DescriptorSet;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -223,23 +224,23 @@ unsafe impl VulkanObject for UnsafeDescriptorSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl DeviceOwned for UnsafeDescriptorSet {
|
unsafe impl DeviceOwned for RawDescriptorSet {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn device(&self) -> &Arc<Device> {
|
fn device(&self) -> &Arc<Device> {
|
||||||
self.allocation.inner.device()
|
self.allocation.inner.device()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for UnsafeDescriptorSet {
|
impl PartialEq for RawDescriptorSet {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.allocation.inner == other.allocation.inner
|
self.allocation.inner == other.allocation.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for UnsafeDescriptorSet {}
|
impl Eq for RawDescriptorSet {}
|
||||||
|
|
||||||
impl Hash for UnsafeDescriptorSet {
|
impl Hash for RawDescriptorSet {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.allocation.inner.hash(state);
|
self.allocation.inner.hash(state);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{
|
use super::{
|
||||||
layout::{DescriptorSetLayout, DescriptorType},
|
layout::{DescriptorSetLayout, DescriptorType},
|
||||||
sys::UnsafeDescriptorSet,
|
sys::RawDescriptorSet,
|
||||||
DescriptorSet,
|
DescriptorSet,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -1581,7 +1581,7 @@ pub struct CopyDescriptorSet {
|
|||||||
/// The source descriptor set to copy from.
|
/// The source descriptor set to copy from.
|
||||||
///
|
///
|
||||||
/// There is no default value.
|
/// There is no default value.
|
||||||
pub src_set: Arc<dyn DescriptorSet>,
|
pub src_set: Arc<DescriptorSet>,
|
||||||
|
|
||||||
/// The binding number in the source descriptor set to copy from.
|
/// The binding number in the source descriptor set to copy from.
|
||||||
///
|
///
|
||||||
@ -1612,7 +1612,7 @@ pub struct CopyDescriptorSet {
|
|||||||
impl CopyDescriptorSet {
|
impl CopyDescriptorSet {
|
||||||
/// Returns a `CopyDescriptorSet` with the specified `src_set`.
|
/// Returns a `CopyDescriptorSet` with the specified `src_set`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(src_set: Arc<dyn DescriptorSet>) -> Self {
|
pub fn new(src_set: Arc<DescriptorSet>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
src_set,
|
src_set,
|
||||||
src_binding: 0,
|
src_binding: 0,
|
||||||
@ -1624,10 +1624,7 @@ impl CopyDescriptorSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn validate(
|
pub(crate) fn validate(&self, dst_set: &RawDescriptorSet) -> Result<(), Box<ValidationError>> {
|
||||||
&self,
|
|
||||||
dst_set: &UnsafeDescriptorSet,
|
|
||||||
) -> Result<(), Box<ValidationError>> {
|
|
||||||
let &Self {
|
let &Self {
|
||||||
ref src_set,
|
ref src_set,
|
||||||
src_binding,
|
src_binding,
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
//! DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutCreateInfo,
|
//! DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutCreateInfo,
|
||||||
//! DescriptorType,
|
//! DescriptorType,
|
||||||
//! },
|
//! },
|
||||||
//! PersistentDescriptorSet, WriteDescriptorSet,
|
//! DescriptorSet, WriteDescriptorSet,
|
||||||
//! },
|
//! },
|
||||||
//! format::Format,
|
//! format::Format,
|
||||||
//! image::{
|
//! image::{
|
||||||
@ -99,7 +99,7 @@
|
|||||||
//! };
|
//! };
|
||||||
//! let image_view = ImageView::new(image, create_info).unwrap();
|
//! let image_view = ImageView::new(image, create_info).unwrap();
|
||||||
//!
|
//!
|
||||||
//! let descriptor_set = PersistentDescriptorSet::new(
|
//! let descriptor_set = DescriptorSet::new(
|
||||||
//! descriptor_set_allocator.clone(),
|
//! descriptor_set_allocator.clone(),
|
||||||
//! descriptor_set_layout.clone(),
|
//! descriptor_set_layout.clone(),
|
||||||
//! [WriteDescriptorSet::image_view(0, image_view)],
|
//! [WriteDescriptorSet::image_view(0, image_view)],
|
||||||
|
@ -448,7 +448,7 @@ mod tests {
|
|||||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::{
|
descriptor_set::{
|
||||||
allocator::StandardDescriptorSetAllocator, PersistentDescriptorSet, WriteDescriptorSet,
|
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
|
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
|
||||||
pipeline::{
|
pipeline::{
|
||||||
@ -544,7 +544,7 @@ mod tests {
|
|||||||
device.clone(),
|
device.clone(),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
));
|
));
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
ds_allocator,
|
ds_allocator,
|
||||||
pipeline.layout().set_layouts().get(0).unwrap().clone(),
|
pipeline.layout().set_layouts().get(0).unwrap().clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
@ -688,7 +688,7 @@ mod tests {
|
|||||||
device.clone(),
|
device.clone(),
|
||||||
Default::default(),
|
Default::default(),
|
||||||
));
|
));
|
||||||
let set = PersistentDescriptorSet::new(
|
let set = DescriptorSet::new(
|
||||||
ds_allocator,
|
ds_allocator,
|
||||||
pipeline.layout().set_layouts().get(0).unwrap().clone(),
|
pipeline.layout().set_layouts().get(0).unwrap().clone(),
|
||||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||||
|
Loading…
Reference in New Issue
Block a user