typegpu 0.3.0-alpha.3 → 0.3.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -335,6 +335,16 @@ interface v2f extends NumberArrayView, Swizzle2<v2f, v3f, v4f> {
335
335
  x: number;
336
336
  y: number;
337
337
  }
338
+ /**
339
+ * Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.
340
+ * A vector with 2 elements of type f16
341
+ */
342
+ interface v2h extends NumberArrayView, Swizzle2<v2h, v3h, v4h> {
343
+ /** use to distinguish between vectors of the same size on the type level */
344
+ readonly kind: 'vec2h';
345
+ x: number;
346
+ y: number;
347
+ }
338
348
  /**
339
349
  * Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.
340
350
  * A vector with 2 elements of type i32
@@ -366,6 +376,17 @@ interface v3f extends NumberArrayView, Swizzle3<v2f, v3f, v4f> {
366
376
  y: number;
367
377
  z: number;
368
378
  }
379
+ /**
380
+ * Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.
381
+ * A vector with 3 elements of type f16
382
+ */
383
+ interface v3h extends NumberArrayView, Swizzle3<v2h, v3h, v4h> {
384
+ /** use to distinguish between vectors of the same size on the type level */
385
+ readonly kind: 'vec3h';
386
+ x: number;
387
+ y: number;
388
+ z: number;
389
+ }
369
390
  /**
370
391
  * Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.
371
392
  * A vector with 3 elements of type i32
@@ -400,6 +421,18 @@ interface v4f extends NumberArrayView, Swizzle4<v2f, v3f, v4f> {
400
421
  z: number;
401
422
  w: number;
402
423
  }
424
+ /**
425
+ * Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.
426
+ * A vector with 4 elements of type f16
427
+ */
428
+ interface v4h extends NumberArrayView, Swizzle4<v2h, v3h, v4h> {
429
+ /** use to distinguish between vectors of the same size on the type level */
430
+ readonly kind: 'vec4h';
431
+ x: number;
432
+ y: number;
433
+ z: number;
434
+ w: number;
435
+ }
403
436
  /**
404
437
  * Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.
405
438
  * A vector with 4 elements of type i32
@@ -505,6 +538,11 @@ interface Vec2f {
505
538
  /** Type-token, not available at runtime */
506
539
  readonly '~repr': v2f;
507
540
  }
