Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions examples/jsm/nodes/core/OutputStructNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ class OutputStructNode extends Node {

generate( builder, output ) {

const nodeVar = builder.getVarFromNode( this );
nodeVar.isOutputStructVar = true;

const propertyName = builder.getPropertyName( nodeVar );

const propertyName = builder.getOutputName();
const members = this.members;

const structPrefix = propertyName !== '' ? propertyName + '.' : '';
Expand Down
10 changes: 6 additions & 4 deletions examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ class GLSLNodeBuilder extends NodeBuilder {

getPropertyName( node, shaderStage ) {

if ( node.isOutputStructVar ) return '';

return super.getPropertyName( node, shaderStage );

}

getOutputName() {
Comment thread
sunag marked this conversation as resolved.
Outdated

return '';

}

buildFunctionCode( shaderNode ) {

const layout = shaderNode.layout;
Expand Down Expand Up @@ -277,8 +281,6 @@ ${ flowData.code }

for ( const variable of vars ) {

if ( variable.isOutputStructVar ) continue;

snippets.push( `${ this.getVar( variable.type, variable.name ) };` );

}
Expand Down
12 changes: 12 additions & 0 deletions examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ class WGSLNodeBuilder extends NodeBuilder {

}

getOutputName() {

return 'output';

}

_getUniformGroupCount( shaderStage ) {

return Object.keys( this.uniforms[ shaderStage ] ).length;
Expand Down Expand Up @@ -622,6 +628,10 @@ ${ flowData.code }

}

const builtins = this.getBuiltins( 'output' );

if ( builtins ) snippets.push( builtins );

return snippets.join( ',\n' );

}
Expand All @@ -642,6 +652,8 @@ ${ flowData.code }

snippets.push( snippet );

snippets.push( `\nvar<private> output : ${ name };\n\n`);

}

return snippets.join( '\n\n' );
Expand Down