Cogs.Core
Public Member Functions | List of all members
Cogs::IEffects Struct Referenceabstract

Provides effects and shader management functionality. More...

#include <IEffects.h>

Inheritance diagram for Cogs::IEffects:
Cogs::EffectsCommon Cogs::EffectsD3D11 Cogs::EffectsD3D12 Cogs::EffectsGL20 Cogs::EffectsGLES30 Cogs::EffectsNull Cogs::EffectsVK Cogs::EffectsWebGPU

Public Member Functions

virtual EffectHandle loadEffect (const EffectDescription &description)=0
 Load an effect from the given description.
 
virtual EffectHandle loadEffect (const StringView &fileName, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load the given single file effect.
 
virtual EffectHandle loadComputeEffect (const StringView &fileName, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load the compute shader with the given file name and create an effect.
 
virtual EffectHandle loadComputeEffect (const StringView &fileName, const PreprocessorDefinitions &definitions, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load the compute shader with the given file name and create an effect.
 
virtual EffectHandle loadEffect (const StringView &vsFileName, const StringView &psFileName, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex and pixel shader files given.
 
virtual EffectHandle loadEffect (const StringView &vsFileName, const StringView &psFileName, const PreprocessorDefinitions &definitions, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex and pixel shader files given, applying the given preprocessor definitions to the shaders.
 
virtual EffectHandle loadEffectSource (const StringView &vsSource, const StringView &psSource, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex and pixel shader sources given.
 
virtual EffectHandle loadEffectSource (const StringView &vsSource, const StringView &gsSource, const StringView &psSource, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex, geometry, and pixel shader sources given.
 
virtual EffectHandle loadEffectSource (const StringView &vsSource, const StringView &psSource, const PreprocessorDefinitions &definitions, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex and pixel shader sources given, applying the given preprocessor definitions to the shaders.
 
virtual EffectHandle loadEffectSource (const StringView &vsSource, const StringView &gsSource, const StringView &psSource, const PreprocessorDefinitions &definitions, EffectFlags::EEffectFlags effectFlags=EffectFlags::None)=0
 Load an effect created from the vertex, geometry, and pixel shader sources given, applying the given preprocessor definitions to the shaders.
 
virtual void releaseEffect (EffectHandle effectHandle)=0
 Release the effect with the given handle, freeing all resources generated during program loading.
 
virtual EffectVariableHandle getEffectVariable (EffectHandle effectHandle, const StringView &name)=0
 Get a handle to the variable with the given name in the effect with the given effectHandle.
 
virtual ConstantBufferBindingHandle getConstantBufferBinding (EffectHandle effectHandle, const StringView &name)=0
 Get a handle to a constant buffer binding, mapping how to bind a constant buffer to the given effect.
 
virtual TextureBindingHandle getTextureBinding (EffectHandle effectHandle, const StringView &name, const unsigned int slot)=0
 Get a handle to a texture object binding, mapping how to bind textures to the given effect.
 
virtual BufferBindingHandle getBufferBinding (EffectHandle effectHandle, const StringView &name)=0
 Get a handle to a buffer binding.
 
virtual void releaseBufferBinding (BufferBindingHandle bufferBindingHandle)=0
 Release a handle to a buffer binding.
 
virtual SamplerStateBindingHandle getSamplerStateBinding (EffectHandle effectHandle, const StringView &name, const unsigned int slot)=0
 Get a handle to a sampler state object binding, mapping how to bind the sampler state to the given effect.
 
virtual void releaseResources ()=0
 Release all allocated effect resources.
 
virtual void annotate (EffectHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual void annotateVS (EffectHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual void annotateGS (EffectHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual void annotatePS (EffectHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual void annotateCS (EffectHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual void setIOHandler (IIOHandler *handler)=0
 Sets an external I/O handler to use for I/O operations.
 
virtual IIOHandlergetIOHandler ()
 Gets the external I/O handler.
 

Detailed Description

Provides effects and shader management functionality.

Definition at line 147 of file IEffects.h.

Member Function Documentation

◆ annotate()

virtual void Cogs::IEffects::annotate ( EffectHandle  handle,
const StringView name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

Reimplemented in Cogs::EffectsD3D11, Cogs::EffectsGL20, Cogs::EffectsNull, and Cogs::EffectsWebGPU.

Definition at line 320 of file IEffects.h.

◆ annotateCS()

virtual void Cogs::IEffects::annotateCS ( EffectHandle  handle,
const StringView name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

Reimplemented in Cogs::EffectsD3D11, Cogs::EffectsGL20, Cogs::EffectsNull, and Cogs::EffectsWebGPU.

Definition at line 340 of file IEffects.h.

◆ annotateGS()

virtual void Cogs::IEffects::annotateGS ( EffectHandle  handle,
const StringView name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

Reimplemented in Cogs::EffectsD3D11, Cogs::EffectsGL20, Cogs::EffectsNull, and Cogs::EffectsWebGPU.

Definition at line 330 of file IEffects.h.

◆ annotatePS()

virtual void Cogs::IEffects::annotatePS ( EffectHandle  handle,
const StringView name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

Reimplemented in Cogs::EffectsD3D11, Cogs::EffectsGL20, Cogs::EffectsNull, and Cogs::EffectsWebGPU.

Definition at line 335 of file IEffects.h.

◆ annotateVS()

virtual void Cogs::IEffects::annotateVS ( EffectHandle  handle,
const StringView name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

Reimplemented in Cogs::EffectsD3D11, Cogs::EffectsGL20, Cogs::EffectsNull, and Cogs::EffectsWebGPU.

Definition at line 325 of file IEffects.h.

◆ getBufferBinding()

virtual BufferBindingHandle Cogs::IEffects::getBufferBinding ( EffectHandle  effectHandle,
const StringView name 
)
pure virtual

Get a handle to a buffer binding.

Implemented in Cogs::EffectsCommon, Cogs::EffectsGL20, and Cogs::EffectsWebGPU.

◆ getConstantBufferBinding()

virtual ConstantBufferBindingHandle Cogs::IEffects::getConstantBufferBinding ( EffectHandle  effectHandle,
const StringView name 
)
pure virtual

Get a handle to a constant buffer binding, mapping how to bind a constant buffer to the given effect.

The binding object can then be used to effectively bind the constant buffer before drawing, and avoid having to do name based lookups at runtime.

Parameters
effectHandleValid handle to an effect.
nameName of the constant buffer as used in shaders.
Returns
Handle to the constant buffer binding, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon, Cogs::EffectsGL20, Cogs::EffectsGLES30, and Cogs::EffectsWebGPU.

◆ getEffectVariable()

virtual EffectVariableHandle Cogs::IEffects::getEffectVariable ( EffectHandle  effectHandle,
const StringView name 
)
pure virtual

Get a handle to the variable with the given name in the effect with the given effectHandle.

Parameters
effectHandleValid handle to an effect.
nameName of the variable get a handle to.
Returns
Handle to the effect variable, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon, and Cogs::EffectsGLES30.

◆ getIOHandler()

virtual IIOHandler * Cogs::IEffects::getIOHandler ( )
inlinevirtual

Gets the external I/O handler.

Reimplemented in Cogs::EffectsCommon.

Definition at line 352 of file IEffects.h.

◆ getSamplerStateBinding()

virtual SamplerStateBindingHandle Cogs::IEffects::getSamplerStateBinding ( EffectHandle  effectHandle,
const StringView name,
const unsigned int  slot 
)
pure virtual

Get a handle to a sampler state object binding, mapping how to bind the sampler state to the given effect.

The name is used to lookup a shader-defined sampler state object if supported. If named sampler states are not supported, the given slot is used to bind the sampler state.

In scenarios where no sampler state usage is defined in the shader, the sampler state object should be bound to a slot with the same number as the texture slot the sampler should be applied to.

Parameters
effectHandleValid handle to an effect.
nameName of the sampler state object as used in shaders in the effect. If not supported by the graphics device, this field is ignored.
slotSlot number to bind the sampler state object to. The slot number is by default used to apply the sampler state when sampling from textures bound with the same slot index. On supported systems this may be remapped in the shaders.
Returns
Handle to the sampler state object binding, InvalidHandle if the operation failed.s

Implemented in Cogs::EffectsWebGPU, Cogs::EffectsCommon, Cogs::EffectsGL20, and Cogs::EffectsGLES30.

◆ getTextureBinding()

virtual TextureBindingHandle Cogs::IEffects::getTextureBinding ( EffectHandle  effectHandle,
const StringView name,
const unsigned int  slot 
)
pure virtual

Get a handle to a texture object binding, mapping how to bind textures to the given effect.

The name is used to lookup how to make textures set using this binding be bound to the shader variable of the same name. The slot number is used to bind the texture if no direct slot is given by the shader.

Parameters
effectHandleValid handle to an effect.
nameName of the texture object as used in shaders in the effect.
slotSlot number to bind the texture object to. If multiple textures are bound to the same effect, the slot numbers must be unique and ranging from zero to the maximum number of texture slots for the graphics device.
Returns
Handle to the texture object binding, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon, Cogs::EffectsGL20, Cogs::EffectsGLES30, and Cogs::EffectsWebGPU.

◆ loadComputeEffect() [1/2]

virtual EffectHandle Cogs::IEffects::loadComputeEffect ( const StringView fileName,
const PreprocessorDefinitions definitions,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load the compute shader with the given file name and create an effect.

Parameters
fileNameFile name of a compute shader.
definitionsA set of preprocessor definitions to apply to the shader source.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsNull, Cogs::EffectsWebGPU, Cogs::EffectsD3D11, Cogs::EffectsD3D12, Cogs::EffectsGL20, Cogs::EffectsGLES30, and Cogs::EffectsVK.

◆ loadComputeEffect() [2/2]

virtual EffectHandle Cogs::IEffects::loadComputeEffect ( const StringView fileName,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load the compute shader with the given file name and create an effect.

Parameters
fileNameFile name of a compute shader.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsNull, Cogs::EffectsWebGPU, Cogs::EffectsD3D11, Cogs::EffectsD3D12, Cogs::EffectsGL20, Cogs::EffectsGLES30, and Cogs::EffectsVK.

◆ loadEffect() [1/4]

virtual EffectHandle Cogs::IEffects::loadEffect ( const EffectDescription description)
pure virtual

Load an effect from the given description.

Parameters
descriptionEffect description.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffect() [2/4]

virtual EffectHandle Cogs::IEffects::loadEffect ( const StringView fileName,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load the given single file effect.

Parameters
fileNameFile name of an effect to load. Must be a valid single file effect (for D3D11 typically .fx file).
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffect() [3/4]

virtual EffectHandle Cogs::IEffects::loadEffect ( const StringView vsFileName,
const StringView psFileName,
const PreprocessorDefinitions definitions,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex and pixel shader files given, applying the given preprocessor definitions to the shaders.

Parameters
vsFileNameFile name for the vertex shader.
psFileNameFile name for the pixel shader.
definitionsA list of preprocessor definitions (key, value pairs) to apply to the shaders before compilation.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffect() [4/4]

virtual EffectHandle Cogs::IEffects::loadEffect ( const StringView vsFileName,
const StringView psFileName,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex and pixel shader files given.

Parameters
vsFileNameFile name for the vertex shader.
psFileNameFile name for the pixel shader.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffectSource() [1/4]

virtual EffectHandle Cogs::IEffects::loadEffectSource ( const StringView vsSource,
const StringView gsSource,
const StringView psSource,
const PreprocessorDefinitions definitions,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex, geometry, and pixel shader sources given, applying the given preprocessor definitions to the shaders.

Parameters
vsSourceSource code for the vertex shader.
gsSourceSource code for the geometry shader.
psSourceSource code for the pixel shader.
definitionsA list of preprocessor definitions (key, value pairs) to apply to the shaders before compilation.
effectFlagsFlags to describe effect source.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffectSource() [2/4]

virtual EffectHandle Cogs::IEffects::loadEffectSource ( const StringView vsSource,
const StringView gsSource,
const StringView psSource,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex, geometry, and pixel shader sources given.

Parameters
vsSourceSource code for the vertex shader.
gsSourceSource code for the geometry shader.
psSourceSource code for the pixel shader.
effectFlagsFlags to describe effect source.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffectSource() [3/4]

virtual EffectHandle Cogs::IEffects::loadEffectSource ( const StringView vsSource,
const StringView psSource,
const PreprocessorDefinitions definitions,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex and pixel shader sources given, applying the given preprocessor definitions to the shaders.

Parameters
vsSourceSource code for the vertex shader.
psSourceSource code for the pixel shader.
definitionsA list of preprocessor definitions (key, value pairs) to apply to the shaders before compilation.
effectFlagsFlags to describe effect source.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ loadEffectSource() [4/4]

virtual EffectHandle Cogs::IEffects::loadEffectSource ( const StringView vsSource,
const StringView psSource,
EffectFlags::EEffectFlags  effectFlags = EffectFlags::None 
)
pure virtual

Load an effect created from the vertex and pixel shader sources given.

Parameters
vsSourceSource code for the vertex shader.
psSourceSource code for the pixel shader.
effectFlagsFlags to describe effect source.
Returns
Handle to the loaded effect, InvalidHandle if the operation failed.

Implemented in Cogs::EffectsCommon.

◆ releaseBufferBinding()

virtual void Cogs::IEffects::releaseBufferBinding ( BufferBindingHandle  bufferBindingHandle)
pure virtual

Release a handle to a buffer binding.

Implemented in Cogs::EffectsCommon, Cogs::EffectsGL20, and Cogs::EffectsWebGPU.

◆ releaseEffect()

virtual void Cogs::IEffects::releaseEffect ( EffectHandle  effectHandle)
pure virtual

Release the effect with the given handle, freeing all resources generated during program loading.

Parameters
effectHandleValid handle to a previously created effect.

Implemented in Cogs::EffectsNull, Cogs::EffectsVK, Cogs::EffectsWebGPU, Cogs::EffectsD3D12, Cogs::EffectsGLES30, Cogs::EffectsD3D11, and Cogs::EffectsGL20.

◆ releaseResources()

virtual void Cogs::IEffects::releaseResources ( )
pure virtual

◆ setIOHandler()

virtual void Cogs::IEffects::setIOHandler ( IIOHandler handler)
pure virtual

Sets an external I/O handler to use for I/O operations.

Parameters
handlerPointer to user implemented I/O handler.

Implemented in Cogs::EffectsCommon.


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