#include <WEffect.hpp>
|
virtual std::string | GetTypeName () const override |
|
virtual void | SetID (uint32_t newID) override |
|
virtual void | SetName (std::string newName) override |
|
| WEffect (class Wasabi *const app, uint32_t ID=0) |
|
WError | BindShader (WShader *shader) |
|
WError | UnbindShader (W_SHADER_TYPE type) |
|
void | SetPrimitiveTopology (VkPrimitiveTopology topology) |
|
void | SetBlendingState (VkPipelineColorBlendAttachmentState state) |
|
void | SetBlendingStates (vector< VkPipelineColorBlendAttachmentState > states) |
|
void | SetDepthStencilState (VkPipelineDepthStencilStateCreateInfo state) |
|
void | SetRasterizationState (VkPipelineRasterizationStateCreateInfo state) |
|
WError | BuildPipeline (class WRenderTarget *rt) |
|
WError | Bind (class WRenderTarget *rt) |
|
void | SetRenderFlags (W_EFFECT_RENDER_FLAGS flags) |
|
W_EFFECT_RENDER_FLAGS | GetRenderFlags () const |
|
class WMaterial * | CreateMaterial (uint32_t bindingSet=0, bool isPerFrame=false) |
|
VkPipelineLayout | GetPipelineLayout () const |
|
VkDescriptorSetLayout | GetDescriptorSetLayout (uint32_t setIndex=0) const |
|
W_INPUT_LAYOUT | GetInputLayout (uint32_t layout_index=0) const |
|
size_t | GetInputLayoutSize (uint32_t layout_index=0) const |
|
virtual bool | Valid () const override |
|
virtual WError | SaveToStream (WFile *file, std::ostream &outputStream) override |
|
virtual WError | LoadFromStream (WFile *file, std::istream &inputStream, std::vector< void * > &args, std::string nameSuffix) override |
|
| WFileAsset (class Wasabi *const app, uint32_t ID=0) |
|
virtual WError | LoadFromStream (class WFile *file, std::istream &inputStream, vector< void * > &args, std::string nameSuffix)=0 |
|
| WBase (class Wasabi *const app, uint32_t ID=0) |
|
uint32_t | GetID () const |
|
std::string | GetName () const |
|
class Wasabi * | GetAppPtr () const |
|
void | AddReference () |
|
void | RemoveReference () |
|
A WEffect is a container for shaders, rendering states, and the Vulkan graphics (or compute) pipeline. An effect specifies how rendering of geometry is to be done. More generally, an effect controls all stages of a Vulkan pipeline.
Example:
◆ _GetTypeName()
static std::string WEffect::_GetTypeName |
( |
| ) |
|
|
static |
Returns "Effect" string.
- Returns
- Returns "Effect" string
◆ Bind()
Binds the effect (pipeline) to render command buffer of the specified render target. The render target must have its Begin() function called before this function is called. Binding an effect means binding all descriptor sets of all specified materials and binding the effect's pipeline.
- Parameters
-
rt | Render target to bind to its command buffer |
- Returns
- Error code, see WError.h
◆ BindShader()
Binds a shader to this effect.
- Parameters
-
- Returns
- Error code, see WError.h
◆ BuildPipeline()
Builds Vulkan pipelines corresponding to the currently bound shaders and Vulkan states. This function will build several pipelines for different numbers of input layout supplied by the shaders. For instance, a shader with two input layouts will have two pipelines, one that only uses one input layout and another that uses both. This is done to provide convenience when one wishes to use the same effect without supplying all required vertex shaders.
- Parameters
-
rt | Render target that the effect plans on rendering to |
- Returns
- Error code, see WError.h
◆ CreateMaterial()
class WMaterial* WEffect::CreateMaterial |
( |
uint32_t |
bindingSet = 0 , |
|
|
bool |
isPerFrame = false |
|
) |
| |
Allocates a new material for this effect.
- Parameters
-
bindingSet | The binding set to use from this effect |
isPerFrame | If set to true, this material will be bound to the pipeline automatically every time this effect is bound |
- Returns
- Newly allocated and initialized material
◆ GetDescriptorSetLayout()
VkDescriptorSetLayout WEffect::GetDescriptorSetLayout |
( |
uint32_t |
setIndex = 0 | ) |
const |
Retrieves the Vulkan descriptor set layout.
- Parameters
-
Index | of the specified set |
- Returns
- The Vulkan descriptor set layout
◆ GetInputLayout()
W_INPUT_LAYOUT WEffect::GetInputLayout |
( |
uint32_t |
layout_index = 0 | ) |
const |
Retrieves an input layout supplied by one of the bound shaders.
- Parameters
-
layout_index | Index of the layout requested |
- Returns
- The input layout at layout_index supplied by bound shaders
◆ GetInputLayoutSize()
size_t WEffect::GetInputLayoutSize |
( |
uint32_t |
layout_index = 0 | ) |
const |
Retrieves the size of the input layout at the given index.
- Parameters
-
layout_index | Index of the layout requested |
- Returns
- The size of the input layout at the given index
◆ GetPipelineLayout()
VkPipelineLayout WEffect::GetPipelineLayout |
( |
| ) |
const |
Retrieves the layout of the pipelines created by this effect.
- Returns
- The Vulkan pipeline layout for the effect's pipelines
◆ GetRenderFlags()
◆ GetTypeName()
virtual std::string WEffect::GetTypeName |
( |
| ) |
const |
|
overridevirtual |
This function must be implemented by a child class. This is used for debugging, in which a class should return its name.
- Returns
- The name of the class
Implements WBase.
◆ SetBlendingState()
void WEffect::SetBlendingState |
( |
VkPipelineColorBlendAttachmentState |
state | ) |
|
Sets the blending state in the Vulkan pipeline. This needs to be called before BuildPipeline() for changes to be effective.
- Parameters
-
state | The new Vulkan Blend state |
◆ SetBlendingStates()
void WEffect::SetBlendingStates |
( |
vector< VkPipelineColorBlendAttachmentState > |
states | ) |
|
Sets multiple blending states in the Vulkan pipeline. Multiple blend states are used when the render target has multiple output attachments. This needs to be called before BuildPipeline() for changes to be effective.
- Parameters
-
state | The new Vulkan Blend state |
◆ SetDepthStencilState()
void WEffect::SetDepthStencilState |
( |
VkPipelineDepthStencilStateCreateInfo |
state | ) |
|
Sets the depth stencil state in the Vulkan pipeline. This needs to be called before BuildPipeline() for changes to be effective.
- Parameters
-
state | The new Vulkan depth stencil state |
◆ SetID()
virtual void WEffect::SetID |
( |
uint32_t |
newID | ) |
|
|
overridevirtual |
Sets the ID of this object and notifies its manager.
- Parameters
-
Implements WBase.
◆ SetName()
virtual void WEffect::SetName |
( |
std::string |
newName | ) |
|
|
overridevirtual |
Sets the name of this object.
- Parameters
-
name | New name for the object |
Implements WBase.
◆ SetPrimitiveTopology()
void WEffect::SetPrimitiveTopology |
( |
VkPrimitiveTopology |
topology | ) |
|
Sets the primitive topology in the Vulkan pipeline. This needs to be called before BuildPipeline() for changes to be effective.
- Parameters
-
topology | The new Vulkan primitive topology |
◆ SetRasterizationState()
void WEffect::SetRasterizationState |
( |
VkPipelineRasterizationStateCreateInfo |
state | ) |
|
Sets the rasterization state in the Vulkan pipeline. This needs to be called before BuildPipeline() for changes to be effective.
- Parameters
-
state | The new Vulkan rasterization state |
◆ SetRenderFlags()
Sets the render flags of this effect. Render flags is a bitfield of type W_EFFECT_RENDER_FLAGS that specifies various preperties about the rendering of the effect, such as which stage it should render in.
- Parameters
-
◆ UnbindShader()
Unbinds a shader from this effect.
- Parameters
-
type | The type of the shader to unbind |
- Returns
- Error code, see WError.h
◆ Valid()
virtual bool WEffect::Valid |
( |
| ) |
const |
|
overridevirtual |
Checks the validity of the effect. An effect is valid if it has at least one pipeline created and has a bound vertex shader that supplies a valid input layout.
- Returns
- true if the effect is valid, false otherwise
Implements WBase.
The documentation for this class was generated from the following file: