Class GPUVertexLayout
Defines input layout of vertex buffer data passed to the Vertex Shader.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/Shaders/GPUVertexLayout.h
Syntax
public class GPUVertexLayout : public GPUResource
Constructors
GPUVertexLayout()
Declaration
protected GPUVertexLayout()
Methods
FindElement(VertexElement::Types type)
Searches for a given element type in a layout.
Declaration
public VertexElement FindElement(VertexElement::Types type) const
Parameters
VertexElement::Types
type
The type of element to find. |
Returns
VertexElement
Found element with properties or empty if missing. |
Get(const Array<VertexElement, FixedAllocation<GPU_MAX_VS_ELEMENTS>>& elements, bool explicitOffsets=false)
Gets the vertex layout for a given list of elements. Uses internal cache to skip creating layout if it's already exists for a given list.
Declaration
public static GPUVertexLayout* Get(const Array<VertexElement, FixedAllocation<GPU_MAX_VS_ELEMENTS>>& elements, bool explicitOffsets=false)
Parameters
Array<VertexElement, FixedAllocation<GPU_MAX_VS_ELEMENTS>>
elements
The list of elements for the layout. |
bool
explicitOffsets
If set to true, input elements offsets will be used without automatic calculations (offsets with value 0). |
Returns
GPUVertexLayout
Vertex layout object. Doesn't need to be cleared as it's cached for an application lifetime. |
Get(const Span<GPUBuffer* >& vertexBuffers)
Gets the vertex layout for a given list of vertex buffers (sequence of binding slots based on layouts set on those buffers). Uses internal cache to skip creating layout if it's already exists for a given list.
Declaration
public static GPUVertexLayout* Get(const Span<GPUBuffer* >& vertexBuffers)
Parameters
Span<GPUBuffer >
vertexBuffers
The list of vertex buffers for the layout. |
Returns
GPUVertexLayout
Vertex layout object. Doesn't need to be cleared as it's cached for an application lifetime. |
Get(const Span<GPUVertexLayout* >& layouts)
Merges list of layouts in a single one. Uses internal cache to skip creating layout if it's already exists for a given list.
Declaration
public static GPUVertexLayout* Get(const Span<GPUVertexLayout* >& layouts)
Parameters
Span<GPUVertexLayout >
layouts
The list of layouts to merge. |
Returns
GPUVertexLayout
Vertex layout object. Doesn't need to be cleared as it's cached for an application lifetime. |
GetElements()
Gets the list of elements used by this layout.
Declaration
public Array<VertexElement, FixedAllocation<GPU_MAX_VS_ELEMENTS>> GetElements() const
Returns
Array<VertexElement, FixedAllocation<GPU_MAX_VS_ELEMENTS>>
|
GetElementsString()
Gets the list of elements used by this layout as a text (each element in a new line).
Declaration
public String GetElementsString() const
Returns
String
|
GetResourceType()
Gets the GPU resource type.
Declaration
public virtual GPUResourceType GetResourceType() const override
Returns
GPUResourceType
|
Overrides
GetStride()
Gets the size in bytes of all elements in the layout structure (including their offsets).
Declaration
public uint32 GetStride() const
Returns
uint32
|
Merge(GPUVertexLayout* base, GPUVertexLayout* reference, bool removeUnused=false, bool addMissing=true, int32 missingSlotOverride=-1)
Merges reference vertex elements into the given set of elements to ensure the reference list is satisfied (vertex shader input requirement). Returns base layout if it's valid.
Declaration
public static GPUVertexLayout* Merge(GPUVertexLayout* base, GPUVertexLayout* reference, bool removeUnused=false, bool addMissing=true, int32 missingSlotOverride=-1)
Parameters
GPUVertexLayout
base
The list of vertex buffers for the layout. |
GPUVertexLayout
reference
The list of reference inputs. |
bool
removeUnused
True to remove elements from base layout that don't exist in a reference layout. |
bool
addMissing
True to add missing elements to base layout that exist in a reference layout. |
int32
missingSlotOverride
Allows to override the input slot for missing elements. Use value -1 to inherit slot from the reference layout. |
Returns
GPUVertexLayout
Vertex layout object. Doesn't need to be cleared as it's cached for an application lifetime. |
SetElements(const Elements& elements, bool explicitOffsets)
Declaration
protected void SetElements(const Elements& elements, bool explicitOffsets)
Parameters
Elements
elements
|
bool
explicitOffsets
|