LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::IShaderModule Class Referenceabstract

Represents a single shader module, i.e. a part of a IShaderProgram. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::Backends::DirectX12ShaderModule, and LiteFX::Rendering::Backends::VulkanShaderModule.

Public Member Functions

virtual ~IShaderModule () noexcept=default
 
virtual ShaderStage type () const noexcept=0
 Returns the type of the shader module.
 
virtual const StringfileName () const noexcept=0
 Returns the file name of the shader module.
 
virtual const StringentryPoint () const noexcept=0
 Returns the name of the shader module entry point.
 
virtual const Optional< DescriptorBindingPoint > & shaderLocalDescriptor () const noexcept=0
 For ray-tracing shader modules returns the binding point for the descriptor that receives shader-local data.
 

Protected Member Functions

 IShaderModule () noexcept=default
 
 IShaderModule (const IShaderModule &)=default
 
 IShaderModule (IShaderModule &&) noexcept=default
 
IShaderModuleoperator= (const IShaderModule &)=default
 
IShaderModuleoperator= (IShaderModule &&) noexcept=default
 

Detailed Description

Represents a single shader module, i.e. a part of a IShaderProgram.

A shader module corresponds to a single shader source file.

Constructor & Destructor Documentation

◆ IShaderModule() [1/3]

LiteFX::Rendering::IShaderModule::IShaderModule ( )
protecteddefaultnoexcept

◆ IShaderModule() [2/3]

LiteFX::Rendering::IShaderModule::IShaderModule ( const IShaderModule & )
protecteddefault

◆ IShaderModule() [3/3]

LiteFX::Rendering::IShaderModule::IShaderModule ( IShaderModule && )
protecteddefaultnoexcept

◆ ~IShaderModule()

virtual LiteFX::Rendering::IShaderModule::~IShaderModule ( )
virtualdefaultnoexcept

Member Function Documentation

◆ entryPoint()

virtual const String & LiteFX::Rendering::IShaderModule::entryPoint ( ) const
pure virtualnoexcept

Returns the name of the shader module entry point.

Returns
The name of the shader module entry point.

Implemented in LiteFX::Rendering::Backends::DirectX12ShaderModule, and LiteFX::Rendering::Backends::VulkanShaderModule.

◆ fileName()

virtual const String & LiteFX::Rendering::IShaderModule::fileName ( ) const
pure virtualnoexcept

Returns the file name of the shader module.

Returns
The file name of the shader module.

Implemented in LiteFX::Rendering::Backends::DirectX12ShaderModule, and LiteFX::Rendering::Backends::VulkanShaderModule.

◆ operator=() [1/2]

IShaderModule & LiteFX::Rendering::IShaderModule::operator= ( const IShaderModule & )
protecteddefault

◆ operator=() [2/2]

IShaderModule & LiteFX::Rendering::IShaderModule::operator= ( IShaderModule && )
protecteddefaultnoexcept

◆ shaderLocalDescriptor()

virtual const Optional< DescriptorBindingPoint > & LiteFX::Rendering::IShaderModule::shaderLocalDescriptor ( ) const
pure virtualnoexcept

For ray-tracing shader modules returns the binding point for the descriptor that receives shader-local data.

Ray-tracing shaders, especially hit and intersection shaders may rely on local per-invocation data to handle ray intersections. One prominent example of such data is a custom index that identifies the geometry within the instance that has been hit, which can then be used to index into bindless arrays to acquire additional data, such as material properties or texture maps. This data is placed alongside the shader binding table created from a ShaderRecordCollection and passed to the shader when it is invoked. However, when building the IPipelineLayout for a ray-tracing pipeline, the device needs to know which descriptors bind globally and which descriptor binds locally. This information currently cannot be reliably acquired by shader reflection and must thus be specified on a per-module basis.

Note that it is only possible for one descriptor to bind to local data. However, this descriptor can bind a constant/uniform buffer that contains multiple variables. Whilst it is possible to bind buffer references (using IDeviceMemory::virtualAddress), support for it is differs depending on the shader language. To keep shaders portable, it is recommended to use descriptor indexing to bind buffers and textures and only pass constant values into local descriptor bindings.

For shader modules of types other than ray-tracing, this setting is ignored.

Returns
Returns the binding point for the descriptor that receives shader-local data.
See also
ShaderRecord<<typename TLocalData>>

Implemented in LiteFX::Rendering::Backends::DirectX12ShaderModule, and LiteFX::Rendering::Backends::VulkanShaderModule.

◆ type()

virtual ShaderStage LiteFX::Rendering::IShaderModule::type ( ) const
pure virtualnoexcept

Returns the type of the shader module.

Returns
The type of the shader module.

Implemented in LiteFX::Rendering::Backends::DirectX12ShaderModule, and LiteFX::Rendering::Backends::VulkanShaderModule.