1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use crate::{
assets::Shader,
id::Id,
renderer::{ Bindings, Options, Renderer, ScissorsRect },
};
#[derive(Default)]
pub struct Pipeline {
pub shader: Id<Shader>,
pub bindings: Bindings,
pub cycle: usize,
pub disabled: bool,
pub options: Options,
}
impl Pipeline {
pub fn cycle(&self, renderer: &Renderer) -> bool {
!self.disabled && self.cycle != renderer.cycle() && !self.shader.is_null()
}
pub fn ready(&self) -> bool {
self.bindings.loaded()
}
pub fn with_scissors_rect(
mut self,
clip_min_x: u32,
clip_min_y: u32,
width: u32,
height: u32,
) -> Self {
self.options.scissors_rect = Some (
ScissorsRect {
clip_min_x,
clip_min_y,
width,
height,
}
);
self
}
}