onejs-sl 0.1.11 → 0.1.13
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 +17 -0
- package/README.md +54 -24
- package/goldens/goldens.json +35 -5
- package/lib/common.hlsl +8 -6
- package/lib/noise2d.hlsl +72 -18
- package/package.json +1 -1
- package/src/lib/glsl.ts +45 -17
- package/src/lib/hlsl.ts +45 -17
- package/src/lib/names.ts +3 -0
- package/src/lib/table.ts +23 -20
- package/src/lib/wgsl.ts +47 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.13
|
|
4
|
+
|
|
5
|
+
Unity's Metal compile of OneJS's effects no longer warns of an uninitialized variable. Nothing draws differently.
|
|
6
|
+
|
|
7
|
+
- `onejsFbmKind` returns once, so FxSources compiles on Metal with no warning
|
|
8
|
+
- A WGSL noise kind no longer evaluates both fBm kinds to pick one
|
|
9
|
+
|
|
10
|
+
## 0.1.12
|
|
11
|
+
|
|
12
|
+
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.
|
|
13
|
+
|
|
14
|
+
- `noise`, `fbm`, `voronoi` and value `fx.noise` fields look different; simplex, turbulence and ridged do not
|
|
15
|
+
- Seeds closer than 1/65536 draw the same field, and cells past 2^31 draw the edge cell
|
|
16
|
+
- A 4 octave fbm costs about 14% more (3840 x 2160: 0.50 to 0.57 ms on an M4 Pro, WebGPU)
|
|
17
|
+
- goldens.json ships bit exact hash probes for a host's compiler, and marks exact fixtures
|
|
18
|
+
- `npm run goldens -- --check` compares a machine's drawing with goldens.json
|
|
19
|
+
|
|
3
20
|
## 0.1.11
|
|
4
21
|
|
|
5
22
|
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
|
|
105
|
-
`UNITY_COLORSPACE_GAMMA`, which becomes the target's
|
|
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,
|
|
@@ -114,8 +115,8 @@ know the project's colour space when it prints.
|
|
|
114
115
|
difference, the `.cginc` copies included in the container, and OneJS's
|
|
115
116
|
`SLSharedLibraryTests` checks them from the other side. What proves the
|
|
116
117
|
translations draw the same picture: the goldens compile the whole library on
|
|
117
|
-
WebGPU and WebGL2 and draw every fixture; OneJS's parity harness
|
|
118
|
-
|
|
118
|
+
WebGPU and WebGL2 and draw every fixture; OneJS's parity harness draws every
|
|
119
|
+
fixture through a real WebGL player and holds it to the goldens; `SLSharedLibraryTests` draws every corpus program in Unity
|
|
119
120
|
through `SLCommon.cginc` and through the translated shared subset and requires
|
|
120
121
|
them to agree; and the Metal check above compiles the shared subset.
|
|
121
122
|
|
|
@@ -124,9 +125,11 @@ them to agree; and the Metal check above compiles the shared subset.
|
|
|
124
125
|
`goldens/goldens.json` is every corpus fixture drawn as a Linear OneJS game
|
|
125
126
|
stores it: the package's WGSL and GLSL ES in OneJS's web frame, into an
|
|
126
127
|
`rgba8unorm-srgb` target (the format the element's render texture has), read
|
|
127
|
-
back raw, with no Unity, no UI Toolkit and no browser colour management.
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
back raw, with no Unity, no UI Toolkit and no browser colour management. The
|
|
129
|
+
goldens stand on their own: the two backends must agree, and the anchors and
|
|
130
|
+
the hash probes must match arithmetic. A host's own backend is checked against
|
|
131
|
+
them, as OneJS's parity harness (`Tools/sl-web-parity` in the container) checks
|
|
132
|
+
what a WebGL player draws.
|
|
130
133
|
|
|
131
134
|
`npm run goldens` draws it on WebGPU and WebGL2 in a Chrome with its own
|
|
132
135
|
profile (set `CHROME` to choose one). The two backends must agree within 1/255
|
|
@@ -136,7 +139,21 @@ stores as written) and `texture.sl` (a texture's orientation and sRGB decode).
|
|
|
136
139
|
The whole translated library must also compile on both backends, including
|
|
137
140
|
the functions no fixture reaches. The file describes the sampling grid, the
|
|
138
141
|
times and the texture every sampled slot gets. A host imports it as
|
|
139
|
-
`onejs-sl/goldens.json`.
|
|
142
|
+
`onejs-sl/goldens.json`.
|
|
143
|
+
|
|
144
|
+
The hashes are held to the bit, not to 1/255: two backends that happen to round
|
|
145
|
+
alike prove nothing about a third. `goldens/probes.hlsl` draws each of the
|
|
146
|
+
library's hashes (`hash21`, the value noise's, and `hash22`, voronoi's) as three
|
|
147
|
+
bits per pixel, and `corpus/probe-hash.sl` does the same through a program;
|
|
148
|
+
every pixel must match `goldens/reference.mjs`, which computes the hashes in
|
|
149
|
+
JavaScript. goldens.json ships each probe under its name, as HLSL, WGSL and
|
|
150
|
+
GLSL ES and with the bits it must draw, for a host to run on its own compiler,
|
|
151
|
+
and marks the fixtures compared at 0/255 `exact`.
|
|
152
|
+
|
|
153
|
+
`npm run goldens -- --check` draws everything again and compares it with
|
|
154
|
+
goldens.json instead of writing it: within 1/255, and exact fixtures and probes
|
|
155
|
+
to the byte. It is how a machine that did not write the file checks its own
|
|
156
|
+
GPU and compilers. No CI runner here has a GPU, so `src/goldens.test.ts` checks instead
|
|
140
157
|
that the file still covers the corpus at today's hashes; a change that moves a
|
|
141
158
|
hash fails there until the goldens are drawn again.
|
|
142
159
|
|
|
@@ -169,7 +186,11 @@ Before the tag:
|
|
|
169
186
|
`PlaySite/`. It is a private repo, so no workflow here can. When `diagnose`
|
|
170
187
|
or an error's fix changed, also run `node Tools/editor-sl-smoke/editor-sl-smoke.mjs`
|
|
171
188
|
from the container root, which drives the Play editor in real Monaco.
|
|
172
|
-
4.
|
|
189
|
+
4. Run `npm run goldens -- --check` on Windows, whose WebGPU compiles through
|
|
190
|
+
a different shader compiler from the Mac's that writes goldens.json. A
|
|
191
|
+
compiler that rounds the library differently shows here first, and nowhere
|
|
192
|
+
in CI, which has no GPU.
|
|
193
|
+
5. Push `main` and wait for CI, whose `consumers` job runs onejs-unity's
|
|
173
194
|
and onejs-play's typecheck and tests against the commit (`consumers.yml`). `publish.yml`
|
|
174
195
|
runs the same job and publishes nothing if it fails. When a consumer has to
|
|
175
196
|
follow a change, land it here, fix the consumer, then re-run and tag.
|
|
@@ -183,17 +204,17 @@ container this package is checked out at `JSModules/onejs-sl`, and
|
|
|
183
204
|
|
|
184
205
|
## The one idea
|
|
185
206
|
|
|
186
|
-
**One authoring surface, one IR,
|
|
187
|
-
at runtime in a player build, on any graphics API, so
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
editor compiles shaders at build time.
|
|
207
|
+
**One authoring surface, one IR, several backends.** Unity cannot compile a
|
|
208
|
+
shader at runtime in a player build, on any graphics API, so the first backend
|
|
209
|
+
made a program data that a fixed shader evaluates: a VM. An editor does compile
|
|
210
|
+
shaders, at build time, so the second prints HLSL for it.
|
|
191
211
|
|
|
192
|
-
So the same source
|
|
193
|
-
|
|
212
|
+
So the same source draws compiled from generated HLSL in the editor and in a
|
|
213
|
+
native player, with no edit in between, and the VM stays behind a switch: OneJS
|
|
214
|
+
leaves it out unless a project defines `ONEJS_SL_VM`. Both backends exist:
|
|
194
215
|
`encode.ts` feeds OneJS's `Runtime/SL/SLProgramBridge.cs` and `FxProgram.shader`,
|
|
195
216
|
and `hlsl.ts` feeds its `Editor/SLShaderGenerator.cs`. Nobody writes a manifest for the
|
|
196
|
-
second: an editor that
|
|
217
|
+
second: an editor that draws a program asks the encoded program for its
|
|
197
218
|
`hlsl` (a lazy getter, never read in Play), records it into
|
|
198
219
|
`Assets/OneJS/Recorded.sl.json`, generates the shader and
|
|
199
220
|
moves the live material onto it. `manifest()` is still there for an app that
|
|
@@ -204,10 +225,11 @@ shader, but the page it runs in can. `web.ts` prints every program as WGSL and
|
|
|
204
225
|
as GLSL ES 3.00 (carrying the library functions it calls, translated from
|
|
205
226
|
`lib/*.hlsl`), and OneJS's
|
|
206
227
|
`Plugins/WebGL/OneJSSLWeb.jslib` compiles whichever one Unity's device speaks
|
|
207
|
-
and draws it into the element's target
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
228
|
+
and draws it into the element's target. A `.sl` import carries both strings,
|
|
229
|
+
printed at build time; an `encode()` result has them as lazy getters, like
|
|
230
|
+
`hlsl`. A WebGL player has no VM: the element draws nothing until the compiled
|
|
231
|
+
program is ready, and nothing after a compile error, which the page reports.
|
|
232
|
+
The host contract (the frame block, the
|
|
211
233
|
16 uniform slots, one binding pair per sampled texture) is written out at the
|
|
212
234
|
top of `web.ts`.
|
|
213
235
|
|
|
@@ -215,7 +237,7 @@ The emitters match the HLSL emitter's semantics rather than each language's
|
|
|
215
237
|
own: `%` truncates like `fmod`, `pow` takes `abs` of its base, `asin` and
|
|
216
238
|
`acos` clamp, `log` and `sqrt` guard their argument, a select is the VM's
|
|
217
239
|
branchless `lerp`. `web.test.ts` checks the structure (every shape, every
|
|
218
|
-
opcode, the library order); whether the output matches the
|
|
240
|
+
opcode, the library order); whether the output matches the goldens is
|
|
219
241
|
measured in a browser, through the real element, by `Tools/sl-web-parity` in
|
|
220
242
|
the container.
|
|
221
243
|
|
|
@@ -275,8 +297,10 @@ baseline, which is the one resource neither backend can widen.
|
|
|
275
297
|
|
|
276
298
|
`Program.hash` is what will link a program to its compiled shader. If it differs
|
|
277
299
|
between the machine that generated the shader and the machine that runs it, the
|
|
278
|
-
|
|
279
|
-
|
|
300
|
+
player finds no shader for the program: it draws nothing and logs one error
|
|
301
|
+
naming the hash. Before OneJS 3.6.0 it fell back to the VM and **nobody was
|
|
302
|
+
told**: correct output, quietly slow, no error, the worst failure this design
|
|
303
|
+
could have, and the reason the hash is built the way it is.
|
|
280
304
|
|
|
281
305
|
So it is a Merkle hash over the graph reachable from the result, not a walk of
|
|
282
306
|
the node array. An earlier version hashed storage order, which meant hoisting a
|
|
@@ -407,3 +431,9 @@ a simplex here is the simplex there. Octaves are 1 to 4. A program has no seed;
|
|
|
407
431
|
offset the input for a different field. `sl.simplex` used to be value noise on
|
|
408
432
|
a rotated lattice, and `sl.fbm` had its own value noise; both changed on
|
|
409
433
|
2026-09-06 when the fields were unified.
|
|
434
|
+
|
|
435
|
+
The lattice hash under value noise and voronoi is integer arithmetic (pcg2d),
|
|
436
|
+
so every GPU draws the same bits: `lib/noise2d.hlsl` says why a float hash
|
|
437
|
+
cannot promise that. A cell is converted to an integer, so a point past
|
|
438
|
+
-2^31 or 2^31 lands in the edge cell, and a NaN in an undefined one. `fx.noise`
|
|
439
|
+
seeds are read to 1/65536: two seeds closer than that draw the same field.
|
package/goldens/goldens.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generatedBy": "onejs-sl goldens/run.mjs",
|
|
3
|
-
"package": "0.1.
|
|
3
|
+
"package": "0.1.13",
|
|
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": [
|
|
28
|
-
"1.25": [
|
|
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,
|
|
68
|
-
"1.25": [
|
|
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
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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 =
|
|
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
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
float
|
|
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
|
|
|
@@ -165,10 +213,16 @@ float onejsRidged(float2 p, float seed, int octaves, float lacunarity, float gai
|
|
|
165
213
|
|
|
166
214
|
/// Dispatches on the noise kind: 0 value fBm, 1 simplex fBm, 2 turbulence,
|
|
167
215
|
/// 3 ridged. The numbers are the contract with onejs-unity/src/fx/image.ts.
|
|
216
|
+
///
|
|
217
|
+
/// One return, at the end. Written with early returns, every path still
|
|
218
|
+
/// returns, but Unity's Metal compile warns of a potentially uninitialized
|
|
219
|
+
/// variable named after this function in every project that imports OneJS.
|
|
168
220
|
float onejsFbmKind(int kind, float2 p, float seed, int octaves, float lacunarity, float gain)
|
|
169
221
|
{
|
|
170
|
-
|
|
171
|
-
if (kind ==
|
|
172
|
-
|
|
173
|
-
|
|
222
|
+
float n;
|
|
223
|
+
if (kind == 2) n = onejsTurbulence(p, seed, octaves, lacunarity, gain);
|
|
224
|
+
else if (kind == 3) n = onejsRidged(p, seed, octaves, lacunarity, gain);
|
|
225
|
+
else if (kind == 1) n = onejsFbmSimplex(p, seed, octaves, lacunarity, gain);
|
|
226
|
+
else n = onejsFbm(p, seed, octaves, lacunarity, gain);
|
|
227
|
+
return n;
|
|
174
228
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onejs-sl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
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
|
-
|
|
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
|
-
|
|
562
|
-
float
|
|
563
|
-
float
|
|
564
|
-
float
|
|
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
|
`,
|
|
@@ -685,20 +710,23 @@ float onejsRidged(vec2 p, float seed, int octaves, float lacunarity, float gain)
|
|
|
685
710
|
`,
|
|
686
711
|
`
|
|
687
712
|
float onejsFbmKind(int kind, vec2 p, float seed, int octaves, float lacunarity, float gain) {
|
|
713
|
+
float n;
|
|
688
714
|
if (kind == 2) {
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
715
|
+
n = onejsTurbulence(p, seed, octaves, lacunarity, gain);
|
|
716
|
+
} else if (kind == 3) {
|
|
717
|
+
n = onejsRidged(p, seed, octaves, lacunarity, gain);
|
|
718
|
+
} else if (kind == 1) {
|
|
719
|
+
n = onejsFbmSimplex(p, seed, octaves, lacunarity, gain);
|
|
720
|
+
} else {
|
|
721
|
+
n = onejsFbm(p, seed, octaves, lacunarity, gain);
|
|
693
722
|
}
|
|
694
|
-
return
|
|
723
|
+
return n;
|
|
695
724
|
}
|
|
696
725
|
`,
|
|
697
726
|
`
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
return fract(p.x * p.y);
|
|
727
|
+
vec2 sl_hash22(vec2 p) {
|
|
728
|
+
uvec2 v = onejsPcg2d(onejsHashKey(p, 0.0) + uvec2(1759714724u, 3002137945u));
|
|
729
|
+
return vec2(float(v.x >> 8u), float(v.y >> 8u)) * 5.9604644775390625e-8;
|
|
702
730
|
}
|
|
703
731
|
`,
|
|
704
732
|
`
|
|
@@ -823,7 +851,7 @@ float sl_voronoi(vec2 p) {
|
|
|
823
851
|
for (int y = -1; y <= 1; y++) {
|
|
824
852
|
for (int x = -1; x <= 1; x++) {
|
|
825
853
|
vec2 o = vec2(float(x), float(y));
|
|
826
|
-
vec2 jitter =
|
|
854
|
+
vec2 jitter = sl_hash22(cell + o);
|
|
827
855
|
best = min(best, length(o + jitter - f));
|
|
828
856
|
}
|
|
829
857
|
}
|
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
|
-
|
|
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
|
-
|
|
562
|
-
float
|
|
563
|
-
float
|
|
564
|
-
float
|
|
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
|
`,
|
|
@@ -685,20 +710,23 @@ float onejsRidged(float2 p, float seed, int octaves, float lacunarity, float gai
|
|
|
685
710
|
`,
|
|
686
711
|
`
|
|
687
712
|
float onejsFbmKind(int kind, float2 p, float seed, int octaves, float lacunarity, float gain) {
|
|
713
|
+
float n;
|
|
688
714
|
if (kind == 2) {
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
715
|
+
n = onejsTurbulence(p, seed, octaves, lacunarity, gain);
|
|
716
|
+
} else if (kind == 3) {
|
|
717
|
+
n = onejsRidged(p, seed, octaves, lacunarity, gain);
|
|
718
|
+
} else if (kind == 1) {
|
|
719
|
+
n = onejsFbmSimplex(p, seed, octaves, lacunarity, gain);
|
|
720
|
+
} else {
|
|
721
|
+
n = onejsFbm(p, seed, octaves, lacunarity, gain);
|
|
693
722
|
}
|
|
694
|
-
return
|
|
723
|
+
return n;
|
|
695
724
|
}
|
|
696
725
|
`,
|
|
697
726
|
`
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
return frac(p.x * p.y);
|
|
727
|
+
float2 sl_hash22(float2 p) {
|
|
728
|
+
uint2 v = onejsPcg2d(onejsHashKey(p, 0.0) + uint2(1759714724u, 3002137945u));
|
|
729
|
+
return float2((float)(v.x >> 8u), (float)(v.y >> 8u)) * 5.9604644775390625e-8;
|
|
702
730
|
}
|
|
703
731
|
`,
|
|
704
732
|
`
|
|
@@ -823,7 +851,7 @@ float sl_voronoi(float2 p) {
|
|
|
823
851
|
for (int y = -1; y <= 1; y++) {
|
|
824
852
|
for (int x = -1; x <= 1; x++) {
|
|
825
853
|
float2 o = float2(float(x), float(y));
|
|
826
|
-
float2 jitter =
|
|
854
|
+
float2 jitter = sl_hash22(cell + o);
|
|
827
855
|
best = min(best, length(o + jitter - f));
|
|
828
856
|
}
|
|
829
857
|
}
|
package/src/lib/names.ts
CHANGED
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: "
|
|
54
|
-
{ name: "
|
|
55
|
-
{ name: "
|
|
56
|
-
{ name: "
|
|
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: [
|
|
60
|
-
{ name: "onejsSimplexRaw", params: ["float2"], ret: "float", wgsl: "onejsSimplexRaw", deps: [
|
|
61
|
-
{ name: "onejsSimplex", params: ["float2", "float"], ret: "float", wgsl: "onejsSimplex", deps: [
|
|
62
|
-
{ name: "onejsFbmSimplex", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmSimplex", deps: [
|
|
63
|
-
{ name: "onejsTurbulence", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsTurbulence", deps: [
|
|
64
|
-
{ name: "onejsRidged", params: ["float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsRidged", deps: [
|
|
65
|
-
{ name: "onejsFbmKind", params: ["int", "float2", "float", "int", "float", "float"], ret: "float", wgsl: "onejsFbmKind", deps: [
|
|
66
|
-
{ name: "
|
|
67
|
-
{ name: "sl_valueNoise", params: ["float2"], ret: "float", wgsl: "sl_valueNoise", deps: [
|
|
68
|
-
{ name: "sl_simplex", params: ["float2"], ret: "float", wgsl: "sl_simplex", deps: [
|
|
69
|
-
{ name: "sl_fbm", params: ["float2", "int", "int"], ret: "float", wgsl: "sl_fbm", deps: [
|
|
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: [
|
|
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: [
|
|
76
|
-
{ name: "sl_toLinear", params: ["float2"], ret: "float2", wgsl: "sl_toLinear_f2", deps: [
|
|
77
|
-
{ name: "sl_toLinear", params: ["float3"], ret: "float3", wgsl: "sl_toLinear_f3", deps: [
|
|
78
|
-
{ name: "sl_toLinear", params: ["float4"], ret: "float4", wgsl: "sl_toLinear_f4", deps: [
|
|
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
|
|
591
|
-
var
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
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
|
|
603
|
-
let
|
|
604
|
-
let
|
|
605
|
-
let
|
|
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
|
`,
|
|
@@ -736,21 +761,23 @@ fn onejsRidged(pIn: vec2f, seed: f32, octaves: i32, lacunarity: f32, gain: f32)
|
|
|
736
761
|
`,
|
|
737
762
|
`
|
|
738
763
|
fn onejsFbmKind(kind: i32, p: vec2f, seed: f32, octaves: i32, lacunarity: f32, gain: f32) -> f32 {
|
|
764
|
+
var n: f32;
|
|
739
765
|
if (kind == 2) {
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
|
|
766
|
+
n = onejsTurbulence(p, seed, octaves, lacunarity, gain);
|
|
767
|
+
} else if (kind == 3) {
|
|
768
|
+
n = onejsRidged(p, seed, octaves, lacunarity, gain);
|
|
769
|
+
} else if (kind == 1) {
|
|
770
|
+
n = onejsFbmSimplex(p, seed, octaves, lacunarity, gain);
|
|
771
|
+
} else {
|
|
772
|
+
n = onejsFbm_f2_f_i_f_f(p, seed, octaves, lacunarity, gain);
|
|
744
773
|
}
|
|
745
|
-
return
|
|
774
|
+
return n;
|
|
746
775
|
}
|
|
747
776
|
`,
|
|
748
777
|
`
|
|
749
|
-
fn
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
p += dot(p, p + 45.32);
|
|
753
|
-
return fract(p.x * p.y);
|
|
778
|
+
fn sl_hash22(p: vec2f) -> vec2f {
|
|
779
|
+
let v: vec2u = onejsPcg2d(onejsHashKey(p, 0.0) + vec2u(1759714724u, 3002137945u));
|
|
780
|
+
return vec2f(f32(v.x >> 8u), f32(v.y >> 8u)) * 5.9604644775390625e-8;
|
|
754
781
|
}
|
|
755
782
|
`,
|
|
756
783
|
`
|
|
@@ -918,7 +945,7 @@ fn sl_voronoi(p: vec2f) -> f32 {
|
|
|
918
945
|
for (var y: i32 = -1; y <= 1; y++) {
|
|
919
946
|
for (var x: i32 = -1; x <= 1; x++) {
|
|
920
947
|
let o: vec2f = vec2f(f32(x), f32(y));
|
|
921
|
-
let jitter: vec2f =
|
|
948
|
+
let jitter: vec2f = sl_hash22(cell + o);
|
|
922
949
|
best = min(best, length(o + jitter - f));
|
|
923
950
|
}
|
|
924
951
|
}
|