onejs-sl 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.12
4
+
5
+ The noise hashes are integer arithmetic, so every GPU draws the same bits. Value noise and voronoi look different, seed 0 included; program hashes do not change.
6
+
7
+ - `noise`, `fbm`, `voronoi` and value `fx.noise` fields look different; simplex, turbulence and ridged do not
8
+ - Seeds closer than 1/65536 draw the same field, and cells past 2^31 draw the edge cell
9
+ - A 4 octave fbm costs about 14% more (3840 x 2160: 0.50 to 0.57 ms on an M4 Pro, WebGPU)
10
+ - goldens.json ships bit exact hash probes for a host's compiler, and marks exact fixtures
11
+ - `npm run goldens -- --check` compares a machine's drawing with goldens.json
12
+
3
13
  ## 0.1.11
4
14
 
5
15
  The value noise hash no longer rounds differently from one GPU to the next. Seeded value noise looks different, with the same character; program hashes do not change.
package/README.md CHANGED
@@ -101,8 +101,9 @@ by `npm run lib`, and nobody edits the copies:
101
101
 
102
102
  `lib/translate.ts` does the printing, at build time only. It reads a subset of
103
103
  HLSL, listed at its top (functions, locals, `if`, bounded `for`, `switch`,
104
- intrinsics, `mul(v, float2x2(...))`, and one preprocessor switch,
105
- `UNITY_COLORSPACE_GAMMA`, which becomes the target's colour), and anything
104
+ intrinsics, `mul(v, float2x2(...))`, `uint` and `uint2` for the hashes, and one
105
+ preprocessor switch, `UNITY_COLORSPACE_GAMMA`, which becomes the target's
106
+ colour), and anything
106
107
  outside it is an error with a file and line rather than a guess. HLSL converts
107
108
  where GLSL, WGSL and Metal refuse, so it makes every conversion explicit first;
