Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngine/interface/InputLayout.h Source File

Diligent Engine API Reference

InputLayout.h
1 /* Copyright 2015-2018 Egor Yusov
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12 *
13 * In no event and under no legal theory, whether in tort (including negligence),
14 * contract, or otherwise, unless required by applicable law (such as deliberate
15 * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16 * liable for any damages, including any direct, indirect, special, incidental,
17 * or consequential damages of any character arising as a result of this License or
18 * out of the use or inability to use the software (including but not limited to damages
19 * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20 * all other commercial damages or losses), even if such Contributor has been advised
21 * of the possibility of such damages.
22 */
23
24 #pragma once
25
28
29 #include "BasicTypes.h"
30
31 namespace Diligent
32 {
33
34 static constexpr Uint32 iMaxLayoutElements = 16;
35
37 struct LayoutElement
38 {
40 Uint32 InputIndex;
41
43 Uint32 BufferSlot;
44
46 Uint32 NumComponents;
47
49 VALUE_TYPE ValueType;
50
56 Bool IsNormalized;
57
62 Uint32 RelativeOffset;
63
65 enum FREQUENCY : Int32
66 {
68 FREQUENCY_UNDEFINED = 0,
69
71 FREQUENCY_PER_VERTEX,
72
74 FREQUENCY_PER_INSTANCE,
75
77 FREQUENCY_NUM_FREQUENCIES
78 }Frequency;
79
82 Uint32 InstanceDataStepRate;
83
85 LayoutElement(Uint32 _InputIndex = 0,
86 Uint32 _BufferSlot = 0,
87 Uint32 _NumComponents = 0,
88 VALUE_TYPE _ValueType = VT_FLOAT32,
89 Bool _IsNormalized = True,
90 Uint32 _RelativeOffset = 0,
91 FREQUENCY _Frequency = FREQUENCY_PER_VERTEX,
92 Uint32 _InstanceDataStepRate = 1) :
93 InputIndex(_InputIndex),
94 BufferSlot(_BufferSlot),
95 NumComponents(_NumComponents),
96 ValueType(_ValueType),
97 IsNormalized(_IsNormalized),
98 RelativeOffset(_RelativeOffset),
99 Frequency(_Frequency),
100 InstanceDataStepRate(_InstanceDataStepRate)
101 {}
102 };
103
105
107 struct InputLayoutDesc
108 {
110 const LayoutElement *LayoutElements;
112 Uint32 NumElements;
113 InputLayoutDesc() :
114 LayoutElements(nullptr),
115 NumElements(0)
116 {}
117 };
118
119 }
Diligent::LayoutElement::NumComponents
Uint32 NumComponents
Number of components in the element. Allowed values are 1, 2, 3, and 4.
Definition: InputLayout.h:46
Diligent::InputLayoutDesc::NumElements
Uint32 NumElements
Number of layout elements.
Definition: InputLayout.h:112
Diligent::LayoutElement::IsNormalized
Bool IsNormalized
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.
Definition: InputLayout.h:56
Diligent::LayoutElement::InputIndex
Uint32 InputIndex
Input index of the element, which is specified in the vertex shader.
Definition: InputLayout.h:40
Diligent
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Diligent::LayoutElement::RelativeOffset
Uint32 RelativeOffset
Relative offset, in bytes, to the element bits. If this value is zero, the offset will be computed au...
Definition: InputLayout.h:62
Diligent::LayoutElement::InstanceDataStepRate
Uint32 InstanceDataStepRate
The number of instances to draw using the same per-instance data before advancing in the buffer by on...
Definition: InputLayout.h:82
Diligent::InputLayoutDesc::LayoutElements
const LayoutElement * LayoutElements
Array of layout elements.
Definition: InputLayout.h:110
Diligent::LayoutElement
Description of a single element of the input layout.
Definition: InputLayout.h:37
Diligent::InputLayoutDesc
Layout description.
Definition: InputLayout.h:107
Diligent::LayoutElement::FREQUENCY
FREQUENCY
Input frequency.
Definition: InputLayout.h:65
Diligent::VALUE_TYPE
VALUE_TYPE
Value type.
Definition: GraphicsTypes.h:39
Diligent::LayoutElement::FREQUENCY_UNDEFINED
Frequency is undefined.
Definition: InputLayout.h:68
Diligent::LayoutElement::BufferSlot
Uint32 BufferSlot
Buffer slot index that this element is read from.
Definition: InputLayout.h:43
Diligent::LayoutElement::FREQUENCY_PER_INSTANCE
Input data is per-instance data.
Definition: InputLayout.h:74
Diligent::VT_FLOAT32
Full-precision 32-bit floating point.
Definition: GraphicsTypes.h:49
Diligent::LayoutElement::LayoutElement
LayoutElement(Uint32 _InputIndex=0, Uint32 _BufferSlot=0, Uint32 _NumComponents=0, VALUE_TYPE _ValueType=VT_FLOAT32, Bool _IsNormalized=True, Uint32 _RelativeOffset=0, FREQUENCY _Frequency=FREQUENCY_PER_VERTEX, Uint32 _InstanceDataStepRate=1)
Initializes the structure.
Definition: InputLayout.h:85
Diligent::LayoutElement::FREQUENCY_PER_VERTEX
Input data is per-vertex data.
Definition: InputLayout.h:71
Diligent::LayoutElement::ValueType
VALUE_TYPE ValueType
Type of the element components, see Diligent::VALUE_TYPE for details.
Definition: InputLayout.h:49
Diligent::LayoutElement::FREQUENCY_NUM_FREQUENCIES
Helper value that stores the total number of frequencies in the enumeration.
Definition: InputLayout.h:77