1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#pragma once
#include <cstdint>
#include <type_traits>
namespace mbgl {
namespace gl {
// Mapping based on https://www.opengl.org/wiki/OpenGL_Type
using ProgramID = uint32_t;
using ShaderID = uint32_t;
using BufferID = uint32_t;
using TextureID = uint32_t;
using VertexArrayID = uint32_t;
using FramebufferID = uint32_t;
using RenderbufferID = uint32_t;
using AttributeLocation = int32_t;
using UniformLocation = int32_t;
using TextureUnit = uint8_t;
using DepthValue = double;
using StencilValue = int32_t;
using StencilMaskValue = uint32_t;
enum class DataType : uint32_t {
Byte = 0x1400,
UnsignedByte = 0x1401,
Short = 0x1402,
UnsignedShort = 0x1403,
Integer = 0x1404,
UnsignedInteger = 0x1405,
Float = 0x1406
};
template <typename T> struct DataTypeOf;
template <> struct DataTypeOf<int8_t> : std::integral_constant<DataType, DataType::Byte> {};
template <> struct DataTypeOf<uint8_t> : std::integral_constant<DataType, DataType::UnsignedByte> {};
template <> struct DataTypeOf<int16_t> : std::integral_constant<DataType, DataType::Short> {};
template <> struct DataTypeOf<uint16_t> : std::integral_constant<DataType, DataType::UnsignedShort> {};
template <> struct DataTypeOf<int32_t> : std::integral_constant<DataType, DataType::Integer> {};
template <> struct DataTypeOf<uint32_t> : std::integral_constant<DataType, DataType::UnsignedInteger> {};
template <> struct DataTypeOf<float> : std::integral_constant<DataType, DataType::Float> {};
enum class BufferType : uint32_t {
Vertex = 0x8892,
Element = 0x8893
};
enum class RenderbufferType : uint32_t {
RGBA = 0x8058,
DepthStencil = 0x88F0,
};
enum class TextureMipMap : bool { No = false, Yes = true };
enum class TextureFilter : bool { Nearest = false, Linear = true };
enum class StencilTestFunction : uint32_t {
Never = 0x0200,
Less = 0x0201,
Equal = 0x0202,
LessEqual = 0x0203,
Greater = 0x0204,
NotEqual = 0x0205,
GreaterEqual = 0x0206,
Always = 0x0207,
};
enum class StencilTestOperation : uint32_t {
Keep = 0x1E00,
Zero = 0x0000,
Replace = 0x1E01,
Increment = 0x1E02,
IncrementWrap = 0x8507,
Decrement = 0x1E03,
DecrementWrap = 0x8508,
Invert = 0x150A,
};
enum class DepthTestFunction : uint32_t {
Never = 0x0200,
Less = 0x0201,
Equal = 0x0202,
LessEqual = 0x0203,
Greater = 0x0204,
NotEqual = 0x0205,
GreaterEqual = 0x0206,
Always = 0x0207,
};
enum class BlendSourceFactor : uint32_t {
Zero = 0x0000,
One = 0x0001,
SrcColor = 0x0300,
OneMinusSrcColor = 0x0301,
DstColor = 0x0306,
OneMinusDstColor = 0x0307,
SrcAlpha = 0x0302,
OneMinusSrcAlpha = 0x0303,
DstAlpha = 0x0304,
OneMinusDstAlpha = 0x0305,
ConstantColor = 0x8001,
OneMinusConstantColor = 0x8002,
ConstantAlpha = 0x8003,
OneMinusConstantAlpha = 0x8004,
SrcAlphaSaturate = 0x0308,
};
enum class BlendDestinationFactor : uint32_t {
Zero = 0x0000,
One = 0x0001,
SrcColor = 0x0300,
OneMinusSrcColor = 0x0301,
DstColor = 0x0306,
OneMinusDstColor = 0x0307,
SrcAlpha = 0x0302,
OneMinusSrcAlpha = 0x0303,
DstAlpha = 0x0304,
OneMinusDstAlpha = 0x0305,
ConstantColor = 0x8001,
OneMinusConstantColor = 0x8002,
ConstantAlpha = 0x8003,
OneMinusConstantAlpha = 0x8004,
};
} // namespace gl
} // namespace mbgl
|