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
//! Hardware rasterization sink hook.
//!
//! Lets a hardware block take over the engine's flat-shaded primitives -- triangles
//! and lines -- instead of the CPU rasterizer.
//!
//! Triangles are offered *after* culling and *after* depth has been resolved through
//! the state's depth mode and bias, so the sink sees exactly the triangle the CPU
//! rasterizer would have drawn. Lines are offered with their final screen-space
//! endpoints.
//!
//! A sink that accepts a primitive takes responsibility for drawing it; the CPU
//! path is then skipped for that primitive only. The contract is the same
//! `true` = handled / `false` = fall back as
//! [`HardwareAccelerator`](crate::pipeline::output::display_backend::HardwareAccelerator),
//! so one backend can implement both.
//!
//! Methods take `&self` so the sink can live in [`RasterState`], which is `Copy`
//! and passed by shared reference all the way down the rasterizer. Implementations
//! that need to accumulate state use interior mutability -- for a GPU that means
//! buffering primitives and submitting them in one batch, which is the whole point:
//! per-primitive submission would cost more in command overhead than the
//! rasterization it saves.
//!
//! [`RasterState`]: crate::pipeline::rasterize::draw::state::RasterState
use Debug;
use Rgb565;
use Point2;
/// A hardware sink for flat-shaded rasterization primitives.