blob: af373fc3f8e50f118ba3df96bfb90191a1df2920 (
plain)
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
|
#ifndef MBGL_GL_GL_CONFIG
#define MBGL_GL_GL_CONFIG
#include <cstdint>
#include <tuple>
#include <array>
#include <mbgl/gl/gl_values.hpp>
namespace mbgl {
namespace gl {
template <typename T>
class Value {
public:
inline void operator=(const typename T::Type& value) {
if (dirty || current != value) {
dirty = false;
current = value;
T::Set(current);
}
}
inline void reset() {
dirty = true;
current = T::Default;
T::Set(current);
}
inline void setDirty() {
dirty = true;
}
private:
typename T::Type current = T::Default;
bool dirty = false;
};
class Config {
public:
void reset() {
stencilFunc.reset();
stencilMask.reset();
stencilTest.reset();
stencilOp.reset();
depthRange.reset();
depthMask.reset();
depthTest.reset();
depthFunc.reset();
blend.reset();
blendFunc.reset();
colorMask.reset();
clearDepth.reset();
clearColor.reset();
clearStencil.reset();
program.reset();
lineWidth.reset();
}
void setDirty() {
stencilFunc.setDirty();
stencilMask.setDirty();
stencilTest.setDirty();
stencilOp.setDirty();
depthRange.setDirty();
depthMask.setDirty();
depthTest.setDirty();
depthFunc.setDirty();
blend.setDirty();
blendFunc.setDirty();
colorMask.setDirty();
clearDepth.setDirty();
clearColor.setDirty();
clearStencil.setDirty();
program.setDirty();
lineWidth.setDirty();
}
Value<StencilFunc> stencilFunc;
Value<StencilMask> stencilMask;
Value<StencilTest> stencilTest;
Value<StencilOp> stencilOp;
Value<DepthRange> depthRange;
Value<DepthMask> depthMask;
Value<DepthTest> depthTest;
Value<DepthFunc> depthFunc;
Value<Blend> blend;
Value<BlendFunc> blendFunc;
Value<ColorMask> colorMask;
Value<ClearDepth> clearDepth;
Value<ClearColor> clearColor;
Value<ClearStencil> clearStencil;
Value<Program> program;
Value<LineWidth> lineWidth;
};
} // namespace gl
} // namespace mbgl
#endif // MBGL_RENDERER_GL_CONFIG
|