typegpu 0.5.7 → 0.5.8
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/chunk-7ACLI4JY.cjs +2 -0
- package/{chunk-FHOQ6WZE.cjs.map → chunk-7ACLI4JY.cjs.map} +1 -1
- package/chunk-L7HIBZAX.js +4 -0
- package/chunk-L7HIBZAX.js.map +1 -0
- package/chunk-SFECI7OX.js +2 -0
- package/chunk-SFECI7OX.js.map +1 -0
- package/chunk-SLWTVY6K.js +2 -0
- package/chunk-SLWTVY6K.js.map +1 -0
- package/chunk-TF6YPHJS.cjs +2 -0
- package/chunk-TF6YPHJS.cjs.map +1 -0
- package/chunk-V4CSEIB2.cjs +4 -0
- package/chunk-V4CSEIB2.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +2 -2
- package/data/index.d.ts +2 -2
- package/data/index.js +1 -1
- package/index.cjs +18 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +18 -18
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +36 -16
- package/std/index.d.ts +36 -16
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuComputeFn-DH8_PcIR.d.cts → tgpuComputeFn-S61HxwW-.d.cts} +94 -73
- package/{tgpuComputeFn-DH8_PcIR.d.ts → tgpuComputeFn-S61HxwW-.d.ts} +94 -73
- package/chunk-5RYM4COI.js +0 -4
- package/chunk-5RYM4COI.js.map +0 -1
- package/chunk-FHOQ6WZE.cjs +0 -2
- package/chunk-ODKBWWHU.cjs +0 -4
- package/chunk-ODKBWWHU.cjs.map +0 -1
- package/chunk-SMTSXYNG.js +0 -2
- package/chunk-SMTSXYNG.js.map +0 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as tinyest from 'tinyest';
|
2
|
-
import {
|
2
|
+
import { FuncParameter, Block } from 'tinyest';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* Can be assigned a name. Not to be confused with
|
@@ -44,7 +44,7 @@ type InferPartial<T> = T extends {
|
|
44
44
|
* @example
|
45
45
|
* type A = InferGPU<F32> // => number
|
46
46
|
* type B = InferGPU<WgslArray<F32>> // => number[]
|
47
|
-
* type C =
|
47
|
+
* type C = InferGPU<Atomic<U32>> // => atomicU32
|
48
48
|
*/
|
49
49
|
type InferGPU<T> = T extends {
|
50
50
|
readonly '~gpuRepr': infer TRepr;
|
@@ -85,7 +85,7 @@ type Mutable<T> = {
|
|
85
85
|
-readonly [P in keyof T]: T[P];
|
86
86
|
};
|
87
87
|
|
88
|
-
type DecoratedLocation<T extends BaseData> = Decorated<T, Location
|
88
|
+
type DecoratedLocation<T extends BaseData> = Decorated<T, Location[]>;
|
89
89
|
interface NumberArrayView {
|
90
90
|
readonly length: number;
|
91
91
|
[n: number]: number;
|
@@ -627,6 +627,7 @@ interface matBase<TColumn> extends NumberArrayView {
|
|
627
627
|
interface mat2x2<TColumn> extends matBase<TColumn> {
|
628
628
|
readonly length: 4;
|
629
629
|
readonly kind: string;
|
630
|
+
readonly columns: readonly [TColumn, TColumn];
|
630
631
|
[n: number]: number;
|
631
632
|
}
|
632
633
|
/**
|
@@ -643,6 +644,7 @@ interface m2x2f extends mat2x2<v2f> {
|
|
643
644
|
interface mat3x3<TColumn> extends matBase<TColumn> {
|
644
645
|
readonly length: 12;
|
645
646
|
readonly kind: string;
|
647
|
+
readonly columns: readonly [TColumn, TColumn, TColumn];
|
646
648
|
[n: number]: number;
|
647
649
|
}
|
648
650
|
/**
|
@@ -659,6 +661,12 @@ interface m3x3f extends mat3x3<v3f> {
|
|
659
661
|
interface mat4x4<TColumn> extends matBase<TColumn> {
|
660
662
|
readonly length: 16;
|
661
663
|
readonly kind: string;
|
664
|
+
readonly columns: readonly [
|
665
|
+
TColumn,
|
666
|
+
TColumn,
|
667
|
+
TColumn,
|
668
|
+
TColumn
|
669
|
+
];
|
662
670
|
[n: number]: number;
|
663
671
|
}
|
664
672
|
/**
|
@@ -670,6 +678,7 @@ interface m4x4f extends mat4x4<v4f> {
|
|
670
678
|
}
|
671
679
|
type AnyMatInstance = m2x2f | m3x3f | m4x4f;
|
672
680
|
type vBaseForMat<T extends AnyMatInstance> = T extends m2x2f ? v2f : T extends m3x3f ? v3f : v4f;
|
681
|
+
type mBaseForVec<T extends AnyVecInstance> = T extends v2f ? m2x2f : T extends v3f ? m3x3f : T extends v4f ? m4x4f : never;
|
673
682
|
/**
|
674
683
|
* Boolean schema representing a single WGSL bool value.
|
675
684
|
* Cannot be used inside buffers as it is not host-shareable.
|
@@ -947,8 +956,8 @@ interface Mat2x2f {
|
|
947
956
|
readonly [$internal]: true;
|
948
957
|
readonly type: 'mat2x2f';
|
949
958
|
readonly [$repr]: m2x2f;
|
950
|
-
(...elements: number
|
951
|
-
(...columns: v2f
|
959
|
+
(...elements: [number, number, number, number]): m2x2f;
|
960
|
+
(...columns: [v2f, v2f]): m2x2f;
|
952
961
|
(): m2x2f;
|
953
962
|
}
|
954
963
|
/**
|
@@ -958,8 +967,8 @@ interface Mat3x3f {
|
|
958
967
|
readonly [$internal]: true;
|
959
968
|
readonly type: 'mat3x3f';
|
960
969
|
readonly [$repr]: m3x3f;
|
961
|
-
(...elements: number
|
962
|
-
(...columns: v3f
|
970
|
+
(...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;
|
971
|
+
(...columns: [v3f, v3f, v3f]): m3x3f;
|
963
972
|
(): m3x3f;
|
964
973
|
}
|
965
974
|
/**
|
@@ -969,8 +978,8 @@ interface Mat4x4f {
|
|
969
978
|
readonly [$internal]: true;
|
970
979
|
readonly type: 'mat4x4f';
|
971
980
|
readonly [$repr]: m4x4f;
|
972
|
-
(...elements: number
|
973
|
-
(...columns: v4f
|
981
|
+
(...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;
|
982
|
+
(...columns: [v4f, v4f, v4f, v4f]): m4x4f;
|
974
983
|
(): m4x4f;
|
975
984
|
}
|
976
985
|
/**
|
@@ -1054,7 +1063,7 @@ interface Size<T extends number> {
|
|
1054
1063
|
readonly type: '@size';
|
1055
1064
|
readonly value: T;
|
1056
1065
|
}
|
1057
|
-
interface Location<T extends number> {
|
1066
|
+
interface Location<T extends number = number> {
|
1058
1067
|
readonly [$internal]: true;
|
1059
1068
|
readonly type: '@location';
|
1060
1069
|
readonly value: T;
|
@@ -1062,7 +1071,7 @@ interface Location<T extends number> {
|
|
1062
1071
|
type PerspectiveOrLinearInterpolationType = `${'perspective' | 'linear'}${'' | ', center' | ', centroid' | ', sample'}`;
|
1063
1072
|
type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;
|
1064
1073
|
type InterpolationType = PerspectiveOrLinearInterpolationType | FlatInterpolationType;
|
1065
|
-
interface Interpolate<T extends InterpolationType> {
|
1074
|
+
interface Interpolate<T extends InterpolationType = InterpolationType> {
|
1066
1075
|
readonly [$internal]: true;
|
1067
1076
|
readonly type: '@interpolate';
|
1068
1077
|
readonly value: T;
|
@@ -1080,7 +1089,7 @@ interface Decorated<TInner extends BaseData = BaseData, TAttribs extends unknown
|
|
1080
1089
|
readonly [$repr]: Infer<TInner>;
|
1081
1090
|
readonly '~gpuRepr': InferGPU<TInner>;
|
1082
1091
|
readonly '~reprPartial': InferPartial<TInner>;
|
1083
|
-
readonly '~memIdent': TAttribs extends Location
|
1092
|
+
readonly '~memIdent': TAttribs extends Location[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
|
1084
1093
|
}
|
1085
1094
|
declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec2<bool>", "vec3f", "vec3h", "vec3i", "vec3u", "vec3<bool>", "vec4f", "vec4h", "vec4i", "vec4u", "vec4<bool>", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptr", "atomic", "decorated", "abstractInt", "abstractFloat", "void"];
|
1086
1095
|
type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
|
@@ -1140,7 +1149,7 @@ declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T):
|
|
1140
1149
|
declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
|
1141
1150
|
|
1142
1151
|
interface TgpuConst<TDataType extends AnyWgslData = AnyWgslData> extends TgpuNamable {
|
1143
|
-
readonly value:
|
1152
|
+
readonly value: InferGPU<TDataType>;
|
1144
1153
|
readonly [$internal]: {
|
1145
1154
|
readonly dataType: TDataType;
|
1146
1155
|
};
|
@@ -1148,7 +1157,7 @@ interface TgpuConst<TDataType extends AnyWgslData = AnyWgslData> extends TgpuNam
|
|
1148
1157
|
/**
|
1149
1158
|
* Creates a module constant with specified value.
|
1150
1159
|
*/
|
1151
|
-
declare function constant<TDataType extends AnyWgslData>(dataType: TDataType, value:
|
1160
|
+
declare function constant<TDataType extends AnyWgslData>(dataType: TDataType, value: InferGPU<TDataType>): TgpuConst<TDataType>;
|
1152
1161
|
|
1153
1162
|
/**
|
1154
1163
|
* Extra declaration that shall be included in final WGSL code,
|
@@ -1212,6 +1221,8 @@ declare const builtin: {
|
|
1212
1221
|
};
|
1213
1222
|
type AnyBuiltin = (typeof builtin)[keyof typeof builtin];
|
1214
1223
|
type AnyComputeBuiltin = BuiltinLocalInvocationId | BuiltinLocalInvocationIndex | BuiltinGlobalInvocationId | BuiltinWorkgroupId | BuiltinNumWorkgroups | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
1224
|
+
type AnyVertexInputBuiltin = BuiltinVertexIndex | BuiltinInstanceIndex;
|
1225
|
+
type AnyVertexOutputBuiltin = BuiltinClipDistances | BuiltinPosition;
|
1215
1226
|
type AnyFragmentInputBuiltin = BuiltinPosition | BuiltinFrontFacing | BuiltinSampleIndex | BuiltinSampleMask | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
1216
1227
|
type AnyFragmentOutputBuiltin = BuiltinFragDepth | BuiltinSampleMask;
|
1217
1228
|
type OmitBuiltins<S> = S extends AnyBuiltin ? never : S extends BaseData ? S : {
|
@@ -1258,7 +1269,7 @@ declare class StrictNameRegistry implements NameRegistry {
|
|
1258
1269
|
/**
|
1259
1270
|
* Describes a function signature (its arguments and return type)
|
1260
1271
|
*/
|
1261
|
-
type TgpuFnShellHeader<Args extends
|
1272
|
+
type TgpuFnShellHeader<Args extends AnyData[], Return extends AnyData> = {
|
1262
1273
|
readonly [$internal]: true;
|
1263
1274
|
readonly argTypes: Args;
|
1264
1275
|
readonly returnType: Return | undefined;
|
@@ -1269,13 +1280,13 @@ type TgpuFnShellHeader<Args extends AnyWgslData[] | Record<string, AnyWgslData>,
|
|
1269
1280
|
* Allows creating tgpu functions by calling this shell
|
1270
1281
|
* and passing the implementation (as WGSL string or JS function) as the argument.
|
1271
1282
|
*/
|
1272
|
-
type TgpuFnShell<Args extends
|
1283
|
+
type TgpuFnShell<Args extends AnyData[], Return extends AnyData> = TgpuFnShellHeader<Args, Return> & ((implementation: (...args: InferArgs<Args>) => InferReturn<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuFn<Args, Return>) & {
|
1273
1284
|
/**
|
1274
1285
|
* @deprecated Invoke the shell as a function instead.
|
1275
1286
|
*/
|
1276
|
-
does: ((implementation: (...args:
|
1287
|
+
does: ((implementation: (...args: InferArgs<Args>) => InferReturn<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>);
|
1277
1288
|
};
|
1278
|
-
interface TgpuFnBase<Args extends
|
1289
|
+
interface TgpuFnBase<Args extends AnyData[], Return extends AnyData> extends TgpuNamable {
|
1279
1290
|
readonly [$internal]: {
|
1280
1291
|
implementation: Implementation<Args, Return>;
|
1281
1292
|
argTypes: FnArgsConversionHint;
|
@@ -1285,28 +1296,30 @@ interface TgpuFnBase<Args extends AnyWgslData[] | Record<string, AnyWgslData>, R
|
|
1285
1296
|
readonly '~providing'?: Providing | undefined;
|
1286
1297
|
$uses(dependencyMap: Record<string, unknown>): this;
|
1287
1298
|
with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TgpuFn<Args, Return>;
|
1288
|
-
with<T extends
|
1299
|
+
with<T extends AnyData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): TgpuFn<Args, Return>;
|
1289
1300
|
}
|
1290
|
-
type TgpuFn<Args extends
|
1291
|
-
declare function fn<Args extends
|
1292
|
-
declare function fn<Args extends
|
1293
|
-
declare function isTgpuFn<Args extends
|
1301
|
+
type TgpuFn<Args extends AnyData[] = AnyData[], Return extends AnyData = AnyData> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) => InferReturn<Return>);
|
1302
|
+
declare function fn<Args extends AnyData[] | []>(argTypes: Args, returnType?: undefined): TgpuFnShell<Args, Void>;
|
1303
|
+
declare function fn<Args extends AnyData[] | [], Return extends AnyData>(argTypes: Args, returnType: Return): TgpuFnShell<Args, Return>;
|
1304
|
+
declare function isTgpuFn<Args extends AnyData[], Return extends AnyData>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
|
1294
1305
|
|
1295
1306
|
interface TgpuSlot<T> extends TgpuNamable {
|
1296
1307
|
readonly resourceType: 'slot';
|
1297
|
-
[$repr]: Infer<T>;
|
1308
|
+
readonly [$repr]: Infer<T>;
|
1309
|
+
readonly '~gpuRepr': InferGPU<T>;
|
1298
1310
|
readonly defaultValue: T | undefined;
|
1299
1311
|
/**
|
1300
1312
|
* Used to determine if code generated using either value `a` or `b` in place
|
1301
1313
|
* of the slot will be equivalent. Defaults to `Object.is`.
|
1302
1314
|
*/
|
1303
1315
|
areEqual(a: T, b: T): boolean;
|
1304
|
-
readonly value:
|
1316
|
+
readonly value: InferGPU<T>;
|
1305
1317
|
}
|
1306
1318
|
interface TgpuDerived<T> {
|
1307
1319
|
readonly resourceType: 'derived';
|
1308
|
-
readonly value:
|
1320
|
+
readonly value: InferGPU<T>;
|
1309
1321
|
[$repr]: Infer<T>;
|
1322
|
+
'~gpuRepr': InferGPU<T>;
|
1310
1323
|
readonly '~providing'?: Providing | undefined;
|
1311
1324
|
with<TValue>(slot: TgpuSlot<TValue>, value: Eventual<TValue>): TgpuDerived<T>;
|
1312
1325
|
/**
|
@@ -1314,13 +1327,14 @@ interface TgpuDerived<T> {
|
|
1314
1327
|
*/
|
1315
1328
|
'~compute'(): T;
|
1316
1329
|
}
|
1317
|
-
interface TgpuAccessor<T extends
|
1330
|
+
interface TgpuAccessor<T extends AnyData = AnyData> extends TgpuNamable {
|
1318
1331
|
readonly resourceType: 'accessor';
|
1319
|
-
[$repr]: Infer<T>;
|
1332
|
+
readonly [$repr]: Infer<T>;
|
1333
|
+
readonly '~gpuRepr': InferGPU<T>;
|
1320
1334
|
readonly schema: T;
|
1321
1335
|
readonly defaultValue: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T> | undefined;
|
1322
1336
|
readonly slot: TgpuSlot<TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>>;
|
1323
|
-
readonly value:
|
1337
|
+
readonly value: InferGPU<T>;
|
1324
1338
|
}
|
1325
1339
|
/**
|
1326
1340
|
* Represents a value that is available at resolution time.
|
@@ -1413,21 +1427,21 @@ type KindToAcceptedAttribMap = {
|
|
1413
1427
|
};
|
1414
1428
|
|
1415
1429
|
type WithLocations<T extends IORecord> = {
|
1416
|
-
[Key in keyof T]: IsBuiltin<T[Key]> extends true ? T[Key] : HasCustomLocation<T[Key]> extends true ? T[Key] : Decorate<T[Key], Location
|
1430
|
+
[Key in keyof T]: IsBuiltin<T[Key]> extends true ? T[Key] : HasCustomLocation<T[Key]> extends true ? T[Key] : Decorate<T[Key], Location>;
|
1417
1431
|
};
|
1418
1432
|
type IOLayoutToSchema<T extends IOLayout> = T extends BaseData ? Decorate<T, Location<0>> : T extends IORecord ? WgslStruct<WithLocations<T>> : T extends {
|
1419
1433
|
type: 'void';
|
1420
1434
|
} ? void : never;
|
1421
1435
|
|
1422
|
-
type
|
1423
|
-
type
|
1436
|
+
type FragmentInConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Location | Interpolate)[]> | AnyFragmentInputBuiltin>;
|
1437
|
+
type FragmentOutConstrained = IOLayout<Vec4f | Decorated<Vec4f, (Location | Interpolate)[]> | AnyFragmentOutputBuiltin>;
|
1424
1438
|
/**
|
1425
1439
|
* Describes a fragment entry function signature (its arguments, return type and targets)
|
1426
1440
|
*/
|
1427
1441
|
type TgpuFragmentFnShellHeader<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained> = {
|
1428
|
-
readonly argTypes: [
|
1442
|
+
readonly argTypes: [IOLayoutToSchema<FragmentIn>] | [];
|
1429
1443
|
readonly targets: FragmentOut;
|
1430
|
-
readonly returnType: FragmentOut
|
1444
|
+
readonly returnType: IOLayoutToSchema<FragmentOut>;
|
1431
1445
|
readonly isEntry: true;
|
1432
1446
|
};
|
1433
1447
|
/**
|
@@ -1466,12 +1480,14 @@ declare function fragmentFn<FragmentIn extends FragmentInConstrained, FragmentOu
|
|
1466
1480
|
out: FragmentOut;
|
1467
1481
|
}): TgpuFragmentFnShell<FragmentIn, FragmentOut>;
|
1468
1482
|
|
1483
|
+
type VertexInConstrained = IORecord<BaseIOData | AnyVertexInputBuiltin>;
|
1484
|
+
type VertexOutConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Location | Interpolate)[]> | AnyVertexOutputBuiltin>;
|
1469
1485
|
/**
|
1470
1486
|
* Describes a vertex entry function signature (its arguments, return type and attributes)
|
1471
1487
|
*/
|
1472
|
-
type TgpuVertexFnShellHeader<VertexIn extends
|
1473
|
-
readonly argTypes: [
|
1474
|
-
readonly returnType: VertexOut;
|
1488
|
+
type TgpuVertexFnShellHeader<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained> = {
|
1489
|
+
readonly argTypes: [IOLayoutToSchema<VertexIn>] | [];
|
1490
|
+
readonly returnType: IOLayoutToSchema<VertexOut> | undefined;
|
1475
1491
|
readonly attributes: [VertexIn];
|
1476
1492
|
readonly isEntry: true;
|
1477
1493
|
};
|
@@ -1480,22 +1496,22 @@ type TgpuVertexFnShellHeader<VertexIn extends IOLayout, VertexOut extends IOLayo
|
|
1480
1496
|
* Allows creating tgpu vertex functions by calling this shell
|
1481
1497
|
* and passing the implementation (as WGSL string or JS function) as the argument.
|
1482
1498
|
*/
|
1483
|
-
type TgpuVertexFnShell<VertexIn extends
|
1499
|
+
type TgpuVertexFnShell<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained> = TgpuVertexFnShellHeader<VertexIn, VertexOut> & ((implementation: (input: InferIO<VertexIn>) => InferIO<VertexOut>) => TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>) & ((implementation: string) => TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>) & {
|
1484
1500
|
/**
|
1485
1501
|
* @deprecated Invoke the shell as a function instead.
|
1486
1502
|
*/
|
1487
1503
|
does: ((implementation: (input: InferIO<VertexIn>) => InferIO<VertexOut>) => TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>) & ((implementation: string) => TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>);
|
1488
1504
|
};
|
1489
|
-
interface TgpuVertexFn<VertexIn extends
|
1505
|
+
interface TgpuVertexFn<VertexIn extends VertexInConstrained = any, VertexOut extends VertexOutConstrained = any> extends TgpuNamable {
|
1490
1506
|
readonly shell: TgpuVertexFnShellHeader<VertexIn, VertexOut>;
|
1491
1507
|
readonly outputType: IOLayoutToSchema<VertexOut>;
|
1492
1508
|
readonly inputType: IOLayoutToSchema<VertexIn>;
|
1493
1509
|
$uses(dependencyMap: Record<string, unknown>): this;
|
1494
1510
|
}
|
1495
|
-
declare function vertexFn<VertexOut extends
|
1511
|
+
declare function vertexFn<VertexOut extends VertexOutConstrained>(options: {
|
1496
1512
|
out: VertexOut;
|
1497
1513
|
}): TgpuVertexFnShell<{}, VertexOut>;
|
1498
|
-
declare function vertexFn<VertexIn extends
|
1514
|
+
declare function vertexFn<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained>(options: {
|
1499
1515
|
in: VertexIn;
|
1500
1516
|
out: VertexOut;
|
1501
1517
|
}): TgpuVertexFnShell<VertexIn, VertexOut>;
|
@@ -2096,8 +2112,8 @@ interface WithFragment<Output extends FragmentOutConstrained = FragmentOutConstr
|
|
2096
2112
|
interface WithBinding {
|
2097
2113
|
with<T>(slot: TgpuSlot<T>, value: Eventual<T>): WithBinding;
|
2098
2114
|
with<T extends AnyWgslData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): WithBinding;
|
2099
|
-
withCompute(entryFn: TgpuComputeFn): WithCompute;
|
2100
|
-
withVertex<VertexIn extends
|
2115
|
+
withCompute<ComputeIn extends IORecord<AnyComputeBuiltin>>(entryFn: TgpuComputeFn<ComputeIn>): WithCompute;
|
2116
|
+
withVertex<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained>(entryFn: TgpuVertexFn<VertexIn, VertexOut>, attribs: LayoutToAllowedAttribs<OmitBuiltins<VertexIn>>): WithVertex<VertexOut>;
|
2101
2117
|
}
|
2102
2118
|
type CreateTextureOptions<TSize, TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormat extends GPUTextureFormat, TDimension extends GPUTextureDimension> = {
|
2103
2119
|
/**
|
@@ -2528,9 +2544,11 @@ interface TgpuExternalTexture {
|
|
2528
2544
|
}
|
2529
2545
|
|
2530
2546
|
type VariableScope = 'private' | 'workgroup';
|
2531
|
-
interface TgpuVar<TScope extends VariableScope = VariableScope, TDataType extends
|
2547
|
+
interface TgpuVar<TScope extends VariableScope = VariableScope, TDataType extends AnyData = AnyData> extends TgpuNamable {
|
2532
2548
|
value: Infer<TDataType>;
|
2533
|
-
readonly
|
2549
|
+
readonly [$internal]: {
|
2550
|
+
readonly scope: TScope;
|
2551
|
+
};
|
2534
2552
|
}
|
2535
2553
|
/**
|
2536
2554
|
* Defines a variable scoped to each entry function (private).
|
@@ -2538,29 +2556,22 @@ interface TgpuVar<TScope extends VariableScope = VariableScope, TDataType extend
|
|
2538
2556
|
* @param dataType The schema of the held data's type
|
2539
2557
|
* @param initialValue If not provided, the variable will be initialized to the dataType's "zero-value".
|
2540
2558
|
*/
|
2541
|
-
declare function privateVar<TDataType extends
|
2559
|
+
declare function privateVar<TDataType extends AnyData>(dataType: TDataType, initialValue?: Infer<TDataType>): TgpuVar<'private', TDataType>;
|
2542
2560
|
/**
|
2543
2561
|
* Defines a variable scoped to the whole workgroup, shared between entry functions
|
2544
2562
|
* of the same invocation.
|
2545
2563
|
*
|
2546
2564
|
* @param dataType The schema of the held data's type
|
2547
2565
|
*/
|
2548
|
-
declare function workgroupVar<TDataType extends
|
2566
|
+
declare function workgroupVar<TDataType extends AnyData>(dataType: TDataType): TgpuVar<'workgroup', TDataType>;
|
2549
2567
|
|
2550
2568
|
type ResolvableObject = SelfResolvable | TgpuBufferUsage | TgpuConst | TgpuDeclare | TgpuFn | TgpuComputeFn | TgpuFragmentFn | TgpuComputePipeline | TgpuRenderPipeline | TgpuVertexFn | TgpuSampler | TgpuAccessor | TgpuExternalTexture | TgpuTexture | TgpuAnyTextureView | TgpuVar | AnyVecInstance | AnyMatInstance | AnyData | TgpuFn<any, any>;
|
2551
2569
|
type Wgsl = Eventual<string | number | boolean | ResolvableObject>;
|
2552
|
-
declare const UnknownData: {
|
2553
|
-
type: "unknown";
|
2554
|
-
};
|
2555
|
-
type UnknownData = typeof UnknownData;
|
2556
|
-
type Snippet = {
|
2557
|
-
value: unknown;
|
2558
|
-
dataType: AnyData | UnknownData;
|
2559
|
-
};
|
2560
2570
|
type TgpuShaderStage = 'compute' | 'vertex' | 'fragment';
|
2561
2571
|
interface FnToWgslOptions {
|
2562
2572
|
args: Snippet[];
|
2563
|
-
|
2573
|
+
argAliases: Record<string, Snippet>;
|
2574
|
+
returnType: AnyData;
|
2564
2575
|
body: Block;
|
2565
2576
|
externalMap: Record<string, unknown>;
|
2566
2577
|
}
|
@@ -2575,7 +2586,7 @@ interface ItemStateStack {
|
|
2575
2586
|
popItem(): void;
|
2576
2587
|
pushSlotBindings(pairs: SlotValuePair<unknown>[]): void;
|
2577
2588
|
popSlotBindings(): void;
|
2578
|
-
pushFunctionScope(args: Snippet[],
|
2589
|
+
pushFunctionScope(args: Snippet[], argAliases: Record<string, Snippet>, returnType: AnyData, externalMap: Record<string, unknown>): void;
|
2579
2590
|
popFunctionScope(): void;
|
2580
2591
|
pushBlockScope(): void;
|
2581
2592
|
popBlockScope(): void;
|
@@ -2612,9 +2623,9 @@ interface ResolutionCtx {
|
|
2612
2623
|
*/
|
2613
2624
|
unwrap<T>(eventual: Eventual<T>): T;
|
2614
2625
|
resolve(item: unknown): string;
|
2615
|
-
resolveValue<T extends BaseData>(value: Infer<T>, schema: T): string;
|
2626
|
+
resolveValue<T extends BaseData>(value: Infer<T> | InferGPU<T>, schema: T): string;
|
2616
2627
|
transpileFn(fn: string): {
|
2617
|
-
|
2628
|
+
params: FuncParameter[];
|
2618
2629
|
body: Block;
|
2619
2630
|
externalNames: string[];
|
2620
2631
|
};
|
@@ -2637,7 +2648,7 @@ interface SelfResolvable {
|
|
2637
2648
|
}
|
2638
2649
|
type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';
|
2639
2650
|
type DefaultConversionStrategy = 'keep' | 'coerce';
|
2640
|
-
type FnArgsConversionHint =
|
2651
|
+
type FnArgsConversionHint = AnyData[] | ((...args: Snippet[]) => AnyWgslData[]) | DefaultConversionStrategy | undefined;
|
2641
2652
|
|
2642
2653
|
type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
|
2643
2654
|
interface TgpuVertexFormatData<T extends VertexFormat> {
|
@@ -2773,7 +2784,7 @@ type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
|
|
2773
2784
|
declare const unorm8x4_bgra: unorm8x4_bgra;
|
2774
2785
|
type PackedData = uint8 | uint8x2 | uint8x4 | sint8 | sint8x2 | sint8x4 | unorm8 | unorm8x2 | unorm8x4 | snorm8 | snorm8x2 | snorm8x4 | uint16 | uint16x2 | uint16x4 | sint16 | sint16x2 | sint16x4 | unorm16 | unorm16x2 | unorm16x4 | snorm16 | snorm16x2 | snorm16x4 | float16 | float16x2 | float16x4 | float32 | float32x2 | float32x3 | float32x4 | uint32 | uint32x2 | uint32x3 | uint32x4 | sint32 | sint32x2 | sint32x3 | sint32x4 | unorm10_10_10_2 | unorm8x4_bgra;
|
2775
2786
|
|
2776
|
-
type TgpuDualFn<TImpl extends (...args:
|
2787
|
+
type TgpuDualFn<TImpl extends (...args: never[]) => unknown> = TImpl & {
|
2777
2788
|
[$internal]: {
|
2778
2789
|
implementation: TImpl | string;
|
2779
2790
|
argTypes: FnArgsConversionHint;
|
@@ -2859,6 +2870,14 @@ declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is
|
|
2859
2870
|
declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
|
2860
2871
|
declare function isData(value: unknown): value is AnyData;
|
2861
2872
|
type AnyData = AnyWgslData | AnyLooseData;
|
2873
|
+
interface UnknownData {
|
2874
|
+
readonly type: 'unknown';
|
2875
|
+
}
|
2876
|
+
declare const UnknownData: UnknownData;
|
2877
|
+
interface Snippet {
|
2878
|
+
readonly value: unknown;
|
2879
|
+
readonly dataType: AnyData | UnknownData;
|
2880
|
+
}
|
2862
2881
|
|
2863
2882
|
declare const builtinNames: readonly ["vertex_index", "instance_index", "position", "clip_distances", "front_facing", "frag_depth", "sample_index", "sample_mask", "fragment", "local_invocation_id", "local_invocation_index", "global_invocation_id", "workgroup_id", "num_workgroups", "subgroup_invocation_id", "subgroup_size"];
|
2864
2883
|
type BuiltinName = (typeof builtinNames)[number];
|
@@ -2885,7 +2904,7 @@ type Undecorate<T> = T extends {
|
|
2885
2904
|
*/
|
2886
2905
|
type Decorate<TData extends BaseData, TAttrib extends AnyAttribute> = TData['type'] extends WgslTypeLiteral ? Decorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : TData['type'] extends LooseTypeLiteral ? LooseDecorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : never;
|
2887
2906
|
type IsBuiltin<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Builtin<BuiltinName> ? true : false;
|
2888
|
-
type HasCustomLocation<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Location
|
2907
|
+
type HasCustomLocation<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Location ? true : false;
|
2889
2908
|
/**
|
2890
2909
|
* Gives the wrapped data-type a custom byte alignment. Useful in order to
|
2891
2910
|
* fulfill uniform alignment requirements.
|
@@ -2968,7 +2987,7 @@ declare function isBuiltin<T extends Decorated<AnyWgslData, AnyAttribute[]> | Lo
|
|
2968
2987
|
* Information extracted from transpiling a JS function.
|
2969
2988
|
*/
|
2970
2989
|
type TranspilationResult = {
|
2971
|
-
|
2990
|
+
params: tinyest.FuncParameter[];
|
2972
2991
|
body: tinyest.Block;
|
2973
2992
|
/**
|
2974
2993
|
* All identifiers found in the function code that are not declared in the
|
@@ -2983,7 +3002,7 @@ type InferReturn<T> = T extends undefined ? void : Infer<T>;
|
|
2983
3002
|
type JsImplementation<Args extends unknown[] | Record<string, unknown> = unknown[] | Record<string, unknown>, Return = unknown> = (...args: Args extends unknown[] ? InferArgs<Args> : Args extends Record<string, never> ? [] : [InferIO<Args>]) => InferReturn<Return>;
|
2984
3003
|
type Implementation<Args extends unknown[] | Record<string, unknown> = unknown[] | Record<string, unknown>, Return = unknown> = string | JsImplementation<Args, Return>;
|
2985
3004
|
type BaseIOData = F32 | F16 | I32 | U32 | Vec2f | Vec3f | Vec4f | Vec2h | Vec3h | Vec4h | Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
|
2986
|
-
type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]
|
3005
|
+
type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]> | BuiltinClipDistances;
|
2987
3006
|
type IORecord<TElementType extends IOData = IOData> = Record<string, TElementType>;
|
2988
3007
|
/**
|
2989
3008
|
* Used for I/O definitions of entry functions.
|
@@ -2998,9 +3017,9 @@ type InferIO<T> = T extends {
|
|
2998
3017
|
/**
|
2999
3018
|
* Describes a compute entry function signature (its arguments, return type and workgroup size)
|
3000
3019
|
*/
|
3001
|
-
type TgpuComputeFnShellHeader<ComputeIn extends
|
3002
|
-
readonly argTypes: [
|
3003
|
-
readonly returnType:
|
3020
|
+
type TgpuComputeFnShellHeader<ComputeIn extends IORecord<AnyComputeBuiltin>> = {
|
3021
|
+
readonly argTypes: [IOLayoutToSchema<ComputeIn>] | [];
|
3022
|
+
readonly returnType: Void;
|
3004
3023
|
readonly workgroupSize: [number, number, number];
|
3005
3024
|
readonly isEntry: true;
|
3006
3025
|
};
|
@@ -3009,9 +3028,11 @@ type TgpuComputeFnShellHeader<ComputeIn extends Record<string, AnyComputeBuiltin
|
|
3009
3028
|
* Allows creating tgpu compute functions by calling this shell
|
3010
3029
|
* and passing the implementation (as WGSL string or JS function) as the argument.
|
3011
3030
|
*/
|
3012
|
-
type TgpuComputeFnShell<ComputeIn extends
|
3031
|
+
type TgpuComputeFnShell<ComputeIn extends IORecord<AnyComputeBuiltin>> = TgpuComputeFnShellHeader<ComputeIn>
|
3032
|
+
/**
|
3013
3033
|
* Creates a type-safe implementation of this signature
|
3014
|
-
*/
|
3034
|
+
*/
|
3035
|
+
& ((implementation: (input: InferIO<ComputeIn>) => undefined) => TgpuComputeFn<ComputeIn>) & /**
|
3015
3036
|
* @param implementation
|
3016
3037
|
* Raw WGSL function implementation with header and body
|
3017
3038
|
* without `fn` keyword and function name
|
@@ -3027,16 +3048,16 @@ type TgpuComputeFnShell<ComputeIn extends Record<string, AnyComputeBuiltin>> = T
|
|
3027
3048
|
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
3028
3049
|
*/ ((implementation: string) => TgpuComputeFn<ComputeIn>);
|
3029
3050
|
};
|
3030
|
-
interface TgpuComputeFn<ComputeIn extends
|
3031
|
-
readonly shell:
|
3051
|
+
interface TgpuComputeFn<ComputeIn extends IORecord<AnyComputeBuiltin> = any> extends TgpuNamable {
|
3052
|
+
readonly shell: TgpuComputeFnShellHeader<ComputeIn>;
|
3032
3053
|
$uses(dependencyMap: Record<string, unknown>): this;
|
3033
3054
|
}
|
3034
3055
|
declare function computeFn(options: {
|
3035
3056
|
workgroupSize: number[];
|
3036
3057
|
}): TgpuComputeFnShell<{}>;
|
3037
|
-
declare function computeFn<ComputeIn extends
|
3058
|
+
declare function computeFn<ComputeIn extends IORecord<AnyComputeBuiltin>>(options: {
|
3038
3059
|
in: ComputeIn;
|
3039
3060
|
workgroupSize: number[];
|
3040
3061
|
}): TgpuComputeFnShell<ComputeIn>;
|
3041
3062
|
|
3042
|
-
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type
|
3063
|
+
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type BuiltinLocalInvocationId as b$, type BaseData as b0, type Unstruct as b1, type Mat2x2f as b2, type Mat3x3f as b3, type Mat4x4f as b4, type m2x2f as b5, type m3x3f as b6, type m4x4f as b7, type Atomic as b8, isAlignAttrib as b9, type v3u as bA, type v4b as bB, type v4f as bC, type v4i as bD, type v4u as bE, type AnyLooseData as bF, type LooseDecorated as bG, align as bH, type AnyAttribute as bI, type HasCustomLocation as bJ, interpolate as bK, type IsBuiltin as bL, isBuiltin as bM, location as bN, size as bO, isData as bP, isDisarray as bQ, isLooseData as bR, isLooseDecorated as bS, isUnstruct as bT, builtin as bU, type AnyBuiltin as bV, type BuiltinClipDistances as bW, type BuiltinFragDepth as bX, type BuiltinFrontFacing as bY, type BuiltinGlobalInvocationId as bZ, type BuiltinInstanceIndex as b_, isAtomic as ba, isBuiltinAttrib as bb, isDecorated as bc, isInterpolateAttrib as bd, isLocationAttrib as be, isPtr as bf, isSizeAttrib as bg, isWgslArray as bh, isWgslData as bi, isWgslStruct as bj, Void as bk, type Align as bl, type AnyVecInstance as bm, type AnyWgslStruct as bn, type Builtin as bo, type Decorated as bp, type Interpolate as bq, type Location as br, type Size as bs, type v2b as bt, type v2f as bu, type v2i as bv, type v2u as bw, type v3b as bx, type v3f as by, type v3i as bz, type TgpuAccessor as c, type v4h as c$, type BuiltinLocalInvocationIndex as c0, type BuiltinNumWorkgroups as c1, type BuiltinPosition as c2, type BuiltinSampleIndex as c3, type BuiltinSampleMask as c4, type BuiltinVertexIndex as c5, type BuiltinWorkgroupId as c6, type InferGPU as c7, type InferPartial as c8, type FormatToWGSLType as c9, snorm16x4 as cA, float16 as cB, float16x2 as cC, float16x4 as cD, float32 as cE, float32x2 as cF, float32x3 as cG, float32x4 as cH, uint32 as cI, uint32x2 as cJ, uint32x3 as cK, uint32x4 as cL, sint32 as cM, sint32x2 as cN, sint32x3 as cO, sint32x4 as cP, unorm10_10_10_2 as cQ, unorm8x4_bgra as cR, type PackedData as cS, type TgpuDualFn as cT, type AnyNumericVecInstance as cU, type AnyMatInstance as cV, type vBaseForMat as cW, type mBaseForVec as cX, type AnyFloatVecInstance as cY, type v3h as cZ, type v2h as c_, type TgpuVertexFormatData as ca, formatToWGSLType as cb, packedFormats as cc, uint8 as cd, uint8x2 as ce, uint8x4 as cf, sint8 as cg, sint8x2 as ch, sint8x4 as ci, unorm8 as cj, unorm8x2 as ck, unorm8x4 as cl, snorm8 as cm, snorm8x2 as cn, snorm8x4 as co, uint16 as cp, uint16x2 as cq, uint16x4 as cr, sint16 as cs, sint16x2 as ct, sint16x4 as cu, unorm16 as cv, unorm16x2 as cw, unorm16x4 as cx, snorm16 as cy, snorm16x2 as cz, type TgpuDerived as d, type AnyVec2Instance as d0, type AnyVec3Instance as d1, type AnyBooleanVecInstance as d2, type atomicI32 as d3, type atomicU32 as d4, type TgpuStorageTexture as d5, type TexelData as d6, type ChannelData as d7, type TgpuSlot as e, type TgpuBindGroupLayout as f, type TgpuVertexLayout as g, type WgslArray as h, type TgpuBuffer as i, type AnyData as j, bindGroupLayout as k, fn as l, fragmentFn as m, vertexFn as n, computeFn as o, privateVar as p, constant as q, declare as r, sampler as s, comparisonSampler as t, isBuffer as u, vertexLayout as v, workgroupVar as w, isUsableAsVertex as x, isDerived as y, isSlot as z };
|
package/chunk-5RYM4COI.js
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
var r=Symbol("internal"),O=Symbol("get name forward");function ue(e){return!!e?.[O]}function k(e){return ue(e)?k(e[O]):globalThis.__TYPEGPU_META__?.get(e)?.name}function U(e,t){globalThis.__TYPEGPU_META__??=new WeakMap;let n=globalThis.__TYPEGPU_META__;n.set(e,{...n.get(e),name:t})}function Ge(e){return!!e?.$name}var E="Invariant failed";function L(e,t){if(e)return;throw new Error(E)}var te=class e extends Error{constructor(n,i){let s=i.map(h=>`- ${h}`);s.length>20&&(s=[...s.slice(0,11),"...",...s.slice(-10)]);super(`Resolution of the following tree failed:
|
2
|
-
${s.join(`
|
3
|
-
`)}: ${n&&typeof n=="object"&&"message"in n?n.message:n}`);this.cause=n;this.trace=i;Object.setPrototypeOf(this,e.prototype)}appendToTrace(n){let i=[n,...this.trace];return new e(this.cause,i)}},ne=class e extends Error{constructor(n){super(`Missing value for '${n}'`);this.slot=n;Object.setPrototypeOf(this,e.prototype)}},re=class e extends Error{constructor(t){super(`Buffer '${k(t)??"<unnamed>"}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`),Object.setPrototypeOf(this,e.prototype)}},se=class e extends Error{constructor(t,n){super(`The function '${t??"<unnamed>"}' is missing links to the following external values: ${n}.`),Object.setPrototypeOf(this,e.prototype)}},ie=class e extends Error{constructor(t){super(`Missing bind groups for layouts: '${[...t].map(n=>k(n)??"<unnamed>").join(", ")}'. Please provide it using pipeline.with(layout, bindGroup).(...)`),Object.setPrototypeOf(this,e.prototype)}},he=class e extends Error{constructor(t){super(`Missing vertex buffers for layouts: '${[...t].map(n=>k(n)??"<unnamed>").join(", ")}'. Please provide it using pipeline.with(layout, buffer).(...)`),Object.setPrototypeOf(this,e.prototype)}};var x=Symbol("Type token for the inferred (CPU & GPU) representation of a resource");var He={[r]:!0,type:"void",[x]:void 0},ce=["bool","f32","f16","i32","u32","vec2f","vec2h","vec2i","vec2u","vec2<bool>","vec3f","vec3h","vec3i","vec3u","vec3<bool>","vec4f","vec4h","vec4i","vec4u","vec4<bool>","mat2x2f","mat3x3f","mat4x4f","struct","array","ptr","atomic","decorated","abstractInt","abstractFloat","void"];function le(e){return e?.[r]&&e?.type.startsWith("vec2")}function xe(e){return e?.[r]&&e?.type.startsWith("vec3")}function we(e){return e?.[r]&&e?.type.startsWith("vec4")}function ae(e){return le(e)||xe(e)||we(e)}function de(e){return e?.[r]&&e?.type==="mat2x2f"}function me(e){return e?.[r]&&e?.type==="mat3x3f"}function pe(e){return e?.[r]&&e?.type==="mat4x4f"}function qe(e){return de(e)||me(e)||pe(e)}function Je(e){return e?.[r]&&ce.includes(e?.type)}function Qe(e){return e?.[r]&&e?.type==="array"}function Xe(e){return e?.[r]&&e?.type==="struct"}function Ze(e){return e?.[r]&&e?.type==="ptr"}function et(e){return e?.[r]&&e?.type==="atomic"}function tt(e){return e?.[r]&&e?.type==="@align"}function nt(e){return e?.[r]&&e?.type==="@size"}function rt(e){return e?.[r]&&e?.type==="@location"}function st(e){return e?.[r]&&e?.type==="@interpolate"}function it(e){return e?.[r]&&e?.type==="@builtin"}function oe(e){return e?.[r]&&e?.type==="decorated"}function ht(e){return e?.[r]&&e.type==="void"}import R from"typed-binary";var B=null,ze=Symbol("CPU"),Te=Symbol("GPU"),ge={CPU:ze,GPU:Te},D=[];function yt(e,t){L(B===null,"Cannot nest context providers"),B=e;try{return t()}finally{B=null}}function ut(){return B}function ct(e){D.push(e)}function lt(e){let t=D.pop();e!==void 0&&L(t===e,"Unexpected mode")}var ye=()=>D.length>0&&D[D.length-1]===ge.GPU;function*mt(e){let t=0;for(;;)e.has(t)||(yield t),t++}function y(e,t,n){let i=(...s)=>ye()?t(...s):e(...s);return i[r]={implementation:e,argTypes:n},i}var Vt={[r]:!0,type:"abstractInt"},bt={[r]:!0,type:"abstractFloat"},W={[r]:!0,type:"bool"},Ve=y(e=>typeof e=="boolean"?e?1:0:Number.isInteger(e)?((e<0||e>4294967295)&&console.warn(`u32 value ${e} overflowed`),(e&4294967295)>>>0):Math.max(0,Math.min(4294967295,Math.floor(e))),e=>({value:`u32(${e.value})`,dataType:P})),P=Object.assign(Ve,{type:"u32"}),be=y(e=>{if(typeof e=="boolean")return e?1:0;if(Number.isInteger(e))return(e<-2147483648||e>2147483647)&&console.warn(`i32 value ${e} overflowed`),(e|0)&4294967295;let t=e<0?Math.ceil(e):Math.floor(e);return Math.max(-2147483648,Math.min(2147483647,t))},e=>({value:`i32(${e.value})`,dataType:M})),M=Object.assign(be,{type:"i32"}),fe=y(e=>{if(typeof e=="boolean")return e?1:0;let t=new Float32Array(1);return t[0]=e,t[0]},e=>({value:`f32(${e.value})`,dataType:C})),C=Object.assign(fe,{type:"f32"}),ve=y(e=>{if(typeof e=="boolean")return e?1:0;let t=new ArrayBuffer(2);return R.f16.write(new R.BufferWriter(t),e),R.f16.read(new R.BufferReader(t))},e=>({value:`f16(${e.value})`,dataType:N})),N=Object.assign(ve,{type:"f16"});var F=class extends Array{[r]=!0;"~resolve"(){return`${this.kind}(${this.join(", ")})`}toString(){return this["~resolve"]()}get xx(){return new this._Vec2(this[0],this[0])}get xy(){return new this._Vec2(this[0],this[1])}get xz(){return new this._Vec2(this[0],this[2])}get xw(){return new this._Vec2(this[0],this[3])}get yx(){return new this._Vec2(this[1],this[0])}get yy(){return new this._Vec2(this[1],this[1])}get yz(){return new this._Vec2(this[1],this[2])}get yw(){return new this._Vec2(this[1],this[3])}get zx(){return new this._Vec2(this[2],this[0])}get zy(){return new this._Vec2(this[2],this[1])}get zz(){return new this._Vec2(this[2],this[2])}get zw(){return new this._Vec2(this[2],this[3])}get wx(){return new this._Vec2(this[3],this[0])}get wy(){return new this._Vec2(this[3],this[1])}get wz(){return new this._Vec2(this[3],this[2])}get ww(){return new this._Vec2(this[3],this[3])}get xxx(){return new this._Vec3(this[0],this[0],this[0])}get xxy(){return new this._Vec3(this[0],this[0],this[1])}get xxz(){return new this._Vec3(this[0],this[0],this[2])}get xxw(){return new this._Vec3(this[0],this[0],this[3])}get xyx(){return new this._Vec3(this[0],this[1],this[0])}get xyy(){return new this._Vec3(this[0],this[1],this[1])}get xyz(){return new this._Vec3(this[0],this[1],this[2])}get xyw(){return new this._Vec3(this[0],this[1],this[3])}get xzx(){return new this._Vec3(this[0],this[2],this[0])}get xzy(){return new this._Vec3(this[0],this[2],this[1])}get xzz(){return new this._Vec3(this[0],this[2],this[2])}get xzw(){return new this._Vec3(this[0],this[2],this[3])}get xwx(){return new this._Vec3(this[0],this[3],this[0])}get xwy(){return new this._Vec3(this[0],this[3],this[1])}get xwz(){return new this._Vec3(this[0],this[3],this[2])}get xww(){return new this._Vec3(this[0],this[3],this[3])}get yxx(){return new this._Vec3(this[1],this[0],this[0])}get yxy(){return new this._Vec3(this[1],this[0],this[1])}get yxz(){return new this._Vec3(this[1],this[0],this[2])}get yxw(){return new this._Vec3(this[1],this[0],this[3])}get yyx(){return new this._Vec3(this[1],this[1],this[0])}get yyy(){return new this._Vec3(this[1],this[1],this[1])}get yyz(){return new this._Vec3(this[1],this[1],this[2])}get yyw(){return new this._Vec3(this[1],this[1],this[3])}get yzx(){return new this._Vec3(this[1],this[2],this[0])}get yzy(){return new this._Vec3(this[1],this[2],this[1])}get yzz(){return new this._Vec3(this[1],this[2],this[2])}get yzw(){return new this._Vec3(this[1],this[2],this[3])}get ywx(){return new this._Vec3(this[1],this[3],this[0])}get ywy(){return new this._Vec3(this[1],this[3],this[1])}get ywz(){return new this._Vec3(this[1],this[3],this[2])}get yww(){return new this._Vec3(this[1],this[3],this[3])}get zxx(){return new this._Vec3(this[2],this[0],this[0])}get zxy(){return new this._Vec3(this[2],this[0],this[1])}get zxz(){return new this._Vec3(this[2],this[0],this[2])}get zxw(){return new this._Vec3(this[2],this[0],this[3])}get zyx(){return new this._Vec3(this[2],this[1],this[0])}get zyy(){return new this._Vec3(this[2],this[1],this[1])}get zyz(){return new this._Vec3(this[2],this[1],this[2])}get zyw(){return new this._Vec3(this[2],this[1],this[3])}get zzx(){return new this._Vec3(this[2],this[2],this[0])}get zzy(){return new this._Vec3(this[2],this[2],this[1])}get zzz(){return new this._Vec3(this[2],this[2],this[2])}get zzw(){return new this._Vec3(this[2],this[2],this[3])}get zwx(){return new this._Vec3(this[2],this[3],this[0])}get zwy(){return new this._Vec3(this[2],this[3],this[1])}get zwz(){return new this._Vec3(this[2],this[3],this[2])}get zww(){return new this._Vec3(this[2],this[3],this[3])}get wxx(){return new this._Vec3(this[3],this[0],this[0])}get wxy(){return new this._Vec3(this[3],this[0],this[1])}get wxz(){return new this._Vec3(this[3],this[0],this[2])}get wxw(){return new this._Vec3(this[3],this[0],this[3])}get wyx(){return new this._Vec3(this[3],this[1],this[0])}get wyy(){return new this._Vec3(this[3],this[1],this[1])}get wyz(){return new this._Vec3(this[3],this[1],this[2])}get wyw(){return new this._Vec3(this[3],this[1],this[3])}get wzx(){return new this._Vec3(this[3],this[2],this[0])}get wzy(){return new this._Vec3(this[3],this[2],this[1])}get wzz(){return new this._Vec3(this[3],this[2],this[2])}get wzw(){return new this._Vec3(this[3],this[2],this[3])}get wwx(){return new this._Vec3(this[3],this[3],this[0])}get wwy(){return new this._Vec3(this[3],this[3],this[1])}get wwz(){return new this._Vec3(this[3],this[3],this[2])}get www(){return new this._Vec3(this[3],this[3],this[3])}get xxxx(){return new this._Vec4(this[0],this[0],this[0],this[0])}get xxxy(){return new this._Vec4(this[0],this[0],this[0],this[1])}get xxxz(){return new this._Vec4(this[0],this[0],this[0],this[2])}get xxxw(){return new this._Vec4(this[0],this[0],this[0],this[3])}get xxyx(){return new this._Vec4(this[0],this[0],this[1],this[0])}get xxyy(){return new this._Vec4(this[0],this[0],this[1],this[1])}get xxyz(){return new this._Vec4(this[0],this[0],this[1],this[2])}get xxyw(){return new this._Vec4(this[0],this[0],this[1],this[3])}get xxzx(){return new this._Vec4(this[0],this[0],this[2],this[0])}get xxzy(){return new this._Vec4(this[0],this[0],this[2],this[1])}get xxzz(){return new this._Vec4(this[0],this[0],this[2],this[2])}get xxzw(){return new this._Vec4(this[0],this[0],this[2],this[3])}get xxwx(){return new this._Vec4(this[0],this[0],this[3],this[0])}get xxwy(){return new this._Vec4(this[0],this[0],this[3],this[1])}get xxwz(){return new this._Vec4(this[0],this[0],this[3],this[2])}get xxww(){return new this._Vec4(this[0],this[0],this[3],this[3])}get xyxx(){return new this._Vec4(this[0],this[1],this[0],this[0])}get xyxy(){return new this._Vec4(this[0],this[1],this[0],this[1])}get xyxz(){return new this._Vec4(this[0],this[1],this[0],this[2])}get xyxw(){return new this._Vec4(this[0],this[1],this[0],this[3])}get xyyx(){return new this._Vec4(this[0],this[1],this[1],this[0])}get xyyy(){return new this._Vec4(this[0],this[1],this[1],this[1])}get xyyz(){return new this._Vec4(this[0],this[1],this[1],this[2])}get xyyw(){return new this._Vec4(this[0],this[1],this[1],this[3])}get xyzx(){return new this._Vec4(this[0],this[1],this[2],this[0])}get xyzy(){return new this._Vec4(this[0],this[1],this[2],this[1])}get xyzz(){return new this._Vec4(this[0],this[1],this[2],this[2])}get xyzw(){return new this._Vec4(this[0],this[1],this[2],this[3])}get xywx(){return new this._Vec4(this[0],this[1],this[3],this[0])}get xywy(){return new this._Vec4(this[0],this[1],this[3],this[1])}get xywz(){return new this._Vec4(this[0],this[1],this[3],this[2])}get xyww(){return new this._Vec4(this[0],this[1],this[3],this[3])}get xzxx(){return new this._Vec4(this[0],this[2],this[0],this[0])}get xzxy(){return new this._Vec4(this[0],this[2],this[0],this[1])}get xzxz(){return new this._Vec4(this[0],this[2],this[0],this[2])}get xzxw(){return new this._Vec4(this[0],this[2],this[0],this[3])}get xzyx(){return new this._Vec4(this[0],this[2],this[1],this[0])}get xzyy(){return new this._Vec4(this[0],this[2],this[1],this[1])}get xzyz(){return new this._Vec4(this[0],this[2],this[1],this[2])}get xzyw(){return new this._Vec4(this[0],this[2],this[1],this[3])}get xzzx(){return new this._Vec4(this[0],this[2],this[2],this[0])}get xzzy(){return new this._Vec4(this[0],this[2],this[2],this[1])}get xzzz(){return new this._Vec4(this[0],this[2],this[2],this[2])}get xzzw(){return new this._Vec4(this[0],this[2],this[2],this[3])}get xzwx(){return new this._Vec4(this[0],this[2],this[3],this[0])}get xzwy(){return new this._Vec4(this[0],this[2],this[3],this[1])}get xzwz(){return new this._Vec4(this[0],this[2],this[3],this[2])}get xzww(){return new this._Vec4(this[0],this[2],this[3],this[3])}get xwxx(){return new this._Vec4(this[0],this[3],this[0],this[0])}get xwxy(){return new this._Vec4(this[0],this[3],this[0],this[1])}get xwxz(){return new this._Vec4(this[0],this[3],this[0],this[2])}get xwxw(){return new this._Vec4(this[0],this[3],this[0],this[3])}get xwyx(){return new this._Vec4(this[0],this[3],this[1],this[0])}get xwyy(){return new this._Vec4(this[0],this[3],this[1],this[1])}get xwyz(){return new this._Vec4(this[0],this[3],this[1],this[2])}get xwyw(){return new this._Vec4(this[0],this[3],this[1],this[3])}get xwzx(){return new this._Vec4(this[0],this[3],this[2],this[0])}get xwzy(){return new this._Vec4(this[0],this[3],this[2],this[1])}get xwzz(){return new this._Vec4(this[0],this[3],this[2],this[2])}get xwzw(){return new this._Vec4(this[0],this[3],this[2],this[3])}get xwwx(){return new this._Vec4(this[0],this[3],this[3],this[0])}get xwwy(){return new this._Vec4(this[0],this[3],this[3],this[1])}get xwwz(){return new this._Vec4(this[0],this[3],this[3],this[2])}get xwww(){return new this._Vec4(this[0],this[3],this[3],this[3])}get yxxx(){return new this._Vec4(this[1],this[0],this[0],this[0])}get yxxy(){return new this._Vec4(this[1],this[0],this[0],this[1])}get yxxz(){return new this._Vec4(this[1],this[0],this[0],this[2])}get yxxw(){return new this._Vec4(this[1],this[0],this[0],this[3])}get yxyx(){return new this._Vec4(this[1],this[0],this[1],this[0])}get yxyy(){return new this._Vec4(this[1],this[0],this[1],this[1])}get yxyz(){return new this._Vec4(this[1],this[0],this[1],this[2])}get yxyw(){return new this._Vec4(this[1],this[0],this[1],this[3])}get yxzx(){return new this._Vec4(this[1],this[0],this[2],this[0])}get yxzy(){return new this._Vec4(this[1],this[0],this[2],this[1])}get yxzz(){return new this._Vec4(this[1],this[0],this[2],this[2])}get yxzw(){return new this._Vec4(this[1],this[0],this[2],this[3])}get yxwx(){return new this._Vec4(this[1],this[0],this[3],this[0])}get yxwy(){return new this._Vec4(this[1],this[0],this[3],this[1])}get yxwz(){return new this._Vec4(this[1],this[0],this[3],this[2])}get yxww(){return new this._Vec4(this[1],this[0],this[3],this[3])}get yyxx(){return new this._Vec4(this[1],this[1],this[0],this[0])}get yyxy(){return new this._Vec4(this[1],this[1],this[0],this[1])}get yyxz(){return new this._Vec4(this[1],this[1],this[0],this[2])}get yyxw(){return new this._Vec4(this[1],this[1],this[0],this[3])}get yyyx(){return new this._Vec4(this[1],this[1],this[1],this[0])}get yyyy(){return new this._Vec4(this[1],this[1],this[1],this[1])}get yyyz(){return new this._Vec4(this[1],this[1],this[1],this[2])}get yyyw(){return new this._Vec4(this[1],this[1],this[1],this[3])}get yyzx(){return new this._Vec4(this[1],this[1],this[2],this[0])}get yyzy(){return new this._Vec4(this[1],this[1],this[2],this[1])}get yyzz(){return new this._Vec4(this[1],this[1],this[2],this[2])}get yyzw(){return new this._Vec4(this[1],this[1],this[2],this[3])}get yywx(){return new this._Vec4(this[1],this[1],this[3],this[0])}get yywy(){return new this._Vec4(this[1],this[1],this[3],this[1])}get yywz(){return new this._Vec4(this[1],this[1],this[3],this[2])}get yyww(){return new this._Vec4(this[1],this[1],this[3],this[3])}get yzxx(){return new this._Vec4(this[1],this[2],this[0],this[0])}get yzxy(){return new this._Vec4(this[1],this[2],this[0],this[1])}get yzxz(){return new this._Vec4(this[1],this[2],this[0],this[2])}get yzxw(){return new this._Vec4(this[1],this[2],this[0],this[3])}get yzyx(){return new this._Vec4(this[1],this[2],this[1],this[0])}get yzyy(){return new this._Vec4(this[1],this[2],this[1],this[1])}get yzyz(){return new this._Vec4(this[1],this[2],this[1],this[2])}get yzyw(){return new this._Vec4(this[1],this[2],this[1],this[3])}get yzzx(){return new this._Vec4(this[1],this[2],this[2],this[0])}get yzzy(){return new this._Vec4(this[1],this[2],this[2],this[1])}get yzzz(){return new this._Vec4(this[1],this[2],this[2],this[2])}get yzzw(){return new this._Vec4(this[1],this[2],this[2],this[3])}get yzwx(){return new this._Vec4(this[1],this[2],this[3],this[0])}get yzwy(){return new this._Vec4(this[1],this[2],this[3],this[1])}get yzwz(){return new this._Vec4(this[1],this[2],this[3],this[2])}get yzww(){return new this._Vec4(this[1],this[2],this[3],this[3])}get ywxx(){return new this._Vec4(this[1],this[3],this[0],this[0])}get ywxy(){return new this._Vec4(this[1],this[3],this[0],this[1])}get ywxz(){return new this._Vec4(this[1],this[3],this[0],this[2])}get ywxw(){return new this._Vec4(this[1],this[3],this[0],this[3])}get ywyx(){return new this._Vec4(this[1],this[3],this[1],this[0])}get ywyy(){return new this._Vec4(this[1],this[3],this[1],this[1])}get ywyz(){return new this._Vec4(this[1],this[3],this[1],this[2])}get ywyw(){return new this._Vec4(this[1],this[3],this[1],this[3])}get ywzx(){return new this._Vec4(this[1],this[3],this[2],this[0])}get ywzy(){return new this._Vec4(this[1],this[3],this[2],this[1])}get ywzz(){return new this._Vec4(this[1],this[3],this[2],this[2])}get ywzw(){return new this._Vec4(this[1],this[3],this[2],this[3])}get ywwx(){return new this._Vec4(this[1],this[3],this[3],this[0])}get ywwy(){return new this._Vec4(this[1],this[3],this[3],this[1])}get ywwz(){return new this._Vec4(this[1],this[3],this[3],this[2])}get ywww(){return new this._Vec4(this[1],this[3],this[3],this[3])}get zxxx(){return new this._Vec4(this[2],this[0],this[0],this[0])}get zxxy(){return new this._Vec4(this[2],this[0],this[0],this[1])}get zxxz(){return new this._Vec4(this[2],this[0],this[0],this[2])}get zxxw(){return new this._Vec4(this[2],this[0],this[0],this[3])}get zxyx(){return new this._Vec4(this[2],this[0],this[1],this[0])}get zxyy(){return new this._Vec4(this[2],this[0],this[1],this[1])}get zxyz(){return new this._Vec4(this[2],this[0],this[1],this[2])}get zxyw(){return new this._Vec4(this[2],this[0],this[1],this[3])}get zxzx(){return new this._Vec4(this[2],this[0],this[2],this[0])}get zxzy(){return new this._Vec4(this[2],this[0],this[2],this[1])}get zxzz(){return new this._Vec4(this[2],this[0],this[2],this[2])}get zxzw(){return new this._Vec4(this[2],this[0],this[2],this[3])}get zxwx(){return new this._Vec4(this[2],this[0],this[3],this[0])}get zxwy(){return new this._Vec4(this[2],this[0],this[3],this[1])}get zxwz(){return new this._Vec4(this[2],this[0],this[3],this[2])}get zxww(){return new this._Vec4(this[2],this[0],this[3],this[3])}get zyxx(){return new this._Vec4(this[2],this[1],this[0],this[0])}get zyxy(){return new this._Vec4(this[2],this[1],this[0],this[1])}get zyxz(){return new this._Vec4(this[2],this[1],this[0],this[2])}get zyxw(){return new this._Vec4(this[2],this[1],this[0],this[3])}get zyyx(){return new this._Vec4(this[2],this[1],this[1],this[0])}get zyyy(){return new this._Vec4(this[2],this[1],this[1],this[1])}get zyyz(){return new this._Vec4(this[2],this[1],this[1],this[2])}get zyyw(){return new this._Vec4(this[2],this[1],this[1],this[3])}get zyzx(){return new this._Vec4(this[2],this[1],this[2],this[0])}get zyzy(){return new this._Vec4(this[2],this[1],this[2],this[1])}get zyzz(){return new this._Vec4(this[2],this[1],this[2],this[2])}get zyzw(){return new this._Vec4(this[2],this[1],this[2],this[3])}get zywx(){return new this._Vec4(this[2],this[1],this[3],this[0])}get zywy(){return new this._Vec4(this[2],this[1],this[3],this[1])}get zywz(){return new this._Vec4(this[2],this[1],this[3],this[2])}get zyww(){return new this._Vec4(this[2],this[1],this[3],this[3])}get zzxx(){return new this._Vec4(this[2],this[2],this[0],this[0])}get zzxy(){return new this._Vec4(this[2],this[2],this[0],this[1])}get zzxz(){return new this._Vec4(this[2],this[2],this[0],this[2])}get zzxw(){return new this._Vec4(this[2],this[2],this[0],this[3])}get zzyx(){return new this._Vec4(this[2],this[2],this[1],this[0])}get zzyy(){return new this._Vec4(this[2],this[2],this[1],this[1])}get zzyz(){return new this._Vec4(this[2],this[2],this[1],this[2])}get zzyw(){return new this._Vec4(this[2],this[2],this[1],this[3])}get zzzx(){return new this._Vec4(this[2],this[2],this[2],this[0])}get zzzy(){return new this._Vec4(this[2],this[2],this[2],this[1])}get zzzz(){return new this._Vec4(this[2],this[2],this[2],this[2])}get zzzw(){return new this._Vec4(this[2],this[2],this[2],this[3])}get zzwx(){return new this._Vec4(this[2],this[2],this[3],this[0])}get zzwy(){return new this._Vec4(this[2],this[2],this[3],this[1])}get zzwz(){return new this._Vec4(this[2],this[2],this[3],this[2])}get zzww(){return new this._Vec4(this[2],this[2],this[3],this[3])}get zwxx(){return new this._Vec4(this[2],this[3],this[0],this[0])}get zwxy(){return new this._Vec4(this[2],this[3],this[0],this[1])}get zwxz(){return new this._Vec4(this[2],this[3],this[0],this[2])}get zwxw(){return new this._Vec4(this[2],this[3],this[0],this[3])}get zwyx(){return new this._Vec4(this[2],this[3],this[1],this[0])}get zwyy(){return new this._Vec4(this[2],this[3],this[1],this[1])}get zwyz(){return new this._Vec4(this[2],this[3],this[1],this[2])}get zwyw(){return new this._Vec4(this[2],this[3],this[1],this[3])}get zwzx(){return new this._Vec4(this[2],this[3],this[2],this[0])}get zwzy(){return new this._Vec4(this[2],this[3],this[2],this[1])}get zwzz(){return new this._Vec4(this[2],this[3],this[2],this[2])}get zwzw(){return new this._Vec4(this[2],this[3],this[2],this[3])}get zwwx(){return new this._Vec4(this[2],this[3],this[3],this[0])}get zwwy(){return new this._Vec4(this[2],this[3],this[3],this[1])}get zwwz(){return new this._Vec4(this[2],this[3],this[3],this[2])}get zwww(){return new this._Vec4(this[2],this[3],this[3],this[3])}get wxxx(){return new this._Vec4(this[3],this[0],this[0],this[0])}get wxxy(){return new this._Vec4(this[3],this[0],this[0],this[1])}get wxxz(){return new this._Vec4(this[3],this[0],this[0],this[2])}get wxxw(){return new this._Vec4(this[3],this[0],this[0],this[3])}get wxyx(){return new this._Vec4(this[3],this[0],this[1],this[0])}get wxyy(){return new this._Vec4(this[3],this[0],this[1],this[1])}get wxyz(){return new this._Vec4(this[3],this[0],this[1],this[2])}get wxyw(){return new this._Vec4(this[3],this[0],this[1],this[3])}get wxzx(){return new this._Vec4(this[3],this[0],this[2],this[0])}get wxzy(){return new this._Vec4(this[3],this[0],this[2],this[1])}get wxzz(){return new this._Vec4(this[3],this[0],this[2],this[2])}get wxzw(){return new this._Vec4(this[3],this[0],this[2],this[3])}get wxwx(){return new this._Vec4(this[3],this[0],this[3],this[0])}get wxwy(){return new this._Vec4(this[3],this[0],this[3],this[1])}get wxwz(){return new this._Vec4(this[3],this[0],this[3],this[2])}get wxww(){return new this._Vec4(this[3],this[0],this[3],this[3])}get wyxx(){return new this._Vec4(this[3],this[1],this[0],this[0])}get wyxy(){return new this._Vec4(this[3],this[1],this[0],this[1])}get wyxz(){return new this._Vec4(this[3],this[1],this[0],this[2])}get wyxw(){return new this._Vec4(this[3],this[1],this[0],this[3])}get wyyx(){return new this._Vec4(this[3],this[1],this[1],this[0])}get wyyy(){return new this._Vec4(this[3],this[1],this[1],this[1])}get wyyz(){return new this._Vec4(this[3],this[1],this[1],this[2])}get wyyw(){return new this._Vec4(this[3],this[1],this[1],this[3])}get wyzx(){return new this._Vec4(this[3],this[1],this[2],this[0])}get wyzy(){return new this._Vec4(this[3],this[1],this[2],this[1])}get wyzz(){return new this._Vec4(this[3],this[1],this[2],this[2])}get wyzw(){return new this._Vec4(this[3],this[1],this[2],this[3])}get wywx(){return new this._Vec4(this[3],this[1],this[3],this[0])}get wywy(){return new this._Vec4(this[3],this[1],this[3],this[1])}get wywz(){return new this._Vec4(this[3],this[1],this[3],this[2])}get wyww(){return new this._Vec4(this[3],this[1],this[3],this[3])}get wzxx(){return new this._Vec4(this[3],this[2],this[0],this[0])}get wzxy(){return new this._Vec4(this[3],this[2],this[0],this[1])}get wzxz(){return new this._Vec4(this[3],this[2],this[0],this[2])}get wzxw(){return new this._Vec4(this[3],this[2],this[0],this[3])}get wzyx(){return new this._Vec4(this[3],this[2],this[1],this[0])}get wzyy(){return new this._Vec4(this[3],this[2],this[1],this[1])}get wzyz(){return new this._Vec4(this[3],this[2],this[1],this[2])}get wzyw(){return new this._Vec4(this[3],this[2],this[1],this[3])}get wzzx(){return new this._Vec4(this[3],this[2],this[2],this[0])}get wzzy(){return new this._Vec4(this[3],this[2],this[2],this[1])}get wzzz(){return new this._Vec4(this[3],this[2],this[2],this[2])}get wzzw(){return new this._Vec4(this[3],this[2],this[2],this[3])}get wzwx(){return new this._Vec4(this[3],this[2],this[3],this[0])}get wzwy(){return new this._Vec4(this[3],this[2],this[3],this[1])}get wzwz(){return new this._Vec4(this[3],this[2],this[3],this[2])}get wzww(){return new this._Vec4(this[3],this[2],this[3],this[3])}get wwxx(){return new this._Vec4(this[3],this[3],this[0],this[0])}get wwxy(){return new this._Vec4(this[3],this[3],this[0],this[1])}get wwxz(){return new this._Vec4(this[3],this[3],this[0],this[2])}get wwxw(){return new this._Vec4(this[3],this[3],this[0],this[3])}get wwyx(){return new this._Vec4(this[3],this[3],this[1],this[0])}get wwyy(){return new this._Vec4(this[3],this[3],this[1],this[1])}get wwyz(){return new this._Vec4(this[3],this[3],this[1],this[2])}get wwyw(){return new this._Vec4(this[3],this[3],this[1],this[3])}get wwzx(){return new this._Vec4(this[3],this[3],this[2],this[0])}get wwzy(){return new this._Vec4(this[3],this[3],this[2],this[1])}get wwzz(){return new this._Vec4(this[3],this[3],this[2],this[2])}get wwzw(){return new this._Vec4(this[3],this[3],this[2],this[3])}get wwwx(){return new this._Vec4(this[3],this[3],this[3],this[0])}get wwwy(){return new this._Vec4(this[3],this[3],this[3],this[1])}get wwwz(){return new this._Vec4(this[3],this[3],this[3],this[2])}get wwww(){return new this._Vec4(this[3],this[3],this[3],this[3])}},u=class extends F{0;1;constructor(t,n){super(2),this[0]=t??this.getDefaultValue(),this[1]=n??t??this.getDefaultValue()}get x(){return this[0]}get y(){return this[1]}set x(t){this[0]=t}set y(t){this[1]=t}},c=class extends F{0;1;2;constructor(t,n,i){super(3),this[0]=t??this.getDefaultValue(),this[1]=n??t??this.getDefaultValue(),this[2]=i??t??this.getDefaultValue()}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}},l=class extends F{0;1;2;3;constructor(t,n,i,s){super(4),this[0]=t??this.getDefaultValue(),this[1]=n??t??this.getDefaultValue(),this[2]=i??t??this.getDefaultValue(),this[3]=s??t??this.getDefaultValue()}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}set w(t){this[3]=t}},w=class e extends u{getDefaultValue(){return 0}get kind(){return"vec2f"}get _Vec2(){return e}get _Vec3(){return T}get _Vec4(){return v}},d=class e extends u{getDefaultValue(){return 0}get kind(){return"vec2h"}get _Vec2(){return e}get _Vec3(){return g}get _Vec4(){return _}},m=class e extends u{getDefaultValue(){return 0}get kind(){return"vec2i"}get _Vec2(){return e}get _Vec3(){return V}get _Vec4(){return I}},p=class e extends u{getDefaultValue(){return 0}get kind(){return"vec2u"}get _Vec2(){return e}get _Vec3(){return b}get _Vec4(){return A}},z=class e extends u{getDefaultValue(){return!1}get kind(){return"vec2<bool>"}get _Vec2(){return e}get _Vec3(){return f}get _Vec4(){return S}},T=class e extends c{getDefaultValue(){return 0}get kind(){return"vec3f"}get _Vec2(){return w}get _Vec3(){return e}get _Vec4(){return v}},g=class e extends c{getDefaultValue(){return 0}get kind(){return"vec3h"}get _Vec2(){return d}get _Vec3(){return e}get _Vec4(){return _}},V=class e extends c{getDefaultValue(){return 0}get kind(){return"vec3i"}get _Vec2(){return m}get _Vec3(){return e}get _Vec4(){return I}},b=class e extends c{getDefaultValue(){return 0}get kind(){return"vec3u"}get _Vec2(){return p}get _Vec3(){return e}get _Vec4(){return A}},f=class e extends c{getDefaultValue(){return!1}get kind(){return"vec3<bool>"}get _Vec2(){return z}get _Vec3(){return e}get _Vec4(){return S}},v=class e extends l{getDefaultValue(){return 0}get kind(){return"vec4f"}get _Vec2(){return w}get _Vec3(){return T}get _Vec4(){return e}},_=class e extends l{getDefaultValue(){return 0}get kind(){return"vec4h"}get _Vec2(){return d}get _Vec3(){return g}get _Vec4(){return e}},I=class e extends l{getDefaultValue(){return 0}get kind(){return"vec4i"}get _Vec2(){return m}get _Vec3(){return V}get _Vec4(){return e}},A=class e extends l{getDefaultValue(){return 0}get kind(){return"vec4u"}get _Vec2(){return p}get _Vec3(){return b}get _Vec4(){return e}},S=class e extends l{getDefaultValue(){return!1}get kind(){return"vec4<bool>"}get _Vec2(){return z}get _Vec3(){return f}get _Vec4(){return e}};var j=a(w),_e=a(d),Ie=a(m),Ae=a(p),Se=a(z),K=a(T),$e=a(g),ke=a(V),De=a(b),Pe=a(f),Y=a(v),Me=a(_),Ce=a(I),Ne=a(A),Fe=a(S),Ue={vec2f:j,vec2h:_e,vec2i:Ie,vec2u:Ae,"vec2<bool>":Se,vec3f:K,vec3h:$e,vec3i:ke,vec3u:De,"vec3<bool>":Pe,vec4f:Y,vec4h:Me,vec4i:Ce,vec4u:Ne,"vec4<bool>":Fe},Be={vec2f:C,vec2h:N,vec2i:M,vec2u:P,"vec2<bool>":W,vec3f:C,vec3h:N,vec3i:M,vec3u:P,"vec3<bool>":W,vec4f:C,vec4h:N,vec4i:M,vec4u:P,"vec4<bool>":W};function a(e){let{kind:t,length:n}=new e,i=y((...s)=>{let h=new Array(s.length),o=0;for(let $ of s)if(typeof $=="number"||typeof $=="boolean")h[o++]=$;else for(let G=0;G<$.length;++G)h[o++]=$[G];if(h.length<=1||h.length===n)return new e(...h);throw new Error(`'${t}' constructor called with invalid number of arguments.`)},(...s)=>({value:`${t}(${s.map(h=>h.value).join(", ")})`,dataType:Ue[t]}),(...s)=>s.map(h=>{let o=h.dataType;return oe(o)&&(o=o.inner),ae(o)?o:Be[t]}));return U(i,t),Object.assign(i,{type:t,[x]:void 0})}function ee(e){let t={[r]:!0,[x]:void 0,type:e.type};U(t,e.type);let n=y((...i)=>{let s=[];for(let h of i)if(typeof h=="number")s.push(h);else for(let o=0;o<h.length;++o)s.push(h[o]);for(let h=s.length;h<e.columns*e.rows;++h)s.push(0);return e.makeFromElements(...s)},(...i)=>({value:`${t.type}(${i.map(s=>s.value).join(", ")})`,dataType:t}));return Object.assign(n,t)}var H=class{[r]=!0;columns;length=4;constructor(...t){this.columns=[this.makeColumn(t[0],t[1]),this.makeColumn(t[2],t[3])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[1].x}get 3(){return this.columns[1].y}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[1].x=t}set 3(t){this.columns[1].y=t}*[Symbol.iterator](){yield this[0],yield this[1],yield this[2],yield this[3]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}},q=class extends H{kind="mat2x2f";makeColumn(t,n){return j(t,n)}},J=class{[r]=!0;columns;length=12;constructor(...t){this.columns=[this.makeColumn(t[0],t[1],t[2]),this.makeColumn(t[3],t[4],t[5]),this.makeColumn(t[6],t[7],t[8])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return 0}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return 0}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return 0}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){}*[Symbol.iterator](){for(let t=0;t<12;t++)yield this[t]}"~resolve"(){return`${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${this[5]}, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`}},Q=class extends J{kind="mat3x3f";makeColumn(t,n,i){return K(t,n,i)}},X=class{[r]=!0;columns;constructor(...t){this.columns=[this.makeColumn(t[0],t[1],t[2],t[3]),this.makeColumn(t[4],t[5],t[6],t[7]),this.makeColumn(t[8],t[9],t[10],t[11]),this.makeColumn(t[12],t[13],t[14],t[15])]}length=16;get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return this.columns[0].w}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return this.columns[1].w}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return this.columns[2].w}get 12(){return this.columns[3].x}get 13(){return this.columns[3].y}get 14(){return this.columns[3].z}get 15(){return this.columns[3].w}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){this.columns[0].w=t}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){this.columns[1].w=t}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){this.columns[2].w=t}set 12(t){this.columns[3].x=t}set 13(t){this.columns[3].y=t}set 14(t){this.columns[3].z=t}set 15(t){this.columns[3].w=t}*[Symbol.iterator](){for(let t=0;t<16;t++)yield this[t]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}},Z=class extends X{kind="mat4x4f";makeColumn(t,n,i,s){return Y(t,n,i,s)}},Bt=ee({type:"mat2x2f",rows:2,columns:2,makeFromElements:(...e)=>new q(...e)}),Rt=ee({type:"mat3x3f",rows:3,columns:3,makeFromElements:(...e)=>new Q(...e)}),Wt=ee({type:"mat4x4f",rows:4,columns:4,makeFromElements:(...e)=>new Z(...e)});function Gt(e){return e.kind==="mat3x3f"?[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]]:Array.from({length:e.length}).map((t,n)=>e[n])}function Lt(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"function",access:"read-write"}}function jt(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"private",access:"read-write"}}function Kt(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"workgroup",access:"read-write"}}function Yt(e,t="read"){return{[r]:!0,type:"ptr",inner:e,addressSpace:"storage",access:t}}function Ht(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"uniform",access:"read"}}function qt(e){return{[r]:!0,type:"ptr",inner:e,addressSpace:"handle",access:"read"}}export{r as a,O as b,k as c,U as d,Ge as e,L as f,te as g,ne as h,re as i,se as j,ie as k,he as l,ge as m,yt as n,ut as o,ct as p,lt as q,ye as r,x as s,He as t,le as u,xe as v,ae as w,de as x,me as y,qe as z,Je as A,Qe as B,Xe as C,Ze as D,et as E,tt as F,nt as G,rt as H,st as I,it as J,oe as K,ht as L,mt as M,y as N,Vt as O,bt as P,W as Q,P as R,M as S,C as T,N as U,j as V,_e as W,Ie as X,Ae as Y,Se as Z,K as _,$e as $,ke as aa,De as ba,Pe as ca,Y as da,Me as ea,Ce as fa,Ne as ga,Fe as ha,Be as ia,Bt as ja,Rt as ka,Wt as la,Gt as ma,Lt as na,jt as oa,Kt as pa,Yt as qa,Ht as ra,qt as sa};
|
4
|
-
//# sourceMappingURL=chunk-5RYM4COI.js.map
|