DriftTexture · const
DECODE_OP
A texture's decoder, as data.
Explained in DriftTexture.
const DECODE_OP:import { DECODE_OP } from '@driftengine/texture';In depth
This is the file where the expensive mistake would be made, so the reasoning is here. The
decode program is uploaded as a uniform buffer and walked by one shader. There is no code
generation, no #define, no shader per material and no variant — because ARCHITECTURE.md has
already measured what the other way costs, with the number: a fifth permutation flag took the
generated WGSL corpus from 914 KB to 1,906 KB and cost 196,910 gzipped bytes on every
consumer, including those who never enabled it, because deflate's window is 32 KB and
near-identical permutations do not deduplicate. A decode graph as permutations would be that
mistake with a far larger exponent — per material rather than per feature.
As data it costs bytes, linearly, and a new operation is one more case in one switch.
A node is four words: op, a, b, out. Which of a and b name registers rather than
immediates is a property of the operation, held in OP_ARGS so that the validator and both
interpreters read one table rather than three copies of a convention.