HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CustomCodeNodeMdl Class Reference

Node to handle user defined implementations in external MDL files or using the inline sourcecode attribute. More...

#include <CustomNodeMdl.h>

+ Inheritance diagram for CustomCodeNodeMdl:

Public Member Functions

void initialize (const InterfaceElement &element, GenContext &context) override
 
void emitFunctionDefinition (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit function definition for the given node instance. More...
 
const stringgetQualifiedModuleName () const
 
string modifyPortName (const string &name, const MdlSyntax &syntax) const
 
- Public Member Functions inherited from SourceCodeNodeMdl
void initialize (const InterfaceElement &element, GenContext &context) override
 
void emitFunctionDefinition (const ShaderNode &, GenContext &, ShaderStage &) const override
 Emit function definition for the given node instance. More...
 
void emitFunctionCall (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit the function call or inline source code for given node instance in the given context. More...
 
- Public Member Functions inherited from SourceCodeNode
void initialize (const InterfaceElement &element, GenContext &context) override
 
void emitFunctionDefinition (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit function definition for the given node instance. More...
 
void emitFunctionCall (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit the function call or inline source code for given node instance in the given context. More...
 
- Public Member Functions inherited from ShaderNodeImpl
virtual ~ShaderNodeImpl ()
 
virtual const stringgetTarget () const
 
const stringgetName () const
 Return the name of this implementation. More...
 
size_t getHash () const
 
virtual void addInputs (ShaderNode &node, GenContext &context) const
 Add additional inputs on a node. More...
 
virtual void setValues (const Node &node, ShaderNode &shaderNode, GenContext &context) const
 Set values for additional inputs on a node. More...
 
virtual void addClassification (ShaderNode &node) const
 Add additional classifications on a node. More...
 
virtual void createVariables (const ShaderNode &node, GenContext &context, Shader &shader) const
 
virtual void emitOutputVariables (const ShaderNode &node, GenContext &context, ShaderStage &stage) const
 Emit declaration and initialization of output variables to use in a function call. More...
 
virtual ShaderGraphgetGraph () const
 
virtual bool isEditable (const ShaderInput &) const
 
virtual bool isEditable (const ShaderGraphInputSocket &) const
 

Static Public Member Functions

static ShaderNodeImplPtr create ()
 
- Static Public Member Functions inherited from SourceCodeNodeMdl
static ShaderNodeImplPtr create ()
 
- Static Public Member Functions inherited from SourceCodeNode
static ShaderNodeImplPtr create ()
 

Protected Member Functions

void initializeForInlineSourceCode (const InterfaceElement &element, GenContext &context)
 Initialize function for nodes that use the inline sourcecode attribute. More...
 
void initializeForExternalSourceCode (const InterfaceElement &element, GenContext &context)
 Initialize function for nodes that use the file and function attribute. More...
 
void initializeFunctionCallTemplateString (const MdlSyntax &syntax, const NodeDef &node)
 Computes the function call string with replacement markers use by base class. More...
 
void initializeOutputDefaults (const MdlSyntax &syntax, const NodeDef &node)
 Keep track of the default values needed for the inline sourcecode case. More...
 
- Protected Member Functions inherited from SourceCodeNodeMdl
void resolveSourceCode (const InterfaceElement &element, GenContext &context) override
 Resolve the source file and read the source code during the initialization of the node. More...
 
- Protected Member Functions inherited from ShaderNodeImpl
 ShaderNodeImpl ()
 Protected constructor. More...
 

Protected Attributes

std::vector< ValuePtr_outputDefaults
 store default values of the node definition More...
 
bool _useExternalSourceCode
 
string _inlineFunctionName
 
string _inlineSourceCode
 
string _qualifiedModuleName
 
- Protected Attributes inherited from SourceCodeNodeMdl
string _returnStruct
 
- Protected Attributes inherited from SourceCodeNode
bool _inlined
 
string _functionName
 
string _functionSource
 
FilePath _sourceFilename
 
- Protected Attributes inherited from ShaderNodeImpl
string _name
 
size_t _hash
 

Detailed Description

Node to handle user defined implementations in external MDL files or using the inline sourcecode attribute.

Definition at line 17 of file CustomNodeMdl.h.

Member Function Documentation

static ShaderNodeImplPtr CustomCodeNodeMdl::create ( )
static
void CustomCodeNodeMdl::emitFunctionDefinition ( const ShaderNode node,
GenContext context,
ShaderStage stage 
) const
overridevirtual

Emit function definition for the given node instance.

Reimplemented from ShaderNodeImpl.

const string& CustomCodeNodeMdl::getQualifiedModuleName ( ) const

Get the MDL qualified name of the externally references user module. It's used for import statements and functions calls in the generated target code.

void CustomCodeNodeMdl::initialize ( const InterfaceElement element,
GenContext context 
)
overridevirtual

Initialize with the given implementation element. Initialization must set the name and hash for the implementation, as well as any other data needed to emit code for the node.

Reimplemented from ShaderNodeImpl.

void CustomCodeNodeMdl::initializeForExternalSourceCode ( const InterfaceElement element,
GenContext context 
)
protected

Initialize function for nodes that use the file and function attribute.

void CustomCodeNodeMdl::initializeForInlineSourceCode ( const InterfaceElement element,
GenContext context 
)
protected

Initialize function for nodes that use the inline sourcecode attribute.

void CustomCodeNodeMdl::initializeFunctionCallTemplateString ( const MdlSyntax syntax,
const NodeDef node 
)
protected

Computes the function call string with replacement markers use by base class.

void CustomCodeNodeMdl::initializeOutputDefaults ( const MdlSyntax syntax,
const NodeDef node 
)
protected

Keep track of the default values needed for the inline sourcecode case.

string CustomCodeNodeMdl::modifyPortName ( const string name,
const MdlSyntax syntax 
) const

To avoid collisions with reserved names in MDL, input and output names are prefixed. In the sourcecode case all inputs and outputs are prefixed so authors don't need knowledge about reserved words in MDL. In the file and function case, only reserved names are prefixed to support existing MDL implementations without changes.

Member Data Documentation

string CustomCodeNodeMdl::_inlineFunctionName
protected

Definition at line 49 of file CustomNodeMdl.h.

string CustomCodeNodeMdl::_inlineSourceCode
protected

Definition at line 50 of file CustomNodeMdl.h.

std::vector<ValuePtr> CustomCodeNodeMdl::_outputDefaults
protected

store default values of the node definition

Definition at line 46 of file CustomNodeMdl.h.

string CustomCodeNodeMdl::_qualifiedModuleName
protected

Definition at line 51 of file CustomNodeMdl.h.

bool CustomCodeNodeMdl::_useExternalSourceCode
protected

Definition at line 48 of file CustomNodeMdl.h.


The documentation for this class was generated from the following file: