@zephyr3d/device 0.2.1 → 0.2.3
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/dist/base_types.js +72 -5
- package/dist/base_types.js.map +1 -1
- package/dist/builder/ast.js +3 -5
- package/dist/builder/ast.js.map +1 -1
- package/dist/builder/base.js +30 -4
- package/dist/builder/base.js.map +1 -1
- package/dist/builder/builtinfunc.js +328 -10
- package/dist/builder/builtinfunc.js.map +1 -1
- package/dist/builder/constructors.js +4 -4
- package/dist/builder/programbuilder.js +50 -19
- package/dist/builder/programbuilder.js.map +1 -1
- package/dist/builder/types.js +37 -12
- package/dist/builder/types.js.map +1 -1
- package/dist/device.js +64 -12
- package/dist/device.js.map +1 -1
- package/dist/gpuobject.js +136 -4
- package/dist/gpuobject.js.map +1 -1
- package/dist/index.d.ts +307 -25
- package/dist/index.js +1 -1
- package/dist/pool.js +324 -0
- package/dist/pool.js.map +1 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ interface StructTypeDetail {
|
|
|
178
178
|
*/
|
|
179
179
|
interface ArrayTypeDetail {
|
|
180
180
|
/** Type of array elements */
|
|
181
|
-
elementType: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo;
|
|
181
|
+
elementType: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo | PBAtomicI32TypeInfo | PBAtomicU32TypeInfo;
|
|
182
182
|
/** Array dimension */
|
|
183
183
|
dimension: number;
|
|
184
184
|
}
|
|
@@ -252,6 +252,8 @@ declare abstract class PBTypeInfo<DetailType extends TypeDetailInfo = TypeDetail
|
|
|
252
252
|
isAnyType(): this is PBAnyTypeInfo;
|
|
253
253
|
/** returns true if this is a primitive type */
|
|
254
254
|
isPrimitiveType(): this is PBPrimitiveTypeInfo;
|
|
255
|
+
/** Wether this type have atomic members */
|
|
256
|
+
haveAtomicMembers(): boolean;
|
|
255
257
|
/** returns true if this is a struct type */
|
|
256
258
|
isStructType(): this is PBStructTypeInfo;
|
|
257
259
|
/** returns true if this is an array type */
|
|
@@ -371,6 +373,8 @@ declare class PBStructTypeInfo extends PBTypeInfo<StructTypeDetail> {
|
|
|
371
373
|
/** @internal */
|
|
372
374
|
defaultSize: number;
|
|
373
375
|
}[];
|
|
376
|
+
/** Whether this struct has atomic members */
|
|
377
|
+
haveAtomicMembers(): boolean;
|
|
374
378
|
/**
|
|
375
379
|
* Creates a new struct type by extending this type
|
|
376
380
|
* @param name - Name of the new struct type
|
|
@@ -391,11 +395,13 @@ declare class PBStructTypeInfo extends PBTypeInfo<StructTypeDetail> {
|
|
|
391
395
|
* @public
|
|
392
396
|
*/
|
|
393
397
|
declare class PBArrayTypeInfo extends PBTypeInfo<ArrayTypeDetail> {
|
|
394
|
-
constructor(elementType: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo, dimension?: number);
|
|
398
|
+
constructor(elementType: PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo | PBAtomicI32TypeInfo | PBAtomicU32TypeInfo, dimension?: number);
|
|
395
399
|
/** Get the element type */
|
|
396
|
-
get elementType(): PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo;
|
|
400
|
+
get elementType(): PBPrimitiveTypeInfo | PBArrayTypeInfo | PBStructTypeInfo | PBAnyTypeInfo | PBAtomicI32TypeInfo | PBAtomicU32TypeInfo;
|
|
397
401
|
/** Get dimension of the array type */
|
|
398
402
|
get dimension(): number;
|
|
403
|
+
/** Wether array have atomic members */
|
|
404
|
+
haveAtomicMembers(): boolean;
|
|
399
405
|
/** {@inheritDoc PBTypeInfo.isArrayType} */
|
|
400
406
|
isArrayType(): this is PBArrayTypeInfo;
|
|
401
407
|
/** {@inheritDoc PBTypeInfo.toBufferLayout} */
|
|
@@ -413,6 +419,8 @@ declare class PBPointerTypeInfo extends PBTypeInfo<PointerTypeDetail> {
|
|
|
413
419
|
/** Get address space of the pointer */
|
|
414
420
|
get addressSpace(): PBAddressSpace;
|
|
415
421
|
set addressSpace(val: PBAddressSpace);
|
|
422
|
+
/** {@inheritDoc PBTypeInfo.haveAtomicMembers} */
|
|
423
|
+
haveAtomicMembers(): boolean;
|
|
416
424
|
/** {@inheritDoc PBTypeInfo.isPointerType} */
|
|
417
425
|
isPointerType(): this is PBPointerTypeInfo;
|
|
418
426
|
/** {@inheritDoc PBTypeInfo.toBufferLayout} */
|
|
@@ -424,6 +432,8 @@ declare class PBPointerTypeInfo extends PBTypeInfo<PointerTypeDetail> {
|
|
|
424
432
|
*/
|
|
425
433
|
declare class PBAtomicI32TypeInfo extends PBTypeInfo<null> {
|
|
426
434
|
constructor();
|
|
435
|
+
/** {@inheritDoc PBTypeInfo.isPointerType} */
|
|
436
|
+
haveAtomicMembers(): boolean;
|
|
427
437
|
/** {@inheritDoc PBTypeInfo.toBufferLayout} */
|
|
428
438
|
toBufferLayout(offset: number): UniformBufferLayout;
|
|
429
439
|
}
|
|
@@ -433,6 +443,8 @@ declare class PBAtomicI32TypeInfo extends PBTypeInfo<null> {
|
|
|
433
443
|
*/
|
|
434
444
|
declare class PBAtomicU32TypeInfo extends PBTypeInfo<null> {
|
|
435
445
|
constructor();
|
|
446
|
+
/** {@inheritDoc PBTypeInfo.isPointerType} */
|
|
447
|
+
haveAtomicMembers(): boolean;
|
|
436
448
|
/** {@inheritDoc PBTypeInfo.toBufferLayout} */
|
|
437
449
|
toBufferLayout(offset: number): UniformBufferLayout;
|
|
438
450
|
}
|
|
@@ -459,8 +471,10 @@ declare class PBTextureTypeInfo extends PBTypeInfo<TextureTypeDetail> {
|
|
|
459
471
|
get storageTexelFormat(): TextureFormat;
|
|
460
472
|
/** Returns true if this is a readable storage texture type */
|
|
461
473
|
get readable(): boolean;
|
|
474
|
+
set readable(val: boolean);
|
|
462
475
|
/** Returns true if this is a writable storage texture type */
|
|
463
476
|
get writable(): boolean;
|
|
477
|
+
set writable(val: boolean);
|
|
464
478
|
/** Returns true if this is a 2D texture type */
|
|
465
479
|
is2DTexture(): boolean;
|
|
466
480
|
/** Returns true if this is a 3D texture type */
|
|
@@ -585,7 +599,7 @@ type TextureImageElement = ImageBitmap | HTMLCanvasElement;
|
|
|
585
599
|
* The vertex format types
|
|
586
600
|
* @public
|
|
587
601
|
*/
|
|
588
|
-
type VertexAttribFormat = 'position_u8normx2' | 'position_u8normx4' | 'position_i8normx2' | 'position_i8normx4' | 'position_u16x2' | 'position_u16x4' | 'position_i16x2' | 'position_i16x4' | 'position_u16normx2' | 'position_u16normx4' | 'position_i16normx2' | 'position_i16normx4' | 'position_f16x2' | 'position_f16x4' | 'position_f32' | 'position_f32x2' | 'position_f32x3' | 'position_f32x4' | 'position_i32' | 'position_i32x2' | 'position_i32x3' | 'position_i32x4' | 'position_u32' | 'position_u32x2' | 'position_u32x3' | 'position_u32x4' | 'normal_f16x4' | 'normal_f32x3' | 'normal_f32x4' | 'diffuse_u8normx4' | 'diffuse_u16x4' | 'diffuse_u16normx4' | 'diffuse_f16x4' | 'diffuse_f32x3' | 'diffuse_f32x4' | 'diffuse_u32x3' | 'diffuse_u32x4' | 'tangent_f16x4' | 'tangent_f32x3' | 'tangent_f32x4' | 'tex0_u8normx2' | 'tex0_u8normx4' | 'tex0_i8normx2' | 'tex0_i8normx4' | 'tex0_u16x2' | 'tex0_u16x4' | 'tex0_i16x2' | 'tex0_i16x4' | 'tex0_u16normx2' | 'tex0_u16normx4' | 'tex0_i16normx2' | 'tex0_i16normx4' | 'tex0_f16x2' | 'tex0_f16x4' | 'tex0_f32' | 'tex0_f32x2' | 'tex0_f32x3' | 'tex0_f32x4' | 'tex0_i32' | 'tex0_i32x2' | 'tex0_i32x3' | 'tex0_i32x4' | 'tex0_u32' | 'tex0_u32x2' | 'tex0_u32x3' | 'tex0_u32x4' | 'tex1_u8normx2' | 'tex1_u8normx4' | 'tex1_i8normx2' | 'tex1_i8normx4' | 'tex1_u16x2' | 'tex1_u16x4' | 'tex1_i16x2' | 'tex1_i16x4' | 'tex1_u16normx2' | 'tex1_u16normx4' | 'tex1_i16normx2' | 'tex1_i16normx4' | 'tex1_f16x2' | 'tex1_f16x4' | 'tex1_f32' | 'tex1_f32x2' | 'tex1_f32x3' | 'tex1_f32x4' | 'tex1_i32' | 'tex1_i32x2' | 'tex1_i32x3' | 'tex1_i32x4' | 'tex1_u32' | 'tex1_u32x2' | 'tex1_u32x3' | 'tex1_u32x4' | 'tex2_u8normx2' | 'tex2_u8normx4' | 'tex2_i8normx2' | 'tex2_i8normx4' | 'tex2_u16x2' | 'tex2_u16x4' | 'tex2_i16x2' | 'tex2_i16x4' | 'tex2_u16normx2' | 'tex2_u16normx4' | 'tex2_i16normx2' | 'tex2_i16normx4' | 'tex2_f16x2' | 'tex2_f16x4' | 'tex2_f32' | 'tex2_f32x2' | 'tex2_f32x3' | 'tex2_f32x4' | 'tex2_i32' | 'tex2_i32x2' | 'tex2_i32x3' | 'tex2_i32x4' | 'tex2_u32' | 'tex2_u32x2' | 'tex2_u32x3' | 'tex2_u32x4' | 'tex3_u8normx2' | 'tex3_u8normx4' | 'tex3_i8normx2' | 'tex3_i8normx4' | 'tex3_u16x2' | 'tex3_u16x4' | 'tex3_i16x2' | 'tex3_i16x4' | 'tex3_u16normx2' | 'tex3_u16normx4' | 'tex3_i16normx2' | 'tex3_i16normx4' | 'tex3_f16x2' | 'tex3_f16x4' | 'tex3_f32' | 'tex3_f32x2' | 'tex3_f32x3' | 'tex3_f32x4' | 'tex3_i32' | 'tex3_i32x2' | 'tex3_i32x3' | 'tex3_i32x4' | 'tex3_u32' | 'tex3_u32x2' | 'tex3_u32x3' | 'tex3_u32x4' | 'tex4_u8normx2' | 'tex4_u8normx4' | 'tex4_i8normx2' | 'tex4_i8normx4' | 'tex4_u16x2' | 'tex4_u16x4' | 'tex4_i16x2' | 'tex4_i16x4' | 'tex4_u16normx2' | 'tex4_u16normx4' | 'tex4_i16normx2' | 'tex4_i16normx4' | 'tex4_f16x2' | 'tex4_f16x4' | 'tex4_f32' | 'tex4_f32x2' | 'tex4_f32x3' | 'tex4_f32x4' | 'tex4_i32' | 'tex4_i32x2' | 'tex4_i32x3' | 'tex4_i32x4' | 'tex4_u32' | 'tex4_u32x2' | 'tex4_u32x3' | 'tex4_u32x4' | 'tex5_u8normx2' | 'tex5_u8normx4' | 'tex5_i8normx2' | 'tex5_i8normx4' | 'tex5_u16x2' | 'tex5_u16x4' | 'tex5_i16x2' | 'tex5_i16x4' | 'tex5_u16normx2' | 'tex5_u16normx4' | 'tex5_i16normx2' | 'tex5_i16normx4' | 'tex5_f16x2' | 'tex5_f16x4' | 'tex5_f32' | 'tex5_f32x2' | 'tex5_f32x3' | 'tex5_f32x4' | 'tex5_i32' | 'tex5_i32x2' | 'tex5_i32x3' | 'tex5_i32x4' | 'tex5_u32' | 'tex5_u32x2' | 'tex5_u32x3' | 'tex5_u32x4' | 'tex6_u8normx2' | 'tex6_u8normx4' | 'tex6_i8normx2' | 'tex6_i8normx4' | 'tex6_u16x2' | 'tex6_u16x4' | 'tex6_i16x2' | 'tex6_i16x4' | 'tex6_u16normx2' | 'tex6_u16normx4' | 'tex6_i16normx2' | 'tex6_i16normx4' | 'tex6_f16x2' | 'tex6_f16x4' | 'tex6_f32' | 'tex6_f32x2' | 'tex6_f32x3' | 'tex6_f32x4' | 'tex6_i32' | 'tex6_i32x2' | 'tex6_i32x3' | 'tex6_i32x4' | 'tex6_u32' | 'tex6_u32x2' | 'tex6_u32x3' | 'tex6_u32x4' | 'tex7_u8normx2' | 'tex7_u8normx4' | 'tex7_i8normx2' | 'tex7_i8normx4' | 'tex7_u16x2' | 'tex7_u16x4' | 'tex7_i16x2' | 'tex7_i16x4' | 'tex7_u16normx2' | 'tex7_u16normx4' | 'tex7_i16normx2' | 'tex7_i16normx4' | 'tex7_f16x2' | 'tex7_f16x4' | 'tex7_f32' | 'tex7_f32x2' | 'tex7_f32x3' | 'tex7_f32x4' | 'tex7_i32' | 'tex7_i32x2' | 'tex7_i32x3' | 'tex7_i32x4' | 'tex7_u32' | 'tex7_u32x2' | 'tex7_u32x3' | 'tex7_u32x4' | 'blendweights_f16x4' | 'blendweights_f32x4' | '
|
|
602
|
+
type VertexAttribFormat = 'position_u8normx2' | 'position_u8normx4' | 'position_i8normx2' | 'position_i8normx4' | 'position_u16x2' | 'position_u16x4' | 'position_i16x2' | 'position_i16x4' | 'position_u16normx2' | 'position_u16normx4' | 'position_i16normx2' | 'position_i16normx4' | 'position_f16x2' | 'position_f16x4' | 'position_f32' | 'position_f32x2' | 'position_f32x3' | 'position_f32x4' | 'position_i32' | 'position_i32x2' | 'position_i32x3' | 'position_i32x4' | 'position_u32' | 'position_u32x2' | 'position_u32x3' | 'position_u32x4' | 'normal_f16x4' | 'normal_f32x3' | 'normal_f32x4' | 'diffuse_u8normx4' | 'diffuse_u16x4' | 'diffuse_u16normx4' | 'diffuse_f16x4' | 'diffuse_f32x3' | 'diffuse_f32x4' | 'diffuse_u32x3' | 'diffuse_u32x4' | 'tangent_f16x4' | 'tangent_f32x3' | 'tangent_f32x4' | 'tex0_u8normx2' | 'tex0_u8normx4' | 'tex0_i8normx2' | 'tex0_i8normx4' | 'tex0_u16x2' | 'tex0_u16x4' | 'tex0_i16x2' | 'tex0_i16x4' | 'tex0_u16normx2' | 'tex0_u16normx4' | 'tex0_i16normx2' | 'tex0_i16normx4' | 'tex0_f16x2' | 'tex0_f16x4' | 'tex0_f32' | 'tex0_f32x2' | 'tex0_f32x3' | 'tex0_f32x4' | 'tex0_i32' | 'tex0_i32x2' | 'tex0_i32x3' | 'tex0_i32x4' | 'tex0_u32' | 'tex0_u32x2' | 'tex0_u32x3' | 'tex0_u32x4' | 'tex1_u8normx2' | 'tex1_u8normx4' | 'tex1_i8normx2' | 'tex1_i8normx4' | 'tex1_u16x2' | 'tex1_u16x4' | 'tex1_i16x2' | 'tex1_i16x4' | 'tex1_u16normx2' | 'tex1_u16normx4' | 'tex1_i16normx2' | 'tex1_i16normx4' | 'tex1_f16x2' | 'tex1_f16x4' | 'tex1_f32' | 'tex1_f32x2' | 'tex1_f32x3' | 'tex1_f32x4' | 'tex1_i32' | 'tex1_i32x2' | 'tex1_i32x3' | 'tex1_i32x4' | 'tex1_u32' | 'tex1_u32x2' | 'tex1_u32x3' | 'tex1_u32x4' | 'tex2_u8normx2' | 'tex2_u8normx4' | 'tex2_i8normx2' | 'tex2_i8normx4' | 'tex2_u16x2' | 'tex2_u16x4' | 'tex2_i16x2' | 'tex2_i16x4' | 'tex2_u16normx2' | 'tex2_u16normx4' | 'tex2_i16normx2' | 'tex2_i16normx4' | 'tex2_f16x2' | 'tex2_f16x4' | 'tex2_f32' | 'tex2_f32x2' | 'tex2_f32x3' | 'tex2_f32x4' | 'tex2_i32' | 'tex2_i32x2' | 'tex2_i32x3' | 'tex2_i32x4' | 'tex2_u32' | 'tex2_u32x2' | 'tex2_u32x3' | 'tex2_u32x4' | 'tex3_u8normx2' | 'tex3_u8normx4' | 'tex3_i8normx2' | 'tex3_i8normx4' | 'tex3_u16x2' | 'tex3_u16x4' | 'tex3_i16x2' | 'tex3_i16x4' | 'tex3_u16normx2' | 'tex3_u16normx4' | 'tex3_i16normx2' | 'tex3_i16normx4' | 'tex3_f16x2' | 'tex3_f16x4' | 'tex3_f32' | 'tex3_f32x2' | 'tex3_f32x3' | 'tex3_f32x4' | 'tex3_i32' | 'tex3_i32x2' | 'tex3_i32x3' | 'tex3_i32x4' | 'tex3_u32' | 'tex3_u32x2' | 'tex3_u32x3' | 'tex3_u32x4' | 'tex4_u8normx2' | 'tex4_u8normx4' | 'tex4_i8normx2' | 'tex4_i8normx4' | 'tex4_u16x2' | 'tex4_u16x4' | 'tex4_i16x2' | 'tex4_i16x4' | 'tex4_u16normx2' | 'tex4_u16normx4' | 'tex4_i16normx2' | 'tex4_i16normx4' | 'tex4_f16x2' | 'tex4_f16x4' | 'tex4_f32' | 'tex4_f32x2' | 'tex4_f32x3' | 'tex4_f32x4' | 'tex4_i32' | 'tex4_i32x2' | 'tex4_i32x3' | 'tex4_i32x4' | 'tex4_u32' | 'tex4_u32x2' | 'tex4_u32x3' | 'tex4_u32x4' | 'tex5_u8normx2' | 'tex5_u8normx4' | 'tex5_i8normx2' | 'tex5_i8normx4' | 'tex5_u16x2' | 'tex5_u16x4' | 'tex5_i16x2' | 'tex5_i16x4' | 'tex5_u16normx2' | 'tex5_u16normx4' | 'tex5_i16normx2' | 'tex5_i16normx4' | 'tex5_f16x2' | 'tex5_f16x4' | 'tex5_f32' | 'tex5_f32x2' | 'tex5_f32x3' | 'tex5_f32x4' | 'tex5_i32' | 'tex5_i32x2' | 'tex5_i32x3' | 'tex5_i32x4' | 'tex5_u32' | 'tex5_u32x2' | 'tex5_u32x3' | 'tex5_u32x4' | 'tex6_u8normx2' | 'tex6_u8normx4' | 'tex6_i8normx2' | 'tex6_i8normx4' | 'tex6_u16x2' | 'tex6_u16x4' | 'tex6_i16x2' | 'tex6_i16x4' | 'tex6_u16normx2' | 'tex6_u16normx4' | 'tex6_i16normx2' | 'tex6_i16normx4' | 'tex6_f16x2' | 'tex6_f16x4' | 'tex6_f32' | 'tex6_f32x2' | 'tex6_f32x3' | 'tex6_f32x4' | 'tex6_i32' | 'tex6_i32x2' | 'tex6_i32x3' | 'tex6_i32x4' | 'tex6_u32' | 'tex6_u32x2' | 'tex6_u32x3' | 'tex6_u32x4' | 'tex7_u8normx2' | 'tex7_u8normx4' | 'tex7_i8normx2' | 'tex7_i8normx4' | 'tex7_u16x2' | 'tex7_u16x4' | 'tex7_i16x2' | 'tex7_i16x4' | 'tex7_u16normx2' | 'tex7_u16normx4' | 'tex7_i16normx2' | 'tex7_i16normx4' | 'tex7_f16x2' | 'tex7_f16x4' | 'tex7_f32' | 'tex7_f32x2' | 'tex7_f32x3' | 'tex7_f32x4' | 'tex7_i32' | 'tex7_i32x2' | 'tex7_i32x3' | 'tex7_i32x4' | 'tex7_u32' | 'tex7_u32x2' | 'tex7_u32x3' | 'tex7_u32x4' | 'blendweights_f16x1' | 'blendweights_f32x1' | 'blendweights_f16x2' | 'blendweights_f32x2' | 'blendweights_f16x3' | 'blendweights_f32x3' | 'blendweights_f16x4' | 'blendweights_f32x4' | 'blendindices_f16x1' | 'blendindices_u16x1' | 'blendindices_f32x1' | 'blendindices_u32x1' | 'blendindices_f16x2' | 'blendindices_u16x2' | 'blendindices_f32x2' | 'blendindices_u32x2' | 'blendindices_f16x3' | 'blendindices_u16x3' | 'blendindices_f32x3' | 'blendindices_u32x3' | 'blendindices_f16x4' | 'blendindices_u16x4' | 'blendindices_f32x4' | 'blendindices_u32x4';
|
|
589
603
|
/**
|
|
590
604
|
* The semantic type of vertex
|
|
591
605
|
* @public
|
|
@@ -674,6 +688,26 @@ declare enum GPUResourceUsageFlags {
|
|
|
674
688
|
DYNAMIC = 2048,
|
|
675
689
|
MANAGED = 4096
|
|
676
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Get vertex attribute index by semantic
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
declare function getVertexAttribByName(name: VertexSemantic): number;
|
|
696
|
+
/**
|
|
697
|
+
* Get vertex semantic by attribute index
|
|
698
|
+
* @public
|
|
699
|
+
*/
|
|
700
|
+
declare function getVertexAttribName(attrib: number): VertexSemantic;
|
|
701
|
+
/**
|
|
702
|
+
* Get byte size of specified vertex format
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
declare function getVertexFormatSize(fmt: VertexAttribFormat): number;
|
|
706
|
+
/**
|
|
707
|
+
* Get number of components of specified vertex format
|
|
708
|
+
* @public
|
|
709
|
+
*/
|
|
710
|
+
declare function getVertexFormatComponentCount(fmt: VertexAttribFormat): number;
|
|
677
711
|
/**
|
|
678
712
|
* Get vertex format by semantic and component type and component count
|
|
679
713
|
* @param semantic - The vertex semantic
|
|
@@ -838,6 +872,8 @@ interface BufferBindingLayout {
|
|
|
838
872
|
uniformLayout: UniformBufferLayout;
|
|
839
873
|
/** minimum binding size of the buffer */
|
|
840
874
|
minBindingSize?: number;
|
|
875
|
+
/** dynamic offset index */
|
|
876
|
+
dynamicOffsetIndex: number;
|
|
841
877
|
}
|
|
842
878
|
/**
|
|
843
879
|
* Binding layout of a sampler
|
|
@@ -1005,6 +1041,7 @@ interface BaseTexture<T = unknown> extends GPUObject<T> {
|
|
|
1005
1041
|
readonly depth: number;
|
|
1006
1042
|
readonly format: TextureFormat;
|
|
1007
1043
|
readonly mipLevelCount: number;
|
|
1044
|
+
readonly memCost: number;
|
|
1008
1045
|
samplerOptions: SamplerOptions;
|
|
1009
1046
|
init(): void;
|
|
1010
1047
|
generateMipmaps(): void;
|
|
@@ -1117,6 +1154,7 @@ interface FrameBuffer<T = unknown> extends GPUObject<T> {
|
|
|
1117
1154
|
getWidth(): number;
|
|
1118
1155
|
getHeight(): number;
|
|
1119
1156
|
getSampleCount(): number;
|
|
1157
|
+
getHash(): string;
|
|
1120
1158
|
setColorAttachmentCubeFace(index: number, face: CubeFace): void;
|
|
1121
1159
|
setColorAttachmentMipLevel(index: number, level: number): void;
|
|
1122
1160
|
setColorAttachmentLayer(index: number, layer: number): void;
|
|
@@ -1154,15 +1192,22 @@ type StructuredValue = number | TypedArray | VectorBase | {
|
|
|
1154
1192
|
*/
|
|
1155
1193
|
interface BindGroup extends GPUObject<unknown> {
|
|
1156
1194
|
getLayout(): BindGroupLayout;
|
|
1195
|
+
getDynamicOffsets(): number[];
|
|
1196
|
+
getGPUId(): string;
|
|
1157
1197
|
getBuffer(name: string): GPUDataBuffer;
|
|
1158
1198
|
getTexture(name: string): BaseTexture;
|
|
1159
|
-
setBuffer(name: string, buffer: GPUDataBuffer): void;
|
|
1199
|
+
setBuffer(name: string, buffer: GPUDataBuffer, offset?: number, bindOffset?: number, bindSize?: number): void;
|
|
1160
1200
|
setValue(name: string, value: StructuredValue): any;
|
|
1161
1201
|
setRawData(name: string, byteOffset: number, data: TypedArray, srcPos?: number, srcLength?: number): any;
|
|
1162
1202
|
setTexture(name: string, texture: BaseTexture, sampler?: TextureSampler): any;
|
|
1163
1203
|
setTextureView(name: string, value: BaseTexture, level?: number, face?: number, mipCount?: number, sampler?: TextureSampler): any;
|
|
1164
1204
|
setSampler(name: string, sampler: TextureSampler): any;
|
|
1165
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Render bundle
|
|
1208
|
+
* @public
|
|
1209
|
+
*/
|
|
1210
|
+
type RenderBundle = unknown;
|
|
1166
1211
|
/**
|
|
1167
1212
|
* Creates the default name for the type of given gpu object
|
|
1168
1213
|
* @param obj - The gpu object
|
|
@@ -1213,7 +1258,7 @@ declare class PBShaderExp extends Proxiable<PBShaderExp> {
|
|
|
1213
1258
|
* @param group - The bind group index
|
|
1214
1259
|
* @returns self
|
|
1215
1260
|
*/
|
|
1216
|
-
uniformBuffer(group: number): PBShaderExp;
|
|
1261
|
+
uniformBuffer(group: number, bindingSize?: number): PBShaderExp;
|
|
1217
1262
|
/**
|
|
1218
1263
|
* Point out that the variable should be in workgroup address space
|
|
1219
1264
|
*
|
|
@@ -1229,12 +1274,24 @@ declare class PBShaderExp extends Proxiable<PBShaderExp> {
|
|
|
1229
1274
|
* @returns self
|
|
1230
1275
|
*/
|
|
1231
1276
|
storage(group: number): PBShaderExp;
|
|
1277
|
+
/**
|
|
1278
|
+
* Point out that the variable is read-only and should be in storage address space
|
|
1279
|
+
* @param group - The bind group index
|
|
1280
|
+
* @returns self
|
|
1281
|
+
*/
|
|
1282
|
+
storageReadonly(group: number): PBShaderExp;
|
|
1232
1283
|
/**
|
|
1233
1284
|
* Point out that the variable should be a storage buffer
|
|
1234
1285
|
* @param group - The bind group index
|
|
1235
1286
|
* @returns self
|
|
1236
1287
|
*/
|
|
1237
|
-
storageBuffer(group: number): PBShaderExp;
|
|
1288
|
+
storageBuffer(group: number, bindingSize?: number): PBShaderExp;
|
|
1289
|
+
/**
|
|
1290
|
+
* Point out that the variable is read-only and should be a storage buffer
|
|
1291
|
+
* @param group - The bind group index
|
|
1292
|
+
* @returns self
|
|
1293
|
+
*/
|
|
1294
|
+
storageBufferReadonly(group: number, bindingSize?: number): PBShaderExp;
|
|
1238
1295
|
inout(): PBShaderExp;
|
|
1239
1296
|
out(): PBShaderExp;
|
|
1240
1297
|
/**
|
|
@@ -1508,6 +1565,26 @@ interface ProgramBuilder {
|
|
|
1508
1565
|
* @returns the 'referenceOf' expression
|
|
1509
1566
|
*/
|
|
1510
1567
|
referenceOf(ptr: PBShaderExp): PBShaderExp;
|
|
1568
|
+
/** Atomic int type variable constructors */
|
|
1569
|
+
atomic_int: {
|
|
1570
|
+
(): PBShaderExp;
|
|
1571
|
+
(rhs: number): PBShaderExp;
|
|
1572
|
+
(rhs: boolean): PBShaderExp;
|
|
1573
|
+
(rhs: PBShaderExp): PBShaderExp;
|
|
1574
|
+
(name: string): PBShaderExp;
|
|
1575
|
+
ptr: ShaderTypeFunc;
|
|
1576
|
+
[dim: number]: ShaderTypeFunc;
|
|
1577
|
+
};
|
|
1578
|
+
/** Atomic uint type variable constructors */
|
|
1579
|
+
atomic_uint: {
|
|
1580
|
+
(): PBShaderExp;
|
|
1581
|
+
(rhs: number): PBShaderExp;
|
|
1582
|
+
(rhs: boolean): PBShaderExp;
|
|
1583
|
+
(rhs: PBShaderExp): PBShaderExp;
|
|
1584
|
+
(name: string): PBShaderExp;
|
|
1585
|
+
ptr: ShaderTypeFunc;
|
|
1586
|
+
[dim: number]: ShaderTypeFunc;
|
|
1587
|
+
};
|
|
1511
1588
|
/** float type variable constructors */
|
|
1512
1589
|
float: {
|
|
1513
1590
|
(): PBShaderExp;
|
|
@@ -1968,13 +2045,13 @@ interface ProgramBuilder {
|
|
|
1968
2045
|
arrayLength(x: PBShaderExp): PBShaderExp;
|
|
1969
2046
|
/** Same as the select builtin function in WGSL, only valid for WebGPU device */
|
|
1970
2047
|
select(x: number | PBShaderExp, y: number | PBShaderExp, cond: boolean | PBShaderExp): PBShaderExp;
|
|
1971
|
-
/** Same as floatBitsToInt builtin function in GLSL, only valid for WebGL2 device */
|
|
2048
|
+
/** Same as floatBitsToInt builtin function in GLSL, only valid for WebGL2 device and WebGPU device */
|
|
1972
2049
|
floatBitsToInt(x: number | PBShaderExp): PBShaderExp;
|
|
1973
|
-
/** Same as floatBitsToUint builtin function in GLSL, only valid for WebGL2 device */
|
|
2050
|
+
/** Same as floatBitsToUint builtin function in GLSL, only valid for WebGL2 device and WebGPU device */
|
|
1974
2051
|
floatBitsToUint(x: number | PBShaderExp): PBShaderExp;
|
|
1975
|
-
/** Same as intBitsToFloat builtin function in GLSL, only valid for WebGL2 device */
|
|
2052
|
+
/** Same as intBitsToFloat builtin function in GLSL, only valid for WebGL2 device and WebGPU device */
|
|
1976
2053
|
intBitsToFloat(x: number | PBShaderExp): PBShaderExp;
|
|
1977
|
-
/** Same as uintBitsToFloat builtin function in GLSL, only valid for WebGL2 device */
|
|
2054
|
+
/** Same as uintBitsToFloat builtin function in GLSL, only valid for WebGL2 device and WebGPU device */
|
|
1978
2055
|
uintBitsToFloat(x: number | PBShaderExp): PBShaderExp;
|
|
1979
2056
|
/** Same as pack4x8snorm builtin function in WGSL, only valid for WebGPU device */
|
|
1980
2057
|
pack4x8snorm(x: PBShaderExp): PBShaderExp;
|
|
@@ -2088,6 +2165,8 @@ interface ProgramBuilder {
|
|
|
2088
2165
|
atomicOr(ptr: PBShaderExp, value: number | PBShaderExp): PBShaderExp;
|
|
2089
2166
|
/** atomicXor, only valid for WebGPU device */
|
|
2090
2167
|
atomicXor(ptr: PBShaderExp, value: number | PBShaderExp): PBShaderExp;
|
|
2168
|
+
/** atomicExchange, only valid for WebGPU device */
|
|
2169
|
+
atomicExchange(ptr: PBShaderExp, value: number | PBShaderExp): PBShaderExp;
|
|
2091
2170
|
}
|
|
2092
2171
|
/**
|
|
2093
2172
|
* The program builder class
|
|
@@ -2564,7 +2643,9 @@ interface StencilState {
|
|
|
2564
2643
|
* @public
|
|
2565
2644
|
*/
|
|
2566
2645
|
interface RenderStateSet {
|
|
2567
|
-
/** Creates a new RenderStateSet by
|
|
2646
|
+
/** Creates a new RenderStateSet object by deep copy from this object */
|
|
2647
|
+
clone(): RenderStateSet;
|
|
2648
|
+
/** Shallow copy existing RenderStateSet object to this */
|
|
2568
2649
|
copyFrom(stateSet: RenderStateSet): void;
|
|
2569
2650
|
/** Fragment output related render statements or null if the default values should be used */
|
|
2570
2651
|
readonly colorState: ColorState;
|
|
@@ -2628,6 +2709,133 @@ interface RenderStateSet {
|
|
|
2628
2709
|
apply(force?: boolean): void;
|
|
2629
2710
|
}
|
|
2630
2711
|
|
|
2712
|
+
/**
|
|
2713
|
+
* ObjectPool class is responsible for managing and reusing textures and framebuffers.
|
|
2714
|
+
* @public
|
|
2715
|
+
*/
|
|
2716
|
+
declare class Pool {
|
|
2717
|
+
/**
|
|
2718
|
+
* Creates an instance of Pool class
|
|
2719
|
+
* @param device - Rendering device
|
|
2720
|
+
*/
|
|
2721
|
+
constructor(device: AbstractDevice, memCostThreshold?: number);
|
|
2722
|
+
autoRelease(): void;
|
|
2723
|
+
/**
|
|
2724
|
+
* Fetch a temporal 2D texture from the object pool.
|
|
2725
|
+
* @param autoRelease - Whether the texture should be automatically released at the next frame.
|
|
2726
|
+
* @param format - The format of the texture.
|
|
2727
|
+
* @param width - The width of the texture.
|
|
2728
|
+
* @param height - The height of the texture.
|
|
2729
|
+
* @param mipmapping - Whether this texture support mipmapping
|
|
2730
|
+
* @returns The fetched Texture2D object.
|
|
2731
|
+
*/
|
|
2732
|
+
fetchTemporalTexture2D(autoRelease: boolean, format: TextureFormat, width: number, height: number, mipmapping: boolean): Texture2D;
|
|
2733
|
+
/**
|
|
2734
|
+
* Fetch a temporal 2D array texture from the object pool.
|
|
2735
|
+
* @param autoRelease - Whether the texture should be automatically released at the next frame.
|
|
2736
|
+
* @param format - Format of the texture.
|
|
2737
|
+
* @param width - Width of the texture.
|
|
2738
|
+
* @param height - Height of the texture.
|
|
2739
|
+
* @param numLayers - Layer count of the texture
|
|
2740
|
+
* @param mipmapping - Whether this texture support mipmapping
|
|
2741
|
+
* @returns The fetched Texture2DArray object.
|
|
2742
|
+
*/
|
|
2743
|
+
fetchTemporalTexture2DArray(autoRelease: boolean, format: TextureFormat, width: number, height: number, numLayers: number, mipmapping: boolean): Texture2DArray;
|
|
2744
|
+
/**
|
|
2745
|
+
* Fetch a temporal Cube texture from the object pool.
|
|
2746
|
+
* @param autoRelease - Whether the texture should be automatically released at the next frame.
|
|
2747
|
+
* @param format - Format of the texture.
|
|
2748
|
+
* @param size - size of the texture.
|
|
2749
|
+
* @param mipmapping - Whether this texture support mipmapping
|
|
2750
|
+
* @returns The fetched TextureCube object.
|
|
2751
|
+
*/
|
|
2752
|
+
fetchTemporalTextureCube(autoRelease: boolean, format: TextureFormat, size: number, mipmapping: boolean): TextureCube;
|
|
2753
|
+
/**
|
|
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.
|
|
2795
|
+
* @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.
|
|
2800
|
+
* @returns The fetched FrameBuffer object.
|
|
2801
|
+
*/
|
|
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;
|
|
2803
|
+
/**
|
|
2804
|
+
* Creates a temporal framebuffer from the object pool.
|
|
2805
|
+
* @param autoRelease - Whether the framebuffer should be automatically released at the next frame.
|
|
2806
|
+
* @param colorAttachments - Array of color attachments for the framebuffer.
|
|
2807
|
+
* @param depthAttachment - Depth attachment for the framebuffer.
|
|
2808
|
+
* @param sampleCount - The sample count for the framebuffer.
|
|
2809
|
+
* @param ignoreDepthStencil - Whether to ignore depth stencil.
|
|
2810
|
+
* @returns The fetched FrameBuffer object.
|
|
2811
|
+
*/
|
|
2812
|
+
createTemporalFramebuffer(autoRelease: boolean, colorAttachments: BaseTexture[], depthAttachment?: BaseTexture, sampleCount?: number, ignoreDepthStencil?: boolean): FrameBuffer<unknown>;
|
|
2813
|
+
/**
|
|
2814
|
+
* Dispose a texture that is allocated from the object pool.
|
|
2815
|
+
* @param texture - The texture to dispose.
|
|
2816
|
+
*/
|
|
2817
|
+
disposeTexture(texture: BaseTexture): void;
|
|
2818
|
+
/**
|
|
2819
|
+
* Release a texture back to the object pool.
|
|
2820
|
+
* @param texture - The texture to release.
|
|
2821
|
+
*/
|
|
2822
|
+
releaseTexture(texture: BaseTexture): void;
|
|
2823
|
+
/**
|
|
2824
|
+
* Dispose a framebuffer that is allocated from the object pool.
|
|
2825
|
+
* @param fb - The framebuffer to dispose.
|
|
2826
|
+
*/
|
|
2827
|
+
disposeFrameBuffer(fb: FrameBuffer): void;
|
|
2828
|
+
/**
|
|
2829
|
+
* Release a framebuffer back to the object pool.
|
|
2830
|
+
* @param fb - The framebuffer to release.
|
|
2831
|
+
*/
|
|
2832
|
+
releaseFrameBuffer(fb: FrameBuffer): void;
|
|
2833
|
+
/**
|
|
2834
|
+
* Purge the object pool by disposing all free framebuffers and textures.
|
|
2835
|
+
*/
|
|
2836
|
+
purge(): void;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2631
2839
|
/**
|
|
2632
2840
|
* The webgl context type
|
|
2633
2841
|
* @public
|
|
@@ -2662,7 +2870,7 @@ type DataType = 'u8' | 'u8norm' | 'i8' | 'i8norm' | 'u16' | 'u16norm' | 'i16' |
|
|
|
2662
2870
|
* Texture format type
|
|
2663
2871
|
* @public
|
|
2664
2872
|
*/
|
|
2665
|
-
type TextureFormat = 'unknown' | 'r8unorm' | 'r8snorm' | 'r16f' | 'r32f' | 'r8ui' | 'r8i' | 'r16ui' | 'r16i' | 'r32ui' | 'r32i' | 'rg8unorm' | 'rg8snorm' | 'rg16f' | 'rg32f' | 'rg8ui' | 'rg8i' | 'rg16ui' | 'rg16i' | 'rg32ui' | 'rg32i' | 'rgba8unorm' | 'rgba8unorm-srgb' | 'rgba8snorm' | 'bgra8unorm' | 'bgra8unorm-srgb' | 'rgba16f' | 'rgba32f' | 'rgba8ui' | 'rgba8i' | 'rgba16ui' | 'rgba16i' | 'rgba32ui' | 'rgba32i' | 'rg11b10uf' | 'd16' | 'd24' | 'd32f' | 'd24s8' | 'd32fs8' | 'dxt1' | 'dxt1-srgb' | 'dxt3' | 'dxt3-srgb' | 'dxt5' | 'dxt5-srgb';
|
|
2873
|
+
type TextureFormat = 'unknown' | 'r8unorm' | 'r8snorm' | 'r16f' | 'r32f' | 'r8ui' | 'r8i' | 'r16ui' | 'r16i' | 'r32ui' | 'r32i' | 'rg8unorm' | 'rg8snorm' | 'rg16f' | 'rg32f' | 'rg8ui' | 'rg8i' | 'rg16ui' | 'rg16i' | 'rg32ui' | 'rg32i' | 'rgba8unorm' | 'rgba8unorm-srgb' | 'rgba8snorm' | 'bgra8unorm' | 'bgra8unorm-srgb' | 'rgba16f' | 'rgba32f' | 'rgba8ui' | 'rgba8i' | 'rgba16ui' | 'rgba16i' | 'rgba32ui' | 'rgba32i' | 'rg11b10uf' | 'd16' | 'd24' | 'd32f' | 'd24s8' | 'd32fs8' | 'dxt1' | 'dxt1-srgb' | 'dxt3' | 'dxt3-srgb' | 'dxt5' | 'dxt5-srgb' | 'bc4' | 'bc4-signed' | 'bc5' | 'bc5-signed' | 'bc7' | 'bc7-srgb' | 'bc6h' | 'bc6h-signed' | 'astc-4x4' | 'astc-4x4-srgb' | 'astc-5x4' | 'astc-5x4-srgb' | 'astc-5x5' | 'astc-5x5-srgb' | 'astc-6x5' | 'astc-6x5-srgb' | 'astc-6x6' | 'astc-6x6-srgb' | 'astc-8x5' | 'astc-8x5-srgb' | 'astc-8x6' | 'astc-8x6-srgb' | 'astc-8x8' | 'astc-8x8-srgb' | 'astc-10x5' | 'astc-10x5-srgb' | 'astc-10x6' | 'astc-10x6-srgb' | 'astc-10x8' | 'astc-10x8-srgb' | 'astc-10x10' | 'astc-10x10-srgb' | 'astc-12x10' | 'astc-12x10-srgb' | 'astc-12x12' | 'astc-12x12-srgb';
|
|
2666
2874
|
/**
|
|
2667
2875
|
* Converts a non-sRGB texture format to the corresponding sRGB texture format
|
|
2668
2876
|
* @param format - The texture format to be converted
|
|
@@ -2898,6 +3106,10 @@ interface ShaderCaps {
|
|
|
2898
3106
|
maxUniformBufferSize: number;
|
|
2899
3107
|
/** The uniform buffer offset alignment */
|
|
2900
3108
|
uniformBufferOffsetAlignment: number;
|
|
3109
|
+
/** The maximum number of bytes of storage buffer */
|
|
3110
|
+
maxStorageBufferSize: number;
|
|
3111
|
+
/** The storage buffer offset alignment */
|
|
3112
|
+
storageBufferOffsetAlignment: number;
|
|
2901
3113
|
}
|
|
2902
3114
|
/**
|
|
2903
3115
|
* Information of a texture format
|
|
@@ -2926,6 +3138,12 @@ interface TextureCaps {
|
|
|
2926
3138
|
npo2Repeating: boolean;
|
|
2927
3139
|
/** True if device supports dxt1, dxt3, dxt5 texture format */
|
|
2928
3140
|
supportS3TC: boolean;
|
|
3141
|
+
/** True if device supports bptc texture format */
|
|
3142
|
+
supportBPTC: boolean;
|
|
3143
|
+
/** True if device supports rgtc texture format */
|
|
3144
|
+
supportRGTC: boolean;
|
|
3145
|
+
/** True if device supports astc texture format */
|
|
3146
|
+
supportASTC: boolean;
|
|
2929
3147
|
/** True if device supports dxt1_srgb, dxt3-srgb, dxt5-srgb texture format */
|
|
2930
3148
|
supportS3TCSRGB: boolean;
|
|
2931
3149
|
/** True if device supports depth texture */
|
|
@@ -3104,6 +3322,12 @@ type DeviceViewport = {
|
|
|
3104
3322
|
* @public
|
|
3105
3323
|
*/
|
|
3106
3324
|
interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
3325
|
+
/** Get pool object */
|
|
3326
|
+
pool: Pool;
|
|
3327
|
+
/** vSync */
|
|
3328
|
+
vSync: boolean;
|
|
3329
|
+
/** Get adapter information */
|
|
3330
|
+
getAdapterInfo(): any;
|
|
3107
3331
|
/** Get sample count of current frame buffer */
|
|
3108
3332
|
getFrameBufferSampleCount(): number;
|
|
3109
3333
|
/** Returns true if device context is lost. */
|
|
@@ -3120,6 +3344,10 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
|
3120
3344
|
getBackBufferHeight(): number;
|
|
3121
3345
|
/** Get the device capabilities */
|
|
3122
3346
|
getDeviceCaps(): DeviceCaps;
|
|
3347
|
+
/** Schedule next frame */
|
|
3348
|
+
nextFrame(callback: () => void): number;
|
|
3349
|
+
/** Cancel schedule next frame */
|
|
3350
|
+
cancelNextFrame(handle: number): any;
|
|
3123
3351
|
/** Set font for drawText function */
|
|
3124
3352
|
setFont(fontName: string): any;
|
|
3125
3353
|
/**
|
|
@@ -3250,6 +3478,15 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
|
3250
3478
|
* @param options - The creation options
|
|
3251
3479
|
*/
|
|
3252
3480
|
createBuffer(sizeInBytes: number, options: BufferCreationOptions): GPUDataBuffer;
|
|
3481
|
+
/**
|
|
3482
|
+
* Copies a buffer to another buffer
|
|
3483
|
+
* @param sourceBuffer - Source buffer
|
|
3484
|
+
* @param destBuffer - destination buffer
|
|
3485
|
+
* @param srcOffset - Source offset in bytes
|
|
3486
|
+
* @param dstOffset - Destination offset in bytes
|
|
3487
|
+
* @param bytes - How many bytes to be copy
|
|
3488
|
+
*/
|
|
3489
|
+
copyBuffer(sourceBuffer: GPUDataBuffer, destBuffer: GPUDataBuffer, srcOffset: number, dstOffset: number, bytes: number): any;
|
|
3253
3490
|
/**
|
|
3254
3491
|
* Creates an index buffer
|
|
3255
3492
|
* @param data - Data of the index buffer
|
|
@@ -3316,11 +3553,29 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
|
3316
3553
|
/** Get current render states */
|
|
3317
3554
|
getRenderStates(): RenderStateSet;
|
|
3318
3555
|
/**
|
|
3319
|
-
*
|
|
3556
|
+
* Sets the current framebuffer to the specified FrameBuffer object.
|
|
3320
3557
|
*
|
|
3321
|
-
* @param rt - The
|
|
3558
|
+
* @param rt - The FrameBuffer object to set as the current framebuffer.
|
|
3322
3559
|
*/
|
|
3323
|
-
setFramebuffer(rt: FrameBuffer):
|
|
3560
|
+
setFramebuffer(rt: FrameBuffer): any;
|
|
3561
|
+
/**
|
|
3562
|
+
* Sets the current framebuffer specifying complex color attachments, an optional depth attachment, MIP level, face, and sample count.
|
|
3563
|
+
*
|
|
3564
|
+
* @param color - An array of BaseTextures or objects containing a BaseTexture and optional properties. Each BaseTexture or object will serve as a color attachment.
|
|
3565
|
+
* - If an object is provided, it can specify:
|
|
3566
|
+
* - `texture`: The BaseTexture to use.
|
|
3567
|
+
* - `miplevel`: Optional MIP level for this specific texture. default is 0.
|
|
3568
|
+
* - `face`: Optional face index for cube map textures, specifying the cube face this texture is attached to. default is 0.
|
|
3569
|
+
* - `layer`: Optional layer index, useful for texture arrays. default is 0.
|
|
3570
|
+
* @param depth - Optional BaseTexture to serve as the depth attachment.
|
|
3571
|
+
* @param sampleCount - Optional sample count defining the number of samples for multisampling.
|
|
3572
|
+
*/
|
|
3573
|
+
setFramebuffer(color: (BaseTexture | {
|
|
3574
|
+
texture: BaseTexture;
|
|
3575
|
+
miplevel?: number;
|
|
3576
|
+
face?: number;
|
|
3577
|
+
layer?: number;
|
|
3578
|
+
})[], depth?: BaseTexture, miplevel?: number, face?: number, sampleCount?: number): any;
|
|
3324
3579
|
/** Get current frame buffer */
|
|
3325
3580
|
getFramebuffer(): FrameBuffer;
|
|
3326
3581
|
/**
|
|
@@ -3367,6 +3622,20 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
|
3367
3622
|
* @param buffer - The output buffer
|
|
3368
3623
|
*/
|
|
3369
3624
|
readPixelsToBuffer(index: number, x: number, y: number, w: number, h: number, buffer: GPUDataBuffer): void;
|
|
3625
|
+
/**
|
|
3626
|
+
* Begin capture draw commands
|
|
3627
|
+
*/
|
|
3628
|
+
beginCapture(): void;
|
|
3629
|
+
/**
|
|
3630
|
+
* Executes render bundle
|
|
3631
|
+
* @param renderBundle - RenderBundle to be execute
|
|
3632
|
+
*/
|
|
3633
|
+
executeRenderBundle(renderBundle: RenderBundle): any;
|
|
3634
|
+
/**
|
|
3635
|
+
* End capture draw commands
|
|
3636
|
+
* @returns A RenderBundle that holds the captured draw commands
|
|
3637
|
+
*/
|
|
3638
|
+
endCapture(): RenderBundle;
|
|
3370
3639
|
/** Get the video memory usage in bytes */
|
|
3371
3640
|
videoMemoryUsage: number;
|
|
3372
3641
|
/** Get the current frame information */
|
|
@@ -3450,12 +3719,6 @@ interface AbstractDevice extends IEventTarget<DeviceEventMap> {
|
|
|
3450
3719
|
* @param f - The function to be scheduled
|
|
3451
3720
|
*/
|
|
3452
3721
|
runNextFrame(f: () => void): void;
|
|
3453
|
-
/**
|
|
3454
|
-
* Canels a pre scheduled function
|
|
3455
|
-
*
|
|
3456
|
-
* @param f - The function to be cancled
|
|
3457
|
-
*/
|
|
3458
|
-
cancelNextFrameCall(f: () => void): void;
|
|
3459
3722
|
/** Exits from current rendering loop */
|
|
3460
3723
|
exitLoop(): void;
|
|
3461
3724
|
/**
|
|
@@ -3557,8 +3820,12 @@ declare abstract class BaseDevice {
|
|
|
3557
3820
|
protected _backend: DeviceBackend;
|
|
3558
3821
|
protected _beginFrameCounter: number;
|
|
3559
3822
|
protected _programBuilder: ProgramBuilder;
|
|
3823
|
+
protected _pool: Pool;
|
|
3824
|
+
protected _temporalFramebuffer: boolean;
|
|
3825
|
+
protected _vSync: boolean;
|
|
3560
3826
|
private _stateStack;
|
|
3561
3827
|
constructor(cvs: HTMLCanvasElement, backend: DeviceBackend);
|
|
3828
|
+
abstract getAdapterInfo(): any;
|
|
3562
3829
|
abstract getFrameBufferSampleCount(): number;
|
|
3563
3830
|
abstract isContextLost(): boolean;
|
|
3564
3831
|
abstract getScale(): number;
|
|
@@ -3588,6 +3855,7 @@ declare abstract class BaseDevice {
|
|
|
3588
3855
|
abstract createGPUProgram(params: GPUProgramConstructParams): GPUProgram;
|
|
3589
3856
|
abstract createBindGroup(layout: BindGroupLayout): BindGroup;
|
|
3590
3857
|
abstract createBuffer(sizeInBytes: number, options: BufferCreationOptions): GPUDataBuffer;
|
|
3858
|
+
abstract copyBuffer(sourceBuffer: GPUDataBuffer, destBuffer: GPUDataBuffer, srcOffset: number, dstOffset: number, bytes: number): any;
|
|
3591
3859
|
abstract createIndexBuffer(data: Uint16Array | Uint32Array, options?: BufferCreationOptions): IndexBuffer;
|
|
3592
3860
|
abstract createStructuredBuffer(structureType: PBStructTypeInfo, options: BufferCreationOptions, data?: TypedArray): StructuredBuffer;
|
|
3593
3861
|
abstract createVertexLayout(options: VertexLayoutOptions): VertexLayout;
|
|
@@ -3602,13 +3870,17 @@ declare abstract class BaseDevice {
|
|
|
3602
3870
|
abstract getVertexLayout(): VertexLayout;
|
|
3603
3871
|
abstract setRenderStates(renderStates: RenderStateSet): void;
|
|
3604
3872
|
abstract getRenderStates(): RenderStateSet;
|
|
3605
|
-
abstract setFramebuffer(rt: FrameBuffer): void;
|
|
3606
3873
|
abstract getFramebuffer(): FrameBuffer;
|
|
3607
3874
|
abstract setBindGroup(index: number, bindGroup: BindGroup, dynamicOffsets?: Iterable<number>): any;
|
|
3608
3875
|
abstract getBindGroup(index: number): [BindGroup, Iterable<number>];
|
|
3609
3876
|
abstract flush(): void;
|
|
3877
|
+
abstract nextFrame(callback: () => void): number;
|
|
3878
|
+
abstract cancelNextFrame(handle: number): any;
|
|
3610
3879
|
abstract readPixels(index: number, x: number, y: number, w: number, h: number, buffer: TypedArray): Promise<void>;
|
|
3611
3880
|
abstract readPixelsToBuffer(index: number, x: number, y: number, w: number, h: number, buffer: GPUDataBuffer): void;
|
|
3881
|
+
abstract beginCapture(): void;
|
|
3882
|
+
abstract endCapture(): RenderBundle;
|
|
3883
|
+
abstract executeRenderBundle(renderBundle: RenderBundle): any;
|
|
3612
3884
|
abstract looseContext(): void;
|
|
3613
3885
|
abstract restoreContext(): void;
|
|
3614
3886
|
protected abstract _draw(primitiveType: PrimitiveType, first: number, count: number): void;
|
|
@@ -3620,10 +3892,20 @@ declare abstract class BaseDevice {
|
|
|
3620
3892
|
get isRendering(): boolean;
|
|
3621
3893
|
get canvas(): HTMLCanvasElement;
|
|
3622
3894
|
get type(): string;
|
|
3895
|
+
get vSync(): boolean;
|
|
3896
|
+
set vSync(val: boolean);
|
|
3897
|
+
get pool(): Pool;
|
|
3623
3898
|
get runLoopFunction(): (device: AbstractDevice) => void;
|
|
3624
3899
|
get programBuilder(): ProgramBuilder;
|
|
3625
3900
|
setFont(fontName: string): void;
|
|
3626
3901
|
drawText(text: string, x: number, y: number, color: string): void;
|
|
3902
|
+
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;
|
|
3627
3909
|
disposeObject(obj: GPUObject, remove?: boolean): void;
|
|
3628
3910
|
restoreObject(obj: GPUObject): Promise<void>;
|
|
3629
3911
|
enableGPUTimeRecording(enable: boolean): void;
|
|
@@ -3636,7 +3918,6 @@ declare abstract class BaseDevice {
|
|
|
3636
3918
|
drawInstanced(primitiveType: PrimitiveType, first: number, count: number, numInstances: number): void;
|
|
3637
3919
|
compute(workgroupCountX: any, workgroupCountY: any, workgroupCountZ: any): void;
|
|
3638
3920
|
runNextFrame(f: () => void): void;
|
|
3639
|
-
cancelNextFrameCall(f: () => void): void;
|
|
3640
3921
|
exitLoop(): void;
|
|
3641
3922
|
runLoop(func: (device: AbstractDevice) => void): void;
|
|
3642
3923
|
pushDeviceStates(): void;
|
|
@@ -3652,6 +3933,7 @@ declare abstract class BaseDevice {
|
|
|
3652
3933
|
updateVideoMemoryCost(delta: number): void;
|
|
3653
3934
|
protected abstract onBeginFrame(): boolean;
|
|
3654
3935
|
protected abstract onEndFrame(): void;
|
|
3936
|
+
protected abstract _setFramebuffer(fb: FrameBuffer): any;
|
|
3655
3937
|
private _onresize;
|
|
3656
3938
|
private _registerEventHandlers;
|
|
3657
3939
|
private updateFrameInfo;
|
|
@@ -3879,4 +4161,4 @@ declare class StructuredBufferData {
|
|
|
3879
4161
|
set(name: string, value: StructuredValue): void;
|
|
3880
4162
|
}
|
|
3881
4163
|
|
|
3882
|
-
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, 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, getVertexAttribFormat, getVertexBufferAttribType, getVertexBufferAttribTypeBySemantic, getVertexBufferLength, getVertexBufferStride, hasAlphaChannel, hasBlueChannel, hasDepthChannel, hasGreenChannel, hasRedChannel, hasStencilChannel, isCompressedTextureFormat, isFloatTextureFormat, isIntegerTextureFormat, isSRGBTextureFormat, isSignedTextureFormat, linearTextureFormatToSRGB, makeVertexBufferType, semanticList };
|
|
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 };
|