@zephyr3d/device 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/base_types.js +7 -66
  3. package/dist/base_types.js.map +1 -1
  4. package/dist/builder/ast.js +121 -118
  5. package/dist/builder/ast.js.map +1 -1
  6. package/dist/builder/base.js +29 -25
  7. package/dist/builder/base.js.map +1 -1
  8. package/dist/builder/builtinfunc.js +62 -19
  9. package/dist/builder/builtinfunc.js.map +1 -1
  10. package/dist/builder/constructors.js +1 -1
  11. package/dist/builder/constructors.js.map +1 -1
  12. package/dist/builder/errors.js +7 -7
  13. package/dist/builder/errors.js.map +1 -1
  14. package/dist/builder/misc.js +10 -0
  15. package/dist/builder/misc.js.map +1 -0
  16. package/dist/builder/programbuilder.js +65 -34
  17. package/dist/builder/programbuilder.js.map +1 -1
  18. package/dist/builder/reflection.js.map +1 -1
  19. package/dist/builder/types.js +74 -74
  20. package/dist/builder/types.js.map +1 -1
  21. package/dist/device.js +72 -43
  22. package/dist/device.js.map +1 -1
  23. package/dist/gpuobject.js +82 -24
  24. package/dist/gpuobject.js.map +1 -1
  25. package/dist/helpers/drawtext.js +1 -0
  26. package/dist/helpers/drawtext.js.map +1 -1
  27. package/dist/helpers/font.js +1 -0
  28. package/dist/helpers/font.js.map +1 -1
  29. package/dist/helpers/glyphmanager.js +7 -7
  30. package/dist/helpers/glyphmanager.js.map +1 -1
  31. package/dist/helpers/textureatlas.js +3 -5
  32. package/dist/helpers/textureatlas.js.map +1 -1
  33. package/dist/index.d.ts +267 -204
  34. package/dist/index.js +6 -5
  35. package/dist/index.js.map +1 -1
  36. package/dist/pool.js +102 -45
  37. package/dist/pool.js.map +1 -1
  38. package/dist/timer.js.map +1 -1
  39. package/dist/uniformdata.js +2 -2
  40. package/dist/uniformdata.js.map +1 -1
  41. package/dist/vertexdata.js +27 -1
  42. package/dist/vertexdata.js.map +1 -1
  43. package/package.json +31 -19
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TypedArray, IEventTarget, CubeFace, VectorBase, Vector4 } from '@zephyr3d/base';
1
+ import { TypedArray, IDisposable, CubeFace, VectorBase, MaybeArray, IEventTarget, Vector4, Observable } from '@zephyr3d/base';
2
2
 
3
3
  /**
4
4
  * Struct layout types
@@ -291,7 +291,7 @@ declare class PBVoidTypeInfo extends PBTypeInfo<null> {
291
291
  /** {@inheritDoc PBTypeInfo.isVoidType} */
292
292
  isVoidType(): this is PBVoidTypeInfo;
293
293
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
294
- toBufferLayout(offset: number): UniformBufferLayout;
294
+ toBufferLayout(_offset: number): UniformBufferLayout;
295
295
  }
296
296
  /**
297
297
  * The void type info
@@ -302,9 +302,9 @@ declare class PBAnyTypeInfo extends PBTypeInfo<null> {
302
302
  /** {@inheritDoc PBTypeInfo.isAnyType} */
303
303
  isAnyType(): this is PBAnyTypeInfo;
304
304
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
305
- toBufferLayout(offset: number): UniformBufferLayout;
305
+ toBufferLayout(_offset: number): UniformBufferLayout;
306
306
  /** {@inheritDoc PBTypeInfo.isCompatibleType} */
307
- isCompatibleType(other: PBTypeInfo<TypeDetailInfo>): boolean;
307
+ isCompatibleType(_other: PBTypeInfo<TypeDetailInfo>): boolean;
308
308
  }
309
309
  /**
310
310
  * The primitive type info
@@ -342,7 +342,7 @@ declare class PBPrimitiveTypeInfo extends PBTypeInfo<PrimitiveTypeDetail> {
342
342
  /** {@inheritDoc PBTypeInfo.isPrimitiveType} */
343
343
  isPrimitiveType(): this is PBPrimitiveTypeInfo;
344
344
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
345
- toBufferLayout(offset: number): UniformBufferLayout;
345
+ toBufferLayout(_offset: number): UniformBufferLayout;
346
346
  }
347
347
  /**
348
348
  * The struct type info
@@ -363,7 +363,7 @@ declare class PBStructTypeInfo extends PBTypeInfo<StructTypeDetail> {
363
363
  /** Name of the struct member */
364
364
  name: string;
365
365
  /** Type of the struct member */
366
- type: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAtomicI32TypeInfo | PBAtomicU32TypeInfo;
366
+ type: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBAtomicI32TypeInfo | PBAtomicU32TypeInfo | PBStructTypeInfo;
367
367
  /** Alignment of the struct member */
368
368
  alignment: number;
369
369
  /** Byte size of the struct member */
@@ -405,7 +405,7 @@ declare class PBArrayTypeInfo extends PBTypeInfo<ArrayTypeDetail> {
405
405
  /** {@inheritDoc PBTypeInfo.isArrayType} */
406
406
  isArrayType(): this is PBArrayTypeInfo;
407
407
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
408
- toBufferLayout(offset: number): UniformBufferLayout;
408
+ toBufferLayout(_offset: number): UniformBufferLayout;
409
409
  isCompatibleType(other: PBTypeInfo<TypeDetailInfo>): boolean;
410
410
  }
411
411
  /**
@@ -424,7 +424,7 @@ declare class PBPointerTypeInfo extends PBTypeInfo<PointerTypeDetail> {
424
424
  /** {@inheritDoc PBTypeInfo.isPointerType} */
425
425
  isPointerType(): this is PBPointerTypeInfo;
426
426
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
427
- toBufferLayout(offset: number): UniformBufferLayout;
427
+ toBufferLayout(_offset: number): UniformBufferLayout;
428
428
  }
429
429
  /**
430
430
  * The atomic int type info
@@ -435,7 +435,7 @@ declare class PBAtomicI32TypeInfo extends PBTypeInfo<null> {
435
435
  /** {@inheritDoc PBTypeInfo.isPointerType} */
436
436
  haveAtomicMembers(): boolean;
437
437
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
438
- toBufferLayout(offset: number): UniformBufferLayout;
438
+ toBufferLayout(_offset: number): UniformBufferLayout;
439
439
  }
440
440
  /**
441
441
  * The atomic int type info
@@ -446,7 +446,7 @@ declare class PBAtomicU32TypeInfo extends PBTypeInfo<null> {
446
446
  /** {@inheritDoc PBTypeInfo.isPointerType} */
447
447
  haveAtomicMembers(): boolean;
448
448
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
449
- toBufferLayout(offset: number): UniformBufferLayout;
449
+ toBufferLayout(_offset: number): UniformBufferLayout;
450
450
  }
451
451
  /**
452
452
  * The sampler type info
@@ -457,7 +457,7 @@ declare class PBSamplerTypeInfo extends PBTypeInfo<SamplerTypeDetail> {
457
457
  /** Get the access mode */
458
458
  get accessMode(): PBSamplerAccessMode;
459
459
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
460
- toBufferLayout(offset: number): UniformBufferLayout;
460
+ toBufferLayout(_offset: number): UniformBufferLayout;
461
461
  }
462
462
  /**
463
463
  * The texture type info
@@ -496,7 +496,7 @@ declare class PBTextureTypeInfo extends PBTypeInfo<TextureTypeDetail> {
496
496
  /** Returns true if the texture format is of type unsigned integer */
497
497
  isUIntTexture(): boolean;
498
498
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
499
- toBufferLayout(offset: number): UniformBufferLayout;
499
+ toBufferLayout(_offset: number): UniformBufferLayout;
500
500
  }
501
501
  /**
502
502
  * The function type info
@@ -519,7 +519,7 @@ declare class PBFunctionTypeInfo extends PBTypeInfo<FunctionTypeDetail> {
519
519
  /** Get hash for parameter types */
520
520
  get argHash(): string;
521
521
  /** {@inheritDoc PBTypeInfo.toBufferLayout} */
522
- toBufferLayout(offset: number): UniformBufferLayout;
522
+ toBufferLayout(_offset: number): UniformBufferLayout;
523
523
  }
524
524
 
525
525
  /**
@@ -548,7 +548,9 @@ declare class VertexData {
548
548
  /** Vertex buffer information list */
549
549
  get vertexBuffers(): VertexBufferInfo[];
550
550
  /** Index buffer */
551
- get indexBuffer(): IndexBuffer<unknown>;
551
+ get indexBuffer(): IndexBuffer;
552
+ /** Number of vertices */
553
+ get numVertices(): number;
552
554
  /** Draw offset */
553
555
  getDrawOffset(): number;
554
556
  setDrawOffset(offset: number): void;