108
109
  the printers then differ in spelling, plus what WGSL lacks (overloading,
@@ -136,7 +137,21 @@ stores as written) and `texture.sl` (a texture's orientation and sRGB decode).
136
137
  The whole translated library must also compile on both backends, including
137
138
  the functions no fixture reaches. The file describes the sampling grid, the
138
139
  times and the texture every sampled slot gets. A host imports it as
139
- `onejs-sl/goldens.json`. No CI runner here has a GPU, so `src/goldens.test.ts` checks instead
140
+ `onejs-sl/goldens.json`.
141
+
142
+ The hashes are held to the bit, not to 1/255: two backends that happen to round
143
+ alike prove nothing about a third. `goldens/probes.hlsl` draws each of the
144
+ library's hashes (`hash21`, the value noise's, and `hash22`, voronoi's) as three
145
+ bits per pixel, and `corpus/probe-hash.sl` does the same through a program;
146
+ every pixel must match `goldens/reference.mjs`, which computes the hashes in
147
+ JavaScript. goldens.json ships each probe under its name, as HLSL, WGSL and
148
+ GLSL ES and with the bits it must draw, for a host to run on its own compiler,
149
+ and marks the fixtures compared at 0/255 `exact`.
150
+
151
+ `npm run goldens -- --check` draws everything again and compares it with
152
+ goldens.json instead of writing it: within 1/255, and exact fixtures and probes
153
+ to the byte. It is how a machine that did not write the file checks its own
154
+ GPU and compilers. No CI runner here has a GPU, so `src/goldens.test.ts` checks instead
140
155
  that the file still covers the corpus at today's hashes; a change that moves a
141
156
  hash fails there until the goldens are drawn again.
142
157
 
@@ -169,7 +184,11 @@ Before the tag:
169
184
  `PlaySite/`. It is a private repo, so no workflow here can. When `diagnose`
170
185
  or an error's fix changed, also run `node Tools/editor-sl-smoke/editor-sl-smoke.mjs`
171
186
  from the container root, which drives the Play editor in real Monaco.
172
- 4. Push `main` and wait for CI, whose `consumers` job runs onejs-unity's
187
+ 4. Run `npm run goldens -- --check` on Windows, whose WebGPU compiles through
188
+ a different shader compiler from the Mac's that writes goldens.json. A
189
+ compiler that rounds the library differently shows here first, and nowhere
190
+ in CI, which has no GPU.
191
+ 5. Push `main` and wait for CI, whose `consumers` job runs onejs-unity's
173
192
  and onejs-play's typecheck and tests against the commit (`consumers.yml`). `publish.yml`
174
193
  runs the same job and publishes nothing if it fails. When a consumer has to
175
194
  follow a change, land it here, fix the consumer, then re-run and tag.
@@ -407,3 +426,9 @@ a simplex here is the simplex there. Octaves are 1 to 4. A program has no seed;
407
426
  offset the input for a different field. `sl.simplex` used to be value noise on
408
427
  a rotated lattice, and `sl.fbm` had its own value noise; both changed on
409
428
  2026-09-06 when the fields were unified.
429
+
430
+ The lattice hash under value noise and voronoi is integer arithmetic (pcg2d),
431
+ so every GPU draws the same bits: `lib/noise2d.hlsl` says why a float hash
432
+ cannot promise that. A cell is converted to an integer, so a point past
433
+ -2^31 or 2^31 lands in the edge cell, and a NaN in an undefined one. `fx.noise`
434
+ seeds are read to 1/65536: two seeds closer than that draw the same field.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "generatedBy": "onejs-sl goldens/run.mjs",
3
- "package": "0.1.11",
3
+ "package": "0.1.12",
4
4
  "ir": 2,
5
5
  "target": "rgba8unorm-srgb: straight alpha, 8 bit, sRGB encoded, the stored bytes of a Linear OneJS game's element",
6
6
  "size": [
@@ -19,13 +19,14 @@
19
19
  "webgl2": "ANGLE (Apple, ANGLE Metal Renderer: Apple M4 Pro, Unspecified Version)"
20
20
  },
21
21
  "backendsAgreeWithin": 1,
22
+ "exact": "a fixture marked exact has to draw its samples to the byte, not within 1/255",
22
23
  "fixtures": {
23
24
  "branch.sl": {
24
25
  "hash": "8e7e61f6",
25
26
  "source": "// A branch, a colour literal and a function that returns a vector.\nuniform float4 tint = #ff8040;\n\nfloat2 swirl(float2 p, float a) {\n float c = cos(a);\n float s = sin(a);\n return float2(p.x * c - p.y * s, p.x * s + p.y * c);\n}\n\nfloat4 main() {\n float2 q = swirl(uv - 0.5, time * 0.3);\n float v = 0.25;\n if (q.x > 0.1) { v = 0.75; } else { v = fbm(q * 3, 4); }\n return float4(tint.rgb * v, 1);\n}\n",
26
27
  "samples": {
27
- "0": [204,101,49,255,189,93,45,255,179,88,42,255,181,89,42,255,175,86,41,255,166,81,38,255,150,73,34,255,155,75,35,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,189,93,45,255,183,90,43,255,178,87,41,255,184,91,43,255,188,93,44,255,184,91,43,255,170,84,39,255,161,79,37,255,154,75,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,180,89,42,255,163,80,37,255,160,78,36,255,185,91,44,255,208,104,50,255,206,102,49,255,177,87,41,255,162,79,37,255,150,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,177,87,41,255,176,87,41,255,189,93,45,255,192,95,45,255,205,102,49,255,203,101,49,255,184,91,43,255,164,80,38,255,164,80,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,193,96,46,255,197,98,47,255,206,102,50,255,206,102,50,255,196,97,47,255,183,90,43,255,168,82,39,255,151,73,34,255,153,74,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,212,106,51,255,219,109,53,255,220,110,54,255,211,105,51,255,197,97,47,255,173,85,40,255,147,71,33,255,124,59,26,255,132,63,28,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,222,111,54,255,231,115,57,255,222,111,54,255,212,106,51,255,190,94,45,255,170,83,39,255,147,71,33,255,141,68,31,255,138,67,30,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,211,105,51,255,225,113,55,255,239,120,59,255,219,109,53,255,190,94,45,255,174,85,40,255,158,77,36,255,154,75,34,255,161,78,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,216,108,52,255,226,113,55,255,239,120,59,255,220,110,54,255,197,98,47,255,180,89,42,255,164,80,37,255,153,74,34,255,154,75,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,105,51,255,212,105,51,255,211,105,51,255,210,104,51,255,210,104,51,255,196,97,47,255,167,82,38,255,132,63,28,255,141,68,31,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,192,95,46,255,189,93,45,255,180,88,42,255,180,88,42,255,192,95,46,255,196,97,47,255,176,87,41,255,148,72,33,255,147,71,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,181,89,42,255,169,83,39,255,161,79,37,255,168,82,39,255,181,89,42,255,193,96,46,255,188,93,44,255,167,82,38,255,174,86,41,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,181,89,43,255,175,86,41,255,172,84,40,255,168,82,39,255,160,78,36,255,167,82,38,255,188,93,44,255,177,87,41,255,185,91,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,183,90,43,255,182,89,43,255,169,83,39,255,166,81,38,255,158,77,36,255,154,75,35,255,175,86,41,255,184,91,43,255,188,93,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,164,80,37,255,165,81,38,255,172,85,40,255,158,77,36,255,168,82,38,255,169,83,39,255,173,85,40,255,185,91,43,255,186,92,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,173,85,40,255,176,87,41,255,179,88,42,255,186,92,44,255,176,86,41,255,176,86,41,255,174,85,40,255,179,88,42,255,179,88,42,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255],
28
- "1.25": [214,107,52,255,192,95,46,255,186,92,44,255,168,82,38,255,161,79,37,255,172,84,40,255,189,93,45,255,176,87,41,255,167,81,38,255,147,71,33,255,150,73,34,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,51,255,192,95,46,255,183,90,43,255,176,87,41,255,174,86,41,255,182,90,43,255,203,101,49,255,203,101,49,255,181,89,43,255,157,76,35,255,162,79,37,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,204,101,49,255,205,102,49,255,202,100,48,255,205,102,49,255,198,98,47,255,206,102,50,255,205,102,49,255,177,87,41,255,162,79,37,255,161,78,37,255,148,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,216,108,53,255,220,109,54,255,220,110,54,255,220,110,54,255,217,108,53,255,199,98,48,255,196,97,47,255,191,94,45,255,178,87,41,255,159,77,36,255,154,75,35,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,220,110,54,255,229,115,56,255,220,110,54,255,211,105,51,255,198,98,47,255,176,86,41,255,161,79,37,255,154,75,35,255,156,76,35,255,166,81,38,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,104,51,255,219,109,53,255,235,117,58,255,233,117,57,255,208,103,50,255,184,91,43,255,167,82,38,255,139,67,30,255,123,59,25,255,136,65,29,255,160,78,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,221,110,54,255,237,119,59,255,223,111,55,255,196,97,47,255,183,90,43,255,160,78,37,255,145,70,32,255,135,65,29,255,132,63,28,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,200,99,48,255,206,102,50,255,211,105,51,255,216,107,52,255,200,99,48,255,178,88,42,255,158,77,36,255,158,77,36,255,156,76,35,255,146,70,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,175,86,41,255,176,87,41,255,182,90,43,255,198,98,47,255,205,102,49,255,185,91,43,255,153,74,34,255,150,73,34,255,160,78,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,168,82,38,255,160,78,36,255,166,81,38,255,187,92,44,255,196,97,47,255,183,90,43,255,155,75,35,255,128,61,27,255,147,71,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,174,85,40,255,171,84,39,255,170,83,39,255,176,86,41,255,192,95,46,255,183,90,43,255,157,76,35,255,146,71,32,255,162,79,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,169,83,39,255,165,81,38,255,163,80,37,255,149,72,33,255,180,88,42,255,181,89,43,255,160,78,37,255,183,90,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,172,84,40,255,156,76,35,255,165,81,38,255,158,77,36,255,175,86,41,255,183,90,43,255,184,91,43,255,195,96,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,187,92,44,255,184,91,43,255,171,84,40,255,170,83,39,255,175,86,41,255,181,89,43,255,188,93,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,193,96,46,255,187,93,44,255,175,86,41,255,173,85,40,255,177,87,41,255,184,91,43,255,194,96,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,191,94,45,255,185,91,43,255,175,86,41,255,168,82,39,255,168,82,39,255,176,86,41,255,191,94,45,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255]
28
+ "0": [205,102,49,255,208,104,50,255,191,95,45,255,198,98,47,255,211,105,51,255,207,103,50,255,206,102,50,255,209,104,50,255,206,102,50,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,213,106,52,255,199,98,48,255,210,105,51,255,219,109,53,255,210,104,51,255,189,93,45,255,193,96,46,255,190,94,45,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,104,51,255,215,107,52,255,202,100,49,255,211,105,51,255,217,108,53,255,207,103,50,255,184,91,43,255,168,82,38,255,183,90,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,206,103,50,255,213,106,52,255,209,104,51,255,211,105,51,255,219,109,53,255,213,106,51,255,188,93,44,255,191,95,45,255,188,93,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,204,102,49,255,216,108,53,255,219,109,53,255,220,110,54,255,213,106,51,255,207,103,50,255,197,98,47,255,194,96,46,255,197,98,47,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,211,105,51,255,223,112,55,255,226,113,55,255,221,110,54,255,214,107,52,255,202,100,48,255,195,97,46,255,186,92,44,255,184,91,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,219,109,53,255,219,109,53,255,230,115,56,255,225,112,55,255,212,106,51,255,200,99,48,255,182,90,43,255,167,82,38,255,165,80,38,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,229,114,56,255,225,112,55,255,223,112,55,255,220,110,54,255,209,104,51,255,192,95,46,255,174,86,41,255,145,70,32,255,144,70,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,219,109,53,255,224,112,55,255,216,108,52,255,206,103,50,255,188,93,44,255,169,83,39,255,150,73,34,255,148,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,202,100,49,255,203,101,49,255,212,105,51,255,200,99,48,255,198,98,47,255,191,94,45,255,175,86,41,255,152,74,34,255,147,71,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,168,82,39,255,187,92,44,255,194,96,46,255,195,96,46,255,200,99,48,255,198,98,47,255,190,94,45,255,168,82,39,255,153,74,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,154,75,34,255,164,80,37,255,170,83,39,255,179,88,42,255,188,93,44,255,185,91,43,255,182,90,43,255,178,88,42,255,177,87,41,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,131,63,28,255,137,66,30,255,138,66,30,255,148,72,33,255,163,79,37,255,169,83,39,255,178,88,42,255,182,90,43,255,184,91,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,124,59,26,255,131,63,28,255,121,57,25,255,139,67,30,255,147,71,33,255,154,75,35,255,172,84,40,255,183,90,43,255,192,95,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,149,72,33,255,148,72,33,255,169,83,39,255,168,82,38,255,176,87,41,255,180,88,42,255,173,85,40,255,176,86,41,255,176,87,41,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,179,88,42,255,186,92,44,255,201,100,48,255,194,96,46,255,191,95,45,255,189,93,45,255,181,89,42,255,172,85,40,255,159,77,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255],
29
+ "1.25": [189,94,45,255,200,99,48,255,205,102,49,255,217,108,53,255,206,102,49,255,203,101,49,255,214,107,52,255,217,108,53,255,206,102,49,255,208,103,50,255,213,106,52,255,207,103,50,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,200,99,48,255,196,97,47,255,206,103,50,255,213,106,52,255,208,103,50,255,209,104,50,255,216,108,52,255,210,105,51,255,195,96,46,255,191,94,45,255,204,101,49,255,201,100,48,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,200,99,48,255,208,104,50,255,214,106,52,255,218,108,53,255,215,107,52,255,212,106,51,255,220,110,54,255,210,104,51,255,184,91,43,255,173,85,40,255,186,92,44,255,185,91,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,51,255,213,106,52,255,218,109,53,255,224,112,55,255,225,113,55,255,216,108,52,255,213,106,52,255,206,102,50,255,187,92,44,255,187,92,44,255,183,90,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,228,114,56,255,222,111,54,255,220,110,54,255,230,115,57,255,222,111,54,255,215,107,52,255,205,102,49,255,200,99,48,255,192,95,46,255,199,99,48,255,196,97,47,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,224,112,55,255,232,116,57,255,224,112,55,255,225,112,55,255,222,111,54,255,210,104,51,255,195,96,46,255,192,95,46,255,186,92,44,255,189,93,45,255,197,98,47,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,104,51,255,213,106,52,255,222,111,54,255,218,109,53,255,211,105,51,255,200,99,48,255,185,91,43,255,171,84,40,255,163,80,37,255,181,89,42,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,184,91,43,255,197,98,47,255,211,105,51,255,202,100,48,255,203,101,49,255,188,93,44,255,174,85,40,255,150,73,34,255,147,71,33,255,163,80,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,169,83,39,255,186,92,44,255,195,96,46,255,199,99,48,255,199,99,48,255,180,89,42,255,164,80,37,255,145,70,32,255,145,70,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,151,73,34,255,166,81,38,255,181,89,43,255,196,97,47,255,200,99,48,255,189,93,45,255,158,77,36,255,150,73,33,255,148,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,128,61,27,255,133,64,29,255,161,78,37,255,178,87,41,255,185,91,43,255,185,91,44,255,170,83,39,255,153,74,34,255,146,71,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,137,66,30,255,138,66,30,255,146,70,32,255,156,76,35,255,172,84,40,255,181,89,42,255,176,86,41,255,173,85,40,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,181,89,43,255,168,82,39,255,164,80,37,255,159,78,36,255,172,85,40,255,176,87,41,255,185,91,44,255,191,94,45,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,207,103,50,255,189,93,45,255,185,91,43,255,179,88,42,255,173,85,40,255,186,92,44,255,192,95,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,199,99,48,255,194,96,46,255,191,94,45,255,188,93,45,255,180,89,42,255,171,84,40,255,167,82,38,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,194,96,46,255,189,93,45,255,188,93,44,255,182,90,43,255,165,81,38,255,157,77,36,255,158,77,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255]
29
30
  }
30
31
  },
31
32
  "cov-arith.sl": {
@@ -64,8 +65,8 @@
64
65
  "hash": "4c59d609",
65
66
  "source": "// Every noise: value, simplex, fbm, turbulence, ridged, voronoi.\nfloat4 main() {\n float2 p = uv * 5.0 + time * 0.1;\n float a = noise(p) * 0.5 + simplex(p * 1.3) * 0.5;\n float b = fbm(p, 3) * 0.5 + turbulence(p * 0.7, 2) * 0.5;\n float c = ridged(p * 0.6, 4) * 0.6 + voronoi(p * 1.5) * 0.4;\n return float4(a, b, c, 1);\n}\n",
66
67
  "samples": {
67
- "0": [174,158,126,255,210,189,205,255,158,187,175,255,225,193,173,255,147,149,159,255,135,169,158,255,173,156,188,255,178,161,183,255,141,180,181,255,132,192,161,255,199,176,94,255,212,191,150,255,240,219,200,255,231,197,184,255,226,193,172,255,217,203,188,255,161,175,160,255,178,177,187,255,192,159,236,255,180,184,203,255,211,168,201,255,195,193,171,255,186,189,164,255,146,163,176,255,210,170,158,255,191,156,155,255,207,158,174,255,174,174,183,255,202,184,201,255,231,196,212,255,178,204,157,255,220,205,189,255,195,183,156,255,215,155,197,255,195,202,201,255,195,214,130,255,179,191,119,255,189,167,164,255,196,174,118,255,156,166,150,255,162,180,122,255,165,183,113,255,179,183,162,255,212,178,179,255,221,200,173,255,214,186,160,255,180,193,170,255,178,191,189,255,190,209,165,255,219,173,163,255,209,158,181,255,206,181,158,255,156,173,180,255,182,189,189,255,190,180,155,255,188,197,192,255,196,193,169,255,166,184,165,255,180,194,176,255,200,152,185,255,145,199,174,255,178,175,188,255,188,187,181,255,187,158,174,255,168,189,208,255,164,168,179,255,141,189,174,255,213,205,201,255,143,180,157,255,213,210,149,255,162,171,141,255,224,204,192,255,216,199,215,255,208,184,182,255,203,195,192,255,190,192,148,255,182,144,148,255,218,160,208,255,223,180,192,255,204,191,174,255,186,161,222,255,177,182,180,255,139,154,177,255,173,141,131,255,181,176,163,255,223,153,151,255,186,170,167,255,216,191,192,255,181,175,178,255,204,197,137,255,222,186,165,255,203,177,188,255,183,143,196,255,195,175,184,255,193,188,156,255,186,202,161,255,165,125,179,255,188,180,157,255,180,151,196,255,142,126,152,255,180,183,152,255,211,197,199,255,190,175,197,255,201,166,91,255,174,176,185,255,179,192,165,255,210,210,165,255,196,178,121,255,199,183,155,255,167,177,165,255,179,166,180,255,165,198,141,255,122,125,130,255,165,145,152,255,134,131,170,255,131,185,164,255,142,157,198,255,166,160,175,255,215,202,181,255,201,172,148,255,213,204,164,255,195,199,143,255,218,180,135,255,181,202,139,255,160,157,180,255,200,187,216,255,204,157,210,255,182,163,208,255,144,164,130,255,187,153,193,255,176,161,113,255,174,165,175,255,163,190,168,255,181,175,136,255,118,188,183,255,206,180,171,255,172,196,186,255,159,179,193,255,173,186,176,255,193,183,187,255,169,152,174,255,178,134,176,255,121,136,160,255,160,152,198,255,135,186,182,255,94,96,190,255,90,168,135,255,117,181,164,255,175,183,161,255,174,149,160,255,127,142,205,255,179,137,155,255,195,160,161,255,203,162,135,255,153,159,146,255,154,175,175,255,179,156,189,255,192,141,125,255,153,133,166,255,167,174,147,255,181,146,177,255,153,143,176,255,175,178,181,255,138,181,186,255,150,156,168,255,117,129,182,255,148,163,178,255,182,184,129,255,213,201,176,255,207,205,179,255,213,162,162,255,193,190,154,255,123,140,222,255,175,166,213,255,154,168,160,255,105,138,87,255,186,150,153,255,122,125,177,255,143,144,221,255,92,143,173,255,192,164,151,255,192,183,184,255,193,171,169,255,165,151,189,255,216,187,189,255,204,187,172,255,182,178,157,255,197,144,177,255,160,166,179,255,184,191,163,255,180,161,169,255,154,134,153,255,200,163,157,255,120,161,167,255,104,151,182,255,137,193,194,255,189,186,149,255,164,180,161,255,152,148,212,255,215,203,187,255,188,226,135,255,218,207,155,255,178,181,122,255,162,178,162,255,137,145,168,255,145,167,130,255,112,179,165,255,167,160,187,255,175,139,184,255,168,179,150,255,179,148,107,255,177,183,185,255,173,179,132,255,185,162,149,255,202,183,174,255,223,196,184,255,220,202,115,255,244,185,153,255,200,178,198,255,187,186,187,255,179,182,193,255,149,136,175,255,110,181,166,255,170,171,196,255,124,169,161,255,178,146,212,255,187,137,177,255,129,151,194,255,149,192,163,255,193,199,101,255,170,177,165,255,219,207,188,255,218,196,160,255,198,214,174,255,215,199,206,255,167,151,176,255,158,182,184,255,194,198,166,255,140,158,163,255,175,155,126,255,163,173,150,255,172,150,210,255,189,177,194,255,164,154,194,255,162,157,198,255,208,197,202,255,181,182,178,255,184,199,195,255,197,207,178,255,194,194,164,255,199,180,140,255,173,149,171,255,182,180,186,255,199,197,207,255,185,152,162,255,171,136,142,255],
68
- "1.25": [178,187,193,255,193,186,191,255,196,197,130,255,195,189,168,255,124,186,148,255,162,166,139,255,188,170,164,255,193,146,176,255,124,172,195,255,143,164,171,255,207,147,139,255,236,212,173,255,244,223,197,255,215,189,154,255,246,175,151,255,195,168,108,255,176,160,165,255,183,182,217,255,185,168,209,255,201,168,206,255,187,163,213,255,173,173,191,255,137,160,165,255,167,152,172,255,190,194,136,255,180,181,157,255,212,163,145,255,196,168,194,255,229,196,224,255,215,206,169,255,205,210,180,255,214,215,185,255,183,154,148,255,221,184,196,255,164,211,190,255,189,203,160,255,188,183,177,255,200,189,150,255,191,190,156,255,182,148,206,255,180,165,143,255,177,186,143,255,213,183,157,255,189,213,178,255,217,179,193,255,215,214,191,255,183,187,184,255,209,191,154,255,186,200,176,255,230,177,188,255,201,190,159,255,211,177,122,255,139,146,185,255,209,172,145,255,155,173,123,255,159,204,201,255,171,194,156,255,159,198,136,255,182,153,179,255,188,204,187,255,183,182,143,255,179,181,164,255,164,181,202,255,175,191,168,255,187,189,203,255,168,179,171,255,185,183,160,255,191,197,198,255,159,205,163,255,187,191,174,255,208,139,172,255,216,199,207,255,218,174,207,255,179,178,199,255,220,193,138,255,194,165,151,255,176,158,189,255,217,168,201,255,220,169,154,255,175,195,189,255,178,177,216,255,146,170,187,255,159,159,171,255,181,158,164,255,200,165,169,255,205,190,170,255,194,160,161,255,215,187,198,255,202,152,209,255,217,175,184,255,179,196,203,255,176,192,187,255,176,153,193,255,214,172,193,255,220,198,140,255,200,200,183,255,194,165,182,255,158,181,176,255,190,139,178,255,122,159,142,255,220,198,144,255,192,193,192,255,199,172,189,255,185,190,114,255,181,187,182,255,203,215,131,255,218,188,154,255,228,166,155,255,189,189,165,255,178,147,175,255,139,184,179,255,163,190,120,255,148,161,147,255,184,140,155,255,102,171,164,255,130,164,179,255,186,171,172,255,197,172,201,255,223,203,177,255,183,185,158,255,194,207,179,255,201,178,106,255,207,181,169,255,157,189,140,255,180,196,140,255,204,169,178,255,208,127,200,255,162,187,194,255,137,140,152,255,171,131,180,255,182,165,149,255,164,168,162,255,142,142,156,255,168,164,168,255,179,186,178,255,212,173,184,255,206,194,195,255,164,179,147,255,204,207,154,255,174,199,195,255,148,153,210,255,177,153,164,255,161,139,179,255,135,130,190,255,148,167,187,255,145,132,185,255,105,171,149,255,159,185,172,255,179,169,170,255,150,161,117,255,134,167,192,255,185,139,179,255,166,185,170,255,176,145,161,255,132,139,168,255,189,162,204,255,177,144,153,255,186,146,146,255,125,138,144,255,180,171,166,255,172,151,175,255,121,170,148,255,109,186,174,255,169,176,188,255,129,180,188,255,169,137,184,255,154,116,143,255,202,188,152,255,222,200,128,255,200,174,146,255,206,201,130,255,158,181,191,255,178,117,202,255,174,165,188,255,122,138,127,255,126,169,129,255,186,149,184,255,130,145,192,255,166,149,193,255,134,151,159,255,171,159,164,255,171,177,195,255,137,180,146,255,188,185,189,255,232,193,188,255,179,200,165,255,201,162,179,255,184,126,202,255,138,178,201,255,184,175,192,255,149,163,162,255,175,120,151,255,171,129,166,255,123,128,176,255,120,165,194,255,128,186,160,255,192,185,161,255,184,170,180,255,185,166,214,255,192,193,170,255,208,207,170,255,199,191,123,255,165,184,137,255,166,154,179,255,149,183,142,255,181,167,154,255,126,176,168,255,179,156,173,255,154,162,197,255,142,155,133,255,168,162,179,255,177,190,154,255,205,186,110,255,164,138,153,255,203,181,209,255,222,214,114,255,219,222,151,255,220,195,176,255,185,185,204,255,201,184,199,255,139,136,173,255,134,177,153,255,120,178,175,255,188,157,216,255,139,160,179,255,195,187,165,255,174,125,184,255,128,178,205,255,142,183,155,255,167,188,126,255,207,210,177,255,230,203,132,255,213,199,105,255,226,217,185,255,198,185,194,255,134,182,167,255,178,179,170,255,148,155,167,255,150,155,166,255,134,133,152,255,122,153,158,255,179,121,222,255,194,160,188,255,136,168,202,255,198,192,167,255,213,191,167,255,171,188,172,255,213,194,165,255,188,191,169,255,182,178,180,255,223,185,175,255,154,172,183,255,200,187,170,255,186,184,166,255,185,128,154,255,149,156,136,255]
68
+ "0": [196,174,153,255,204,180,193,255,104,156,160,255,194,163,150,255,138,151,159,255,173,191,182,255,213,188,201,255,219,185,189,255,198,201,215,255,195,219,190,255,229,200,172,255,213,197,157,255,225,197,158,255,217,192,155,255,220,187,182,255,217,202,222,255,161,169,176,255,169,168,162,255,175,150,206,255,161,179,186,255,206,164,200,255,201,198,171,255,197,193,149,255,171,162,147,255,236,179,177,255,224,174,146,255,225,164,183,255,165,157,177,255,174,146,168,255,209,167,206,255,154,177,158,255,207,186,194,255,174,169,185,255,206,138,222,255,194,195,201,255,196,202,128,255,172,178,134,255,174,154,136,255,179,160,153,255,150,153,169,255,177,193,148,255,189,201,90,255,187,188,173,255,195,167,157,255,190,172,149,255,181,164,165,255,141,163,171,255,142,177,202,255,164,192,171,255,212,160,163,255,213,153,175,255,212,172,170,255,149,160,184,255,161,171,185,255,165,161,181,255,177,189,197,255,203,197,173,255,183,201,166,255,184,201,181,255,182,142,151,255,79,181,194,255,135,160,169,255,153,167,192,255,154,147,196,255,148,174,180,255,167,150,148,255,168,204,149,255,231,225,195,255,154,188,150,255,205,201,123,255,141,164,170,255,214,195,188,255,209,203,190,255,203,191,189,255,196,186,196,255,179,183,137,255,169,157,178,255,210,169,203,255,220,188,194,255,205,198,152,255,179,156,207,255,193,178,144,255,186,188,174,255,213,186,164,255,203,205,182,255,224,161,163,255,179,157,141,255,203,184,175,255,150,148,179,255,172,173,188,255,204,165,166,255,204,171,182,255,197,162,211,255,212,187,192,255,217,214,169,255,218,225,149,255,161,145,191,255,208,196,159,255,221,188,184,255,196,179,170,255,206,206,179,255,215,196,193,255,187,163,187,255,187,165,146,255,133,156,164,255,127,157,177,255,188,185,142,255,200,175,113,255,219,191,188,255,196,197,134,255,214,206,177,255,211,225,159,255,144,153,187,255,191,172,166,255,176,152,162,255,175,202,149,255,173,176,194,255,183,167,178,255,225,205,182,255,201,179,150,255,199,197,131,255,170,197,172,255,207,160,156,255,187,190,168,255,181,161,201,255,219,196,190,255,229,180,185,255,217,185,206,255,191,198,148,255,212,184,170,255,191,171,130,255,187,168,169,255,186,195,148,255,211,196,155,255,167,209,182,255,225,199,159,255,180,208,184,255,159,197,189,255,176,185,158,255,201,175,177,255,181,156,177,255,192,141,158,255,153,165,147,255,189,175,180,255,196,217,183,255,145,160,193,255,102,185,150,255,121,189,121,255,194,179,122,255,211,180,167,255,184,181,202,255,211,167,161,255,212,174,155,255,213,181,124,255,166,177,147,255,165,187,164,255,187,175,188,255,201,172,155,255,173,174,172,255,190,187,155,255,220,179,172,255,182,170,184,255,183,188,208,255,145,175,187,255,168,153,189,255,157,132,138,255,183,175,158,255,200,188,172,255,214,200,169,255,199,209,171,255,210,165,199,255,198,198,167,255,141,160,199,255,189,174,204,255,175,181,155,255,140,158,117,255,208,180,165,255,149,148,151,255,158,157,219,255,113,143,189,255,199,150,173,255,197,173,170,255,196,154,159,255,150,126,201,255,184,159,177,255,155,162,164,255,146,154,157,255,196,143,152,255,181,175,179,255,203,197,159,255,198,172,180,255,176,162,174,255,210,179,172,255,140,177,181,255,130,163,182,255,155,201,174,255,192,177,133,255,152,179,163,255,131,155,166,255,185,176,183,255,109,191,184,255,145,169,150,255,112,161,103,255,156,185,166,255,167,151,184,255,173,171,124,255,144,186,178,255,186,171,186,255,186,161,148,255,183,194,171,255,195,165,129,255,193,196,179,255,174,186,125,255,168,148,164,255,182,166,164,255,191,177,195,255,163,158,170,255,187,116,149,255,147,149,172,255,177,185,179,255,194,174,178,255,169,130,174,255,141,179,173,255,191,177,184,255,140,188,176,255,194,169,202,255,207,157,179,255,158,174,182,255,146,197,123,255,162,178,153,255,117,146,173,255,178,181,202,255,165,147,190,255,126,162,169,255,170,172,193,255,138,140,140,255,150,165,162,255,194,176,182,255,160,155,194,255,201,172,165,255,174,173,138,255,191,156,185,255,212,194,148,255,190,182,174,255,156,173,184,255,169,178,213,255,110,134,143,255,114,153,175,255,135,167,191,255,131,168,154,255,149,147,160,255,132,108,160,255,156,154,185,255,186,177,218,255,196,156,192,255,203,179,149,255],
69
+ "1.25": [193,194,194,255,172,170,187,255,148,165,136,255,165,167,166,255,141,200,139,255,207,204,160,255,230,210,143,255,236,182,182,255,193,206,222,255,201,200,194,255,227,168,168,255,230,204,156,255,230,207,169,255,205,192,151,255,245,180,195,255,199,174,154,255,180,159,173,255,167,169,169,255,154,157,174,255,182,147,180,255,191,168,223,255,196,186,213,255,171,173,140,255,202,159,183,255,227,210,164,255,217,200,174,255,224,174,185,255,181,143,184,255,208,165,186,255,198,185,154,255,194,199,183,255,208,200,183,255,170,145,178,255,214,177,193,255,158,205,187,255,184,193,167,255,181,173,160,255,192,186,146,255,187,175,165,255,192,148,202,255,203,187,159,255,201,199,116,255,214,182,166,255,162,193,144,255,186,139,182,255,187,190,194,255,153,159,182,255,187,177,158,255,164,180,193,255,226,163,198,255,206,173,166,255,212,156,120,255,120,120,177,255,188,147,156,255,127,141,169,255,157,195,216,255,187,201,166,255,178,213,133,255,177,162,184,255,155,194,164,255,137,163,151,255,134,158,162,255,115,155,200,255,133,188,174,255,172,175,176,255,173,178,150,255,201,199,133,255,201,205,204,255,152,199,140,255,168,181,175,255,192,130,198,255,210,198,196,255,220,183,193,255,182,186,202,255,214,189,130,255,175,154,155,255,148,153,204,255,199,164,181,255,207,161,172,255,159,198,185,255,175,163,190,255,172,172,169,255,198,194,182,255,209,190,182,255,207,180,171,255,197,186,164,255,183,149,155,255,201,179,173,255,181,136,215,255,198,160,213,255,167,184,196,255,177,194,196,255,182,174,203,255,223,188,202,255,234,214,132,255,220,218,163,255,198,181,165,255,193,203,159,255,233,184,185,255,178,205,171,255,234,213,174,255,190,183,168,255,191,166,192,255,159,184,142,255,134,156,191,255,165,184,161,255,206,172,115,255,238,173,168,255,211,199,180,255,208,184,173,255,188,218,183,255,210,217,144,255,162,178,178,255,212,169,185,255,166,202,157,255,177,190,180,255,204,194,179,255,203,167,184,255,224,200,189,255,167,185,151,255,162,187,155,255,171,150,156,255,198,161,161,255,173,183,162,255,201,197,149,255,228,194,123,255,239,175,191,255,206,203,209,255,174,171,155,255,196,155,175,255,202,171,136,255,187,178,151,255,172,155,153,255,194,179,188,255,201,203,158,255,219,183,180,255,200,199,196,255,154,187,172,255,205,190,155,255,186,192,205,255,167,160,205,255,197,165,131,255,192,162,168,255,175,149,170,255,196,204,176,255,169,167,173,255,111,181,155,255,170,183,138,255,205,174,146,255,196,194,164,255,184,199,175,255,210,162,196,255,180,200,141,255,186,166,145,255,145,148,132,255,197,174,190,255,186,163,158,255,198,175,148,255,153,171,165,255,202,181,155,255,212,183,178,255,148,193,188,255,113,188,174,255,178,165,179,255,163,183,180,255,206,164,168,255,193,153,136,255,220,191,167,255,227,210,138,255,203,189,153,255,211,211,173,255,168,197,200,255,187,148,193,255,188,183,208,255,150,158,105,255,157,182,150,255,211,177,171,255,152,166,185,255,175,144,204,255,147,137,186,255,184,149,168,255,186,166,170,255,152,176,157,255,179,170,201,255,210,178,173,255,144,178,172,255,191,155,178,255,193,135,188,255,160,187,180,255,201,180,176,255,172,179,164,255,194,154,167,255,186,152,192,255,145,146,172,255,142,171,185,255,142,193,152,255,192,171,153,255,175,164,159,255,169,151,182,255,150,152,180,255,144,172,187,255,126,160,121,255,127,175,155,255,177,158,169,255,176,188,163,255,201,177,131,255,153,187,205,255,197,176,164,255,168,177,194,255,160,169,161,255,185,171,160,255,187,199,139,255,202,181,104,255,144,135,155,255,183,172,184,255,183,186,159,255,153,185,181,255,153,154,154,255,147,180,195,255,208,186,197,255,167,135,181,255,162,179,142,255,149,182,184,255,205,165,186,255,156,179,172,255,211,203,178,255,195,145,203,255,146,197,179,255,126,182,152,255,129,164,175,255,174,189,180,255,189,178,174,255,150,140,150,255,169,172,172,255,160,169,172,255,124,177,120,255,182,163,154,255,161,143,180,255,174,149,200,255,166,160,166,255,142,169,134,255,199,139,187,255,217,174,166,255,155,195,168,255,180,191,162,255,170,159,181,255,99,150,139,255,162,145,180,255,118,142,167,255,109,135,143,255,189,163,183,255,120,153,154,255,184,168,167,255,185,171,187,255,205,147,193,255,186,191,127,255]
69
70
  }
70
71
  },
71
72
  "cov-step.sl": {
@@ -102,6 +103,7 @@
102
103
  },
103
104
  "hex.sl": {
104
105
  "hash": "0a6de6e8",
106
+ "exact": true,
105
107
  "source": "// An anchor: a hex colour is sRGB as written and the program converts it to\n// linear, so a Linear target stores exactly the bytes written here.\nfloat4 main() { return #ff8040; }\n",
106
108
  "samples": {
107
109
  "0": [255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255,255,128,64,255],
@@ -124,6 +126,15 @@
124
126
  "1.25": [56,251,0,255,90,251,0,255,113,251,0,255,131,251,0,255,146,251,0,255,160,251,0,255,172,251,0,255,184,251,0,255,194,251,0,255,204,251,0,255,213,251,0,255,221,251,0,255,230,251,0,255,238,251,0,255,245,251,0,255,252,251,0,255,56,243,0,255,90,243,0,255,113,243,0,255,131,243,0,255,146,243,0,255,160,243,0,255,172,243,0,255,184,243,0,255,194,243,0,255,204,243,0,255,213,243,0,255,221,243,0,255,230,243,0,255,238,243,0,255,245,243,0,255,252,243,0,255,56,236,0,255,90,236,0,255,113,236,0,255,131,236,0,255,146,236,0,255,160,236,0,255,172,236,0,255,184,236,0,255,194,236,0,255,204,236,0,255,213,236,0,255,221,236,0,255,230,236,0,255,238,236,0,255,245,236,0,255,252,236,0,255,56,228,0,255,90,228,0,255,113,228,0,255,131,228,0,255,146,228,0,255,160,228,0,255,172,228,0,255,184,228,0,255,194,228,0,255,204,228,0,255,213,228,0,255,221,228,0,255,230,228,0,255,238,228,0,255,245,228,0,255,252,228,0,255,56,219,0,255,90,219,0,255,113,219,0,255,131,219,0,255,146,219,0,255,160,219,0,255,172,219,0,255,184,219,0,255,194,219,0,255,204,219,0,255,213,219,0,255,221,219,0,255,230,219,0,255,238,219,0,255,245,219,0,255,252,219,0,255,56,211,0,255,90,211,0,255,113,211,0,255,131,211,0,255,146,211,0,255,160,211,0,255,172,211,0,255,184,211,0,255,194,211,0,255,204,211,0,255,213,211,0,255,221,211,0,255,230,211,0,255,238,211,0,255,245,211,0,255,252,211,0,255,56,201,0,255,90,201,0,255,113,201,0,255,131,201,0,255,146,201,0,255,160,201,0,255,172,201,0,255,184,201,0,255,194,201,0,255,204,201,0,255,213,201,0,255,221,201,0,255,230,201,0,255,238,201,0,255,245,201,0,255,252,201,0,255,56,191,0,255,90,191,0,255,113,191,0,255,131,191,0,255,146,191,0,255,160,191,0,255,172,191,0,255,184,191,0,255,194,191,0,255,204,191,0,255,213,191,0,255,221,191,0,255,230,191,0,255,238,191,0,255,245,191,0,255,252,191,0,255,56,181,0,255,90,181,0,255,113,181,0,255,131,181,0,255,146,181,0,255,160,181,0,255,172,181,0,255,184,181,0,255,194,181,0,255,204,181,0,255,213,181,0,255,221,181,0,255,230,181,0,255,238,181,0,255,245,181,0,255,252,181,0,255,56,169,0,255,90,169,0,255,113,169,0,255,131,169,0,255,146,169,0,255,160,169,0,255,172,169,0,255,184,169,0,255,194,169,0,255,204,169,0,255,213,169,0,255,221,169,0,255,230,169,0,255,238,169,0,255,245,169,0,255,252,169,0,255,56,157,0,255,90,157,0,255,113,157,0,255,131,157,0,255,146,157,0,255,160,157,0,255,172,157,0,255,184,157,0,255,194,157,0,255,204,157,0,255,213,157,0,255,221,157,0,255,230,157,0,255,238,157,0,255,245,157,0,255,252,157,0,255,56,143,0,255,90,143,0,255,113,143,0,255,131,143,0,255,146,143,0,255,160,143,0,255,172,143,0,255,184,143,0,255,194,143,0,255,204,143,0,255,213,143,0,255,221,143,0,255,230,143,0,255,238,143,0,255,245,143,0,255,252,143,0,255,56,127,0,255,90,127,0,255,113,127,0,255,131,127,0,255,146,127,0,255,160,127,0,255,172,127,0,255,184,127,0,255,194,127,0,255,204,127,0,255,213,127,0,255,221,127,0,255,230,127,0,255,238,127,0,255,245,127,0,255,252,127,0,255,56,107,0,255,90,107,0,255,113,107,0,255,131,107,0,255,146,107,0,255,160,107,0,255,172,107,0,255,184,107,0,255,194,107,0,255,204,107,0,255,213,107,0,255,221,107,0,255,230,107,0,255,238,107,0,255,245,107,0,255,252,107,0,255,56,83,0,255,90,83,0,255,113,83,0,255,131,83,0,255,146,83,0,255,160,83,0,255,172,83,0,255,184,83,0,255,194,83,0,255,204,83,0,255,213,83,0,255,221,83,0,255,230,83,0,255,238,83,0,255,245,83,0,255,252,83,0,255,56,42,0,255,90,42,0,255,113,42,0,255,131,42,0,255,146,42,0,255,160,42,0,255,172,42,0,255,184,42,0,255,194,42,0,255,204,42,0,255,213,42,0,255,221,42,0,255,230,42,0,255,238,42,0,255,245,42,0,255,252,42,0,255]
125
127
  }
126
128
  },
129
+ "probe-hash.sl": {
130
+ "hash": "6746a2b2",
131
+ "exact": true,
132
+ "source": "// The value noise hash, bit for bit, through a program. At a whole number\n// point, noise is exactly the hash of that lattice cell, so each pixel reads\n// one cell and shows three of the twelve highest bits of its value, as 0 or 1\n// per channel. Eight blocks of 128 cells (16 x 8 from the block's start, four\n// pixels per cell): around 0, around -0 and the negatives, straddling zero,\n// then ever further out, past where a float still counts in ones and past\n// 2^31. goldens/run.mjs compares every pixel with arithmetic, allowing\n// nothing, and so should a host.\nfloat bit(float v) { return v - 2.0 * floor(v * 0.5); }\n\nfloat4 main() {\n float2 px = floor(float2(uv.x, 1.0 - uv.y) * 64.0);\n float k = px.y * 64.0 + px.x;\n float block = floor(k * 0.001953125);\n float j = k - block * 512.0;\n float n = floor(j * 0.25);\n float group = j - n * 4.0;\n float3 start = block < 0.5 ? float3(0.0, 0.0, 1.0)\n : block < 1.5 ? float3(0.0, 0.0, -1.0)\n : block < 2.5 ? float3(-8.0, -4.0, 1.0)\n : block < 3.5 ? float3(10000.0, -10000.0, 1.0)\n : block < 4.5 ? float3(1000000.0, 1000000.0, 1.0)\n : block < 5.5 ? float3(16777216.0, -16777216.0, 1.0)\n : block < 6.5 ? float3(1073741824.0, -1073741824.0, 1.0)\n : float3(3000000000.0, -3000000000.0, 1.0);\n float2 cell = (start.xy + float2(n - 16.0 * floor(n * 0.0625), floor(n * 0.0625))) * start.z;\n float v = floor(noise(cell) * 4096.0);\n float t = floor(v * (group < 0.5 ? 0.001953125 : group < 1.5 ? 0.015625 : group < 2.5 ? 0.125 : 1.0));\n return float4(bit(floor(t * 0.25)), bit(floor(t * 0.5)), bit(t), 1.0);\n}\n",
133
+ "samples": {
134
+ "0": [255,0,0,255,255,0,255,255,0,255,255,255,0,255,0,255,0,255,0,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,0,255,0,255,0,0,255,255,255,255,0,255,255,255,255,255,0,255,0,255,255,255,0,255,255,255,0,255,255,255,255,255,0,255,255,255,0,0,0,255,255,0,255,255,255,255,0,255,255,0,0,255,255,0,255,255,255,0,0,255,255,255,0,255,255,255,255,255,0,255,255,255,255,0,0,255,255,0,255,255,255,0,255,255,0,255,0,255,255,0,0,255,0,0,0,255,255,0,255,255,255,255,0,255,0,0,0,255,0,255,0,255,0,255,255,255,0,0,255,255,255,0,255,255,0,0,255,255,255,0,255,255,0,0,255,255,255,0,255,255,255,255,0,255,0,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,0,255,255,255,255,255,0,255,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255,255,0,0,255,255,255,255,255,0,0,255,255,0,0,0,255,255,0,0,255,255,0,255,255,0,0,255,255,0,255,0,255,0,0,255,255,255,0,255,255,0,0,255,255,0,255,255,255,0,255,0,255,0,0,0,255,255,255,0,255,255,0,255,255,0,0,0,255,255,0,0,255,0,255,255,255,255,255,0,255,0,255,0,255,0,255,0,255,255,0,0,255,0,255,255,255,255,0,0,255,0,0,255,255,0,0,255,255,255,0,0,255,0,255,255,255,0,0,255,255,255,255,0,255,0,0,0,255,255,0,0,255,255,0,255,255,0,255,255,255,0,255,0,255,0,255,0,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,0,255,0,0,0,255,0,255,255,255,255,0,0,255,255,255,0,255,255,0,0,255,0,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,0,255,255,0,0,255,0,255,255,255,255,0,255,255,0,255,255,255,0,0,0,255,255,255,255,255,255,255,0,255,0,255,0,255,255,0,255,255,0,0,0,255,0,255,0,255,0,255,255,255,255,0,0,255,0,255,0,255,0,255,255,255,255,0,0,255,0,0,255,255,255,255,255,255,0,255,0,255,0,0,0,255,0,0,0,255,255,255,0,255,255,0,255,255,0,0,0,255,0,255,0,255,0,255,0,255,0,0,255,255,255,255,255,255,255,255,0,255,255,255,255,255,0,0,255,255,0,255,0,255,255,255,255,255,255,0,0,255,0,0,0,255,255,255,255,255,255,0,255,255,0,255,255,255,0,255,255,255,255,255,255,255,0,0,255,255,255,0,255,255,255,255,255,255,0,0,0,255,0,255,255,255,0,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,0,0,0,255,255,0,0,255,0,0,0,255,0,0,255,255,255,255,0,255,255,255,0,255,0,255,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,255,0,255,0,255,0,255,0,255,0,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,0,255,255,0,255,255,255,255,255,255,255,255,255,255,0,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,255,0,255,255,255,255,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255],
135
+ "1.25": [255,0,0,255,255,0,255,255,0,255,255,255,0,255,0,255,0,255,0,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,0,255,0,255,0,0,255,255,255,255,0,255,255,255,255,255,0,255,0,255,255,255,0,255,255,255,0,255,255,255,255,255,0,255,255,255,0,0,0,255,255,0,255,255,255,255,0,255,255,0,0,255,255,0,255,255,255,0,0,255,255,255,0,255,255,255,255,255,0,255,255,255,255,0,0,255,255,0,255,255,255,0,255,255,0,255,0,255,255,0,0,255,0,0,0,255,255,0,255,255,255,255,0,255,0,0,0,255,0,255,0,255,0,255,255,255,0,0,255,255,255,0,255,255,0,0,255,255,255,0,255,255,0,0,255,255,255,0,255,255,255,255,0,255,0,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,0,255,255,255,255,255,0,255,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,255,255,0,0,255,255,255,255,255,0,0,255,255,0,0,0,255,255,0,0,255,255,0,255,255,0,0,255,255,0,255,0,255,0,0,255,255,255,0,255,255,0,0,255,255,0,255,255,255,0,255,0,255,0,0,0,255,255,255,0,255,255,0,255,255,0,0,0,255,255,0,0,255,0,255,255,255,255,255,0,255,0,255,0,255,0,255,0,255,255,0,0,255,0,255,255,255,255,0,0,255,0,0,255,255,0,0,255,255,255,0,0,255,0,255,255,255,0,0,255,255,255,255,0,255,0,0,0,255,255,0,0,255,255,0,255,255,0,255,255,255,0,255,0,255,0,255,0,255,0,255,255,255,255,255,255,255,0,255,255,255,0,255,0,255,0,0,0,255,0,255,255,255,255,0,0,255,255,255,0,255,255,0,0,255,0,0,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,0,255,255,0,0,255,0,255,255,255,255,0,255,255,0,255,255,255,0,0,0,255,255,255,255,255,255,255,0,255,0,255,0,255,255,0,255,255,0,0,0,255,0,255,0,255,0,255,255,255,255,0,0,255,0,255,0,255,0,255,255,255,255,0,0,255,0,0,255,255,255,255,255,255,0,255,0,255,0,0,0,255,0,0,0,255,255,255,0,255,255,0,255,255,0,0,0,255,0,255,0,255,0,255,0,255,0,0,255,255,255,255,255,255,255,255,0,255,255,255,255,255,0,0,255,255,0,255,0,255,255,255,255,255,255,0,0,255,0,0,0,255,255,255,255,255,255,0,255,255,0,255,255,255,0,255,255,255,255,255,255,255,0,0,255,255,255,0,255,255,255,255,255,255,0,0,0,255,0,255,255,255,0,255,255,255,255,255,0,255,255,255,0,255,255,255,255,255,0,0,0,255,255,0,0,255,0,0,0,255,0,0,255,255,255,255,0,255,255,255,0,255,0,255,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,255,0,255,0,255,0,255,0,255,0,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,0,255,255,0,255,255,255,255,255,255,255,255,255,255,0,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,255,0,255,255,255,255,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255]
136
+ }
137
+ },
127
138
  "ripple.sl": {
128
139
  "hash": "730728d3",
129
140
  "source": "// Every pixel of the surface runs this function, at once, on the GPU.\n//\n// uv says where this pixel is, 0 to 1 across the surface. time is the clock.\n// `uniform` is the wire back to JavaScript: declare one here and its name is\n// what the uniforms prop accepts, checked against the .d.ts the build writes\n// beside this file.\nuniform float spread = 0.4;\n\nfloat4 main() {\n float d = length(uv - 0.5);\n float wave = sin(d * 44 - time * 3) * 0.5 + 0.5;\n float ring = wave * smoothstep(0.55, 0.0, d) * (spread * 0.9 + 0.1);\n return float4(lerp(float3(0.05, 0.06, 0.09), float3(0.42, 0.78, 1.0), ring), 1);\n}\n",
@@ -484,5 +495,24 @@
484
495
  "1.25": [83,236,0,255,161,250,0,255,188,253,0,255,178,252,0,255,126,244,0,255,4,219,0,255,148,163,0,255,248,61,0,255,233,92,0,255,111,181,0,255,44,228,0,255,144,247,0,255,184,252,0,255,185,253,0,255,147,247,0,255,52,229,0,255,252,237,0,255,222,211,0,255,199,197,0,255,208,203,0,255,241,225,0,255,253,249,0,255,180,252,0,255,24,209,0,255,34,225,0,255,209,255,0,255,255,244,0,255,232,219,0,255,203,200,0,255,202,199,0,255,231,217,0,255,255,243,0,255,1,99,46,255,119,25,76,255,162,1,86,255,146,2,83,255,62,63,64,255,99,145,0,255,234,220,0,255,227,255,0,255,248,252,0,255,210,204,0,255,55,124,24,255,91,45,70,255,155,0,85,255,157,0,85,255,97,41,72,255,45,120,29,255,250,114,113,255,243,179,129,255,219,202,135,255,230,194,133,255,255,150,121,255,211,52,98,255,6,91,51,255,219,210,0,255,178,186,0,255,79,53,68,255,234,83,105,255,251,165,125,255,224,199,134,255,223,200,134,255,250,168,126,255,237,89,107,255,130,237,147,255,52,255,162,255,131,252,168,255,103,254,166,255,41,250,155,255,217,204,136,255,232,80,105,255,12,106,42,255,68,60,65,255,251,119,114,255,182,221,141,255,1,254,159,255,120,253,167,255,122,253,167,255,7,254,159,255,173,225,142,255,171,246,172,255,255,188,187,255,235,222,180,255,248,210,183,255,233,224,180,255,22,255,160,255,233,191,132,255,174,10,89,255,224,69,102,255,191,218,140,255,101,254,166,255,249,208,184,255,241,217,182,255,240,219,181,255,251,205,184,255,115,253,167,255,254,195,186,255,92,254,165,255,94,244,151,255,12,252,157,255,211,235,176,255,209,236,176,255,122,239,148,255,244,101,109,255,255,148,121,255,28,251,156,255,244,215,182,255,164,248,171,255,62,248,154,255,69,247,153,255,152,249,170,255,248,209,183,255,209,236,176,255,134,236,147,255,250,116,113,255,234,190,132,255,80,255,164,255,253,200,185,255,34,255,161,255,193,217,140,255,164,228,144,255,117,253,167,255,250,207,184,255,16,252,157,255,254,156,123,255,255,148,121,255,41,250,155,255,246,213,183,255,69,255,163,255,224,198,134,255,178,14,90,255,254,133,117,255,88,245,151,255,207,237,176,255,241,217,181,255,159,248,171,255,176,245,172,255,253,199,185,255,156,249,170,255,162,229,144,255,235,86,106,255,228,74,103,255,175,224,142,255,143,251,169,255,177,223,142,255,246,106,111,255,10,89,52,255,182,18,91,255,240,183,130,255,49,250,155,255,156,249,170,255,222,230,178,255,215,234,177,255,119,253,167,255,112,241,149,255,254,152,122,255,118,26,76,255,102,38,73,255,255,145,120,255,124,238,148,255,245,103,110,255,83,51,68,255,192,193,0,255,52,123,26,255,199,38,95,255,252,161,124,255,187,219,141,255,124,239,148,255,134,236,147,255,207,209,137,255,255,137,118,255,155,0,84,255,124,157,0,255,137,164,0,255,144,4,82,255,254,132,117,255,1,95,48,255,195,195,0,255,248,252,0,255,244,228,0,255,94,143,0,255,109,33,74,255,209,50,98,255,238,90,107,255,235,85,106,255,193,31,93,255,66,61,65,255,144,168,0,255,255,241,0,255,255,244,0,255,154,173,0,255,55,67,62,255,247,231,0,255,229,255,0,255,56,230,0,255,174,251,0,255,255,246,0,255,216,207,0,255,138,164,0,255,87,139,0,255,95,143,0,255,157,174,0,255,232,219,0,255,249,251,0,255,128,244,0,255,117,242,0,255,246,252,0,255,235,221,0,255,124,243,0,255,54,201,0,255,218,111,0,255,139,168,0,255,53,229,0,255,183,252,0,255,235,254,0,255,249,252,0,255,247,252,0,255,227,255,0,255,160,249,0,255,2,218,0,255,179,144,0,255,187,139,0,255,1,216,0,255,154,248,0,255,210,119,0,255,255,27,0,255,205,86,0,255,247,15,0,255,238,85,0,255,167,152,0,255,91,189,0,255,46,203,0,255,53,201,0,255,108,182,0,255,187,139,0,255,248,61,0,255,233,49,0,255,229,56,0,255,250,56,0,255,191,135,0,255,189,101,0,255,72,168,0,255,109,226,0,255,2,196,0,255,147,131,0,255,222,66,0,255,249,11,0,255,254,2,0,255,253,1,0,255,245,24,0,255,209,81,0,255,117,148,0,255,53,210,0,255,63,213,0,255,110,151,0,255,206,85,0,255]
485
496
  }
486
497
  }
498
+ },
499
+ "probeContract": "each probe is a function of a pixel of a 64 x 64 frame, x and y whole numbers from the top left, calling the library's own functions (the host's, in its own frame); it returns 0 or 1 per channel and alpha 1. bits has one digit per pixel, rows from the top, 4r + 2g + b, and every pixel has to match",
500
+ "probes": {
501
+ "hash21": {
502
+ "entry": "slProbeHash21",
503
+ "call": "slProbeHash21(pixel)",
504
+ "hlsl": "float slProbeBit(float v) {\n return v - 2.0 * floor(v * 0.5);\n}\nfloat4 slProbeBits(float h, int group) {\n float v = floor(h * 4096.0);\n float t = floor(v * (group == 0 ? 0.001953125 : group == 1 ? 0.015625 : group == 2 ? 0.125 : 1.0));\n return float4(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nfloat4 slProbeCase21(int i) {\n switch (i) {\n case 0:\n return float4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return float4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return float4(0.0, 0.0, -0.0, 1.0);\n case 3:\n return float4(0.0, 0.0, 0.5, 1.0);\n case 4:\n return float4(0.0, 0.0, 1.0, 1.0);\n case 5:\n return float4(0.0, 0.0, 19.0, 1.0);\n case 6:\n return float4(0.0, 0.0, 57.0, 1.0);\n case 7:\n return float4(0.0, 0.0, 1000000.0, 1.0);\n case 8:\n return float4(-4.0, -4.0, 0.0, 1.0);\n case 9:\n return float4(10000.0, -10000.0, 0.0, 1.0);\n case 10:\n return float4(1000000.0, 1000000.0, 0.0, 1.0);\n case 11:\n return float4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return float4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 13:\n return float4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 14:\n return float4(123.0, 456.0, -3.5, 1.0);\n default:\n return float4(-777.0, 333.0, 57.25, 1.0);\n }\n}\nfloat4 slProbeHash21(float2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.25);\n float4 c = slProbeCase21((int)block);\n float2 cell = (c.xy + float2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), (int)(j - n * 4.0));\n}\nfloat4 slProbeCase22(int i) {\n switch (i) {\n case 0:\n return float4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return float4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return float4(-4.0, -4.0, 0.0, 1.0);\n case 3:\n return float4(8.0, 8.0, 0.0, 1.0);\n case 4:\n return float4(-100.0, 50.0, 0.0, 1.0);\n case 5:\n return float4(1000.0, -1000.0, 0.0, 1.0);\n case 6:\n return float4(10000.0, -10000.0, 0.0, 1.0);\n case 7:\n return float4(65536.0, 65536.0, 0.0, 1.0);\n case 8:\n return float4(1000000.0, 1000000.0, 0.0, 1.0);\n case 9:\n return float4(-1000000.0, 1000000.0, 0.0, 1.0);\n case 10:\n return float4(16777216.0, -16777216.0, 0.0, 1.0);\n case 11:\n return float4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return float4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 13:\n return float4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 14:\n return float4(-3000000000.0, 3000000000.0, 0.0, 1.0);\n default:\n return float4(123.0, 456.0, 0.0, 1.0);\n }\n}\nfloat4 slProbeHash22(float2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.125);\n float g = j - n * 8.0;\n float4 c = slProbeCase22((int)block);\n float2 cell = (c.xy + float2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n float2 h = sl_hash22(cell);\n return slProbeBits(g < 4.0 ? h.x : h.y, (int)(g < 4.0 ? g : g - 4.0));\n}",
505
+ "wgsl": "fn slProbeBit(v: f32) -> f32 {\n return v - 2.0 * floor(v * 0.5);\n}\nfn slProbeBits(h: f32, group: i32) -> vec4f {\n let v: f32 = floor(h * 4096.0);\n let t: f32 = floor(v * (select(select(select(1.0, 0.125, group == 2), 0.015625, group == 1), 0.001953125, group == 0)));\n return vec4f(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nfn slProbeCase21(i: i32) -> vec4f {\n switch (i) {\n case 0: {\n return vec4f(0.0, 0.0, 0.0, 1.0);\n }\n case 1: {\n return vec4f(0.0, 0.0, 0.0, -1.0);\n }\n case 2: {\n return vec4f(0.0, 0.0, -0.0, 1.0);\n }\n case 3: {\n return vec4f(0.0, 0.0, 0.5, 1.0);\n }\n case 4: {\n return vec4f(0.0, 0.0, 1.0, 1.0);\n }\n case 5: {\n return vec4f(0.0, 0.0, 19.0, 1.0);\n }\n case 6: {\n return vec4f(0.0, 0.0, 57.0, 1.0);\n }\n case 7: {\n return vec4f(0.0, 0.0, 1000000.0, 1.0);\n }\n case 8: {\n return vec4f(-4.0, -4.0, 0.0, 1.0);\n }\n case 9: {\n return vec4f(10000.0, -10000.0, 0.0, 1.0);\n }\n case 10: {\n return vec4f(1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 11: {\n return vec4f(1073741824.0, -1073741824.0, 0.0, 1.0);\n }\n case 12: {\n return vec4f(3000000000.0, -3000000000.0, 0.0, 1.0);\n }\n case 13: {\n return vec4f(2147483520.0, -2147483648.0, 0.0, 1.0);\n }\n case 14: {\n return vec4f(123.0, 456.0, -3.5, 1.0);\n }\n default: {\n return vec4f(-777.0, 333.0, 57.25, 1.0);\n }\n }\n}\nfn slProbeHash21(pixel: vec2f) -> vec4f {\n let k: f32 = pixel.y * 64.0 + pixel.x;\n let block: f32 = floor(k * 0.00390625);\n let j: f32 = k - block * 256.0;\n let n: f32 = floor(j * 0.25);\n let c: vec4f = slProbeCase21(i32(block));\n let cell: vec2f = (c.xy + vec2f(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), i32(j - n * 4.0));\n}\nfn slProbeCase22(i: i32) -> vec4f {\n switch (i) {\n case 0: {\n return vec4f(0.0, 0.0, 0.0, 1.0);\n }\n case 1: {\n return vec4f(0.0, 0.0, 0.0, -1.0);\n }\n case 2: {\n return vec4f(-4.0, -4.0, 0.0, 1.0);\n }\n case 3: {\n return vec4f(8.0, 8.0, 0.0, 1.0);\n }\n case 4: {\n return vec4f(-100.0, 50.0, 0.0, 1.0);\n }\n case 5: {\n return vec4f(1000.0, -1000.0, 0.0, 1.0);\n }\n case 6: {\n return vec4f(10000.0, -10000.0, 0.0, 1.0);\n }\n case 7: {\n return vec4f(65536.0, 65536.0, 0.0, 1.0);\n }\n case 8: {\n return vec4f(1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 9: {\n return vec4f(-1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 10: {\n return vec4f(16777216.0, -16777216.0, 0.0, 1.0);\n }\n case 11: {\n return vec4f(1073741824.0, -1073741824.0, 0.0, 1.0);\n }\n case 12: {\n return vec4f(2147483520.0, -2147483648.0, 0.0, 1.0);\n }\n case 13: {\n return vec4f(3000000000.0, -3000000000.0, 0.0, 1.0);\n }\n case 14: {\n return vec4f(-3000000000.0, 3000000000.0, 0.0, 1.0);\n }\n default: {\n return vec4f(123.0, 456.0, 0.0, 1.0);\n }\n }\n}\nfn slProbeHash22(pixel: vec2f) -> vec4f {\n let k: f32 = pixel.y * 64.0 + pixel.x;\n let block: f32 = floor(k * 0.00390625);\n let j: f32 = k - block * 256.0;\n let n: f32 = floor(j * 0.125);\n let g: f32 = j - n * 8.0;\n let c: vec4f = slProbeCase22(i32(block));\n let cell: vec2f = (c.xy + vec2f(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n let h: vec2f = sl_hash22(cell);\n return slProbeBits(select(h.y, h.x, g < 4.0), i32(select(g - 4.0, g, g < 4.0)));\n}",
506
+ "glsl": "float slProbeBit(float v) {\n return v - 2.0 * floor(v * 0.5);\n}\nvec4 slProbeBits(float h, int group) {\n float v = floor(h * 4096.0);\n float t = floor(v * (group == 0 ? 0.001953125 : group == 1 ? 0.015625 : group == 2 ? 0.125 : 1.0));\n return vec4(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nvec4 slProbeCase21(int i) {\n switch (i) {\n case 0:\n return vec4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return vec4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return vec4(0.0, 0.0, -0.0, 1.0);\n case 3:\n return vec4(0.0, 0.0, 0.5, 1.0);\n case 4:\n return vec4(0.0, 0.0, 1.0, 1.0);\n case 5:\n return vec4(0.0, 0.0, 19.0, 1.0);\n case 6:\n return vec4(0.0, 0.0, 57.0, 1.0);\n case 7:\n return vec4(0.0, 0.0, 1000000.0, 1.0);\n case 8:\n return vec4(-4.0, -4.0, 0.0, 1.0);\n case 9:\n return vec4(10000.0, -10000.0, 0.0, 1.0);\n case 10:\n return vec4(1000000.0, 1000000.0, 0.0, 1.0);\n case 11:\n return vec4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return vec4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 13:\n return vec4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 14:\n return vec4(123.0, 456.0, -3.5, 1.0);\n default:\n return vec4(-777.0, 333.0, 57.25, 1.0);\n }\n}\nvec4 slProbeHash21(vec2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.25);\n vec4 c = slProbeCase21(int(block));\n vec2 cell = (c.xy + vec2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), int(j - n * 4.0));\n}\nvec4 slProbeCase22(int i) {\n switch (i) {\n case 0:\n return vec4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return vec4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return vec4(-4.0, -4.0, 0.0, 1.0);\n case 3:\n return vec4(8.0, 8.0, 0.0, 1.0);\n case 4:\n return vec4(-100.0, 50.0, 0.0, 1.0);\n case 5:\n return vec4(1000.0, -1000.0, 0.0, 1.0);\n case 6:\n return vec4(10000.0, -10000.0, 0.0, 1.0);\n case 7:\n return vec4(65536.0, 65536.0, 0.0, 1.0);\n case 8:\n return vec4(1000000.0, 1000000.0, 0.0, 1.0);\n case 9:\n return vec4(-1000000.0, 1000000.0, 0.0, 1.0);\n case 10:\n return vec4(16777216.0, -16777216.0, 0.0, 1.0);\n case 11:\n return vec4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return vec4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 13:\n return vec4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 14:\n return vec4(-3000000000.0, 3000000000.0, 0.0, 1.0);\n default:\n return vec4(123.0, 456.0, 0.0, 1.0);\n }\n}\nvec4 slProbeHash22(vec2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.125);\n float g = j - n * 8.0;\n vec4 c = slProbeCase22(int(block));\n vec2 cell = (c.xy + vec2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n vec2 h = sl_hash22(cell);\n return slProbeBits(g < 4.0 ? h.x : h.y, int(g < 4.0 ? g : g - 4.0));\n}",
507
+ "bits": "0616473403651615022543050222017642362354214407523431241513407065624400534431522621262535677413351126632557352016756774440107477343574607066662740107240324102501533205305655773055167762665714501770133320074551426757473450124200614017472222017402103777773064061676507676104256343643320533123525074202553242032227016232362524016155146562042526143530126054674265266650723555415652327042636477770301143775525574715146532163317443132704743472320315575515005646336460405356711554545677732750665376460760051452621663202306164734036516150225430502220176423623542144075234312415134070656244005344315226212625356774133511266325573520167567744401074773435746070666627401072403241025015332053056557730551677626657145017701333200745514267574734501242006140174722220174021037777730645363242657125035632466200421455067655573051721544440074003516757552640173624532151415370665764044011632774264052266523155005751026077736736415141314411424403736342353544170353025362763610542212202764116004162732721173515743630275430560232100763123046271603423641606347665162451313754760640667527153007755024262433505534150044341751202623365020126324036262573030624460045171314342167355735457723501725360764074237332642044025015370342352067072153454312607712776160431762310217121211255462701153517745057537123504242164225320373653420224757524013662370303116620730505167101741122014211153264452616707676304700157362374545200700001571744464420070772007542157656212036456147135052353401734047372765665507051674474253673357421202653212753150556613617536570536351002677164542550306655613501272523704246602341745511317504571605504246771442444536160703706036014655413722442755441370550342473344512757653132422701633064672027540332540210544051635625656422557167366437037544173244447562257211444012065064701035124266770502057256076435156341353670407174341235764175757364011661466516574532247742323135012052442124055310665507026336075226715674210341673111221217477065266161304540232333751313504606706151571740262421355736515331451425775526275256751101341553773647015447764320066751704707634352553775011477036477502277073573554172356650652667422612120230532526620414656155240116471331456703223242025507423525327545632212563410427676765006164734036516154575234724757750423623542144075232307014456301026244005344315226652077630045704411266325573520161234721057306270327515274124517015101166723757112236336040217771462471071337134146662645261665611074324331022473664116557477705347612212634054477766406027575256225235352143405643641536336537247477216742207453170300227330154670116333133737612642001341214500111732664517166062114112523355417003166516371270001015315045534312627153560731206725001701734663436704070272754710345626330051402641052164053401515362374732145425777136371051762060214715605736563641307170451060515574320653376630036601443477063255472635074714461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614461446144614466204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620462046204620433241417225010102037340431152511200740530044062373722355530772131770364576454732433204613723416551065745606064755303626746654274024475342331065525761675535041335706761554524456412106464256703564756720340776536546514260562341242273442473610243145751251232706747507603637702127662055251032772174463000217774517301235236131036634244311615331714734310621455416517135733270044215642047760573742146022167205721246616406406366417251505334267740433663647105720047640777132442752362133750443605616122647332702717417225310"
508
+ },
509
+ "hash22": {
510
+ "entry": "slProbeHash22",
511
+ "call": "slProbeHash22(pixel)",
512
+ "hlsl": "float slProbeBit(float v) {\n return v - 2.0 * floor(v * 0.5);\n}\nfloat4 slProbeBits(float h, int group) {\n float v = floor(h * 4096.0);\n float t = floor(v * (group == 0 ? 0.001953125 : group == 1 ? 0.015625 : group == 2 ? 0.125 : 1.0));\n return float4(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nfloat4 slProbeCase21(int i) {\n switch (i) {\n case 0:\n return float4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return float4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return float4(0.0, 0.0, -0.0, 1.0);\n case 3:\n return float4(0.0, 0.0, 0.5, 1.0);\n case 4:\n return float4(0.0, 0.0, 1.0, 1.0);\n case 5:\n return float4(0.0, 0.0, 19.0, 1.0);\n case 6:\n return float4(0.0, 0.0, 57.0, 1.0);\n case 7:\n return float4(0.0, 0.0, 1000000.0, 1.0);\n case 8:\n return float4(-4.0, -4.0, 0.0, 1.0);\n case 9:\n return float4(10000.0, -10000.0, 0.0, 1.0);\n case 10:\n return float4(1000000.0, 1000000.0, 0.0, 1.0);\n case 11:\n return float4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return float4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 13:\n return float4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 14:\n return float4(123.0, 456.0, -3.5, 1.0);\n default:\n return float4(-777.0, 333.0, 57.25, 1.0);\n }\n}\nfloat4 slProbeHash21(float2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.25);\n float4 c = slProbeCase21((int)block);\n float2 cell = (c.xy + float2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), (int)(j - n * 4.0));\n}\nfloat4 slProbeCase22(int i) {\n switch (i) {\n case 0:\n return float4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return float4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return float4(-4.0, -4.0, 0.0, 1.0);\n case 3:\n return float4(8.0, 8.0, 0.0, 1.0);\n case 4:\n return float4(-100.0, 50.0, 0.0, 1.0);\n case 5:\n return float4(1000.0, -1000.0, 0.0, 1.0);\n case 6:\n return float4(10000.0, -10000.0, 0.0, 1.0);\n case 7:\n return float4(65536.0, 65536.0, 0.0, 1.0);\n case 8:\n return float4(1000000.0, 1000000.0, 0.0, 1.0);\n case 9:\n return float4(-1000000.0, 1000000.0, 0.0, 1.0);\n case 10:\n return float4(16777216.0, -16777216.0, 0.0, 1.0);\n case 11:\n return float4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return float4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 13:\n return float4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 14:\n return float4(-3000000000.0, 3000000000.0, 0.0, 1.0);\n default:\n return float4(123.0, 456.0, 0.0, 1.0);\n }\n}\nfloat4 slProbeHash22(float2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.125);\n float g = j - n * 8.0;\n float4 c = slProbeCase22((int)block);\n float2 cell = (c.xy + float2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n float2 h = sl_hash22(cell);\n return slProbeBits(g < 4.0 ? h.x : h.y, (int)(g < 4.0 ? g : g - 4.0));\n}",
513
+ "wgsl": "fn slProbeBit(v: f32) -> f32 {\n return v - 2.0 * floor(v * 0.5);\n}\nfn slProbeBits(h: f32, group: i32) -> vec4f {\n let v: f32 = floor(h * 4096.0);\n let t: f32 = floor(v * (select(select(select(1.0, 0.125, group == 2), 0.015625, group == 1), 0.001953125, group == 0)));\n return vec4f(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nfn slProbeCase21(i: i32) -> vec4f {\n switch (i) {\n case 0: {\n return vec4f(0.0, 0.0, 0.0, 1.0);\n }\n case 1: {\n return vec4f(0.0, 0.0, 0.0, -1.0);\n }\n case 2: {\n return vec4f(0.0, 0.0, -0.0, 1.0);\n }\n case 3: {\n return vec4f(0.0, 0.0, 0.5, 1.0);\n }\n case 4: {\n return vec4f(0.0, 0.0, 1.0, 1.0);\n }\n case 5: {\n return vec4f(0.0, 0.0, 19.0, 1.0);\n }\n case 6: {\n return vec4f(0.0, 0.0, 57.0, 1.0);\n }\n case 7: {\n return vec4f(0.0, 0.0, 1000000.0, 1.0);\n }\n case 8: {\n return vec4f(-4.0, -4.0, 0.0, 1.0);\n }\n case 9: {\n return vec4f(10000.0, -10000.0, 0.0, 1.0);\n }\n case 10: {\n return vec4f(1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 11: {\n return vec4f(1073741824.0, -1073741824.0, 0.0, 1.0);\n }\n case 12: {\n return vec4f(3000000000.0, -3000000000.0, 0.0, 1.0);\n }\n case 13: {\n return vec4f(2147483520.0, -2147483648.0, 0.0, 1.0);\n }\n case 14: {\n return vec4f(123.0, 456.0, -3.5, 1.0);\n }\n default: {\n return vec4f(-777.0, 333.0, 57.25, 1.0);\n }\n }\n}\nfn slProbeHash21(pixel: vec2f) -> vec4f {\n let k: f32 = pixel.y * 64.0 + pixel.x;\n let block: f32 = floor(k * 0.00390625);\n let j: f32 = k - block * 256.0;\n let n: f32 = floor(j * 0.25);\n let c: vec4f = slProbeCase21(i32(block));\n let cell: vec2f = (c.xy + vec2f(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), i32(j - n * 4.0));\n}\nfn slProbeCase22(i: i32) -> vec4f {\n switch (i) {\n case 0: {\n return vec4f(0.0, 0.0, 0.0, 1.0);\n }\n case 1: {\n return vec4f(0.0, 0.0, 0.0, -1.0);\n }\n case 2: {\n return vec4f(-4.0, -4.0, 0.0, 1.0);\n }\n case 3: {\n return vec4f(8.0, 8.0, 0.0, 1.0);\n }\n case 4: {\n return vec4f(-100.0, 50.0, 0.0, 1.0);\n }\n case 5: {\n return vec4f(1000.0, -1000.0, 0.0, 1.0);\n }\n case 6: {\n return vec4f(10000.0, -10000.0, 0.0, 1.0);\n }\n case 7: {\n return vec4f(65536.0, 65536.0, 0.0, 1.0);\n }\n case 8: {\n return vec4f(1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 9: {\n return vec4f(-1000000.0, 1000000.0, 0.0, 1.0);\n }\n case 10: {\n return vec4f(16777216.0, -16777216.0, 0.0, 1.0);\n }\n case 11: {\n return vec4f(1073741824.0, -1073741824.0, 0.0, 1.0);\n }\n case 12: {\n return vec4f(2147483520.0, -2147483648.0, 0.0, 1.0);\n }\n case 13: {\n return vec4f(3000000000.0, -3000000000.0, 0.0, 1.0);\n }\n case 14: {\n return vec4f(-3000000000.0, 3000000000.0, 0.0, 1.0);\n }\n default: {\n return vec4f(123.0, 456.0, 0.0, 1.0);\n }\n }\n}\nfn slProbeHash22(pixel: vec2f) -> vec4f {\n let k: f32 = pixel.y * 64.0 + pixel.x;\n let block: f32 = floor(k * 0.00390625);\n let j: f32 = k - block * 256.0;\n let n: f32 = floor(j * 0.125);\n let g: f32 = j - n * 8.0;\n let c: vec4f = slProbeCase22(i32(block));\n let cell: vec2f = (c.xy + vec2f(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n let h: vec2f = sl_hash22(cell);\n return slProbeBits(select(h.y, h.x, g < 4.0), i32(select(g - 4.0, g, g < 4.0)));\n}",
514
+ "glsl": "float slProbeBit(float v) {\n return v - 2.0 * floor(v * 0.5);\n}\nvec4 slProbeBits(float h, int group) {\n float v = floor(h * 4096.0);\n float t = floor(v * (group == 0 ? 0.001953125 : group == 1 ? 0.015625 : group == 2 ? 0.125 : 1.0));\n return vec4(slProbeBit(floor(t * 0.25)), slProbeBit(floor(t * 0.5)), slProbeBit(t), 1.0);\n}\nvec4 slProbeCase21(int i) {\n switch (i) {\n case 0:\n return vec4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return vec4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return vec4(0.0, 0.0, -0.0, 1.0);\n case 3:\n return vec4(0.0, 0.0, 0.5, 1.0);\n case 4:\n return vec4(0.0, 0.0, 1.0, 1.0);\n case 5:\n return vec4(0.0, 0.0, 19.0, 1.0);\n case 6:\n return vec4(0.0, 0.0, 57.0, 1.0);\n case 7:\n return vec4(0.0, 0.0, 1000000.0, 1.0);\n case 8:\n return vec4(-4.0, -4.0, 0.0, 1.0);\n case 9:\n return vec4(10000.0, -10000.0, 0.0, 1.0);\n case 10:\n return vec4(1000000.0, 1000000.0, 0.0, 1.0);\n case 11:\n return vec4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return vec4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 13:\n return vec4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 14:\n return vec4(123.0, 456.0, -3.5, 1.0);\n default:\n return vec4(-777.0, 333.0, 57.25, 1.0);\n }\n}\nvec4 slProbeHash21(vec2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.25);\n vec4 c = slProbeCase21(int(block));\n vec2 cell = (c.xy + vec2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n return slProbeBits(onejsHash21(cell, c.z), int(j - n * 4.0));\n}\nvec4 slProbeCase22(int i) {\n switch (i) {\n case 0:\n return vec4(0.0, 0.0, 0.0, 1.0);\n case 1:\n return vec4(0.0, 0.0, 0.0, -1.0);\n case 2:\n return vec4(-4.0, -4.0, 0.0, 1.0);\n case 3:\n return vec4(8.0, 8.0, 0.0, 1.0);\n case 4:\n return vec4(-100.0, 50.0, 0.0, 1.0);\n case 5:\n return vec4(1000.0, -1000.0, 0.0, 1.0);\n case 6:\n return vec4(10000.0, -10000.0, 0.0, 1.0);\n case 7:\n return vec4(65536.0, 65536.0, 0.0, 1.0);\n case 8:\n return vec4(1000000.0, 1000000.0, 0.0, 1.0);\n case 9:\n return vec4(-1000000.0, 1000000.0, 0.0, 1.0);\n case 10:\n return vec4(16777216.0, -16777216.0, 0.0, 1.0);\n case 11:\n return vec4(1073741824.0, -1073741824.0, 0.0, 1.0);\n case 12:\n return vec4(2147483520.0, -2147483648.0, 0.0, 1.0);\n case 13:\n return vec4(3000000000.0, -3000000000.0, 0.0, 1.0);\n case 14:\n return vec4(-3000000000.0, 3000000000.0, 0.0, 1.0);\n default:\n return vec4(123.0, 456.0, 0.0, 1.0);\n }\n}\nvec4 slProbeHash22(vec2 pixel) {\n float k = pixel.y * 64.0 + pixel.x;\n float block = floor(k * 0.00390625);\n float j = k - block * 256.0;\n float n = floor(j * 0.125);\n float g = j - n * 8.0;\n vec4 c = slProbeCase22(int(block));\n vec2 cell = (c.xy + vec2(n - 8.0 * floor(n * 0.125), floor(n * 0.125))) * c.w;\n vec2 h = sl_hash22(cell);\n return slProbeBits(g < 4.0 ? h.x : h.y, int(g < 4.0 ? g : g - 4.0));\n}",
515
+ "bits": "3747075004432347045054603040140150423336535744070514516462342207061710443411255422302411115143005632015301524323357057254632326353031124640566464756454004235304161643112422000220572356012356607057347725115376241102443653207415660520206031156035415722432666374707504274015067425316073615733005121067617760263024102504737531561705700232571315273047610335632350240066713760453202537512436402016672535765644202722763500710133731105560124403164562633077011672464614456171505101435120612415676364246441526653247356035745727536224534153041513376123214336340104742123063316452020527612415676343512061715051014614456101167246072655454760640616321021101337312763500764420272725357656402016666656536654477470742761563235024476103351315273070023257315617052652104100343423465156161763123565523222006073701164771235441721062656245656353510604303374473134036760046573556113705204123342715613743277110733775407513641626247573161446362213733253655106571242573323731250156263645705514426351704147423604515253175535242433641370346223716772107445475521517740114060064612476361173415703074523414742012230753034262255164236325043660534052527612267365652037715651062357567145711757031106566014662171521154022056501721201140707545060574276171024503762643527723163432027726156531444672246402072776034534342326373721534443221016637641446732115145554420264263205550737775040137130173777106167546277523012510136036074171276167524264433664423175773150132052200656532653537242117662716674621705064131032653364357620574776050350264167413714326252420606776406733056536562635114152541431100105470111231614643033436142333127466550376712347346567627254232343313277146274664656147724241172632517534460557771453531006545650162325233737706362373406762356604546522152165760133400732050532503106205773031341052256711151117663622134230751435312774262601044771274233723633335352376203107041063263477020053014503032113714771631731421522031020547144523603724025060503516672701671437442340747760224612530223034723715047570063345761251460370704326561753710371342736033023465077204146113766141571431062327175634454655316645610123460402150435024765401547261566351753562154727460513241462104104123143557502534424320311245176244471253334115167112370756211645217121535245351663327542103240202647435020707331671447424725061432635342337134344411020304522257036251065154030533757712416433437364114042546620174166026107346023320674332621430540545420333001721207314510512014644155550450214737360162301525347527763130777501652303151732561275363103631464112067505731273362261062113122020043200026175173567706217713054746435407464354055415734536673455366734553667345413162626211624526600512266005125645036413072720130727201307272021754444162441275627321556273215205041013616716636167166361671667151506021125057572524665725246675030116211126122111261221112612722375530403744271174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741667117416671174166711741660574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102605741026057410260574102671404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045117140451171404511714045114157666273272122350720540107544236703367451701720617564727721553075745275771754011236747070212525756341656456305660120420113273547220472324663602546263455315517143704606303035365355400472126701723246476336007164052057012757163025425411317111310446352132644"
516
+ }
487
517
  }
