diff --git a/include/mbgl/map/mode.hpp b/include/mbgl/map/mode.hpp
index c9b9f6095..2efc8b18e 100644
--- a/include/mbgl/map/mode.hpp
+++ b/include/mbgl/map/mode.hpp
@@ -47,6 +47,7 @@ enum class MapDebugOptions : EnumType {
// FIXME: https://github.com/mapbox/mapbox-gl-native/issues/5117
#ifndef GL_ES_VERSION_2_0
StencilClip = 1 << 6,
+ DepthBuffer = 1 << 7,
#endif // GL_ES_VERSION_2_0
};
@@ -55,11 +56,19 @@ constexpr MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) {
}
constexpr MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) {
- return (lhs = lhs | rhs);
+ return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs)));
}
constexpr bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) {
return mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs);
}
+constexpr MapDebugOptions& operator&=(MapDebugOptions& lhs, MapDebugOptions rhs) {
+ return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs)));
+}
+
+constexpr MapDebugOptions operator~(MapDebugOptions value) {
+ return MapDebugOptions(~mbgl::underlying_type(value));
+}
+
} // namespace mbgl
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 863f42ec7..b84bbfdf8 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -97,6 +97,7 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
printf("- Press `Z` to cycle through north orientations\n");
printf("- Prezz `X` to cycle through the viewport modes\n");
printf("- Press `A` to cycle through Mapbox offices in the world + dateline monument\n");
+ printf("- Press `B` to cycle through the color, stencil, and depth buffer\n");
printf("\n");
printf("- Press `1` through `6` to add increasing numbers of point annotations for testing\n");
printf("- Press `7` through `0` to add increasing numbers of shape annotations for testing\n");
@@ -155,6 +156,18 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
}
}
break;
+ case GLFW_KEY_B: {
+ auto debug = view->map->getDebug();
+ if (debug & mbgl::MapDebugOptions::StencilClip) {
+ debug &= ~mbgl::MapDebugOptions::StencilClip;
+ debug |= mbgl::MapDebugOptions::DepthBuffer;
+ } else if (debug & mbgl::MapDebugOptions::DepthBuffer) {
+ debug &= ~mbgl::MapDebugOptions::DepthBuffer;
+ } else {
+ debug |= mbgl::MapDebugOptions::StencilClip;
+ }
+ view->map->setDebug(debug);
+ } break;
case GLFW_KEY_N:
if (!mods)
view->map->resetNorth();
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib
index fae2a7db7..716872a32 100644
--- a/platform/macos/app/Base.lproj/MainMenu.xib
+++ b/platform/macos/app/Base.lproj/MainMenu.xib
@@ -474,6 +474,12 @@
+