yjz-web-sdk 1.0.10 → 1.0.11-beta.10
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/README.md +90 -0
- package/lib/ScreenControlUtil-D4-BTCo9.js +5230 -0
- package/lib/components/RemotePlayer/index.vue.d.ts +1 -73
- package/lib/composables/useCursorStyle.d.ts +1 -1
- package/lib/composables/useKeyboardControl.d.ts +5 -1
- package/lib/composables/useMouseTouchControl.d.ts +5 -4
- package/lib/composables/useRemoteVideo.d.ts +8 -25
- package/lib/composables/useResizeObserver.d.ts +1 -1
- package/lib/core/WebRTCSdk.d.ts +3 -0
- package/lib/core/data/WebRtcError.d.ts +3 -3
- package/lib/core/data/WebrtcDataType.d.ts +1 -11
- package/lib/core/groupctrl/SdkController.d.ts +2 -2
- package/lib/core/rtc/WebRTCClient.d.ts +13 -3
- package/lib/core/rtc/WebRTCConfig.d.ts +3 -1
- package/lib/core/rtc/WebRtcNegotiate.d.ts +3 -3
- package/lib/core/signal/SignalingClient.d.ts +1 -1
- package/lib/core/util/KeyCodeUtil.d.ts +6 -0
- package/lib/core/util/TurnTestUtil.d.ts +4 -4
- package/lib/index.d.ts +3 -3
- package/lib/uni/KeyboardControl.d.ts +53 -0
- package/lib/uni/Logger.d.ts +13 -0
- package/lib/uni/MouseTouchControl.d.ts +56 -0
- package/lib/uni/RemoteCanvasController.d.ts +11 -0
- package/lib/uni/RemoteController.d.ts +23 -0
- package/lib/uni/RemoteVideoController.d.ts +38 -0
- package/lib/uni/WebRTCWrapper.d.ts +57 -0
- package/lib/uni/constants.d.ts +42 -0
- package/lib/uni/index.d.ts +110 -0
- package/lib/{components/RemotePlayer → uni}/type.d.ts +1 -0
- package/lib/uni-sdk.js +1263 -0
- package/lib/yjz-web-sdk.js +312 -5955
- package/package.json +10 -20
- package/lib/core/data/TurnType.d.ts +0 -21
- package/lib/core/util/MapCache.d.ts +0 -20
- package/lib/render/Canvas2DRenderer.d.ts +0 -10
- package/lib/render/WebGLRenderer.d.ts +0 -16
- package/lib/render/WebGPURenderer.d.ts +0 -18
- package/lib/types/index.d.ts +0 -13
- package/lib/util/WasmUtil.d.ts +0 -17
- package/lib/worker/worker.d.ts +0 -1
- package/src/assets/icon/circle.svg +0 -1
- package/src/assets/icon/triangle.svg +0 -1
- package/src/assets/wasm/h264-atomic.wasm +0 -0
- package/src/assets/wasm/h264-simd.wasm +0 -0
- package/src/components/RemotePlayer/index.vue +0 -170
- package/src/components/RemotePlayer/type.ts +0 -11
- package/src/composables/useCursorStyle.ts +0 -15
- package/src/composables/useKeyboardControl.ts +0 -32
- package/src/composables/useMouseTouchControl.ts +0 -158
- package/src/composables/useRemoteVideo.ts +0 -248
- package/src/composables/useResizeObserver.ts +0 -27
- package/src/core/WebRTCSdk.ts +0 -561
- package/src/core/data/MessageType.ts +0 -70
- package/src/core/data/TurnType.ts +0 -25
- package/src/core/data/WebRtcError.ts +0 -93
- package/src/core/data/WebrtcDataType.ts +0 -354
- package/src/core/groupctrl/GroupCtrlSocketManager.ts +0 -94
- package/src/core/groupctrl/SdkController.ts +0 -96
- package/src/core/rtc/WebRTCClient.ts +0 -862
- package/src/core/rtc/WebRTCConfig.ts +0 -86
- package/src/core/rtc/WebRtcNegotiate.ts +0 -164
- package/src/core/signal/SignalingClient.ts +0 -221
- package/src/core/util/FileTypeUtils.ts +0 -75
- package/src/core/util/KeyCodeUtil.ts +0 -162
- package/src/core/util/Logger.ts +0 -83
- package/src/core/util/MapCache.ts +0 -135
- package/src/core/util/ScreenControlUtil.ts +0 -174
- package/src/core/util/TurnTestUtil.ts +0 -123
- package/src/env.d.ts +0 -30
- package/src/index.ts +0 -61
- package/src/render/Canvas2DRenderer.ts +0 -38
- package/src/render/WebGLRenderer.ts +0 -150
- package/src/render/WebGPURenderer.ts +0 -194
- package/src/types/index.ts +0 -15
- package/src/types/webgpu.d.ts +0 -1158
- package/src/util/WasmUtil.ts +0 -291
- package/src/worker/worker.ts +0 -292
package/src/types/webgpu.d.ts
DELETED
|
@@ -1,1158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file WebGPU 的声明文件 https://www.w3.org/TR/2023/WD-webgpu-20230322/
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
type GPUPowerPreference = 'low-power' | 'high-performance'
|
|
7
|
-
type GPUFeatureName = 'depth-clip-control' | 'depth32float-stencil8'
|
|
8
|
-
| 'texture-compression-bc' | 'texture-compression-etc2'
|
|
9
|
-
| 'texture-compression-astc' | 'timestamp-query'
|
|
10
|
-
| 'indirect-first-instance' | 'shader-f16' | 'rg11b10ufloat-renderable' | 'float32-filterable'
|
|
11
|
-
type GPUBufferMapState = 'unmapped' | 'pending' | 'mapped'
|
|
12
|
-
type GPUTextureAspect = 'all' | 'stencil-only' | 'depth-only'
|
|
13
|
-
type GPUTextureDimension = '1d' | '2d' | '3d'
|
|
14
|
-
type GPUTextureViewDimension = GPUTextureDimension | '2d-array' | 'cube' | 'cube-array'
|
|
15
|
-
type GPUAddressMode = 'clamp-to-edge' | 'repeat' | 'mirror-repeat'
|
|
16
|
-
type GPUFilterMode = 'nearest' | 'linear'
|
|
17
|
-
type GPUMipmapFilterMode = 'nearest' | 'linear'
|
|
18
|
-
type GPUBufferBindingType = 'uniform' | 'storage' | 'read-only-storage'
|
|
19
|
-
type GPUSamplerBindingType = 'filtering' | 'non-filtering' | 'comparison'
|
|
20
|
-
type GPUTextureSampleType = 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint'
|
|
21
|
-
type GPUStorageTextureAccess = 'write-only'
|
|
22
|
-
type GPUAutoLayoutMode = 'auto'
|
|
23
|
-
type GPUCompilationMessageType = 'error' | 'warning' | 'info'
|
|
24
|
-
type GPUVertexStepMode = 'vertex' | 'instance'
|
|
25
|
-
type GPUPrimitiveTopology = 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip'
|
|
26
|
-
type GPUFrontFace = 'ccw' | 'cw'
|
|
27
|
-
type GPUIndexFormat = 'uint16' | 'uint32'
|
|
28
|
-
type GPUCullMode = 'none' | 'front' | 'back'
|
|
29
|
-
type GPUStencilOperation = 'keep' | 'zero' | 'replace' | 'invert' | 'increment-clamp'
|
|
30
|
-
| 'decrement-clamp' | 'increment-wrap' | 'decrement-wrap'
|
|
31
|
-
type GPUBlendOperation = 'add' | 'subtract' | 'reverse-subtract' | 'min' | 'max'
|
|
32
|
-
type GPUBlendFactor = 'zero' | 'one' | 'src' | 'one-minus-src' | 'src-alpha'
|
|
33
|
-
| 'one-minus-src-alpha' | 'dst' | 'one-minus-dst' | 'dst-alpha'
|
|
34
|
-
| 'one-minus-dst-alpha' | 'src-alpha-saturated' | 'constant' | 'one-minus-constant'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* load 保存之前的颜色缓冲区
|
|
39
|
-
* clear 清除之前的延时缓冲区
|
|
40
|
-
*/
|
|
41
|
-
type GPULoadOp = 'load' | 'clear'
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* store 保存绘制之后的颜色缓冲区
|
|
45
|
-
* discard 丢弃绘制之后的延时缓冲区
|
|
46
|
-
*/
|
|
47
|
-
type GPUStoreOp = 'store' | 'discard'
|
|
48
|
-
|
|
49
|
-
type GPUQueryType =
|
|
50
|
-
/**
|
|
51
|
-
* 遮挡查询
|
|
52
|
-
*/
|
|
53
|
-
'occlusion'
|
|
54
|
-
/**
|
|
55
|
-
* 时间戳查询
|
|
56
|
-
*/
|
|
57
|
-
| 'timestamp'
|
|
58
|
-
|
|
59
|
-
type GPURenderPassTimestampLocation = 'beginning' | 'end'
|
|
60
|
-
type GPUComputePassTimestampLocation = 'beginning' | 'end'
|
|
61
|
-
type GPUCanvasAlphaMode = 'opaque' | 'premultiplied'
|
|
62
|
-
|
|
63
|
-
type GPUSize64 = number
|
|
64
|
-
type GPUIndex32 = number
|
|
65
|
-
type GPUSize32 = number
|
|
66
|
-
type GPUSignedOffset32 = number
|
|
67
|
-
type GPUBufferDynamicOffset = number
|
|
68
|
-
type GPUStencilValue = number
|
|
69
|
-
type GPUSampleMask = number
|
|
70
|
-
type GPUDepthBias = number
|
|
71
|
-
type GPUIntegerCoordinate = number
|
|
72
|
-
type GPUFlagsConstant = number
|
|
73
|
-
type GPUPipelineConstantValue = number
|
|
74
|
-
|
|
75
|
-
interface GPUColorDict {
|
|
76
|
-
r: number
|
|
77
|
-
g: number
|
|
78
|
-
b: number
|
|
79
|
-
a: number
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
type GPUColor = number[] | GPUColorDict
|
|
83
|
-
|
|
84
|
-
type GPUCompareFunction = 'never' | 'less' | 'equal'
|
|
85
|
-
| 'less-equal' | 'greater' | 'not-equal' | 'greater-equal' | 'always'
|
|
86
|
-
|
|
87
|
-
type GPUExtent3D = GPUIntegerCoordinate[] | {
|
|
88
|
-
width: GPUIntegerCoordinate
|
|
89
|
-
height?: GPUIntegerCoordinate
|
|
90
|
-
depthOrArrayLayers?: GPUIntegerCoordinate
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type GPUOrigin2D = GPUIntegerCoordinate[] | {
|
|
94
|
-
x?: GPUIntegerCoordinate
|
|
95
|
-
y?: GPUIntegerCoordinate
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
type GPUOrigin3D = GPUIntegerCoordinate[] | {
|
|
99
|
-
x?: GPUIntegerCoordinate
|
|
100
|
-
y?: GPUIntegerCoordinate
|
|
101
|
-
z?: GPUIntegerCoordinate
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
type GPUTextureFormat =
|
|
105
|
-
// 8-bit formats
|
|
106
|
-
'r8unorm'
|
|
107
|
-
| 'r8snorm'
|
|
108
|
-
| 'r8uint'
|
|
109
|
-
| 'r8sint'
|
|
110
|
-
|
|
111
|
-
// 16-bit formats
|
|
112
|
-
| 'r16uint'
|
|
113
|
-
| 'r16sint'
|
|
114
|
-
| 'r16float'
|
|
115
|
-
| 'rg8unorm'
|
|
116
|
-
| 'rg8snorm'
|
|
117
|
-
| 'rg8uint'
|
|
118
|
-
| 'rg8sint'
|
|
119
|
-
|
|
120
|
-
// 32-bit formats
|
|
121
|
-
| 'r32uint'
|
|
122
|
-
| 'r32sint'
|
|
123
|
-
| 'r32float'
|
|
124
|
-
| 'rg16uint'
|
|
125
|
-
| 'rg16sint'
|
|
126
|
-
| 'rg16float'
|
|
127
|
-
| 'rgba8unorm'
|
|
128
|
-
| 'rgba8unorm-srgb'
|
|
129
|
-
| 'rgba8snorm'
|
|
130
|
-
| 'rgba8uint'
|
|
131
|
-
| 'rgba8sint'
|
|
132
|
-
| 'bgra8unorm'
|
|
133
|
-
| 'bgra8unorm-srgb'
|
|
134
|
-
// Packed 32-bit formats
|
|
135
|
-
| 'rgb9e5ufloat'
|
|
136
|
-
| 'rgb10a2unorm'
|
|
137
|
-
| 'rg11b10ufloat'
|
|
138
|
-
|
|
139
|
-
// 64-bit formats
|
|
140
|
-
| 'rg32uint'
|
|
141
|
-
| 'rg32sint'
|
|
142
|
-
| 'rg32float'
|
|
143
|
-
| 'rgba16uint'
|
|
144
|
-
| 'rgba16sint'
|
|
145
|
-
| 'rgba16float'
|
|
146
|
-
|
|
147
|
-
// 128-bit formats
|
|
148
|
-
| 'rgba32uint'
|
|
149
|
-
| 'rgba32sint'
|
|
150
|
-
| 'rgba32float'
|
|
151
|
-
|
|
152
|
-
// Depth/stencil formats
|
|
153
|
-
| 'stencil8'
|
|
154
|
-
| 'depth16unorm'
|
|
155
|
-
| 'depth24plus'
|
|
156
|
-
| 'depth24plus-stencil8'
|
|
157
|
-
| 'depth32float'
|
|
158
|
-
|
|
159
|
-
// "depth32float-stencil8" feature
|
|
160
|
-
| 'depth32float-stencil8'
|
|
161
|
-
|
|
162
|
-
/*
|
|
163
|
-
* BC compressed formats usable if "texture-compression-bc" is both
|
|
164
|
-
* supported by the device/user agent and enabled in requestDevice.
|
|
165
|
-
*/
|
|
166
|
-
| 'bc1-rgba-unorm'
|
|
167
|
-
| 'bc1-rgba-unorm-srgb'
|
|
168
|
-
| 'bc2-rgba-unorm'
|
|
169
|
-
| 'bc2-rgba-unorm-srgb'
|
|
170
|
-
| 'bc3-rgba-unorm'
|
|
171
|
-
| 'bc3-rgba-unorm-srgb'
|
|
172
|
-
| 'bc4-r-unorm'
|
|
173
|
-
| 'bc4-r-snorm'
|
|
174
|
-
| 'bc5-rg-unorm'
|
|
175
|
-
| 'bc5-rg-snorm'
|
|
176
|
-
| 'bc6h-rgb-ufloat'
|
|
177
|
-
| 'bc6h-rgb-float'
|
|
178
|
-
| 'bc7-rgba-unorm'
|
|
179
|
-
| 'bc7-rgba-unorm-srgb'
|
|
180
|
-
|
|
181
|
-
/*
|
|
182
|
-
* ETC2 compressed formats usable if "texture-compression-etc2" is both
|
|
183
|
-
* supported by the device/user agent and enabled in requestDevice.
|
|
184
|
-
*/
|
|
185
|
-
| 'etc2-rgb8unorm'
|
|
186
|
-
| 'etc2-rgb8unorm-srgb'
|
|
187
|
-
| 'etc2-rgb8a1unorm'
|
|
188
|
-
| 'etc2-rgb8a1unorm-srgb'
|
|
189
|
-
| 'etc2-rgba8unorm'
|
|
190
|
-
| 'etc2-rgba8unorm-srgb'
|
|
191
|
-
| 'eac-r11unorm'
|
|
192
|
-
| 'eac-r11snorm'
|
|
193
|
-
| 'eac-rg11unorm'
|
|
194
|
-
| 'eac-rg11snorm'
|
|
195
|
-
|
|
196
|
-
/*
|
|
197
|
-
* ASTC compressed formats usable if "texture-compression-astc" is both
|
|
198
|
-
* supported by the device/user agent and enabled in requestDevice.
|
|
199
|
-
*/
|
|
200
|
-
| 'astc-4x4-unorm'
|
|
201
|
-
| 'astc-4x4-unorm-srgb'
|
|
202
|
-
| 'astc-5x4-unorm'
|
|
203
|
-
| 'astc-5x4-unorm-srgb'
|
|
204
|
-
| 'astc-5x5-unorm'
|
|
205
|
-
| 'astc-5x5-unorm-srgb'
|
|
206
|
-
| 'astc-6x5-unorm'
|
|
207
|
-
| 'astc-6x5-unorm-srgb'
|
|
208
|
-
| 'astc-6x6-unorm'
|
|
209
|
-
| 'astc-6x6-unorm-srgb'
|
|
210
|
-
| 'astc-8x5-unorm'
|
|
211
|
-
| 'astc-8x5-unorm-srgb'
|
|
212
|
-
| 'astc-8x6-unorm'
|
|
213
|
-
| 'astc-8x6-unorm-srgb'
|
|
214
|
-
| 'astc-8x8-unorm'
|
|
215
|
-
| 'astc-8x8-unorm-srgb'
|
|
216
|
-
| 'astc-10x5-unorm'
|
|
217
|
-
| 'astc-10x5-unorm-srgb'
|
|
218
|
-
| 'astc-10x6-unorm'
|
|
219
|
-
| 'astc-10x6-unorm-srgb'
|
|
220
|
-
| 'astc-10x8-unorm'
|
|
221
|
-
| 'astc-10x8-unorm-srgb'
|
|
222
|
-
| 'astc-10x10-unorm'
|
|
223
|
-
| 'astc-10x10-unorm-srgb'
|
|
224
|
-
| 'astc-12x10-unorm'
|
|
225
|
-
| 'astc-12x10-unorm-srgb'
|
|
226
|
-
| 'astc-12x12-unorm'
|
|
227
|
-
| 'astc-12x12-unorm-srgb'
|
|
228
|
-
|
|
229
|
-
type GPUVertexFormat =
|
|
230
|
-
| 'uint8x2'
|
|
231
|
-
| 'uint8x4'
|
|
232
|
-
| 'sint8x2'
|
|
233
|
-
| 'sint8x4'
|
|
234
|
-
| 'unorm8x2'
|
|
235
|
-
| 'unorm8x4'
|
|
236
|
-
| 'snorm8x2'
|
|
237
|
-
| 'snorm8x4'
|
|
238
|
-
| 'uint16x2'
|
|
239
|
-
| 'uint16x4'
|
|
240
|
-
| 'sint16x2'
|
|
241
|
-
| 'sint16x4'
|
|
242
|
-
| 'unorm16x2'
|
|
243
|
-
| 'unorm16x4'
|
|
244
|
-
| 'snorm16x2'
|
|
245
|
-
| 'snorm16x4'
|
|
246
|
-
| 'float16x2'
|
|
247
|
-
| 'float16x4'
|
|
248
|
-
| 'float32'
|
|
249
|
-
| 'float32x2'
|
|
250
|
-
| 'float32x3'
|
|
251
|
-
| 'float32x4'
|
|
252
|
-
| 'uint32'
|
|
253
|
-
| 'uint32x2'
|
|
254
|
-
| 'uint32x3'
|
|
255
|
-
| 'uint32x4'
|
|
256
|
-
| 'sint32'
|
|
257
|
-
| 'sint32x2'
|
|
258
|
-
| 'sint32x3'
|
|
259
|
-
| 'sint32x4'
|
|
260
|
-
|
|
261
|
-
interface GPURequestAdapterOptions {
|
|
262
|
-
powerPreference?: GPUPowerPreference
|
|
263
|
-
forceFallbackAdapter?: boolean
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
interface GPUSupportedLimits {
|
|
267
|
-
readonly maxTextureDimension1D: number
|
|
268
|
-
readonly maxTextureDimension2D: number
|
|
269
|
-
readonly maxTextureDimension3D: number
|
|
270
|
-
readonly maxTextureArrayLayers: number
|
|
271
|
-
readonly maxBindGroups: number
|
|
272
|
-
readonly maxBindingsPerBindGroup: number
|
|
273
|
-
readonly maxDynamicUniformBuffersPerPipelineLayout: number
|
|
274
|
-
readonly maxDynamicStorageBuffersPerPipelineLayout: number
|
|
275
|
-
readonly maxSampledTexturesPerShaderStage: number
|
|
276
|
-
readonly maxSamplersPerShaderStage: number
|
|
277
|
-
readonly maxStorageBuffersPerShaderStage: number
|
|
278
|
-
readonly maxStorageTexturesPerShaderStage: number
|
|
279
|
-
readonly maxUniformBuffersPerShaderStage: number
|
|
280
|
-
readonly maxUniformBufferBindingSize: number
|
|
281
|
-
readonly maxStorageBufferBindingSize: number
|
|
282
|
-
readonly minUniformBufferOffsetAlignment: number
|
|
283
|
-
readonly minStorageBufferOffsetAlignment: number
|
|
284
|
-
readonly maxVertexBuffers: number
|
|
285
|
-
readonly maxBufferSize: number
|
|
286
|
-
readonly maxVertexAttributes: number
|
|
287
|
-
readonly maxVertexBufferArrayStride: number
|
|
288
|
-
readonly maxInterStageShaderComponents: number
|
|
289
|
-
readonly maxInterStageShaderVariables: number
|
|
290
|
-
readonly maxColorAttachments: number
|
|
291
|
-
readonly maxColorAttachmentBytesPerSample: number
|
|
292
|
-
readonly maxComputeWorkgroupStorageSize: number
|
|
293
|
-
readonly maxComputeInvocationsPerWorkgroup: number
|
|
294
|
-
readonly maxComputeWorkgroupSizeX: number
|
|
295
|
-
readonly maxComputeWorkgroupSizeY: number
|
|
296
|
-
readonly maxComputeWorkgroupSizeZ: number
|
|
297
|
-
readonly maxComputeWorkgroupsPerDimension: number
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
interface GPUObjectDescriptorBase {
|
|
303
|
-
label?: string
|
|
304
|
-
}
|
|
305
|
-
interface GPUObjectBase {
|
|
306
|
-
label: string
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
interface GPUQueueDescriptor extends GPUObjectDescriptorBase {
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
|
|
314
|
-
requiredFeatures?: GPUFeatureName[]
|
|
315
|
-
requiredLimits?: Record<string, GPUSize64>
|
|
316
|
-
defaultQueue?: GPUQueueDescriptor
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
interface GPUAdapterInfo {
|
|
320
|
-
readonly vendor: string
|
|
321
|
-
readonly architecture: string
|
|
322
|
-
readonly device: string
|
|
323
|
-
readonly description: string
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
type GPUSupportedFeatures = Map<string, string>
|
|
327
|
-
|
|
328
|
-
interface GPUCommandBuffer extends GPUObjectBase {
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
declare enum GPUBufferUsage {
|
|
333
|
-
MAP_READ = 0x0001,
|
|
334
|
-
MAP_WRITE = 0x0002,
|
|
335
|
-
COPY_SRC = 0x0004,
|
|
336
|
-
COPY_DST = 0x0008,
|
|
337
|
-
INDEX = 0x0010,
|
|
338
|
-
VERTEX = 0x0020,
|
|
339
|
-
UNIFORM = 0x0040,
|
|
340
|
-
STORAGE = 0x0080,
|
|
341
|
-
INDIRECT = 0x0100,
|
|
342
|
-
QUERY_RESOLVE = 0x0200
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
enum GPUMapModeFlags {
|
|
346
|
-
READ = 0x0001,
|
|
347
|
-
WRITE = 0x0002
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
declare enum GPUTextureUsage {
|
|
351
|
-
COPY_SRC = 0x01,
|
|
352
|
-
COPY_DST = 0x02,
|
|
353
|
-
TEXTURE_BINDING = 0x04,
|
|
354
|
-
STORAGE_BINDING = 0x08,
|
|
355
|
-
RENDER_ATTACHMENT = 0x10
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
interface GPUBuffer extends GPUObjectBase {
|
|
359
|
-
readonly size: GPUSize64
|
|
360
|
-
readonly usage: GPUBufferUsage
|
|
361
|
-
readonly mapState: GPUBufferMapState
|
|
362
|
-
|
|
363
|
-
mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64, size?: GPUSize64): Promise<void>
|
|
364
|
-
getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer
|
|
365
|
-
unmap(): void
|
|
366
|
-
destroy(): void
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
|
|
370
|
-
format?: GPUTextureFormat
|
|
371
|
-
dimension?: GPUTextureViewDimension
|
|
372
|
-
aspect?: GPUTextureAspect
|
|
373
|
-
baseMipLevel?: GPUIntegerCoordinate
|
|
374
|
-
mipLevelCount?: GPUIntegerCoordinate
|
|
375
|
-
baseArrayLayer?: GPUIntegerCoordinate
|
|
376
|
-
arrayLayerCount?: GPUIntegerCoordinate
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
interface GPUTextureView extends GPUObjectBase {
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
interface GPUTexture extends GPUObjectBase {
|
|
384
|
-
readonly width: GPUIntegerCoordinate
|
|
385
|
-
readonly height: GPUIntegerCoordinate
|
|
386
|
-
readonly depthOrArrayLayers: GPUIntegerCoordinate
|
|
387
|
-
readonly mipLevelCount: GPUIntegerCoordinate
|
|
388
|
-
readonly sampleCount: GPUSize32
|
|
389
|
-
readonly dimension: GPUTextureDimension
|
|
390
|
-
readonly format: GPUTextureFormat
|
|
391
|
-
readonly usage: number
|
|
392
|
-
|
|
393
|
-
createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView
|
|
394
|
-
destroy(): void
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
interface GPUImageCopyTexture {
|
|
398
|
-
texture: GPUTexture
|
|
399
|
-
mipLevel?: number
|
|
400
|
-
origin?: GPUOrigin3D
|
|
401
|
-
aspect?: GPUTextureAspect
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
interface GPUImageDataLayout {
|
|
405
|
-
offset?: GPUSize64
|
|
406
|
-
bytesPerRow?: GPUSize32
|
|
407
|
-
rowsPerImage?: GPUSize32
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
interface GPUImageCopyExternalImage {
|
|
411
|
-
source: ImageBitmap | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | VideoFrame
|
|
412
|
-
origin?: GPUOrigin2D
|
|
413
|
-
flipY?: boolean
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
interface GPUImageCopyTextureTagged extends GPUImageCopyTexture {
|
|
417
|
-
colorSpace?: string
|
|
418
|
-
premultipliedAlpha?: boolean
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
interface GPUQueue extends GPUObjectBase {
|
|
422
|
-
submit(commandBuffers: GPUCommandBuffer[]): void
|
|
423
|
-
onSubmittedWorkDone(): Promise<void>
|
|
424
|
-
writeBuffer(
|
|
425
|
-
buffer: GPUBuffer,
|
|
426
|
-
bufferOffset: GPUSize64,
|
|
427
|
-
data: BufferSource,
|
|
428
|
-
dataOffset?: GPUSize64,
|
|
429
|
-
size?: GPUSize64
|
|
430
|
-
): void
|
|
431
|
-
writeTexture(
|
|
432
|
-
destination: GPUImageCopyTexture,
|
|
433
|
-
data: BufferSource,
|
|
434
|
-
dataLayout: GPUImageDataLayout,
|
|
435
|
-
size: GPUExtent3D
|
|
436
|
-
): void
|
|
437
|
-
copyExternalImageToTexture(
|
|
438
|
-
source: GPUImageCopyExternalImage,
|
|
439
|
-
destination: GPUImageCopyTextureTagged,
|
|
440
|
-
copySize: GPUExtent3D
|
|
441
|
-
): void
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
|
|
445
|
-
size: GPUSize64
|
|
446
|
-
usage: number
|
|
447
|
-
mappedAtCreation?: boolean
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
|
|
451
|
-
size: GPUExtent3D
|
|
452
|
-
format: GPUTextureFormat
|
|
453
|
-
usage: number
|
|
454
|
-
mipLevelCount?: GPUIntegerCoordinate
|
|
455
|
-
sampleCount?: GPUSize32
|
|
456
|
-
dimension?: GPUTextureDimension
|
|
457
|
-
viewFormats?: GPUTextureFormat[]
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
|
|
461
|
-
addressModeU?: GPUAddressMode
|
|
462
|
-
addressModeV?: GPUAddressMode
|
|
463
|
-
addressModeW?: GPUAddressMode
|
|
464
|
-
magFilter?: GPUFilterMode
|
|
465
|
-
minFilter?: GPUFilterMode
|
|
466
|
-
mipmapFilter?: GPUMipmapFilterMode
|
|
467
|
-
lodMinClamp?: number
|
|
468
|
-
lodMaxClamp?: number
|
|
469
|
-
compare?: GPUCompareFunction
|
|
470
|
-
maxAnisotropy?: number
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
interface GPUSampler extends GPUObjectBase {}
|
|
474
|
-
|
|
475
|
-
interface GPUExternalTextureDescriptor extends GPUObjectDescriptorBase {
|
|
476
|
-
source: HTMLVideoElement | VideoFrame
|
|
477
|
-
colorSpace?: string
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
interface GPUExternalTexture extends GPUObjectBase {
|
|
481
|
-
readonly expired: boolean
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
declare enum GPUShaderStage {
|
|
485
|
-
VERTEX = 0x1,
|
|
486
|
-
FRAGMENT = 0x2,
|
|
487
|
-
COMPUTE = 0x4
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
interface GPUBufferBindingLayout {
|
|
491
|
-
type?: GPUBufferBindingType
|
|
492
|
-
hasDynamicOffset?: boolean
|
|
493
|
-
minBindingSize?: GPUSize64
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
interface GPUSamplerBindingLayout {
|
|
497
|
-
type?: GPUSamplerBindingType
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
interface GPUTextureBindingLayout {
|
|
501
|
-
sampleType?: GPUTextureSampleType
|
|
502
|
-
viewDimension?: GPUTextureViewDimension
|
|
503
|
-
multisampled?: boolean
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
interface GPUStorageTextureBindingLayout {
|
|
507
|
-
access?: GPUStorageTextureAccess
|
|
508
|
-
format: GPUTextureFormat
|
|
509
|
-
viewDimension?: GPUTextureViewDimension
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
interface GPUExternalTextureBindingLayout {}
|
|
513
|
-
|
|
514
|
-
interface GPUBindGroupLayoutEntry {
|
|
515
|
-
binding: GPUIndex32
|
|
516
|
-
visibility: GPUShaderStage
|
|
517
|
-
buffer?: GPUBufferBindingLayout
|
|
518
|
-
sampler?: GPUSamplerBindingLayout
|
|
519
|
-
texture?: GPUTextureBindingLayout
|
|
520
|
-
storageTexture?: GPUStorageTextureBindingLayout
|
|
521
|
-
externalTexture?: GPUExternalTextureBindingLayout
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
|
|
525
|
-
entries: GPUBindGroupLayoutEntry[]
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
interface GPUBindGroupLayout extends GPUObjectBase {}
|
|
529
|
-
|
|
530
|
-
interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
|
|
531
|
-
bindGroupLayouts: GPUBindGroupLayout[]
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
interface GPUPipelineLayout extends GPUObjectBase {}
|
|
535
|
-
|
|
536
|
-
interface GPUBufferBinding {
|
|
537
|
-
buffer: GPUBuffer
|
|
538
|
-
offset?: GPUSize64
|
|
539
|
-
size?: GPUSize64
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
type GPUBindingResource = GPUSampler | GPUTextureView | GPUBufferBinding | GPUExternalTexture
|
|
543
|
-
|
|
544
|
-
interface GPUBindGroupEntry {
|
|
545
|
-
binding: GPUIndex32
|
|
546
|
-
resource: GPUBindingResource
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase {
|
|
550
|
-
layout: GPUBindGroupLayout
|
|
551
|
-
entries: GPUBindGroupEntry[]
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
interface GPUBindGroup extends GPUObjectBase {}
|
|
555
|
-
|
|
556
|
-
interface GPUShaderModuleCompilationHint {
|
|
557
|
-
layout?: GPUPipelineLayout | GPUAutoLayoutMode
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
|
|
561
|
-
code: string
|
|
562
|
-
sourceMap?: Object
|
|
563
|
-
hints?: Record<string, GPUShaderModuleCompilationHint>
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
interface GPUCompilationMessage {
|
|
567
|
-
readonly message: string
|
|
568
|
-
readonly type: GPUCompilationMessageType
|
|
569
|
-
readonly lineNum: number
|
|
570
|
-
readonly linePos: number
|
|
571
|
-
readonly offset: number
|
|
572
|
-
readonly length: number
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
interface GPUCompilationInfo {
|
|
576
|
-
readonly messages: GPUCompilationMessage[]
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
interface GPUShaderModule extends GPUObjectBase {
|
|
580
|
-
compilationInfo(): Promise<GPUCompilationInfo>
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
interface GPUProgrammableStage {
|
|
584
|
-
module: GPUShaderModule
|
|
585
|
-
entryPoint: string
|
|
586
|
-
constants?: Record<string, GPUPipelineConstantValue>
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
|
|
590
|
-
layout: GPUPipelineLayout | GPUAutoLayoutMode
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
|
|
594
|
-
compute: GPUProgrammableStage
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
interface GPUPipelineBase {
|
|
598
|
-
getBindGroupLayout(index: number): GPUBindGroupLayout
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
interface GPUComputePipeline extends GPUObjectBase, GPUPipelineBase {}
|
|
602
|
-
|
|
603
|
-
interface GPUVertexAttribute {
|
|
604
|
-
format: GPUVertexFormat
|
|
605
|
-
offset: GPUSize64
|
|
606
|
-
shaderLocation: GPUIndex32
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
interface GPUVertexBufferLayout {
|
|
610
|
-
arrayStride: number
|
|
611
|
-
stepMode?: GPUVertexStepMode
|
|
612
|
-
attributes: GPUVertexAttribute[]
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
interface GPUVertexState extends GPUProgrammableStage {
|
|
616
|
-
buffers: GPUVertexBufferLayout[]
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
interface GPUPrimitiveState {
|
|
620
|
-
topology?: GPUPrimitiveTopology
|
|
621
|
-
stripIndexFormat?: GPUIndexFormat
|
|
622
|
-
frontFace?: GPUFrontFace
|
|
623
|
-
cullMode?: GPUCullMode
|
|
624
|
-
unclippedDepth?: boolean
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
interface GPUStencilFaceState {
|
|
628
|
-
compare?: GPUCompareFunction
|
|
629
|
-
failOp?: GPUStencilOperation
|
|
630
|
-
depthFailOp?: GPUStencilOperation
|
|
631
|
-
passOp?: GPUStencilOperation
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
interface GPUDepthStencilState {
|
|
635
|
-
format: GPUTextureFormat
|
|
636
|
-
depthWriteEnabled?: boolean
|
|
637
|
-
depthCompare?: GPUCompareFunction
|
|
638
|
-
stencilFront?: GPUStencilFaceState
|
|
639
|
-
stencilBack?: GPUStencilFaceState
|
|
640
|
-
stencilReadMask?: GPUStencilValue
|
|
641
|
-
stencilWriteMask?: GPUStencilValue
|
|
642
|
-
depthBias?: GPUDepthBias
|
|
643
|
-
depthBiasSlopeScale?: number
|
|
644
|
-
depthBiasClamp?: number
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
interface GPUMultisampleState {
|
|
648
|
-
count?: GPUSize32
|
|
649
|
-
mask?: GPUSampleMask
|
|
650
|
-
alphaToCoverageEnabled?: boolean
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
interface GPUBlendComponent {
|
|
654
|
-
operation?: GPUBlendOperation
|
|
655
|
-
srcFactor?: GPUBlendFactor
|
|
656
|
-
dstFactor?: GPUBlendFactor
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
interface GPUBlendState {
|
|
660
|
-
color: GPUBlendComponent
|
|
661
|
-
alpha: GPUBlendComponent
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
declare enum GPUColorWrite {
|
|
665
|
-
RED = 0x1,
|
|
666
|
-
GREEN = 0x2,
|
|
667
|
-
BLUE = 0x4,
|
|
668
|
-
ALPHA = 0x8,
|
|
669
|
-
ALL = 0xF
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
interface GPUColorTargetState {
|
|
673
|
-
format: GPUTextureFormat
|
|
674
|
-
blend?: GPUBlendState
|
|
675
|
-
writeMask?: number
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
interface GPUFragmentState extends GPUProgrammableStage {
|
|
679
|
-
targets: GPUColorTargetState[]
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
|
|
683
|
-
vertex: GPUVertexState
|
|
684
|
-
primitive?: GPUPrimitiveState
|
|
685
|
-
depthStencil?: GPUDepthStencilState
|
|
686
|
-
multisample?: GPUMultisampleState
|
|
687
|
-
fragment?: GPUFragmentState
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
interface GPURenderPipeline extends GPUObjectBase, GPUPipelineBase {}
|
|
691
|
-
|
|
692
|
-
interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {}
|
|
693
|
-
|
|
694
|
-
interface GPUCommandsMixin {}
|
|
695
|
-
|
|
696
|
-
interface GPUDebugCommandsMixin {
|
|
697
|
-
pushDebugGroup(groupLabel: number): void
|
|
698
|
-
popDebugGroup(): void
|
|
699
|
-
insertDebugMarker(markerLabel: number): void
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
interface GPURenderPassColorAttachment {
|
|
703
|
-
view: GPUTextureView
|
|
704
|
-
resolveTarget?: GPUTextureView
|
|
705
|
-
clearValue?: GPUColor
|
|
706
|
-
loadOp: GPULoadOp
|
|
707
|
-
storeOp: GPUStoreOp
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
interface GPURenderPassDepthStencilAttachment {
|
|
711
|
-
view: GPUTextureView
|
|
712
|
-
|
|
713
|
-
depthClearValue?: number
|
|
714
|
-
depthLoadOp?: GPULoadOp
|
|
715
|
-
depthStoreOp?: GPUStoreOp
|
|
716
|
-
depthReadOnly?: boolean
|
|
717
|
-
|
|
718
|
-
stencilClearValue?: GPUStencilValue
|
|
719
|
-
stencilLoadOp?: GPULoadOp
|
|
720
|
-
stencilStoreOp?: GPUStoreOp
|
|
721
|
-
stencilReadOnly?: boolean
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
interface GPUQuerySet extends GPUObjectBase {
|
|
725
|
-
destroy(): void
|
|
726
|
-
readonly type: GPUQueryType
|
|
727
|
-
readonly count: GPUSize32
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
interface GPURenderPassTimestampWrite {
|
|
731
|
-
querySet: GPUQuerySet
|
|
732
|
-
queryIndex: GPUSize32
|
|
733
|
-
location: GPURenderPassTimestampLocation
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
type GPURenderPassTimestampWrites = GPURenderPassTimestampWrite[]
|
|
737
|
-
|
|
738
|
-
interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
|
|
739
|
-
colorAttachments: GPURenderPassColorAttachment[]
|
|
740
|
-
depthStencilAttachment?: GPURenderPassDepthStencilAttachment
|
|
741
|
-
occlusionQuerySet?: GPUQuerySet
|
|
742
|
-
timestampWrites?: GPURenderPassTimestampWrites
|
|
743
|
-
maxDrawCount?: GPUSize64
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
interface GPUBindingCommandsMixin {
|
|
747
|
-
setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup, dynamicOffsets?: GPUBufferDynamicOffset[]): void
|
|
748
|
-
|
|
749
|
-
setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup,
|
|
750
|
-
dynamicOffsetsData: Uint32Array,
|
|
751
|
-
dynamicOffsetsDataStart: GPUSize64,
|
|
752
|
-
dynamicOffsetsDataLength: GPUSize32): void
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
interface GPURenderCommandsMixin {
|
|
756
|
-
setPipeline(pipeline: GPURenderPipeline): void
|
|
757
|
-
|
|
758
|
-
setIndexBuffer(buffer: GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64, size?: GPUSize64): void
|
|
759
|
-
setVertexBuffer(slot: GPUIndex32, buffer: GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void
|
|
760
|
-
|
|
761
|
-
draw(vertexCount: GPUSize32, instanceCount?: GPUSize32,
|
|
762
|
-
firstVertex?: GPUSize32, firstInstance?: GPUSize32): void
|
|
763
|
-
drawIndexed(indexCount: GPUSize32, instanceCount?: GPUSize32,
|
|
764
|
-
firstIndex?: GPUSize32,
|
|
765
|
-
baseVertex?: GPUSignedOffset32,
|
|
766
|
-
firstInstance?: GPUSize32): void
|
|
767
|
-
|
|
768
|
-
drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void
|
|
769
|
-
drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
interface GPURenderBundle extends GPUObjectBase {}
|
|
773
|
-
|
|
774
|
-
interface GPURenderPassEncoder extends GPUObjectBase, GPUCommandsMixin,
|
|
775
|
-
GPUDebugCommandsMixin, GPUBindingCommandsMixin, GPURenderCommandsMixin
|
|
776
|
-
{
|
|
777
|
-
setViewport(x: number, y: number,
|
|
778
|
-
width: number, height: number,
|
|
779
|
-
minDepth: number, maxDepth: number): void
|
|
780
|
-
|
|
781
|
-
setScissorRect(
|
|
782
|
-
x: GPUIntegerCoordinate,
|
|
783
|
-
y: GPUIntegerCoordinate,
|
|
784
|
-
width: GPUIntegerCoordinate,
|
|
785
|
-
height: GPUIntegerCoordinate
|
|
786
|
-
): void
|
|
787
|
-
|
|
788
|
-
setBlendConstant(color: GPUColor): void
|
|
789
|
-
setStencilReference(reference: GPUStencilValue): void
|
|
790
|
-
|
|
791
|
-
beginOcclusionQuery(queryIndex: GPUSize32): void
|
|
792
|
-
endOcclusionQuery(): void
|
|
793
|
-
|
|
794
|
-
executeBundles(bundles: GPURenderBundle[]): void
|
|
795
|
-
end(): void
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
interface GPUComputePassTimestampWrite {
|
|
799
|
-
querySet: GPUQuerySet
|
|
800
|
-
queryIndex: GPUSize32
|
|
801
|
-
location: GPUComputePassTimestampLocation
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
type GPUComputePassTimestampWrites = GPUComputePassTimestampWrite[]
|
|
805
|
-
|
|
806
|
-
interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
|
|
807
|
-
timestampWrites?: GPUComputePassTimestampWrites
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
interface GPUComputePassEncoder extends GPUObjectBase, GPUCommandsMixin,
|
|
811
|
-
GPUDebugCommandsMixin, GPUBindingCommandsMixin
|
|
812
|
-
{
|
|
813
|
-
setPipeline(pipeline: GPUComputePipeline): void
|
|
814
|
-
dispatchWorkgroups(
|
|
815
|
-
workgroupCountX: GPUSize32,
|
|
816
|
-
workgroupCountY?: GPUSize32,
|
|
817
|
-
workgroupCountZ?: GPUSize32
|
|
818
|
-
): void
|
|
819
|
-
dispatchWorkgroupsIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void
|
|
820
|
-
end(): void
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
interface GPUImageCopyBuffer extends GPUImageDataLayout {
|
|
824
|
-
buffer: GPUBuffer
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
|
|
828
|
-
|
|
829
|
-
interface GPUCommandEncoder extends GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin {
|
|
830
|
-
/**
|
|
831
|
-
* 开启一个渲染通道编码器
|
|
832
|
-
*
|
|
833
|
-
* @param descriptor
|
|
834
|
-
*/
|
|
835
|
-
beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* 开启一个计算通道编码器
|
|
839
|
-
*
|
|
840
|
-
* @param descriptor
|
|
841
|
-
*/
|
|
842
|
-
beginComputePass(descriptor: GPUComputePassDescriptor): GPUComputePassEncoder
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* 将一个 GPU 缓存数据复制到另一个 GPU 缓存
|
|
846
|
-
*
|
|
847
|
-
* @param source
|
|
848
|
-
* @param sourceOffset
|
|
849
|
-
* @param destination
|
|
850
|
-
* @param destinationOffset
|
|
851
|
-
* @param size
|
|
852
|
-
*/
|
|
853
|
-
copyBufferToBuffer(
|
|
854
|
-
source: GPUBuffer,
|
|
855
|
-
sourceOffset: GPUSize64,
|
|
856
|
-
destination: GPUBuffer,
|
|
857
|
-
destinationOffset: GPUSize64,
|
|
858
|
-
size: GPUSize64
|
|
859
|
-
): void
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* 将 GPU 缓存中的数据复制到一个纹理中
|
|
863
|
-
*
|
|
864
|
-
* @param source
|
|
865
|
-
* @param destination
|
|
866
|
-
* @param copySize
|
|
867
|
-
*/
|
|
868
|
-
copyBufferToTexture(
|
|
869
|
-
source: GPUImageCopyBuffer,
|
|
870
|
-
destination: GPUImageCopyTexture,
|
|
871
|
-
copySize: GPUExtent3D
|
|
872
|
-
): void
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* 将纹理数据复制到一个 GPU 缓存
|
|
876
|
-
*
|
|
877
|
-
* @param source
|
|
878
|
-
* @param destination
|
|
879
|
-
* @param copySize
|
|
880
|
-
*/
|
|
881
|
-
copyTextureToBuffer(
|
|
882
|
-
source: GPUImageCopyTexture,
|
|
883
|
-
destination: GPUImageCopyBuffer,
|
|
884
|
-
copySize: GPUExtent3D
|
|
885
|
-
): void
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* 将纹理数据复制到另一个纹理
|
|
889
|
-
*
|
|
890
|
-
* @param source
|
|
891
|
-
* @param destination
|
|
892
|
-
* @param copySize
|
|
893
|
-
*/
|
|
894
|
-
copyTextureToTexture(
|
|
895
|
-
source: GPUImageCopyTexture,
|
|
896
|
-
destination: GPUImageCopyTexture,
|
|
897
|
-
copySize: GPUExtent3D
|
|
898
|
-
): void
|
|
899
|
-
|
|
900
|
-
/**
|
|
901
|
-
* 清空 GPU 缓存
|
|
902
|
-
*
|
|
903
|
-
* @param buffer
|
|
904
|
-
* @param offset
|
|
905
|
-
* @param size
|
|
906
|
-
*/
|
|
907
|
-
clearBuffer(
|
|
908
|
-
buffer: GPUBuffer,
|
|
909
|
-
offset?: GPUSize64,
|
|
910
|
-
size?: GPUSize64
|
|
911
|
-
): void
|
|
912
|
-
|
|
913
|
-
/**
|
|
914
|
-
* 记录时间戳
|
|
915
|
-
*
|
|
916
|
-
* @param querySet
|
|
917
|
-
* @param queryIndex
|
|
918
|
-
*/
|
|
919
|
-
writeTimestamp(querySet: GPUQuerySet, queryIndex: GPUSize32): void
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* 将时间戳查询结果写入存储型缓冲
|
|
923
|
-
*
|
|
924
|
-
* @param querySet
|
|
925
|
-
* @param firstQuery
|
|
926
|
-
* @param queryCount
|
|
927
|
-
* @param destination
|
|
928
|
-
* @param destinationOffset
|
|
929
|
-
*/
|
|
930
|
-
resolveQuerySet(
|
|
931
|
-
querySet: GPUQuerySet,
|
|
932
|
-
firstQuery: GPUSize32,
|
|
933
|
-
queryCount: GPUSize32,
|
|
934
|
-
destination: GPUBuffer,
|
|
935
|
-
destinationOffset: GPUSize64
|
|
936
|
-
): void
|
|
937
|
-
|
|
938
|
-
/**
|
|
939
|
-
* 结束指令编码
|
|
940
|
-
*
|
|
941
|
-
* @param descriptor
|
|
942
|
-
*/
|
|
943
|
-
finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
interface GPURenderPassLayout extends GPUObjectDescriptorBase {
|
|
947
|
-
colorFormats: GPUTextureFormat[]
|
|
948
|
-
depthStencilFormat?: GPUTextureFormat
|
|
949
|
-
sampleCount?: GPUSize32
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout {
|
|
953
|
-
depthReadOnly?: boolean
|
|
954
|
-
stencilReadOnly?: boolean
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {}
|
|
958
|
-
|
|
959
|
-
interface GPURenderBundleEncoder extends GPUObjectBase, GPUCommandsMixin,
|
|
960
|
-
GPUDebugCommandsMixin, GPUBindingCommandsMixin, GPURenderCommandsMixin
|
|
961
|
-
{
|
|
962
|
-
/**
|
|
963
|
-
* 结束渲染捆绑包编码
|
|
964
|
-
*
|
|
965
|
-
* @param descriptor
|
|
966
|
-
*/
|
|
967
|
-
finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
|
|
971
|
-
type: GPUQueryType
|
|
972
|
-
count: GPUSize32
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
interface GPUDevice extends EventTarget, GPUObjectBase {
|
|
976
|
-
readonly features: GPUSupportedFeatures
|
|
977
|
-
readonly limits: GPUSupportedLimits
|
|
978
|
-
/**
|
|
979
|
-
* 指令队列
|
|
980
|
-
*/
|
|
981
|
-
readonly queue: GPUQueue
|
|
982
|
-
|
|
983
|
-
readonly lost: Promise<any>
|
|
984
|
-
|
|
985
|
-
destroy(): void
|
|
986
|
-
/**
|
|
987
|
-
* 创建一块 GPU 内存
|
|
988
|
-
*
|
|
989
|
-
* @param descriptor
|
|
990
|
-
*/
|
|
991
|
-
createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer
|
|
992
|
-
/**
|
|
993
|
-
* 创建一个纹理
|
|
994
|
-
*
|
|
995
|
-
* @param descriptor
|
|
996
|
-
*/
|
|
997
|
-
createTexture(descriptor: GPUTextureDescriptor): GPUTexture
|
|
998
|
-
/**
|
|
999
|
-
* 创建一个采样器
|
|
1000
|
-
*
|
|
1001
|
-
* @param descriptor
|
|
1002
|
-
*/
|
|
1003
|
-
createSampler(descriptor?: GPUSamplerDescriptor): GPUSampler
|
|
1004
|
-
/**
|
|
1005
|
-
* 从 一个 video 元素导出一个纹理,
|
|
1006
|
-
*
|
|
1007
|
-
* @param descriptor
|
|
1008
|
-
*/
|
|
1009
|
-
importExternalTexture(descriptor: GPUExternalTextureDescriptor): GPUExternalTexture
|
|
1010
|
-
/**
|
|
1011
|
-
* 创建一个绑定组布局
|
|
1012
|
-
*
|
|
1013
|
-
* @param descriptor
|
|
1014
|
-
*/
|
|
1015
|
-
createBindGroupLayout(descriptor: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout
|
|
1016
|
-
/**
|
|
1017
|
-
* 创建一个管线布局
|
|
1018
|
-
*
|
|
1019
|
-
* @param descriptor
|
|
1020
|
-
*/
|
|
1021
|
-
createPipelineLayout(descriptor: GPUPipelineLayoutDescriptor): GPUPipelineLayout
|
|
1022
|
-
/**
|
|
1023
|
-
* 创建一个绑定组
|
|
1024
|
-
*
|
|
1025
|
-
* @param descriptor
|
|
1026
|
-
*/
|
|
1027
|
-
createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* 创建一个着色器
|
|
1031
|
-
*
|
|
1032
|
-
* @param descriptor
|
|
1033
|
-
*/
|
|
1034
|
-
createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule
|
|
1035
|
-
/**
|
|
1036
|
-
* 创建一个计算管线
|
|
1037
|
-
*
|
|
1038
|
-
* @param descriptor
|
|
1039
|
-
*/
|
|
1040
|
-
createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline
|
|
1041
|
-
/**
|
|
1042
|
-
* 创建一个渲染管线
|
|
1043
|
-
*
|
|
1044
|
-
* @param descriptor
|
|
1045
|
-
*/
|
|
1046
|
-
createRenderPipeline(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline
|
|
1047
|
-
/**
|
|
1048
|
-
* 异步创建一个计算管线
|
|
1049
|
-
*
|
|
1050
|
-
* @param descriptor
|
|
1051
|
-
*/
|
|
1052
|
-
createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>
|
|
1053
|
-
/**
|
|
1054
|
-
* 异步创建一个渲染管线
|
|
1055
|
-
* @param descriptor
|
|
1056
|
-
*/
|
|
1057
|
-
createRenderPipelineAsync(descriptor: GPURenderPipelineDescriptor): Promise<GPURenderPipeline>
|
|
1058
|
-
/**
|
|
1059
|
-
* 创建一个指令编码器
|
|
1060
|
-
*
|
|
1061
|
-
* @param descriptor
|
|
1062
|
-
*/
|
|
1063
|
-
createCommandEncoder(descriptor?: GPUCommandEncoderDescriptor): GPUCommandEncoder
|
|
1064
|
-
/**
|
|
1065
|
-
* 创建一个渲染捆绑包编码器
|
|
1066
|
-
*
|
|
1067
|
-
* @param descriptor
|
|
1068
|
-
*/
|
|
1069
|
-
createRenderBundleEncoder(descriptor: GPURenderBundleEncoderDescriptor): GPURenderBundleEncoder
|
|
1070
|
-
/**
|
|
1071
|
-
* 创建一个查询集
|
|
1072
|
-
*
|
|
1073
|
-
* @param descriptor
|
|
1074
|
-
*/
|
|
1075
|
-
createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
interface GPUAdapter {
|
|
1079
|
-
/**
|
|
1080
|
-
* 当前 GPU Adapter 支持的功能列表
|
|
1081
|
-
*/
|
|
1082
|
-
readonly features: Map<string, string>
|
|
1083
|
-
/**
|
|
1084
|
-
* 当前 GPU Adapter 的一些限制
|
|
1085
|
-
*/
|
|
1086
|
-
readonly limits: GPUSupportedLimits
|
|
1087
|
-
/**
|
|
1088
|
-
* 是否是回滚的 GPU Adapter(比如在一个没有独显的设备上请求独显 Adapter,则返回的核显 Adapter,此值为 true)
|
|
1089
|
-
*/
|
|
1090
|
-
readonly isFallbackAdapter: boolean
|
|
1091
|
-
/**
|
|
1092
|
-
* 获取 GPUDevice 设备
|
|
1093
|
-
*
|
|
1094
|
-
* @param options
|
|
1095
|
-
*/
|
|
1096
|
-
requestDevice(options?: GPUDeviceDescriptor): Promise<GPUDevice>
|
|
1097
|
-
/**
|
|
1098
|
-
* 获取 GPU Adapter 的一些信息
|
|
1099
|
-
*
|
|
1100
|
-
* @param unmaskHints
|
|
1101
|
-
*/
|
|
1102
|
-
requestAdapterInfo(unmaskHints?: string[]): Promise<GPUAdapterInfo>
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
interface GPUCanvasConfiguration {
|
|
1106
|
-
device: GPUDevice
|
|
1107
|
-
format: GPUTextureFormat
|
|
1108
|
-
usage?: number
|
|
1109
|
-
viewFormats?: GPUTextureFormat[]
|
|
1110
|
-
colorSpace?: string
|
|
1111
|
-
alphaMode?: GPUCanvasAlphaMode
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
declare interface GPUCanvasContext {
|
|
1115
|
-
readonly canvas: HTMLCanvasElement | OffscreenCanvas
|
|
1116
|
-
/**
|
|
1117
|
-
* GPUCanvasContext 配置
|
|
1118
|
-
*
|
|
1119
|
-
* @param configuration
|
|
1120
|
-
*/
|
|
1121
|
-
configure(configuration: GPUCanvasConfiguration): void
|
|
1122
|
-
/**
|
|
1123
|
-
* GPUCanvasContext 取消配置
|
|
1124
|
-
*/
|
|
1125
|
-
unconfigure(): void
|
|
1126
|
-
/**
|
|
1127
|
-
* 获取当前的 canvas 颜色缓冲 texture(注意每次一绘制操作都需要重新获取)
|
|
1128
|
-
*/
|
|
1129
|
-
getCurrentTexture(): GPUTexture
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
interface GPU {
|
|
1133
|
-
/**
|
|
1134
|
-
* 获取设备适配器,可以选择获取核显或独显
|
|
1135
|
-
* 'low-power' 核显
|
|
1136
|
-
* 'high-performance' 独显
|
|
1137
|
-
*
|
|
1138
|
-
* @param options
|
|
1139
|
-
*/
|
|
1140
|
-
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter>
|
|
1141
|
-
/**
|
|
1142
|
-
* 获取 canvas 的优先颜色格式(texture 最好使用这个颜色格式)
|
|
1143
|
-
*/
|
|
1144
|
-
getPreferredCanvasFormat(): 'rgba8unorm' | 'bgra8unorm'
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
declare interface Navigator {
|
|
1148
|
-
gpu: GPU
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
declare interface HTMLCanvasElement {
|
|
1152
|
-
/**
|
|
1153
|
-
* 获取 webgpu 上下文
|
|
1154
|
-
*
|
|
1155
|
-
* @param contextId
|
|
1156
|
-
*/
|
|
1157
|
-
getContext(contextId: 'webgpu'): GPUCanvasContext | null
|
|
1158
|
-
}
|