📄 WorkgroupInfoNode.js
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 9 |
🧱 Classes | 2 |
📦 Imports | 3 |
📊 Variables & Constants | 3 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 src/nodes/gpgpu/WorkgroupInfoNode.js
📦 Imports¶
Name | Source |
---|---|
ArrayElementNode |
../utils/ArrayElementNode.js |
nodeObject |
../tsl/TSLCore.js |
Node |
../core/Node.js |
Variables & Constants¶
Name | Type | Kind | Value | Exported |
---|---|---|---|---|
snippet |
any |
let/var | *not shown* |
✗ |
isAssignContext |
any |
let/var | builder.context.assign |
✗ |
name |
string |
let/var | ( this.name !== '' ) ? this.name : ${this.scope}Array_${this.id}`` |
✗ |
Functions¶
WorkgroupInfoElementNode.generate(builder: any, output: any): any
¶
Parameters:
builder
any
output
any
Returns: any
Calls:
super.generate
this.getNodeType
builder.format
Internal Comments:
Code
generate( builder, output ) {
let snippet;
const isAssignContext = builder.context.assign;
snippet = super.generate( builder );
if ( isAssignContext !== true ) {
const type = this.getNodeType( builder );
snippet = builder.format( snippet, type, output );
}
// TODO: Possibly activate clip distance index on index access rather than from clipping context
return snippet;
}
WorkgroupInfoNode.setName(name: string): WorkgroupInfoNode
¶
JSDoc:
/**
* Sets the name of this node.
*
* @param {string} name - The name to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
Parameters:
name
string
Returns: WorkgroupInfoNode
WorkgroupInfoNode.label(name: string): WorkgroupInfoNode
¶
JSDoc:
/**
* Sets the name/label of this node.
*
* @deprecated
* @param {string} name - The name to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
Parameters:
name
string
Returns: WorkgroupInfoNode
Calls:
console.warn
this.setName
Code
WorkgroupInfoNode.setScope(scope: string): WorkgroupInfoNode
¶
JSDoc:
/**
* Sets the scope of this node.
*
* @param {string} scope - The scope to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
Parameters:
scope
string
Returns: WorkgroupInfoNode
WorkgroupInfoNode.getElementType(): string
¶
JSDoc:
Returns: string
WorkgroupInfoNode.getInputType(): string
¶
JSDoc:
/**
* Overwrites the default implementation since the input type
* is inferred from the scope.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {string} The input type.
*/
Returns: string
WorkgroupInfoNode.element(indexNode: IndexNode): WorkgroupInfoElementNode
¶
JSDoc:
/**
* This method can be used to access elements via an index node.
*
* @param {IndexNode} indexNode - indexNode.
* @return {WorkgroupInfoElementNode} A reference to an element.
*/
Parameters:
indexNode
IndexNode
Returns: WorkgroupInfoElementNode
Calls:
nodeObject (from ../tsl/TSLCore.js)
WorkgroupInfoNode.generate(builder: any): any
¶
Parameters:
builder
any
Returns: any
Calls:
builder.getScopedArray
this.scope.toLowerCase
Code
workgroupArray(type: string, count: number): WorkgroupInfoNode
¶
Parameters:
type
string
count
number
Returns: WorkgroupInfoNode
Calls:
nodeObject (from ../tsl/TSLCore.js)
Classes¶
WorkgroupInfoElementNode
¶
Class Code
class WorkgroupInfoElementNode extends ArrayElementNode {
/**
* Constructs a new workgroup info element node.
*
* @param {Node} workgroupInfoNode - The workgroup info node.
* @param {Node} indexNode - The index node that defines the element access.
*/
constructor( workgroupInfoNode, indexNode ) {
super( workgroupInfoNode, indexNode );
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isWorkgroupInfoElementNode = true;
}
generate( builder, output ) {
let snippet;
const isAssignContext = builder.context.assign;
snippet = super.generate( builder );
if ( isAssignContext !== true ) {
const type = this.getNodeType( builder );
snippet = builder.format( snippet, type, output );
}
// TODO: Possibly activate clip distance index on index access rather than from clipping context
return snippet;
}
}
Methods¶
generate(builder: any, output: any): any
¶
Code
generate( builder, output ) {
let snippet;
const isAssignContext = builder.context.assign;
snippet = super.generate( builder );
if ( isAssignContext !== true ) {
const type = this.getNodeType( builder );
snippet = builder.format( snippet, type, output );
}
// TODO: Possibly activate clip distance index on index access rather than from clipping context
return snippet;
}
WorkgroupInfoNode
¶
Class Code
class WorkgroupInfoNode extends Node {
/**
* Constructs a new buffer scoped to type scope.
*
* @param {string} scope - TODO.
* @param {string} bufferType - The data type of a 'workgroup' scoped buffer element.
* @param {number} [bufferCount=0] - The number of elements in the buffer.
*/
constructor( scope, bufferType, bufferCount = 0 ) {
super( bufferType );
/**
* The buffer type.
*
* @type {string}
*/
this.bufferType = bufferType;
/**
* The buffer count.
*
* @type {number}
* @default 0
*/
this.bufferCount = bufferCount;
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isWorkgroupInfoNode = true;
/**
* The data type of the array buffer.
*
* @type {string}
*/
this.elementType = bufferType;
/**
* TODO.
*
* @type {string}
*/
this.scope = scope;
/**
* The name of the workgroup scoped buffer.
*
* @type {string}
* @default ''
*/
this.name = '';
}
/**
* Sets the name of this node.
*
* @param {string} name - The name to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
setName( name ) {
this.name = name;
return this;
}
/**
* Sets the name/label of this node.
*
* @deprecated
* @param {string} name - The name to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
label( name ) {
console.warn( 'THREE.TSL: "label()" has been deprecated. Use "setName()" instead.' ); // @deprecated r179
return this.setName( name );
}
/**
* Sets the scope of this node.
*
* @param {string} scope - The scope to set.
* @return {WorkgroupInfoNode} A reference to this node.
*/
setScope( scope ) {
this.scope = scope;
return this;
}
/**
* The data type of the array buffer.
*
* @return {string} The element type.
*/
getElementType() {
return this.elementType;
}
/**
* Overwrites the default implementation since the input type
* is inferred from the scope.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {string} The input type.
*/
getInputType( /*builder*/ ) {
return `${this.scope}Array`;
}
/**
* This method can be used to access elements via an index node.
*
* @param {IndexNode} indexNode - indexNode.
* @return {WorkgroupInfoElementNode} A reference to an element.
*/
element( indexNode ) {
return nodeObject( new WorkgroupInfoElementNode( this, indexNode ) );
}
generate( builder ) {
const name = ( this.name !== '' ) ? this.name : `${this.scope}Array_${this.id}`;
return builder.getScopedArray( name, this.scope.toLowerCase(), this.bufferType, this.bufferCount );
}
}