diff options
-rw-r--r-- | include/mbgl/gl/gl_values.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/gl/gl_config.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 1 | ||||
-rw-r--r-- | test/gl/object.cpp | 6 |
4 files changed, 10 insertions, 5 deletions
diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp index 1e05984fbc..b15ef18f48 100644 --- a/include/mbgl/gl/gl_values.hpp +++ b/include/mbgl/gl/gl_values.hpp @@ -140,6 +140,10 @@ struct StencilOp { } }; +constexpr bool operator!=(const StencilOp::Type& a, const StencilOp::Type& b) { + return a.sfail != b.sfail || a.dpfail != b.dpfail || a.dppass != b.dppass; +} + struct DepthRange { struct Type { GLfloat near, far; }; static const Type Default; diff --git a/src/mbgl/gl/gl_config.hpp b/src/mbgl/gl/gl_config.hpp index 09080ca365..9d7dfb3b6c 100644 --- a/src/mbgl/gl/gl_config.hpp +++ b/src/mbgl/gl/gl_config.hpp @@ -21,9 +21,7 @@ public: } void reset() { - dirty = true; - current = T::Default; - T::Set(current); + *this = T::Default; } void setDirty() { diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index e5c88de635..ba68b5a24d 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -83,6 +83,7 @@ Painter::Painter(const TransformState& state_, overdrawShader.circle = std::make_unique<CircleShader>(store, Shader::Overdraw); // Reset GL values + config.setDirty(); config.reset(); } diff --git a/test/gl/object.cpp b/test/gl/object.cpp index 5e7a158939..1506c33956 100644 --- a/test/gl/object.cpp +++ b/test/gl/object.cpp @@ -18,11 +18,13 @@ static bool setFlag = false; struct MockGLObject { using Type = bool; - static const Type Default = false; + static const Type Default; static Type Get() { getFlag = true; return true; } static void Set(const Type&) { setFlag = true; } }; +const bool MockGLObject::Default = false; + TEST(GLObject, Preserve) { getFlag = false; setFlag = false; @@ -61,7 +63,7 @@ TEST(GLObject, Value) { object->reset(); EXPECT_EQ(object->getCurrent(), false); - EXPECT_TRUE(object->getDirty()); + EXPECT_FALSE(object->getDirty()); EXPECT_TRUE(setFlag); } |