use aetna_core::paint::PhysicalScissor;
use smallvec::smallvec;
use vulkano::command_buffer::{AutoCommandBufferBuilder, PrimaryAutoCommandBuffer};
use vulkano::pipeline::graphics::viewport::Scissor;
pub(crate) fn set_scissor(
builder: &mut AutoCommandBufferBuilder<PrimaryAutoCommandBuffer>,
scissor: Option<PhysicalScissor>,
full: PhysicalScissor,
) {
let s = scissor.unwrap_or(full);
builder
.set_scissor(
0,
smallvec![Scissor {
offset: [s.x, s.y],
extent: [s.w.max(1), s.h.max(1)],
}],
)
.expect("set_scissor");
}