488
518
  }
package/lib/common.hlsl CHANGED
@@ -18,12 +18,14 @@
18
18
  // its own: offset the input to get a different field. The four kinds and
19
19
  // their numbers are the contract with `onejsFbmKind`: 0 value fBm, 1 simplex
20
20
  // fBm, 2 turbulence, 3 ridged, with the classic lacunarity 2 and gain 0.5.
21
- // Voronoi keeps its own hash: the fx side has no voronoi to share yet.
22
- float sl_hash21(float2 p)
21
+ // Voronoi hashes with the value noise's integer hash (noise2d.hlsl says why it
22
+ // is integer), from a key moved well away from the value noise's own, so a
23
+ // program that draws both does not get the same cells lit in each.
24
+ /// A lattice point's jitter, both axes: what voronoi places each point by.
25
+ float2 sl_hash22(float2 p)
23
26
  {
24
- p = frac(p * float2(123.34, 456.21));
25
- p += dot(p, p + 45.32);
26
- return frac(p.x * p.y);
27
+ uint2 v = onejsPcg2d(onejsHashKey(p, 0.0) + uint2(1759714724u, 3002137945u));
28
+ return float2((float)(v.x >> 8u), (float)(v.y >> 8u)) * 5.9604644775390625e-8;
27
29
  }
