Lluvia
ll::ComputeNode Class Reference

Class representing compute nodes. More...

#include <ComputeNode.h>

Inheritance diagram for ll::ComputeNode:
Collaboration diagram for ll::ComputeNode:

Public Member Functions

 ComputeNode ()=delete
 
 ComputeNode (const ComputeNode &node)=delete
 
 ComputeNode (ComputeNode &&node)=delete
 
 ComputeNode (const std::shared_ptr< ll::vulkan::Device > &device, const ll::ComputeNodeDescriptor &descriptor, const std::weak_ptr< ll::Interpreter > &interpreter)
 Constructs the object. More...
 
virtual ~ComputeNode ()
 
ComputeNodeoperator= (const ComputeNode &node)=delete
 
ComputeNodeoperator= (ComputeNode &&node)=delete
 
ll::NodeType getType () const noexcept override
 Gets the node type. More...
 
std::string getFunctionName () const noexcept
 Gets the function name within the shader module this node runs. More...
 
std::shared_ptr< ll::ProgramgetProgram () const noexcept
 Gets the program object associated to this node. More...
 
const ll::ComputeNodeDescriptorgetDescriptor () const noexcept
 Gets the descriptor. More...
 
uint32_t getLocalX () const noexcept
 Gets the local group size in X dimension. More...
 
uint32_t getLocalY () const noexcept
 Gets the local group size in Y dimension. More...
 
uint32_t getLocalZ () const noexcept
 Gets the local group size in Z dimension. More...
 
ll::vec3ui getLocalShape () const noexcept
 Gets the local group shape. More...
 
uint32_t getGridX () const noexcept
 Gets the grid size in X dimension. More...
 
void setGridX (const uint32_t x) noexcept
 Sets the grid size in the X axis. More...
 
uint32_t getGridY () const noexcept
 Gets the grid size in Y dimension. More...
 
void setGridY (const uint32_t y) noexcept
 Sets the grid size in the Y axis. More...
 
uint32_t getGridZ () const noexcept
 Gets the grid size in Z dimension. More...
 
void setGridZ (const uint32_t z) noexcept
 Sets the grid size in the Z axis. More...
 
void setGridShape (const ll::vec3ui &shape) noexcept
 Sets the grid shape. More...
 
void configureGridShape (const ll::vec3ui &globalShape) noexcept
 Configures the grid shape given a global shape. More...
 
ll::vec3ui getGridShape () const noexcept
 Gets the grid shape. More...
 
bool hasPort (const std::string &name) const noexcept override
 Returns whether or not a port exists with a given name. More...
 
std::shared_ptr< ll::ObjectgetPort (const std::string &name) const override
 Gets a port descriptor given its name. More...
 
void setPushConstants (const ll::PushConstants &constants) noexcept
 
const ll::PushConstantsgetPushConstants () const noexcept
 
void bind (const std::string &name, const std::shared_ptr< ll::Object > &obj) override
 Binds a ll::Object as port index for this node. More...
 
void record (ll::CommandBuffer &commandBuffer) const override
 Records the operations required to run this node in a ll::CommandBuffer. More...
 
void setParameter (const std::string &name, const ll::Parameter &value) override
 Sets a parameter. More...
 
const ll::ParametergetParameter (const std::string &name) const override
 Gets a parameter. More...
 
- Public Member Functions inherited from ll::Node
virtual ~Node ()=default
 
void setState (const ll::NodeState tState)
 
ll::NodeState getState () const noexcept
 
void init ()
 

Protected Member Functions

void onInit () override
 

Detailed Description

Class representing compute nodes.

Constructor & Destructor Documentation

◆ ComputeNode() [1/4]

ll::ComputeNode::ComputeNode ( )
delete

◆ ComputeNode() [2/4]

ll::ComputeNode::ComputeNode ( const ComputeNode node)
delete

◆ ComputeNode() [3/4]

ll::ComputeNode::ComputeNode ( ComputeNode &&  node)
delete

◆ ComputeNode() [4/4]

