-
Notifications
You must be signed in to change notification settings - Fork 5
/
mugl.ts
786 lines (721 loc) · 22.1 KB
/
mugl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/**
* Minimal WebGPU_like rendering interface.
* @packageDocumentation
*/
import {
AddressMode, CompareFunction, CullMode, FilterMode, Float, FrontFace, FutureStatus, IndexFormat, MipmapHint,
PrimitiveTopology, ShaderStage, StencilOperation, TextureDimension, TextureFormat, TextureUsage, UInt
} from './gpu';
import { WebGLContextAttributeFlag } from './gl2';
import { WebGPUContextAttributeFlag } from './webgpu';
//#region Pointers
export type ContextId = f64;
export type FutureId = f64;
export type FutureValueId = f64;
export type CanvasId = f64;
export type ImageSourceId = f64;
export type DeviceId = f64;
export type BufferId = f64;
export type TextureId = f64;
export type SamplerId = f64;
export type ShaderId = f64;
export type BindGroupLayoutId = f64;
export type BindGroupId = f64;
export type RenderPipelineId = f64;
export type RenderPassId = f64;
//#endregion Pointers
//#region DOM
/**
* Returns current status of the future.
* @param id future pointer
* @returns future status
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_future_status")
export declare function getFutureStatus(id: FutureId): FutureStatus;
/**
* Returns resolved value of the future.
* @param id future pointer
* @returns future value pointer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_future_value")
export declare function getFutureValue(id: FutureId): FutureValueId;
/**
* Gets an image handle by string ID.
* @param context unique context ID for the app
* @param idPtr the image ID string pointer
* @param idLen the image ID string length
* @returns image pointer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_image_by_id")
export declare function getImageById(context: ContextId, idPtr: usize, idLen: usize): ImageSourceId;
/**
* Deletes an image handle.
* @param image image pointer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_image")
export declare function deleteImage(image: ImageSourceId): void;
/**
* Get the width of the given image.
* @param canvas image pointer
* @returns image width
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_image_width")
export declare function getImageWidth(image: ImageSourceId): UInt;
/**
* Get the height of the given image.
* @param canvas image pointer
* @returns image height
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_image_height")
export declare function getImageHeight(image: ImageSourceId): UInt;
/**
* Get canvas by string ID.
* @param context unique context ID for the app
* @param idPtr the image ID string pointer
* @param idLen the image URI ID length
* @returns canvas pointer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_canvas_by_id")
export declare function getCanvasById(context: ContextId, idPtr: usize, idLen: usize): CanvasId;
/**
* Get the width of given canvas.
* @param canvas canvas pointer
* @returns canvas width
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_canvas_width")
export declare function getCanvasWidth(canvas: CanvasId): UInt;
/**
* Get the height of given canvas.
* @param canvas canvas pointer
* @returns canvas height
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_canvas_height")
export declare function getCanvasHeight(canvas: CanvasId): UInt;
/**
* Deletes a canvas handle.
* @param canvas canvas pointer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_canvas")
export declare function deleteCanvas(canvas: CanvasId): void;
//#endregion DOM
//#region WebGPU
/**
* Requests a WebGPU GPU device.
* @param canvas canvas pointer
* @param desc WebGPUContextAttributeFlag
* @param features WebGPUFeature flags
* @returns future to the device pointer, or 0 if WebGPU is unsupported
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "webgpu_request_device")
export declare function requestWebGPUDevice(
canvas: CanvasId, desc: WebGPUContextAttributeFlag, features: UInt
): FutureId;
/**
* Creates a WebGPU surface texture.
* @param device device pointer
* @param canvas canvas pointer
* @param desc WebGPUContextAttributeFlag
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "webgpu_create_surface_texture")
export declare function createWebGPUSurfaceTexture(
device: DeviceId,
canvas: CanvasId,
desc: WebGPUContextAttributeFlag
): TextureId;
/**
* Creates a WebGPU surface depth-stencil texture.
* @param device device pointer
* @param canvas canvas pointer
* @param desc WebGPUContextAttributeFlag
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "webgpu_create_surface_depth_texture")
export declare function createWebGPUSurfaceDepthTexture(
device: DeviceId,
canvas: CanvasId,
desc: WebGPUContextAttributeFlag
): TextureId;
//#endregion WebGPU
//#region WebGL2
/**
* Requests a WebGL2 GPU device.
* @param canvas canvas pointer
* @param desc WebGLContextAttributeFlag
* @param features WebGL2Feature flags
* @returns the device pointer, or 0 if WebGL2 is unsupported
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "webgl_request_device")
export declare function requestWebGL2Device(
canvas: CanvasId, desc: WebGLContextAttributeFlag, features: UInt
): DeviceId;
/**
* Generates mipmap for a WebGL texture.
* @param device
* @param texture
* @param hint
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "webgl_generate_mipmap")
export declare function generateMipmap(device: DeviceId, texture: TextureId, hint: MipmapHint): void
//#endregion WebGL2
//#region GPU
/**
* Flushes the command buffer
* @param device the device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "flush")
export declare function flush(device: DeviceId): void;
/**
* Resets the state of a GPU device.
* @param device the device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "reset_device")
export declare function resetDevice(device: DeviceId): void;
/**
* Deletes a device.
* @param device the device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_device")
export declare function deleteDevice(device: DeviceId): void;
/**
* Checks if the device is lost.
* @param device the device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "is_device_lost")
export declare function isDeviceLost(device: DeviceId): boolean;
/**
* Get supported and enabled features of a device.
* @param device the device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "get_device_features")
export declare function getFeatures(device: DeviceId): u32;
/**
* Creates a GPU buffer.
* @param device the device
* @param size buffer byte size
* @param usage buffer usage flags
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_buffer")
export declare function createBuffer(device: DeviceId, size: UInt, usage: UInt): BufferId;
/**
* Deletes a GPU buffer.
* @param device the device
* @param buffer the buffer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_buffer")
export declare function deleteBuffer(buffer: BufferId): void;
/**
* Creates a GPU texture.
* @param device
* @param width
* @param height
* @param depth
* @param mipLevelCount
* @param sampleCount
* @param dimension
* @param format
* @param usage
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_texture")
export declare function createTexture(
device: DeviceId,
width: UInt, height: UInt, depth: UInt,
mipLevelCount: UInt,
sampleCount: UInt,
dimension: TextureDimension,
format: TextureFormat,
usage: TextureUsage,
): TextureId;
/**
* Deletes a GPU texture.
* @param device the device
* @param texture the texture
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_texture")
export declare function deleteTexture(texture: TextureId): void;
/**
* Creates a GPU sampler.
* @param device
* @param addressModeU
* @param addressModeV
* @param addressModeW
* @param magFilter
* @param minFilter
* @param mipmapFilter
* @param lodMinClamp
* @param lodMaxClamp
* @param compare
* @param maxAnisotropy
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_sampler")
export declare function createSampler(
device: DeviceId,
addressModeU: AddressMode, addressModeV: AddressMode, addressModeW: AddressMode,
magFilter: FilterMode, minFilter: FilterMode, mipmapFilter: FilterMode,
lodMinClamp: f32, lodMaxClamp: f32,
compare: CompareFunction,
maxAnisotropy: UInt
): SamplerId;
/**
* Deletes a GPU sampler.
* @param device
* @param sampler
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_sampler")
export declare function deleteSampler(sampler: SamplerId): void;
/**
* Creates a GPU shader module.
* @param device
* @param codePtr shader code string pointer
* @param codeLen shader code string length
* @param usage
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_shader")
export declare function createShader(device: DeviceId, codePtr: usize, codeLen: UInt, usage: ShaderStage): ShaderId;
/**
* Deletes a GPU shader.
* @param device
* @param shader
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_shader")
export declare function deleteShader(shader: ShaderId): void;
/**
* Creates a GPU bind group layout.
* @param device
* @param entriesPtr pointer to BindGroupLayoutEntry array
* @param entriesLen length of BindGroupLayoutEntry array
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_bind_group_layout")
export declare function createBindGroupLayout(
device: DeviceId, entriesPtr: usize, entriesLen: UInt
): BindGroupLayoutId;
/**
* Deletes a GPU bind group layout.
* @param device
* @param bindGroupLayout
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_bind_group_layout")
export declare function deleteBindGroupLayout(bindGroupLayout: BindGroupLayoutId): void;
/**
* Creates a GPU bind group.
* @param device
* @param layout the BindGroupLayout
* @param entriesPtr pointer to BindGroupEntry array
* @param entriesLen length of BindGroupEntry array
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_bind_group")
export declare function createBindGroup(
device: DeviceId, layout: BindGroupLayoutId, entriesPtr: usize, entriesLen: UInt
): BindGroupId;
/**
* Deletes a GPU bind group.
* @param device
* @param bindGroup
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_bind_group")
export declare function deleteBindGroup(bindGroup: BindGroupId): void;
/**
* Creates a GPU render pipeline.
* @param device
* @param vertex
* @param fragment
* @param attributesPtr pointer to VertexAttribute array
* @param attributesLen length of VertexAttribute array
* @param buffersPtr pointer to VertexBufferLayout array
* @param buffersLen length of VertexBufferLayout array
* @param bindGroupsPtr pointer to BindGroupLayout array
* @param bindGroupsLen length of BindGroupLayout array
* @param topology
* @param indexFormat
* @param frontFace
* @param cullMode
* @param sampleCount
* @param alphaToCoverage
* @param hasDepthStencil
* @param depthStencilFormat
* @param depthWrite
* @param depthCompare
* @param stencilFrontCompare
* @param stencilFrontFailOp
* @param stencilFrontDepthFailOp
* @param stencilFrontPassOp
* @param stencilBackCompare
* @param stencilBackFailOp
* @param stencilBackDepthFailOp
* @param stencilBackPassOp
* @param stencilReadMask
* @param stencilWriteMask
* @param depthBias
* @param depthBiasSlopeScale
* @param depthBiasClamp
* @param colorsPtr pointer to ColorTargetState array
* @param colorsLen length of ColorTargetState array
* @param colorWriteMask
* @param blendColorOperation
* @param blendColorSrcFactor
* @param blendColorDstFactor
* @param blendAlphaOperation
* @param blendAlphaSrcFactor
* @param blendAlphaDstFactor
* @param vertexEntryPointPtr pointer to vertexEntryPoint string
* @param vertexEntryPointLen length of vertexEntryPoint string
* @param fragmentEntryPointPtr pointer to fragmentEntryPoint string
* @param fragmentEntryPointLen length of fragmentEntryPoint string
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_render_pipeline")
export declare function createRenderPipeline(
device: DeviceId,
vertex: ShaderId,
fragment: ShaderId,
attributesPtr: usize, attributesLen: UInt,
buffersPtr: usize, buffersLen: UInt,
bindGroupsPtr: usize, bindGroupsLen: UInt,
topology: PrimitiveTopology, indexFormat: IndexFormat, frontFace: FrontFace, cullMode: CullMode,
sampleCount: UInt, alphaToCoverage: boolean,
hasDepthStencil: boolean, depthStencilFormat: TextureFormat, depthWrite: boolean, depthCompare: CompareFunction,
stencilFrontCompare: CompareFunction, stencilFrontFailOp: StencilOperation, stencilFrontDepthFailOp: StencilOperation, stencilFrontPassOp: StencilOperation,
stencilBackCompare: CompareFunction, stencilBackFailOp: StencilOperation, stencilBackDepthFailOp: StencilOperation, stencilBackPassOp: StencilOperation,
stencilReadMask: UInt, stencilWriteMask: UInt, depthBias: Float, depthBiasSlopeScale: Float, depthBiasClamp: Float,
colorsPtr: usize, colorsLen: UInt,
colorWriteMask: UInt,
blendColorOperation: UInt, blendColorSrcFactor: UInt, blendColorDstFactor: UInt,
blendAlphaOperation: UInt, blendAlphaSrcFactor: UInt, blendAlphaDstFactor: UInt,
vertexEntryPointPtr: usize, vertexEntryPointLen: UInt, fragmentEntryPointPtr: usize, fragmentEntryPointLen: UInt,
): RenderPipelineId;
/**
* Deletes a GPU render pipeline.
* @param device
* @param renderPipeline
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_render_pipeline")
export declare function deleteRenderPipeline(renderPipeline: RenderPipelineId): void;
/**
* Creates a GPU render pass.
* @param device
* @param clearDepth
* @param clearStencil
* @param clearColorRed
* @param clearColorGreen
* @param clearColorBlue
* @param clearColorAlpha
* @param isOffscreen
* @param depthStencilTexture
* @param depthStecilMipLevel
* @param depthStecilSlice
* @param colorsPtr pointer to ColorAttachment array
* @param colorsLen ength of ColorAttachment array
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "create_render_pass")
export declare function createRenderPass(
device: DeviceId,
clearDepth: Float, clearStencil: Float,
clearColorRed: Float, clearColorGreen: Float, clearColorBlue: Float, clearColorAlpha: Float,
isOffscreen: boolean,
depthStencilTexture: TextureId, depthStecilMipLevel: UInt, depthStecilSlice: UInt,
colorsPtr: usize, colorsLen: UInt
): RenderPassId;
/**
* Deletes a GPU render pass.
* @param device
* @param renderPipeline
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "delete_render_pass")
export declare function deleteRenderPass(renderPass: RenderPassId): void;
/**
* Reads data from a GPU buffer.
* @param device
* @param buffer
* @param offset offset into the GPU buffer to read from
* @param outPtr pointer to the output buffer
* @param size byte size of the output
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "read_buffer")
export declare function readBuffer(
device: DeviceId, buffer: BufferId, offset: UInt, outPtr: usize, size: UInt
): FutureId;
/**
* Writes data to a GPU buffer.
* @param device
* @param buffer
* @param dataPtr pointer to the data buffer to read from
* @param size byte size of the data
* @param offset offset into the GPU buffer to write to
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "write_buffer")
export declare function writeBuffer(
device: DeviceId, buffer: BufferId, dataPtr: usize, size: UInt, offset: UInt
): void;
/**
* Copies data from a GPU buffer to another buffer.
* @param device
* @param src
* @param dst
* @param size data byte size to copy
* @param srcOffset
* @param dstOffset
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "copy_buffer")
export declare function copyBuffer(
device: DeviceId, src: BufferId, dst: BufferId, size: UInt, srcOffset: UInt, dstOffset: UInt
): void;
/**
* Writes subregion of data array to a GPU texture.
* @param device
* @param texture
* @param mipLevel
* @param x
* @param y
* @param z
* @param dataPtr pointer to the data buffer to read from
* @param dataLen byte size of the data
* @param offset
* @param bytesPerRow
* @param rowsPerImage
* @param width
* @param height
* @param depth
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "write_texture")
export declare function writeTexture(
device: DeviceId,
texture: TextureId, mipLevel: UInt, x: UInt, y: UInt, z: UInt,
dataPtr: usize, dataLen: UInt,
offset: UInt, bytesPerRow: UInt, rowsPerImage: UInt,
width: UInt, height: UInt, depth: UInt
): void;
/**
* Uploads an image subregion to a GPU texture.
* @param device
* @param src
* @param srcX
* @param srcY
* @param dst
* @param mipLevel
* @param dstX
* @param dstY
* @param dstZ
* @param width
* @param height
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "copy_external_image_to_texture")
export declare function copyExternalImageToTexture(
device: DeviceId,
src: ImageSourceId, srcX: UInt, srcY: UInt,
dst: TextureId, mipLevel: UInt, dstX: UInt, dstY: UInt, dstZ: UInt,
width: UInt, height: UInt
): void;
/**
* Copies subregion of a GPU texture to another texture.
* @param device
* @param src
* @param srcMipLevel
* @param srcX
* @param srcY
* @param srcZ
* @param dst
* @param dstMipLevel
* @param dstX
* @param dstY
* @param dstZ
* @param width
* @param height
* @param depth
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "copy_texture")
export declare function copyTexture(
device: DeviceId,
src: TextureId, srcMipLevel: UInt, srcX: UInt, srcY: UInt, srcZ: UInt,
dst: TextureId, dstMipLevel: UInt, dstX: UInt, dstY: UInt, dstZ: UInt,
width: UInt, height: UInt, depth: UInt
): void;
/**
* Copies subregion of a GPU texture to a GPU buffer.
* @param device
* @param src
* @param srcMipLevel
* @param srcX
* @param srcY
* @param srcZ
* @param dst
* @param offset
* @param bytesPerRow
* @param rowsPerImage
* @param width
* @param height
* @param depth
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "copy_texture_to_buffer")
export declare function copyTextureToBuffer(
device: DeviceId,
src: TextureId, srcMipLevel: UInt, srcX: UInt, srcY: UInt, srcZ: UInt,
dst: BufferId,
offset: UInt, bytesPerRow: UInt, rowsPerImage: UInt,
width: UInt, height: UInt, depth: UInt
): void;
/**
* Begins a render pass.
* @param device
* @param pass
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "begin_render_pass")
export declare function beginRenderPass(device: DeviceId, pass: RenderPassId): void;
/**
* Submits the current render pass.
* @param device
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "submit_render_pass")
export declare function submitRenderPass(device: DeviceId): void;
/**
* Binds a render pipeline to the current render pass.
* @param device
* @param pipeline
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_render_pipeline")
export declare function setRenderPipeline(device: DeviceId, pipeline: RenderPipelineId): void;
/**
* Binds an index buffer to the current render pass.
* @param device
* @param buffer
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_index")
export declare function setIndex(device: DeviceId, buffer: BufferId): void;
/**
* Binds a vertex buffer to a slot in the current render pass.
* @param device
* @param slot
* @param buffer
* @param offset
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_vertex")
export declare function setVertex(device: DeviceId, slot: UInt, buffer: BufferId, offset: UInt): void;
/**
* Binds a bind group to the current render pass.
* @param device
* @param slot
* @param bindGroup
* @param offsetsPtr pointer to the dynamic offset array
* @param offsetsLen length of the dynamic offset array
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_bind_group")
export declare function setBindGroup(
device: DeviceId, slot: UInt, bindGroup: BindGroupId, offsetsPtr: usize, offsetsLen: UInt
): void;
/**
* Submits a draw call in the current render pass.
* @param device
* @param vertexCount
* @param instanceCount
* @param firstVertex
* @param firstInstance
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "draw")
export declare function draw(
device: DeviceId, vertexCount: UInt, instanceCount: UInt, firstVertex: UInt, firstInstance: UInt
): void;
/**
* Submits an indexed draw call in the current render pass.
* @param device
* @param indexCount
* @param instanceCount
* @param firstIndex
* @param firstInstance
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "draw_indexed")
export declare function drawIndexed(
device: DeviceId, indexCount: UInt, instanceCount: UInt, firstIndex: UInt, firstInstance: UInt
): void;
/**
* Sets the 3D viewport area for the current render pass.
* @param device
* @param x
* @param y
* @param width
* @param height
* @param minDepth
* @param maxDepth
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_viewport")
export declare function setViewport(
device: DeviceId, x: UInt, y: UInt, width: UInt, height: UInt, minDepth: Float, maxDepth: Float
): void;
/**
* Sets the scissor rectangle for the current render pass.
* @param device
* @param x
* @param y
* @param width
* @param height
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_scissor_rect")
export declare function setScissorRect(device: DeviceId, x: UInt, y: UInt, width: UInt, height: UInt): void;
/**
* Sets the blend_constant color for the current render pass.
* @param device
* @param red
* @param green
* @param blue
* @param alpha
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_blend_const")
export declare function setBlendConst(device: DeviceId, red: Float, green: Float, blue: Float, alpha: Float): void;
/**
* Sets the stencil reference value for the current render pass.
* @param device
* @param ref
*/
//@ts-expect-error: host binding
@external("mugl/wasm", "set_stencil_ref")
export declare function setStencilRef(device: DeviceId, ref: UInt): void;
//#endregion GPU