28
30
 
29
31
  float sl_valueNoise(float2 p) { return onejsVNoise(p, 0.0); }
@@ -117,7 +119,7 @@ float sl_voronoi(float2 p)
117
119
  for (int x = -1; x <= 1; x++)
118
120
  {
119
121
  float2 o = float2(x, y);
120
- float2 jitter = float2(sl_hash21(cell + o), sl_hash21(cell + o + 37.7));
122
+ float2 jitter = sl_hash22(cell + o);
121
123
  best = min(best, length(o + jitter - f));
122
124
  }
123
125
  }
package/lib/noise2d.hlsl CHANGED
@@ -9,28 +9,76 @@
9
9
  // is the kind of thing nobody notices until two effects that should match do
10
10
  // not.
11
11
 
12
- // The product is reduced before the seed is added, and must stay that way.
13
- // p * k reaches the tens of thousands, where one rounding step is a few
14
- // thousandths, and `p * k + seed * c` is a multiply-add a compiler may fuse
15
- // into one rounding. Dawn on Windows did and Metal and ANGLE did not, so the
16
- // same program drew a different fbm on each. frac(frac(x) + frac(y)) is the
17
- // same number, with nothing large left to fuse, and at seed 0 it is exactly
18
- // what it was.
12
+ // MARK: hash
13
+ //
14
+ // The lattice hash is integer arithmetic, and has to stay integer arithmetic.
15
+ // A float hash, frac of a large product as most shader noise is written, is
16
+ // only as exact as the compiler lets it be: one that contracts a multiply and
17
+ // an add into a single rounding computes a different hash, and a different
18
+ // hash is a different picture. Dawn on Windows contracted frac(p * k + c), and
19
+ // Metal computes dot(p, q) as fma(p.y, q.y, p.x * q.x), so one program drew a
20
+ // different noise on each. 32 bit unsigned multiply, add, xor and shift wrap
21
+ // modulo 2^32 on every target (HLSL, Metal, GLSL ES 3.00 highp and WGSL), so
22
+ // nothing is left for a compiler to round. goldens/probes.hlsl holds both
23
+ // hashes to the bit, and src/lib/lib.test.ts refuses a frac in any of them.
24
+
25
+ /// pcg2d (Jarzynski and Olano, "Hash Functions for GPU Rendering", 2020):
26
+ /// two 32 bit words in, two well mixed words out.
27
+ uint2 onejsPcg2d(uint2 v)
28
+ {
29
+ v = v * 1664525u + 1013904223u;
30
+ v.x += v.y * 1664525u;
31
+ v.y += v.x * 1664525u;
32
+ v = v ^ (v >> 16u);
33
+ v.x += v.y * 1664525u;
34
+ v.y += v.x * 1664525u;
35
+ v = v ^ (v >> 16u);
36
+ return v;
37
+ }
38
+
39
+ /// A lattice cell and a seed as the two words the hash mixes.
40
+ ///
41
+ /// The cell is a whole number already, the floor of a point. A float outside
42
+ /// int's range has no defined conversion in HLSL or GLSL, so it is clamped
43
+ /// first: every cell past -2^31 or 2^31 - 128 (the last float below 2^31) is
44
+ /// the edge cell. -0 is 0. A NaN coordinate gives an undefined cell, because
45
+ /// clamp returns either bound for a NaN depending on the backend.
46
+ ///
47
+ /// The seed is its whole part, clamped the same way, and its fraction in
48
+ /// 65536ths, so seeds closer than 1/65536 draw the same field. Each is spread
49
+ /// by a large odd multiplier before it is added, so a seed moves the field far
50
+ /// across the lattice rather than one cell over.
51
+ uint2 onejsHashKey(float2 cell, float seed)
52
+ {
53
+ float2 c = clamp(cell, float2(-2147483648.0, -2147483648.0), float2(2147483520.0, 2147483520.0));
54
+ float s = clamp(seed, -2147483648.0, 2147483520.0);
55
+ float whole = floor(s);
56
+ uint2 key = uint2((uint)(int)whole, (uint)(int)((s - whole) * 65536.0));
57
+ return uint2((uint)(int)c.x, (uint)(int)c.y) + key * uint2(2654435769u, 2246822507u);
58
+ }
59
+
60
+ /// A key's hash as 0..1: the top 24 bits, which a float holds exactly.
61
+ float onejsHashUnit(uint2 key)
62
+ {
63
+ return (float)(onejsPcg2d(key).x >> 8u) * 5.9604644775390625e-8;
64
+ }
65
+
19
66
  float onejsHash21(float2 p, float seed)
