@@ -15,7 +15,7 @@ import {
1515 NeverStencilFunc , AlwaysStencilFunc , LessStencilFunc , LessEqualStencilFunc , EqualStencilFunc , GreaterEqualStencilFunc , GreaterStencilFunc , NotEqualStencilFunc
1616} from '../../../constants.js' ;
1717
18- import { error , ReversedDepthFuncs , warn , warnOnce } from '../../../utils.js' ;
18+ import { error , ReversedDepthFuncs , warnOnce } from '../../../utils.js' ;
1919
2020/**
2121 * A WebGPU backend utility module for managing pipelines.
@@ -272,12 +272,6 @@ class WebGPUPipelineUtils {
272272
273273 device . pushErrorScope ( 'validation' ) ;
274274
275- const stages = [
276- { program : vertexProgram , module : vertexModule . module } ,
277- { program : fragmentProgram , module : fragmentModule . module }
278- ] ;
279- const pipelineLabel = pipelineDescriptor . label ;
280-
281275 if ( promises === null ) {
282276
283277 pipelineData . pipeline = device . createRenderPipeline ( pipelineDescriptor ) ;
@@ -288,9 +282,7 @@ class WebGPUPipelineUtils {
288282
289283 pipelineData . error = true ;
290284
291- error ( `WebGPURenderer: Render pipeline creation failed (${ pipelineLabel } ): ${ err . message } ` ) ;
292-
293- this . _reportShaderDiagnostics ( stages , pipelineLabel ) . catch ( ( ) => { } ) ;
285+ error ( err . message ) ;
294286
295287 }
296288
@@ -300,28 +292,19 @@ class WebGPUPipelineUtils {
300292
301293 const p = new Promise ( async ( resolve /*, reject*/ ) => {
302294
303- let asyncError = null ;
304-
305295 try {
306296
307297 pipelineData . pipeline = await device . createRenderPipelineAsync ( pipelineDescriptor ) ;
308298
309- } catch ( err ) {
310-
311- asyncError = err ;
312-
313- }
299+ } catch ( err ) { }
314300
315301 const errorScope = await device . popErrorScope ( ) ;
316302
317- if ( errorScope !== null || asyncError !== null ) {
303+ if ( errorScope !== null ) {
318304
319305 pipelineData . error = true ;
320306
321- const reason = ( errorScope && errorScope . message ) || ( asyncError && asyncError . message ) || 'unknown' ;
322- error ( `WebGPURenderer: Async render pipeline creation failed (${ pipelineLabel } ): ${ reason } ` ) ;
323-
324- await this . _reportShaderDiagnostics ( stages , pipelineLabel ) ;
307+ error ( errorScope . message ) ;
325308
326309 }
327310
@@ -390,107 +373,13 @@ class WebGPUPipelineUtils {
390373
391374 }
392375
393- const computeStage = pipeline . computeProgram ;
394- const pipelineLabel = `computePipeline_${ computeStage . stage } ${ computeStage . name ? `_${ computeStage . name } ` : '' } ` ;
395-
396- device . pushErrorScope ( 'validation' ) ;
397-
398376 pipelineGPU . pipeline = device . createComputePipeline ( {
399- label : pipelineLabel ,
400377 compute : computeProgram ,
401378 layout : device . createPipelineLayout ( {
402379 bindGroupLayouts
403380 } )
404381 } ) ;
405382
406- device . popErrorScope ( ) . then ( ( err ) => {
407-
408- if ( err !== null ) {
409-
410- pipelineGPU . error = true ;
411-
412- error ( `WebGPURenderer: Compute pipeline creation failed (${ pipelineLabel } ): ${ err . message } ` ) ;
413-
414- this . _reportShaderDiagnostics ( [ { program : computeStage , module : computeProgram . module } ] , pipelineLabel ) . catch ( ( ) => { } ) ;
415-
416- }
417-
418- } ) ;
419-
420- }
421-
422- /**
423- * Reads line-accurate diagnostics from shader modules and logs any
424- * errors/warnings/info messages. Called from pipeline creation error paths
425- * to turn opaque validation failures into actionable WGSL feedback.
426- *
427- * @private
428- * @param {Array<{program: ProgrammableStage, module: GPUShaderModule}> } stages - Pairs of program + compiled shader module.
429- * @param {string } pipelineLabel - Label of the owning pipeline, used as log prefix.
430- * @return {Promise<void> }
431- */
432- async _reportShaderDiagnostics ( stages , pipelineLabel ) {
433-
434- for ( const { program, module } of stages ) {
435-
436- if ( ! module || typeof module . getCompilationInfo !== 'function' ) continue ;
437-
438- let info ;
439-
440- try {
441-
442- info = await module . getCompilationInfo ( ) ;
443-
444- } catch ( _ ) {
445-
446- continue ;
447-
448- }
449-
450- if ( ! info || ! info . messages || info . messages . length === 0 ) continue ;
451-
452- const stageName = program ? program . stage : 'shader' ;
453- const sourceLines = program && program . code ? program . code . split ( '\n' ) : null ;
454-
455- for ( const msg of info . messages ) {
456-
457- const location = ( msg . lineNum > 0 )
458- ? ` at line ${ msg . lineNum } ${ msg . linePos > 0 ? `:${ msg . linePos } ` : '' } `
459- : '' ;
460-
461- const header = `WebGPURenderer [${ pipelineLabel } / ${ stageName } ${ msg . type } ]${ location } : ${ msg . message } ` ;
462-
463- let excerpt = '' ;
464- if ( sourceLines && msg . lineNum > 0 ) {
465-
466- const line = sourceLines [ msg . lineNum - 1 ] ;
467- if ( line !== undefined ) {
468-
469- excerpt = `\n ${ line } ` ;
470- if ( msg . linePos > 0 ) {
471-
472- excerpt += `\n ${ ' ' . repeat ( Math . max ( 0 , msg . linePos - 1 ) ) } ^` ;
473-
474- }
475-
476- }
477-
478- }
479-
480- if ( msg . type === 'error' ) {
481-
482- error ( header + excerpt ) ;
483-
484- } else {
485-
486- warn ( header + excerpt ) ;
487-
488- }
489-
490- }
491-
492- }
493-
494383 }
495384
496385 /**
0 commit comments