Skip to content

LiteFX::Rendering::IShaderProgram

The interface for a shader program.

Synopsis

Declared in <litefx/rendering_api.hpp>

class [[dllimport, dllexport]] IShaderProgram
    : public SharedObject

Description

A shader program differs in it's functionality as well as the contained shader modules, depending on the pipeline type it gets assigned to. A shader program can be of any of the following types:

  • Rasterization: A rasterization pipeline is a traditional pipeline, that can contain at maximum one module of the following stages: Vertex, Tessellation Control, Tessellation Evaluation, Geometry, Fragment. A vertex and fragment shader are required for rasterization programs.
  • Mesh shading: If mesh shader support is enabled (through the device feature GraphicsDeviceFeatures::MeshShaders), a mesh shading program can contain at maximum one module of the following stages: Task, Mesh, Fragment. A mesh and fragment shader are required for a mesh shading program.
  • Compute: A compute shader program must only contain a single module for the Compute stage.
  • Ray-tracing: If ray tracing support is enabled (through the device feature GraphicsDeviceFeatures::RayTracing), a ray tracing program can contain modules of the following stages: Ray Generation, Any Hit, Closest Hit, Intersection, Miss, Callable. There must be exactly one Ray Generation module. All other modules can occur multiple times. To build a ray tracing pipeline, all shaders should be added to a single shader program, which is then passed to the pipeline during creation.

Shaders from different program types must not be mixed. For example, it is not valid to add a compute module to a rasterization program. The only exception to this is the ShaderStage::Fragment module, which can be added to a mesh pipeline, as well as a rasterization pipeline.

Base Classes

NameDescription
SharedObjectBase class for an object that can be shared.

Type Aliases

Name
_Esft_type

Member Functions

NameDescription
IShaderProgram [constructor]Constructors
~IShaderProgram [destructor] [virtual]Destructor
operator= Assignment operators
buildShaderRecordCollection Builds a shader record collection based on the current shader program.
contains contains overloads
modules Returns the modules, the shader program is build from.
operator[] Returns a pointer to shader module based on its (case-sensitive) name.
reflectPipelineLayout Uses shader reflection to extract the pipeline layout of a shader. May not be available in all backends.
shared_from_this Returns a shared pointer to the current object instance.
weak_from_this Returns a weak pointer to the current object instance.

Protected Types

NameDescription
Allocator An allocator used to allocate the shared object.

Protected Member Functions

NameDescription
IShaderProgram [constructor]Default constructor
operator= Assignment operators

Protected Static Member Functions

NameDescription
create Generic factory method used to create instances of the shared object.

Derived Classes

NameDescription
ShaderProgram Represents a shader program, consisting of multiple IShaderModule "IShaderModules".

See Also

https://github.com/crud89/LiteFX/wiki/Shader-Development