-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix storage buffer example with workgroupBarrier()
- Loading branch information
1 parent
c799910
commit a8eb792
Showing
4 changed files
with
46 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
import { expression } from '../code/ExpressionNode'; | ||
import Node, { registerNodeClass } from '../core/Node.js'; | ||
import { nodeProxy } from '../tsl/TSLCore.js'; | ||
|
||
class BarrierNode extends Node { | ||
|
||
constructor( scope ) { | ||
|
||
super(); | ||
|
||
this.scope = scope; | ||
|
||
} | ||
|
||
generate( builder ) { | ||
|
||
const { scope } = this; | ||
const { renderer } = builder; | ||
|
||
if ( renderer.backend.isWebGLBackend === true ) { | ||
|
||
builder.addFlowCode( `\t// ${scope}Barrier \n` ); | ||
|
||
} else { | ||
|
||
builder.addLineFlowCode( `${scope}Barrier()` ); | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
export default BarrierNode; | ||
|
||
registerNodeClass( 'Barrier', BarrierNode ); | ||
|
||
export const barrier = nodeProxy( BarrierNode ); | ||
|
||
export const workgroupBarrier = () => barrier( 'workgroup' ).append(); | ||
|
||
export const workgroupBarrier = () => expression( 'workgroupBarrier();' ).append(); | ||
export const storageBarrier = () => expression( 'storageBarrier();' ).append(); | ||
export const textureBarrier = () => expression( 'textureBarrier();' ).append(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters