@maptalks/gpu 0.117.0 → 0.118.0

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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="@webgpu/types" />
2
2
  /*!
3
- * @maptalks/gpu v0.117.0
3
+ * @maptalks/gpu v0.118.0
4
4
  * LICENSE : UNLICENSED
5
5
  * (c) 2016-2025 maptalks.com
6
6
  */
@@ -106,7 +106,6 @@ declare class GraphicsDevice {
106
106
  context: GPUCanvasContext;
107
107
  adapter: GPUAdapter;
108
108
  gltfManager?: any;
109
- _supportedFormats: any;
110
109
  constructor(device: GPUDevice, context: GPUCanvasContext, adapter: GPUAdapter);
111
110
  hasExtension(extension: any): boolean;
112
111
  getCommandEncoder(): GPUCommandEncoder;
@@ -115,12 +114,19 @@ declare class GraphicsDevice {
115
114
  getRenderPassEncoder(fbo: GraphicsFramebuffer): GPURenderPassEncoder;
116
115
  addCommandBuffer(commandBuffer: GPUCommandBuffer, front: boolean): void;
117
116
  submit(): void;
117
+ preserveDrawingBuffer(canvas: any): void;
118
118
  buffer(options: any): any;
119
+ elements(options: any): any;
119
120
  framebuffer(width: any, height: any): GraphicsFramebuffer;
120
- texture(config: any): GraphicsTexture;
121
+ texture(width: any, height?: any): GraphicsTexture;
121
122
  clear(options: any): void;
122
123
  read(options: any): any;
123
124
  destroy(): void;
125
+ incrDrawCall(): void;
126
+ resetDrawCalls(): void;
127
+ getDrawCalls(): 0;
128
+ _renderToClear(fbo: any): void;
129
+ _getEmptyPipeline(fbo: any): any;
124
130
  }
125
131
 
126
132
  declare class GraphicsTexture {
@@ -135,7 +141,7 @@ declare class GraphicsTexture {
135
141
  resize(width: any, height: any): void;
136
142
  update(config: any): void;
137
143
  _updateTexture(): void;
138
- getView(): GPUTextureView;
144
+ getView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
139
145
  addBindGroup(bindGroup: any): void;
140
146
  destroy(): void;
141
147
  }
@@ -349,6 +355,7 @@ declare class Geometry {
349
355
  getAttrData(activeAttributes: ActiveAttributes): any;
350
356
  getREGLData(regl: any, activeAttributes: ActiveAttributes, disableVAO: boolean): AttributeData;
351
357
  generateBuffers(device: any): void;
358
+ isBufferGenerated(): boolean;
352
359
  getVertexCount(): number;
353
360
  getColor0Size(): number;
354
361
  /**
@@ -422,6 +429,7 @@ declare class Material extends Material_base {
422
429
  set version(v: number);
423
430
  get version(): number;
424
431
  get propVersion(): number;
432
+ get textureVersion(): number;
425
433
  set doubleSided(value: boolean);
426
434
  get doubleSided(): boolean;
427
435
  getUniforms(device: any): ShaderUniforms;
@@ -552,6 +560,11 @@ declare class DynamicBuffer {
552
560
  dispose(): void;
553
561
  }
554
562
 
563
+ type BindGroupResult = {
564
+ bindGroup: GPUBindGroup;
565
+ outdated: boolean;
566
+ uniformTextures?: any;
567
+ };
555
568
  declare class BindGroupFormat {
556
569
  bytes: number;
557
570
  uuid: number;
@@ -560,7 +573,8 @@ declare class BindGroupFormat {
560
573
  getShaderUniforms(): any;
561
574
  getMeshUniforms(): any;
562
575
  _parse(bindGroupMapping: any): void;
563
- createBindGroup(device: GraphicsDevice, mesh: Mesh$1, shaderUniforms: ShaderUniforms, layout: GPUBindGroupLayout, shaderBuffer: DynamicBuffer, meshBuffer: DynamicBuffer): GPUBindGroup;
576
+ createFormatBindGroup(device: GraphicsDevice, mesh: Mesh$1, shaderUniforms: ShaderUniforms, layout: GPUBindGroupLayout, shaderBuffer: DynamicBuffer, meshBuffer: DynamicBuffer): BindGroupResult;
577
+ copyTextures(bindGroup: BindGroupResult, props: any): void;
564
578
  dispose(): void;
565
579
  }
566
580
 
@@ -585,6 +599,7 @@ declare class Mesh$1 {
585
599
  get material(): Material;
586
600
  set version(v: number);
587
601
  get version(): number;
602
+ get textureVersion(): number;
588
603
  get geometry(): Geometry;
589
604
  set geometry(geo: Geometry);
590
605
  set localTransform(m: mat4);
@@ -621,8 +636,8 @@ declare class Mesh$1 {
621
636
  getMemorySize(): number;
622
637
  getWorldTransform(): any;
623
638
  _meshBuffer: Record<string, DynamicBuffer>;
624
- writeDynamicBuffer(commandUID: number, renderProps: any, bindGroupMapping: BindGroupFormat, pool: DynamicBufferPool, dynamicOffsets: DynamicOffsets): DynamicBuffer;
625
- getBindGroup(key: any): GPUBindGroup;
639
+ writeDynamicBuffer(commandUID: string, renderProps: any, bindGroupMapping: BindGroupFormat, pool: DynamicBufferPool, dynamicOffsets: DynamicOffsets): DynamicBuffer;
640
+ getBindGroup(key: any): BindGroupResult;
626
641
  setBindGroup(key: any, bindGroup: any): this;
627
642
  getShaderFnValues(shaderUID: number): GPUBindGroup;
628
643
  setShaderFnValues(shaderUID: number, fnValues: any): this;
@@ -823,13 +838,6 @@ declare function getPosArrayType(max: number): Int8ArrayConstructor | Int16Array
823
838
  * @param max - max value
824
839
  */
825
840
  declare function clamp(n: number, min: number, max: number): number;
826
- /**
827
- * 检查当前环境是否支持VAO
828
- * @english
829
- * Check if current context supports VAO
830
- * @param regl regl context
831
- * @returns
832
- */
833
841
  declare function isSupportVAO(regl: any): any;
834
842
  /**
835
843
  * Object.hasOwnProperty的包装方法
@@ -921,6 +929,7 @@ declare function isPowerOfTwo(value: number): boolean;
921
929
  declare function resizeToPowerOfTwo(image: HTMLImageElement | NumberArray, width?: number, height?: number): NumberArray | HTMLCanvasElement | HTMLImageElement;
922
930
  declare function supportNPOT(regl: any): boolean;
923
931
  declare function isTextureDestroyed(texture: any): boolean;
932
+ declare function isTextureLike(texture: any): any;
924
933
 
925
934
  declare const Util_d_clamp: typeof clamp;
926
935
  declare const Util_d_defined: typeof defined;
@@ -946,6 +955,7 @@ declare const Util_d_isPowerOfTwo: typeof isPowerOfTwo;
946
955
  declare const Util_d_isString: typeof isString;
947
956
  declare const Util_d_isSupportVAO: typeof isSupportVAO;
948
957
  declare const Util_d_isTextureDestroyed: typeof isTextureDestroyed;
958
+ declare const Util_d_isTextureLike: typeof isTextureLike;
949
959
  declare const Util_d_lerp: typeof lerp;
950
960
  declare const Util_d_log2: typeof log2;
951
961
  declare const Util_d_normalize: typeof normalize;
@@ -953,7 +963,7 @@ declare const Util_d_resizeToPowerOfTwo: typeof resizeToPowerOfTwo;
953
963
  declare const Util_d_set: typeof set;
954
964
  declare const Util_d_supportNPOT: typeof supportNPOT;
955
965
  declare namespace Util_d {
956
- export { Util_d_clamp as clamp, Util_d_defined as defined, Util_d_extend as extend, Util_d_extendWithoutNil as extendWithoutNil, Util_d_getArrayCtor as getArrayCtor, Util_d_getBufferSize as getBufferSize, Util_d_getPosArrayType as getPosArrayType, Util_d_getSupportedFormats as getSupportedFormats, Util_d_getTexMemorySize as getTexMemorySize, Util_d_getTextureByteWidth as getTextureByteWidth, Util_d_getTextureChannels as getTextureChannels, Util_d_hasOwn as hasOwn, Util_d_hashCode as hashCode, Util_d_interpolate as interpolate, Util_d_isArray as isArray, Util_d_isFunction as isFunction, Util_d_isInStride as isInStride, Util_d_isInterleaved as isInterleaved, Util_d_isNil as isNil, Util_d_isNumber as isNumber, Util_d_isPowerOfTwo as isPowerOfTwo, Util_d_isString as isString, Util_d_isSupportVAO as isSupportVAO, Util_d_isTextureDestroyed as isTextureDestroyed, Util_d_lerp as lerp, Util_d_log2 as log2, Util_d_normalize as normalize, Util_d_resizeToPowerOfTwo as resizeToPowerOfTwo, Util_d_set as set, Util_d_supportNPOT as supportNPOT };
966
+ export { Util_d_clamp as clamp, Util_d_defined as defined, Util_d_extend as extend, Util_d_extendWithoutNil as extendWithoutNil, Util_d_getArrayCtor as getArrayCtor, Util_d_getBufferSize as getBufferSize, Util_d_getPosArrayType as getPosArrayType, Util_d_getSupportedFormats as getSupportedFormats, Util_d_getTexMemorySize as getTexMemorySize, Util_d_getTextureByteWidth as getTextureByteWidth, Util_d_getTextureChannels as getTextureChannels, Util_d_hasOwn as hasOwn, Util_d_hashCode as hashCode, Util_d_interpolate as interpolate, Util_d_isArray as isArray, Util_d_isFunction as isFunction, Util_d_isInStride as isInStride, Util_d_isInterleaved as isInterleaved, Util_d_isNil as isNil, Util_d_isNumber as isNumber, Util_d_isPowerOfTwo as isPowerOfTwo, Util_d_isString as isString, Util_d_isSupportVAO as isSupportVAO, Util_d_isTextureDestroyed as isTextureDestroyed, Util_d_isTextureLike as isTextureLike, Util_d_lerp as lerp, Util_d_log2 as log2, Util_d_normalize as normalize, Util_d_resizeToPowerOfTwo as resizeToPowerOfTwo, Util_d_set as set, Util_d_supportNPOT as supportNPOT };
957
967
  }
958
968
 
959
969
  declare function parseRGBE(arrayBuffer: ArrayBufferLike, exposure?: number): {
@@ -1005,12 +1015,23 @@ declare const _default$1: {
1005
1015
  };
1006
1016
  //# sourceMappingURL=WgslShaderLib.d.ts.map
1007
1017
 
1018
+ type CommandStruct = {
1019
+ uid: string;
1020
+ layout: GPUBindGroupLayout;
1021
+ pipeline: GPURenderPipeline;
1022
+ vertexInfo: any;
1023
+ bindGroupFormat: BindGroupFormat;
1024
+ bindGroupMapping: any;
1025
+ activeAttributes: ActiveAttributes;
1026
+ };
1027
+
1008
1028
  declare class GLShader {
1009
1029
  vert: string;
1010
1030
  frag: string;
1011
1031
  wgslVert: string;
1012
1032
  wgslFrag: string;
1013
1033
  uid: number;
1034
+ commandId: number;
1014
1035
  version: number;
1015
1036
  extraCommandProps: any;
1016
1037
  name: string;
@@ -1059,7 +1080,8 @@ declare class GPUShader extends GLShader {
1059
1080
  vert: any;
1060
1081
  frag: any;
1061
1082
  };
1062
- run(deviceOrRegl: any, command: any, props: any): any;
1083
+ run(deviceOrRegl: any, command: CommandStruct, props: any): any;
1084
+ _checkBindGroupTextures(bindGroup: BindGroupResult, props: any): boolean;
1063
1085
  _getCurrentRenderPassEncoder(device: GraphicsDevice): GPURenderPassEncoder;
1064
1086
  setFramebuffer(framebuffer: any): this;
1065
1087
  dispose(): void;
@@ -1287,6 +1309,7 @@ declare class SsrPass {
1287
1309
  _blurUniforms: {
1288
1310
  rgbmRange: number;
1289
1311
  outputSize: number[];
1312
+ inputSize: number[];
1290
1313
  };
1291
1314
  getMipmapTexture(): any;
1292
1315
  _outputTex: any;
@@ -1436,10 +1459,7 @@ declare class GLTFPack {
1436
1459
  geometries: any[];
1437
1460
  _emptyTexture: any;
1438
1461
  getMeshesInfo(): any[];
1439
- getGLTFBBox(): {
1440
- min: number[];
1441
- max: number[];
1442
- };
1462
+ getGLTFBBox(transform: any): BoundingBox;
1443
1463
  _createSkins(skins: any): void;
1444
1464
  _skinMap: {};
1445
1465
  _createTextures(textures: any): void;
@@ -1492,7 +1512,7 @@ declare class GLTFPack {
1492
1512
  * @param options
1493
1513
  * @returns
1494
1514
  */
1495
- arrangeAlongLine(from: any, to: any, xyDist: any, gltfScale: any, projectionScale: any, options: any): {
1515
+ arrangeAlongLine(from: any, to: any, xyDist: any, gltfScale: any, projectionScale: any, rotationScaleMat: any, options: any): {
1496
1516
  coordinates: any;
1497
1517
  t: number;
1498
1518
  scale: number[];
@@ -1501,7 +1521,7 @@ declare class GLTFPack {
1501
1521
  rotationXY: number;
1502
1522
  }[];
1503
1523
  calModelHeightScale(out: any, modelHeight: any): vec3;
1504
- _calBoxWidth(scale: any, options: any): any;
1524
+ _calBoxWidth(scale: any, rotationScaleMat: any, options: any): any;
1505
1525
  _getRotationZ(from: any, to: any): number;
1506
1526
  _getRotationXY(xyDist: any, zDist: any): number;
1507
1527
  }
@@ -1529,10 +1549,7 @@ declare class GLTFManager {
1529
1549
  addSimpleModel(id: any, gltfData: any): void;
1530
1550
  removeSimpleModel(id: any): void;
1531
1551
  _exportGLTFResource(gltf: any, url: any, useUniqueREGLBuffer?: boolean): {
1532
- bbox: {
1533
- min: number[];
1534
- max: number[];
1535
- };
1552
+ bbox: BoundingBox;
1536
1553
  gltfPack: GLTFPack;
1537
1554
  resources: any[];
1538
1555
  json: any;
@@ -1661,6 +1678,7 @@ declare class BoxShadowBlurShader extends QuadShader {
1661
1678
 
1662
1679
  declare class ShadowMapShader extends MeshShader {
1663
1680
  constructor(defines: any);
1681
+ setDefines(defines: any): void;
1664
1682
  filter(mesh: any): any;
1665
1683
  }
1666
1684
  //# sourceMappingURL=ShadowMapShader.d.ts.map
@@ -1743,13 +1761,13 @@ declare class FBORayPicking {
1743
1761
  render(meshes: Mesh[], uniforms: any, once?: boolean): this;
1744
1762
  _currentShader: any;
1745
1763
  pickAll(x: any, y: any, tolerance: any, uniforms: any, options: any): {
1746
- meshId: any;
1764
+ meshId: number;
1747
1765
  pickingId: any;
1748
1766
  point: number[];
1749
1767
  coordinate: any[];
1750
1768
  }[];
1751
1769
  pick(x: any, y: any, tolerance: any, uniforms: any, options?: {}): {
1752
- meshId: any;
1770
+ meshId: number;
1753
1771
  pickingId: any;
1754
1772
  point: number[];
1755
1773
  coordinate: any[];
@@ -1770,7 +1788,7 @@ declare class FBORayPicking {
1770
1788
  width?: undefined;
1771
1789
  height?: undefined;
1772
1790
  } | {
1773
- meshIds: any[];
1791
+ meshIds: number[];
1774
1792
  pickingIds: any[];
1775
1793
  coords: any[][];
1776
1794
  points: number[][];
@@ -1789,13 +1807,14 @@ declare class FBORayPicking {
1789
1807
  _getPickingId(x: any, y: any, width: any, height: any, pixels: any, meshes: any, uniforms: any): any[];
1790
1808
  _pickDepth(x: any, y: any, width: any, height: any, pixels: any, meshes: any, uniforms: any): number[];
1791
1809
  _packData(data: any, shader: any): {
1792
- meshId: any;
1793
- pickingId: any;
1810
+ meshId: number;
1811
+ pickingId: number;
1794
1812
  };
1795
1813
  _clearFbo(framebuffer: any): void;
1796
1814
  _getShader(meshes: any, once: any): MeshShader;
1797
1815
  _getFBO1(): any;
1798
1816
  _fbo1: any;
1817
+ _debugFBO(fbo: any): void;
1799
1818
  _getParams(px: any, py: any, tolerance: any, fbo: any): {
1800
1819
  px: any;
1801
1820
  py: any;
@@ -2321,7 +2340,6 @@ declare class MapGLRenderer extends renderer.MapAbstractRenderer {
2321
2340
 
2322
2341
  declare class MapGPURenderer extends MapGLRenderer {
2323
2342
  device: any;
2324
- gpuDevice: GPUDevice;
2325
2343
  drawLayers(layers: Layer[], framestamp: number): boolean;
2326
2344
  createContext(): Promise<void>;
2327
2345
  isWebGL(): boolean;