onejs-sl 0.1.10 → 0.1.11
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 +9 -0
- package/goldens/goldens.json +5 -5
- package/lib/noise2d.hlsl +8 -1
- package/package.json +1 -1
- package/src/ir.ts +17 -5
- package/src/lang/README.md +3 -1
- package/src/lib/glsl.ts +1 -1
- package/src/lib/hlsl.ts +1 -1
- package/src/lib/wgsl.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.11
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
- `fbm` with 2 or more octaves now looks different
|
|
8
|
+
- Default `fx.noise` fields now look different, since they are seeded
|
|
9
|
+
- `noise`, one octave of `fbm`, simplex, turbulence and ridged are unchanged
|
|
10
|
+
- A helper library change that keeps the IR's shape does not bump `SL_IR_VERSION`
|
|
11
|
+
|
|
3
12
|
## 0.1.10
|
|
4
13
|
|
|
5
14
|
Attributes on uniforms, for a host's controls (`Specs/SL_NEXT.md` 1). A program that has none compiles to exactly what it did, and one that has them hashes as it would without.
|
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.11",
|
|
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": [
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"hash": "8e7e61f6",
|
|
25
25
|
"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
26
|
"samples": {
|
|
27
|
-
"0": [
|
|
28
|
-
"1.25": [214,
|
|
27
|
+
"0": [204,101,49,255,189,93,45,255,179,88,42,255,181,89,42,255,175,86,41,255,166,81,38,255,150,73,34,255,155,75,35,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,189,93,45,255,183,90,43,255,178,87,41,255,184,91,43,255,188,93,44,255,184,91,43,255,170,84,39,255,161,79,37,255,154,75,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,180,89,42,255,163,80,37,255,160,78,36,255,185,91,44,255,208,104,50,255,206,102,49,255,177,87,41,255,162,79,37,255,150,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,177,87,41,255,176,87,41,255,189,93,45,255,192,95,45,255,205,102,49,255,203,101,49,255,184,91,43,255,164,80,38,255,164,80,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,193,96,46,255,197,98,47,255,206,102,50,255,206,102,50,255,196,97,47,255,183,90,43,255,168,82,39,255,151,73,34,255,153,74,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,212,106,51,255,219,109,53,255,220,110,54,255,211,105,51,255,197,97,47,255,173,85,40,255,147,71,33,255,124,59,26,255,132,63,28,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,222,111,54,255,231,115,57,255,222,111,54,255,212,106,51,255,190,94,45,255,170,83,39,255,147,71,33,255,141,68,31,255,138,67,30,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,211,105,51,255,225,113,55,255,239,120,59,255,219,109,53,255,190,94,45,255,174,85,40,255,158,77,36,255,154,75,34,255,161,78,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,216,108,52,255,226,113,55,255,239,120,59,255,220,110,54,255,197,98,47,255,180,89,42,255,164,80,37,255,153,74,34,255,154,75,34,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,105,51,255,212,105,51,255,211,105,51,255,210,104,51,255,210,104,51,255,196,97,47,255,167,82,38,255,132,63,28,255,141,68,31,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,192,95,46,255,189,93,45,255,180,88,42,255,180,88,42,255,192,95,46,255,196,97,47,255,176,87,41,255,148,72,33,255,147,71,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,181,89,42,255,169,83,39,255,161,79,37,255,168,82,39,255,181,89,42,255,193,96,46,255,188,93,44,255,167,82,38,255,174,86,41,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,181,89,43,255,175,86,41,255,172,84,40,255,168,82,39,255,160,78,36,255,167,82,38,255,188,93,44,255,177,87,41,255,185,91,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,183,90,43,255,182,89,43,255,169,83,39,255,166,81,38,255,158,77,36,255,154,75,35,255,175,86,41,255,184,91,43,255,188,93,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,164,80,37,255,165,81,38,255,172,85,40,255,158,77,36,255,168,82,38,255,169,83,39,255,173,85,40,255,185,91,43,255,186,92,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,173,85,40,255,176,87,41,255,179,88,42,255,186,92,44,255,176,86,41,255,176,86,41,255,174,85,40,255,179,88,42,255,179,88,42,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255],
|
|
28
|
+
"1.25": [214,107,52,255,192,95,46,255,186,92,44,255,168,82,38,255,161,79,37,255,172,84,40,255,189,93,45,255,176,87,41,255,167,81,38,255,147,71,33,255,150,73,34,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,51,255,192,95,46,255,183,90,43,255,176,87,41,255,174,86,41,255,182,90,43,255,203,101,49,255,203,101,49,255,181,89,43,255,157,76,35,255,162,79,37,255,149,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,204,101,49,255,205,102,49,255,202,100,48,255,205,102,49,255,198,98,47,255,206,102,50,255,205,102,49,255,177,87,41,255,162,79,37,255,161,78,37,255,148,72,33,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,216,108,53,255,220,109,54,255,220,110,54,255,220,110,54,255,217,108,53,255,199,98,48,255,196,97,47,255,191,94,45,255,178,87,41,255,159,77,36,255,154,75,35,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,220,110,54,255,229,115,56,255,220,110,54,255,211,105,51,255,198,98,47,255,176,86,41,255,161,79,37,255,154,75,35,255,156,76,35,255,166,81,38,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,210,104,51,255,219,109,53,255,235,117,58,255,233,117,57,255,208,103,50,255,184,91,43,255,167,82,38,255,139,67,30,255,123,59,25,255,136,65,29,255,160,78,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,213,106,52,255,221,110,54,255,237,119,59,255,223,111,55,255,196,97,47,255,183,90,43,255,160,78,37,255,145,70,32,255,135,65,29,255,132,63,28,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,200,99,48,255,206,102,50,255,211,105,51,255,216,107,52,255,200,99,48,255,178,88,42,255,158,77,36,255,158,77,36,255,156,76,35,255,146,70,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,175,86,41,255,176,87,41,255,182,90,43,255,198,98,47,255,205,102,49,255,185,91,43,255,153,74,34,255,150,73,34,255,160,78,36,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,168,82,38,255,160,78,36,255,166,81,38,255,187,92,44,255,196,97,47,255,183,90,43,255,155,75,35,255,128,61,27,255,147,71,32,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,174,85,40,255,171,84,39,255,170,83,39,255,176,86,41,255,192,95,46,255,183,90,43,255,157,76,35,255,146,71,32,255,162,79,37,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,169,83,39,255,165,81,38,255,163,80,37,255,149,72,33,255,180,88,42,255,181,89,43,255,160,78,37,255,183,90,43,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,172,84,40,255,156,76,35,255,165,81,38,255,158,77,36,255,175,86,41,255,183,90,43,255,184,91,43,255,195,96,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,187,92,44,255,184,91,43,255,171,84,40,255,170,83,39,255,175,86,41,255,181,89,43,255,188,93,44,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,193,96,46,255,187,93,44,255,175,86,41,255,173,85,40,255,177,87,41,255,184,91,43,255,194,96,46,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,191,94,45,255,185,91,43,255,175,86,41,255,168,82,39,255,168,82,39,255,176,86,41,255,191,94,45,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255,225,112,55,255]
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"cov-arith.sl": {
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"hash": "4c59d609",
|
|
65
65
|
"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
66
|
"samples": {
|
|
67
|
-
"0": [174,
|
|
68
|
-
"1.25": [178,
|
|
67
|
+
"0": [174,158,126,255,210,189,205,255,158,187,175,255,225,193,173,255,147,149,159,255,135,169,158,255,173,156,188,255,178,161,183,255,141,180,181,255,132,192,161,255,199,176,94,255,212,191,150,255,240,219,200,255,231,197,184,255,226,193,172,255,217,203,188,255,161,175,160,255,178,177,187,255,192,159,236,255,180,184,203,255,211,168,201,255,195,193,171,255,186,189,164,255,146,163,176,255,210,170,158,255,191,156,155,255,207,158,174,255,174,174,183,255,202,184,201,255,231,196,212,255,178,204,157,255,220,205,189,255,195,183,156,255,215,155,197,255,195,202,201,255,195,214,130,255,179,191,119,255,189,167,164,255,196,174,118,255,156,166,150,255,162,180,122,255,165,183,113,255,179,183,162,255,212,178,179,255,221,200,173,255,214,186,160,255,180,193,170,255,178,191,189,255,190,209,165,255,219,173,163,255,209,158,181,255,206,181,158,255,156,173,180,255,182,189,189,255,190,180,155,255,188,197,192,255,196,193,169,255,166,184,165,255,180,194,176,255,200,152,185,255,145,199,174,255,178,175,188,255,188,187,181,255,187,158,174,255,168,189,208,255,164,168,179,255,141,189,174,255,213,205,201,255,143,180,157,255,213,210,149,255,162,171,141,255,224,204,192,255,216,199,215,255,208,184,182,255,203,195,192,255,190,192,148,255,182,144,148,255,218,160,208,255,223,180,192,255,204,191,174,255,186,161,222,255,177,182,180,255,139,154,177,255,173,141,131,255,181,176,163,255,223,153,151,255,186,170,167,255,216,191,192,255,181,175,178,255,204,197,137,255,222,186,165,255,203,177,188,255,183,143,196,255,195,175,184,255,193,188,156,255,186,202,161,255,165,125,179,255,188,180,157,255,180,151,196,255,142,126,152,255,180,183,152,255,211,197,199,255,190,175,197,255,201,166,91,255,174,176,185,255,179,192,165,255,210,210,165,255,196,178,121,255,199,183,155,255,167,177,165,255,179,166,180,255,165,198,141,255,122,125,130,255,165,145,152,255,134,131,170,255,131,185,164,255,142,157,198,255,166,160,175,255,215,202,181,255,201,172,148,255,213,204,164,255,195,199,143,255,218,180,135,255,181,202,139,255,160,157,180,255,200,187,216,255,204,157,210,255,182,163,208,255,144,164,130,255,187,153,193,255,176,161,113,255,174,165,175,255,163,190,168,255,181,175,136,255,118,188,183,255,206,180,171,255,172,196,186,255,159,179,193,255,173,186,176,255,193,183,187,255,169,152,174,255,178,134,176,255,121,136,160,255,160,152,198,255,135,186,182,255,94,96,190,255,90,168,135,255,117,181,164,255,175,183,161,255,174,149,160,255,127,142,205,255,179,137,155,255,195,160,161,255,203,162,135,255,153,159,146,255,154,175,175,255,179,156,189,255,192,141,125,255,153,133,166,255,167,174,147,255,181,146,177,255,153,143,176,255,175,178,181,255,138,181,186,255,150,156,168,255,117,129,182,255,148,163,178,255,182,184,129,255,213,201,176,255,207,205,179,255,213,162,162,255,193,190,154,255,123,140,222,255,175,166,213,255,154,168,160,255,105,138,87,255,186,150,153,255,122,125,177,255,143,144,221,255,92,143,173,255,192,164,151,255,192,183,184,255,193,171,169,255,165,151,189,255,216,187,189,255,204,187,172,255,182,178,157,255,197,144,177,255,160,166,179,255,184,191,163,255,180,161,169,255,154,134,153,255,200,163,157,255,120,161,167,255,104,151,182,255,137,193,194,255,189,186,149,255,164,180,161,255,152,148,212,255,215,203,187,255,188,226,135,255,218,207,155,255,178,181,122,255,162,178,162,255,137,145,168,255,145,167,130,255,112,179,165,255,167,160,187,255,175,139,184,255,168,179,150,255,179,148,107,255,177,183,185,255,173,179,132,255,185,162,149,255,202,183,174,255,223,196,184,255,220,202,115,255,244,185,153,255,200,178,198,255,187,186,187,255,179,182,193,255,149,136,175,255,110,181,166,255,170,171,196,255,124,169,161,255,178,146,212,255,187,137,177,255,129,151,194,255,149,192,163,255,193,199,101,255,170,177,165,255,219,207,188,255,218,196,160,255,198,214,174,255,215,199,206,255,167,151,176,255,158,182,184,255,194,198,166,255,140,158,163,255,175,155,126,255,163,173,150,255,172,150,210,255,189,177,194,255,164,154,194,255,162,157,198,255,208,197,202,255,181,182,178,255,184,199,195,255,197,207,178,255,194,194,164,255,199,180,140,255,173,149,171,255,182,180,186,255,199,197,207,255,185,152,162,255,171,136,142,255],
|
|
68
|
+
"1.25": [178,187,193,255,193,186,191,255,196,197,130,255,195,189,168,255,124,186,148,255,162,166,139,255,188,170,164,255,193,146,176,255,124,172,195,255,143,164,171,255,207,147,139,255,236,212,173,255,244,223,197,255,215,189,154,255,246,175,151,255,195,168,108,255,176,160,165,255,183,182,217,255,185,168,209,255,201,168,206,255,187,163,213,255,173,173,191,255,137,160,165,255,167,152,172,255,190,194,136,255,180,181,157,255,212,163,145,255,196,168,194,255,229,196,224,255,215,206,169,255,205,210,180,255,214,215,185,255,183,154,148,255,221,184,196,255,164,211,190,255,189,203,160,255,188,183,177,255,200,189,150,255,191,190,156,255,182,148,206,255,180,165,143,255,177,186,143,255,213,183,157,255,189,213,178,255,217,179,193,255,215,214,191,255,183,187,184,255,209,191,154,255,186,200,176,255,230,177,188,255,201,190,159,255,211,177,122,255,139,146,185,255,209,172,145,255,155,173,123,255,159,204,201,255,171,194,156,255,159,198,136,255,182,153,179,255,188,204,187,255,183,182,143,255,179,181,164,255,164,181,202,255,175,191,168,255,187,189,203,255,168,179,171,255,185,183,160,255,191,197,198,255,159,205,163,255,187,191,174,255,208,139,172,255,216,199,207,255,218,174,207,255,179,178,199,255,220,193,138,255,194,165,151,255,176,158,189,255,217,168,201,255,220,169,154,255,175,195,189,255,178,177,216,255,146,170,187,255,159,159,171,255,181,158,164,255,200,165,169,255,205,190,170,255,194,160,161,255,215,187,198,255,202,152,209,255,217,175,184,255,179,196,203,255,176,192,187,255,176,153,193,255,214,172,193,255,220,198,140,255,200,200,183,255,194,165,182,255,158,181,176,255,190,139,178,255,122,159,142,255,220,198,144,255,192,193,192,255,199,172,189,255,185,190,114,255,181,187,182,255,203,215,131,255,218,188,154,255,228,166,155,255,189,189,165,255,178,147,175,255,139,184,179,255,163,190,120,255,148,161,147,255,184,140,155,255,102,171,164,255,130,164,179,255,186,171,172,255,197,172,201,255,223,203,177,255,183,185,158,255,194,207,179,255,201,178,106,255,207,181,169,255,157,189,140,255,180,196,140,255,204,169,178,255,208,127,200,255,162,187,194,255,137,140,152,255,171,131,180,255,182,165,149,255,164,168,162,255,142,142,156,255,168,164,168,255,179,186,178,255,212,173,184,255,206,194,195,255,164,179,147,255,204,207,154,255,174,199,195,255,148,153,210,255,177,153,164,255,161,139,179,255,135,130,190,255,148,167,187,255,145,132,185,255,105,171,149,255,159,185,172,255,179,169,170,255,150,161,117,255,134,167,192,255,185,139,179,255,166,185,170,255,176,145,161,255,132,139,168,255,189,162,204,255,177,144,153,255,186,146,146,255,125,138,144,255,180,171,166,255,172,151,175,255,121,170,148,255,109,186,174,255,169,176,188,255,129,180,188,255,169,137,184,255,154,116,143,255,202,188,152,255,222,200,128,255,200,174,146,255,206,201,130,255,158,181,191,255,178,117,202,255,174,165,188,255,122,138,127,255,126,169,129,255,186,149,184,255,130,145,192,255,166,149,193,255,134,151,159,255,171,159,164,255,171,177,195,255,137,180,146,255,188,185,189,255,232,193,188,255,179,200,165,255,201,162,179,255,184,126,202,255,138,178,201,255,184,175,192,255,149,163,162,255,175,120,151,255,171,129,166,255,123,128,176,255,120,165,194,255,128,186,160,255,192,185,161,255,184,170,180,255,185,166,214,255,192,193,170,255,208,207,170,255,199,191,123,255,165,184,137,255,166,154,179,255,149,183,142,255,181,167,154,255,126,176,168,255,179,156,173,255,154,162,197,255,142,155,133,255,168,162,179,255,177,190,154,255,205,186,110,255,164,138,153,255,203,181,209,255,222,214,114,255,219,222,151,255,220,195,176,255,185,185,204,255,201,184,199,255,139,136,173,255,134,177,153,255,120,178,175,255,188,157,216,255,139,160,179,255,195,187,165,255,174,125,184,255,128,178,205,255,142,183,155,255,167,188,126,255,207,210,177,255,230,203,132,255,213,199,105,255,226,217,185,255,198,185,194,255,134,182,167,255,178,179,170,255,148,155,167,255,150,155,166,255,134,133,152,255,122,153,158,255,179,121,222,255,194,160,188,255,136,168,202,255,198,192,167,255,213,191,167,255,171,188,172,255,213,194,165,255,188,191,169,255,182,178,180,255,223,185,175,255,154,172,183,255,200,187,170,255,186,184,166,255,185,128,154,255,149,156,136,255]
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"cov-step.sl": {
|
package/lib/noise2d.hlsl
CHANGED
|
@@ -9,9 +9,16 @@
|
|
|
9
9
|
// is the kind of thing nobody notices until two effects that should match do
|
|
10
10
|
// not.
|
|
11
11
|
|
|
12
|
+
// The product is reduced before the seed is added, and must stay that way.
|
|
13
|
+
// p * k reaches the tens of thousands, where one rounding step is a few
|
|
14
|
+
// thousandths, and `p * k + seed * c` is a multiply-add a compiler may fuse
|
|
15
|
+
// into one rounding. Dawn on Windows did and Metal and ANGLE did not, so the
|
|
16
|
+
// same program drew a different fbm on each. frac(frac(x) + frac(y)) is the
|
|
17
|
+
// same number, with nothing large left to fuse, and at seed 0 it is exactly
|
|
18
|
+
// what it was.
|
|
12
19
|
float onejsHash21(float2 p, float seed)
|
|
13
20
|
{
|
|
14
|
-
p = frac(p * float2(123.34, 456.21) + seed * 0.1731);
|
|
21
|
+
p = frac(frac(p * float2(123.34, 456.21)) + frac(seed * 0.1731));
|
|
15
22
|
p += dot(p, p + 45.32);
|
|
16
23
|
return frac(p.x * p.y);
|
|
17
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onejs-sl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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/ir.ts
CHANGED
|
@@ -425,9 +425,12 @@ export function hashProgram(nodes: SLNode[], result: NodeRef, uniforms: UniformD
|
|
|
425
425
|
return d
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
// The IR version is in the hash, so a change to what an opcode
|
|
429
|
-
// changes every hash and every cache keyed by one
|
|
430
|
-
//
|
|
428
|
+
// The IR version is in the hash, so a change to what an opcode means in the
|
|
429
|
+
// IR changes every hash and every cache keyed by one recompiles rather than
|
|
430
|
+
// serving the old maths. A change to the helper library alone (a noise's
|
|
431
|
+
// arithmetic, say) is not one: every host includes the library's text when
|
|
432
|
+
// it compiles, and none caches a compiled program by hash across a
|
|
433
|
+
// library update, so the new text reaches every shader without a bump.
|
|
431
434
|
const parts: string[] = [`v${SL_HASH_VERSION}:${SL_IR_VERSION}`, of(result)]
|
|
432
435
|
for (const u of uniforms) parts.push(`U:${u.name}:${u.type}:${u.value.map(fixed).join(",")}`)
|
|
433
436
|
for (const t of textures) parts.push(`T:${t.name}:${t.slot}`)
|
|
@@ -451,8 +454,17 @@ export const SL_HASH_VERSION = 1
|
|
|
451
454
|
|
|
452
455
|
/**
|
|
453
456
|
* Bumped whenever the IR changes in a way a reader has to know about: a new
|
|
454
|
-
* opcode, a new shape, a change to what an existing opcode
|
|
455
|
-
* change to the JSON shape (which also gets a migration in
|
|
457
|
+
* opcode, a new shape, a change to what an existing opcode's operands or
|
|
458
|
+
* result mean, or a change to the JSON shape (which also gets a migration in
|
|
459
|
+
* `fromJSON`).
|
|
460
|
+
*
|
|
461
|
+
* NOT bumped for a change to the helper library (`lib/*.hlsl`) that keeps the
|
|
462
|
+
* IR's shape, such as 0.1.11's value noise hash. Hosts include the library's
|
|
463
|
+
* text when they compile and do not cache its output by hash: OneJS's
|
|
464
|
+
* generated shaders include `SLCommon.cginc`, which recompiles, and Magerie
|
|
465
|
+
* keys its compiled pipelines by source text. A bump would change every hash,
|
|
466
|
+
* which strands every recorded program in a player built before the editor
|
|
467
|
+
* records it again, for no gain.
|
|
456
468
|
*
|
|
457
469
|
* A reader accepts every version up to its own and refuses a newer one with a
|
|
458
470
|
* message naming both, the rule the particle wire and fx follow. Part of the
|
package/src/lang/README.md
CHANGED
|
@@ -58,7 +58,9 @@ It writes two things beside the code:
|
|
|
58
58
|
|
|
59
59
|
- **`<name>.sl.d.ts`**, the way a USS module gets one, carrying the uniform
|
|
60
60
|
names in the type. `uniforms={{ wrap: 1 }}` is then a call site error rather
|
|
61
|
-
than a console warning on a frame nobody is looking at.
|
|
61
|
+
than a console warning on a frame nobody is looking at. Its doc comment lists
|
|
62
|
+
each uniform with its default and the control its attributes ask for, so
|
|
63
|
+
hovering the import says what to set (from onejs-unity after 0.5.19).
|
|
62
64
|
- **`app.sl.json`** beside the bundle, the manifest `SLShaderGenerator` already
|
|
63
65
|
watches for. This is the thing the file format makes possible and the EDSL
|
|
64
66
|
cannot: a program in a file is known statically, so **an ejected game is
|
package/src/lib/glsl.ts
CHANGED
|
@@ -548,7 +548,7 @@ float sdCircleWave(vec2 p, float tb, float ra) {
|
|
|
548
548
|
`,
|
|
549
549
|
`
|
|
550
550
|
float onejsHash21(vec2 p, float seed) {
|
|
551
|
-
p = fract(p * vec2(123.34, 456.21) + seed * 0.1731);
|
|
551
|
+
p = fract(fract(p * vec2(123.34, 456.21)) + fract(seed * 0.1731));
|
|
552
552
|
p += dot(p, p + 45.32);
|
|
553
553
|
return fract(p.x * p.y);
|
|
554
554
|
}
|
package/src/lib/hlsl.ts
CHANGED
|
@@ -548,7 +548,7 @@ float sdCircleWave(float2 p, float tb, float ra) {
|
|
|
548
548
|
`,
|
|
549
549
|
`
|
|
550
550
|
float onejsHash21(float2 p, float seed) {
|
|
551
|
-
p = frac(p * float2(123.34, 456.21) + seed * 0.1731);
|
|
551
|
+
p = frac(frac(p * float2(123.34, 456.21)) + frac(seed * 0.1731));
|
|
552
552
|
p += dot(p, p + 45.32);
|
|
553
553
|
return frac(p.x * p.y);
|
|
554
554
|
}
|
package/src/lib/wgsl.ts
CHANGED
|
@@ -589,7 +589,7 @@ fn sdCircleWave(pIn: vec2f, tbIn: f32, ra: f32) -> f32 {
|
|
|
589
589
|
`
|
|
590
590
|
fn onejsHash21(pIn: vec2f, seed: f32) -> f32 {
|
|
591
591
|
var p: vec2f = pIn;
|
|
592
|
-
p = fract(p * vec2f(123.34, 456.21) + seed * 0.1731);
|
|
592
|
+
p = fract(fract(p * vec2f(123.34, 456.21)) + fract(seed * 0.1731));
|
|
593
593
|
p += dot(p, p + 45.32);
|
|
594
594
|
return fract(p.x * p.y);
|
|
595
595
|
}
|