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 
38 {
40  Uint32 InputIndex;
41 
43  Uint32 BufferSlot;
44 
46  Uint32 NumComponents;
47 
50 
57 
63 
65  enum FREQUENCY : Int32
66  {
69 
72 
75 
78  }Frequency;
79 
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 
108 {
112  Uint32 NumElements;
113  InputLayoutDesc() :
114  LayoutElements(nullptr),
115  NumElements(0)
116  {}
117 };
118 
119 }
Uint32 NumComponents
Number of components in the element. Allowed values are 1, 2, 3, and 4.
Definition: InputLayout.h:46
Uint32 NumElements
Number of layout elements.
Definition: InputLayout.h:112
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
Uint32 InputIndex
Input index of the element, which is specified in the vertex shader.
Definition: InputLayout.h:40
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
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
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
const LayoutElement * LayoutElements
Array of layout elements.
Definition: InputLayout.h:110
Description of a single element of the input layout.
Definition: InputLayout.h:37
Layout description.
Definition: InputLayout.h:107
FREQUENCY
Input frequency.
Definition: InputLayout.h:65
VALUE_TYPE
Value type.
Definition: GraphicsTypes.h:39
Frequency is undefined.
Definition: InputLayout.h:68
Uint32 BufferSlot
Buffer slot index that this element is read from.
Definition: InputLayout.h:43
Input data is per-instance data.
Definition: InputLayout.h:74
Full-precision 32-bit floating point.
Definition: GraphicsTypes.h:49
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
Input data is per-vertex data.
Definition: InputLayout.h:71
VALUE_TYPE ValueType
Type of the element components, see Diligent::VALUE_TYPE for details.
Definition: InputLayout.h:49
Helper value that stores the total number of frequencies in the enumeration.
Definition: InputLayout.h:77