typegpu 0.5.4 → 0.5.6
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/attributes-B90UjSYb.d.ts +159 -0
- package/attributes-zljQ-iA7.d.cts +159 -0
- package/chunk-KJHEEZQT.js +4 -0
- package/chunk-KJHEEZQT.js.map +1 -0
- package/chunk-LB4TSIPN.cjs +2 -0
- package/chunk-LB4TSIPN.cjs.map +1 -0
- package/chunk-VTUUXD6H.cjs +4 -0
- package/chunk-VTUUXD6H.cjs.map +1 -0
- package/chunk-YVK55BVR.js +2 -0
- package/chunk-YVK55BVR.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +3 -4
- package/data/index.d.ts +3 -4
- package/data/index.js +1 -1
- package/{wgslTypes-Bh2dG5qv.d.cts → dataTypes-6k4EJeol.d.cts} +359 -42
- package/{wgslTypes-Bh2dG5qv.d.ts → dataTypes-6k4EJeol.d.ts} +359 -42
- package/index.cjs +18 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +35 -407
- package/index.d.ts +35 -407
- package/index.js +18 -18
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/sampler-ByLNpSxj.d.ts +369 -0
- package/sampler-NRTAYTIW.d.cts +369 -0
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +85 -50
- package/std/index.d.ts +85 -50
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/attributes-BdU8hyQq.d.cts +0 -435
- package/attributes-CAsvE5Z9.d.ts +0 -435
- package/chunk-5PJ3H5OR.js +0 -2
- package/chunk-5PJ3H5OR.js.map +0 -1
- package/chunk-7UUBX6MC.cjs +0 -4
- package/chunk-7UUBX6MC.cjs.map +0 -1
- package/chunk-AKBL6GDL.js +0 -4
- package/chunk-AKBL6GDL.js.map +0 -1
- package/chunk-URJCMUTT.cjs +0 -2
- package/chunk-URJCMUTT.cjs.map +0 -1
@@ -40,6 +40,8 @@ type MemIdentityRecord<T extends Record<string | number | symbol, unknown>> = {
|
|
40
40
|
[Key in keyof T]: MemIdentity<T[Key]>;
|
41
41
|
};
|
42
42
|
|
43
|
+
declare const $internal: unique symbol;
|
44
|
+
|
43
45
|
type Default<T, TDefault> = unknown extends T ? TDefault : T extends undefined ? TDefault : T;
|
44
46
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
45
47
|
type Prettify<T> = {
|
@@ -68,26 +70,32 @@ interface BooleanArrayView {
|
|
68
70
|
[n: number]: boolean;
|
69
71
|
}
|
70
72
|
interface BaseData {
|
71
|
-
|
72
|
-
|
73
|
+
readonly [$internal]: true;
|
74
|
+
readonly type: string;
|
73
75
|
readonly [$repr]: unknown;
|
74
76
|
}
|
75
77
|
/**
|
76
78
|
* Represents a 64-bit integer.
|
77
79
|
*/
|
78
80
|
interface AbstractInt {
|
81
|
+
readonly [$internal]: true;
|
79
82
|
readonly type: 'abstractInt';
|
80
|
-
/** Type-token, not available at runtime */
|
81
83
|
readonly [$repr]: number;
|
82
84
|
}
|
83
85
|
/**
|
84
86
|
* Represents a 64-bit IEEE 754 floating point number.
|
85
87
|
*/
|
86
88
|
interface AbstractFloat {
|
89
|
+
readonly [$internal]: true;
|
87
90
|
readonly type: 'abstractFloat';
|
88
|
-
/** Type-token, not available at runtime */
|
89
91
|
readonly [$repr]: number;
|
90
92
|
}
|
93
|
+
interface Void {
|
94
|
+
readonly [$internal]: true;
|
95
|
+
readonly type: 'void';
|
96
|
+
readonly [$repr]: undefined;
|
97
|
+
}
|
98
|
+
declare const Void: Void;
|
91
99
|
interface Swizzle2<T2, T3, T4> {
|
92
100
|
readonly xx: T2;
|
93
101
|
readonly xy: T2;
|
@@ -398,6 +406,7 @@ interface Swizzle4<T2, T3, T4> extends Swizzle3<T2, T3, T4> {
|
|
398
406
|
* A vector with 2 elements of type f32
|
399
407
|
*/
|
400
408
|
interface v2f extends NumberArrayView, Swizzle2<v2f, v3f, v4f> {
|
409
|
+
readonly [$internal]: true;
|
401
410
|
/** use to distinguish between vectors of the same size on the type level */
|
402
411
|
readonly kind: 'vec2f';
|
403
412
|
x: number;
|
@@ -408,6 +417,7 @@ interface v2f extends NumberArrayView, Swizzle2<v2f, v3f, v4f> {
|
|
408
417
|
* A vector with 2 elements of type f16
|
409
418
|
*/
|
410
419
|
interface v2h extends NumberArrayView, Swizzle2<v2h, v3h, v4h> {
|
420
|
+
readonly [$internal]: true;
|
411
421
|
/** use to distinguish between vectors of the same size on the type level */
|
412
422
|
readonly kind: 'vec2h';
|
413
423
|
x: number;
|
@@ -418,6 +428,7 @@ interface v2h extends NumberArrayView, Swizzle2<v2h, v3h, v4h> {
|
|
418
428
|
* A vector with 2 elements of type i32
|
419
429
|
*/
|
420
430
|
interface v2i extends NumberArrayView, Swizzle2<v2i, v3i, v4i> {
|
431
|
+
readonly [$internal]: true;
|
421
432
|
/** use to distinguish between vectors of the same size on the type level */
|
422
433
|
readonly kind: 'vec2i';
|
423
434
|
x: number;
|
@@ -428,6 +439,7 @@ interface v2i extends NumberArrayView, Swizzle2<v2i, v3i, v4i> {
|
|
428
439
|
* A vector with 2 elements of type u32
|
429
440
|
*/
|
430
441
|
interface v2u extends NumberArrayView, Swizzle2<v2u, v3u, v4u> {
|
442
|
+
readonly [$internal]: true;
|
431
443
|
/** use to distinguish between vectors of the same size on the type level */
|
432
444
|
readonly kind: 'vec2u';
|
433
445
|
x: number;
|
@@ -438,6 +450,7 @@ interface v2u extends NumberArrayView, Swizzle2<v2u, v3u, v4u> {
|
|
438
450
|
* A vector with 2 elements of type `bool`
|
439
451
|
*/
|
440
452
|
interface v2b extends BooleanArrayView, Swizzle2<v2b, v3b, v4b> {
|
453
|
+
readonly [$internal]: true;
|
441
454
|
/** use to distinguish between vectors of the same size on the type level */
|
442
455
|
readonly kind: 'vec2<bool>';
|
443
456
|
x: boolean;
|
@@ -448,6 +461,7 @@ interface v2b extends BooleanArrayView, Swizzle2<v2b, v3b, v4b> {
|
|
448
461
|
* A vector with 3 elements of type f32
|
449
462
|
*/
|
450
463
|
interface v3f extends NumberArrayView, Swizzle3<v2f, v3f, v4f> {
|
464
|
+
readonly [$internal]: true;
|
451
465
|
/** use to distinguish between vectors of the same size on the type level */
|
452
466
|
readonly kind: 'vec3f';
|
453
467
|
x: number;
|
@@ -459,6 +473,7 @@ interface v3f extends NumberArrayView, Swizzle3<v2f, v3f, v4f> {
|
|
459
473
|
* A vector with 3 elements of type f16
|
460
474
|
*/
|
461
475
|
interface v3h extends NumberArrayView, Swizzle3<v2h, v3h, v4h> {
|
476
|
+
readonly [$internal]: true;
|
462
477
|
/** use to distinguish between vectors of the same size on the type level */
|
463
478
|
readonly kind: 'vec3h';
|
464
479
|
x: number;
|
@@ -470,6 +485,7 @@ interface v3h extends NumberArrayView, Swizzle3<v2h, v3h, v4h> {
|
|
470
485
|
* A vector with 3 elements of type i32
|
471
486
|
*/
|
472
487
|
interface v3i extends NumberArrayView, Swizzle3<v2i, v3i, v4i> {
|
488
|
+
readonly [$internal]: true;
|
473
489
|
/** use to distinguish between vectors of the same size on the type level */
|
474
490
|
readonly kind: 'vec3i';
|
475
491
|
x: number;
|
@@ -481,6 +497,7 @@ interface v3i extends NumberArrayView, Swizzle3<v2i, v3i, v4i> {
|
|
481
497
|
* A vector with 3 elements of type u32
|
482
498
|
*/
|
483
499
|
interface v3u extends NumberArrayView, Swizzle3<v2u, v3u, v4u> {
|
500
|
+
readonly [$internal]: true;
|
484
501
|
/** use to distinguish between vectors of the same size on the type level */
|
485
502
|
readonly kind: 'vec3u';
|
486
503
|
x: number;
|
@@ -492,6 +509,7 @@ interface v3u extends NumberArrayView, Swizzle3<v2u, v3u, v4u> {
|
|
492
509
|
* A vector with 3 elements of type `bool`
|
493
510
|
*/
|
494
511
|
interface v3b extends BooleanArrayView, Swizzle3<v2b, v3b, v4b> {
|
512
|
+
readonly [$internal]: true;
|
495
513
|
/** use to distinguish between vectors of the same size on the type level */
|
496
514
|
readonly kind: 'vec3<bool>';
|
497
515
|
x: boolean;
|
@@ -503,6 +521,7 @@ interface v3b extends BooleanArrayView, Swizzle3<v2b, v3b, v4b> {
|
|
503
521
|
* A vector with 4 elements of type f32
|
504
522
|
*/
|
505
523
|
interface v4f extends NumberArrayView, Swizzle4<v2f, v3f, v4f> {
|
524
|
+
readonly [$internal]: true;
|
506
525
|
/** use to distinguish between vectors of the same size on the type level */
|
507
526
|
readonly kind: 'vec4f';
|
508
527
|
x: number;
|
@@ -515,6 +534,7 @@ interface v4f extends NumberArrayView, Swizzle4<v2f, v3f, v4f> {
|
|
515
534
|
* A vector with 4 elements of type f16
|
516
535
|
*/
|
517
536
|
interface v4h extends NumberArrayView, Swizzle4<v2h, v3h, v4h> {
|
537
|
+
readonly [$internal]: true;
|
518
538
|
/** use to distinguish between vectors of the same size on the type level */
|
519
539
|
readonly kind: 'vec4h';
|
520
540
|
x: number;
|
@@ -527,6 +547,7 @@ interface v4h extends NumberArrayView, Swizzle4<v2h, v3h, v4h> {
|
|
527
547
|
* A vector with 4 elements of type i32
|
528
548
|
*/
|
529
549
|
interface v4i extends NumberArrayView, Swizzle4<v2i, v3i, v4i> {
|
550
|
+
readonly [$internal]: true;
|
530
551
|
/** use to distinguish between vectors of the same size on the type level */
|
531
552
|
readonly kind: 'vec4i';
|
532
553
|
x: number;
|
@@ -539,6 +560,7 @@ interface v4i extends NumberArrayView, Swizzle4<v2i, v3i, v4i> {
|
|
539
560
|
* A vector with 4 elements of type u32
|
540
561
|
*/
|
541
562
|
interface v4u extends NumberArrayView, Swizzle4<v2u, v3u, v4u> {
|
563
|
+
readonly [$internal]: true;
|
542
564
|
/** use to distinguish between vectors of the same size on the type level */
|
543
565
|
readonly kind: 'vec4u';
|
544
566
|
x: number;
|
@@ -551,6 +573,7 @@ interface v4u extends NumberArrayView, Swizzle4<v2u, v3u, v4u> {
|
|
551
573
|
* A vector with 4 elements of type `bool`
|
552
574
|
*/
|
553
575
|
interface v4b extends BooleanArrayView, Swizzle4<v2b, v3b, v4b> {
|
576
|
+
readonly [$internal]: true;
|
554
577
|
/** use to distinguish between vectors of the same size on the type level */
|
555
578
|
readonly kind: 'vec4<bool>';
|
556
579
|
x: boolean;
|
@@ -569,6 +592,7 @@ type AnyVec3Instance = v3f | v3h | v3i | v3u | v3b;
|
|
569
592
|
type AnyVec4Instance = v4f | v4h | v4i | v4u | v4b;
|
570
593
|
type AnyVecInstance = AnyVec2Instance | AnyVec3Instance | AnyVec4Instance;
|
571
594
|
interface matBase<TColumn> extends NumberArrayView {
|
595
|
+
readonly [$internal]: true;
|
572
596
|
readonly columns: readonly TColumn[];
|
573
597
|
}
|
574
598
|
/**
|
@@ -626,6 +650,7 @@ type vBaseForMat<T extends AnyMatInstance> = T extends m2x2f ? v2f : T extends m
|
|
626
650
|
* Cannot be used inside buffers as it is not host-shareable.
|
627
651
|
*/
|
628
652
|
interface Bool {
|
653
|
+
readonly [$internal]: true;
|
629
654
|
readonly type: 'bool';
|
630
655
|
readonly [$repr]: boolean;
|
631
656
|
}
|
@@ -633,8 +658,8 @@ interface Bool {
|
|
633
658
|
* 32-bit float schema representing a single WGSL f32 value.
|
634
659
|
*/
|
635
660
|
interface F32 {
|
661
|
+
readonly [$internal]: true;
|
636
662
|
readonly type: 'f32';
|
637
|
-
/** Type-token, not available at runtime */
|
638
663
|
readonly [$repr]: number;
|
639
664
|
(v: number | boolean): number;
|
640
665
|
}
|
@@ -642,8 +667,8 @@ interface F32 {
|
|
642
667
|
* 16-bit float schema representing a single WGSL f16 value.
|
643
668
|
*/
|
644
669
|
interface F16 {
|
670
|
+
readonly [$internal]: true;
|
645
671
|
readonly type: 'f16';
|
646
|
-
/** Type-token, not available at runtime */
|
647
672
|
readonly [$repr]: number;
|
648
673
|
(v: number | boolean): number;
|
649
674
|
}
|
@@ -651,8 +676,8 @@ interface F16 {
|
|
651
676
|
* Signed 32-bit integer schema representing a single WGSL i32 value.
|
652
677
|
*/
|
653
678
|
interface I32 {
|
679
|
+
readonly [$internal]: true;
|
654
680
|
readonly type: 'i32';
|
655
|
-
/** Type-token, not available at runtime */
|
656
681
|
readonly [$repr]: number;
|
657
682
|
readonly '~memIdent': I32 | Atomic<I32> | DecoratedLocation<I32>;
|
658
683
|
(v: number | boolean): number;
|
@@ -661,8 +686,8 @@ interface I32 {
|
|
661
686
|
* Unsigned 32-bit integer schema representing a single WGSL u32 value.
|
662
687
|
*/
|
663
688
|
interface U32 {
|
689
|
+
readonly [$internal]: true;
|
664
690
|
readonly type: 'u32';
|
665
|
-
/** Type-token, not available at runtime */
|
666
691
|
readonly [$repr]: number;
|
667
692
|
readonly '~memIdent': U32 | Atomic<U32> | DecoratedLocation<U32>;
|
668
693
|
(v: number | boolean): number;
|
@@ -671,8 +696,8 @@ interface U32 {
|
|
671
696
|
* Type of the `d.vec2f` object/function: vector data type schema/constructor
|
672
697
|
*/
|
673
698
|
interface Vec2f {
|
699
|
+
readonly [$internal]: true;
|
674
700
|
readonly type: 'vec2f';
|
675
|
-
/** Type-token, not available at runtime */
|
676
701
|
readonly [$repr]: v2f;
|
677
702
|
(x: number, y: number): v2f;
|
678
703
|
(xy: number): v2f;
|
@@ -683,8 +708,8 @@ interface Vec2f {
|
|
683
708
|
* Type of the `d.vec2h` object/function: vector data type schema/constructor
|
684
709
|
*/
|
685
710
|
interface Vec2h {
|
711
|
+
readonly [$internal]: true;
|
686
712
|
readonly type: 'vec2h';
|
687
|
-
/** Type-token, not available at runtime */
|
688
713
|
readonly [$repr]: v2h;
|
689
714
|
(x: number, y: number): v2h;
|
690
715
|
(xy: number): v2h;
|
@@ -695,8 +720,8 @@ interface Vec2h {
|
|
695
720
|
* Type of the `d.vec2i` object/function: vector data type schema/constructor
|
696
721
|
*/
|
697
722
|
interface Vec2i {
|
723
|
+
readonly [$internal]: true;
|
698
724
|
readonly type: 'vec2i';
|
699
|
-
/** Type-token, not available at runtime */
|
700
725
|
readonly [$repr]: v2i;
|
701
726
|
(x: number, y: number): v2i;
|
702
727
|
(xy: number): v2i;
|
@@ -707,8 +732,8 @@ interface Vec2i {
|
|
707
732
|
* Type of the `d.vec2u` object/function: vector data type schema/constructor
|
708
733
|
*/
|
709
734
|
interface Vec2u {
|
735
|
+
readonly [$internal]: true;
|
710
736
|
readonly type: 'vec2u';
|
711
|
-
/** Type-token, not available at runtime */
|
712
737
|
readonly [$repr]: v2u;
|
713
738
|
(x: number, y: number): v2u;
|
714
739
|
(xy: number): v2u;
|
@@ -720,8 +745,8 @@ interface Vec2u {
|
|
720
745
|
* Cannot be used inside buffers as it is not host-shareable.
|
721
746
|
*/
|
722
747
|
interface Vec2b {
|
748
|
+
readonly [$internal]: true;
|
723
749
|
readonly type: 'vec2<bool>';
|
724
|
-
/** Type-token, not available at runtime */
|
725
750
|
readonly [$repr]: v2b;
|
726
751
|
(x: boolean, y: boolean): v2b;
|
727
752
|
(xy: boolean): v2b;
|
@@ -732,8 +757,8 @@ interface Vec2b {
|
|
732
757
|
* Type of the `d.vec3f` object/function: vector data type schema/constructor
|
733
758
|
*/
|
734
759
|
interface Vec3f {
|
760
|
+
readonly [$internal]: true;
|
735
761
|
readonly type: 'vec3f';
|
736
|
-
/** Type-token, not available at runtime */
|
737
762
|
readonly [$repr]: v3f;
|
738
763
|
(x: number, y: number, z: number): v3f;
|
739
764
|
(xyz: number): v3f;
|
@@ -746,8 +771,8 @@ interface Vec3f {
|
|
746
771
|
* Type of the `d.vec3h` object/function: vector data type schema/constructor
|
747
772
|
*/
|
748
773
|
interface Vec3h {
|
774
|
+
readonly [$internal]: true;
|
749
775
|
readonly type: 'vec3h';
|
750
|
-
/** Type-token, not available at runtime */
|
751
776
|
readonly [$repr]: v3h;
|
752
777
|
(x: number, y: number, z: number): v3h;
|
753
778
|
(xyz: number): v3h;
|
@@ -760,8 +785,8 @@ interface Vec3h {
|
|
760
785
|
* Type of the `d.vec3i` object/function: vector data type schema/constructor
|
761
786
|
*/
|
762
787
|
interface Vec3i {
|
788
|
+
readonly [$internal]: true;
|
763
789
|
readonly type: 'vec3i';
|
764
|
-
/** Type-token, not available at runtime */
|
765
790
|
readonly [$repr]: v3i;
|
766
791
|
(x: number, y: number, z: number): v3i;
|
767
792
|
(xyz: number): v3i;
|
@@ -774,8 +799,8 @@ interface Vec3i {
|
|
774
799
|
* Type of the `d.vec3u` object/function: vector data type schema/constructor
|
775
800
|
*/
|
776
801
|
interface Vec3u {
|
802
|
+
readonly [$internal]: true;
|
777
803
|
readonly type: 'vec3u';
|
778
|
-
/** Type-token, not available at runtime */
|
779
804
|
readonly [$repr]: v3u;
|
780
805
|
(x: number, y: number, z: number): v3u;
|
781
806
|
(xyz: number): v3u;
|
@@ -789,8 +814,8 @@ interface Vec3u {
|
|
789
814
|
* Cannot be used inside buffers as it is not host-shareable.
|
790
815
|
*/
|
791
816
|
interface Vec3b {
|
817
|
+
readonly [$internal]: true;
|
792
818
|
readonly type: 'vec3<bool>';
|
793
|
-
/** Type-token, not available at runtime */
|
794
819
|
readonly [$repr]: v3b;
|
795
820
|
(x: boolean, y: boolean, z: boolean): v3b;
|
796
821
|
(xyz: boolean): v3b;
|
@@ -803,8 +828,8 @@ interface Vec3b {
|
|
803
828
|
* Type of the `d.vec4f` object/function: vector data type schema/constructor
|
804
829
|
*/
|
805
830
|
interface Vec4f {
|
831
|
+
readonly [$internal]: true;
|
806
832
|
readonly type: 'vec4f';
|
807
|
-
/** Type-token, not available at runtime */
|
808
833
|
readonly [$repr]: v4f;
|
809
834
|
(x: number, y: number, z: number, w: number): v4f;
|
810
835
|
(xyzw: number): v4f;
|
@@ -821,8 +846,8 @@ interface Vec4f {
|
|
821
846
|
* Type of the `d.vec4h` object/function: vector data type schema/constructor
|
822
847
|
*/
|
823
848
|
interface Vec4h {
|
849
|
+
readonly [$internal]: true;
|
824
850
|
readonly type: 'vec4h';
|
825
|
-
/** Type-token, not available at runtime */
|
826
851
|
readonly [$repr]: v4h;
|
827
852
|
(x: number, y: number, z: number, w: number): v4h;
|
828
853
|
(xyzw: number): v4h;
|
@@ -839,8 +864,8 @@ interface Vec4h {
|
|
839
864
|
* Type of the `d.vec4i` object/function: vector data type schema/constructor
|
840
865
|
*/
|
841
866
|
interface Vec4i {
|
867
|
+
readonly [$internal]: true;
|
842
868
|
readonly type: 'vec4i';
|
843
|
-
/** Type-token, not available at runtime */
|
844
869
|
readonly [$repr]: v4i;
|
845
870
|
(x: number, y: number, z: number, w: number): v4i;
|
846
871
|
(xyzw: number): v4i;
|
@@ -857,8 +882,8 @@ interface Vec4i {
|
|
857
882
|
* Type of the `d.vec4u` object/function: vector data type schema/constructor
|
858
883
|
*/
|
859
884
|
interface Vec4u {
|
885
|
+
readonly [$internal]: true;
|
860
886
|
readonly type: 'vec4u';
|
861
|
-
/** Type-token, not available at runtime */
|
862
887
|
readonly [$repr]: v4u;
|
863
888
|
(x: number, y: number, z: number, w: number): v4u;
|
864
889
|
(xyzw: number): v4u;
|
@@ -876,8 +901,8 @@ interface Vec4u {
|
|
876
901
|
* Cannot be used inside buffers as it is not host-shareable.
|
877
902
|
*/
|
878
903
|
interface Vec4b {
|
904
|
+
readonly [$internal]: true;
|
879
905
|
readonly type: 'vec4<bool>';
|
880
|
-
/** Type-token, not available at runtime */
|
881
906
|
readonly [$repr]: v4b;
|
882
907
|
(x: boolean, y: boolean, z: boolean, w: boolean): v4b;
|
883
908
|
(xyzw: boolean): v4b;
|
@@ -894,8 +919,8 @@ interface Vec4b {
|
|
894
919
|
* Type of the `d.mat2x2f` object/function: matrix data type schema/constructor
|
895
920
|
*/
|
896
921
|
interface Mat2x2f {
|
922
|
+
readonly [$internal]: true;
|
897
923
|
readonly type: 'mat2x2f';
|
898
|
-
/** Type-token, not available at runtime */
|
899
924
|
readonly [$repr]: m2x2f;
|
900
925
|
(...elements: number[]): m2x2f;
|
901
926
|
(...columns: v2f[]): m2x2f;
|
@@ -905,8 +930,8 @@ interface Mat2x2f {
|
|
905
930
|
* Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
|
906
931
|
*/
|
907
932
|
interface Mat3x3f {
|
933
|
+
readonly [$internal]: true;
|
908
934
|
readonly type: 'mat3x3f';
|
909
|
-
/** Type-token, not available at runtime */
|
910
935
|
readonly [$repr]: m3x3f;
|
911
936
|
(...elements: number[]): m3x3f;
|
912
937
|
(...columns: v3f[]): m3x3f;
|
@@ -916,8 +941,8 @@ interface Mat3x3f {
|
|
916
941
|
* Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
|
917
942
|
*/
|
918
943
|
interface Mat4x4f {
|
944
|
+
readonly [$internal]: true;
|
919
945
|
readonly type: 'mat4x4f';
|
920
|
-
/** Type-token, not available at runtime */
|
921
946
|
readonly [$repr]: m4x4f;
|
922
947
|
(...elements: number[]): m4x4f;
|
923
948
|
(...columns: v4f[]): m4x4f;
|
@@ -931,10 +956,10 @@ interface Mat4x4f {
|
|
931
956
|
* the `byteAlignment` requirement of its elementType.
|
932
957
|
*/
|
933
958
|
interface WgslArray<TElement extends BaseData = BaseData> {
|
959
|
+
readonly [$internal]: true;
|
934
960
|
readonly type: 'array';
|
935
961
|
readonly elementCount: number;
|
936
962
|
readonly elementType: TElement;
|
937
|
-
/** Type-token, not available at runtime */
|
938
963
|
readonly [$repr]: Infer<TElement>[];
|
939
964
|
readonly '~gpuRepr': InferGPU<TElement>[];
|
940
965
|
readonly '~reprPartial': {
|
@@ -943,7 +968,6 @@ interface WgslArray<TElement extends BaseData = BaseData> {
|
|
943
968
|
}[];
|
944
969
|
readonly '~memIdent': WgslArray<MemIdentity<TElement>>;
|
945
970
|
}
|
946
|
-
declare const $structTag: unique symbol;
|
947
971
|
/**
|
948
972
|
* Struct schema constructed via `d.struct` function.
|
949
973
|
*
|
@@ -953,17 +977,15 @@ declare const $structTag: unique symbol;
|
|
953
977
|
*/
|
954
978
|
interface WgslStruct<TProps extends Record<string, BaseData> = Record<string, BaseData>> extends TgpuNamable {
|
955
979
|
(props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;
|
956
|
-
|
980
|
+
readonly [$internal]: true;
|
957
981
|
readonly type: 'struct';
|
958
982
|
readonly label?: string | undefined;
|
959
983
|
readonly propTypes: TProps;
|
960
|
-
readonly [$structTag]: true;
|
961
|
-
/** Type-token, not available at runtime */
|
962
984
|
readonly [$repr]: Prettify<InferRecord<TProps>>;
|
963
985
|
/** Type-token, not available at runtime */
|
964
986
|
readonly '~gpuRepr': Prettify<InferGPURecord<TProps>>;
|
965
987
|
/** Type-token, not available at runtime */
|
966
|
-
readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps
|
988
|
+
readonly '~memIdent': WgslStruct<Prettify<MemIdentityRecord<TProps>>>;
|
967
989
|
/** Type-token, not available at runtime */
|
968
990
|
readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;
|
969
991
|
}
|
@@ -972,39 +994,44 @@ type AddressSpace = 'uniform' | 'storage' | 'workgroup' | 'private' | 'function'
|
|
972
994
|
type Access = 'read' | 'write' | 'read-write';
|
973
995
|
interface Ptr<TAddr extends AddressSpace = AddressSpace, TInner extends BaseData = BaseData, // can also be sampler or texture (╯'□')╯︵ ┻━┻
|
974
996
|
TAccess extends Access = Access> {
|
997
|
+
readonly [$internal]: true;
|
975
998
|
readonly type: 'ptr';
|
976
999
|
readonly inner: TInner;
|
977
1000
|
readonly addressSpace: TAddr;
|
978
1001
|
readonly access: TAccess;
|
979
|
-
/** Type-token, not available at runtime */
|
980
1002
|
readonly [$repr]: Infer<TInner>;
|
981
1003
|
}
|
982
1004
|
/**
|
983
1005
|
* Schema representing the `atomic<...>` WGSL data type.
|
984
1006
|
*/
|
985
1007
|
interface Atomic<TInner extends U32 | I32 = U32 | I32> {
|
1008
|
+
readonly [$internal]: true;
|
986
1009
|
readonly type: 'atomic';
|
987
1010
|
readonly inner: TInner;
|
988
|
-
/** Type-token, not available at runtime */
|
989
1011
|
readonly [$repr]: Infer<TInner>;
|
990
1012
|
readonly '~gpuRepr': TInner extends U32 ? atomicU32 : atomicI32;
|
991
1013
|
readonly '~memIdent': MemIdentity<TInner>;
|
992
1014
|
}
|
993
1015
|
interface atomicU32 {
|
994
|
-
|
1016
|
+
readonly [$internal]: true;
|
1017
|
+
readonly type: 'atomicU32';
|
995
1018
|
}
|
996
1019
|
interface atomicI32 {
|
997
|
-
|
1020
|
+
readonly [$internal]: true;
|
1021
|
+
readonly type: 'atomicI32';
|
998
1022
|
}
|
999
1023
|
interface Align<T extends number> {
|
1024
|
+
readonly [$internal]: true;
|
1000
1025
|
readonly type: '@align';
|
1001
1026
|
readonly value: T;
|
1002
1027
|
}
|
1003
1028
|
interface Size<T extends number> {
|
1029
|
+
readonly [$internal]: true;
|
1004
1030
|
readonly type: '@size';
|
1005
1031
|
readonly value: T;
|
1006
1032
|
}
|
1007
1033
|
interface Location<T extends number> {
|
1034
|
+
readonly [$internal]: true;
|
1008
1035
|
readonly type: '@location';
|
1009
1036
|
readonly value: T;
|
1010
1037
|
}
|
@@ -1012,29 +1039,33 @@ type PerspectiveOrLinearInterpolationType = `${'perspective' | 'linear'}${'' | '
|
|
1012
1039
|
type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;
|
1013
1040
|
type InterpolationType = PerspectiveOrLinearInterpolationType | FlatInterpolationType;
|
1014
1041
|
interface Interpolate<T extends InterpolationType> {
|
1042
|
+
readonly [$internal]: true;
|
1015
1043
|
readonly type: '@interpolate';
|
1016
1044
|
readonly value: T;
|
1017
1045
|
}
|
1018
1046
|
interface Builtin<T extends string> {
|
1047
|
+
readonly [$internal]: true;
|
1019
1048
|
readonly type: '@builtin';
|
1020
1049
|
readonly value: T;
|
1021
1050
|
}
|
1022
1051
|
interface Decorated<TInner extends BaseData = BaseData, TAttribs extends unknown[] = unknown[]> {
|
1052
|
+
readonly [$internal]: true;
|
1023
1053
|
readonly type: 'decorated';
|
1024
1054
|
readonly inner: TInner;
|
1025
1055
|
readonly attribs: TAttribs;
|
1026
|
-
/** Type-token, not available at runtime */
|
1027
1056
|
readonly [$repr]: Infer<TInner>;
|
1028
1057
|
readonly '~gpuRepr': InferGPU<TInner>;
|
1029
1058
|
readonly '~reprPartial': InferPartial<TInner>;
|
1030
1059
|
readonly '~memIdent': TAttribs extends Location<number>[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
|
1031
1060
|
}
|
1032
|
-
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"];
|
1061
|
+
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"];
|
1033
1062
|
type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
|
1034
|
-
type
|
1035
|
-
type
|
1063
|
+
type PerspectiveOrLinearInterpolatableBaseType = F32 | F16 | Vec2f | Vec2h | Vec3f | Vec3h | Vec4f | Vec4h;
|
1064
|
+
type PerspectiveOrLinearInterpolatableData = PerspectiveOrLinearInterpolatableBaseType | Decorated<PerspectiveOrLinearInterpolatableBaseType>;
|
1065
|
+
type FlatInterpolatableAdditionalBaseType = I32 | U32 | Vec2i | Vec2u | Vec3i | Vec3u | Vec4i | Vec4u;
|
1066
|
+
type FlatInterpolatableData = PerspectiveOrLinearInterpolatableData | FlatInterpolatableAdditionalBaseType | Decorated<FlatInterpolatableAdditionalBaseType>;
|
1036
1067
|
type ScalarData = Bool | F32 | F16 | I32 | U32 | AbstractInt | AbstractFloat;
|
1037
|
-
type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b | Mat2x2f | Mat3x3f | Mat4x4f | AnyWgslStruct | WgslArray | Ptr | Atomic | Decorated | AbstractInt | AbstractFloat;
|
1068
|
+
type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b | Mat2x2f | Mat3x3f | Mat4x4f | AnyWgslStruct | WgslArray | Ptr | Atomic | Decorated | AbstractInt | AbstractFloat | Void;
|
1038
1069
|
declare function isWgslData(value: unknown): value is AnyWgslData;
|
1039
1070
|
/**
|
1040
1071
|
* Checks whether passed in value is an array schema,
|
@@ -1085,4 +1116,290 @@ declare function isInterpolateAttrib<T extends Interpolate<InterpolationType>>(v
|
|
1085
1116
|
declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
|
1086
1117
|
declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
|
1087
1118
|
|
1088
|
-
|
1119
|
+
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"];
|
1120
|
+
type VertexFormat = (typeof vertexFormats)[number];
|
1121
|
+
declare const kindToDefaultFormatMap: {
|
1122
|
+
readonly f32: "float32";
|
1123
|
+
readonly vec2f: "float32x2";
|
1124
|
+
readonly vec3f: "float32x3";
|
1125
|
+
readonly vec4f: "float32x4";
|
1126
|
+
readonly f16: "float16";
|
1127
|
+
readonly vec2h: "float16x2";
|
1128
|
+
readonly vec4h: "float16x4";
|
1129
|
+
readonly u32: "uint32";
|
1130
|
+
readonly vec2u: "uint32x2";
|
1131
|
+
readonly vec3u: "uint32x3";
|
1132
|
+
readonly vec4u: "uint32x4";
|
1133
|
+
readonly i32: "sint32";
|
1134
|
+
readonly vec2i: "sint32x2";
|
1135
|
+
readonly vec3i: "sint32x3";
|
1136
|
+
readonly vec4i: "sint32x4";
|
1137
|
+
};
|
1138
|
+
type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;
|
1139
|
+
interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {
|
1140
|
+
readonly format: TFormat;
|
1141
|
+
readonly offset: number;
|
1142
|
+
}
|
1143
|
+
/**
|
1144
|
+
* All vertex attribute formats that can be interpreted as
|
1145
|
+
* an single or multi component u32 in a shader.
|
1146
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
1147
|
+
*/
|
1148
|
+
type U32CompatibleFormats = TgpuVertexAttrib<'uint8'> | TgpuVertexAttrib<'uint8x2'> | TgpuVertexAttrib<'uint8x4'> | TgpuVertexAttrib<'uint16'> | TgpuVertexAttrib<'uint16x2'> | TgpuVertexAttrib<'uint16x4'> | TgpuVertexAttrib<'uint32'> | TgpuVertexAttrib<'uint32x2'> | TgpuVertexAttrib<'uint32x3'> | TgpuVertexAttrib<'uint32x4'>;
|
1149
|
+
/**
|
1150
|
+
* All vertex attribute formats that can be interpreted as
|
1151
|
+
* an single or multi component i32 in a shader.
|
1152
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
1153
|
+
*/
|
1154
|
+
type I32CompatibleFormats = TgpuVertexAttrib<'sint8'> | TgpuVertexAttrib<'sint8x2'> | TgpuVertexAttrib<'sint8x4'> | TgpuVertexAttrib<'sint16'> | TgpuVertexAttrib<'sint16x2'> | TgpuVertexAttrib<'sint16x4'> | TgpuVertexAttrib<'sint32'> | TgpuVertexAttrib<'sint32x2'> | TgpuVertexAttrib<'sint32x3'> | TgpuVertexAttrib<'sint32x4'>;
|
1155
|
+
/**
|
1156
|
+
* All vertex attribute formats that can be interpreted as
|
1157
|
+
* an single or multi component f32 in a shader.
|
1158
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
1159
|
+
*/
|
1160
|
+
type F32CompatibleFormats = TgpuVertexAttrib<'unorm8'> | TgpuVertexAttrib<'unorm8x2'> | TgpuVertexAttrib<'unorm8x4'> | TgpuVertexAttrib<'snorm8'> | TgpuVertexAttrib<'snorm8x2'> | TgpuVertexAttrib<'snorm8x4'> | TgpuVertexAttrib<'unorm16'> | TgpuVertexAttrib<'unorm16x2'> | TgpuVertexAttrib<'unorm16x4'> | TgpuVertexAttrib<'snorm16'> | TgpuVertexAttrib<'snorm16x2'> | TgpuVertexAttrib<'snorm16x4'> | TgpuVertexAttrib<'float16'> | TgpuVertexAttrib<'float16x2'> | TgpuVertexAttrib<'float16x4'> | TgpuVertexAttrib<'float32'> | TgpuVertexAttrib<'float32x2'> | TgpuVertexAttrib<'float32x3'> | TgpuVertexAttrib<'float32x4'> | TgpuVertexAttrib<'unorm10-10-10-2'> | TgpuVertexAttrib<'unorm8x4-bgra'>;
|
1161
|
+
/**
|
1162
|
+
* All vertex attribute formats that can be interpreted as
|
1163
|
+
* a single or multi component f16 in a shader. (same as f32 on the shader side)
|
1164
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
1165
|
+
*/
|
1166
|
+
type F16CompatibleFormats = F32CompatibleFormats;
|
1167
|
+
type KindToAcceptedAttribMap = {
|
1168
|
+
u32: U32CompatibleFormats;
|
1169
|
+
vec2u: U32CompatibleFormats;
|
1170
|
+
vec3u: U32CompatibleFormats;
|
1171
|
+
vec4u: U32CompatibleFormats;
|
1172
|
+
i32: I32CompatibleFormats;
|
1173
|
+
vec2i: I32CompatibleFormats;
|
1174
|
+
vec3i: I32CompatibleFormats;
|
1175
|
+
vec4i: I32CompatibleFormats;
|
1176
|
+
f16: F16CompatibleFormats;
|
1177
|
+
vec2h: F16CompatibleFormats;
|
1178
|
+
vec3h: F16CompatibleFormats;
|
1179
|
+
vec4h: F16CompatibleFormats;
|
1180
|
+
f32: F32CompatibleFormats;
|
1181
|
+
vec2f: F32CompatibleFormats;
|
1182
|
+
vec3f: F32CompatibleFormats;
|
1183
|
+
vec4f: F32CompatibleFormats;
|
1184
|
+
};
|
1185
|
+
|
1186
|
+
type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
|
1187
|
+
interface TgpuVertexFormatData<T extends VertexFormat> {
|
1188
|
+
readonly [$internal]: true;
|
1189
|
+
readonly type: T;
|
1190
|
+
readonly [$repr]: Infer<FormatToWGSLType<T>>;
|
1191
|
+
}
|
1192
|
+
declare const formatToWGSLType: {
|
1193
|
+
readonly uint8: U32;
|
1194
|
+
readonly uint8x2: Vec2u;
|
1195
|
+
readonly uint8x4: Vec4u;
|
1196
|
+
readonly sint8: I32;
|
1197
|
+
readonly sint8x2: Vec2i;
|
1198
|
+
readonly sint8x4: Vec4i;
|
1199
|
+
readonly unorm8: F32;
|
1200
|
+
readonly unorm8x2: Vec2f;
|
1201
|
+
readonly unorm8x4: Vec4f;
|
1202
|
+
readonly snorm8: F32;
|
1203
|
+
readonly snorm8x2: Vec2f;
|
1204
|
+
readonly snorm8x4: Vec4f;
|
1205
|
+
readonly uint16: U32;
|
1206
|
+
readonly uint16x2: Vec2u;
|
1207
|
+
readonly uint16x4: Vec4u;
|
1208
|
+
readonly sint16: I32;
|
1209
|
+
readonly sint16x2: Vec2i;
|
1210
|
+
readonly sint16x4: Vec4i;
|
1211
|
+
readonly unorm16: F32;
|
1212
|
+
readonly unorm16x2: Vec2f;
|
1213
|
+
readonly unorm16x4: Vec4f;
|
1214
|
+
readonly snorm16: F32;
|
1215
|
+
readonly snorm16x2: Vec2f;
|
1216
|
+
readonly snorm16x4: Vec4f;
|
1217
|
+
readonly float16: F32;
|
1218
|
+
readonly float16x2: Vec2f;
|
1219
|
+
readonly float16x4: Vec4f;
|
1220
|
+
readonly float32: F32;
|
1221
|
+
readonly float32x2: Vec2f;
|
1222
|
+
readonly float32x3: Vec3f;
|
1223
|
+
readonly float32x4: Vec4f;
|
1224
|
+
readonly uint32: U32;
|
1225
|
+
readonly uint32x2: Vec2u;
|
1226
|
+
readonly uint32x3: Vec3u;
|
1227
|
+
readonly uint32x4: Vec4u;
|
1228
|
+
readonly sint32: I32;
|
1229
|
+
readonly sint32x2: Vec2i;
|
1230
|
+
readonly sint32x3: Vec3i;
|
1231
|
+
readonly sint32x4: Vec4i;
|
1232
|
+
readonly 'unorm10-10-10-2': Vec4f;
|
1233
|
+
readonly 'unorm8x4-bgra': Vec4f;
|
1234
|
+
};
|
1235
|
+
declare const packedFormats: string[];
|
1236
|
+
type uint8 = TgpuVertexFormatData<'uint8'>;
|
1237
|
+
declare const uint8: uint8;
|
1238
|
+
type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
|
1239
|
+
declare const uint8x2: uint8x2;
|
1240
|
+
type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
|
1241
|
+
declare const uint8x4: uint8x4;
|
1242
|
+
type sint8 = TgpuVertexFormatData<'sint8'>;
|
1243
|
+
declare const sint8: sint8;
|
1244
|
+
type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
|
1245
|
+
declare const sint8x2: sint8x2;
|
1246
|
+
type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
|
1247
|
+
declare const sint8x4: sint8x4;
|
1248
|
+
type unorm8 = TgpuVertexFormatData<'unorm8'>;
|
1249
|
+
declare const unorm8: unorm8;
|
1250
|
+
type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
|
1251
|
+
declare const unorm8x2: unorm8x2;
|
1252
|
+
type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
|
1253
|
+
declare const unorm8x4: unorm8x4;
|
1254
|
+
type snorm8 = TgpuVertexFormatData<'snorm8'>;
|
1255
|
+
declare const snorm8: snorm8;
|
1256
|
+
type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
|
1257
|
+
declare const snorm8x2: snorm8x2;
|
1258
|
+
type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
|
1259
|
+
declare const snorm8x4: snorm8x4;
|
1260
|
+
type uint16 = TgpuVertexFormatData<'uint16'>;
|
1261
|
+
declare const uint16: uint16;
|
1262
|
+
type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
|
1263
|
+
declare const uint16x2: uint16x2;
|
1264
|
+
type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
|
1265
|
+
declare const uint16x4: uint16x4;
|
1266
|
+
type sint16 = TgpuVertexFormatData<'sint16'>;
|
1267
|
+
declare const sint16: sint16;
|
1268
|
+
type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
|
1269
|
+
declare const sint16x2: sint16x2;
|
1270
|
+
type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
|
1271
|
+
declare const sint16x4: sint16x4;
|
1272
|
+
type unorm16 = TgpuVertexFormatData<'unorm16'>;
|
1273
|
+
declare const unorm16: unorm16;
|
1274
|
+
type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
|
1275
|
+
declare const unorm16x2: unorm16x2;
|
1276
|
+
type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
|
1277
|
+
declare const unorm16x4: unorm16x4;
|
1278
|
+
type snorm16 = TgpuVertexFormatData<'snorm16'>;
|
1279
|
+
declare const snorm16: snorm16;
|
1280
|
+
type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
|
1281
|
+
declare const snorm16x2: snorm16x2;
|
1282
|
+
type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
|
1283
|
+
declare const snorm16x4: snorm16x4;
|
1284
|
+
type float16 = TgpuVertexFormatData<'float16'>;
|
1285
|
+
declare const float16: float16;
|
1286
|
+
type float16x2 = TgpuVertexFormatData<'float16x2'>;
|
1287
|
+
declare const float16x2: float16x2;
|
1288
|
+
type float16x4 = TgpuVertexFormatData<'float16x4'>;
|
1289
|
+
declare const float16x4: float16x4;
|
1290
|
+
type float32 = TgpuVertexFormatData<'float32'>;
|
1291
|
+
declare const float32: float32;
|
1292
|
+
type float32x2 = TgpuVertexFormatData<'float32x2'>;
|
1293
|
+
declare const float32x2: float32x2;
|
1294
|
+
type float32x3 = TgpuVertexFormatData<'float32x3'>;
|
1295
|
+
declare const float32x3: float32x3;
|
1296
|
+
type float32x4 = TgpuVertexFormatData<'float32x4'>;
|
1297
|
+
declare const float32x4: float32x4;
|
1298
|
+
type uint32 = TgpuVertexFormatData<'uint32'>;
|
1299
|
+
declare const uint32: uint32;
|
1300
|
+
type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
|
1301
|
+
declare const uint32x2: uint32x2;
|
1302
|
+
type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
|
1303
|
+
declare const uint32x3: uint32x3;
|
1304
|
+
type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
|
1305
|
+
declare const uint32x4: uint32x4;
|
1306
|
+
type sint32 = TgpuVertexFormatData<'sint32'>;
|
1307
|
+
declare const sint32: sint32;
|
1308
|
+
type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
|
1309
|
+
declare const sint32x2: sint32x2;
|
1310
|
+
type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
|
1311
|
+
declare const sint32x3: sint32x3;
|
1312
|
+
type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
|
1313
|
+
declare const sint32x4: sint32x4;
|
1314
|
+
type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
|
1315
|
+
declare const unorm10_10_10_2: unorm10_10_10_2;
|
1316
|
+
type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
|
1317
|
+
declare const unorm8x4_bgra: unorm8x4_bgra;
|
1318
|
+
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;
|
1319
|
+
|
1320
|
+
type TgpuDualFn<TImpl extends (...args: unknown[]) => unknown> = TImpl & {
|
1321
|
+
[$internal]: true;
|
1322
|
+
};
|
1323
|
+
/**
|
1324
|
+
* Array schema constructed via `d.disarrayOf` function.
|
1325
|
+
*
|
1326
|
+
* Useful for defining vertex buffers.
|
1327
|
+
* Elements in the schema are not aligned in respect to their `byteAlignment`,
|
1328
|
+
* unless they are explicitly decorated with the custom align attribute
|
1329
|
+
* via `d.align` function.
|
1330
|
+
*/
|
1331
|
+
interface Disarray<TElement extends BaseData = BaseData> {
|
1332
|
+
readonly [$internal]: true;
|
1333
|
+
readonly type: 'disarray';
|
1334
|
+
readonly elementCount: number;
|
1335
|
+
readonly elementType: TElement;
|
1336
|
+
readonly [$repr]: Infer<TElement>[];
|
1337
|
+
readonly '~reprPartial': {
|
1338
|
+
idx: number;
|
1339
|
+
value: InferPartial<TElement>;
|
1340
|
+
}[];
|
1341
|
+
}
|
1342
|
+
/**
|
1343
|
+
* Struct schema constructed via `d.unstruct` function.
|
1344
|
+
*
|
1345
|
+
* Useful for defining vertex buffers, as the standard layout restrictions do not apply.
|
1346
|
+
* Members are not aligned in respect to their `byteAlignment`,
|
1347
|
+
* unless they are explicitly decorated with the custom align attribute
|
1348
|
+
* via `d.align` function.
|
1349
|
+
*/
|
1350
|
+
interface Unstruct<TProps extends Record<string, BaseData> = Record<string, BaseData>> extends TgpuNamable {
|
1351
|
+
readonly [$internal]: true;
|
1352
|
+
(props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;
|
1353
|
+
readonly label?: string | undefined;
|
1354
|
+
readonly type: 'unstruct';
|
1355
|
+
readonly propTypes: TProps;
|
1356
|
+
readonly [$repr]: Prettify<InferRecord<TProps>>;
|
1357
|
+
readonly '~gpuRepr': Prettify<InferGPURecord<TProps>>;
|
1358
|
+
readonly '~memIdent': Unstruct<Prettify<MemIdentityRecord<TProps>>>;
|
1359
|
+
readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;
|
1360
|
+
}
|
1361
|
+
type AnyUnstruct = Unstruct<any>;
|
1362
|
+
interface LooseDecorated<TInner extends BaseData = BaseData, TAttribs extends unknown[] = unknown[]> {
|
1363
|
+
readonly [$internal]: true;
|
1364
|
+
readonly type: 'loose-decorated';
|
1365
|
+
readonly inner: TInner;
|
1366
|
+
readonly attribs: TAttribs;
|
1367
|
+
readonly [$repr]: Infer<TInner>;
|
1368
|
+
}
|
1369
|
+
declare const looseTypeLiterals: readonly ["unstruct", "disarray", "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"];
|
1370
|
+
type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
|
1371
|
+
type AnyLooseData = Disarray | AnyUnstruct | LooseDecorated | PackedData;
|
1372
|
+
declare function isLooseData(data: unknown): data is AnyLooseData;
|
1373
|
+
/**
|
1374
|
+
* Checks whether the passed in value is a disarray schema,
|
1375
|
+
* as opposed to, e.g., a regular array schema.
|
1376
|
+
*
|
1377
|
+
* Array schemas can be used to describe uniform and storage buffers,
|
1378
|
+
* whereas disarray schemas cannot. Disarrays are useful for
|
1379
|
+
* defining vertex buffers instead.
|
1380
|
+
*
|
1381
|
+
* @example
|
1382
|
+
* isDisarray(d.arrayOf(d.u32, 4)) // false
|
1383
|
+
* isDisarray(d.disarrayOf(d.u32, 4)) // true
|
1384
|
+
* isDisarray(d.vec3f) // false
|
1385
|
+
*/
|
1386
|
+
declare function isDisarray<T extends Disarray>(schema: T | unknown): schema is T;
|
1387
|
+
/**
|
1388
|
+
* Checks whether passed in value is a unstruct schema,
|
1389
|
+
* as opposed to, e.g., a struct schema.
|
1390
|
+
*
|
1391
|
+
* Struct schemas can be used to describe uniform and storage buffers,
|
1392
|
+
* whereas unstruct schemas cannot. Unstructs are useful for
|
1393
|
+
* defining vertex buffers instead.
|
1394
|
+
*
|
1395
|
+
* @example
|
1396
|
+
* isUnstruct(d.struct({ a: d.u32 })) // false
|
1397
|
+
* isUnstruct(d.unstruct({ a: d.u32 })) // true
|
1398
|
+
* isUnstruct(d.vec3f) // false
|
1399
|
+
*/
|
1400
|
+
declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is T;
|
1401
|
+
declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
|
1402
|
+
declare function isData(value: unknown): value is AnyData;
|
1403
|
+
type AnyData = AnyWgslData | AnyLooseData;
|
1404
|
+
|
1405
|
+
export { $internal as $, type AnyWgslData as A, type BaseData as B, type Default as C, type Decorated as D, type InferGPU as E, type F32 as F, type AnyVecInstance as G, type AnyMatInstance as H, type Infer as I, type Bool as J, type KindToDefaultFormatMap as K, type Location as L, type Mutable as M, type Ptr as N, type OmitProps as O, type Prettify as P, type Vec2b as Q, type Vec3b as R, type Vec4b as S, type TgpuNamable as T, type U32 as U, type Vec2f as V, type WgslStruct as W, type Unstruct as X, type Mat2x2f as Y, type Mat3x3f as Z, type Mat4x4f as _, type F16 as a, float16 as a$, type m2x2f as a0, type m3x3f as a1, type m4x4f as a2, type Atomic as a3, isWgslData as a4, isWgslArray as a5, isWgslStruct as a6, isPtr as a7, isAtomic as a8, isDecorated as a9, type TgpuVertexFormatData as aA, formatToWGSLType as aB, packedFormats as aC, uint8 as aD, uint8x2 as aE, uint8x4 as aF, sint8 as aG, sint8x2 as aH, sint8x4 as aI, unorm8 as aJ, unorm8x2 as aK, unorm8x4 as aL, snorm8 as aM, snorm8x2 as aN, snorm8x4 as aO, uint16 as aP, uint16x2 as aQ, uint16x4 as aR, sint16 as aS, sint16x2 as aT, sint16x4 as aU, unorm16 as aV, unorm16x2 as aW, unorm16x4 as aX, snorm16 as aY, snorm16x2 as aZ, snorm16x4 as a_, isAlignAttrib as aa, isBuiltinAttrib as ab, isLocationAttrib as ac, isInterpolateAttrib as ad, isSizeAttrib as ae, type Size as af, type Align as ag, type Builtin as ah, type Interpolate as ai, type v2f as aj, type v2i as ak, type v2u as al, type v3f as am, type v3i as an, type v3u as ao, type v4f as ap, type v4i as aq, type v4u as ar, type LooseDecorated as as, type AnyLooseData as at, isDisarray as au, isUnstruct as av, isLooseDecorated as aw, isData as ax, isLooseData as ay, type FormatToWGSLType as az, type I32 as b, float16x2 as b0, float16x4 as b1, float32 as b2, float32x2 as b3, float32x3 as b4, float32x4 as b5, uint32 as b6, uint32x2 as b7, uint32x3 as b8, uint32x4 as b9, type atomicU32 as bA, sint32 as ba, sint32x2 as bb, sint32x3 as bc, sint32x4 as bd, unorm10_10_10_2 as be, unorm8x4_bgra as bf, type PackedData as bg, type InterpolationType as bh, type LooseTypeLiteral as bi, type PerspectiveOrLinearInterpolationType as bj, type PerspectiveOrLinearInterpolatableData as bk, type FlatInterpolationType as bl, type FlatInterpolatableData as bm, type TgpuDualFn as bn, type AnyNumericVecInstance as bo, type vBaseForMat as bp, type AnyFloatVecInstance as bq, type v3h as br, type AnyVec2Instance as bs, type v2b as bt, type AnyVec3Instance as bu, type v3b as bv, type v4b as bw, type AnyBooleanVecInstance as bx, type ScalarData as by, type atomicI32 as bz, type Vec3f as c, type Vec4f as d, type Vec2h as e, type Vec3h as f, type Vec4h as g, type Vec2i as h, type Vec3i as i, type Vec4i as j, type Vec2u as k, type Vec3u as l, type Vec4u as m, type AnyWgslStruct as n, $repr as o, type WgslArray as p, type Disarray as q, type AnyUnstruct as r, type VertexFormat as s, type TgpuVertexAttrib as t, type KindToAcceptedAttribMap as u, type AnyData as v, type WgslTypeLiteral as w, type UnionToIntersection as x, type InferPartial as y, type MemIdentity as z };
|