LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::IShaderProgram Class Referenceabstract

The interface for a shader program. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::ShaderProgram< DirectX12ShaderModule >, LiteFX::Rendering::ShaderProgram< VulkanShaderModule >, and LiteFX::Rendering::ShaderProgram< TShaderModule >.

Public Member Functions

virtual ~IShaderProgram () noexcept=default
 
Array< const IShaderModule * > modules () const noexcept
 Returns the modules, the shader program is build from. More...
 
SharedPtr< IPipelineLayoutreflectPipelineLayout () const
 Uses shader reflection to extract the pipeline layout of a shader. May not be available in all backends. More...
 

Detailed Description

The interface for a shader program.

Constructor & Destructor Documentation

◆ ~IShaderProgram()

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

Member Function Documentation

◆ modules()

Array< const IShaderModule * > LiteFX::Rendering::IShaderProgram::modules ( ) const
inlinenoexcept

Returns the modules, the shader program is build from.

Returns
The modules, the shader program is build from.

◆ reflectPipelineLayout()

SharedPtr< IPipelineLayout > LiteFX::Rendering::IShaderProgram::reflectPipelineLayout ( ) const
inline

Uses shader reflection to extract the pipeline layout of a shader. May not be available in all backends.

Note that shader reflection may not yield different results than you would expect, especially when using DirectX 12. For more information on how to use shader reflection and how to write portable shaders, refer to the shader development guide in the wiki.

In particular, shader reflection is not able to restore:

  • Input attachments in DirectX. Instead, input attachments are treated as DescriptorType::Texture. This is usually not a problem, since DirectX does not have a concept of render pass outputs/inputs anyway. However, keep this in mind, if you want to filter descriptors based on their type, for example. Immutable sampler states in Vulkan. Those are only restored in DirectX, if an explicit root signature has been provided. For this reason, it is best not to use them, if you want to use shader reflection.
Returns
The pipeline layout extracted from shader reflection.