20
67
  {
21
- p = frac(frac(p * float2(123.34, 456.21)) + frac(seed * 0.1731));
22
- p += dot(p, p + 45.32);
23
- return frac(p.x * p.y);
68
+ return onejsHashUnit(onejsHashKey(p, seed));
24
69
  }
25
70
 
26
71
  float onejsVNoise(float2 p, float seed)
27
72
  {
28
73
  float2 i = floor(p), f = frac(p);
29
74
  f = f * f * (3.0 - 2.0 * f);
30
- float a = onejsHash21(i, seed);
31
- float b = onejsHash21(i + float2(1, 0), seed);
32
- float c = onejsHash21(i + float2(0, 1), seed);
33
- float d = onejsHash21(i + float2(1, 1), seed);
75
+ // The neighbours are found in integers, so they stay distinct past 2^24,
76
+ // where i + 1 as a float is i again.
77
+ uint2 k = onejsHashKey(i, seed);
78
+ float a = onejsHashUnit(k);
79
+ float b = onejsHashUnit(k + uint2(1u, 0u));
80
+ float c = onejsHashUnit(k + uint2(0u, 1u));
81
+ float d = onejsHashUnit(k + uint2(1u, 1u));
34
82
  return lerp(lerp(a, b, f.x), lerp(c, d, f.x), f.y);
35
83
  }
