class render::RendererMaterialBase

Base class for all RendererMaterial instances, containing common data and methods.

Public

Methods

~RendererMaterialBase

virtual ~RendererMaterialBase() noexcept = default

Initialize

virtual void Initialize()

Initializes the material.

Use this instead of the constructor to perform any one-time setup before using the material.

GetShader

SPtr<Shader> GetShader() const

Returns the shader used by the material.

GetGpuParameterSet

SPtr<GpuParameterSet> GetGpuParameterSet() const

Returns the internal parameter set containing GPU bindable parameters.

CreateGpuParameterSet

virtual SPtr<GpuParameterSet> CreateGpuParameterSet(u32 set = 0) const = 0

Creates a new instance of GPU parameters for this material.

GetGraphicsPipeline

SPtr<GpuGraphicsPipelineState> GetGraphicsPipeline() const

Returns the material's graphics pipeline state.

This will be null if the material is a compute material.

GetComputePipeline

SPtr<GpuComputePipelineState> GetComputePipeline() const

Returns the material's compute pipeline state.

This will be null if the material is a graphics material.

Bind

void Bind(GpuCommandBuffer &commandBuffer, bool bindParameters = true) const

Binds the materials and its parameters to the pipeline.

This material will be used for rendering any subsequent draw calls, or executing dispatch calls. If is false you need to call BindParameters() separately to bind material parameters (if any).

BindParameters

void BindParameters(GpuCommandBuffer &commandBuffer) const

Binds the material parameters to the pipeline.

Protected

Fields

mGpuParameterSet

SPtr<GpuParameterSet> mGpuParameterSet

mGraphicsPipeline

SPtr<GpuGraphicsPipelineState> mGraphicsPipeline

mComputePipeline

SPtr<GpuComputePipelineState> mComputePipeline

mStencilReferenceValue

u32 mStencilReferenceValue

mVariationParameters

ShaderVariationParameters mVariationParameters

mShader

SPtr<Shader> mShader

mGpuDevice

SPtr<GpuDevice> mGpuDevice