-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Backend-agnostic GPGPU on Nodes #25273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
2b056f8
0a182f1
fdd2250
c86b396
6f0fbce
0a69697
cbf104b
bd312e7
19d896d
5871996
b489298
96be961
7d9e040
ddf51c7
4ca19cf
a73ba79
39fed20
e2db2e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import TempNode from './TempNode.js'; | ||
|
|
||
| class AssignNode extends TempNode { | ||
LeviPesin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| constructor( aNode, bNode ) { | ||
|
|
||
| super(); | ||
|
|
||
| this.aNode = aNode; | ||
| this.bNode = bNode; | ||
|
|
||
| } | ||
|
|
||
| hasDependencies( builder ) { | ||
|
|
||
| return false; | ||
|
|
||
| } | ||
|
|
||
| getNodeType( builder, output ) { | ||
|
|
||
| const aNode = this.aNode; | ||
| const bNode = this.bNode; | ||
|
|
||
| const typeA = aNode.getNodeType( builder ); | ||
| const typeB = bNode.getNodeType( builder ); | ||
|
|
||
| if ( typeA === 'void' || typeB === 'void' ) { | ||
|
|
||
| return 'void'; | ||
|
|
||
| } else { | ||
|
|
||
| return typeA; | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| generate( builder, output ) { | ||
|
|
||
| const aNode = this.aNode; | ||
| const type = this.getNodeType( builder, output ); | ||
| const a = aNode.build( builder, type ); | ||
|
|
||
| if ( aNode.isBufferNode === true || aNode.node.isBufferNode === true ) { | ||
|
|
||
| const nodeData = builder.getDataFromNode( aNode.isBufferNode ? aNode : aNode.node, builder.getShaderStage() ); | ||
| const buffer = nodeData.uniformBuffer; | ||
| if ( buffer !== undefined ) { | ||
|
|
||
| builder.outComputeBuffer = buffer; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should be able to support multiples buffers in WebGL too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There could be only one output buffer (implemented as a render target). There can be multiple source buffers simultaneously.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Or maybe just change |
||
| return buffer.setElement( this.bNode ).build( builder ); | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| const bNode = this.bNode; | ||
| const b = bNode.build( builder, type ); | ||
|
|
||
| if ( output !== 'void' ) { | ||
|
|
||
| builder.addFlowCode( `${a} = ${b}` ); | ||
|
|
||
| return a; | ||
|
|
||
| } else if ( type !== 'void' ) { | ||
|
|
||
| return builder.format( `${a} = ${b}`, type, output ); | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| export default AssignNode; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure why...