36
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onejs-sl",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "The OneJS shader language: a small typed language for per pixel programs, compiled to a portable IR and emitted as HLSL, WGSL, GLSL ES or a VM buffer",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/lib/glsl.ts CHANGED
@@ -545,12 +545,36 @@ float sdCircleWave(vec2 p, float tb, float ra) {
545
545
  float d2 = ((co.y * p2.x > co.x * p2.y) ? length(p2 - co) : abs(length(p2) - ra));
546
546
  return min(d1, d2);
547
547
  }
548
+ `,
549
+ `
550
+ uvec2 onejsPcg2d(uvec2 v) {
551
+ v = v * uvec2(1664525u) + uvec2(1013904223u);
552
+ v.x += v.y * 1664525u;
553
+ v.y += v.x * 1664525u;
554
+ v = v ^ (v >> uvec2(16u));
555
+ v.x += v.y * 1664525u;
556
+ v.y += v.x * 1664525u;
557
+ v = v ^ (v >> uvec2(16u));
558
+ return v;
559
+ }
560
+ `,
561
+ `
562
+ uvec2 onejsHashKey(vec2 cell, float seed) {
563
+ vec2 c = clamp(cell, vec2(-2147483648.0, -2147483648.0), vec2(2147483520.0, 2147483520.0));
564
+ float s = clamp(seed, -2147483648.0, 2147483520.0);
565
+ float whole = floor(s);
566
+ uvec2 key = uvec2(uint(int(whole)), uint(int((s - whole) * 65536.0)));
567
+ return uvec2(uint(int(c.x)), uint(int(c.y))) + key * uvec2(2654435769u, 2246822507u);
568
+ }
569
+ `,
570
+ `
571
+ float onejsHashUnit(uvec2 key) {
572
+ return float(onejsPcg2d(key).x >> 8u) * 5.9604644775390625e-8;
573
+ }
548
574
  `,
549
575
  `