@@ -595,6 +597,40 @@ declare class VertexData {
595
597
  * @public
596
598
  */
597
599
  type TextureImageElement = ImageBitmap | HTMLCanvasElement;
600
+ /** @public */
601
+ declare const MAX_VERTEX_ATTRIBUTES = 16;
602
+ /** @public */
603
+ declare const MAX_BINDING_GROUPS = 4;
604
+ /** @public */
605
+ declare const MAX_TEXCOORD_INDEX_COUNT = 8;
606
+ /** @public */
607
+ declare const VERTEX_ATTRIB_POSITION = 0;
608
+ /** @public */
609
+ declare const VERTEX_ATTRIB_NORMAL = 1;
610
+ /** @public */
611
+ declare const VERTEX_ATTRIB_DIFFUSE = 2;
612
+ /** @public */
613
+ declare const VERTEX_ATTRIB_TANGENT = 3;
614
+ /** @public */
615
+ declare const VERTEX_ATTRIB_TEXCOORD0 = 4;
616
+ /** @public */
617
+ declare const VERTEX_ATTRIB_TEXCOORD1 = 5;
618
+ /** @public */
619
+ declare const VERTEX_ATTRIB_TEXCOORD2 = 6;
620
+ /** @public */
621
+ declare const VERTEX_ATTRIB_TEXCOORD3 = 7;
622
+ /** @public */
623
+ declare const VERTEX_ATTRIB_TEXCOORD4 = 8;
624
+ /** @public */
625
+ declare const VERTEX_ATTRIB_TEXCOORD5 = 9;
626
+ /** @public */
627
+ declare const VERTEX_ATTRIB_TEXCOORD6 = 10;
628
+ /** @public */
629
+ declare const VERTEX_ATTRIB_TEXCOORD7 = 11;
630
+ /** @public */
631
+ declare const VERTEX_ATTRIB_BLEND_WEIGHT = 12;
632
+ /** @public */
633
+ declare const VERTEX_ATTRIB_BLEND_INDICES = 13;
598
634
  /**
599
635
  * The vertex format types
600
636
  * @public
@@ -614,14 +650,7 @@ type VertexLayoutOptions = {
614
650
  * vertex buffers in this vertex layout
615
651
  */
616
652
  vertexBuffers: {
617
- /**
618
- * vertex buffer object created by device
619
- */
620
653
  buffer: StructuredBuffer;
621
- /**
622
- * the vertex buffer step mode,
623
- * value can be 'vertex' or 'instance', default is 'vertex'
624
- */
625
654
  stepMode?: VertexStepMode;
626
655
  }[];
627
656
  /**
@@ -638,7 +667,7 @@ type TextureColorSpace = 'srgb' | 'linear';
638
667
  * Buffer usage type
639
668
  * @public
640
669
  */
641
- type BufferUsage = 'vertex' | 'index' | 'uniform' | 'read' | 'write';
670
+ type BufferUsage = 'vertex' | 'index' | 'uniform' | 'read' | 'write' | 'pack-pixel' | 'unpack-pixel';
642
671
  /**
643
672
  * Common options for createing texture or buffer
644
673
  * @public
@@ -656,6 +685,7 @@ interface BaseCreationOptions {
656
685
  interface TextureCreationOptions extends BaseCreationOptions {
657
686
  writable?: boolean;
658
687
  texture?: BaseTexture;
688
+ mipmapping?: boolean;
659
689
  samplerOptions?: SamplerOptions;
660
690
  }
661
691
  /**
@@ -685,8 +715,10 @@ declare enum GPUResourceUsageFlags {
685
715
  BF_WRITE = 256,
686
716
  BF_UNIFORM = 512,
687
717
  BF_STORAGE = 1024,
688
- DYNAMIC = 2048,
689
- MANAGED = 4096
718
+ BF_PACK_PIXEL = 2048,
719
+ BF_UNPACK_PIXEL = 4096,
720
+ DYNAMIC = 8192,
721
+ MANAGED = 16384
690
722
  }
691
723
  /**
692
724
  * Get vertex attribute index by semantic
@@ -698,13 +730,40 @@ declare function getVertexAttribByName(name: VertexSemantic): number;
698
730
  * @public
699
731
  */
700
732
  declare function getVertexAttribName(attrib: number): VertexSemantic;
733
+ /**
734
+ * Test whether a vertex buffer matches given semantic
735
+ * @param buffer - Vertex buffer
736
+ * @param name - Semantic to test
737
+ * @returns true if the vertex buffer matches given semantic, otherwise false
738
+ *
739
+ * @public
740
+ */
741
+ declare function matchVertexBuffer(buffer: StructuredBuffer, name: VertexSemantic): boolean;
742
+ /**
743
+ * Get vertex attribute type of specified vertex format
744
+ * @param fmt - The vertex format
745
+ * @returns Vertex attribute type, possible values are 'f32', 'f16', 'i32', 'u32', 'i16', 'u16', 'i8norm', 'u8norm', 'i16norm', 'u16norm'
746
+ *
747
+ * @public
748
+ */
749
+ declare function getVertexAttributeFormat(fmt: VertexAttribFormat): "f32" | "i32" | "u32" | "u8norm" | "i8norm" | "u16" | "i16" | "u16norm" | "i16norm" | "f16";
750
+ /**
751
+ * Get vertex attribute index of specified vertex format
752
+ * @param fmt - The vertex format
753
+ * @returns Vertex attribute index
754
+ *
755
+ * @public
756
+ */
757
+ declare function getVertexAttributeIndex(fmt: VertexAttribFormat): number;
701
758
  /**
702
759
  * Get byte size of specified vertex format
760
+ *
703
761
  * @public
704
762
  */
705
763
  declare function getVertexFormatSize(fmt: VertexAttribFormat): number;
706
764
  /**
707
765
  * Get number of components of specified vertex format
766
+ *
708
767
  * @public
709
768
  */
710
769
  declare function getVertexFormatComponentCount(fmt: VertexAttribFormat): number;
@@ -714,6 +773,7 @@ declare function getVertexFormatComponentCount(fmt: VertexAttribFormat): number;
714
773
  * @param type - Data type of vertex component
715
774
  * @param count - The count of vertex components
716
775
  * @returns Vertex format
776
+ *
717
777
  * @public
718
778
  */
719
779
  declare function getVertexAttribFormat(semantic: VertexSemantic, type: DataType, count: number): VertexAttribFormat;
@@ -721,6 +781,7 @@ declare function getVertexAttribFormat(semantic: VertexSemantic, type: DataType,
721
781
  * Get the length of a vertex buffer by specified structure type of the vertex buffer
722
782
  * @param vertexBufferType - The structure type of the vertex buffer
723
783
  * @returns The length of the vertex buffer
784
+ *
724
785
  * @public
725
786
  */
726
787
  declare function getVertexBufferLength(vertexBufferType: PBStructTypeInfo): number;
@@ -728,6 +789,7 @@ declare function getVertexBufferLength(vertexBufferType: PBStructTypeInfo): numb
728
789
  * Get byte stride of a vertex buffer by specified structure type of the vertex buffer
729
790
  * @param vertexBufferType - The structure type of the vertex buffer
730
791
  * @returns The byte stride of the vertex buffer
792
+ *
731
793
  * @public
732
794
  */
733
795
  declare function getVertexBufferStride(vertexBufferType: PBStructTypeInfo): number;
@@ -736,6 +798,7 @@ declare function getVertexBufferStride(vertexBufferType: PBStructTypeInfo): numb
736
798
  * @param vertexBufferType - The structure type of the vertex buffer
737
799
  * @param semantic - The vertex semantic
738
800
  * @returns - The primitive type of the vertex attribute
801
+ *
739
802
  * @public
740
803
  */
741
804
  declare function getVertexBufferAttribTypeBySemantic(vertexBufferType: PBStructTypeInfo, semantic: VertexSemantic): PBPrimitiveTypeInfo;
@@ -744,6 +807,7 @@ declare function getVertexBufferAttribTypeBySemantic(vertexBufferType: PBStructT
744
807
  * @param vertexBufferType - The structure type of the vertex buffer
745
808
  * @param semantic - The vertex attribute index
746
809
  * @returns - The primitive type of the vertex attribute
810
+ *
747
811
  * @public
748
812
  */
749
813
  declare function getVertexBufferAttribType(vertexBufferType: PBStructTypeInfo, attrib: number): PBPrimitiveTypeInfo;
@@ -752,16 +816,19 @@ declare function getVertexBufferAttribType(vertexBufferType: PBStructTypeInfo, a
752
816
  * @param length - The length of the vertex buffer
753
817
  * @param attributes - The vertex attributes
754
818
  * @returns The structure type of the vertex buffer
819
+ *
755
820
  * @public
756
821
  */
757
822
  declare function makeVertexBufferType(length: number, ...attributes: VertexAttribFormat[]): PBStructTypeInfo;
758
823
  /**
759
824
  * Vertex step mode.
825
+ *
760
826
  * @public
761
827
  */
762
828
  type VertexStepMode = 'vertex' | 'instance';
763
829
  /**
764
830
  * Vertex semantic list
831
+ *
765
832
  * @public
766
833
  */
767
834
  declare const semanticList: string[];
@@ -909,7 +976,7 @@ interface StorageTextureBindingLayout {
909
976
  /** The texture format */
910
977
  format: TextureFormat;
911
978
  /** View dimension */
912
- viewDimension: '1d' | '2d';
979
+ viewDimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
913
980
  }
914
981
  /**
915
982
  * Binding layout of an external texture
@@ -984,9 +1051,7 @@ interface SamplerOptions {
984
1051
  * Base class for a GPU object
985
1052
  * @public
986
1053
  */
987
- interface GPUObject<T = unknown> extends IEventTarget<{
988
- disposed: null;
989
- }> {
1054
+ interface GPUObject<T = unknown> extends IDisposable {
990
1055
  /** The object was created by which device */
991
1056
  readonly device: AbstractDevice;
992
1057
  /** The internal GPU object */
@@ -996,7 +1061,7 @@ interface GPUObject<T = unknown> extends IEventTarget<{
996
1061
  readonly cid: number;
997
1062
  readonly disposed: boolean;
998
1063
  name: string;
999
- restoreHandler: (tex: GPUObject) => Promise<void>;
1064
+ restoreHandler: (tex: GPUObject) => void;
1000
1065
  isVertexLayout(): this is VertexLayout;
1001
1066
  isFramebuffer(): this is FrameBuffer;
1002
1067
  isSampler(): this is TextureSampler;
@@ -1010,9 +1075,9 @@ interface GPUObject<T = unknown> extends IEventTarget<{
1010
1075
  isBuffer(): this is GPUDataBuffer;
1011
1076
  isBindGroup(): this is BindGroup;
1012
1077
  dispose(): void;
1013
- reload(): Promise<void>;
1078
+ reload(): void;
1014
1079
  destroy(): void;
1015
- restore(): Promise<void>;
1080
+ restore(): void;
1016
1081
  }
1017
1082
  /**
1018
1083
  * Abstract interface for texture sampler
@@ -1108,7 +1173,7 @@ interface GPUDataBuffer<T = unknown> extends GPUObject<T> {
1108
1173
  readonly byteLength: number;
1109
1174
  readonly usage: number;
1110
1175
  bufferSubData(dstByteOffset: number, data: TypedArray, srcOffset?: number, srcLength?: number): void;
1111
- getBufferSubData(dstBuffer?: Uint8Array, offsetInBytes?: number, sizeInBytes?: number): Promise<Uint8Array>;
1176
+ getBufferSubData(dstBuffer?: Uint8Array<ArrayBuffer>, offsetInBytes?: number, sizeInBytes?: number): Promise<Uint8Array<ArrayBuffer>>;
1112
1177
  }
1113
1178
  /**
1114
1179
  * Abstract interface for index buffer
@@ -1156,13 +1221,20 @@ interface FrameBuffer<T = unknown> extends GPUObject<T> {
1156
1221
  getSampleCount(): number;
1157
1222
  getHash(): string;
1158
1223
  setColorAttachmentCubeFace(index: number, face: CubeFace): void;
1224
+ getColorAttachmentCubeFace(index: number): CubeFace;
1159
1225
  setColorAttachmentMipLevel(index: number, level: number): void;
1226
+ getColorAttachmentMipLevel(index: number): number;
1160
1227
  setColorAttachmentLayer(index: number, layer: number): void;
1228
+ getColorAttachmentLayer(index: number): number;
1161
1229
  setColorAttachmentGenerateMipmaps(index: number, generateMipmaps: boolean): void;
1230
+ getColorAttachmentGenerateMipmaps(index: number): boolean;
1162
1231
  setDepthAttachmentCubeFace(face: CubeFace): void;
1232
+ getDepthAttachmentCubeFace(): CubeFace;
1163
1233
  setDepthAttachmentLayer(layer: number): void;
1234
+ getDepthAttachmentLayer(): number;
1164
1235
  getColorAttachments(): BaseTexture[];
1165
1236
  getDepthAttachment(): BaseTexture;
1237
+ getColorAttachment<T extends BaseTexture = BaseTexture>(index: number): T;
1166
1238
  bind(): boolean;
1167
1239
  unbind(): void;
1168
1240
  }
@@ -1194,7 +1266,7 @@ interface BindGroup extends GPUObject<unknown> {
1194
1266
  getLayout(): BindGroupLayout;
1195
1267
  getDynamicOffsets(): number[];
1196
1268
  getGPUId(): string;
1197
- getBuffer(name: string): GPUDataBuffer;
1269
+ getBuffer(name: string, nocreate?: boolean): GPUDataBuffer;
1198
1270
  getTexture(name: string): BaseTexture;
1199
1271
  setBuffer(name: string, buffer: GPUDataBuffer, offset?: number, bindOffset?: number, bindSize?: number): void;
1200
1272
  setValue(name: string, value: StructuredValue): any;
@@ -1480,7 +1552,7 @@ interface ProgramBuilder {
1480
1552
  /** Gets the global scope */
1481
1553
  getGlobalScope(): PBGlobalScope;
1482
1554
  /** Gets the current scope */
1483
- getCurrentScope(): PBScope;
1555
+ getCurrentScope<T extends PBScope = PBScope>(): T;
1484
1556
  /**
1485
1557
  * Query the global variable by the name
1486
1558
  * @param name - Name of the variable
@@ -1951,6 +2023,8 @@ interface ProgramBuilder {
1951
2023
  max(x: number | PBShaderExp, y: number | PBShaderExp): PBShaderExp;
1952
2024
  /** Same as clamp builtin function in GLSL and WGSL */
1953
2025
  clamp(x: number | PBShaderExp, y: number | PBShaderExp, z: number | PBShaderExp): PBShaderExp;
2026
+ /** Clamp to [0, 1] */
2027
+ saturate(x: PBShaderExp): PBShaderExp;
1954
2028
  /** Same as mix builtin function in GLSL and WGSL */
1955
2029
  mix(x: number | PBShaderExp, y: number | PBShaderExp, z: number | PBShaderExp): PBShaderExp;
1956
2030
  /** Same as step builtin function in GLSL and WGSL */
@@ -1964,13 +2038,13 @@ interface ProgramBuilder {
1964
2038
  /** add two values */
1965
2039
  add_2(x: number | PBShaderExp, y: number | PBShaderExp): any;
1966
2040
  /** add a couple of values togeter */
1967
- add(x: number | PBShaderExp, ...rest: (number | PBShaderExp)[]): any;
2041
+ add(x: number | PBShaderExp, y: number | PBShaderExp, ...rest: (number | PBShaderExp)[]): any;
1968
2042
  /** subtract two values */
1969
2043
  sub(x: number | PBShaderExp, y: number | PBShaderExp): any;
1970
2044
  /** multiply two values */
1971
2045
  mul_2(x: number | PBShaderExp, y: number | PBShaderExp): any;
1972
2046
  /** multiply a couple of values togeter */
1973
- mul(x: number | PBShaderExp, ...rest: (number | PBShaderExp)[]): any;
2047
+ mul(x: number | PBShaderExp, y: number | PBShaderExp, ...rest: (number | PBShaderExp)[]): any;
1974
2048
  /** divide the first number by the second number */
1975
2049
  div(x: number | PBShaderExp, y: number | PBShaderExp): any;
1976
2050
  /** Same as length builtin function in GLSL and WGSL */
@@ -2239,7 +2313,7 @@ declare class PBLocalScope extends PBScope {
2239
2313
  interface PBBuiltinScope {
2240
2314
  position: PBShaderExp;
2241
2315
  pointSize: PBShaderExp | number;
2242
- fragDepth: PBShaderExp;
2316
+ fragDepth: PBShaderExp | number;
2243
2317
  readonly fragCoord: PBShaderExp;
2244
2318
  readonly frontFacing: PBShaderExp;
2245
2319
  readonly vertexIndex: PBShaderExp;
@@ -2321,7 +2395,7 @@ declare class PBInsideFunctionScope extends PBScope {
2321
2395
  * @param end - end value of the counter exclusive
2322
2396
  * @param body - Generator function for the scope that inside the for statement
2323
2397
  */
2324
- $for(counter: PBShaderExp, init: number | PBShaderExp, end: number | PBShaderExp, body: (this: PBForScope) => void): void;
2398
+ $for(counter: PBShaderExp, init: number | PBShaderExp, end: number | PBShaderExp, open?: boolean | ((this: PBForScope) => void), reverse?: boolean | ((this: PBForScope) => void), body?: (this: PBForScope) => void): void;
2325
2399
  /**
2326
2400
  * Creates a 'do..while' statement
2327
2401
  * @param body - Generator function for the scope that inside the do..while statment
@@ -2334,6 +2408,8 @@ declare class PBInsideFunctionScope extends PBScope {
2334
2408
  * @param body - Generator function for the scope that inside the while statement
2335
2409
  */
2336
2410
  $while(condition: ExpValueNonArrayType, body: (this: PBWhileScope) => void): void;
2411
+ /** Gets main function scope */
2412
+ $getMainScope(): PBFunctionScope;
2337
2413
  }
2338
2414
  /**
2339
2415
  * Scope that insides a function
@@ -2530,6 +2606,10 @@ interface DepthState {
2530
2606
  writeEnabled: boolean;
2531
2607
  /** The comparison function for depth testing */
2532
2608
  compareFunc: CompareFunc;
2609
+ /** Depth bias */
2610
+ depthBias: number;
2611
+ /** Slope scaled depth bias */
2612
+ depthBiasSlopeScale: number;
2533
2613
  /**
2534
2614
  * Enable or disable depth testing
2535
2615
  * @param b - true if enable
@@ -2548,6 +2628,16 @@ interface DepthState {
2548
2628
  * @returns self
2549
2629
  */
2550
2630
  setCompareFunc(func: CompareFunc): this;
2631
+ /**
2632
+ * Sets the depth bias
2633
+ * @param value - Value of the depth bias
2634
+ */
2635
+ setDepthBias(value: number): this;
2636
+ /**
2637
+ * Sets the slope scaled depth bias
2638
+ * @param value - Value of the slope scaled depth bias
2639
+ */
2640
+ setDepthBiasSlopeScale(value: number): this;
2551
2641
  }
2552
2642
  /**
2553
2643
  * Stencil operations
@@ -2718,7 +2808,11 @@ declare class Pool {
2718
2808
  * Creates an instance of Pool class
2719
2809
  * @param device - Rendering device
2720
2810
  */
2721
- constructor(device: AbstractDevice, memCostThreshold?: number);
2811
+ constructor(device: AbstractDevice, id: string | symbol, memCostThreshold?: number);
2812
+ /**
2813
+ * Id for this pool
2814
+ */
2815
+ get id(): string | symbol;
2722
2816
  autoRelease(): void;
2723
2817
  /**
2724
2818
  * Fetch a temporal 2D texture from the object pool.
@@ -2729,7 +2823,7 @@ declare class Pool {
2729
2823
  * @param mipmapping - Whether this texture support mipmapping
2730
2824
  * @returns The fetched Texture2D object.
2731
2825
  */
2732
- fetchTemporalTexture2D(autoRelease: boolean, format: TextureFormat, width: number, height: number, mipmapping: boolean): Texture2D;
2826
+ fetchTemporalTexture2D(autoRelease: boolean, format: TextureFormat, width: number, height: number, mipmapping?: boolean): Texture2D;
2733
2827
  /**
2734
2828
  * Fetch a temporal 2D array texture from the object pool.
2735
2829
  * @param autoRelease - Whether the texture should be automatically released at the next frame.
@@ -2740,7 +2834,7 @@ declare class Pool {
2740
2834
  * @param mipmapping - Whether this texture support mipmapping
2741
2835
  * @returns The fetched Texture2DArray object.
2742
2836
  */
2743
- fetchTemporalTexture2DArray(autoRelease: boolean, format: TextureFormat, width: number, height: number, numLayers: number, mipmapping: boolean): Texture2DArray;
2837
+ fetchTemporalTexture2DArray(autoRelease: boolean, format: TextureFormat, width: number, height: number, numLayers: number, mipmapping?: boolean): Texture2DArray;
2744
2838
  /**
2745
2839
  * Fetch a temporal Cube texture from the object pool.
2746
2840
  * @param autoRelease - Whether the texture should be automatically released at the next frame.
@@ -2749,67 +2843,36 @@ declare class Pool {
2749
2843
  * @param mipmapping - Whether this texture support mipmapping
2750
2844
  * @returns The fetched TextureCube object.
2751
2845
  */
2752
- fetchTemporalTextureCube(autoRelease: boolean, format: TextureFormat, size: number, mipmapping: boolean): TextureCube;
2846
+ fetchTemporalTextureCube(autoRelease: boolean, format: TextureFormat, size: number, mipmapping?: boolean): TextureCube;
2753
2847
  /**
2754
- * Fetch a temporal framebuffer from the object pool.
2755
- * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2756
- * @param colorFormat - Texture format for color attachment.
2757
- * @param depthFormat - Texture format for depth attachment.
2758
- * @param sampleCount - The sample count for the framebuffer.
2759
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2760
- * @returns The fetched FrameBuffer object.
2761
- */
2762
- fetchTemporalFramebuffer(autoRelease: boolean, width: number, height: number, colorFormat: TextureFormat, depthFormat?: TextureFormat, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer;
2763
- /**
2764
- * Fetch a temporal framebuffer from the object pool.
2765
- * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2766
- * @param colorFormat - Texture format for color attachment.
2767
- * @param depthTex - depth attachment.
2768
- * @param sampleCount - The sample count for the framebuffer.
2769
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2770
- * @returns The fetched FrameBuffer object.
2771
- */
2772
- fetchTemporalFramebuffer<T extends BaseTexture<unknown>>(autoRelease: boolean, width: number, height: number, colorFormat: TextureFormat, depthTex?: T, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer;
2773
- /**
2774
- * Fetch a temporal framebuffer from the object pool.
2775
- * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2776
- * @param colorTex - color attachment.
2777
- * @param depthFormat - Texture format for depth attachment.
2778
- * @param sampleCount - The sample count for the framebuffer.
2779
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2780
- * @returns The fetched FrameBuffer object.
2781
- */
2782
- fetchTemporalFramebuffer<T extends BaseTexture<unknown>>(autoRelease: boolean, width: number, height: number, colorTex: T, depthFormat?: TextureFormat, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer;
2783
- /**
2784
- * Fetch a temporal framebuffer from the object pool.
2785
- * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2786
- * @param colorTex - color attachment.
2787
- * @param depthTex - depth attachment.
2788
- * @param sampleCount - The sample count for the framebuffer.
2789
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2790
- * @returns The fetched FrameBuffer object.
2791
- */
2792
- fetchTemporalFramebuffer<T extends BaseTexture<unknown>>(autoRelease: boolean, width: number, height: number, colorTex: T, depthTex?: T, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer;
2793
- /**
2794
- * Fetch a temporal framebuffer from the object pool.
2848
+ * Creates a temporal framebuffer from the object pool.
2795
2849
  * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2796
- * @param colorTexOrFormat - color attachment or texture format.
2797
- * @param depthTexOrFormat - depth attachment or texture format.
2798
- * @param sampleCount - The sample count for the framebuffer.
2799
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2850
+ * @param width - Width of the framebuffer
2851
+ * @param height - Height of the framebuffer
2852
+ * @param colorAttachments - Array of color attachments or texture format of the framebuffer.
2853
+ * @param depthAttachment - Depth attachment or texture format of the framebuffer.
2854
+ * @param mipmapping - Whether mipmapping should be enabled when creating color attachment textures, default is false.
2855
+ * @param sampleCount - The sample count for the framebuffer, default is 1.
2856
+ * @param ignoreDepthStencil - Whether to ignore depth stencil when resolving msaa framebuffer, default is true.
2857
+ * @param attachmentMipLevel - The mipmap level to which the color attachment will render, default is 0
2858
+ * @param attachmentCubeface - The cubemap face to which the color attachment will render, default is 0
2859
+ * @param attachmentLayer - The texture layer to which the color attachment will render, default is 0
2800
2860
  * @returns The fetched FrameBuffer object.
2801
2861
  */
2802
- fetchTemporalFramebuffer<T extends BaseTexture<unknown>>(autoRelease: boolean, width: number, height: number, colorTexOrFormat: TextureFormat | T, depthTexOrFormat?: TextureFormat | T, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer;
2862
+ fetchTemporalFramebuffer<T extends BaseTexture<unknown>>(autoRelease: boolean, width: number, height: number, colorTexOrFormat: MaybeArray<TextureFormat | T>, depthTexOrFormat?: TextureFormat | T, mipmapping?: boolean, sampleCount?: number, ignoreDepthStencil?: boolean, attachmentMipLevel?: number, attachmentCubeface?: number, attachmentLayer?: number): FrameBuffer;
2803
2863
  /**
2804
2864
  * Creates a temporal framebuffer from the object pool.
2805
2865
  * @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
2806
2866
  * @param colorAttachments - Array of color attachments for the framebuffer.
2807
2867
  * @param depthAttachment - Depth attachment for the framebuffer.
2808
- * @param sampleCount - The sample count for the framebuffer.
2809
- * @param ignoreDepthStencil - Whether to ignore depth stencil.
2868
+ * @param sampleCount - The sample count for the framebuffer, default is 1.
2869
+ * @param ignoreDepthStencil - Whether to ignore depth stencil when resolving msaa framebuffer, default is true.
2870
+ * @param attachmentMipLevel - The mipmap level to which the color attachment will render, default is 0.
2871
+ * @param attachmentCubeface - The cubemap face to which the color attachment will render, default is 0.
2872
+ * @param attachmentLayer - The texture layer to which the color attachment will render, default is 0.
2810
2873
  * @returns The fetched FrameBuffer object.
2811
2874
  */
2812
- createTemporalFramebuffer(autoRelease: boolean, colorAttachments: BaseTexture[], depthAttachment?: BaseTexture, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer<unknown>;
2875
+ createTemporalFramebuffer(autoRelease: boolean, colorAttachments: BaseTexture[], depthAttachment?: BaseTexture, sampleCount?: number, ignoreDepthStencil?: boolean, attachmentMipLevel?: number, attachmentCubeface?: number, attachmentLayer?: number): FrameBuffer;
2813
2876
  /**
2814
2877
  * Dispose a texture that is allocated from the object pool.
2815
2878
  * @param texture - The texture to dispose.
@@ -2820,6 +2883,11 @@ declare class Pool {
2820
2883
  * @param texture - The texture to release.
2821
2884
  */
2822
2885
  releaseTexture(texture: BaseTexture): void;
2886
+ /**
2887
+ * Increment reference counter for given texture
2888
+ * @param texture - The texture to retain
2889
+ */
2890
+ retainTexture(texture: BaseTexture): void;
2823
2891
  /**
2824
2892
  * Dispose a framebuffer that is allocated from the object pool.
2825
2893
  * @param fb - The framebuffer to dispose.
@@ -2830,6 +2898,11 @@ declare class Pool {
2830
2898
  * @param fb - The framebuffer to release.
2831
2899
  */
2832
2900
  releaseFrameBuffer(fb: FrameBuffer): void;
2901
+ /**
2902
+ * Increment reference counter for given framebuffer
2903
+ * @param fb - The framebuffer to retain
2904
+ */
2905
+ retainFrameBuffer(fb: FrameBuffer): void;
2833
2906
  /**
2834
2907
  * Purge the object pool by disposing all free framebuffers and textures.
2835
2908
  */
@@ -3060,6 +3133,8 @@ interface DeviceCaps {
3060
3133
  interface FramebufferCaps {
3061
3134
  /** The maximum number of framebuffer color attachment points */
3062
3135
  maxDrawBuffers: number;
3136
+ /** True if device supports rendering to mipmap */
3137
+ supportRenderMipmap: boolean;
3063
3138
  /** True if device supports multisampled frame buffer */
3064
3139
  supportMultisampledFramebuffer: boolean;
3065
3140
  /** True if device supports blending on float point frame buffer */
@@ -3122,6 +3197,12 @@ interface TextureFormatInfo {
3122
3197
  renderable: boolean;
3123
3198
  /** True if the texture format is a compressed format */
3124
3199
  compressed: boolean;
3200
+ /** Number of bytes per-block */
3201
+ size: number;
3202
+ /** Block width */
3203
+ blockWidth: number;
3204
+ /** Block height */
3205
+ blockHeight: number;
3125
3206
  }
3126
3207
  /**
3127
3208
  * Texture related capabilities of the device'
@@ -3211,70 +3292,6 @@ interface GPUProgramConstructParams {
3211
3292
  /** The creation options */
3212
3293
  params: RenderProgramConstructParams | ComputeProgramConstructParams;
3213
3294
  }
3214
- /**
3215
- * Event that will be fired when device is lost
3216
- * @public
3217
- */
3218
- declare class DeviceLostEvent {
3219
- /** The event name */
3220
- static readonly NAME: "devicelost";
3221
- type: "devicelost";
3222
- }
3223
- /**
3224
- * Event that will be fired when device has just been restored
3225
- * @public
3226
- */
3227
- declare class DeviceRestoreEvent {
3228
- /** The event name */
3229
- static readonly NAME: "devicerestored";
3230
- type: "devicerestored";
3231
- }
3232
- /**
3233
- * Event that will be fired when size of back buffer has changed
3234
- * @public
3235
- */
3236
- declare class DeviceResizeEvent {
3237
- /** The event name */
3238
- static readonly NAME: "resize";
3239
- width: number;
3240
- height: number;
3241
- type: "resize";
3242
- constructor(width: number, height: number);
3243
- }
3244
- /**
3245
- * Event that will be fired when any gpu object is created
3246
- * @public
3247
- */
3248
- declare class DeviceGPUObjectAddedEvent {
3249
- /** the event name */
3250
- static readonly NAME: "gpuobject_added";
3251
- object: GPUObject;
3252
- type: "gpuobject_added";
3253
- constructor(obj: GPUObject);
3254
- }
3255
- /**
3256
- * Event that will be fired when any gpu object is disposed
3257
- * @public
3258
- */
3259
- declare class DeviceGPUObjectRemovedEvent {
3260
- /** The event name */
3261
- static readonly NAME: 'gpuobject_removed';
3262
- object: GPUObject;
3263
- type: "gpuobject_removed";
3264
- constructor(obj: GPUObject);
3265
- }
3266
- /**
3267
- * Event that will be fired when any gpu object name is changed
3268
- * @public
3269
- */
3270
- declare class DeviceGPUObjectRenameEvent {
3271
- /** The event name */
3272
- static readonly NAME: 'gpuobject_rename';
3273
- object: GPUObject;
3274
- lastName: string;
3275
- type: "gpuobject_rename";
3276
- constructor(obj: GPUObject, lastName: string);
3277
- }
3278
3295
  /**
3279
3296
  * Creation options for device
3280
3297
  * @public
@@ -3290,12 +3307,12 @@ interface DeviceOptions {
3290
3307
  * @public
3291
3308
  */
3292
3309
  type DeviceEventMap = {
3293
- [DeviceResizeEvent.NAME]: DeviceResizeEvent;
3294
- [DeviceLostEvent.NAME]: DeviceLostEvent;
3295
- [DeviceRestoreEvent.NAME]: DeviceRestoreEvent;
3296
- [DeviceGPUObjectAddedEvent.NAME]: DeviceGPUObjectAddedEvent;
3297
- [DeviceGPUObjectRemovedEvent.NAME]: DeviceGPUObjectRemovedEvent;
3298
- [DeviceGPUObjectRenameEvent.NAME]: DeviceGPUObjectRenameEvent;
3310
+ resize: [width: number, height: number];
3311
+ devicelost: [];
3312
+ devicerestored: [];
3313
+ gpuobject_added: [obj: GPUObject];
3314
+ gpuobject_removed: [obj: GPUObject];
3315
+ gpuobject_rename: [obj: GPUObject, lastName: string];
3299
3316
  };
3300
3317
  /**
3301
3318
  * Structure that contains the device viewport information
@@ -3326,6 +3343,10 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3326
3343
  pool: Pool;
3327
3344
  /** vSync */
3328
3345
  vSync: boolean;
3346
+ /** Check if a pool with given key exists */
3347
+ poolExists(key: string | symbol): boolean;
3348
+ /** Get the pool with given key, or create a new one if not exists */
3349
+ getPool(key: string | symbol): Pool;
3329
3350
  /** Get adapter information */
3330
3351
  getAdapterInfo(): any;
3331
3352
  /** Get sample count of current frame buffer */
@@ -3367,9 +3388,20 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3367
3388
  clearFrameBuffer(clearColor: Vector4, clearDepth: number, clearStencil: number): any;
3368
3389
  /** Creates a render state set object */
3369
3390
  createRenderStateSet(): RenderStateSet;
3391
+ /** Creates a blending state object */
3392
+ createBlendingState(): BlendingState;
3393
+ /** Creates a color state object */
3394
+ createColorState(): ColorState;
3395
+ /** Creates a rasterizer state object */
3396
+ createRasterizerState(): RasterizerState;
3397
+ /** Creates a depth state object */
3398
+ createDepthState(): DepthState;
3399
+ /** Creates a stencil state object */
3400
+ createStencilState(): StencilState;
3370
3401
  /**
3371
3402
  * Creates a texture sampler object
3372
3403
  * @param options - The creation options
3404
+ * @returns The created texture sampler
3373
3405
  */
3374
3406
  createSampler(options: SamplerOptions): TextureSampler;
3375
3407
  /**
@@ -3385,18 +3417,14 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3385
3417
  * @param width - Pixel width of the texture
3386
3418
  * @param height - Pixel height of the texture
3387
3419
  * @param options - The creation options
3420
+ * @returns The created 2D texture
3388
3421
  */
3389
3422
  createTexture2D(format: TextureFormat, width: number, height: number, options?: TextureCreationOptions): Texture2D;
3390
- /**
3391
- * Creates a 2d texture from given mipmap data
3392
- * @param data - The mipmap data
3393
- * @param options - The creation options
3394
- */
3395
- createTexture2DFromMipmapData(data: TextureMipmapData, sRGB: boolean, options?: TextureCreationOptions): Texture2D;
3396
3423
  /**
3397
3424
  * Creates a 2d texture from a image element
3398
3425
  * @param element - The image element
3399
3426
  * @param options - The creation options
3427
+ * @returns The created 2D texture.
3400
3428
  */
3401
3429
  createTexture2DFromImage(element: TextureImageElement, sRGB: boolean, options?: TextureCreationOptions): Texture2D;
3402
3430
  /**
@@ -3406,29 +3434,25 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3406
3434
  * @param height - Pixel height of the texture
3407
3435
  * @param depth - Array length of the texture
3408
3436
  * @param options - The creation options
3437
+ * @returns The created 2D array texture.
3409
3438
  */
3410
3439
  createTexture2DArray(format: TextureFormat, width: number, height: number, depth: number, options?: TextureCreationOptions): Texture2DArray;
3411
- /**
3412
- * Creates a 2d array texture from mipmap data
3413
- * @param data - mipmap data
3414
- * @param sRGB - whether texture should have sRGB texture format
3415
- * @param options - The creation options
3416
- */
3417
- createTexture2DArrayFromMipmapData(data: TextureMipmapData, options?: TextureCreationOptions): Texture2DArray;
3418
3440
  /**
3419
3441
  * Creates a 2d array texture from a seris of image elements
3420
3442
  * @remarks image elements must have the same size.
3421
3443
  * @param elements - image elements
3422
3444
  * @param options - The creation options
3445
+ * @returns The created 2D array texture.
3423
3446
  */
3424
3447
  createTexture2DArrayFromImages(elements: TextureImageElement[], sRGB: boolean, options?: TextureCreationOptions): Texture2DArray;
3425
3448
  /**
3426
- * Creates a 3d texture
3449
+ * Creates a 3D texture
3427
3450
  * @param format - The texture format
3428
3451
  * @param width - Pixel width of the texture
3429
3452
  * @param height - Pixel height of the texture
3430
3453
  * @param depth - Pixel depth of the texture
3431
3454
  * @param options - The creation options
3455
+ * @returns The created 3D texture.
3432
3456
  */
3433
3457
  createTexture3D(format: TextureFormat, width: number, height: number, depth: number, options?: TextureCreationOptions): Texture3D;
3434
3458
  /**
@@ -3436,19 +3460,39 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3436
3460
  * @param format - The texture format
3437
3461
  * @param size - Pixel width of the texture
3438
3462
  * @param options - The creation options
3463
+ * @returns The created cube texture.
3439
3464
  */
3440
3465
  createCubeTexture(format: TextureFormat, size: number, options?: TextureCreationOptions): TextureCube;
3441
- /**
3442
- * Creates a cube texture from given mipmap data
3443
- * @param data - The mipmap data
3444
- * @param options - The creation options
3445
- */
3446
- createCubeTextureFromMipmapData(data: TextureMipmapData, sRGB: boolean, options?: TextureCreationOptions): TextureCube;
3447
3466
  /**
3448
3467
  * Creates a video texture from a video element
3449
3468
  * @param el - The video element
3469
+ * @returns The created video texture.
3450
3470
  */
3451
3471
  createTextureVideo(el: HTMLVideoElement, samplerOptions?: SamplerOptions): TextureVideo;
3472
+ /**
3473
+ * Copies a 2d texture to another texture.
3474
+ *
3475
+ * @remarks
3476
+ * The two textures must have the same size and format
3477
+ *
3478
+ * @param src - Texture that will be copied from.
3479
+ * @param srcLevel - Which mipmap level to be copied from.
3480
+ * @param dst - Texture that will be copied to.
3481
+ * @param dstLevel - Which mipmap level to be copied to.
3482
+ */
3483
+ copyTexture2D(src: Texture2D, srcLevel: number, dst: Texture2D, dstLevel: number): any;
3484
+ /**
3485
+ * Copies a color attachment of a framebuffer to a mipmap level of a texture.
3486
+ *
3487
+ * @remarks
3488
+ * The color attachment and the mipmap level must have the same size and format
3489
+ *
3490
+ * @param src - Framebuffer that will be copied from.
3491
+ * @param index - Color attachment index of the framebuffer.
3492
+ * @param dst - Texture that will be copied to.
3493
+ * @param level - Which mipmap level should be copied to.
3494
+ */
3495
+ copyFramebufferToTexture2D(src: FrameBuffer, index: number, dst: Texture2D, level: number): any;
3452
3496
  /**
3453
3497
  * Set wether to reverse the winding order
3454
3498
  *
@@ -3465,17 +3509,20 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3465
3509
  /**
3466
3510
  * Creates a gpu program
3467
3511
  * @param params - The creation options
3512
+ * @returns The created program.
3468
3513
  */
3469
3514
  createGPUProgram(params: GPUProgramConstructParams): GPUProgram;
3470
3515
  /**
3471
3516
  * Creates a bind group
3472
3517
  * @param layout - Layout of the bind group
3518
+ * @returns The created bind group.
3473
3519
  */
3474
3520
  createBindGroup(layout: BindGroupLayout): BindGroup;
3475
3521
  /**
3476
3522
  * Creates a gpu buffer
3477
3523
  * @param sizeInBytes - Size of the buffer in bytes
3478
3524
  * @param options - The creation options
3525
+ * @returns The created buffer.
3479
3526
  */
3480
3527
  createBuffer(sizeInBytes: number, options: BufferCreationOptions): GPUDataBuffer;
3481
3528
  /**
@@ -3491,23 +3538,27 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3491
3538
  * Creates an index buffer
3492
3539
  * @param data - Data of the index buffer
3493
3540
  * @param options - The creation options
3541
+ * @returns The created index buffer.
3494
3542
  */
3495
- createIndexBuffer(data: Uint16Array | Uint32Array, options?: BufferCreationOptions): IndexBuffer;
3543
+ createIndexBuffer(data: Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>, options?: BufferCreationOptions): IndexBuffer;
3496
3544
  /**
3497
3545
  * Creates a structured buffer
3498
3546
  * @param structureType - The structure type
3499
3547
  * @param options - The creation options
3500
3548
  * @param data - Data to be filled with
3549
+ * @returns The created structured buffer.
3501
3550
  */
3502
3551
  createStructuredBuffer(structureType: PBStructTypeInfo, options: BufferCreationOptions, data?: TypedArray): StructuredBuffer;
3503
3552
  /**
3504
- * Creates a vertex layout
3553
+ * Creates a vertex layout object.
3505
3554
  * @param options - The creation options
3555
+ * @returns The created vertex layout object.
3506
3556
  */
3507
3557
  createVertexLayout(options: VertexLayoutOptions): VertexLayout;
3508
3558
  /**
3509
3559
  * Creates a frame buffer
3510
3560
  * @param options - The creation options
3561
+ * @returns The created framebuffer.
3511
3562
  */
3512
3563
  createFrameBuffer(colorAttachments: BaseTexture[], depthAttachment: BaseTexture, options?: FrameBufferOptions): FrameBuffer;
3513
3564
  /**
@@ -3654,14 +3705,14 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3654
3705
  * Begins a frame for rendering
3655
3706
  *
3656
3707
  * @remarks
3657
- * All rendering call must occur between the {@link AbstractDevice.beginFrame} and {@link AbstractDevice.endFrame} methods
3708
+ * All rendering call must occur between the @see AbstractDevice.beginFrame and @see AbstractDevice.endFrame methods
3658
3709
  */
3659
3710
  beginFrame(): boolean;
3660
3711
  /**
3661
3712
  * Ends a frame for rendering
3662
3713
  *
3663
3714
  * @remarks
3664
- * All rendering call must occur between the {@link AbstractDevice.beginFrame} and {@link AbstractDevice.endFrame} methods
3715
+ * All rendering call must occur between the @see AbstractDevice.beginFrame and @see AbstractDevice.endFrame methods
3665
3716
  */
3666
3717
  endFrame(): void;
3667
3718
  /**
@@ -3678,6 +3729,7 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3678
3729
  * @param attribFormats - The vertex attribute formats for each vertex stream in the vertex buffer
3679
3730
  * @param data - Data to be filled with
3680
3731
  * @param options - The creation options
3732
+ * @returns The created vertex buffer.
3681
3733
  */
3682
3734
  createInterleavedVertexBuffer(attribFormats: VertexAttribFormat[], data: TypedArray, options?: BufferCreationOptions): StructuredBuffer;
3683
3735
  /**
@@ -3686,6 +3738,7 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3686
3738
  * @param attribFormat - The vertex attribute format
3687
3739
  * @param data - Data to be filled with
3688
3740
  * @param options - The creation options
3741
+ * @returns The created vertex buffer
3689
3742
  */
3690
3743
  createVertexBuffer(attribFormat: VertexAttribFormat, data: TypedArray, options?: BufferCreationOptions): StructuredBuffer;
3691
3744
  /**
@@ -3719,6 +3772,12 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
3719
3772
  * @param f - The function to be scheduled
3720
3773
  */
3721
3774
  runNextFrame(f: () => void): void;
3775
+ /**
3776
+ * Asyncronized version of scheduling a function to be executed at the beginning of the next frame
3777
+ *
3778
+ * @param f - The function to be scheduled
3779
+ */
3780
+ runNextFrameAsync(f: () => void): Promise<void>;
3722
3781
  /** Exits from current rendering loop */
3723
3782
  exitLoop(): void;
3724
3783
  /**
@@ -3799,7 +3858,7 @@ interface DeviceBackend {
3799
3858
  * Base class for rendering device
3800
3859
  * @public
3801
3860
  */
3802
- declare abstract class BaseDevice {
3861
+ declare abstract class BaseDevice extends Observable<DeviceEventMap> {
3803
3862
  protected _canvas: HTMLCanvasElement;
3804
3863
  protected _canvasClientWidth: number;
3805
3864
  protected _canvasClientHeight: number;
@@ -3820,10 +3879,11 @@ declare abstract class BaseDevice {
3820
3879
  protected _backend: DeviceBackend;
3821
3880
  protected _beginFrameCounter: number;
3822
3881
  protected _programBuilder: ProgramBuilder;
3823
- protected _pool: Pool;
3882
+ protected _poolMap: Map<string | symbol, Pool>;
3883
+ protected _defaultPoolKey: symbol;
3824
3884
  protected _temporalFramebuffer: boolean;
3825
3885
  protected _vSync: boolean;
3826
- private _stateStack;
3886
+ private readonly _stateStack;
3827
3887
  constructor(cvs: HTMLCanvasElement, backend: DeviceBackend);
3828
3888
  abstract getAdapterInfo(): any;
3829
3889
  abstract getFrameBufferSampleCount(): number;
@@ -3838,25 +3898,29 @@ declare abstract class BaseDevice {
3838
3898
  abstract clearFrameBuffer(clearColor: Vector4, clearDepth: number, clearStencil: number): any;
3839
3899
  abstract createGPUTimer(): ITimer;
3840
3900
  abstract createRenderStateSet(): RenderStateSet;
3901
+ abstract createBlendingState(): BlendingState;
3902
+ abstract createColorState(): ColorState;
3903
+ abstract createRasterizerState(): RasterizerState;
3904
+ abstract createDepthState(): DepthState;
3905
+ abstract createStencilState(): StencilState;
3841
3906
  abstract createSampler(options: SamplerOptions): TextureSampler;
3842
3907
  abstract createTextureFromMipmapData<T extends BaseTexture>(data: TextureMipmapData, sRGB: boolean, options?: TextureCreationOptions): T;
3843
3908
  abstract createTexture2D(format: TextureFormat, width: number, height: number, options?: TextureCreationOptions): Texture2D;
3844
- abstract createTexture2DFromMipmapData(data: TextureMipmapData, sRGB: boolean, options?: TextureCreationOptions): Texture2D;
3845
3909
  abstract createTexture2DFromImage(element: TextureImageElement, sRGB: boolean, options?: TextureCreationOptions): Texture2D;
3846
3910
  abstract createTexture2DArray(format: TextureFormat, width: number, height: number, depth: number, options?: TextureCreationOptions): Texture2DArray;
3847
- abstract createTexture2DArrayFromMipmapData(data: TextureMipmapData, options?: TextureCreationOptions): Texture2DArray;
3848
3911
  abstract createTexture2DArrayFromImages(elements: TextureImageElement[], sRGB: boolean, options?: TextureCreationOptions): Texture2DArray;
3849
3912
  abstract createTexture3D(format: TextureFormat, width: number, height: number, depth: number, options?: TextureCreationOptions): Texture3D;
3850
3913
  abstract createCubeTexture(format: TextureFormat, size: number, options?: TextureCreationOptions): TextureCube;
3851
- abstract createCubeTextureFromMipmapData(data: TextureMipmapData, sRGB: boolean, options?: TextureCreationOptions): TextureCube;
3852
3914
  abstract createTextureVideo(el: HTMLVideoElement, samplerOptions?: SamplerOptions): TextureVideo;
3853
3915
  abstract reverseVertexWindingOrder(reverse: boolean): void;
3854
3916
  abstract isWindingOrderReversed(): boolean;
3917
+ abstract copyTexture2D(src: Texture2D, srcLevel: number, dst: Texture2D, dstLevel: number): any;
3918
+ abstract copyFramebufferToTexture2D(src: FrameBuffer, index: number, dst: Texture2D, level: number): any;
3855
3919
  abstract createGPUProgram(params: GPUProgramConstructParams): GPUProgram;
3856
3920
  abstract createBindGroup(layout: BindGroupLayout): BindGroup;
3857
3921
  abstract createBuffer(sizeInBytes: number, options: BufferCreationOptions): GPUDataBuffer;
3858
3922
  abstract copyBuffer(sourceBuffer: GPUDataBuffer, destBuffer: GPUDataBuffer, srcOffset: number, dstOffset: number, bytes: number): any;
3859
- abstract createIndexBuffer(data: Uint16Array | Uint32Array, options?: BufferCreationOptions): IndexBuffer;
3923
+ abstract createIndexBuffer(data: Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>, options?: BufferCreationOptions): IndexBuffer;
3860
3924
  abstract createStructuredBuffer(structureType: PBStructTypeInfo, options: BufferCreationOptions, data?: TypedArray): StructuredBuffer;
3861
3925
  abstract createVertexLayout(options: VertexLayoutOptions): VertexLayout;
3862
3926
  abstract createFrameBuffer(colorAttachments: BaseTexture[], depthAttachment: BaseTexture, options?: FrameBufferOptions): FrameBuffer;
@@ -3880,9 +3944,9 @@ declare abstract class BaseDevice {
3880
3944
  abstract readPixelsToBuffer(index: number, x: number, y: number, w: number, h: number, buffer: GPUDataBuffer): void;
3881
3945
  abstract beginCapture(): void;
3882
3946
  abstract endCapture(): RenderBundle;
3883
- abstract executeRenderBundle(renderBundle: RenderBundle): any;
3884
3947
  abstract looseContext(): void;
3885
3948
  abstract restoreContext(): void;
3949
+ protected abstract _executeRenderBundle(renderBundle: RenderBundle): number;
3886
3950
  protected abstract _draw(primitiveType: PrimitiveType, first: number, count: number): void;
3887
3951
  protected abstract _drawInstanced(primitiveType: PrimitiveType, first: number, count: number, numInstances: number): void;
3888
3952
  protected abstract _compute(workgroupCountX: number, workgroupCountY: number, workgroupCountZ: number): void;
@@ -3897,17 +3961,14 @@ declare abstract class BaseDevice {
3897
3961
  get pool(): Pool;
3898
3962
  get runLoopFunction(): (device: AbstractDevice) => void;
3899
3963
  get programBuilder(): ProgramBuilder;
3964
+ poolExists(key: string | symbol): boolean;
3965
+ getPool(key: string | symbol): Pool;
3900
3966
  setFont(fontName: string): void;
3901
3967
  drawText(text: string, x: number, y: number, color: string): void;
3902
3968
  setFramebuffer(rt: FrameBuffer): any;
3903
- setFramebuffer(color: (BaseTexture | {
3904
- texture: BaseTexture;
3905
- miplevel?: number;
3906
- face?: number;
3907
- layer?: number;
3908
- })[], depth?: BaseTexture, sampleCount?: number): any;
3969
+ setFramebuffer(color: BaseTexture[], depth?: BaseTexture, sampleCount?: number): any;
3909
3970
  disposeObject(obj: GPUObject, remove?: boolean): void;
3910
- restoreObject(obj: GPUObject): Promise<void>;
3971
+ restoreObject(obj: GPUObject): void;
3911
3972
  enableGPUTimeRecording(enable: boolean): void;
3912
3973
  beginFrame(): boolean;
3913
3974
  endFrame(): void;
@@ -3916,8 +3977,10 @@ declare abstract class BaseDevice {
3916
3977
  createVertexBuffer(attribFormat: VertexAttribFormat, data: TypedArray, options?: BufferCreationOptions): StructuredBuffer;
3917
3978
  draw(primitiveType: PrimitiveType, first: number, count: number): void;
3918
3979
  drawInstanced(primitiveType: PrimitiveType, first: number, count: number, numInstances: number): void;
3980
+ executeRenderBundle(renderBundle: RenderBundle): void;
3919
3981
  compute(workgroupCountX: any, workgroupCountY: any, workgroupCountZ: any): void;
3920
3982
  runNextFrame(f: () => void): void;
3983
+ runNextFrameAsync(f: () => void | Promise<void>): Promise<void>;
3921
3984
  exitLoop(): void;
3922
3985
  runLoop(func: (device: AbstractDevice) => void): void;
3923
3986
  pushDeviceStates(): void;
@@ -3939,7 +4002,7 @@ declare abstract class BaseDevice {
3939
4002
  private updateFrameInfo;
3940
4003
  private getGPUObjectList;
3941
4004
  protected invalidateAll(): void;
3942
- protected reloadAll(): Promise<void>;
4005
+ protected reloadAll(): void;
3943
4006
  protected parseTextureOptions(options?: TextureCreationOptions): number;
3944
4007
  protected parseBufferOptions(options: BufferCreationOptions, defaultUsage?: BufferUsage): number;
3945
4008
  }
@@ -3981,8 +4044,8 @@ declare class TextureAtlasManager {
3981
4044
  * The texture restore handler callback function
3982
4045
  * This callback function will be called whenever the device has been restored
3983
4046
  */
3984
- get atlasTextureRestoreHandler(): (tex: BaseTexture) => Promise<void>;
3985
- set atlasTextureRestoreHandler(f: (tex: BaseTexture) => Promise<void>);
4047
+ get atlasTextureRestoreHandler(): (tex: BaseTexture) => void;
4048
+ set atlasTextureRestoreHandler(f: (tex: BaseTexture) => void);
3986
4049
  /**
3987
4050
  * Gets the atlas texture of a given index
3988
4051
  * @param index - Index of the atlas bin
@@ -4161,4 +4224,4 @@ declare class StructuredBufferData {
4161
4224
  set(name: string, value: StructuredValue): void;
4162
4225
  }
4163
4226
 
4164
- export { AbstractDevice, ArrayTypeDetail, AtlasInfo, AtomicTypeInfoDetail, BaseCreationOptions, BaseDevice, BaseTexture, BindGroup, BindGroupLayout, BindGroupLayoutEntry, BindPointInfo, BlendEquation, BlendFunc, BlendingState, BufferBindingLayout, BufferCreationOptions, BufferUsage, CPUTimer, ColorState, CompareFunc, ComputeProgramConstructParams, DataType, DepthState, DeviceBackend, DeviceCaps, DeviceEventMap, DeviceGPUObjectAddedEvent, DeviceGPUObjectRemovedEvent, DeviceGPUObjectRenameEvent, DeviceLostEvent, DeviceOptions, DeviceResizeEvent, DeviceRestoreEvent, DeviceViewport, DrawText, ExpValueNonArrayType, ExpValueType, ExternalTextureBindingLayout, FaceMode, FaceWinding, Font, FrameBuffer, FrameBufferOptions, FrameBufferTextureAttachment, FrameInfo, FramebufferCaps, FunctionTypeDetail, GPUDataBuffer, GPUObject, GPUObjectList, GPUProgram, GPUProgramConstructParams, GPUResourceUsageFlags, GlyphManager, ITimer, IndexBuffer, MiscCaps, PBAddressSpace, PBAnyTypeInfo, PBArrayTypeInfo, PBAtomicI32TypeInfo, PBAtomicU32TypeInfo, PBBuiltinScope, PBComputeOptions, PBDoWhileScope, PBForScope, PBFunctionScope, PBFunctionTypeInfo, PBGlobalScope, PBIfScope, PBInputScope, PBInsideFunctionScope, PBLocalScope, PBNakedScope, PBOutputScope, PBPointerTypeInfo, PBPrimitiveType, PBPrimitiveTypeInfo, PBReflection, PBReflectionTagGetter, PBRenderOptions, PBSamplerAccessMode, PBSamplerTypeInfo, PBScope, PBShaderExp, PBStructLayout, PBStructTypeInfo, PBTextureType, PBTextureTypeInfo, PBTypeInfo, PBVoidTypeInfo, PBWhileScope, PointerTypeDetail, PrimitiveType, PrimitiveTypeDetail, ProgramBuilder, Proxiable, RasterizerState, RenderBundle, RenderProgramConstructParams, RenderStateSet, SamplerBindingLayout, SamplerOptions, SamplerTypeDetail, ShaderCaps, ShaderExpTagRecord, ShaderExpTagValue, ShaderKind, ShaderType, ShaderTypeFunc, StencilOp, StencilState, StorageTextureBindingLayout, StructTypeDetail, StructuredBuffer, StructuredBufferData, StructuredValue, Texture2D, Texture2DArray, Texture3D, TextureAddressMode, TextureAtlasManager, TextureBindingLayout, TextureCaps, TextureColorSpace, TextureCreationOptions, TextureCube, TextureFilterMode, TextureFormat, TextureFormatInfo, TextureImageElement, TextureMipmapData, TextureMipmapLevelData, TextureSampler, TextureType, TextureTypeDetail, TextureVideo, TypeDetailInfo, UniformBufferLayout, UniformLayout, VertexAttribFormat, VertexBufferInfo, VertexData, VertexLayout, VertexLayoutOptions, VertexSemantic, VertexStepMode, WebGLContext, genDefaultName, getTextureFormatBlockHeight, getTextureFormatBlockSize, getTextureFormatBlockWidth, getVertexAttribByName, getVertexAttribFormat, getVertexAttribName, getVertexBufferAttribType, getVertexBufferAttribTypeBySemantic, getVertexBufferLength, getVertexBufferStride, getVertexFormatComponentCount, getVertexFormatSize, hasAlphaChannel, hasBlueChannel, hasDepthChannel, hasGreenChannel, hasRedChannel, hasStencilChannel, isCompressedTextureFormat, isFloatTextureFormat, isIntegerTextureFormat, isSRGBTextureFormat, isSignedTextureFormat, linearTextureFormatToSRGB, makeVertexBufferType, semanticList };
4227
+ export { type AbstractDevice, type ArrayTypeDetail, type AtlasInfo, type AtomicTypeInfoDetail, type BaseCreationOptions, BaseDevice, type BaseTexture, type BindGroup, type BindGroupLayout, type BindGroupLayoutEntry, type BindPointInfo, type BlendEquation, type BlendFunc, type BlendingState, type BufferBindingLayout, type BufferCreationOptions, type BufferUsage, CPUTimer, type ColorState, type CompareFunc, type ComputeProgramConstructParams, type DataType, type DepthState, type DeviceBackend, type DeviceCaps, type DeviceEventMap, type DeviceOptions, type DeviceViewport, DrawText, type ExpValueNonArrayType, type ExpValueType, type ExternalTextureBindingLayout, type FaceMode, type FaceWinding, Font, type FrameBuffer, type FrameBufferOptions, type FrameBufferTextureAttachment, type FrameInfo, type FramebufferCaps, type FunctionTypeDetail, type GPUDataBuffer, type GPUObject, type GPUObjectList, type GPUProgram, type GPUProgramConstructParams, GPUResourceUsageFlags, GlyphManager, type ITimer, type IndexBuffer, MAX_BINDING_GROUPS, MAX_TEXCOORD_INDEX_COUNT, MAX_VERTEX_ATTRIBUTES, type MiscCaps, PBAddressSpace, PBAnyTypeInfo, PBArrayTypeInfo, PBAtomicI32TypeInfo, PBAtomicU32TypeInfo, PBBuiltinScope, type PBComputeOptions, PBDoWhileScope, PBForScope, PBFunctionScope, PBFunctionTypeInfo, PBGlobalScope, PBIfScope, PBInputScope, PBInsideFunctionScope, PBLocalScope, PBNakedScope, PBOutputScope, PBPointerTypeInfo, PBPrimitiveType, PBPrimitiveTypeInfo, PBReflection, type PBReflectionTagGetter, type PBRenderOptions, PBSamplerAccessMode, PBSamplerTypeInfo, PBScope, PBShaderExp, type PBStructLayout, PBStructTypeInfo, PBTextureType, PBTextureTypeInfo, PBTypeInfo, PBVoidTypeInfo, PBWhileScope, type PointerTypeDetail, Pool, type PrimitiveType, type PrimitiveTypeDetail, ProgramBuilder, Proxiable, type RasterizerState, type RenderBundle, type RenderProgramConstructParams, type RenderStateSet, type SamplerBindingLayout, type SamplerOptions, type SamplerTypeDetail, type ShaderCaps, type ShaderExpTagRecord, type ShaderExpTagValue, type ShaderKind, ShaderType, type ShaderTypeFunc, type StencilOp, type StencilState, type StorageTextureBindingLayout, type StructTypeDetail, type StructuredBuffer, StructuredBufferData, type StructuredValue, type Texture2D, type Texture2DArray, type Texture3D, type TextureAddressMode, TextureAtlasManager, type TextureBindingLayout, type TextureCaps, type TextureColorSpace, type TextureCreationOptions, type TextureCube, type TextureFilterMode, type TextureFormat, type TextureFormatInfo, type TextureImageElement, type TextureMipmapData, type TextureMipmapLevelData, type TextureSampler, type TextureType, type TextureTypeDetail, type TextureVideo, type TypeDetailInfo, type UniformBufferLayout, type UniformLayout, VERTEX_ATTRIB_BLEND_INDICES, VERTEX_ATTRIB_BLEND_WEIGHT, VERTEX_ATTRIB_DIFFUSE, VERTEX_ATTRIB_NORMAL, VERTEX_ATTRIB_POSITION, VERTEX_ATTRIB_TANGENT, VERTEX_ATTRIB_TEXCOORD0, VERTEX_ATTRIB_TEXCOORD1, VERTEX_ATTRIB_TEXCOORD2, VERTEX_ATTRIB_TEXCOORD3, VERTEX_ATTRIB_TEXCOORD4, VERTEX_ATTRIB_TEXCOORD5, VERTEX_ATTRIB_TEXCOORD6, VERTEX_ATTRIB_TEXCOORD7, type VertexAttribFormat, type VertexBufferInfo, VertexData, type VertexLayout, type VertexLayoutOptions, type VertexSemantic, type VertexStepMode, type WebGLContext, genDefaultName, getTextureFormatBlockHeight, getTextureFormatBlockSize, getTextureFormatBlockWidth, getVertexAttribByName, getVertexAttribFormat, getVertexAttribName, getVertexAttributeFormat, getVertexAttributeIndex, getVertexBufferAttribType, getVertexBufferAttribTypeBySemantic, getVertexBufferLength, getVertexBufferStride, getVertexFormatComponentCount, getVertexFormatSize, hasAlphaChannel, hasBlueChannel, hasDepthChannel, hasGreenChannel, hasRedChannel, hasStencilChannel, isCompressedTextureFormat, isFloatTextureFormat, isIntegerTextureFormat, isSRGBTextureFormat, isSignedTextureFormat, linearTextureFormatToSRGB, makeVertexBufferType, matchVertexBuffer, semanticList };