typegpu 0.12.7 → 0.12.9
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/core/function/autoIO.js +2 -2
- package/core/function/comptime.js +7 -5
- package/core/function/createCallableSchema.js +4 -3
- package/core/function/dualImpl.js +21 -19
- package/core/function/ioSchema.d.ts +10 -0
- package/core/function/ioSchema.js +37 -16
- package/core/function/tgpuFn.d.ts +12 -1
- package/core/function/tgpuFn.js +19 -2
- package/core/pipeline/computePipeline.js +5 -2
- package/core/pipeline/renderPipeline.d.ts +4 -2
- package/core/pipeline/renderPipeline.js +17 -12
- package/core/pipeline/timeable.js +15 -2
- package/core/pipeline/webgpuLimitations.js +9 -2
- package/core/root/configurableImpl.js +1 -2
- package/core/root/init.d.ts +3 -3
- package/core/root/init.js +12 -13
- package/core/root/rootTypes.d.ts +4 -1
- package/core/slot/accessor.js +3 -3
- package/core/texture/externalTexture.d.ts +1 -1
- package/core/texture/externalTexture.js +3 -1
- package/core/texture/texture.d.ts +3 -2
- package/core/texture/texture.js +27 -25
- package/core/unroll/tgpuUnroll.d.ts +4 -3
- package/core/unroll/tgpuUnroll.js +7 -1
- package/core/valueProxyUtils.d.ts +4 -2
- package/core/valueProxyUtils.js +4 -2
- package/data/compiledIO.js +13 -10
- package/data/dataIO.d.ts +10 -6
- package/data/dataIO.js +35 -20
- package/data/dataTypes.d.ts +0 -5
- package/data/dataTypes.js +0 -6
- package/data/index.d.ts +4 -3
- package/data/index.js +3 -2
- package/data/matrixColumnsAccess.d.ts +8 -0
- package/data/matrixColumnsAccess.js +15 -0
- package/data/offsetUtils.js +181 -102
- package/data/ref.d.ts +12 -5
- package/data/ref.js +50 -23
- package/data/schemasEqual.d.ts +37 -0
- package/data/schemasEqual.js +131 -0
- package/data/snippet.d.ts +7 -0
- package/data/snippet.js +9 -0
- package/data/struct.js +5 -0
- package/data/wgslTypes.d.ts +4 -4
- package/package.json +2 -2
- package/resolutionCtx.js +1 -1
- package/serial/restore.d.ts +3 -2
- package/serial/restore.js +2 -1
- package/shared/meta.js +1 -1
- package/shared/symbols.d.ts +5 -0
- package/shared/symbols.js +6 -1
- package/std/comptime.d.ts +67 -0
- package/std/comptime.js +90 -0
- package/std/index.d.ts +2 -0
- package/std/index.js +2 -0
- package/std/numeric.d.ts +1 -1
- package/std/numeric.js +13 -13
- package/std/packing.js +10 -10
- package/std/typeOf.d.ts +31 -0
- package/std/typeOf.js +56 -0
- package/tgpuLogger.d.ts +4 -1
- package/tgpuLogger.js +3 -2
- package/tgsl/accessIndex.js +18 -15
- package/tgsl/accessProp.js +10 -7
- package/tgsl/consoleLog/serializers.d.ts +1 -8
- package/tgsl/consoleLog/serializers.js +53 -37
- package/tgsl/conversion.js +3 -2
- package/tgsl/forOfUtils.js +2 -2
- package/tgsl/generationHelpers.d.ts +4 -3
- package/tgsl/generationHelpers.js +16 -3
- package/tgsl/infixDispatch.d.ts +4 -1
- package/tgsl/infixDispatch.js +13 -1
- package/tgsl/makeDereferenceable.d.ts +1 -1
- package/tgsl/makeDereferenceable.js +3 -1
- package/tgsl/shellless.js +8 -29
- package/tgsl/stringifySnippet.d.ts +9 -0
- package/tgsl/stringifySnippet.js +24 -0
- package/tgsl/wgslGenerator.d.ts +1 -0
- package/tgsl/wgslGenerator.js +98 -66
- package/types.d.ts +23 -2
- package/types.js +30 -5
- package/unwrapper.d.ts +2 -2
- package/data/deepEqual.d.ts +0 -21
- package/data/deepEqual.js +0 -93
package/data/deepEqual.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { isDisarray, isLooseDecorated, isUnstruct } from "./dataTypes.js";
|
|
2
|
-
import { isWgslStorageTexture, isWgslTexture } from "./texture.js";
|
|
3
|
-
import { isAtomic, isDecorated, isPtr, isWgslArray, isWgslStruct } from "./wgslTypes.js";
|
|
4
|
-
/**
|
|
5
|
-
* Performs a deep comparison of two TypeGPU data schemas.
|
|
6
|
-
*
|
|
7
|
-
* @param a The first data schema to compare.
|
|
8
|
-
* @param b The second data schema to compare.
|
|
9
|
-
* @returns `true` if the schemas are deeply equal, `false` otherwise.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { vec3f, struct, deepEqual } from 'typegpu/data';
|
|
14
|
-
*
|
|
15
|
-
* const schema1 = struct({ a: vec3f });
|
|
16
|
-
* const schema2 = struct({ a: vec3f });
|
|
17
|
-
* const schema3 = struct({ b: vec3f });
|
|
18
|
-
*
|
|
19
|
-
* console.log(deepEqual(schema1, schema2)); // true
|
|
20
|
-
* console.log(deepEqual(schema1, schema3)); // false
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function deepEqual(a, b) {
|
|
24
|
-
if (a === b) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
if (a.type !== b.type) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if ((isWgslStruct(a) && isWgslStruct(b)) || (isUnstruct(a) && isUnstruct(b))) {
|
|
31
|
-
const aProps = a.propTypes;
|
|
32
|
-
const bProps = b.propTypes;
|
|
33
|
-
const aKeys = Object.keys(aProps);
|
|
34
|
-
const bKeys = Object.keys(bProps);
|
|
35
|
-
if (aKeys.length !== bKeys.length) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
for (let i = 0; i < aKeys.length; i++) {
|
|
39
|
-
const keyA = aKeys[i];
|
|
40
|
-
const keyB = bKeys[i];
|
|
41
|
-
if (keyA !== keyB ||
|
|
42
|
-
!keyA ||
|
|
43
|
-
!keyB ||
|
|
44
|
-
!deepEqual(aProps[keyA], bProps[keyB])) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
if ((isWgslArray(a) && isWgslArray(b)) || (isDisarray(a) && isDisarray(b))) {
|
|
51
|
-
return (a.elementCount === b.elementCount &&
|
|
52
|
-
deepEqual(a.elementType, b.elementType));
|
|
53
|
-
}
|
|
54
|
-
if (isPtr(a) && isPtr(b)) {
|
|
55
|
-
return (a.addressSpace === b.addressSpace &&
|
|
56
|
-
a.access === b.access &&
|
|
57
|
-
a.implicit === b.implicit &&
|
|
58
|
-
deepEqual(a.inner, b.inner));
|
|
59
|
-
}
|
|
60
|
-
if (isAtomic(a) && isAtomic(b)) {
|
|
61
|
-
return deepEqual(a.inner, b.inner);
|
|
62
|
-
}
|
|
63
|
-
if (isWgslTexture(a) && isWgslTexture(b)) {
|
|
64
|
-
// Dimension and multisampling are already encoded in the type
|
|
65
|
-
return deepEqual(a.sampleType, b.sampleType);
|
|
66
|
-
}
|
|
67
|
-
if (isWgslStorageTexture(a) && isWgslStorageTexture(b)) {
|
|
68
|
-
// Dimension is already encoded in the type
|
|
69
|
-
return a.format === b.format && a.access === b.access;
|
|
70
|
-
}
|
|
71
|
-
if ((isDecorated(a) && isDecorated(b)) || (isLooseDecorated(a) && isLooseDecorated(b))) {
|
|
72
|
-
if (!deepEqual(a.inner, b.inner)) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
if (a.attribs.length !== b.attribs.length) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
for (let i = 0; i < a.attribs.length; i++) {
|
|
79
|
-
const attrA = a.attribs[i];
|
|
80
|
-
const attrB = b.attribs[i];
|
|
81
|
-
const paramsA = attrA.params ?? [];
|
|
82
|
-
const paramsB = attrB.params ?? [];
|
|
83
|
-
if (attrA.type !== attrB.type ||
|
|
84
|
-
paramsA.length !== paramsB.length ||
|
|
85
|
-
paramsA.some((param, idx) => param !== paramsB[idx])) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
// All other types have been checked for equality at the start
|
|
92
|
-
return true;
|
|
93
|
-
}
|