550
576
  float onejsHash21(vec2 p, float seed) {
551
- p = fract(fract(p * vec2(123.34, 456.21)) + fract(seed * 0.1731));
552
- p += dot(p, p + 45.32);
553
- return fract(p.x * p.y);
577
+ return onejsHashUnit(onejsHashKey(p, seed));
554
578
  }
555
579
  `,
556
580
  `
@@ -558,10 +582,11 @@ float onejsVNoise(vec2 p, float seed) {
558
582
  vec2 i = floor(p);
559
583
  vec2 f = fract(p);
560
584
  f = f * f * (3.0 - 2.0 * f);
561
- float a = onejsHash21(i, seed);
562
- float b = onejsHash21(i + vec2(1.0, 0.0), seed);
563
- float c = onejsHash21(i + vec2(0.0, 1.0), seed);
564
- float d = onejsHash21(i + vec2(1.0, 1.0), seed);
585
+ uvec2 k = onejsHashKey(i, seed);
586
+ float a = onejsHashUnit(k);
587
+ float b = onejsHashUnit(k + uvec2(1u, 0u));
588
+ float c = onejsHashUnit(k + uvec2(0u, 1u));
589
+ float d = onejsHashUnit(k + uvec2(1u, 1u));
565
590
  return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
566
591
  }
567
592
  `,
@@ -695,10 +720,9 @@ float onejsFbmKind(int kind, vec2 p, float seed, int octaves, float lacunarity,
695
720
  }
696
721
  `,
697
722
  `
698
- float sl_hash21(vec2 p) {
699
- p = fract(p * vec2(123.34, 456.21));
700
- p += dot(p, p + 45.32);
701
- return fract(p.x * p.y);
723
+ vec2 sl_hash22(vec2 p) {
724
+ uvec2 v = onejsPcg2d(onejsHashKey(p, 0.0) + uvec2(1759714724u, 3002137945u));
725
+ return vec2(float(v.x >> 8u), float(v.y >> 8u)) * 5.9604644775390625e-8;
702
726
  }
703
727
  `,
704
728
  `
@@ -823,7 +847,7 @@ float sl_voronoi(vec2 p) {
823
847
  for (int y = -1; y <= 1; y++) {
824
848
  for (int x = -1; x <= 1; x++) {
825
849
  vec2 o = vec2(float(x), float(y));
826
- vec2 jitter = vec2(sl_hash21(cell + o), sl_hash21(cell + o + 37.7));
850
+ vec2 jitter = sl_hash22(cell + o);
827
851
  best = min(best, length(o + jitter - f));
828
852
  }
829
853
  }
package/src/lib/hlsl.ts CHANGED
@@ -545,12 +545,36 @@ float sdCircleWave(float2 p, float tb, float ra) {
545
545
  float d2 = ((co.y * p2.x > co.x * p2.y) ? length(p2 - co) : abs(length(p2) - ra));
546
546
  return min(d1, d2);
547
547
  }
548
+ `,
549
+ `
550
+ uint2 onejsPcg2d(uint2 v) {
551
+ v = v * uint2(1664525u, 1664525u) + uint2(1013904223u, 1013904223u);
552
+ v.x += v.y * 1664525u;
553
+ v.y += v.x * 1664525u;
554
+ v = v ^ (v >> uint2(16u, 16u));
555
+ v.x += v.y * 1664525u;
556
+ v.y += v.x * 1664525u;
557
+ v = v ^ (v >> uint2(16u, 16u));
558
+ return v;
559
+ }
560
+ `,
561
+ `
562
+ uint2 onejsHashKey(float2 cell, float seed) {
563
+ float2 c = clamp(cell, float2(-2147483648.0, -2147483648.0), float2(2147483520.0, 2147483520.0));
564
+ float s = clamp(seed, -2147483648.0, 2147483520.0);
565
+ float whole = floor(s);
566
+ uint2 key = uint2((uint)(int)whole, (uint)(int)((s - whole) * 65536.0));
567
+ return uint2((uint)(int)c.x, (uint)(int)c.y) + key * uint2(2654435769u, 2246822507u);
568
+ }
569
+ `,
570
+ `
571
+ float onejsHashUnit(uint2 key) {
572
+ return (float)(onejsPcg2d(key).x >> 8u) * 5.9604644775390625e-8;
573
+ }
548
574
  `,
549
575
  `
550
576
  float onejsHash21(float2 p, float seed) {
551
- p = frac(frac(p * float2(123.34, 456.21)) + frac(seed * 0.1731));
552
- p += dot(p, p + 45.32);
553
- return frac(p.x * p.y);
577
+ return onejsHashUnit(onejsHashKey(p, seed));
554
578
  }
555
579
  `,
