typegpu 0.11.2 → 0.11.4
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/README.md +1 -1
- package/core/buffer/buffer.js +17 -53
- package/core/function/autoIO.js +2 -2
- package/core/function/entryInputRouter.js +10 -16
- package/core/function/fnCore.js +16 -12
- package/core/function/shelllessImpl.js +1 -1
- package/core/function/tgpuComputeFn.js +1 -1
- package/core/function/tgpuFn.js +1 -1
- package/core/function/tgpuFragmentFn.d.ts +1 -1
- package/core/function/tgpuFragmentFn.js +1 -1
- package/core/function/tgpuVertexFn.js +1 -1
- package/core/pipeline/computePipeline.d.ts +1 -1
- package/core/root/init.d.ts +1 -0
- package/core/root/init.js +6 -0
- package/core/root/rootTypes.d.ts +21 -15
- package/core/slot/accessor.js +1 -1
- package/data/dataIO.d.ts +11 -0
- package/data/dataIO.js +45 -1
- package/data/dataTypes.js +2 -11
- package/data/index.d.ts +3 -3
- package/data/numeric.js +16 -14
- package/data/partialIO.d.ts +8 -0
- package/data/partialIO.js +6 -1
- package/data/snippet.d.ts +1 -6
- package/data/wgslTypes.d.ts +2 -0
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/indexNamedExports.d.ts +2 -0
- package/package.js +1 -1
- package/package.json +1 -1
- package/resolutionCtx.js +82 -86
- package/shared/stringify.js +1 -0
- package/shared/tseynit.js +90 -0
- package/tgsl/accessIndex.js +4 -3
- package/tgsl/accessProp.js +7 -2
- package/tgsl/consoleLog/deserializers.js +1 -1
- package/tgsl/consoleLog/logGenerator.js +16 -14
- package/tgsl/consoleLog/types.d.ts +4 -5
- package/tgsl/conversion.js +15 -5
- package/tgsl/forOfUtils.js +14 -6
- package/tgsl/generationHelpers.d.ts +2 -1
- package/tgsl/generationHelpers.js +1 -4
- package/tgsl/jsPolyfills.d.ts +25 -0
- package/tgsl/jsPolyfills.js +44 -0
- package/tgsl/shaderGenerator.d.ts +2 -3
- package/tgsl/shaderGenerator_members.d.ts +15 -2
- package/tgsl/wgslGenerator.d.ts +3 -1
- package/tgsl/wgslGenerator.js +64 -59
- package/types.d.ts +11 -6
- package/tgsl/consoleLog/types.js +0 -12
- package/tgsl/math.js +0 -45
package/types.d.ts
CHANGED
|
@@ -49,11 +49,17 @@ type ItemLayer = {
|
|
|
49
49
|
type: 'item';
|
|
50
50
|
usedSlots: Set<TgpuSlot<unknown>>;
|
|
51
51
|
};
|
|
52
|
+
type FunctionArgumentAccess = () => Snippet | undefined;
|
|
53
|
+
interface FunctionArgument {
|
|
54
|
+
name: string;
|
|
55
|
+
access: FunctionArgumentAccess;
|
|
56
|
+
decoratedType: BaseData;
|
|
57
|
+
used: boolean;
|
|
58
|
+
}
|
|
52
59
|
type FunctionScopeLayer = {
|
|
53
60
|
type: 'functionScope';
|
|
54
61
|
functionType: 'normal' | 'compute' | 'vertex' | 'fragment';
|
|
55
|
-
|
|
56
|
-
argAliases: Record<string, Snippet>;
|
|
62
|
+
argAccess: Record<string, FunctionArgumentAccess>;
|
|
57
63
|
externalMap: Record<string, unknown>;
|
|
58
64
|
/**
|
|
59
65
|
* The return type of the function. If undefined, the type should be inferred
|
|
@@ -81,7 +87,7 @@ interface ItemStateStack {
|
|
|
81
87
|
readonly topFunctionScope: FunctionScopeLayer | undefined;
|
|
82
88
|
pushItem(): void;
|
|
83
89
|
pushSlotBindings(pairs: SlotValuePair[]): void;
|
|
84
|
-
pushFunctionScope(functionType: 'normal' | TgpuShaderStage,
|
|
90
|
+
pushFunctionScope(functionType: 'normal' | TgpuShaderStage, argAccess: Record<string, FunctionArgumentAccess>,
|
|
85
91
|
/**
|
|
86
92
|
* The return type of the function. If undefined, the type should be inferred
|
|
87
93
|
* from the implementation (relevant for shellless functions).
|
|
@@ -217,8 +223,7 @@ interface ResolutionCtx {
|
|
|
217
223
|
*/
|
|
218
224
|
resolveSnippet(snippet: Snippet): ResolvedSnippet;
|
|
219
225
|
fnToWgsl(options: FnToWgslOptions): {
|
|
220
|
-
|
|
221
|
-
body: Wgsl;
|
|
226
|
+
code: string;
|
|
222
227
|
returnType: BaseData;
|
|
223
228
|
};
|
|
224
229
|
withVaryingLocations<T>(locations: Record<string, number>, callback: () => T): T;
|
|
@@ -261,4 +266,4 @@ type AnyFn = (...args: never[]) => unknown;
|
|
|
261
266
|
type DualFn<T extends AnyFn> = T & GPUCallable<Parameters<T>>;
|
|
262
267
|
type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';
|
|
263
268
|
//#endregion
|
|
264
|
-
export { BindableBufferUsage, DualFn, FunctionScopeLayer, GPUCallable, ResolutionCtx, ResolvableObject, SelfResolvable, TgpuShaderStage, Wgsl, WithCast };
|
|
269
|
+
export { BindableBufferUsage, DualFn, FunctionArgument, FunctionScopeLayer, GPUCallable, ResolutionCtx, ResolvableObject, SelfResolvable, TgpuShaderStage, Wgsl, WithCast };
|
package/tgsl/consoleLog/types.js
DELETED
package/tgsl/math.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { f32 } from "../data/numeric.js";
|
|
2
|
-
import { abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, countLeadingZeros, exp, floor, log, log2, max, min, pow, sign, sin, sinh, sqrt, tan, tanh, trunc } from "../std/numeric.js";
|
|
3
|
-
|
|
4
|
-
//#region src/tgsl/math.ts
|
|
5
|
-
const mathToStd = {
|
|
6
|
-
abs,
|
|
7
|
-
acos,
|
|
8
|
-
acosh,
|
|
9
|
-
asin,
|
|
10
|
-
asinh,
|
|
11
|
-
atan,
|
|
12
|
-
atan2,
|
|
13
|
-
atanh,
|
|
14
|
-
ceil,
|
|
15
|
-
cos,
|
|
16
|
-
cosh,
|
|
17
|
-
exp,
|
|
18
|
-
floor,
|
|
19
|
-
fround: f32,
|
|
20
|
-
clz32: countLeadingZeros,
|
|
21
|
-
trunc,
|
|
22
|
-
log,
|
|
23
|
-
log2,
|
|
24
|
-
pow,
|
|
25
|
-
sign,
|
|
26
|
-
sin,
|
|
27
|
-
sinh,
|
|
28
|
-
sqrt,
|
|
29
|
-
tan,
|
|
30
|
-
tanh,
|
|
31
|
-
max,
|
|
32
|
-
min,
|
|
33
|
-
cbrt: void 0,
|
|
34
|
-
log10: void 0,
|
|
35
|
-
log1p: void 0,
|
|
36
|
-
f16round: void 0,
|
|
37
|
-
hypot: void 0,
|
|
38
|
-
expm1: void 0,
|
|
39
|
-
random: void 0,
|
|
40
|
-
imul: void 0,
|
|
41
|
-
round: void 0
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { mathToStd };
|