From 4208814e7460a74637e1646939591f38f4fd8cea Mon Sep 17 00:00:00 2001 From: tomaka Date: Wed, 23 Aug 2017 15:45:37 +0200 Subject: [PATCH] Fix #760 (#761) --- examples/src/bin/runtime-shader.rs | 8 ++++---- vulkano/src/descriptor/pipeline_layout/limits_check.rs | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/src/bin/runtime-shader.rs b/examples/src/bin/runtime-shader.rs index acb8da70..3942301f 100644 --- a/examples/src/bin/runtime-shader.rs +++ b/examples/src/bin/runtime-shader.rs @@ -246,10 +246,10 @@ fn main() { struct VertLayout(ShaderStages); unsafe impl PipelineLayoutDesc for VertLayout { // Number of descriptor sets it takes. - fn num_sets(&self) -> usize { 1 } + fn num_sets(&self) -> usize { 0 } // Number of entries (bindings) in each set. fn num_bindings_in_set(&self, set: usize) -> Option { - match set { 0 => Some(1), _ => None, } + match set { _ => None, } } // Descriptor descriptions. fn descriptor(&self, set: usize, binding: usize) -> Option { @@ -341,9 +341,9 @@ fn main() { #[derive(Debug, Copy, Clone)] struct FragLayout(ShaderStages); unsafe impl PipelineLayoutDesc for FragLayout { - fn num_sets(&self) -> usize { 1 } + fn num_sets(&self) -> usize { 0 } fn num_bindings_in_set(&self, set: usize) -> Option { - match set { 0 => Some(1), _ => None, } + match set { _ => None, } } fn descriptor(&self, set: usize, binding: usize) -> Option { match (set, binding) { _ => None, } diff --git a/vulkano/src/descriptor/pipeline_layout/limits_check.rs b/vulkano/src/descriptor/pipeline_layout/limits_check.rs index c68b8335..dc9ad966 100644 --- a/vulkano/src/descriptor/pipeline_layout/limits_check.rs +++ b/vulkano/src/descriptor/pipeline_layout/limits_check.rs @@ -34,8 +34,11 @@ pub fn check_desc_against_limits(device: &Device, desc: &D) let mut num_input_attachments = Counter::default(); for set in 0 .. desc.num_sets() { - for binding in 0 .. desc.num_bindings_in_set(set).unwrap() { - let descriptor = desc.descriptor(set, binding).unwrap(); + let num_bindings_in_set = desc.num_bindings_in_set(set) + .expect("Wrong implementation of PipelineLayoutDesc"); + for binding in 0 .. num_bindings_in_set { + let descriptor = desc.descriptor(set, binding) + .expect("Wrong implementation of PipelineLayoutDesc"); num_resources.increment(descriptor.array_count, &descriptor.stages); match descriptor.ty.ty().expect("Not implemented yet") { // TODO: