LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::Shader Class Referenceabstract

Shader interface. More...

#include <Shader.h>

Inheritance diagram for LLGL::Shader:
LLGL::RenderSystemChild LLGL::Interface LLGL::NonCopyable

Public Member Functions

virtual const Report * GetReport () const =0
 Returns a pointer to the report or null if there is none.
virtual bool Reflect (ShaderReflection &reflection) const =0
 Returns a reflection of the shader pipeline layout with all required resources for this shader.
ShaderType GetType () const
 Returns the type of this shader.
Public Member Functions inherited from LLGL::RenderSystemChild
virtual void SetDebugName (const char *name)
 Sets the name of this class instance for debugging purposes.
Public Member Functions inherited from LLGL::Interface
virtual bool IsInstanceOf (int id) const
 Returns true if this object is an instance of the specified interface.
Public Member Functions inherited from LLGL::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
virtual ~NonCopyable ()=default

Protected Member Functions

 Shader (const ShaderType type)
Protected Member Functions inherited from LLGL::NonCopyable
 NonCopyable ()=default

Detailed Description

Constructor & Destructor Documentation

◆ Shader()

LLGL::Shader::Shader ( const ShaderType type)
protected

Member Function Documentation

◆ GetReport()

virtual const Report * LLGL::Shader::GetReport ( ) const
pure virtual

Returns a pointer to the report or null if there is none.

Remarks
If there is a report, it might contain warnings and/or errors from shader compilation process.
See also
Report

◆ GetType()

ShaderType LLGL::Shader::GetType ( ) const
inline

Returns the type of this shader.

◆ Reflect()

virtual bool LLGL::Shader::Reflect ( ShaderReflection & reflection) const
pure virtual

Returns a reflection of the shader pipeline layout with all required resources for this shader.

Parameters
[out]reflectionSpecifies the output shader reflection. If the function returns false, the content of this parameter is undefined!
Remarks
The list of resources in the reflection output is always sorted by the following attributes (lower number means higher priority for sorting):
  1. Resource type in ascending order (see BindingDescriptor::type).
  2. Binding flags in ascending order (see BindingDescriptor::bindFlags).
  3. Binding slot in ascending order (see BindingDescriptor::slot).
Here is an example of such a sorted list (pseudocode):
resources[0] = { type: ResourceType::Buffer, bindFlags: BindFlags::ConstantBuffer, slot: 0 }
resources[1] = { type: ResourceType::Buffer, bindFlags: BindFlags::ConstantBuffer, slot: 2 }
resources[2] = { type: ResourceType::Texture, bindFlags: BindFlags::Sampled, slot: 0 }
resources[3] = { type: ResourceType::Texture, bindFlags: BindFlags::Sampled, slot: 1 }
resources[4] = { type: ResourceType::Texture, bindFlags: BindFlags::Sampled, slot: 2 }
resources[5] = { type: ResourceType::Sampler, bindFlags: 0, slot: 2 }
@ Sampler
Sampler state resource.
Definition ResourceFlags.h:49
@ Buffer
Buffer resource.
Definition ResourceFlags.h:34
@ Texture
Texture resource.
Definition ResourceFlags.h:42
@ Sampled
The resource can be used to bind a buffer or texture for read access.
Definition ResourceFlags.h:111
@ ConstantBuffer
The resource can be used to bind a set of constants.
Definition ResourceFlags.h:88
The instanceDivisor and offset members of the vertex attributes are ignored by this function.
Returns
True, if the reflection was successful. Otherwise, the shader reflection failed and the content of the output parameter reflection is undefined.
Note
Since Metal needs a complete pipeline state for shader reflection, this function is only supported for compute shaders in the Metal backend.
See also
ShaderReflection::resources
ShaderReflection::vertexAttributes
VertexAttribute::instanceDivisor
VertexAttribute::offset

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