Fix multi graphics pipeline creation

When creating multiple graphics pipelines, some may fail and an error will be returned.
Some pipelines might still be built correctly, so we want to return the error and the pipelines.
The current implementation discards all pipelines
This commit is contained in:
msiglreith 2017-04-05 15:20:02 +02:00
parent a7af586e92
commit 495c617513

View file

@ -425,7 +425,7 @@ pub trait DeviceV1_0 {
pipeline_cache: vk::PipelineCache, pipeline_cache: vk::PipelineCache,
create_infos: &[vk::GraphicsPipelineCreateInfo], create_infos: &[vk::GraphicsPipelineCreateInfo],
allocation_callbacks: Option<&vk::AllocationCallbacks>) allocation_callbacks: Option<&vk::AllocationCallbacks>)
-> VkResult<Vec<vk::Pipeline>> { -> (Vec<vk::Pipeline>, VkResult<()>) {
let mut pipelines = Vec::with_capacity(create_infos.len()); let mut pipelines = Vec::with_capacity(create_infos.len());
let err_code = self.fp_v1_0() let err_code = self.fp_v1_0()
.create_graphics_pipelines(self.handle(), .create_graphics_pipelines(self.handle(),
@ -436,8 +436,8 @@ pub trait DeviceV1_0 {
pipelines.as_mut_ptr()); pipelines.as_mut_ptr());
pipelines.set_len(create_infos.len()); pipelines.set_len(create_infos.len());
match err_code { match err_code {
vk::Result::Success => Ok(pipelines), vk::Result::Success => (pipelines, Ok(())),
_ => Err(err_code), _ => (pipelines, Err(err_code)),
} }
} }