541
+ interface Vec2h {
542
+ readonly type: 'vec2h';
543
+ /** Type-token, not available at runtime */
544
+ readonly '~repr': v2h;
545
+ }
508
546
  interface Vec2i {
509
547
  readonly type: 'vec2i';
510
548
  /** Type-token, not available at runtime */
@@ -520,6 +558,11 @@ interface Vec3f {
520
558
  /** Type-token, not available at runtime */
521
559
  readonly '~repr': v3f;
522
560
  }
561
+ interface Vec3h {
562
+ readonly type: 'vec3h';
563
+ /** Type-token, not available at runtime */
564
+ readonly '~repr': v3h;
565
+ }
523
566
  interface Vec3i {
524
567
  readonly type: 'vec3i';
525
568
  /** Type-token, not available at runtime */
@@ -535,6 +578,11 @@ interface Vec4f {
535
578
  /** Type-token, not available at runtime */
536
579
  readonly '~repr': v4f;
537
580
  }
581
+ interface Vec4h {
582
+ readonly type: 'vec4h';
583
+ /** Type-token, not available at runtime */
584
+ readonly '~repr': v4h;
585
+ }
538
586
  interface Vec4i {
539
587
  readonly type: 'vec4i';
540
588
  /** Type-token, not available at runtime */
@@ -606,9 +654,9 @@ interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends
606
654
  /** Type-token, not available at runtime */
607
655
  readonly '~repr': Infer<TInner>;
608
656
  }
609
- declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "vec2f", "vec2i", "vec2u", "vec3f", "vec3i", "vec3u", "vec4f", "vec4i", "vec4u", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "atomic", "decorated"];
657
+ declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f", "vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i", "vec4u", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "atomic", "decorated"];
610
658
  type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
611
- type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2i | Vec2u | Vec3f | Vec3i | Vec3u | Vec4f | Vec4i | Vec4u | Mat2x2f | Mat3x3f | Mat4x4f | WgslStruct | WgslArray | Atomic | Decorated;
659
+ type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2h | Vec2i | Vec2u | Vec3f | Vec3h | Vec3i | Vec3u | Vec4f | Vec4h | Vec4i | Vec4u | Mat2x2f | Mat3x3f | Mat4x4f | WgslStruct | WgslArray | Atomic | Decorated;
612
660
  declare function isWgslData(value: unknown): value is AnyWgslData;
613
661
  /**
614
662
  * Checks whether passed in value is an array schema,
@@ -650,81 +698,6 @@ declare function isLocationAttrib<T extends Location<number>>(value: unknown | T
650
698
  declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
651
699
  declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
652
700
 
653
- /**
654
- * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
655
- */
656
- declare const bool: Bool;
657
- /**
658
- * Unsigned 32-bit integer schema representing a single WGSL u32 value.
659
- */
660
- type NativeU32 = U32 & {
661
- '~exotic': U32;
662
- } & ((v: number | boolean) => number);
663
- /**
664
- * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
665
- *
666
- * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
667
- *
668
- * @example
669
- * const value = u32(3.14); // 3
670
- * @example
671
- * const value = u32(-1); // 4294967295
672
- * @example
673
- * const value = u32(-3.1); // 0
674
- */
675
- declare const u32: NativeU32;
676
- /**
677
- * Signed 32-bit integer schema representing a single WGSL i32 value.
678
- */
679
- type NativeI32 = I32 & {
680
- '~exotic': I32;
681
- } & ((v: number | boolean) => number);
682
- /**
683
- * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
684
- *
685
- * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
686
- *
687
- * @example
688
- * const value = i32(3.14); // 3
689
- * @example
690
- * const value = i32(-3.9); // -3
691
- * @example
692
- * const value = i32(10000000000) // 1410065408
693
- */
694
- declare const i32: NativeI32;
695
- /**
696
- * 32-bit float schema representing a single WGSL f32 value.
697
- */
698
- type NativeF32 = F32 & {
699
- '~exotic': F32;
700
- } & ((v: number | boolean) => number);
701
- /**
702
- * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
703
- *
704
- * Can also be called to cast a value to an f32.
705
- *
706
- * @example
707
- * const value = f32(true); // 1
708
- */
709
- declare const f32: NativeF32;
710
- /**
711
- * 16-bit float schema representing a single WGSL f16 value.
712
- */
713
- type NativeF16 = F16 & {
714
- '~exotic': F16;
715
- } & ((v: number | boolean) => number);
716
- /**
717
- * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
718
- *
719
- * Can also be called to cast a value to an f16.
720
- *
721
- * @example
722
- * const value = f16(true); // 1
723
- * @example
724
- * const value = f16(21877.5); // 21872
725
- */
726
- declare const f16: NativeF16;
727
-
728
701
  /**
729
702
  * Type of the `d.vec2f` object/function: vector data type schema/constructor
730
703
  */
@@ -745,6 +718,26 @@ type NativeVec2f = Vec2f & {
745
718
  * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
746
719
  */
747
720
  declare const vec2f: NativeVec2f;
721
+ /**
722
+ * Type of the `d.vec2h` object/function: vector data type schema/constructor
723
+ */
724
+ type NativeVec2h = Vec2h & {
725
+ '~exotic': Vec2h;
726
+ } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
727
+ /**
728
+ *
729
+ * Schema representing vec2h - a vector with 2 elements of type f16.
730
+ * Also a constructor function for this vector value.
731
+ *
732
+ * @example
733
+ * const vector = d.vec2h(); // (0.0, 0.0)
734
+ * const vector = d.vec2h(1); // (1.0, 1.0)
735
+ * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
736
+ *
737
+ * @example
738
+ * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
739
+ */
740
+ declare const vec2h: NativeVec2h;
748
741
  /**
749
742
  * Type of the `d.vec2i` object/function: vector data type schema/constructor
750
743
  */
@@ -805,6 +798,26 @@ type NativeVec3f = Vec3f & {
805
798
  * const buffer = root.createBuffer(d.vec3f, d.vec3f(0, 1, 2)); // buffer holding a d.vec3f value, with an initial value of vec3f(0, 1, 2);
806
799
  */
807
800
  declare const vec3f: NativeVec3f;
801
+ /**
802
+ * Type of the `d.vec3h` object/function: vector data type schema/constructor
803
+ */
804
+ type NativeVec3h = Vec3h & {
805
+ '~exotic': Vec3h;
806
+ } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
807
+ /**
808
+ *
809
+ * Schema representing vec3h - a vector with 3 elements of type f16.
810
+ * Also a constructor function for this vector value.
811
+ *
812
+ * @example
813
+ * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
814
+ * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
815
+ * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
816
+ *
817
+ * @example
818
+ * const buffer = root.createBuffer(d.vec3h, d.vec3h(0, 1, 2)); // buffer holding a d.vec3h value, with an initial value of vec3h(0, 1, 2);
819
+ */
820
+ declare const vec3h: NativeVec3h;
808
821
  /**
809
822
  * Type of the `d.vec3i` object/function: vector data type schema/constructor
810
823
  */
@@ -865,6 +878,26 @@ type NativeVec4f = Vec4f & {
865
878
  * const buffer = root.createBuffer(d.vec4f, d.vec4f(0, 1, 2, 3)); // buffer holding a d.vec4f value, with an initial value of vec4f(0, 1, 2, 3);
866
879
  */
867
880
  declare const vec4f: NativeVec4f;
881
+ /**
882
+ * Type of the `d.vec4h` object/function: vector data type schema/constructor
883
+ */
884
+ type NativeVec4h = Vec4h & {
885
+ '~exotic': Vec4h;
886
+ } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
887
+ /**
888
+ *
889
+ * Schema representing vec4h - a vector with 4 elements of type f16.
890
+ * Also a constructor function for this vector value.
891
+ *
892
+ * @example
893
+ * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
894
+ * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
895
+ * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
896
+ *
897
+ * @example
898
+ * const buffer = root.createBuffer(d.vec4h, d.vec4h(0, 1, 2, 3)); // buffer holding a d.vec4h value, with an initial value of vec4h(0, 1, 2, 3);
899
+ */
900
+ declare const vec4h: NativeVec4h;
868
901
  /**
869
902
  * Type of the `d.vec4i` object/function: vector data type schema/constructor
870
903
  */
@@ -906,7 +939,82 @@ type NativeVec4u = Vec4u & {
906
939
  */
907
940
  declare const vec4u: NativeVec4u;
908
941
 
909
- declare const vertexFormats: readonly ["uint8x2", "uint8x4", "sint8x2", "sint8x4", "unorm8x2", "unorm8x4", "snorm8x2", "snorm8x4", "uint16x2", "uint16x4", "sint16x2", "sint16x4", "unorm16x2", "unorm16x4", "snorm16x2", "snorm16x4", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2"];
942
+ /**
943
+ * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
944
+ */
945
+ declare const bool: Bool;
946
+ /**
947
+ * Unsigned 32-bit integer schema representing a single WGSL u32 value.
948
+ */
949
+ type NativeU32 = U32 & {
950
+ '~exotic': U32;
951
+ } & ((v: number | boolean) => number);
952
+ /**
953
+ * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
954
+ *
955
+ * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
956
+ *
957
+ * @example
958
+ * const value = u32(3.14); // 3
959
+ * @example
960
+ * const value = u32(-1); // 4294967295
961
+ * @example
962
+ * const value = u32(-3.1); // 0
963
+ */
964
+ declare const u32: NativeU32;
965
+ /**
966
+ * Signed 32-bit integer schema representing a single WGSL i32 value.
967
+ */
968
+ type NativeI32 = I32 & {
969
+ '~exotic': I32;
970
+ } & ((v: number | boolean) => number);
971
+ /**
972
+ * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
973
+ *
974
+ * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
975
+ *
976
+ * @example
977
+ * const value = i32(3.14); // 3
978
+ * @example
979
+ * const value = i32(-3.9); // -3
980
+ * @example
981
+ * const value = i32(10000000000) // 1410065408
982
+ */
983
+ declare const i32: NativeI32;
984
+ /**
985
+ * 32-bit float schema representing a single WGSL f32 value.
986
+ */
987
+ type NativeF32 = F32 & {
988
+ '~exotic': F32;
989
+ } & ((v: number | boolean) => number);
990
+ /**
991
+ * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
992
+ *
993
+ * Can also be called to cast a value to an f32.
994
+ *
995
+ * @example
996
+ * const value = f32(true); // 1
997
+ */
998
+ declare const f32: NativeF32;
999
+ /**
1000
+ * 16-bit float schema representing a single WGSL f16 value.
1001
+ */
1002
+ type NativeF16 = F16 & {
1003
+ '~exotic': F16;
1004
+ } & ((v: number | boolean) => number);
1005
+ /**
1006
+ * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
1007
+ *
1008
+ * Can also be called to cast a value to an f16.
1009
+ *
1010
+ * @example
1011
+ * const value = f16(true); // 1
1012
+ * @example
1013
+ * const value = f16(21877.5); // 21872
1014
+ */
1015
+ declare const f16: NativeF16;
1016
+
1017
+ declare const vertexFormats: readonly ["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"];
910
1018
  type VertexFormat = (typeof vertexFormats)[number];
911
1019
 
912
1020
  type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
@@ -915,22 +1023,31 @@ interface TgpuVertexFormatData<T extends VertexFormat> {
915
1023
  readonly type: T;
916
1024
  }
917
1025
  declare const formatToWGSLType: {
1026
+ readonly uint8: NativeU32;
918
1027
  readonly uint8x2: NativeVec2u;
919
1028
  readonly uint8x4: NativeVec4u;
1029
+ readonly sint8: NativeI32;
920
1030
  readonly sint8x2: NativeVec2i;
921
1031
  readonly sint8x4: NativeVec4i;
1032
+ readonly unorm8: NativeF32;
922
1033
  readonly unorm8x2: NativeVec2f;
923
1034
  readonly unorm8x4: NativeVec4f;
1035
+ readonly snorm8: NativeF32;
924
1036
  readonly snorm8x2: NativeVec2f;
925
1037
  readonly snorm8x4: NativeVec4f;
1038
+ readonly uint16: NativeU32;
926
1039
  readonly uint16x2: NativeVec2u;
927
1040
  readonly uint16x4: NativeVec4u;
1041
+ readonly sint16: NativeI32;
928
1042
  readonly sint16x2: NativeVec2i;
929
1043
  readonly sint16x4: NativeVec4i;
1044
+ readonly unorm16: NativeF32;
930
1045
  readonly unorm16x2: NativeVec2f;
931
1046
  readonly unorm16x4: NativeVec4f;
1047
+ readonly snorm16: NativeF32;
932
1048
  readonly snorm16x2: NativeVec2f;
933
1049
  readonly snorm16x4: NativeVec4f;
1050
+ readonly float16: NativeF32;
934
1051
  readonly float16x2: NativeVec2f;
935
1052
  readonly float16x4: NativeVec4f;
936
1053
  readonly float32: NativeF32;
@@ -946,40 +1063,59 @@ declare const formatToWGSLType: {
946
1063
  readonly sint32x3: NativeVec3i;
947
1064
  readonly sint32x4: NativeVec4i;
948
1065
  readonly 'unorm10-10-10-2': NativeVec4f;
1066
+ readonly 'unorm8x4-bgra': NativeVec4f;
949
1067
  };
950
1068
  declare const packedFormats: string[];
1069
+ type uint8 = TgpuVertexFormatData<'uint8'>;
1070
+ declare const uint8: uint8;
951
1071
  type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
952
1072
  declare const uint8x2: uint8x2;
953
1073
  type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
954
1074
  declare const uint8x4: uint8x4;
1075
+ type sint8 = TgpuVertexFormatData<'sint8'>;
1076
+ declare const sint8: sint8;
955
1077
  type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
956
1078
  declare const sint8x2: sint8x2;
957
1079
  type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
958
1080
  declare const sint8x4: sint8x4;
1081
+ type unorm8 = TgpuVertexFormatData<'unorm8'>;
1082
+ declare const unorm8: unorm8;
959
1083
  type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
960
1084
  declare const unorm8x2: unorm8x2;
961
1085
  type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
962
1086
  declare const unorm8x4: unorm8x4;
1087
+ type snorm8 = TgpuVertexFormatData<'snorm8'>;
1088
+ declare const snorm8: snorm8;
963
1089
  type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
964
1090
  declare const snorm8x2: snorm8x2;
965
1091
  type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
966
1092
  declare const snorm8x4: snorm8x4;
1093
+ type uint16 = TgpuVertexFormatData<'uint16'>;
1094
+ declare const uint16: uint16;
967
1095
  type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
968
1096
  declare const uint16x2: uint16x2;
969
1097
  type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
970
1098
  declare const uint16x4: uint16x4;
1099
+ type sint16 = TgpuVertexFormatData<'sint16'>;
1100
+ declare const sint16: sint16;
971
1101
  type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
972
1102
  declare const sint16x2: sint16x2;
973
1103
  type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
974
1104
  declare const sint16x4: sint16x4;
1105
+ type unorm16 = TgpuVertexFormatData<'unorm16'>;
1106
+ declare const unorm16: unorm16;
975
1107
  type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
976
1108
  declare const unorm16x2: unorm16x2;
977
1109
  type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
978
1110
  declare const unorm16x4: unorm16x4;
1111
+ type snorm16 = TgpuVertexFormatData<'snorm16'>;
1112
+ declare const snorm16: snorm16;
979
1113
  type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
980
1114
  declare const snorm16x2: snorm16x2;
981
1115
  type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
982
1116
  declare const snorm16x4: snorm16x4;
1117
+ type float16 = TgpuVertexFormatData<'float16'>;
1118
+ declare const float16: float16;
983
1119
  type float16x2 = TgpuVertexFormatData<'float16x2'>;
984
1120
  declare const float16x2: float16x2;
985
1121
  type float16x4 = TgpuVertexFormatData<'float16x4'>;
@@ -1010,7 +1146,9 @@ type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
1010
1146
  declare const sint32x4: sint32x4;
1011
1147
  type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
1012
1148
  declare const unorm10_10_10_2: unorm10_10_10_2;
1013
- type PackedData = uint8x2 | uint8x4 | sint8x2 | sint8x4 | unorm8x2 | unorm8x4 | snorm8x2 | snorm8x4 | uint16x2 | uint16x4 | sint16x2 | sint16x4 | unorm16x2 | unorm16x4 | snorm16x2 | snorm16x4 | float16x2 | float16x4 | float32 | float32x2 | float32x3 | float32x4 | uint32 | uint32x2 | uint32x3 | uint32x4 | sint32 | sint32x2 | sint32x3 | sint32x4 | unorm10_10_10_2;
1149
+ type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
1150
+ declare const unorm8x4_bgra: unorm8x4_bgra;
1151
+ 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;
1014
1152
 
1015
1153
  /**
1016
1154
  * Array schema constructed via `d.looseArrayOf` function.
@@ -1045,7 +1183,7 @@ interface LooseDecorated<TInner extends BaseWgslData = BaseWgslData, TAttribs ex
1045
1183
  readonly attribs: TAttribs;
1046
1184
  readonly '~repr': Infer<TInner>;
1047
1185
  }
1048
- declare const looseTypeLiterals: readonly ["loose-struct", "loose-array", "loose-decorated", "uint8x2", "uint8x4", "sint8x2", "sint8x4", "unorm8x2", "unorm8x4", "snorm8x2", "snorm8x4", "uint16x2", "uint16x4", "sint16x2", "sint16x4", "unorm16x2", "unorm16x4", "snorm16x2", "snorm16x4", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2"];
1186
+ declare const looseTypeLiterals: readonly ["loose-struct", "loose-array", "loose-decorated", "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"];
1049
1187
  type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
1050
1188
  type AnyLooseData = LooseArray | LooseStruct | LooseDecorated | PackedData;
1051
1189
  declare function isLooseData(data: unknown): data is AnyLooseData;
@@ -1119,4 +1257,4 @@ type Mutable<T> = {
1119
1257
  -readonly [P in keyof T]: T[P];
1120
1258
  };
1121
1259
 
1122
- export { isBuiltinAttrib as $, type AnyData as A, type BaseWgslData as B, type Atomic as C, type Default as D, type Exotic as E, type F32 as F, bool as G, f32 as H, type I32 as I, f16 as J, i32 as K, type Location as L, type Mutable as M, u32 as N, type OmitProps as O, type Prettify as P, isWgslData as Q, isWgslArray as R, type Size as S, type TgpuNamable as T, type U32 as U, type Vec4f as V, type WgslTypeLiteral as W, isWgslStruct as X, isAtomic as Y, isDecorated as Z, isAlignAttrib as _, type Vec4u as a, type PackedData as a$, isLocationAttrib as a0, isSizeAttrib as a1, type Bool as a2, type F16 as a3, type Vec2f as a4, type Vec2i as a5, type Vec2u as a6, type Vec3f as a7, type Vec3i as a8, type v2i as a9, unorm8x2 as aA, unorm8x4 as aB, snorm8x2 as aC, snorm8x4 as aD, uint16x2 as aE, uint16x4 as aF, sint16x2 as aG, sint16x4 as aH, unorm16x2 as aI, unorm16x4 as aJ, snorm16x2 as aK, snorm16x4 as aL, float16x2 as aM, float16x4 as aN, float32 as aO, float32x2 as aP, float32x3 as aQ, float32x4 as aR, uint32 as aS, uint32x2 as aT, uint32x3 as aU, uint32x4 as aV, sint32 as aW, sint32x2 as aX, sint32x3 as aY, sint32x4 as aZ, unorm10_10_10_2 as a_, type v2u as aa, type v3i as ab, type v3u as ac, type v4i as ad, type v4u as ae, vec2f as af, vec2i as ag, vec2u as ah, vec3f as ai, vec3i as aj, vec3u as ak, vec4f as al, vec4i as am, vec4u as an, isLooseArray as ao, isLooseStruct as ap, isLooseDecorated as aq, isData as ar, isLooseData as as, type FormatToWGSLType as at, type TgpuVertexFormatData as au, packedFormats as av, uint8x2 as aw, uint8x4 as ax, sint8x2 as ay, sint8x4 as az, type Vec4i as b, type UnionToIntersection as c, type Infer as d, type AnyWgslData as e, type Align as f, type Builtin as g, type Decorated as h, type LooseDecorated as i, type AnyLooseData as j, type LooseTypeLiteral as k, type WgslArray as l, type Vec3u as m, type WgslStruct as n, type ExoticRecord as o, type LooseArray as p, type LooseStruct as q, type m2x2f as r, type m3x3f as s, type m4x4f as t, type Mat2x2f as u, type v2f as v, type Mat3x3f as w, type v3f as x, type Mat4x4f as y, type v4f as z };
1260
+ export { isBuiltinAttrib as $, type AnyData as A, type BaseWgslData as B, type Atomic as C, type Default as D, type Exotic as E, type F32 as F, bool as G, f32 as H, type I32 as I, f16 as J, i32 as K, type Location as L, type Mutable as M, u32 as N, type OmitProps as O, type Prettify as P, isWgslData as Q, isWgslArray as R, type Size as S, type TgpuNamable as T, type U32 as U, type Vec4f as V, type WgslTypeLiteral as W, isWgslStruct as X, isAtomic as Y, isDecorated as Z, isAlignAttrib as _, type Vec4u as a, float16x2 as a$, isLocationAttrib as a0, isSizeAttrib as a1, type Bool as a2, type F16 as a3, type Vec2f as a4, type Vec2h as a5, type Vec2i as a6, type Vec2u as a7, type Vec3f as a8, type Vec3h as a9, type TgpuVertexFormatData as aA, packedFormats as aB, uint8 as aC, uint8x2 as aD, uint8x4 as aE, sint8 as aF, sint8x2 as aG, sint8x4 as aH, unorm8 as aI, unorm8x2 as aJ, unorm8x4 as aK, snorm8 as aL, snorm8x2 as aM, snorm8x4 as aN, uint16 as aO, uint16x2 as aP, uint16x4 as aQ, sint16 as aR, sint16x2 as aS, sint16x4 as aT, unorm16 as aU, unorm16x2 as aV, unorm16x4 as aW, snorm16 as aX, snorm16x2 as aY, snorm16x4 as aZ, float16 as a_, type Vec3i as aa, type Vec4h as ab, type v2i as ac, type v2u as ad, type v3i as ae, type v3u as af, type v4i as ag, type v4u as ah, vec2f as ai, vec2h as aj, vec2i as ak, vec2u as al, vec3f as am, vec3h as an, vec3i as ao, vec3u as ap, vec4f as aq, vec4h as ar, vec4i as as, vec4u as at, isLooseArray as au, isLooseStruct as av, isLooseDecorated as aw, isData as ax, isLooseData as ay, type FormatToWGSLType as az, type Vec4i as b, float16x4 as b0, float32 as b1, float32x2 as b2, float32x3 as b3, float32x4 as b4, uint32 as b5, uint32x2 as b6, uint32x3 as b7, uint32x4 as b8, sint32 as b9, sint32x2 as ba, sint32x3 as bb, sint32x4 as bc, unorm10_10_10_2 as bd, unorm8x4_bgra as be, type PackedData as bf, type UnionToIntersection as c, type Infer as d, type AnyWgslData as e, type Align as f, type Builtin as g, type Decorated as h, type LooseDecorated as i, type AnyLooseData as j, type LooseTypeLiteral as k, type WgslArray as l, type Vec3u as m, type WgslStruct as n, type ExoticRecord as o, type LooseArray as p, type LooseStruct as q, type m2x2f as r, type m3x3f as s, type m4x4f as t, type Mat2x2f as u, type v2f as v, type Mat3x3f as w, type v3f as x, type Mat4x4f as y, type v4f as z };
package/chunk-6N2XUXQX.js DELETED
@@ -1,2 +0,0 @@
1
- var De=Object.defineProperty,Be=Object.defineProperties;var Fe=Object.getOwnPropertyDescriptors;var ge=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable;var ee=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))Se.call(t,n)&&ee(e,n,t[n]);if(ge)for(var n of ge(t))Ce.call(t,n)&&ee(e,n,t[n]);return e},ct=(e,t)=>Be(e,Fe(t));var a=(e,t,n)=>(ee(e,typeof t!="symbol"?t+"":t,n),n);import q from"typed-binary";var te=0;function dt(e){te++;try{return e()}finally{te--}}var g=()=>te>0;var We={type:"bool"},Le=e=>g()?`u32(${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))),p=Object.assign(Le,{type:"u32"}),Ie=e=>{if(g())return`i32(${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))},ne=Object.assign(Ie,{type:"i32"}),Ne=e=>{if(g())return`f32(${e})`;if(typeof e=="boolean")return e?1:0;let t=new Float32Array(1);return t[0]=e,t[0]},z=Object.assign(Ne,{type:"f32"}),Ee=e=>{if(g())return`f16(${e})`;if(typeof e=="boolean")return e?1:0;let t=new ArrayBuffer(2);return q.f16.write(new q.BufferWriter(t),e),q.f16.read(new q.BufferReader(t))},Pe=Object.assign(Ee,{type:"f16"});var _e=["bool","f32","f16","i32","u32","vec2f","vec2i","vec2u","vec3f","vec3i","vec3u","vec4f","vec4i","vec4u","mat2x2f","mat3x3f","mat4x4f","struct","array","atomic","decorated"];function E(e){return _e.includes(e==null?void 0:e.type)}function P(e){return(e==null?void 0:e.type)==="array"}function _(e){return(e==null?void 0:e.type)==="struct"}function Me(e){return(e==null?void 0:e.type)==="atomic"}function M(e){return(e==null?void 0:e.type)==="@align"}function O(e){return(e==null?void 0:e.type)==="@size"}function re(e){return(e==null?void 0:e.type)==="@location"}function oe(e){return(e==null?void 0:e.type)==="@builtin"}function f(e){return(e==null?void 0:e.type)==="decorated"}var Ue=e=>new ae(e),ae=class{constructor(t){this.propTypes=t;a(this,"_label");a(this,"type","struct");a(this,"~repr");a(this,"~exotic")}get label(){return this._label}$name(t){return this._label=t,this}};var v=(e,t)=>{let n=t-1,r=~n;return e&n?(e&r)+t:e};var ze=["uint8x2","uint8x4","sint8x2","sint8x4","unorm8x2","unorm8x4","snorm8x2","snorm8x4","uint16x2","uint16x4","sint16x2","sint16x4","unorm16x2","unorm16x4","snorm16x2","snorm16x4","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2"];var $e=["loose-struct","loose-array","loose-decorated",...ze];function Q(e){return $e.includes(e==null?void 0:e.type)}function k(e){return(e==null?void 0:e.type)==="loose-array"}function A(e){return(e==null?void 0:e.type)==="loose-struct"}function d(e){return(e==null?void 0:e.type)==="loose-decorated"}function h(e){var t,n;return(n=(t=e.attribs)==null?void 0:t.find(M))==null?void 0:n.value}function ve(e){var t,n;return(n=(t=e.attribs)==null?void 0:t.find(O))==null?void 0:n.value}function ht(e){var t,n;return(n=(t=e.attribs)==null?void 0:t.find(re))==null?void 0:n.value}function Re(e){return E(e)||Q(e)}function b(e){let t={"~repr":void 0,type:e.type};return Object.assign((...r)=>{var i;let o=r;if(g())return`${t.type}(${o.join(", ")})`;if(o.length<=1)return e.makeFromScalar((i=o[0])!=null?i:0);if(o.length===e.length)return e.make(...o);throw new Error(`'${e.type}' constructor called with invalid number of arguments.`)},t)}var U=class{constructor(t,n){this.x=t;this.y=n;a(this,"length",2)}*[Symbol.iterator](){yield this.x,yield this.y}get 0(){return this.x}get 1(){return this.y}set 0(t){this.x=t}set 1(t){this.y=t}resolve(){return`${this.kind}(${this.x}, ${this.y})`}},V=class e extends U{constructor(){super(...arguments);a(this,"kind","vec2f")}make2(n,r){return new e(n,r)}make3(n,r,o){return new F(n,r,o)}make4(n,r,o,i){return new W(n,r,o,i)}},D=class e extends U{constructor(){super(...arguments);a(this,"kind","vec2i")}make2(n,r){return new e(n,r)}make3(n,r,o){return new S(n,r,o)}make4(n,r,o,i){return new L(n,r,o,i)}},B=class e extends U{constructor(){super(...arguments);a(this,"kind","vec2u")}make2(n,r){return new e(n,r)}make3(n,r,o){return new C(n,r,o)}make4(n,r,o,i){return new I(n,r,o,i)}},$=class{constructor(t,n,r){this.x=t;this.y=n;this.z=r;a(this,"length",3)}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}get 0(){return this.x}get 1(){return this.y}get 2(){return this.z}set 0(t){this.x=t}set 1(t){this.y=t}set 2(t){this.z=t}resolve(){return`${this.kind}(${this.x}, ${this.y}, ${this.z})`}},F=class e extends ${constructor(){super(...arguments);a(this,"kind","vec3f")}make2(n,r){return new V(n,r)}make3(n,r,o){return new e(n,r,o)}make4(n,r,o,i){return new W(n,r,o,i)}},S=class e extends ${constructor(){super(...arguments);a(this,"kind","vec3i")}make2(n,r){return new D(n,r)}make3(n,r,o){return new e(n,r,o)}make4(n,r,o,i){return new L(n,r,o,i)}},C=class e extends ${constructor(){super(...arguments);a(this,"kind","vec3u")}make2(n,r){return new B(n,r)}make3(n,r,o){return new e(n,r,o)}make4(n,r,o,i){return new I(n,r,o,i)}},R=class{constructor(t,n,r,o){this.x=t;this.y=n;this.z=r;this.w=o;a(this,"length",4)}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}get 0(){return this.x}get 1(){return this.y}get 2(){return this.z}get 3(){return this.w}set 0(t){this.x=t}set 1(t){this.y=t}set 2(t){this.z=t}set 3(t){this.w=t}resolve(){return`${this.kind}(${this.x}, ${this.y}, ${this.z}, ${this.w})`}},W=class e extends R{constructor(){super(...arguments);a(this,"kind","vec4f")}make2(n,r){return new V(n,r)}make3(n,r,o){return new F(n,r,o)}make4(n,r,o,i){return new e(n,r,o,i)}},L=class e extends R{constructor(){super(...arguments);a(this,"kind","vec4i")}make2(n,r){return new D(n,r)}make3(n,r,o){return new S(n,r,o)}make4(n,r,o,i){return new e(n,r,o,i)}},I=class e extends R{constructor(){super(...arguments);a(this,"kind","vec4u")}make2(n,r){return new B(n,r)}make3(n,r,o){return new C(n,r,o)}make4(n,r,o,i){return new e(n,r,o,i)}},u={get:(e,t)=>{if(typeof t=="symbol"||!Number.isNaN(Number.parseInt(t)))return Reflect.get(e,t);let n=e,r=new Array(t.length),o=0;for(let i of t){switch(i){case"x":r[o]=n.x;break;case"y":r[o]=n.y;break;case"z":r[o]=n.z;break;case"w":r[o]=n.w;break;default:return Reflect.get(n,t)}o++}return t.length===4?new Proxy(n.make4(r[0],r[1],r[2],r[3]),u):t.length===3?new Proxy(n.make3(r[0],r[1],r[2]),u):t.length===2?new Proxy(n.make2(r[0],r[1]),u):Reflect.get(e,t)}},T=b({type:"vec2f",length:2,make:(e,t)=>new Proxy(new V(e,t),u),makeFromScalar:e=>new Proxy(new V(e,e),u)}),j=b({type:"vec2i",length:2,make:(e,t)=>new Proxy(new D(e,t),u),makeFromScalar:e=>new Proxy(new D(e,e),u)}),G=b({type:"vec2u",length:2,make:(e,t)=>new Proxy(new B(e,t),u),makeFromScalar:e=>new Proxy(new B(e,e),u)}),K=b({type:"vec3f",length:3,make:(e,t,n)=>new Proxy(new F(e,t,n),u),makeFromScalar:e=>new Proxy(new F(e,e,e),u)}),ie=b({type:"vec3i",length:3,make:(e,t,n)=>new Proxy(new S(e,t,n),u),makeFromScalar:e=>new Proxy(new S(e,e,e),u)}),w=b({type:"vec3u",length:3,make:(e,t,n)=>new Proxy(new C(e,t,n),u),makeFromScalar:e=>new Proxy(new C(e,e,e),u)}),y=b({type:"vec4f",length:4,make:(e,t,n,r)=>new Proxy(new W(e,t,n,r),u),makeFromScalar:e=>new Proxy(new W(e,e,e,e),u)}),H=b({type:"vec4i",length:4,make:(e,t,n,r)=>new Proxy(new L(e,t,n,r),u),makeFromScalar:e=>new Proxy(new L(e,e,e,e),u)}),J=b({length:4,type:"vec4u",make:(e,t,n,r)=>new Proxy(new I(e,t,n,r),u),makeFromScalar:e=>new Proxy(new I(e,e,e,e),u)});var s=class{constructor(t){this.type=t;a(this,"~repr")}},je={uint8x2:G,uint8x4:J,sint8x2:j,sint8x4:H,unorm8x2:T,unorm8x4:y,snorm8x2:T,snorm8x4:y,uint16x2:G,uint16x4:J,sint16x2:j,sint16x4:H,unorm16x2:T,unorm16x4:y,snorm16x2:T,snorm16x4:y,float16x2:T,float16x4:y,float32:z,float32x2:T,float32x3:K,float32x4:y,uint32:p,uint32x2:G,uint32x3:w,uint32x4:J,sint32:ne,sint32x2:j,sint32x3:ie,sint32x4:H,"unorm10-10-10-2":y},ke=Object.keys(je),Wt=new s("uint8x2"),Lt=new s("uint8x4"),It=new s("sint8x2"),Nt=new s("sint8x4"),Et=new s("unorm8x2"),Pt=new s("unorm8x4"),_t=new s("snorm8x2"),Mt=new s("snorm8x4"),Ot=new s("uint16x2"),Ut=new s("uint16x4"),$t=new s("sint16x2"),Rt=new s("sint16x4"),jt=new s("unorm16x2"),Gt=new s("unorm16x4"),Kt=new s("snorm16x2"),Ht=new s("snorm16x4"),Jt=new s("float16x2"),qt=new s("float16x4"),Qt=new s("float32"),Xt=new s("float32x2"),Yt=new s("float32x3"),Zt=new s("float32x4"),en=new s("uint32"),tn=new s("uint32x2"),nn=new s("uint32x3"),rn=new s("uint32x4"),on=new s("sint32"),an=new s("sint32x2"),sn=new s("sint32x3"),un=new s("sint32x4"),ln=new s("unorm10-10-10-2");var Ge={bool:4,f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2i:8,vec2u:8,vec3f:16,vec3i:16,vec3u:16,vec4f:16,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16};function Ke(e){var r,o,i;let t=e==null?void 0:e.type,n=Ge[t];if(n!==void 0)return n;if(_(e))return Object.values(e.propTypes).map(m).reduce((x,we)=>x>we?x:we);if(P(e))return m(e.elementType);if(A(e)){let x=Object.values(e.propTypes)[0];return x&&(r=h(x))!=null?r:1}if(k(e))return(o=h(e.elementType))!=null?o:1;if(f(e)||d(e))return(i=h(e))!=null?i:m(e.inner);if(ke.includes(t))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(e)}`)}function He(e){var t,n;if(A(e)){let r=Object.values(e.propTypes)[0];return r?N(r):1}return k(e)?N(e.elementType):d(e)?(t=h(e))!=null?t:N(e.inner):(n=h(e))!=null?n:1}var Ae=new WeakMap,he=new WeakMap;function m(e){let t=Ae.get(e);return t===void 0&&(t=Ke(e),Ae.set(e,t)),t}function N(e){let t=he.get(e);return t===void 0&&(t=He(e),he.set(e,t)),t}function Je(e){return m(e)}var qe={bool:4,f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2i:8,vec2u:8,vec3f:12,vec3i:12,vec3u:12,vec4f:16,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8x2:2,uint8x4:4,sint8x2:2,sint8x4:4,unorm8x2:2,unorm8x4:4,snorm8x2:2,snorm8x4:4,uint16x2:4,uint16x4:8,sint16x2:4,sint16x4:8,unorm16x2:4,unorm16x4:8,snorm16x2:4,snorm16x4:8,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4};function Qe(e){let t=0;for(let n of Object.values(e.propTypes)){if(Number.isNaN(t))throw new Error("Only the last property of a struct can be unbounded");if(t=v(t,m(n)),t+=c(n),Number.isNaN(t)&&n.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return v(t,m(e))}function Xe(e){let t=0;for(let n of Object.values(e.propTypes)){let r=N(n);t=v(t,r),t+=c(n)}return t}function Ye(e){var n;let t=qe[e==null?void 0:e.type];if(t!==void 0)return t;if(_(e))return Qe(e);if(A(e))return Xe(e);if(P(e)){if(e.elementCount===0)return Number.NaN;let r=m(e.elementType);return v(c(e.elementType),r)*e.elementCount}if(k(e)){let r=N(e.elementType);return v(c(e.elementType),r)*e.elementCount}if(f(e)||d(e))return(n=ve(e))!=null?n:c(e.inner);throw new Error(`Cannot determine size of data: ${e}`)}var Ve=new WeakMap;function c(e){let t=Ve.get(e);return t===void 0&&(t=Ye(e),Ve.set(e,t)),t}function Ze(e){return c(e)}var ue=(e,t)=>new se(e,t),se=class{constructor(t,n){this.elementType=t;this.elementCount=n;a(this,"type","array");a(this,"~repr");a(this,"~exotic");if(Number.isNaN(c(t)))throw new Error("Cannot nest runtime sized arrays.")}};var et=(e,t)=>new le(e,t),le=class{constructor(t,n){this.elementType=t;this.elementCount=n;a(this,"type","loose-array");a(this,"~repr")}};var tt=e=>new ye(e),ye=class{constructor(t){this.propTypes=t;a(this,"type","loose-struct");a(this,"~repr")}};function fe(e){let t={"~repr":void 0,type:e.type,label:e.type};return Object.assign((...r)=>{let o=[];for(let i of r)if(typeof i=="number")o.push(i);else for(let x=0;x<i.length;++x)o.push(i[x]);for(let i=o.length;i<e.columns*e.rows;++i)o.push(0);return e.makeFromElements(...o)},t)}var xe=class{constructor(...t){a(this,"columns");a(this,"length",4);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}},me=class extends xe{constructor(){super(...arguments);a(this,"kind","mat2x2f")}makeColumn(n,r){return T(n,r)}},ce=class{constructor(...t){a(this,"columns");a(this,"length",12);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){}},pe=class extends ce{constructor(){super(...arguments);a(this,"kind","mat3x3f")}makeColumn(n,r,o){return K(n,r,o)}},de=class{constructor(...t){a(this,"columns");a(this,"length",16);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])]}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}},Te=class extends de{constructor(){super(...arguments);a(this,"kind","mat4x4f")}makeColumn(n,r,o,i){return y(n,r,o,i)}},nt=fe({type:"mat2x2f",rows:2,columns:2,makeFromElements:(...e)=>new me(...e)}),rt=fe({type:"mat3x3f",rows:3,columns:3,makeFromElements:(...e)=>new pe(...e)}),ot=fe({type:"mat4x4f",rows:4,columns:4,makeFromElements:(...e)=>new Te(...e)});function at(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 it(e){return new be(e)}var be=class{constructor(t){this.inner=t;a(this,"type","atomic");a(this,"~repr")}};function l(e,t){return f(e)?new Y(e.inner,[t,...e.attribs]):d(e)?new Z(e.inner,[t,...e.attribs]):Q(e)?new Z(e,[t]):new Y(e,[t])}function st(e,t){return l(t,{type:"@align",value:e})}function ut(e,t){return l(t,{type:"@size",value:e})}function lt(e,t){return l(t,{type:"@location",value:e})}function yt(e){return(f(e)||d(e))&&e.attribs.find(oe)!==void 0}function Pn(e){return!f(e)&&!d(e)?"":e.attribs.map(t=>`${t.type}(${t.value}) `).join("")}var X=class{constructor(t,n){this.inner=t;this.attribs=n;a(this,"~repr");var i,x;let r=(i=n.find(M))==null?void 0:i.value,o=(x=n.find(O))==null?void 0:x.value;if(r!==void 0){if(r<=0)throw new Error(`Custom data alignment must be a positive number, got: ${r}.`);if(Math.log2(r)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${r}.`);if(E(this.inner)&&r%m(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${r}, expected multiple of: ${m(this.inner)}.`)}if(o!==void 0){if(o<c(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${o}, expected at least: ${c(this.inner)}.`);if(o<=0)throw new Error(`Custom data size must be a positive number. Got: ${o}.`)}}},Y=class extends X{constructor(){super(...arguments);a(this,"type","decorated")}},Z=class extends X{constructor(){super(...arguments);a(this,"type","loose-decorated")}};var xt={vertexIndex:l(p,{type:"@builtin",value:"vertex_index"}),instanceIndex:l(p,{type:"@builtin",value:"instance_index"}),position:l(y,{type:"@builtin",value:"position"}),clipDistances:l(ue(p,8),{type:"@builtin",value:"clip_distances"}),frontFacing:l(z,{type:"@builtin",value:"front_facing"}),fragDepth:l(z,{type:"@builtin",value:"frag_depth"}),sampleIndex:l(p,{type:"@builtin",value:"sample_index"}),sampleMask:l(p,{type:"@builtin",value:"sample_mask"}),localInvocationId:l(w,{type:"@builtin",value:"local_invocation_id"}),localInvocationIndex:l(p,{type:"@builtin",value:"local_invocation_index"}),globalInvocationId:l(w,{type:"@builtin",value:"global_invocation_id"}),workgroupId:l(w,{type:"@builtin",value:"workgroup_id"}),numWorkgroups:l(w,{type:"@builtin",value:"num_workgroups"})};export{mt as a,ct as b,a as c,E as d,P as e,_ as f,Me as g,M as h,O as i,re as j,oe as k,f as l,Q as m,k as n,A as o,d as p,ht as q,Re as r,dt as s,g as t,We as u,p as v,ne as w,z as x,Pe as y,T as z,j as A,G as B,K as C,ie as D,w as E,y as F,H as G,J as H,ke as I,Wt as J,Lt as K,It as L,Nt as M,Et as N,Pt as O,_t as P,Mt as Q,Ot as R,Ut as S,$t as T,Rt as U,jt as V,Gt as W,Kt as X,Ht as Y,Jt as Z,qt as _,Qt as $,Xt as aa,Yt as ba,Zt as ca,en as da,tn as ea,nn as fa,rn as ga,on as ha,an as ia,sn as ja,un as ka,ln as la,m as ma,N as na,Je as oa,c as pa,Ze as qa,st as ra,ut as sa,lt as ta,yt as ua,Pn as va,Ue as wa,ue as xa,et as ya,tt as za,nt as Aa,rt as Ba,ot as Ca,at as Da,it as Ea,xt as Fa};
2
- //# sourceMappingURL=chunk-6N2XUXQX.js.map