ll::ComputeNode::ComputeNode ( const std::shared_ptr< ll::vulkan::Device > &  device,
const ll::ComputeNodeDescriptor descriptor,
const std::weak_ptr< ll::Interpreter > &  interpreter 
)

Constructs the object.

Parameters
[in]deviceThe Vulkan device where this node will run.
[in]descriptorThe descriptor. A copy of this descriptor is kept within this object. So this one can be modified after the compute node is constructed.
[in]interpreterInterpreter to use for running Lua scripts.
Exceptions
std::system_errorWith error code ll::ErrorCode::InvalidShaderFunctionName if desc.getFunctionName() is empty string.
std::system_errorWith error code ll::ErrorCode::InvalidShaderProgram if desc.getProgram is nullptr.
std::system_errorWith error code ll::ErrorCode::InvalidLocalShape if any of the components of descriptor.localShape is zero.

◆ ~ComputeNode()

virtual ll::ComputeNode::~ComputeNode ( )
virtual

Member Function Documentation

◆ bind()

void ll::ComputeNode::bind ( const std::string &  name,
const std::shared_ptr< ll::Object > &  obj 
)
overridevirtual

Binds a ll::Object as port index for this node.

Parameters
[in]nameThe port name.
[in]objThe object to bind.
Exceptions
std::system_errorif obj cannot be mapped as a port at position index.

Implements ll::Node.

◆ configureGridShape()

void ll::ComputeNode::configureGridShape ( const ll::vec3ui globalShape)
noexcept

Configures the grid shape given a global shape.

Parameters
[in]globalShapeThe global shape.

◆ getDescriptor()

const ll::ComputeNodeDescriptor& ll::ComputeNode::getDescriptor ( ) const
noexcept

Gets the descriptor.

Returns
The descriptor.

◆ getFunctionName()

std::string ll::ComputeNode::getFunctionName ( ) const
noexcept

Gets the function name within the shader module this node runs.

Returns
The function name.

◆ getGridShape()

ll::vec3ui ll::ComputeNode::getGridShape ( ) const
noexcept

Gets the grid shape.

See ll::ComputeNodeDescriptor::getGridShape for more information.

Returns
The grid shape.

◆ getGridX()

uint32_t ll::ComputeNode::getGridX ( ) const
noexcept

Gets the grid size in X dimension.

See ll::ComputeNodeDescriptor::getGridX for more information.

Returns
The grid size in X.

◆ getGridY()

uint32_t ll::ComputeNode::getGridY ( ) const
noexcept

Gets the grid size in Y dimension.

See ll::ComputeNodeDescriptor::getGridY for more information.

Returns
The grid size in Y.

◆ getGridZ()

uint32_t ll::ComputeNode::getGridZ ( ) const
noexcept

Gets the grid size in Z dimension.

See ll::ComputeNodeDescriptor::getGridZ for more information.

Returns
The grid size in Z.

◆ getLocalShape()

ll::vec3ui ll::ComputeNode::getLocalShape ( ) const
noexcept

Gets the local group shape.

Returns
The local shape.

◆ getLocalX()

uint32_t ll::ComputeNode::getLocalX ( ) const
noexcept

Gets the local group size in X dimension.

See ll::ComputeNodeDescriptor::getLocalX for more information.

Returns
The local group size in X.

◆ getLocalY()

uint32_t ll::ComputeNode::getLocalY ( ) const
noexcept

Gets the local group size in Y dimension.

See ll::ComputeNodeDescriptor::getLocalY for more information.

Returns
The local group size in Y.

◆ getLocalZ()

uint32_t ll::ComputeNode::getLocalZ ( ) const
noexcept

Gets the local group size in Z dimension.

See ll::ComputeNodeDescriptor::getLocalZ for more information.

Returns
The local group size in Z.

◆ getParameter()

const ll::Parameter& ll::ComputeNode::getParameter ( const std::string &  name) const
overridevirtual

Gets a parameter.

Parameters
[in]nameThe parameter name
Returns
The parameter.
Exceptions
std::system_errorWith error code ll::ErrorCode::KeyNotFound if name is not in the parameters table.

