mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Replace try macro with '?' (#1130)
This commit is contained in:
parent
84d6f1b33a
commit
f997e9322f
@ -243,7 +243,7 @@ pub fn reflect(name: &str, spirv: &[u32], dump: bool) -> Result<TokenStream, Err
|
||||
|
||||
unsafe {
|
||||
Ok(#struct_name {
|
||||
shader: try!(::vulkano::pipeline::shader::ShaderModule::from_words(device, &words))
|
||||
shader: ::vulkano::pipeline::shader::ShaderModule::from_words(device, &words)?
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,14 @@ macro_rules! device_extensions {
|
||||
|
||||
let properties: Vec<vk::ExtensionProperties> = unsafe {
|
||||
let mut num = 0;
|
||||
try!(check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, ptr::null_mut())));
|
||||
check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, ptr::null_mut()
|
||||
))?;
|
||||
|
||||
let mut properties = Vec::with_capacity(num as usize);
|
||||
try!(check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, properties.as_mut_ptr())));
|
||||
check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, properties.as_mut_ptr()
|
||||
))?;
|
||||
properties.set_len(num as usize);
|
||||
properties
|
||||
};
|
||||
@ -63,12 +65,14 @@ macro_rules! device_extensions {
|
||||
|
||||
let properties: Vec<vk::ExtensionProperties> = unsafe {
|
||||
let mut num = 0;
|
||||
try!(check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, ptr::null_mut())));
|
||||
check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, ptr::null_mut()
|
||||
))?;
|
||||
|
||||
let mut properties = Vec::with_capacity(num as usize);
|
||||
try!(check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, properties.as_mut_ptr())));
|
||||
check_errors(vk.EnumerateDeviceExtensionProperties(
|
||||
physical_device.internal_object(), ptr::null(), &mut num, properties.as_mut_ptr()
|
||||
))?;
|
||||
properties.set_len(num as usize);
|
||||
properties
|
||||
};
|
||||
|
@ -79,15 +79,15 @@ macro_rules! extensions {
|
||||
impl fmt::Debug for $sname {
|
||||
#[allow(unused_assignments)]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "["));
|
||||
write!(f, "[")?;
|
||||
|
||||
let mut first = true;
|
||||
|
||||
$(
|
||||
if self.$ext {
|
||||
if !first { try!(write!(f, ", ")); }
|
||||
if !first { write!(f, ", ")? }
|
||||
else { first = false; }
|
||||
try!(f.write_str(str::from_utf8($s).unwrap()));
|
||||
f.write_str(str::from_utf8($s).unwrap())?;
|
||||
}
|
||||
)*
|
||||
|
||||
|
@ -42,12 +42,14 @@ macro_rules! instance_extensions {
|
||||
|
||||
let properties: Vec<vk::ExtensionProperties> = unsafe {
|
||||
let mut num = 0;
|
||||
try!(check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, ptr::null_mut())));
|
||||
check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, ptr::null_mut()
|
||||
))?;
|
||||
|
||||
let mut properties = Vec::with_capacity(num as usize);
|
||||
try!(check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, properties.as_mut_ptr())));
|
||||
check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, properties.as_mut_ptr()
|
||||
))?;
|
||||
properties.set_len(num as usize);
|
||||
properties
|
||||
};
|
||||
@ -91,12 +93,14 @@ macro_rules! instance_extensions {
|
||||
|
||||
let properties: Vec<vk::ExtensionProperties> = unsafe {
|
||||
let mut num = 0;
|
||||
try!(check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, ptr::null_mut())));
|
||||
check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, ptr::null_mut()
|
||||
))?;
|
||||
|
||||
let mut properties = Vec::with_capacity(num as usize);
|
||||
try!(check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, properties.as_mut_ptr())));
|
||||
check_errors(entry_points.EnumerateInstanceExtensionProperties(
|
||||
ptr::null(), &mut num, properties.as_mut_ptr()
|
||||
))?;
|
||||
properties.set_len(num as usize);
|
||||
properties
|
||||
};
|
||||
|
@ -344,9 +344,9 @@ impl DisplayMode {
|
||||
};
|
||||
|
||||
let mut output = mem::uninitialized();
|
||||
try!(check_errors(vk.CreateDisplayModeKHR(display.device.internal_object(),
|
||||
check_errors(vk.CreateDisplayModeKHR(display.device.internal_object(),
|
||||
display.display, &infos, ptr::null(),
|
||||
&mut output)));
|
||||
&mut output))?;
|
||||
output
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ unsafe impl<F> GpuFuture for SemaphoreSignalFuture<F>
|
||||
unimplemented!() // TODO: how to do that?
|
||||
/*debug_assert_eq!(builder.num_signal_semaphores(), 0);
|
||||
builder.add_signal_semaphore(&self.semaphore);
|
||||
try!(builder.submit(&queue));*/
|
||||
builder.submit(&queue)?;*/
|
||||
},
|
||||
SubmitAnyBuilder::QueuePresent(present) => {
|
||||
present.submit(&queue)?;
|
||||
|
Loading…
Reference in New Issue
Block a user