WGSLNodeBuilder.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  1. import UniformsGroup from '../../common/UniformsGroup.js';
  2. import {
  3. FloatNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
  4. ColorNodeUniform, Matrix3NodeUniform, Matrix4NodeUniform
  5. } from '../../common/nodes/NodeUniform.js';
  6. import NodeSampler from '../../common/nodes/NodeSampler.js';
  7. import { NodeSampledTexture, NodeSampledCubeTexture } from '../../common/nodes/NodeSampledTexture.js';
  8. import UniformBuffer from '../../common/UniformBuffer.js';
  9. import StorageBuffer from '../../common/StorageBuffer.js';
  10. import { getVectorLength, getStrideLength } from '../../common/BufferUtils.js';
  11. import RenderTarget from '../../common/RenderTarget.js';
  12. import { NodeBuilder, CodeNode, NodeMaterial } from '../../../nodes/Nodes.js';
  13. import WGSLNodeParser from './WGSLNodeParser.js';
  14. /*
  15. const gpuShaderStageLib = {
  16. 'vertex': GPUShaderStage.VERTEX,
  17. 'fragment': GPUShaderStage.FRAGMENT,
  18. 'compute': GPUShaderStage.COMPUTE
  19. };
  20. */
  21. const supports = {
  22. instance: true
  23. };
  24. const wgslTypeLib = {
  25. float: 'f32',
  26. int: 'i32',
  27. uint: 'u32',
  28. bool: 'bool',
  29. color: 'vec3<f32>',
  30. vec2: 'vec2<f32>',
  31. ivec2: 'vec2<i32>',
  32. uvec2: 'vec2<u32>',
  33. bvec2: 'vec2<bool>',
  34. vec3: 'vec3<f32>',
  35. ivec3: 'vec3<i32>',
  36. uvec3: 'vec3<u32>',
  37. bvec3: 'vec3<bool>',
  38. vec4: 'vec4<f32>',
  39. ivec4: 'vec4<i32>',
  40. uvec4: 'vec4<u32>',
  41. bvec4: 'vec4<bool>',
  42. mat3: 'mat3x3<f32>',
  43. imat3: 'mat3x3<i32>',
  44. umat3: 'mat3x3<u32>',
  45. bmat3: 'mat3x3<bool>',
  46. mat4: 'mat4x4<f32>',
  47. imat4: 'mat4x4<i32>',
  48. umat4: 'mat4x4<u32>',
  49. bmat4: 'mat4x4<bool>'
  50. };
  51. const wgslMethods = {
  52. dFdx: 'dpdx',
  53. dFdy: 'dpdy',
  54. mod: 'threejs_mod',
  55. lessThanEqual: 'threejs_lessThanEqual',
  56. inversesqrt: 'inverseSqrt'
  57. };
  58. const wgslPolyfill = {
  59. lessThanEqual: new CodeNode( `
  60. fn threejs_lessThanEqual( a : vec3<f32>, b : vec3<f32> ) -> vec3<bool> {
  61. return vec3<bool>( a.x <= b.x, a.y <= b.y, a.z <= b.z );
  62. }
  63. ` ),
  64. mod: new CodeNode( `
  65. fn threejs_mod( x : f32, y : f32 ) -> f32 {
  66. return x - y * floor( x / y );
  67. }
  68. ` ),
  69. repeatWrapping: new CodeNode( `
  70. fn threejs_repeatWrapping( uv : vec2<f32>, dimension : vec2<u32> ) -> vec2<u32> {
  71. let uvScaled = vec2<u32>( uv * vec2<f32>( dimension ) );
  72. return ( ( uvScaled % dimension ) + dimension ) % dimension;
  73. }
  74. ` )
  75. };
  76. class WebGPUNodeBuilder extends NodeBuilder {
  77. constructor( object, renderer ) {
  78. super( object, renderer, new WGSLNodeParser() );
  79. this.uniformsGroup = {};
  80. this.builtins = {
  81. vertex: new Map(),
  82. fragment: new Map(),
  83. compute: new Map(),
  84. attribute: new Map()
  85. };
  86. }
  87. build() {
  88. const { object, material } = this;
  89. if ( material !== null ) {
  90. NodeMaterial.fromMaterial( material ).build( this );
  91. } else {
  92. this.addFlow( 'compute', object );
  93. }
  94. return super.build();
  95. }
  96. getSampler( textureProperty, uvSnippet, shaderStage = this.shaderStage ) {
  97. if ( shaderStage === 'fragment' ) {
  98. return `textureSample( ${textureProperty}, ${textureProperty}_sampler, ${uvSnippet} )`;
  99. } else {
  100. this._include( 'repeatWrapping' );
  101. const dimension = `textureDimensions( ${textureProperty}, 0 )`;
  102. return `textureLoad( ${textureProperty}, threejs_repeatWrapping( ${uvSnippet}, ${dimension} ), 0 )`;
  103. }
  104. }
  105. getVideoSampler( textureProperty, uvSnippet, shaderStage = this.shaderStage ) {
  106. if ( shaderStage === 'fragment' ) {
  107. return `textureSampleBaseClampToEdge( ${textureProperty}, ${textureProperty}_sampler, vec2<f32>( ${uvSnippet}.x, 1.0 - ${uvSnippet}.y ) )`;
  108. } else {
  109. console.error( `WebGPURenderer: THREE.VideoTexture does not support ${ shaderStage } shader.` );
  110. }
  111. }
  112. getSamplerLevel( textureProperty, uvSnippet, biasSnippet, shaderStage = this.shaderStage ) {
  113. if ( shaderStage === 'fragment' ) {
  114. return `textureSampleLevel( ${textureProperty}, ${textureProperty}_sampler, ${uvSnippet}, ${biasSnippet} )`;
  115. } else {
  116. this._include( 'repeatWrapping' );
  117. const dimension = `textureDimensions( ${textureProperty}, 0 )`;
  118. return `textureLoad( ${textureProperty}, threejs_repeatWrapping( ${uvSnippet}, ${dimension} ), i32( ${biasSnippet} ) )`;
  119. }
  120. }
  121. getTexture( texture, textureProperty, uvSnippet, shaderStage = this.shaderStage ) {
  122. let snippet = null;
  123. if ( texture.isVideoTexture === true ) {
  124. snippet = this.getVideoSampler( textureProperty, uvSnippet, shaderStage );
  125. } else {
  126. snippet = this.getSampler( textureProperty, uvSnippet, shaderStage );
  127. }
  128. return snippet;
  129. }
  130. getTextureLevel( texture, textureProperty, uvSnippet, biasSnippet, shaderStage = this.shaderStage ) {
  131. let snippet = null;
  132. if ( texture.isVideoTexture === true ) {
  133. snippet = this.getVideoSampler( textureProperty, uvSnippet, shaderStage );
  134. } else {
  135. snippet = this.getSamplerLevel( textureProperty, uvSnippet, biasSnippet, shaderStage );
  136. }
  137. return snippet;
  138. }
  139. getPropertyName( node, shaderStage = this.shaderStage ) {
  140. if ( node.isNodeVarying === true && node.needsInterpolation === true ) {
  141. if ( shaderStage === 'vertex' ) {
  142. return `NodeVaryings.${ node.name }`;
  143. }
  144. } else if ( node.isNodeUniform === true ) {
  145. const name = node.name;
  146. const type = node.type;
  147. if ( type === 'texture' || type === 'cubeTexture' ) {
  148. return name;
  149. } else if ( type === 'buffer' || type === 'storageBuffer' ) {
  150. return `NodeBuffer_${node.node.id}.${name}`;
  151. } else {
  152. return `NodeUniforms.${name}`;
  153. }
  154. }
  155. return super.getPropertyName( node );
  156. }
  157. getUniformFromNode( node, type, shaderStage ) {
  158. const uniformNode = super.getUniformFromNode( node, type, shaderStage );
  159. const nodeData = this.getDataFromNode( node, shaderStage );
  160. if ( nodeData.uniformGPU === undefined ) {
  161. let uniformGPU;
  162. const bindings = this.bindings[ shaderStage ];
  163. if ( type === 'texture' || type === 'cubeTexture' ) {
  164. const sampler = new NodeSampler( `${uniformNode.name}_sampler`, uniformNode.node );
  165. let texture = null;
  166. if ( type === 'texture' ) {
  167. texture = new NodeSampledTexture( uniformNode.name, uniformNode.node );
  168. } else if ( type === 'cubeTexture' ) {
  169. texture = new NodeSampledCubeTexture( uniformNode.name, uniformNode.node );
  170. }
  171. // add first textures in sequence and group for last
  172. const lastBinding = bindings[ bindings.length - 1 ];
  173. const index = lastBinding && lastBinding.isUniformsGroup ? bindings.length - 1 : bindings.length;
  174. if ( shaderStage === 'fragment' ) {
  175. bindings.splice( index, 0, sampler, texture );
  176. uniformGPU = [ sampler, texture ];
  177. } else {
  178. bindings.splice( index, 0, texture );
  179. uniformGPU = [ texture ];
  180. }
  181. } else if ( type === 'buffer' || type === 'storageBuffer' ) {
  182. const bufferClass = type === 'storageBuffer' ? StorageBuffer : UniformBuffer;
  183. const buffer = new bufferClass( 'NodeBuffer_' + node.id, node.value );
  184. //buffer.setVisibility( gpuShaderStageLib[ shaderStage ] );
  185. // add first textures in sequence and group for last
  186. const lastBinding = bindings[ bindings.length - 1 ];
  187. const index = lastBinding && lastBinding.isUniformsGroup ? bindings.length - 1 : bindings.length;
  188. bindings.splice( index, 0, buffer );
  189. uniformGPU = buffer;
  190. } else {
  191. let uniformsGroup = this.uniformsGroup[ shaderStage ];
  192. if ( uniformsGroup === undefined ) {
  193. uniformsGroup = new UniformsGroup( 'nodeUniforms' );
  194. //uniformsGroup.setVisibility( gpuShaderStageLib[ shaderStage ] );
  195. this.uniformsGroup[ shaderStage ] = uniformsGroup;
  196. bindings.push( uniformsGroup );
  197. }
  198. if ( node.isArrayUniformNode === true ) {
  199. uniformGPU = [];
  200. for ( const uniformNode of node.nodes ) {
  201. const uniformNodeGPU = this._getNodeUniform( uniformNode, type );
  202. // fit bounds to buffer
  203. uniformNodeGPU.boundary = getVectorLength( uniformNodeGPU.itemSize );
  204. uniformNodeGPU.itemSize = getStrideLength( uniformNodeGPU.itemSize );
  205. uniformsGroup.addUniform( uniformNodeGPU );
  206. uniformGPU.push( uniformNodeGPU );
  207. }
  208. } else {
  209. uniformGPU = this._getNodeUniform( uniformNode, type );
  210. uniformsGroup.addUniform( uniformGPU );
  211. }
  212. }
  213. nodeData.uniformGPU = uniformGPU;
  214. if ( shaderStage === 'vertex' ) {
  215. this.bindingsOffset[ 'fragment' ] = bindings.length;
  216. }
  217. }
  218. return uniformNode;
  219. }
  220. isReference( type ) {
  221. return super.isReference( type ) || type === 'texture_2d' || type === 'texture_cube';
  222. }
  223. getBuiltin( name, property, type, shaderStage = this.shaderStage ) {
  224. const map = this.builtins[ shaderStage ];
  225. if ( map.has( name ) === false ) {
  226. map.set( name, {
  227. name,
  228. property,
  229. type
  230. } );
  231. }
  232. return property;
  233. }
  234. getInstanceIndex() {
  235. if ( this.shaderStage === 'vertex' ) {
  236. return this.getBuiltin( 'instance_index', 'instanceIndex', 'u32', 'attribute' );
  237. }
  238. return 'instanceIndex';
  239. }
  240. getFrontFacing() {
  241. return this.getBuiltin( 'front_facing', 'isFront', 'bool' );
  242. }
  243. getFragCoord() {
  244. return this.getBuiltin( 'position', 'fragCoord', 'vec4<f32>', 'fragment' );
  245. }
  246. isFlipY() {
  247. return false;
  248. }
  249. getAttributes( shaderStage ) {
  250. const snippets = [];
  251. if ( shaderStage === 'compute' ) {
  252. this.getBuiltin( 'global_invocation_id', 'id', 'vec3<u32>', 'attribute' );
  253. }
  254. if ( shaderStage === 'vertex' || shaderStage === 'compute' ) {
  255. for ( const { name, property, type } of this.builtins.attribute.values() ) {
  256. snippets.push( `@builtin( ${name} ) ${property} : ${type}` );
  257. }
  258. const attributes = this.getAttributesArray();
  259. for ( let index = 0, length = attributes.length; index < length; index ++ ) {
  260. const attribute = attributes[ index ];
  261. const name = attribute.name;
  262. const type = this.getType( attribute.type );
  263. snippets.push( `@location( ${index} ) ${ name } : ${ type }` );
  264. }
  265. }
  266. return snippets.join( ',\n\t' );
  267. }
  268. getVar( type, name ) {
  269. return `var ${ name } : ${ this.getType( type ) }`;
  270. }
  271. getVars( shaderStage ) {
  272. const snippets = [];
  273. const vars = this.vars[ shaderStage ];
  274. for ( const variable of vars ) {
  275. snippets.push( `\t${ this.getVar( variable.type, variable.name ) };` );
  276. }
  277. return `\n${ snippets.join( '\n' ) }\n`;
  278. }
  279. getVaryings( shaderStage ) {
  280. const snippets = [];
  281. if ( shaderStage === 'vertex' ) {
  282. this.getBuiltin( 'position', 'Vertex', 'vec4<f32>', 'vertex' );
  283. }
  284. if ( shaderStage === 'vertex' || shaderStage === 'fragment' ) {
  285. const varyings = this.varyings;
  286. const vars = this.vars[ shaderStage ];
  287. for ( let index = 0; index < varyings.length; index ++ ) {
  288. const varying = varyings[ index ];
  289. if ( varying.needsInterpolation ) {
  290. let attributesSnippet = `@location( ${index} )`;
  291. if ( varying.type === 'int' || varying.type === 'uint' ) {
  292. attributesSnippet += ' @interpolate( flat )';
  293. }
  294. snippets.push( `${ attributesSnippet } ${ varying.name } : ${ this.getType( varying.type ) }` );
  295. } else if ( vars.includes( varying ) === false ) {
  296. vars.push( varying );
  297. }
  298. }
  299. }
  300. for ( const { name, property, type } of this.builtins[ shaderStage ].values() ) {
  301. snippets.push( `@builtin( ${name} ) ${property} : ${type}` );
  302. }
  303. const code = snippets.join( ',\n\t' );
  304. return shaderStage === 'vertex' ? this._getWGSLStruct( 'NodeVaryingsStruct', '\t' + code ) : code;
  305. }
  306. getUniforms( shaderStage ) {
  307. const uniforms = this.uniforms[ shaderStage ];
  308. const bindingSnippets = [];
  309. const bufferSnippets = [];
  310. const groupSnippets = [];
  311. let index = this.bindingsOffset[ shaderStage ];
  312. for ( const uniform of uniforms ) {
  313. if ( uniform.type === 'texture' || uniform.type === 'cubeTexture' ) {
  314. if ( shaderStage === 'fragment' ) {
  315. bindingSnippets.push( `@group( 0 ) @binding( ${index ++} ) var ${uniform.name}_sampler : sampler;` );
  316. }
  317. const texture = uniform.node.value;
  318. let textureType;
  319. if ( texture.isCubeTexture === true ) {
  320. textureType = 'texture_cube<f32>';
  321. } else if ( texture.isDepthTexture === true ) {
  322. textureType = 'texture_depth_2d';
  323. } else if ( texture.isVideoTexture === true ) {
  324. textureType = 'texture_external';
  325. } else {
  326. textureType = 'texture_2d<f32>';
  327. }
  328. bindingSnippets.push( `@group( 0 ) @binding( ${index ++} ) var ${uniform.name} : ${textureType};` );
  329. } else if ( uniform.type === 'buffer' || uniform.type === 'storageBuffer' ) {
  330. const bufferNode = uniform.node;
  331. const bufferType = this.getType( bufferNode.bufferType );
  332. const bufferCount = bufferNode.bufferCount;
  333. const bufferCountSnippet = bufferCount > 0 ? ', ' + bufferCount : '';
  334. const bufferSnippet = `\t${uniform.name} : array< ${bufferType}${bufferCountSnippet} >\n`;
  335. const bufferAccessMode = bufferNode.isStorageBufferNode ? 'storage,read_write' : 'uniform';
  336. bufferSnippets.push( this._getWGSLStructBinding( 'NodeBuffer_' + bufferNode.id, bufferSnippet, bufferAccessMode, index ++ ) );
  337. } else {
  338. const vectorType = this.getType( this.getVectorType( uniform.type ) );
  339. if ( Array.isArray( uniform.value ) === true ) {
  340. const length = uniform.value.length;
  341. groupSnippets.push( `uniform ${vectorType}[ ${length} ] ${uniform.name}` );
  342. } else {
  343. groupSnippets.push( `\t${uniform.name} : ${ vectorType}` );
  344. }
  345. }
  346. }
  347. let code = bindingSnippets.join( '\n' );
  348. code += bufferSnippets.join( '\n' );
  349. if ( groupSnippets.length > 0 ) {
  350. code += this._getWGSLStructBinding( 'NodeUniforms', groupSnippets.join( ',\n' ), 'uniform', index ++ );
  351. }
  352. return code;
  353. }
  354. buildCode() {
  355. const shadersData = this.material !== null ? { fragment: {}, vertex: {} } : { compute: {} };
  356. for ( const shaderStage in shadersData ) {
  357. let flow = '// code\n\n';
  358. flow += this.flowCode[ shaderStage ];
  359. const flowNodes = this.flowNodes[ shaderStage ];
  360. const mainNode = flowNodes[ flowNodes.length - 1 ];
  361. for ( const node of flowNodes ) {
  362. const flowSlotData = this.getFlowData( node/*, shaderStage*/ );
  363. const slotName = node.name;
  364. if ( slotName ) {
  365. if ( flow.length > 0 ) flow += '\n';
  366. flow += `\t// flow -> ${ slotName }\n\t`;
  367. }
  368. flow += `${ flowSlotData.code }\n\t`;
  369. if ( node === mainNode && shaderStage !== 'compute' ) {
  370. flow += '// result\n\t';
  371. if ( shaderStage === 'vertex' ) {
  372. flow += 'NodeVaryings.Vertex = ';
  373. } else if ( shaderStage === 'fragment' ) {
  374. flow += 'return ';
  375. }
  376. flow += `${ flowSlotData.result };`;
  377. }
  378. }
  379. const stageData = shadersData[ shaderStage ];
  380. stageData.uniforms = this.getUniforms( shaderStage );
  381. stageData.attributes = this.getAttributes( shaderStage );
  382. stageData.varyings = this.getVaryings( shaderStage );
  383. stageData.vars = this.getVars( shaderStage );
  384. stageData.codes = this.getCodes( shaderStage );
  385. stageData.flow = flow;
  386. }
  387. if ( this.material !== null ) {
  388. this.vertexShader = this._getWGSLVertexCode( shadersData.vertex );
  389. this.fragmentShader = this._getWGSLFragmentCode( shadersData.fragment );
  390. } else {
  391. this.computeShader = this._getWGSLComputeCode( shadersData.compute, ( this.object.workgroupSize || [ 64 ] ).join( ', ' ) );
  392. }
  393. }
  394. getRenderTarget( width, height, options ) {
  395. return new RenderTarget( width, height, options );
  396. }
  397. getMethod( method ) {
  398. if ( wgslPolyfill[ method ] !== undefined ) {
  399. this._include( method );
  400. }
  401. return wgslMethods[ method ] || method;
  402. }
  403. getType( type ) {
  404. return wgslTypeLib[ type ] || type;
  405. }
  406. isAvailable( name ) {
  407. return supports[ name ] === true;
  408. }
  409. _include( name ) {
  410. wgslPolyfill[ name ].build( this );
  411. }
  412. _getNodeUniform( uniformNode, type ) {
  413. if ( type === 'float' ) return new FloatNodeUniform( uniformNode );
  414. if ( type === 'vec2' ) return new Vector2NodeUniform( uniformNode );
  415. if ( type === 'vec3' ) return new Vector3NodeUniform( uniformNode );
  416. if ( type === 'vec4' ) return new Vector4NodeUniform( uniformNode );
  417. if ( type === 'color' ) return new ColorNodeUniform( uniformNode );
  418. if ( type === 'mat3' ) return new Matrix3NodeUniform( uniformNode );
  419. if ( type === 'mat4' ) return new Matrix4NodeUniform( uniformNode );
  420. throw new Error( `Uniform "${type}" not declared.` );
  421. }
  422. _getWGSLVertexCode( shaderData ) {
  423. return `${ this.getSignature() }
  424. // uniforms
  425. ${shaderData.uniforms}
  426. // varyings
  427. ${shaderData.varyings}
  428. // codes
  429. ${shaderData.codes}
  430. @vertex
  431. fn main( ${shaderData.attributes} ) -> NodeVaryingsStruct {
  432. // system
  433. var NodeVaryings: NodeVaryingsStruct;
  434. // vars
  435. ${shaderData.vars}
  436. // flow
  437. ${shaderData.flow}
  438. return NodeVaryings;
  439. }
  440. `;
  441. }
  442. _getWGSLFragmentCode( shaderData ) {
  443. return `${ this.getSignature() }
  444. // uniforms
  445. ${shaderData.uniforms}
  446. // codes
  447. ${shaderData.codes}
  448. @fragment
  449. fn main( ${shaderData.varyings} ) -> @location( 0 ) vec4<f32> {
  450. // vars
  451. ${shaderData.vars}
  452. // flow
  453. ${shaderData.flow}
  454. }
  455. `;
  456. }
  457. _getWGSLComputeCode( shaderData, workgroupSize ) {
  458. return `${ this.getSignature() }
  459. // system
  460. var<private> instanceIndex : u32;
  461. // uniforms
  462. ${shaderData.uniforms}
  463. // codes
  464. ${shaderData.codes}
  465. @compute @workgroup_size( ${workgroupSize} )
  466. fn main( ${shaderData.attributes} ) {
  467. // system
  468. instanceIndex = id.x;
  469. // vars
  470. ${shaderData.vars}
  471. // flow
  472. ${shaderData.flow}
  473. }
  474. `;
  475. }
  476. _getWGSLStruct( name, vars ) {
  477. return `
  478. struct ${name} {
  479. ${vars}
  480. };`;
  481. }
  482. _getWGSLStructBinding( name, vars, access, binding = 0, group = 0 ) {
  483. const structName = name + 'Struct';
  484. const structSnippet = this._getWGSLStruct( structName, vars );
  485. return `${structSnippet}
  486. @binding( ${binding} ) @group( ${group} )
  487. var<${access}> ${name} : ${structName};`;
  488. }
  489. }
  490. export default WebGPUNodeBuilder;