Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::LayoutElement Struct Reference

Description of a single element of the input layout. More...

#include <InputLayout.h>

Public Member Functions

constexpr LayoutElement (Uint32 _InputIndex, Uint32 _BufferSlot, Uint32 _NumComponents, VALUE_TYPE _ValueType, Bool _IsNormalized=LayoutElement{}.IsNormalized, Uint32 _RelativeOffset=LayoutElement{}.RelativeOffset, Uint32 _Stride=LayoutElement{}.Stride, INPUT_ELEMENT_FREQUENCY _Frequency=LayoutElement{}.Frequency, Uint32 _InstanceDataStepRate=LayoutElement{}.InstanceDataStepRate) noexcept
 Initializes the structure.
 
constexpr LayoutElement (const Char *_HLSLSemantic, Uint32 _InputIndex, Uint32 _BufferSlot, Uint32 _NumComponents, VALUE_TYPE _ValueType, Bool _IsNormalized=LayoutElement{}.IsNormalized, Uint32 _RelativeOffset=LayoutElement{}.RelativeOffset, Uint32 _Stride=LayoutElement{}.Stride, INPUT_ELEMENT_FREQUENCY _Frequency=LayoutElement{}.Frequency, Uint32 _InstanceDataStepRate=LayoutElement{}.InstanceDataStepRate) noexcept
 Initializes the structure.
 
constexpr LayoutElement (Uint32 _InputIndex, Uint32 _BufferSlot, Uint32 _NumComponents, VALUE_TYPE _ValueType, Bool _IsNormalized, INPUT_ELEMENT_FREQUENCY _Frequency, Uint32 _InstanceDataStepRate=LayoutElement{}.InstanceDataStepRate) noexcept
 Initializes the structure.
 

Public Attributes

const Char * HLSLSemantic = "ATTRIB"
 HLSL semantic.
 
Uint32 InputIndex = 0
 Input index of the element that is specified in the vertex shader.
 
Uint32 BufferSlot = 0
 Buffer slot index that this element is read from.
 
Uint32 NumComponents = 0
 Number of components in the element. Allowed values are 1, 2, 3, and 4.
 
VALUE_TYPE ValueType = VT_FLOAT32
 Type of the element components, see Diligent::VALUE_TYPE for details.
 
Bool IsNormalized = True
 Indicates if the value should be normalized.
 
Uint32 RelativeOffset = LAYOUT_ELEMENT_AUTO_OFFSET
 Relative offset, in bytes, to the element bits.
 
Uint32 Stride = LAYOUT_ELEMENT_AUTO_STRIDE
 Stride, in bytes, between two elements, for this buffer slot.
 
INPUT_ELEMENT_FREQUENCY Frequency = INPUT_ELEMENT_FREQUENCY_PER_VERTEX
 Frequency of the input data, see Diligent::INPUT_ELEMENT_FREQUENCY for details.
 
Uint32 InstanceDataStepRate = 1
 

Detailed Description

Description of a single element of the input layout.

Member Data Documentation

◆ HLSLSemantic

const Char* Diligent::LayoutElement::HLSLSemantic = "ATTRIB"

HLSL semantic.

Default value ("ATTRIB") allows HLSL shaders to be converted to GLSL and used in OpenGL backend as well as compiled to SPIRV and used in Vulkan backend. Any value other than default will only work in Direct3D11 and Direct3D12 backends.

◆ InputIndex

Uint32 Diligent::LayoutElement::InputIndex = 0

Input index of the element that is specified in the vertex shader.

In Direct3D11 and Direct3D12 backends this is the semantic index.

◆ InstanceDataStepRate

Uint32 Diligent::LayoutElement::InstanceDataStepRate = 1

The number of instances to draw using the same per-instance data before advancing in the buffer by one element.

◆ IsNormalized

Bool Diligent::LayoutElement::IsNormalized = True

Indicates if the value should be normalized.

For signed and unsigned integer value types (VT_INT8, VT_INT16, VT_INT32, VT_UINT8, VT_UINT16, VT_UINT32) indicates if the value should be normalized to [-1,+1] or [0, 1] range respectively.

For floating point types (VT_FLOAT16 and VT_FLOAT32), this member is ignored.

◆ RelativeOffset

Uint32 Diligent::LayoutElement::RelativeOffset = LAYOUT_ELEMENT_AUTO_OFFSET

Relative offset, in bytes, to the element bits.

If this value is set to LAYOUT_ELEMENT_AUTO_OFFSET (default value), the offset will be computed automatically by placing the element right after the previous one.

◆ Stride

Uint32 Diligent::LayoutElement::Stride = LAYOUT_ELEMENT_AUTO_STRIDE

Stride, in bytes, between two elements, for this buffer slot.

If this value is set to LAYOUT_ELEMENT_AUTO_STRIDE, the stride will be computed automatically assuming that all elements in the same buffer slot are packed one after another. If the buffer slot contains multiple layout elements, they all must specify the same stride or use LAYOUT_ELEMENT_AUTO_STRIDE value.