556
580
  `
@@ -558,10 +582,11 @@ float onejsVNoise(float2 p, float seed) {
558
582
  float2 i = floor(p);
559
583
  float2 f = frac(p);
560
584
  f = f * f * (3.0 - 2.0 * f);
561
- float a = onejsHash21(i, seed);
562
- float b = onejsHash21(i + float2(1.0, 0.0), seed);
563
- float c = onejsHash21(i + float2(0.0, 1.0), seed);
564
- float d = onejsHash21(i + float2(1.0, 1.0), seed);
585
+ uint2 k = onejsHashKey(i, seed);
586
+ float a = onejsHashUnit(k);
587
+ float b = onejsHashUnit(k + uint2(1u, 0u));
588
+ float c = onejsHashUnit(k + uint2(0u, 1u));
589
+ float d = onejsHashUnit(k + uint2(1u, 1u));
565
590
  return lerp(lerp(a, b, f.x), lerp(c, d, f.x), f.y);
566
591
  }
567
592
  `,
@@ -695,10 +720,9 @@ float onejsFbmKind(int kind, float2 p, float seed, int octaves, float lacunarity
695
720
  }
696
721
  `,
697
722
  `
698
- float sl_hash21(float2 p) {
699
- p = frac(p * float2(123.34, 456.21));
700
- p += dot(p, p + 45.32);
701
- return frac(p.x * p.y);
723
+ float2 sl_hash22(float2 p) {
724
+ uint2 v = onejsPcg2d(onejsHashKey(p, 0.0) + uint2(1759714724u, 3002137945u));
725
+ return float2((float)(v.x >> 8u), (float)(v.y >> 8u)) * 5.9604644775390625e-8;
702
726
  }
703
727
  `,
704
728
  `
@@ -823,7 +847,7 @@ float sl_voronoi(float2 p) {
823
847
  for (int y = -1; y <= 1; y++) {
824
848
  for (int x = -1; x <= 1; x++) {
825
849
  float2 o = float2(float(x), float(y));
826
- float2 jitter = float2(sl_hash21(cell + o), sl_hash21(cell + o + 37.7));
850
+ float2 jitter = sl_hash22(cell + o);
827
851
  best = min(best, length(o + jitter - f));
828
852
  }
829
853
  }
package/src/lib/names.ts CHANGED
@@ -48,6 +48,9 @@ export const LIB_PARAM_NAMES: ReadonlyArray<readonly string[]> = [
48
48
  ["p", "k", "he"],
49
49
  ["p"],
50
50
  ["p", "tb", "ra"],
51
+ ["v"],
52
+ ["cell", "seed"],
53
+ ["key"],
51
54
  ["p", "seed"],
52
55
  ["p", "seed"],
53
56
  ["p", "seed", "octaves", "lacunarity", "gain"],
package/src/lib/table.ts CHANGED
@@ -50,32 +50,35 @@ export const LIB_FUNCTIONS: readonly LibFunction[] = [
50
50
  { name: "sdHyberbola", params: ["float2", "float", "float"], ret: "float", wgsl: "sdHyberbola", deps: [], colour: false },
51
51
  { name: "sdCoolS", params: ["float2"], ret: "float", wgsl: "sdCoolS", deps: [2], colour: false },
52
52
  { name: "sdCircleWave", params: ["float2", "float", "float"], ret: "float", wgsl: "sdCircleWave", deps: [0], colour: false },
53
- { name: "onejsHash21", params: ["float2", "float"], ret: "float", wgsl: "onejsHash21", deps: [], colour: false },
54
- { name: "onejsVNoise", params: ["float2", "float"], ret: "float", wgsl: "onejsVNoise", deps: [45], colour: false },
55
- { name: "onejsFbm", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbm_f2_f_i_f_f", deps: [46], colour: false },
56
- { name: "onejsFbm", params: ["float2", "float", "int"], ret: "float", wgsl: "onejsFbm_f2_f_i", deps: [47], colour: false },
53
+ { name: "onejsPcg2d", params: ["uint2"], ret: "uint2", wgsl: "onejsPcg2d", deps: [], colour: false },
54
+ { name: "onejsHashKey", params: ["float2", "float"], ret: "uint2", wgsl: "onejsHashKey", deps: [], colour: false },
55
+ { name: "onejsHashUnit", params: ["uint2"], ret: "float", wgsl: "onejsHashUnit", deps: [45], colour: false },
56
+ { name: "onejsHash21", params: ["float2", "float"], ret: "float", wgsl: "onejsHash21", deps: [46, 47], colour: false },
57
+ { name: "onejsVNoise", params: ["float2", "float"], ret: "float", wgsl: "onejsVNoise", deps: [46, 47], colour: false },
58
+ { name: "onejsFbm", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbm_f2_f_i_f_f", deps: [49], colour: false },
59
+ { name: "onejsFbm", params: ["float2", "float", "int"], ret: "float", wgsl: "onejsFbm_f2_f_i", deps: [50], colour: false },
57
60
  { name: "onejsMod289", params: ["float2"], ret: "float2", wgsl: "onejsMod289_f2", deps: [], colour: false },
58
61
  { name: "onejsMod289", params: ["float3"], ret: "float3", wgsl: "onejsMod289_f3", deps: [], colour: false },
59
- { name: "onejsPermute", params: ["float3"], ret: "float3", wgsl: "onejsPermute", deps: [50], colour: false },
60
- { name: "onejsSimplexRaw", params: ["float2"], ret: "float", wgsl: "onejsSimplexRaw", deps: [49, 51], colour: false },
61
- { name: "onejsSimplex", params: ["float2", "float"], ret: "float", wgsl: "onejsSimplex", deps: [52], colour: false },
62
- { name: "onejsFbmSimplex", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmSimplex", deps: [53], colour: false },
63
- { name: "onejsTurbulence", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsTurbulence", deps: [52], colour: false },
64
- { name: "onejsRidged", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsRidged", deps: [52], colour: false },
65
- { name: "onejsFbmKind", params: ["int", "float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmKind", deps: [47, 54, 55, 56], colour: false },
66
- { name: "sl_hash21", params: ["float2"], ret: "float", wgsl: "sl_hash21", deps: [], colour: false },
67
- { name: "sl_valueNoise", params: ["float2"], ret: "float", wgsl: "sl_valueNoise", deps: [46], colour: false },
68
- { name: "sl_simplex", params: ["float2"], ret: "float", wgsl: "sl_simplex", deps: [53], colour: false },
69
- { name: "sl_fbm", params: ["float2", "int", "int"], ret: "float", wgsl: "sl_fbm", deps: [57], colour: false },
62
+ { name: "onejsPermute", params: ["float3"], ret: "float3", wgsl: "onejsPermute", deps: [53], colour: false },
63
+ { name: "onejsSimplexRaw", params: ["float2"], ret: "float", wgsl: "onejsSimplexRaw", deps: [52, 54], colour: false },
64
+ { name: "onejsSimplex", params: ["float2", "float"], ret: "float", wgsl: "onejsSimplex", deps: [55], colour: false },
65
+ { name: "onejsFbmSimplex", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmSimplex", deps: [56], colour: false },
66
+ { name: "onejsTurbulence", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsTurbulence", deps: [55], colour: false },
67
+ { name: "onejsRidged", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsRidged", deps: [55], colour: false },
68
+ { name: "onejsFbmKind", params: ["int", "float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmKind", deps: [50, 57, 58, 59], colour: false },
69
+ { name: "sl_hash22", params: ["float2"], ret: "float2", wgsl: "sl_hash22", deps: [45, 46], colour: false },
70
+ { name: "sl_valueNoise", params: ["float2"], ret: "float", wgsl: "sl_valueNoise", deps: [49], colour: false },
71
+ { name: "sl_simplex", params: ["float2"], ret: "float", wgsl: "sl_simplex", deps: [56], colour: false },
72
+ { name: "sl_fbm", params: ["float2", "int", "int"], ret: "float", wgsl: "sl_fbm", deps: [60], colour: false },
70
73
  { name: "sl_hsv2rgb", params: ["float3"], ret: "float3", wgsl: "sl_hsv2rgb", deps: [], colour: false },
71
74
  { name: "sl_sdfDistance", params: ["int", "float2", "float4", "float2"], ret: "float", wgsl: "sl_sdfDistance", deps: [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], colour: false },
72
- { name: "sl_voronoi", params: ["float2"], ret: "float", wgsl: "sl_voronoi", deps: [58], colour: false },
75
+ { name: "sl_voronoi", params: ["float2"], ret: "float", wgsl: "sl_voronoi", deps: [61], colour: false },
73
76
  { name: "sl_luminance", params: ["float3"], ret: "float", wgsl: "sl_luminance", deps: [], colour: false },
74
77
  { name: "sl_gammaToLinear", params: ["float3"], ret: "float3", wgsl: "sl_gammaToLinear", deps: [], colour: false },
75
- { name: "sl_toLinear", params: ["float"], ret: "float", wgsl: "sl_toLinear_f", deps: [66], colour: true },
76
- { name: "sl_toLinear", params: ["float2"], ret: "float2", wgsl: "sl_toLinear_f2", deps: [66], colour: true },
77
- { name: "sl_toLinear", params: ["float3"], ret: "float3", wgsl: "sl_toLinear_f3", deps: [66], colour: true },
78
- { name: "sl_toLinear", params: ["float4"], ret: "float4", wgsl: "sl_toLinear_f4", deps: [66], colour: true },
78
+ { name: "sl_toLinear", params: ["float"], ret: "float", wgsl: "sl_toLinear_f", deps: [69], colour: true },
79
+ { name: "sl_toLinear", params: ["float2"], ret: "float2", wgsl: "sl_toLinear_f2", deps: [69], colour: true },
80
+ { name: "sl_toLinear", params: ["float3"], ret: "float3", wgsl: "sl_toLinear_f3", deps: [69], colour: true },
81
+ { name: "sl_toLinear", params: ["float4"], ret: "float4", wgsl: "sl_toLinear_f4", deps: [69], colour: true },
79
82
  ]
80
83
 
81
84
  /** Shape id to the function and where its parameters come from, read from sl_sdfDistance's switch. */
package/src/lib/wgsl.ts CHANGED
@@ -587,11 +587,35 @@ fn sdCircleWave(pIn: vec2f, tbIn: f32, ra: f32) -> f32 {
587
587
  }
588
588
  `,
589
589
  `
590
- fn onejsHash21(pIn: vec2f, seed: f32) -> f32 {
591
- var p: vec2f = pIn;
592
- p = fract(fract(p * vec2f(123.34, 456.21)) + fract(seed * 0.1731));
593
- p += dot(p, p + 45.32);
594
- return fract(p.x * p.y);
590
+ fn onejsPcg2d(vIn: vec2u) -> vec2u {
591
+ var v: vec2u = vIn;
592
+ v = v * vec2u(1664525u) + vec2u(1013904223u);
593
+ v.x += v.y * 1664525u;
594
+ v.y += v.x * 1664525u;
595
+ v = v ^ (v >> vec2u(16u));
596
+ v.x += v.y * 1664525u;
597
+ v.y += v.x * 1664525u;
598
+ v = v ^ (v >> vec2u(16u));
599
+ return v;
600
+ }
601
+ `,
602
+ `
603
+ fn onejsHashKey(cell: vec2f, seed: f32) -> vec2u {
604
+ let c: vec2f = clamp(cell, vec2f(-2147483648.0, -2147483648.0), vec2f(2147483520.0, 2147483520.0));
605
+ let s: f32 = clamp(seed, -2147483648.0, 2147483520.0);
606
+ let whole: f32 = floor(s);
607
+ let key: vec2u = vec2u(u32(i32(whole)), u32(i32((s - whole) * 65536.0)));
608
+ return vec2u(u32(i32(c.x)), u32(i32(c.y))) + key * vec2u(2654435769u, 2246822507u);
609
+ }
610
+ `,
611
+ `
612
+ fn onejsHashUnit(key: vec2u) -> f32 {
613
+ return f32(onejsPcg2d(key).x >> 8u) * 5.9604644775390625e-8;
614
+ }
615
+ `,
616
+ `
617
+ fn onejsHash21(p: vec2f, seed: f32) -> f32 {
618
+ return onejsHashUnit(onejsHashKey(p, seed));
595
619
  }
596
620
  `,
597
621
  `
@@ -599,10 +623,11 @@ fn onejsVNoise(p: vec2f, seed: f32) -> f32 {
599
623
  let i: vec2f = floor(p);
600
624
  var f: vec2f = fract(p);
601
625
  f = f * f * (3.0 - 2.0 * f);
602
- let a: f32 = onejsHash21(i, seed);
603
- let b: f32 = onejsHash21(i + vec2f(1.0, 0.0), seed);
604
- let c: f32 = onejsHash21(i + vec2f(0.0, 1.0), seed);
605
- let d: f32 = onejsHash21(i + vec2f(1.0, 1.0), seed);
626
+ let k: vec2u = onejsHashKey(i, seed);
627
+ let a: f32 = onejsHashUnit(k);
628
+ let b: f32 = onejsHashUnit(k + vec2u(1u, 0u));
629
+ let c: f32 = onejsHashUnit(k + vec2u(0u, 1u));
630
+ let d: f32 = onejsHashUnit(k + vec2u(1u, 1u));
606
631
  return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
607
632
  }
608
633
  `,
@@ -746,11 +771,9 @@ fn onejsFbmKind(kind: i32, p: vec2f, seed: f32, octaves: i32, lacunarity: f32, g
746
771
  }
747
772
  `,
748
773
  `
749
- fn sl_hash21(pIn: vec2f) -> f32 {
750
- var p: vec2f = pIn;
751
- p = fract(p * vec2f(123.34, 456.21));
752
- p += dot(p, p + 45.32);
753
- return fract(p.x * p.y);
774
+ fn sl_hash22(p: vec2f) -> vec2f {
775
+ let v: vec2u = onejsPcg2d(onejsHashKey(p, 0.0) + vec2u(1759714724u, 3002137945u));
776
+ return vec2f(f32(v.x >> 8u), f32(v.y >> 8u)) * 5.9604644775390625e-8;
754
777
  }
755
778
  `,
756
779
  `
@@ -918,7 +941,7 @@ fn sl_voronoi(p: vec2f) -> f32 {
918
941
  for (var y: i32 = -1; y <= 1; y++) {
919
942
  for (var x: i32 = -1; x <= 1; x++) {
920
943
  let o: vec2f = vec2f(f32(x), f32(y));
921
- let jitter: vec2f = vec2f(sl_hash21(cell + o), sl_hash21(cell + o + 37.7));
944
+ let jitter: vec2f = sl_hash22(cell + o);
922
945
  best = min(best, length(o + jitter - f));
923
946
  }
924
947
  }