Implements ll::Node.

◆ getPort()

std::shared_ptr<ll::Object> ll::ComputeNode::getPort ( const std::string &  name) const
overridevirtual

Gets a port descriptor given its name.

Parameters
[in]nameThe name
Returns
The port descriptor.
Exceptions
std::system_errorWith error code ll::ErrorCode::KeyNotFound if name is not in the ports table.

Implements ll::Node.

◆ getProgram()

std::shared_ptr<ll::Program> ll::ComputeNode::getProgram ( ) const
noexcept

Gets the program object associated to this node.

Returns
The program.

◆ getPushConstants()

const ll::PushConstants& ll::ComputeNode::getPushConstants ( ) const
noexcept

◆ getType()

ll::NodeType ll::ComputeNode::getType ( ) const
overridevirtualnoexcept

Gets the node type.

Returns
The type.
See also
ll::NodeType

Implements ll::Node.

◆ hasPort()

bool ll::ComputeNode::hasPort ( const std::string &  name) const
overridevirtualnoexcept

Returns whether or not a port exists with a given name.

Parameters
[in]nameThe name of the port.
Returns
true if the port exists, false otherwise.

Implements ll::Node.

◆ onInit()

void ll::ComputeNode::onInit ( )
overrideprotectedvirtual

Implements ll::Node.

◆ operator=() [1/2]

ComputeNode& ll::ComputeNode::operator= ( ComputeNode &&  node)
delete

◆ operator=() [2/2]

ComputeNode& ll::ComputeNode::operator= ( const ComputeNode node)
delete

◆ record()

void ll::ComputeNode::record ( ll::CommandBuffer commandBuffer) const
overridevirtual

Records the operations required to run this node in a ll::CommandBuffer.

Parameters
[in]commandBufferThe command buffer.
Exceptions
std::system_errorwith corresponding error code and message.

Implements ll::Node.

◆ setGridShape()

void ll::ComputeNode::setGridShape ( const ll::vec3ui shape)
noexcept

Sets the grid shape.

The grid size defines the number of local groups to be run during the execution of a compute node shader program.

Parameter z corresponds to the groupCountZ parameter in vkCmdDispatch. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#vkCmdDispatch for more information.

Parameters
[in]shapeThe grid shape. Each XYZ component must be greater than zero.

◆ setGridX()

void ll::ComputeNode::setGridX ( const uint32_t  x)
noexcept

Sets the grid size in the X axis.

The grid size defines the number of local groups to be run during the execution of a compute node shader program.

Parameter x corresponds to the groupCountX parameter in vkCmdDispatch. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#vkCmdDispatch for more information.

Parameters
[in]xThe grid size. It must be greater than zero.
Returns
A reference to this object.

◆ setGridY()

void ll::ComputeNode::setGridY ( const uint32_t  y)
noexcept

Sets the grid size in the Y axis.

The grid size defines the number of local groups to be run during the execution of a compute node shader program.

Parameter y corresponds to the groupCountY parameter in vkCmdDispatch. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#vkCmdDispatch for more information.

Parameters
[in]yThe grid size. It must be greater than zero.
Returns
A reference to this object.

◆ setGridZ()

void ll::ComputeNode::setGridZ ( const uint32_t  z)
noexcept

Sets the grid size in the Z axis.

The grid size defines the number of local groups to be run during the execution of a compute node shader program.

Parameter z corresponds to the groupCountZ parameter in vkCmdDispatch. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#vkCmdDispatch for more information.

Parameters
[in]zThe grid size. It must be greater than zero.
Returns
A reference to this object.

◆ setParameter()

void ll::ComputeNode::setParameter ( const std::string &  name,
const ll::Parameter value 
)
overridevirtual

Sets a parameter.

Parameters
[in]nameThe name
[in]defaultValueThe value.
Returns
A reference to this object.

Implements ll::Node.

◆ setPushConstants()

void ll::ComputeNode::setPushConstants ( const ll::PushConstants constants)
noexcept

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