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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! **FNV-1a over the wet buffer, and nothing else.**
//!
//! # Why the CPU buffer and not the images
//!
//! The two `Image`s a canvas owns are **output**. `crates/bevy_carnage/src/vfx.rs:6-19` states the rule
//! this crate inherits: GPU output is write-only, nothing reads it back, and a value that cannot reach
//! a hash cannot be the authority for one. So the digest is taken over `(amount, age)` in row-major
//! order — the CPU state that *decides* what the images will say — and the uploaded pixels are a
//! derived, cosmetic account of it.
//!
//! That is also what makes this crate's headline claim checkable. Texture-space blood accumulation
//! elsewhere is a GPU render target, which is why nobody can hash it; hashing this one is a two-line
//! fold because the state never left the CPU.
//!
//! FNV-1a (Fowler–Noll–Vo, 1991) rather than a cryptographic hash: 64 bits over 3 bytes per texel, one
//! multiply and one xor per byte, and no allocation. It is a fingerprint for equality, not a signature.
/// FNV-1a 64-bit offset basis.
const FNV_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;
/// FNV-1a 64-bit prime.
const FNV_PRIME: u64 = 0x0000_0100_0000_01b3;
/// A running FNV-1a 64 fold.
///
/// Kept as a type rather than a free function over a slice because a texel's state is a `(u8, u16)`
/// tuple, not bytes — building a byte buffer to hash it would allocate a second copy of the canvas
/// every time anyone asked for a digest.
pub ;