mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 14:56:42 +00:00
Require initialization of descriptor sets
This commit is contained in:
parent
a57eea3c6b
commit
d5f3409247
@ -107,11 +107,10 @@ fn main() {
|
||||
let (pipeline_layout, set) = {
|
||||
let layout1 = vulkano::descriptor_set::DescriptorSetLayout::new(&device, Default::default()).unwrap();
|
||||
let pipeline_layout = vulkano::descriptor_set::PipelineLayout::new(&device, Default::default(), layout1.clone()).unwrap();
|
||||
let set1 = vulkano::descriptor_set::DescriptorSet::new(&descriptor_pool, &layout1).unwrap();
|
||||
let set1 = vulkano::descriptor_set::DescriptorSet::new(&descriptor_pool, &layout1, uniform_buffer.clone() as std::sync::Arc<_>).unwrap();
|
||||
(pipeline_layout, set1)
|
||||
};
|
||||
|
||||
|
||||
let pipeline = {
|
||||
let ia = vulkano::pipeline::input_assembly::InputAssembly {
|
||||
topology: vulkano::pipeline::input_assembly::PrimitiveTopology::TriangleList,
|
||||
@ -150,8 +149,6 @@ fn main() {
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
|
||||
set.write(uniform_buffer.clone());
|
||||
|
||||
let command_buffers = framebuffers.iter().map(|framebuffer| {
|
||||
vulkano::command_buffer::PrimaryCommandBufferBuilder::new(&cb_pool).unwrap()
|
||||
.draw_inline(&renderpass, &framebuffer, [0.0, 0.0, 1.0, 1.0])
|
||||
|
@ -285,8 +285,24 @@ impl<S> DescriptorSet<S> where S: DescriptorSetDesc {
|
||||
///
|
||||
/// - Panicks if the pool and the layout were not created from the same `Device`.
|
||||
///
|
||||
pub fn new(pool: &Arc<DescriptorPool>, layout: &Arc<DescriptorSetLayout<S>>)
|
||||
pub fn new(pool: &Arc<DescriptorPool>, layout: &Arc<DescriptorSetLayout<S>>, init: S::Init)
|
||||
-> Result<Arc<DescriptorSet<S>>, OomError>
|
||||
{
|
||||
unsafe {
|
||||
let set = try!(DescriptorSet::uninitialized(pool, layout));
|
||||
set.unchecked_write(layout.description().decode_init(init));
|
||||
Ok(set)
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// # Panic
|
||||
///
|
||||
/// - Panicks if the pool and the layout were not created from the same `Device`.
|
||||
///
|
||||
// FIXME: this has to check whether there's still enough room in the pool
|
||||
pub unsafe fn uninitialized(pool: &Arc<DescriptorPool>, layout: &Arc<DescriptorSetLayout<S>>)
|
||||
-> Result<Arc<DescriptorSet<S>>, OomError>
|
||||
{
|
||||
assert_eq!(&*pool.device as *const Device, &*layout.device as *const Device);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user