#include <material.h>
Public Member Functions | |
| ComputeMaterial (Core &core) | |
| virtual bool | init (utility::ErrorState &errorState) override |
| const ComputeShader & | getShader () const |
| glm::uvec3 | getWorkGroupSize () const |
Public Member Functions inherited from BaseMaterial | |
| BaseMaterial (Core &core) | |
| virtual | ~BaseMaterial ()=default |
| const BaseShader & | getShader () const |
Public Member Functions inherited from Resource | |
| Resource () | |
Public Member Functions inherited from Object | |
| Object () | |
| virtual | ~Object () |
| virtual void | onDestroy () |
| Object (Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object &&)=delete | |
| Object & | operator= (Object &&)=delete |
Public Member Functions inherited from UniformContainer | |
| UniformContainer ()=default | |
| virtual | ~UniformContainer ()=default |
| UniformContainer (const UniformContainer &)=delete | |
| UniformContainer & | operator= (const UniformContainer &)=delete |
| UniformStructInstance * | findUniform (const std::string &name) const |
| SamplerInstance * | findSampler (const std::string &name) const |
| BufferBindingInstance * | findBinding (const std::string &name) const |
| ShaderConstantInstance * | findConstant (const std::string &name) const |
| const SamplerInstanceList & | getSamplers () const |
| const BufferBindingInstanceList & | getBufferBindings () const |
| const ShaderConstantInstanceList & | getConstants () const |
| const UniformStructInstanceList & | getUniformStructs () const |
Public Attributes | |
| ResourcePtr< ComputeShader > | mShader = nullptr |
| Property: 'Shader' The compute shader that this material is using. More... | |
Public Attributes inherited from BaseMaterial | |
| std::vector< ResourcePtr< UniformStruct > > | mUniforms |
| Property: 'Uniforms' Static uniforms (as read from file, or as set in code before calling init()) More... | |
| std::vector< ResourcePtr< BufferBinding > > | mBuffers |
| Property: 'Buffers' Static buffer bindings (as read from file, or as set in code before calling init()) More... | |
| std::vector< ResourcePtr< Sampler > > | mSamplers |
| Property: 'Samplers' Static samplers (as read from file, or as set in code before calling init()) More... | |
| std::vector< ResourcePtr< ShaderConstant > > | mConstants |
| Property: 'Constants' Static constants (as read from file, or as set in code before calling init()) More... | |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
Public Types inherited from UniformContainer | |
| using | UniformStructInstanceList = std::vector< std::unique_ptr< UniformStructInstance > > |
| using | BufferBindingInstanceList = std::vector< std::unique_ptr< BufferBindingInstance > > |
| using | SamplerInstanceList = std::vector< std::unique_ptr< SamplerInstance > > |
| using | ShaderConstantInstanceList = std::vector< std::unique_ptr< ShaderConstantInstance > > |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Protected Member Functions inherited from BaseMaterial | |
| bool | rebuild (const BaseShader &shader, utility::ErrorState &errorState) |
Protected Member Functions inherited from UniformContainer | |
| UniformStructInstance & | createUniformRootStruct (const ShaderVariableStructDeclaration &declaration, const UniformCreatedCallback &uniformCreatedCallback) |
| BufferBindingInstance & | addBindingInstance (std::unique_ptr< BufferBindingInstance > instance) |
| SamplerInstance & | addSamplerInstance (std::unique_ptr< SamplerInstance > instance) |
| ShaderConstantInstance & | addConstantInstance (std::unique_ptr< ShaderConstantInstance > instance) |
Resource that acts as the main interface to a compute shader. Controls how GPU buffers are bound to shader inputs. It also creates and holds a set of uniform struct instances, matching those exposed by the shader. If a uniform exposed by this material is updated, all the objects rendered using this material will use that same value, unless overridden by a nap::ComputeMaterialInstance.
Unlike nap::Material, does not expose vertex attribute buffer bindings (or blend/depth modes). It is still possible to access a nap::VertexBuffer<T> in a compute shader through a nap::BufferBinding. This way, mesh data can remain static on the GPU, while being mutable in a compute shader.
| ComputeMaterial | ( | Core & | core | ) |
| core | the core instance |
| const ComputeShader& getShader | ( | ) | const |
| glm::uvec3 getWorkGroupSize | ( | ) | const |
|
overridevirtual |
Initializes the compute material. Validates and converts all the declared shader variables into instances and sets up the vertex buffer bindings.
| errorState | contains the error if initialization fails. |
Reimplemented from Object.
| ResourcePtr<ComputeShader> mShader = nullptr |
Property: 'Shader' The compute shader that this material is using.