@@ -73,9 +73,13 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
7373 }
7474
7575 initDeviceCaps ( ) {
76- this . precision = 'hiphp' ;
76+ this . precision = 'highp' ;
77+ this . maxPrecision = 'highp' ;
7778 this . maxSamples = 4 ;
7879 this . maxTextures = 16 ;
80+ this . maxTextureSize = 4096 ;
81+ this . maxCubeMapSize = 4096 ;
82+ this . maxVolumeSize = 2048 ;
7983 this . maxPixelRatio = 1 ;
8084 this . supportsInstancing = true ;
8185 this . supportsUniformBuffers = true ;
@@ -88,7 +92,6 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
8892 this . extTextureHalfFloat = true ;
8993 this . textureHalfFloatRenderable = true ;
9094 this . textureHalfFloatUpdatable = true ;
91- this . maxTextureSize = 4096 ;
9295 this . boneLimit = 1024 ;
9396 this . supportsImageBitmap = true ;
9497 this . extStandardDerivatives = true ;
@@ -236,34 +239,36 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
236239
237240 draw ( primitive , numInstances = 1 , keepBuffers ) {
238241
239- const passEncoder = this . passEncoder ;
240-
241- // vertex buffers
242- const vb0 = this . vertexBuffers [ 0 ] ;
243- const vbSlot = this . submitVertexBuffer ( vb0 , 0 ) ;
244- const vb1 = this . vertexBuffers [ 1 ] ;
245- if ( vb1 ) {
246- this . submitVertexBuffer ( vb1 , vbSlot ) ;
247- }
248- this . vertexBuffers . length = 0 ;
249-
250- // render pipeline
251- const pipeline = this . renderPipeline . get ( primitive , vb0 . format , vb1 ?. format , this . shader , this . renderTarget ,
252- this . bindGroupFormats , this . renderState ) ;
253- Debug . assert ( pipeline ) ;
254-
255- if ( this . pipeline !== pipeline ) {
256- this . pipeline = pipeline ;
257- passEncoder . setPipeline ( pipeline ) ;
258- }
259-
260- // draw
261- const ib = this . indexBuffer ;
262- if ( ib ) {
263- passEncoder . setIndexBuffer ( ib . impl . buffer , ib . impl . format ) ;
264- passEncoder . drawIndexed ( ib . numIndices , numInstances , 0 , 0 , 0 ) ;
265- } else {
266- passEncoder . draw ( vb0 . numVertices , numInstances , 0 , 0 ) ;
242+ if ( this . shader . ready ) {
243+ const passEncoder = this . passEncoder ;
244+
245+ // vertex buffers
246+ const vb0 = this . vertexBuffers [ 0 ] ;
247+ const vbSlot = this . submitVertexBuffer ( vb0 , 0 ) ;
248+ const vb1 = this . vertexBuffers [ 1 ] ;
249+ if ( vb1 ) {
250+ this . submitVertexBuffer ( vb1 , vbSlot ) ;
251+ }
252+ this . vertexBuffers . length = 0 ;
253+
254+ // render pipeline
255+ const pipeline = this . renderPipeline . get ( primitive , vb0 . format , vb1 ?. format , this . shader , this . renderTarget ,
256+ this . bindGroupFormats , this . renderState ) ;
257+ Debug . assert ( pipeline ) ;
258+
259+ if ( this . pipeline !== pipeline ) {
260+ this . pipeline = pipeline ;
261+ passEncoder . setPipeline ( pipeline ) ;
262+ }
263+
264+ // draw
265+ const ib = this . indexBuffer ;
266+ if ( ib ) {
267+ passEncoder . setIndexBuffer ( ib . impl . buffer , ib . impl . format ) ;
268+ passEncoder . drawIndexed ( ib . numIndices , numInstances , 0 , 0 , 0 ) ;
269+ } else {
270+ passEncoder . draw ( vb0 . numVertices , numInstances , 0 , 0 ) ;
271+ }
267272 }
268273 }
269274
@@ -343,12 +348,14 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
343348
344349 // create a new encoder for each pass to keep the GPU busy with commands
345350 this . commandEncoder = this . wgpu . createCommandEncoder ( ) ;
351+ DebugHelper . setLabel ( this . commandEncoder , renderPass . name ) ;
346352
347353 // clear cached encoder state
348354 this . pipeline = null ;
349355
350356 // start the pass
351357 this . passEncoder = this . commandEncoder . beginRenderPass ( wrt . renderPassDescriptor ) ;
358+ DebugHelper . setLabel ( this . passEncoder , renderPass . name ) ;
352359 }
353360
354361 /**
0 commit comments