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.
Files changed (84) hide show
  1. package/core/function/autoIO.js +2 -2
  2. package/core/function/comptime.js +7 -5
  3. package/core/function/createCallableSchema.js +4 -3
  4. package/core/function/dualImpl.js +21 -19
  5. package/core/function/ioSchema.d.ts +10 -0
  6. package/core/function/ioSchema.js +37 -16
  7. package/core/function/tgpuFn.d.ts +12 -1
  8. package/core/function/tgpuFn.js +19 -2
  9. package/core/pipeline/computePipeline.js +5 -2
  10. package/core/pipeline/renderPipeline.d.ts +4 -2
  11. package/core/pipeline/renderPipeline.js +17 -12
  12. package/core/pipeline/timeable.js +15 -2
  13. package/core/pipeline/webgpuLimitations.js +9 -2
  14. package/core/root/configurableImpl.js +1 -2
  15. package/core/root/init.d.ts +3 -3
  16. package/core/root/init.js +12 -13
  17. package/core/root/rootTypes.d.ts +4 -1
  18. package/core/slot/accessor.js +3 -3
  19. package/core/texture/externalTexture.d.ts +1 -1
  20. package/core/texture/externalTexture.js +3 -1
  21. package/core/texture/texture.d.ts +3 -2
  22. package/core/texture/texture.js +27 -25
  23. package/core/unroll/tgpuUnroll.d.ts +4 -3
  24. package/core/unroll/tgpuUnroll.js +7 -1
  25. package/core/valueProxyUtils.d.ts +4 -2
  26. package/core/valueProxyUtils.js +4 -2
  27. package/data/compiledIO.js +13 -10
  28. package/data/dataIO.d.ts +10 -6
  29. package/data/dataIO.js +35 -20
  30. package/data/dataTypes.d.ts +0 -5
  31. package/data/dataTypes.js +0 -6
  32. package/data/index.d.ts +4 -3
  33. package/data/index.js +3 -2
  34. package/data/matrixColumnsAccess.d.ts +8 -0
  35. package/data/matrixColumnsAccess.js +15 -0
  36. package/data/offsetUtils.js +181 -102
  37. package/data/ref.d.ts +12 -5
  38. package/data/ref.js +50 -23
  39. package/data/schemasEqual.d.ts +37 -0
  40. package/data/schemasEqual.js +131 -0
  41. package/data/snippet.d.ts +7 -0
  42. package/data/snippet.js +9 -0
  43. package/data/struct.js +5 -0
  44. package/data/wgslTypes.d.ts +4 -4
  45. package/package.json +2 -2
  46. package/resolutionCtx.js +1 -1
  47. package/serial/restore.d.ts +3 -2
  48. package/serial/restore.js +2 -1
  49. package/shared/meta.js +1 -1
  50. package/shared/symbols.d.ts +5 -0
  51. package/shared/symbols.js +6 -1
  52. package/std/comptime.d.ts +67 -0
  53. package/std/comptime.js +90 -0
  54. package/std/index.d.ts +2 -0
  55. package/std/index.js +2 -0
  56. package/std/numeric.d.ts +1 -1
  57. package/std/numeric.js +13 -13
  58. package/std/packing.js +10 -10
  59. package/std/typeOf.d.ts +31 -0
  60. package/std/typeOf.js +56 -0
  61. package/tgpuLogger.d.ts +4 -1
  62. package/tgpuLogger.js +3 -2
  63. package/tgsl/accessIndex.js +18 -15
  64. package/tgsl/accessProp.js +10 -7
  65. package/tgsl/consoleLog/serializers.d.ts +1 -8
  66. package/tgsl/consoleLog/serializers.js +53 -37
  67. package/tgsl/conversion.js +3 -2
  68. package/tgsl/forOfUtils.js +2 -2
  69. package/tgsl/generationHelpers.d.ts +4 -3
  70. package/tgsl/generationHelpers.js +16 -3
  71. package/tgsl/infixDispatch.d.ts +4 -1
  72. package/tgsl/infixDispatch.js +13 -1
  73. package/tgsl/makeDereferenceable.d.ts +1 -1
  74. package/tgsl/makeDereferenceable.js +3 -1
  75. package/tgsl/shellless.js +8 -29
  76. package/tgsl/stringifySnippet.d.ts +9 -0
  77. package/tgsl/stringifySnippet.js +24 -0
  78. package/tgsl/wgslGenerator.d.ts +1 -0
  79. package/tgsl/wgslGenerator.js +98 -66
  80. package/types.d.ts +23 -2
  81. package/types.js +30 -5
  82. package/unwrapper.d.ts +2 -2
  83. package/data/deepEqual.d.ts +0 -21
  84. 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
- }