Add some debug assertions for set_scissor (#810)

This commit is contained in:
tomaka 2017-09-07 16:52:41 +02:00 committed by GitHub
parent 9662f8b092
commit c70f3efb6b

View File

@ -1287,7 +1287,13 @@ impl<P> UnsafeCommandBufferBuilder<P> {
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!({