aetna-wgpu 0.3.2

Aetna — wgpu backend (native + wasm)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! wgpu-side scissor binding. The cross-backend paint primitives —
//! `QuadInstance`, `InstanceRun`, `PaintItem`, `PhysicalScissor`,
//! `physical_scissor`, `pack_instance`, `close_run`, `rgba_f32` —
//! live in [`aetna_core::paint`] so `aetna-wgpu` and `aetna-vulkano`
//! consume them from a single source. This file only carries the
//! wgpu-shaped `set_scissor` wrapper, which has to know about
//! `wgpu::RenderPass` and so cannot live in the backend-agnostic core.

use aetna_core::paint::PhysicalScissor;

pub(crate) fn set_scissor(
    pass: &mut wgpu::RenderPass<'_>,
    scissor: Option<PhysicalScissor>,
    full: PhysicalScissor,
) {
    let s = scissor.unwrap_or(full);
    pass.set_scissor_rect(s.x, s.y, s.w, s.h);
}