@luma.gl/shadertools 9.0.0-alpha.45 → 9.0.0-alpha.47
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/dist/dist.dev.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-arithmetic.glsl.js +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-arithmetic.glsl.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +3 -3
- package/src/modules-webgl1/math/fp64/fp64-arithmetic.glsl.ts +1 -1
package/dist/dist.dev.js
CHANGED
|
@@ -7151,7 +7151,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
7151
7151
|
|
|
7152
7152
|
The purpose of this workaround is to prevent shader compilers from
|
|
7153
7153
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
7154
|
-
or transform the equation to some 'equivalent'
|
|
7154
|
+
or transform the equation to some 'equivalent' form.
|
|
7155
7155
|
|
|
7156
7156
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
7157
7157
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
package/dist/index.cjs
CHANGED
|
@@ -6935,7 +6935,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
6935
6935
|
|
|
6936
6936
|
The purpose of this workaround is to prevent shader compilers from
|
|
6937
6937
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
6938
|
-
or transform the equation to some 'equivalent'
|
|
6938
|
+
or transform the equation to some 'equivalent' form.
|
|
6939
6939
|
|
|
6940
6940
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
6941
6941
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
|
@@ -7,7 +7,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
7
7
|
|
|
8
8
|
The purpose of this workaround is to prevent shader compilers from
|
|
9
9
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
10
|
-
or transform the equation to some 'equivalent'
|
|
10
|
+
or transform the equation to some 'equivalent' form.
|
|
11
11
|
|
|
12
12
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
13
13
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fp64-arithmetic.glsl.js","names":["glsl","fp64arithmeticShader"],"sources":["../../../../src/modules-webgl1/math/fp64/fp64-arithmetic.glsl.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {glsl} from '../../../lib/glsl-utils/highlight';\n\nexport const fp64arithmeticShader = glsl`\\\nuniform float ONE;\n\n/*\nAbout LUMA_FP64_CODE_ELIMINATION_WORKAROUND\n\nThe purpose of this workaround is to prevent shader compilers from\noptimizing away necessary arithmetic operations by swapping their sequences\nor transform the equation to some 'equivalent'
|
|
1
|
+
{"version":3,"file":"fp64-arithmetic.glsl.js","names":["glsl","fp64arithmeticShader"],"sources":["../../../../src/modules-webgl1/math/fp64/fp64-arithmetic.glsl.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {glsl} from '../../../lib/glsl-utils/highlight';\n\nexport const fp64arithmeticShader = glsl`\\\nuniform float ONE;\n\n/*\nAbout LUMA_FP64_CODE_ELIMINATION_WORKAROUND\n\nThe purpose of this workaround is to prevent shader compilers from\noptimizing away necessary arithmetic operations by swapping their sequences\nor transform the equation to some 'equivalent' form.\n\nThe method is to multiply an artifical variable, ONE, which will be known to\nthe compiler to be 1 only at runtime. The whole expression is then represented\nas a polynomial with respective to ONE. In the coefficients of all terms, only one a\nand one b should appear\n\nerr = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE\n*/\n\n// Divide float number to high and low floats to extend fraction bits\nvec2 split(float a) {\n const float SPLIT = 4097.0;\n float t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float a_hi = t * ONE - (t - a);\n float a_lo = a * ONE - a_hi;\n#else\n float a_hi = t - (t - a);\n float a_lo = a - a_hi;\n#endif\n return vec2(a_hi, a_lo);\n}\n\n// Divide float number again when high float uses too many fraction bits\nvec2 split2(vec2 a) {\n vec2 b = split(a.x);\n b.y += a.y;\n return b;\n}\n\n// Special sum operation when a > b\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float sum = (a + b) * ONE;\n float err = b - (sum - a) * ONE;\n#else\n float sum = a + b;\n float err = b - (sum - a);\n#endif\n return vec2(sum, err);\n}\n\n// General sum operation\nvec2 twoSum(float a, float b) {\n float s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\n float v = s - a;\n float err = (a - (s - v)) + (b - v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSub(float a, float b) {\n float s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\n float v = s - a;\n float err = (a - (s - v)) - (b + v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSqr(float a) {\n float prod = a * a;\n vec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\n a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\n float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\n return vec2(prod, err);\n}\n\nvec2 twoProd(float a, float b) {\n float prod = a * b;\n vec2 a_fp64 = split(a);\n vec2 b_fp64 = split(b);\n float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\n a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\n return vec2(prod, err);\n}\n\nvec2 sum_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSum(a.x, b.x);\n t = twoSum(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 sub_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSub(a.x, b.x);\n t = twoSub(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 mul_fp64(vec2 a, vec2 b) {\n vec2 prod = twoProd(a.x, b.x);\n // y component is for the error\n prod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n prod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n return prod;\n}\n\nvec2 div_fp64(vec2 a, vec2 b) {\n float xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n vec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\n vec2 yn = a * xn;\n#endif\n float diff = (sub_fp64(a, mul_fp64(b, yn))).x;\n vec2 prod = twoProd(xn, diff);\n return sum_fp64(yn, prod);\n}\n\nvec2 sqrt_fp64(vec2 a) {\n if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\n if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n\n float x = 1.0 / sqrt(a.x);\n float yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n vec2 yn_sqr = twoSqr(yn) * ONE;\n#else\n vec2 yn_sqr = twoSqr(yn);\n#endif\n float diff = sub_fp64(a, yn_sqr).x;\n vec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n return sum_fp64(split(yn), prod);\n#else\n return sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n`;\n"],"mappings":"SACQA,IAAI;AAEZ,OAAO,MAAMC,oBAAoB,GAAGD,IAAK;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}
|
package/dist.min.js
CHANGED
|
@@ -3823,7 +3823,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
3823
3823
|
|
|
3824
3824
|
The purpose of this workaround is to prevent shader compilers from
|
|
3825
3825
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
3826
|
-
or transform the equation to some 'equivalent'
|
|
3826
|
+
or transform the equation to some 'equivalent' form.
|
|
3827
3827
|
|
|
3828
3828
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
3829
3829
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
|
@@ -3989,7 +3989,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
3989
3989
|
|
|
3990
3990
|
The purpose of this workaround is to prevent shader compilers from
|
|
3991
3991
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
3992
|
-
or transform the equation to some 'equivalent'
|
|
3992
|
+
or transform the equation to some 'equivalent' form.
|
|
3993
3993
|
|
|
3994
3994
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
3995
3995
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/shadertools",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.47",
|
|
4
4
|
"description": "Shader module system for luma.gl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
49
|
+
"@luma.gl/core": "9.0.0-alpha.47",
|
|
50
50
|
"@math.gl/core": "^4.0.0",
|
|
51
51
|
"@math.gl/types": "^4.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "7c6e28518021f98c7d0739f5cbdac386144206a1"
|
|
54
54
|
}
|
|
@@ -9,7 +9,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
9
9
|
|
|
10
10
|
The purpose of this workaround is to prevent shader compilers from
|
|
11
11
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
12
|
-
or transform the equation to some 'equivalent'
|
|
12
|
+
or transform the equation to some 'equivalent' form.
|
|
13
13
|
|
|
14
14
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
15
15
|
the compiler to be 1 only at runtime. The whole expression is then represented
|