@@ -51,14 +51,15 @@ var LibraryWebGPU = {
51
51
initManagers : function ( ) {
52
52
function makeManager ( ) {
53
53
return {
54
- objects : [ null ] ,
54
+ objects : [ undefined ] ,
55
55
create : function ( object ) {
56
56
var id = this . objects . length ;
57
57
{ { { gpu . makeCheck ( "typeof this.objects[id] === 'undefined'" ) } } }
58
58
this . objects [ id ] = { refcount : 1 , object } ;
59
59
return id ;
60
60
} ,
61
61
get : function ( id ) {
62
+ if ( id === 0 ) return undefined ;
62
63
{ { { gpu . makeCheckDefined ( 'this.objects[id]' ) } } }
63
64
return this . objects [ id ] . object ;
64
65
} ,
@@ -70,7 +71,7 @@ var LibraryWebGPU = {
70
71
release : function ( id ) {
71
72
var o = this . objects [ id ] ;
72
73
{ { { gpu . makeCheckDefined ( 'o' ) } } }
73
- { { { gpu . makeCheck ( 'o.refCount > 0' ) } } }
74
+ { { { gpu . makeCheck ( 'o.refcount > 0' ) } } }
74
75
o . refcount -- ;
75
76
if ( o . refcount <= 0 ) {
76
77
delete this . objects [ id ] ;
@@ -95,13 +96,51 @@ var LibraryWebGPU = {
95
96
{ { { gpu . makeInitManager ( 'ShaderModule' ) } } }
96
97
} ,
97
98
98
- getColor : function ( ptr ) {
99
- return [
100
- { { { makeGetValue ( 'ptr' , 0 , 'float' ) } } } ,
101
- { { { makeGetValue ( 'ptr' , 4 , 'float' ) } } } ,
102
- { { { makeGetValue ( 'ptr' , 8 , 'float' ) } } } ,
103
- { { { makeGetValue ( 'ptr' , 12 , 'float' ) } } } ,
104
- ] ;
99
+ makeColor : function ( ptr ) {
100
+ return {
101
+ r : { { { makeGetValue ( 'ptr' , 0 , 'float' ) } } } ,
102
+ g : { { { makeGetValue ( 'ptr' , 4 , 'float' ) } } } ,
103
+ b: { { { makeGetValue ( 'ptr' , 8 , 'float' ) } } } ,
104
+ a: { { { makeGetValue ( 'ptr' , 12 , 'float' ) } } } ,
105
+ } ;
106
+ } ,
107
+
108
+ makeExtent3D : function ( ptr ) {
109
+ return {
110
+ width : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnExtent3D . width) } } } ,
111
+ height : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnExtent3D . height) } } } ,
112
+ depth : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnExtent3D . depth) } } } ,
113
+ } ;
114
+ } ,
115
+
116
+ makeOrigin3D : function ( ptr ) {
117
+ return {
118
+ x : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnOrigin3D . x) } } } ,
119
+ y : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnOrigin3D . y) } } } ,
120
+ z : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnOrigin3D . z) } } } ,
121
+ } ;
122
+ } ,
123
+
124
+ makeTextureCopyView : function ( ptr ) {
125
+ { { { gpu . makeCheckDescriptor ( 'ptr' ) } } }
126
+ return {
127
+ texture : this . mgrTexture . get (
128
+ { { { makeGetValue ( 'ptr' , C_STRUCTS . DawnTextureCopyView . texture , '*' ) } } } ) ,
129
+ mipLevel : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnTextureCopyView . mipLevel, '*' ) } } } ,
130
+ arrayLayer : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnTextureCopyView . arrayLayer, '*' ) } } } ,
131
+ origin : WebGPU . makeOrigin3D ( ptr + { { { C_STRUCTS . DawnTextureCopyView . origin } } } ) ,
132
+ } ;
133
+ } ,
134
+
135
+ makeBufferCopyView : function ( ptr ) {
136
+ { { { gpu . makeCheckDescriptor ( 'ptr' ) } } }
137
+ return {
138
+ buffer : this . mgrBuffer . get (
139
+ { { { makeGetValue ( 'ptr' , C_STRUCTS . DawnBufferCopyView . buffer , '*' ) } } } ) ,
140
+ offset : { { { gpu . makeGetU64 ( 'ptr' , C_STRUCTS . DawnBufferCopyView . offset) } } } ,
141
+ rowPitch : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnBufferCopyView . rowPitch) } } } ,
142
+ imageHeight : { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnBufferCopyView . imageHeight) } } } ,
143
+ } ;
105
144
} ,
106
145
107
146
AddressMode : [ 'repeat' , 'mirror-repeat' , 'clamp-to-edge' ] ,
@@ -130,22 +169,22 @@ var LibraryWebGPU = {
130
169
TextureComponentType : [ 'float' , 'sint' , 'uint' ] ,
131
170
TextureDimension : [ '1d' , '2d' , '3d' ] ,
132
171
TextureFormat : [
133
- 'undefined' , 'r8-unorm ' , 'r8-snorm ' , 'r8-uint ' , 'r8-sint ' , 'r16-uint ' , 'r16-sint ' ,
134
- 'r16-float ' , 'rg8-unorm ' , 'rg8-snorm ' , 'rg8-uint ' , 'rg8-sint ' , 'r32-float ' , 'r32-uint ' ,
135
- 'r32-sint ' , 'rg16-uint ' , 'rg16-sint ' , 'rg16-float ' , 'rgba8-unorm ' , 'rgba8-unorm -srgb' ,
136
- 'rgba8-snorm ' , 'rgba8-uint ' , 'rgba8-sint ' , 'bgra8-unorm ' , 'bgra8-unorm -srgb' ,
137
- 'rgb10-a2-unorm ' , 'rg11-b10-float ' , 'rg32-float ' , 'rg32-uint ' , 'rg32-sint ' , 'rgba16-uint ' ,
138
- 'rgba16-sint ' , 'rgba16-float ' , 'rgba32-float ' , 'rgba32-uint ' , 'rgba32-sint ' ,
139
- 'depth32-float ' , 'depth24-plus ' , 'depth24-plus-stencil8 ' , 'bc1-rgba-unorm ' ,
140
- 'bc1-rgba-unorm- srgb' , 'bc2-rgba-unorm ' , 'bc2-rgba-unorm- srgb' , 'bc3-rgba-unorm ' ,
141
- 'bc3-rgba-unorm- srgb' , 'bc4-r-unorm ' , 'bc4-r-snorm ' , 'bc5-rg-unorm ' , 'bc5-rg-snorm ' ,
142
- 'bc6h-rgb-ufloat ' , 'bc6h-rgb-sfloat ' , 'bc7-rgba-unorm ' , 'bc7-rgba-unorm -srgb' ,
172
+ 'undefined' , 'r8unorm ' , 'r8snorm ' , 'r8uint ' , 'r8sint ' , 'r16uint ' , 'r16sint ' ,
173
+ 'r16float ' , 'rg8unorm ' , 'rg8snorm ' , 'rg8uint ' , 'rg8sint ' , 'r32float ' , 'r32uint ' ,
174
+ 'r32sint ' , 'rg16uint ' , 'rg16sint ' , 'rg16float ' , 'rgba8unorm ' , 'rgba8unorm -srgb' ,
175
+ 'rgba8snorm ' , 'rgba8uint ' , 'rgba8sint ' , 'bgra8unorm ' , 'bgra8unorm -srgb' ,
176
+ 'rgb10a2unorm ' , 'rg11b10float ' , 'rg32float ' , 'rg32uint ' , 'rg32sint ' , 'rgba16uint ' ,
177
+ 'rgba16sint ' , 'rgba16float ' , 'rgba32float ' , 'rgba32uint ' , 'rgba32sint ' ,
178
+ 'depth32float ' , 'depth24plus ' , 'depth24plusstencil8 ' , 'bc1rgbaunorm ' ,
179
+ 'bc1rgbaunorm- srgb' , 'bc2rgbaunorm ' , 'bc2rgbaunorm- srgb' , 'bc3rgbaunorm ' ,
180
+ 'bc3rgbaunorm- srgb' , 'bc4runorm ' , 'bc4rsnorm ' , 'bc5rgunorm ' , 'bc5rgsnorm ' ,
181
+ 'bc6hrgbufloat ' , 'bc6hrgbsfloat ' , 'bc7rgbaunorm ' , 'bc7rgbaunorm -srgb' ,
143
182
] ,
144
- TextureViewDimension : [ 'undefined' , '1d' , '2d' , '2d-array ' , 'cube' , 'cube-array' , '3d' ] ,
183
+ TextureViewDimension : [ 'undefined' , '1d' , '2d' , '2darray ' , 'cube' , 'cube-array' , '3d' ] ,
145
184
VertexFormat : [
146
- 'uchar2' , 'uchar4' , 'char2' , 'char4' , 'uchar2-norm ' , 'uchar4-norm ' , 'char2-norm ' ,
147
- 'char4-norm ' , 'ushort2' , 'ushort4' , 'short2' , 'short4' , 'ushort2-norm ' , 'ushort4-norm ' ,
148
- 'short2-norm ' , 'short4-norm ' , 'half2' , 'half4' , 'float' , 'float2' , 'float3' , 'float4' ,
185
+ 'uchar2' , 'uchar4' , 'char2' , 'char4' , 'uchar2norm ' , 'uchar4norm ' , 'char2norm ' ,
186
+ 'char4norm ' , 'ushort2' , 'ushort4' , 'short2' , 'short4' , 'ushort2norm ' , 'ushort4norm ' ,
187
+ 'short2norm ' , 'short4norm ' , 'half2' , 'half4' , 'float' , 'float2' , 'float3' , 'float4' ,
149
188
'uint' , 'uint2' , 'uint3' , 'uint4' , 'int' , 'int2' , 'int3' , 'int4' ,
150
189
] ,
151
190
} ,
@@ -201,8 +240,23 @@ var LibraryWebGPU = {
201
240
return WebGPU . mgrBuffer . create ( device . createBuffer ( desc ) ) ;
202
241
} ,
203
242
204
- dawnDeviceCreateTexture : function ( ) {
205
- console . warn ( 'dawnDeviceCreateTexture: unimplemented' ) ;
243
+ dawnDeviceCreateTexture : function ( deviceId , descriptor ) {
244
+ { { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
245
+
246
+ var desc = {
247
+ size : WebGPU . makeExtent3D ( descriptor + { { { C_STRUCTS . DawnTextureDescriptor . size } } } ) ,
248
+ arrayLayerCount : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . arrayLayerCount) } } } ,
249
+ mipLevelCount : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . mipLevelCount) } } } ,
250
+ sampleCount : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . sampleCount) } } } ,
251
+ dimension : WebGPU . TextureDimension [
252
+ { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . dimension ) } } } ] ,
253
+ format : WebGPU . TextureFormat [
254
+ { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . format ) } } } ] ,
255
+ usage : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureDescriptor . usage) } } } ,
256
+ } ;
257
+
258
+ var device = WebGPU . mgrDevice . get ( deviceId ) ;
259
+ return WebGPU . mgrTexture . create ( device . createTexture ( desc ) ) ;
206
260
} ,
207
261
208
262
dawnDeviceCreatePipelineLayout : function ( deviceId , descriptor ) {
@@ -223,8 +277,18 @@ var LibraryWebGPU = {
223
277
dawnDeviceCreateRenderPipeline : function ( deviceId , descriptor ) {
224
278
{ { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
225
279
280
+ function makeStage ( ptr ) {
281
+ if ( ptr === 0 ) return undefined ;
282
+ return {
283
+ module : WebGPU . mgrShaderModule . get (
284
+ { { { gpu . makeGetU32 ( 'ptr' , C_STRUCTS . DawnPipelineStageDescriptor . module ) } } } ) ,
285
+ entryPoint : UTF8ToString (
286
+ { { { makeGetValue ( 'ptr' , C_STRUCTS . DawnPipelineStageDescriptor . entryPoint , '*' ) } } } ) ,
287
+ } ;
288
+ }
289
+
226
290
function makeRasterizationState ( rsPtr ) {
227
- if ( rsPtr === null ) return null ;
291
+ if ( rsPtr === 0 ) return undefined ;
228
292
{ { { gpu . makeCheckDescriptor ( 'rsPtr' ) } } }
229
293
return {
230
294
frontFace : WebGPU . FrontFace [
@@ -235,6 +299,7 @@ var LibraryWebGPU = {
235
299
}
236
300
237
301
function makeBlendDescriptor ( bdPtr ) {
302
+ if ( bdPtr === 0 ) return undefined ;
238
303
{ { { gpu . makeCheck ( 'bdPtr !== 0' ) } } }
239
304
return {
240
305
operation : WebGPU . BlendOperation [
@@ -285,6 +350,8 @@ var LibraryWebGPU = {
285
350
}
286
351
287
352
function makeDepthStencilState ( dssPtr ) {
353
+ if ( dssPtr === 0 ) return undefined ;
354
+
288
355
{ { { gpu . makeCheck ( 'dssPtr !== 0' ) } } }
289
356
return {
290
357
format : WebGPU . TextureFormat [
@@ -345,6 +412,7 @@ var LibraryWebGPU = {
345
412
}
346
413
347
414
function makeVertexInput ( viPtr ) {
415
+ if ( viPtr === 0 ) return undefined ;
348
416
{ { { gpu . makeCheckDescriptor ( 'viPtr' ) } } }
349
417
return {
350
418
indexFormat : WebGPU . IndexFormat [
@@ -358,8 +426,10 @@ var LibraryWebGPU = {
358
426
var desc = {
359
427
layout : WebGPU . mgrPipelineLayout . get (
360
428
{ { { makeGetValue ( 'descriptor' , C_STRUCTS . DawnRenderPipelineDescriptor . layout , '*' ) } } } ) ,
361
- vertexStage : null ,
362
- fragmentStage : null ,
429
+ vertexStage : makeStage (
430
+ descriptor + { { { C_STRUCTS . DawnRenderPipelineDescriptor . vertexStage } } } ) ,
431
+ fragmentStage : makeStage (
432
+ { { { makeGetValue ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . fragmentStage , '* ') } } } ) ,
363
433
primitiveTopology : WebGPU . PrimitiveTopology [
364
434
{ { { gpu . makeGetU32 ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . primitiveTopology ) } } } ] ,
365
435
rasterizationState : makeRasterizationState (
@@ -373,18 +443,19 @@ var LibraryWebGPU = {
373
443
{ { { makeGetValue ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . vertexInput , '* ') } } } ) ,
374
444
sampleCount : { { { gpu . makeGetU32 ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . sampleCount ) } } } ,
375
445
sampleMask : { { { gpu . makeGetU32 ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . sampleMask ) } } } ,
376
- alphaToCoverageEnabled : { { { gpu . makeGetBool ( 'descriptor ', C_STRUCTS . DawnRenderPipelineDescriptor . alphaToCoverageEnabled ) } } } ,
446
+ // TODO(kainino0x): Turn this on when it doesn't throw an error in Chrome.
447
+ //alphaToCoverageEnabled: {{{ gpu.makeGetBool('descriptor', C_STRUCTS.DawnRenderPipelineDescriptor.alphaToCoverageEnabled) }}},
377
448
} ;
378
449
379
450
var device = WebGPU . mgrDevice . get ( deviceId ) ;
380
451
return WebGPU . mgrRenderPipeline . create ( device . createRenderPipeline ( desc ) ) ;
381
452
} ,
382
453
383
- dawnDeviceCreateShaderModule : function ( descriptor ) {
454
+ dawnDeviceCreateShaderModule : function ( deviceId , descriptor ) {
384
455
{ { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
385
456
var count = { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnShaderModuleDescriptor . codeSize) } } } ;
386
457
var start = { { { makeGetValue ( 'descriptor' , C_STRUCTS . DawnShaderModuleDescriptor . code , '*' ) } } } ;
387
- var desc = { code : HEAP32 . subarray ( start , start + count ) } ;
458
+ var desc = { code : HEAPU32 . subarray ( start >> 2 , ( start >> 2 ) + count ) } ;
388
459
389
460
var device = WebGPU . mgrDevice . get ( deviceId ) ;
390
461
return WebGPU . mgrShaderModule . create ( device . createShaderModule ( desc ) ) ;
@@ -418,12 +489,12 @@ var LibraryWebGPU = {
418
489
419
490
// dawnCommandEncoder
420
491
421
- dawnCommandEncoderFinish : function ( commandEncoderId ) {
422
- var commandEncoder = WebGPU . mgrCommandEncoder . get ( commandEncoderId ) ;
492
+ dawnCommandEncoderFinish : function ( encoderId ) {
493
+ var commandEncoder = WebGPU . mgrCommandEncoder . get ( encoderId ) ;
423
494
return WebGPU . mgrCommandBuffer . create ( commandEncoder . finish ( ) ) ;
424
495
} ,
425
496
426
- dawnCommandEncoderBeginRenderPass : function ( commandEncoderId , descriptor ) {
497
+ dawnCommandEncoderBeginRenderPass : function ( encoderId , descriptor ) {
427
498
{ { { gpu . makeCheck ( 'descriptor !== 0' ) } } }
428
499
429
500
function makeColorAttachment ( caPtr ) {
@@ -436,7 +507,7 @@ var LibraryWebGPU = {
436
507
{ { { gpu . makeGetU32 ( 'caPtr' , C_STRUCTS . DawnRenderPassColorAttachmentDescriptor . loadOp ) } } } ] ,
437
508
storeOp : WebGPU . StoreOp [
438
509
{ { { gpu . makeGetU32 ( 'caPtr' , C_STRUCTS . DawnRenderPassColorAttachmentDescriptor . storeOp ) } } } ] ,
439
- clearColor : WebGPU . getColor ( caPtr + { { { C_STRUCTS . DawnRenderPassColorAttachmentDescriptor . clearColor } } } ) ,
510
+ loadValue : WebGPU . makeColor ( caPtr + { { { C_STRUCTS . DawnRenderPassColorAttachmentDescriptor . clearColor } } } ) ,
440
511
} ;
441
512
}
442
513
@@ -479,12 +550,12 @@ var LibraryWebGPU = {
479
550
} ;
480
551
}
481
552
482
- var commandEncoder = WebGPU . mgrCommandEncoder . get ( commandEncoderId ) ;
483
- commandEncoder . beginRenderPass ( makeRenderPassDescriptor ( descriptor ) ) ;
553
+ var commandEncoder = WebGPU . mgrCommandEncoder . get ( encoderId ) ;
554
+ return WebGPU . mgrRenderPassEncoder . create ( commandEncoder . beginRenderPass ( makeRenderPassDescriptor ( descriptor ) ) ) ;
484
555
} ,
485
556
486
- dawnCommandEncoderCopyBufferToBuffer : function ( commandEncoderId , srcId , srcOffset_l , srcOffset_h , dstId , dstOffset_l , dstOffset_h , size_l , size_h ) {
487
- var commandEncoder = WebGPU . mgrCommandEncoder . get ( commandEncoderId ) ;
557
+ dawnCommandEncoderCopyBufferToBuffer : function ( encoderId , srcId , srcOffset_l , srcOffset_h , dstId , dstOffset_l , dstOffset_h , size_l , size_h ) {
558
+ var commandEncoder = WebGPU . mgrCommandEncoder . get ( encoderId ) ;
488
559
var src = WebGPU . mgrBuffer . get ( srcId ) ;
489
560
var dst = WebGPU . mgrBuffer . get ( dstId ) ;
490
561
commandEncoder . copyBufferToBuffer (
@@ -493,8 +564,11 @@ var LibraryWebGPU = {
493
564
{ { { makeU64ToNumber ( 'size_l' , 'size_h' ) } } } ) ;
494
565
} ,
495
566
496
- dawnCommandEncoderCopyTextureToBuffer : function ( ) {
497
- console . warn ( 'dawnCommandEncoderCopyTextureToBuffer: unimplemented' ) ;
567
+ dawnCommandEncoderCopyTextureToBuffer : function ( encoderId , srcPtr , dstPtr , copySizePtr ) {
568
+ var commandEncoder = WebGPU . mgrCommandEncoder . get ( encoderId ) ;
569
+ var copySize = WebGPU . makeExtent3D ( copySizePtr ) ;
570
+ commandEncoder . copyTextureToBuffer (
571
+ WebGPU . makeTextureCopyView ( srcPtr ) , WebGPU . makeBufferCopyView ( dstPtr ) , copySize ) ;
498
572
} ,
499
573
500
574
// dawnBuffer
@@ -560,20 +634,43 @@ var LibraryWebGPU = {
560
634
561
635
// dawnTexture
562
636
563
- dawnTextureCreateView : function ( ) {
564
- console . warn ( 'dawnTextureCreateView: unimplemented' ) ;
637
+ dawnTextureCreateView : function ( textureId , descriptor ) {
638
+ var desc ;
639
+ if ( descriptor !== 0 ) {
640
+ { { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
641
+
642
+ desc = {
643
+ format : WebGPU . TextureFormat [
644
+ { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . format ) } } } ] ,
645
+ dimension : WebGPU . TextureViewDimension [
646
+ { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . dimension ) } } } ] ,
647
+ baseMipLevel : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . baseMipLevel ) } } } ,
648
+ mipLevelCount : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . mipLevelCount ) } } } ,
649
+ baseArrayLayer : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . baseArrayLayer ) } } } ,
650
+ arrayLayerCount : { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . arrayLayerCount ) } } } ,
651
+ aspect : WebGPU . TextureAspect [
652
+ { { { gpu . makeGetU32 ( 'descriptor' , C_STRUCTS . DawnTextureViewDescriptor . aspect ) } } } ] ,
653
+ } ;
654
+ }
655
+
656
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
657
+ return WebGPU . mgrTextureView . create ( texture . createView ( desc ) ) ;
565
658
} ,
566
659
567
660
// dawnRenderPass
568
661
569
- dawnRenderPassEncoderSetPipeline : function ( ) {
570
- console . warn ( 'dawnRenderPassEncoderSetPipeline: unimplemented' ) ;
662
+ dawnRenderPassEncoderSetPipeline : function ( passId , pipelineId ) {
663
+ var pass = WebGPU . mgrRenderPassEncoder . get ( passId ) ;
664
+ var pipeline = WebGPU . mgrRenderPipeline . get ( pipelineId ) ;
665
+ pass . setPipeline ( pipeline ) ;
571
666
} ,
572
- dawnRenderPassEncoderDraw : function ( ) {
573
- console . warn ( 'dawnRenderPassEncoderDraw: unimplemented' ) ;
667
+ dawnRenderPassEncoderDraw : function ( passId , vertexCount , instanceCount , firstVertex , firstInstance ) {
668
+ var pass = WebGPU . mgrRenderPassEncoder . get ( passId ) ;
669
+ pass . draw ( vertexCount , instanceCount , firstVertex , firstInstance ) ;
574
670
} ,
575
- dawnRenderPassEncoderEndPass : function ( ) {
576
- console . warn ( 'dawnRenderPassEncoderEndPass: unimplemented' ) ;
671
+ dawnRenderPassEncoderEndPass : function ( passId ) {
672
+ var pass = WebGPU . mgrRenderPassEncoder . get ( passId ) ;
673
+ pass . endPass ( ) ;
577
674
} ,
578
675
} ;
579
676
0 commit comments