@@ -418,13 +418,13 @@ class WebGPUNodeBuilder extends NodeBuilder {
418418
419419 const snippets = [ ] ;
420420
421- if ( shaderStage === 'vertex' || shaderStage === ' compute' ) {
421+ if ( shaderStage === 'compute' ) {
422422
423- if ( shaderStage === 'compute' ) {
423+ this . getBuiltin ( 'global_invocation_id' , 'id' , 'vec3<u32>' , 'attribute' ) ;
424424
425- this . getBuiltin ( 'global_invocation_id' , 'id' , 'vec3<u32>' , 'attribute' ) ;
425+ }
426426
427- }
427+ if ( shaderStage === 'vertex' || shaderStage === 'compute' ) {
428428
429429 for ( const { name, property, type } of this . builtins . attribute . values ( ) ) {
430430
@@ -477,26 +477,9 @@ class WebGPUNodeBuilder extends NodeBuilder {
477477
478478 this . getBuiltin ( 'position' , 'Vertex' , 'vec4<f32>' , 'vertex' ) ;
479479
480- const varyings = this . varyings ;
481- const vars = this . vars [ shaderStage ] ;
482-
483- for ( let index = 0 ; index < varyings . length ; index ++ ) {
484-
485- const varying = varyings [ index ] ;
486-
487- if ( varying . needsInterpolation ) {
488-
489- snippets . push ( `@location( ${ index } ) ${ varying . name } : ${ this . getType ( varying . type ) } ` ) ;
490-
491- } else if ( vars . includes ( varying ) === false ) {
492-
493- vars . push ( varying ) ;
494-
495- }
496-
497- }
480+ }
498481
499- } else if ( shaderStage === 'fragment' ) {
482+ if ( shaderStage === 'vertex' || shaderStage === 'fragment' ) {
500483
501484 const varyings = this . varyings ;
502485 const vars = this . vars [ shaderStage ] ;
@@ -543,7 +526,7 @@ class WebGPUNodeBuilder extends NodeBuilder {
543526
544527 for ( const uniform of uniforms ) {
545528
546- if ( uniform . type === 'texture' ) {
529+ if ( uniform . type === 'texture' || uniform . type === 'cubeTexture' ) {
547530
548531 if ( shaderStage === 'fragment' ) {
549532
@@ -553,25 +536,23 @@ class WebGPUNodeBuilder extends NodeBuilder {
553536
554537 const texture = uniform . node . value ;
555538
556- if ( texture . isVideoTexture === true ) {
557-
558- bindingSnippets . push ( `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : texture_external;` ) ;
539+ let textureType ;
559540
560- } else {
541+ if ( texture . isCubeTexture === true ) {
561542
562- bindingSnippets . push ( `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : texture_2d <f32>;` ) ;
543+ textureType = 'texture_cube <f32>' ;
563544
564- }
545+ } else if ( texture . isVideoTexture === true ) {
565546
566- } else if ( uniform . type === 'cubeTexture' ) {
547+ textureType = 'texture_external' ;
567548
568- if ( shaderStage === 'fragment' ) {
549+ } else {
569550
570- bindingSnippets . push ( `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } _sampler : sampler;` ) ;
551+ textureType = 'texture_2d<f32>' ;
571552
572553 }
573554
574- bindingSnippets . push ( `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : texture_cube<f32> ;` ) ;
555+ bindingSnippets . push ( `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : ${ textureType } ;` ) ;
575556
576557 } else if ( uniform . type === 'buffer' || uniform . type === 'storageBuffer' ) {
577558
0 commit comments