Nameless Engine
Loading...
Searching...
No Matches
ne::GlslComputeShaderInterface Class Reference

#include <GlslComputeShaderInterface.h>

Inheritance diagram for ne::GlslComputeShaderInterface:
ne::ComputeShaderInterface

Public Member Functions

 GlslComputeShaderInterface (const GlslComputeShaderInterface &)=delete
 
GlslComputeShaderInterfaceoperator= (const GlslComputeShaderInterface &)=delete
 
virtual std::optional< ErrorbindResource (GpuResource *pResource, const std::string &sShaderResourceName, ComputeResourceUsage usage, bool bUpdateOnlyCurrentFrameResourceDescriptors=false) override
 
void dispatchOnGraphicsQueue (VkCommandBuffer pCommandBuffer)
 
- Public Member Functions inherited from ne::ComputeShaderInterface
 ComputeShaderInterface (const ComputeShaderInterface &)=delete
 
ComputeShaderInterfaceoperator= (const ComputeShaderInterface &)=delete
 
virtual std::optional< ErrorbindResource (GpuResource *pResource, const std::string &sShaderResourceName, ComputeResourceUsage usage, bool bUpdateOnlyCurrentFrameResourceDescriptors=false)=0
 
void submitForExecution (unsigned int iThreadGroupCountX, unsigned int iThreadGroupCountY, unsigned int iThreadGroupCountZ)
 
ComputeExecutionGroup getExecutionGroup () const
 
ComputeExecutionStage getExecutionStage () const
 
std::string getComputeShaderName () const
 
PipelinegetUsedPipeline () const
 

Protected Member Functions

 GlslComputeShaderInterface (Renderer *pRenderer, const std::string &sComputeShaderName, ComputeExecutionStage executionStage, ComputeExecutionGroup executionGroup)
 
- Protected Member Functions inherited from ne::ComputeShaderInterface
 ComputeShaderInterface (Renderer *pRenderer, const std::string &sComputeShaderName, ComputeExecutionStage executionStage, ComputeExecutionGroup executionGroup)
 
RenderergetRenderer ()
 
PipelinegetPipeline () const
 
unsigned int getThreadGroupCountX () const
 
unsigned int getThreadGroupCountY () const
 
unsigned int getThreadGroupCountZ () const
 

Friends

class ComputeShaderInterface
 

Additional Inherited Members

- Static Public Member Functions inherited from ne::ComputeShaderInterface
static std::variant< std::unique_ptr< ComputeShaderInterface >, ErrorcreateUsingGraphicsQueue (Renderer *pRenderer, const std::string &sCompiledComputeShaderName, ComputeExecutionStage executionStage, ComputeExecutionGroup executionGroup=ComputeExecutionGroup::FIRST)
 
- Static Protected Member Functions inherited from ne::ComputeShaderInterface
static std::variant< std::unique_ptr< ComputeShaderInterface >, ErrorcreateRenderSpecificInterface (Renderer *pRenderer, const std::string &sComputeShaderName, ComputeExecutionStage executionStage, ComputeExecutionGroup executionGroup)
 
static std::unique_ptr< ComputeShaderInterfacecreatePartiallyInitializedRenderSpecificInterface (Renderer *pRenderer, const std::string &sComputeShaderName, ComputeExecutionStage executionStage, ComputeExecutionGroup executionGroup)
 

Detailed Description

Interface to configure and run a GLSL compute shader.

Constructor & Destructor Documentation

◆ GlslComputeShaderInterface()

ne::GlslComputeShaderInterface::GlslComputeShaderInterface ( Renderer pRenderer,
const std::string &  sComputeShaderName,
ComputeExecutionStage  executionStage,
ComputeExecutionGroup  executionGroup 
)
protected

Initializes the interface.

Parameters
pRendererUsed renderer.
sComputeShaderNameName of the compiled compute shader to use.
executionStageDetermines when the shader will be executed.
executionGroupDetermines execution group of this shader where shaders of the first group will be executed before shaders from the second group and so on.

Member Function Documentation

◆ bindResource()

std::optional< Error > ne::GlslComputeShaderInterface::bindResource ( GpuResource pResource,
const std::string &  sShaderResourceName,
ComputeResourceUsage  usage,
bool  bUpdateOnlyCurrentFrameResourceDescriptors = false 
)
overridevirtual

Binds the specified resource to be available in compute shaders.

Warning
This overload is used in cases where you cannot transfer resource ownership to the compute shader interface. In this case you must guarantee that the resource will not be deleted while this compute shader interface exists and while the GPU is processing this compute shader.
Parameters
pResourceResource to bind to compute shader.
sShaderResourceNameResource name from shader.
usageResource usage.
bUpdateOnlyCurrentFrameResourceDescriptorsSpecify true if you guarantee that you will bind a different GPU resource on the next frame, specify false if you are not sure if you will rebind the resource on the next frame or not. When true is specified only descriptors of the current frame resource will be updated (because descriptors of other frame resources might be in use and it's invalid to update them), when false descriptors of all frame resources will be updated.
Returns
Error if something went wrong.

Implements ne::ComputeShaderInterface.

◆ dispatchOnGraphicsQueue()

void ne::GlslComputeShaderInterface::dispatchOnGraphicsQueue ( VkCommandBuffer  pCommandBuffer)
inline

Adds a dispatch command to the specified command buffer to execute this compute shader.

Warning
Expects that pipeline and descriptor layout are set.
Parameters
pCommandBufferCommand buffer to add dispatch command to.

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