Cogs.Core
|
Public Member Functions | |
void | initialize (GraphicsDeviceWebGPU *device, IBuffers *buffers) |
virtual void | releaseEffect (EffectHandle effectHandle) override |
Release the effect with the given handle, freeing all resources generated during program loading. | |
virtual void | releaseResources () override |
Release all allocated effect resources. | |
virtual void | annotate (EffectHandle, const StringView &) override |
Associate a name with an object for use in graphics debugging. | |
virtual void | annotateVS (EffectHandle, const StringView &) override |
Associate a name with an object for use in graphics debugging. | |
virtual void | annotateGS (EffectHandle, const StringView &) override |
Associate a name with an object for use in graphics debugging. | |
virtual void | annotatePS (EffectHandle, const StringView &) override |
Associate a name with an object for use in graphics debugging. | |
virtual void | annotateCS (EffectHandle, const StringView &) override |
Associate a name with an object for use in graphics debugging. | |
virtual EffectHandle | loadComputeEffect (const StringView &, EffectFlags::EEffectFlags) override |
Load the compute shader with the given file name and create an effect. | |
virtual EffectHandle | loadComputeEffect (const StringView &, const PreprocessorDefinitions &, EffectFlags::EEffectFlags) override |
Load the compute shader with the given file name and create an effect. | |
virtual EffectHandle | load (const ProcessedContent &, const ProcessedContent &, const ProcessedContent &, const ProcessedContent &, const ProcessedContent &, const StringView &, const StringView &, const StringView &, const StringView &, const StringView &, const EffectDescription &) override |
ConstantBufferBindingHandle | getConstantBufferBinding (EffectHandle effectHandle, const StringView &name) override |
Get a handle to a constant buffer binding, mapping how to bind a constant buffer to the given effect. | |
BufferBindingHandle | getBufferBinding (EffectHandle effectHandle, const StringView &name) override |
Get a handle to a buffer binding. | |
void | releaseBufferBinding (BufferBindingHandle) override |
Release a handle to a buffer binding. | |
TextureBindingHandle | getTextureBinding (EffectHandle effectHandle, const StringView &name, const unsigned int slot) override |
Get a handle to a texture object binding, mapping how to bind textures to the given effect. | |
SamplerStateBindingHandle | getSamplerStateBinding (EffectHandle effectHandle, const StringView &, const unsigned int slot) override |
Get a handle to a sampler state object binding, mapping how to bind the sampler state to the given effect. | |
bool | addConstantBufferBindings (EffectWebGPU &effect, const std::vector< Cogs::WebGPUConstantBufferBinding > &bindings) |
const WebGPUConstantBufferBinding * | getConstantBufferBindings (EffectHandle effectHandle, size_t &num_bindings) |
![]() | |
EffectHandle | loadEffect (const EffectDescription &description) final |
Load an effect from the given description. | |
EffectHandle | loadEffectSource (const EffectDescription &description) |
EffectHandle | loadEffectContents (const EffectDescription &description, const EffectContents &contents) |
EffectHandle | loadEffect (const StringView &fileName, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load the given single file effect. | |
EffectHandle | loadEffect (const StringView &fileName, const PreprocessorDefinitions &defines, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) |
EffectHandle | loadEffect (const StringView &vsFileName, const StringView &psFileName, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex and pixel shader files given. | |
EffectHandle | loadEffect (const StringView &vsFileName, const StringView &psFileName, const PreprocessorDefinitions &defines, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex and pixel shader files given, applying the given preprocessor definitions to the shaders. | |
EffectHandle | loadEffectSource (const StringView &vsSource, const StringView &psSource, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex and pixel shader sources given. | |
EffectHandle | loadEffectSource (const StringView &vsSource, const StringView &psSource, const PreprocessorDefinitions &defines, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex and pixel shader sources given, applying the given preprocessor definitions to the shaders. | |
EffectHandle | loadEffectSource (const StringView &vsSource, const StringView &gsSource, const StringView &psSource, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex, geometry, and pixel shader sources given. | |
EffectHandle | loadEffectSource (const StringView &vsSource, const StringView &gsSource, const StringView &psSource, const PreprocessorDefinitions &defines, EffectFlags::EEffectFlags effectFlags=EffectFlags::None) final |
Load an effect created from the vertex, geometry, and pixel shader sources given, applying the given preprocessor definitions to the shaders. | |
EffectVariableHandle | getEffectVariable (EffectHandle effectHandle, const StringView &name) override |
Get a handle to the variable with the given name in the effect with the given effectHandle. | |
ConstantBufferBindingHandle | getConstantBufferBinding (EffectHandle effectHandle, const StringView &name) override |
Get a handle to a constant buffer binding, mapping how to bind a constant buffer to the given effect. | |
TextureBindingHandle | getTextureBinding (EffectHandle effectHandle, const StringView &name, const unsigned int slot) override |
Get a handle to a texture object binding, mapping how to bind textures to the given effect. | |
SamplerStateBindingHandle | getSamplerStateBinding (EffectHandle effectHandle, const StringView &name, const unsigned int slot) override |
Get a handle to a sampler state object binding, mapping how to bind the sampler state to the given effect. | |
BufferBindingHandle | getBufferBinding (EffectHandle effectHandle, const StringView &name) override |
Get a handle to a buffer binding. | |
void | releaseBufferBinding (BufferBindingHandle bufferBindingHandle) override |
Release a handle to a buffer binding. | |
void | setIOHandler (IIOHandler *handler) override |
Sets an external I/O handler to use for I/O operations. | |
IIOHandler * | getIOHandler () override |
Gets the external I/O handler. | |
EffectHandle | load (const ProcessedContent &vsSource, const ProcessedContent &psSource, const StringView &vsEntryPoint, const StringView &psEntryPoint, const EffectDescription &desc) |
EffectHandle | load (const ProcessedContent &vsSource, const ProcessedContent &gsSource, const ProcessedContent &psSource, const StringView &vsEntryPoint, const StringView &gsEntryPoint, const StringView &psEntryPoint, const EffectDescription &desc) |
virtual EffectHandle | load (const ProcessedContent &vsSource, const ProcessedContent &hsSource, const ProcessedContent &dsSource, const ProcessedContent &gsSource, const ProcessedContent &psSource, const StringView &vsEntryPoint, const StringView &hsEntryPoint, const StringView &dsEntryPoint, const StringView &gsEntryPoint, const StringView &psEntryPoint, const EffectDescription &desc)=0 |
void | initialize (struct IBuffers *buffers) |
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 IIOHandler * | getIOHandler () |
Gets the external I/O handler. | |
Public Attributes | |
GraphicsDeviceWebGPU * | graphicsDevice = nullptr |
SafeResourceMap< EffectHandle, EffectWebGPU > | effects |
![]() | |
SafeResourceMap< EffectHandle, Effect > | effects |
ResourceMap< BufferBindingHandle, BufferBinding > | bufferBindings |
IIOHandler * | handler = nullptr |
std::unique_ptr< IIOHandler > | defaultHandler |
struct IBuffers * | buffers = nullptr |
Definition at line 52 of file EffectsWebGPU.h.
bool Cogs::EffectsWebGPU::addConstantBufferBindings | ( | EffectWebGPU & | effect, |
const std::vector< Cogs::WebGPUConstantBufferBinding > & | bindings | ||
) |
Definition at line 614 of file EffectsWebGPU.cpp.
|
inlineoverridevirtual |
Associate a name with an object for use in graphics debugging.
Reimplemented from Cogs::IEffects.
Definition at line 60 of file EffectsWebGPU.h.
|
inlineoverridevirtual |
Associate a name with an object for use in graphics debugging.
Reimplemented from Cogs::IEffects.
Definition at line 64 of file EffectsWebGPU.h.
|
inlineoverridevirtual |
Associate a name with an object for use in graphics debugging.
Reimplemented from Cogs::IEffects.
Definition at line 62 of file EffectsWebGPU.h.
|
inlineoverridevirtual |
Associate a name with an object for use in graphics debugging.
Reimplemented from Cogs::IEffects.
Definition at line 63 of file EffectsWebGPU.h.
|
inlineoverridevirtual |
Associate a name with an object for use in graphics debugging.
Reimplemented from Cogs::IEffects.
Definition at line 61 of file EffectsWebGPU.h.
|
overridevirtual |
Get a handle to a buffer binding.
Reimplemented from Cogs::EffectsCommon.
Definition at line 605 of file EffectsWebGPU.cpp.
References getConstantBufferBinding(), Cogs::Handle_t< Type, Convertible >::handle, and Cogs::Handle_t< Type, Convertible >::NoHandle.
Referenced by Cogs::ContextWebGPU::setBuffer().
|
overridevirtual |
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.
effectHandle | Valid handle to an effect. |
name | Name of the constant buffer as used in shaders. |
Reimplemented from Cogs::EffectsCommon.
Definition at line 591 of file EffectsWebGPU.cpp.
References Cogs::hash(), and Cogs::Handle_t< ConstantBufferBindingTag >::NoHandle.
Referenced by getBufferBinding(), getSamplerStateBinding(), and getTextureBinding().
const WebGPUConstantBufferBinding * Cogs::EffectsWebGPU::getConstantBufferBindings | ( | EffectHandle | effectHandle, |
size_t & | num_bindings | ||
) |
Definition at line 645 of file EffectsWebGPU.cpp.
|
overridevirtual |
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.
effectHandle | Valid handle to an effect. |
name | Name of the sampler state object as used in shaders in the effect. If not supported by the graphics device, this field is ignored. |
slot | Slot 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. |
Reimplemented from Cogs::EffectsCommon.
Definition at line 660 of file EffectsWebGPU.cpp.
References getConstantBufferBinding(), getSamplerStateBinding(), Cogs::Handle_t< Type, Convertible >::handle, and Cogs::Handle_t< SamplerStateBindingTag >::NoHandle.
Referenced by getSamplerStateBinding().
|
overridevirtual |
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.
effectHandle | Valid handle to an effect. |
name | Name of the texture object as used in shaders in the effect. |
slot | Slot 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. |
Reimplemented from Cogs::EffectsCommon.
Definition at line 651 of file EffectsWebGPU.cpp.
References getConstantBufferBinding(), Cogs::Handle_t< Type, Convertible >::handle, and Cogs::Handle_t< TextureBindingTag >::NoHandle.
void Cogs::EffectsWebGPU::initialize | ( | GraphicsDeviceWebGPU * | device, |
IBuffers * | buffers | ||
) |
Definition at line 430 of file EffectsWebGPU.cpp.
|
overridevirtual |
Implements Cogs::EffectsCommon.
Definition at line 497 of file EffectsWebGPU.cpp.
|
overridevirtual |
Load the compute shader with the given file name and create an effect.
fileName | File name of a compute shader. |
definitions | A set of preprocessor definitions to apply to the shader source. |
Implements Cogs::IEffects.
Definition at line 455 of file EffectsWebGPU.cpp.
References Cogs::EffectFlags::LogShaderSource.
|
overridevirtual |
Load the compute shader with the given file name and create an effect.
fileName | File name of a compute shader. |
Implements Cogs::IEffects.
Definition at line 449 of file EffectsWebGPU.cpp.
References loadComputeEffect().
Referenced by loadComputeEffect().
|
inlineoverridevirtual |
Release a handle to a buffer binding.
Reimplemented from Cogs::EffectsCommon.
Definition at line 84 of file EffectsWebGPU.h.
Referenced by Cogs::ContextWebGPU::setBuffer().
|
overridevirtual |
Release the effect with the given handle, freeing all resources generated during program loading.
effectHandle | Valid handle to a previously created effect. |
Implements Cogs::IEffects.
Definition at line 440 of file EffectsWebGPU.cpp.
|
overridevirtual |
Release all allocated effect resources.
Implements Cogs::IEffects.
Definition at line 436 of file EffectsWebGPU.cpp.
Referenced by Cogs::GraphicsDeviceWebGPU::releaseResources().
SafeResourceMap<EffectHandle, EffectWebGPU> Cogs::EffectsWebGPU::effects |
Definition at line 95 of file EffectsWebGPU.h.
GraphicsDeviceWebGPU* Cogs::EffectsWebGPU::graphicsDevice = nullptr |
Definition at line 93 of file EffectsWebGPU.h.