From c70f3efb6bc563b5b6e5c11b89e9f460e8774d43 Mon Sep 17 00:00:00 2001 From: tomaka Date: Thu, 7 Sep 2017 16:52:41 +0200 Subject: [PATCH] Add some debug assertions for set_scissor (#810) --- vulkano/src/command_buffer/sys.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vulkano/src/command_buffer/sys.rs b/vulkano/src/command_buffer/sys.rs index 2350875f..be3a5a6b 100644 --- a/vulkano/src/command_buffer/sys.rs +++ b/vulkano/src/command_buffer/sys.rs @@ -1287,7 +1287,13 @@ impl

UnsafeCommandBufferBuilder

{ return; } - // TODO: missing a debug assert for limits on the actual scissor values + debug_assert!(scissors.iter().all(|s| s.offset.x >= 0 && s.offset.y >= 0)); + debug_assert!(scissors.iter().all(|s| { + s.extent.width < i32::max_value() as u32 && + s.extent.height < i32::max_value() as u32 && + s.offset.x.checked_add(s.extent.width as i32).is_some() && + s.offset.y.checked_add(s.extent.height as i32).is_some() + })); debug_assert!((first_scissor == 0 && scissors.len() == 1) || self.device().enabled_features().multi_viewport); debug_assert!({