summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core-files.json3
-rw-r--r--src/mbgl/gfx/stencil_mode.hpp56
-rw-r--r--src/mbgl/gfx/types.hpp22
-rw-r--r--src/mbgl/gl/context.cpp4
-rw-r--r--src/mbgl/gl/context.hpp4
-rw-r--r--src/mbgl/gl/enum.cpp60
-rw-r--r--src/mbgl/gl/program.hpp2
-rw-r--r--src/mbgl/gl/stencil_mode.cpp27
-rw-r--r--src/mbgl/gl/stencil_mode.hpp66
-rw-r--r--src/mbgl/gl/value.cpp13
-rw-r--r--src/mbgl/gl/value.hpp14
-rw-r--r--src/mbgl/programs/collision_box_program.hpp4
-rw-r--r--src/mbgl/programs/program.hpp2
-rw-r--r--src/mbgl/programs/symbol_program.hpp2
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_circle_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp6
-rw-r--r--src/mbgl/renderer/layers/render_heatmap_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_hillshade_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp6
-rw-r--r--src/mbgl/renderer/paint_parameters.cpp12
-rw-r--r--src/mbgl/renderer/paint_parameters.hpp4
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp14
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp2
26 files changed, 192 insertions, 147 deletions
diff --git a/src/core-files.json b/src/core-files.json
index e9dc01c64d..60fce99c5d 100644
--- a/src/core-files.json
+++ b/src/core-files.json
@@ -23,7 +23,6 @@
"src/mbgl/gl/debugging_extension.cpp",
"src/mbgl/gl/enum.cpp",
"src/mbgl/gl/object.cpp",
- "src/mbgl/gl/stencil_mode.cpp",
"src/mbgl/gl/uniform.cpp",
"src/mbgl/gl/value.cpp",
"src/mbgl/gl/vertex_array.cpp",
@@ -502,6 +501,7 @@
"mbgl/gfx/depth_mode.hpp": "src/mbgl/gfx/depth_mode.hpp",
"mbgl/gfx/draw_mode.hpp": "src/mbgl/gfx/draw_mode.hpp",
"mbgl/gfx/primitives.hpp": "src/mbgl/gfx/primitives.hpp",
+ "mbgl/gfx/stencil_mode.hpp": "src/mbgl/gfx/stencil_mode.hpp",
"mbgl/gfx/types.hpp": "src/mbgl/gfx/types.hpp",
"mbgl/gfx/uniform.hpp": "src/mbgl/gfx/uniform.hpp",
"mbgl/gl/attribute.hpp": "src/mbgl/gl/attribute.hpp",
@@ -520,7 +520,6 @@
"mbgl/gl/program_binary_extension.hpp": "src/mbgl/gl/program_binary_extension.hpp",
"mbgl/gl/renderbuffer.hpp": "src/mbgl/gl/renderbuffer.hpp",
"mbgl/gl/state.hpp": "src/mbgl/gl/state.hpp",
- "mbgl/gl/stencil_mode.hpp": "src/mbgl/gl/stencil_mode.hpp",
"mbgl/gl/texture.hpp": "src/mbgl/gl/texture.hpp",
"mbgl/gl/types.hpp": "src/mbgl/gl/types.hpp",
"mbgl/gl/uniform.hpp": "src/mbgl/gl/uniform.hpp",
diff --git a/src/mbgl/gfx/stencil_mode.hpp b/src/mbgl/gfx/stencil_mode.hpp
new file mode 100644
index 0000000000..3ba2687b8c
--- /dev/null
+++ b/src/mbgl/gfx/stencil_mode.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <mbgl/gfx/types.hpp>
+#include <mbgl/util/variant.hpp>
+
+namespace mbgl {
+namespace gfx {
+
+class StencilMode {
+public:
+ template <StencilFunctionType F>
+ struct SimpleTest {
+ static constexpr StencilFunctionType func = F;
+ static constexpr uint32_t mask = 0;
+ };
+
+ template <StencilFunctionType F>
+ struct MaskedTest {
+ static constexpr StencilFunctionType func = F;
+ uint32_t mask;
+ };
+
+ using Never = SimpleTest<StencilFunctionType::Never>;
+ using Less = MaskedTest<StencilFunctionType::Less>;
+ using Equal = MaskedTest<StencilFunctionType::Equal>;
+ using LessEqual = MaskedTest<StencilFunctionType::LessEqual>;
+ using Greater = MaskedTest<StencilFunctionType::Greater>;
+ using NotEqual = MaskedTest<StencilFunctionType::NotEqual>;
+ using GreaterEqual = MaskedTest<StencilFunctionType::GreaterEqual>;
+ using Always = SimpleTest<StencilFunctionType::Always>;
+
+ using Test = variant<
+ Never,
+ Less,
+ Equal,
+ LessEqual,
+ Greater,
+ NotEqual,
+ GreaterEqual,
+ Always>;
+
+ Test test;
+ int32_t ref;
+ uint32_t mask;
+
+ StencilOpType fail;
+ StencilOpType depthFail;
+ StencilOpType pass;
+
+ static StencilMode disabled() {
+ return StencilMode { Always(), 0, 0, StencilOpType::Keep, StencilOpType::Keep, StencilOpType::Keep };
+ }
+};
+
+} // namespace gfx
+} // namespace mbgl
diff --git a/src/mbgl/gfx/types.hpp b/src/mbgl/gfx/types.hpp
index 264fa67b04..8faa9dc7f9 100644
--- a/src/mbgl/gfx/types.hpp
+++ b/src/mbgl/gfx/types.hpp
@@ -55,5 +55,27 @@ enum class DepthMaskType : bool {
ReadWrite = true,
};
+enum class StencilFunctionType : uint8_t {
+ Never,
+ Less,
+ Equal,
+ LessEqual,
+ Greater,
+ NotEqual,
+ GreaterEqual,
+ Always,
+};
+
+enum class StencilOpType : uint8_t {
+ Zero,
+ Keep,
+ Replace,
+ Increment,
+ Decrement,
+ Invert,
+ IncrementWrap,
+ DecrementWrap,
+};
+
} // namespace gfx
} // namespace mbgl
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 1be6a32f2b..abe082f14f 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -716,8 +716,8 @@ void Context::setDepthMode(const gfx::DepthMode& depth) {
}
}
-void Context::setStencilMode(const StencilMode& stencil) {
- if (stencil.test.is<StencilMode::Always>() && !stencil.mask) {
+void Context::setStencilMode(const gfx::StencilMode& stencil) {
+ if (stencil.test.is<gfx::StencilMode::Always>() && !stencil.mask) {
stencilTest = false;
} else {
stencilTest = true;
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index e296e81452..d5e51d0adf 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -13,7 +13,7 @@
#include <mbgl/gl/types.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/gfx/depth_mode.hpp>
-#include <mbgl/gl/stencil_mode.hpp>
+#include <mbgl/gfx/stencil_mode.hpp>
#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/noncopyable.hpp>
@@ -171,7 +171,7 @@ public:
void setDrawMode(const gfx::TriangleStrip&);
void setDepthMode(const gfx::DepthMode&);
- void setStencilMode(const StencilMode&);
+ void setStencilMode(const gfx::StencilMode&);
void setColorMode(const gfx::ColorMode&);
void setCullFaceMode(const CullFaceMode&);
diff --git a/src/mbgl/gl/enum.cpp b/src/mbgl/gl/enum.cpp
index a6f251a438..ea47f2104f 100644
--- a/src/mbgl/gl/enum.cpp
+++ b/src/mbgl/gl/enum.cpp
@@ -123,5 +123,65 @@ platform::GLboolean Enum<gfx::DepthMaskType>::to(const gfx::DepthMaskType value)
return value == gfx::DepthMaskType::ReadWrite ? GL_TRUE : GL_FALSE;
}
+template <>
+gfx::StencilFunctionType Enum<gfx::StencilFunctionType>::from(const platform::GLint value) {
+ switch (value) {
+ case GL_NEVER: return gfx::StencilFunctionType::Never;
+ case GL_LESS: return gfx::StencilFunctionType::Less;
+ case GL_EQUAL: return gfx::StencilFunctionType::Equal;
+ case GL_LEQUAL: return gfx::StencilFunctionType::LessEqual;
+ case GL_GREATER: return gfx::StencilFunctionType::Greater;
+ case GL_NOTEQUAL: return gfx::StencilFunctionType::NotEqual;
+ case GL_GEQUAL: return gfx::StencilFunctionType::GreaterEqual;
+ case GL_ALWAYS: return gfx::StencilFunctionType::Always;
+ }
+ return {};
+}
+
+template <>
+platform::GLenum Enum<gfx::StencilFunctionType>::to(const gfx::StencilFunctionType value) {
+ switch (value) {
+ case gfx::StencilFunctionType::Never: return GL_NEVER;
+ case gfx::StencilFunctionType::Less: return GL_LESS;
+ case gfx::StencilFunctionType::Equal: return GL_EQUAL;
+ case gfx::StencilFunctionType::LessEqual: return GL_LEQUAL;
+ case gfx::StencilFunctionType::Greater: return GL_GREATER;
+ case gfx::StencilFunctionType::NotEqual: return GL_NOTEQUAL;
+ case gfx::StencilFunctionType::GreaterEqual: return GL_GEQUAL;
+ case gfx::StencilFunctionType::Always: return GL_ALWAYS;
+ }
+ return GL_INVALID_ENUM;
+}
+
+template <>
+gfx::StencilOpType Enum<gfx::StencilOpType>::from(const platform::GLint value) {
+ switch (value) {
+ case GL_KEEP: return gfx::StencilOpType::Keep;
+ case GL_ZERO: return gfx::StencilOpType::Zero;
+ case GL_REPLACE: return gfx::StencilOpType::Replace;
+ case GL_INCR: return gfx::StencilOpType::Increment;
+ case GL_INCR_WRAP: return gfx::StencilOpType::IncrementWrap;
+ case GL_DECR: return gfx::StencilOpType::Decrement;
+ case GL_DECR_WRAP: return gfx::StencilOpType::DecrementWrap;
+ case GL_INVERT: return gfx::StencilOpType::Invert;
+ }
+ return {};
+}
+
+template <>
+platform::GLenum Enum<gfx::StencilOpType>::to(const gfx::StencilOpType value) {
+ switch (value) {
+ case gfx::StencilOpType::Keep: return GL_KEEP;
+ case gfx::StencilOpType::Zero: return GL_ZERO;
+ case gfx::StencilOpType::Replace: return GL_REPLACE;
+ case gfx::StencilOpType::Increment: return GL_INCR;
+ case gfx::StencilOpType::IncrementWrap: return GL_INCR_WRAP;
+ case gfx::StencilOpType::Decrement: return GL_DECR;
+ case gfx::StencilOpType::DecrementWrap: return GL_DECR_WRAP;
+ case gfx::StencilOpType::Invert: return GL_INVERT;
+ }
+ return GL_INVALID_ENUM;
+}
+
} // namespace gl
} // namespace mbgl
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index de51e8dcb6..5bc7c2075b 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -116,7 +116,7 @@ public:
void draw(Context& context,
DrawMode drawMode,
gfx::DepthMode depthMode,
- StencilMode stencilMode,
+ gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
diff --git a/src/mbgl/gl/stencil_mode.cpp b/src/mbgl/gl/stencil_mode.cpp
deleted file mode 100644
index fc6f3076dc..0000000000
--- a/src/mbgl/gl/stencil_mode.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/defines.hpp>
-#include <mbgl/util/traits.hpp>
-
-namespace mbgl {
-namespace gl {
-
-static_assert(StencilMode::Never::func == GL_NEVER, "OpenGL enum mismatch");
-static_assert(StencilMode::Less::func == GL_LESS, "OpenGL enum mismatch");
-static_assert(StencilMode::Equal::func == GL_EQUAL, "OpenGL enum mismatch");
-static_assert(StencilMode::LessEqual::func == GL_LEQUAL, "OpenGL enum mismatch");
-static_assert(StencilMode::Greater::func == GL_GREATER, "OpenGL enum mismatch");
-static_assert(StencilMode::NotEqual::func == GL_NOTEQUAL, "OpenGL enum mismatch");
-static_assert(StencilMode::GreaterEqual::func == GL_GEQUAL, "OpenGL enum mismatch");
-static_assert(StencilMode::Always::func == GL_ALWAYS, "OpenGL enum mismatch");
-
-static_assert(underlying_type(StencilMode::Keep) == GL_KEEP, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::Zero) == GL_ZERO, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::Replace) == GL_REPLACE, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::Increment) == GL_INCR, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::IncrementWrap) == GL_INCR_WRAP, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::Decrement) == GL_DECR, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::DecrementWrap) == GL_DECR_WRAP, "OpenGL enum mismatch");
-static_assert(underlying_type(StencilMode::Invert) == GL_INVERT, "OpenGL enum mismatch");
-
-} // namespace gl
-} // namespace mbgl
diff --git a/src/mbgl/gl/stencil_mode.hpp b/src/mbgl/gl/stencil_mode.hpp
deleted file mode 100644
index bc959c9a73..0000000000
--- a/src/mbgl/gl/stencil_mode.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#pragma once
-
-#include <mbgl/util/variant.hpp>
-
-namespace mbgl {
-namespace gl {
-
-class StencilMode {
-public:
- template <uint32_t F>
- struct SimpleTest {
- static constexpr uint32_t func = F;
- static constexpr uint32_t mask = 0;
- };
-
- template <uint32_t F>
- struct MaskedTest {
- static constexpr uint32_t func = F;
- uint32_t mask;
- };
-
- using Never = SimpleTest<0x0200>;
- using Less = MaskedTest<0x0201>;
- using Equal = MaskedTest<0x0202>;
- using LessEqual = MaskedTest<0x0203>;
- using Greater = MaskedTest<0x0204>;
- using NotEqual = MaskedTest<0x0205>;
- using GreaterEqual = MaskedTest<0x0206>;
- using Always = SimpleTest<0x0207>;
-
- using Test = variant<
- Never,
- Less,
- Equal,
- LessEqual,
- Greater,
- NotEqual,
- GreaterEqual,
- Always>;
-
- enum Op {
- Zero = 0x0000,
- Keep = 0x1E00,
- Replace = 0x1E01,
- Increment = 0x1E02,
- Decrement = 0x1E03,
- Invert = 0x150A,
- IncrementWrap = 0x8507,
- DecrementWrap = 0x8508
- };
-
- Test test;
- int32_t ref;
- uint32_t mask;
-
- Op fail;
- Op depthFail;
- Op pass;
-
- static StencilMode disabled() {
- return StencilMode { Always(), 0, 0, Keep, Keep, Keep };
- }
-};
-
-} // namespace gl
-} // namespace mbgl
diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp
index 800c39a9d6..8b46c1ae35 100644
--- a/src/mbgl/gl/value.cpp
+++ b/src/mbgl/gl/value.cpp
@@ -93,7 +93,7 @@ StencilFunc::Type StencilFunc::Get() {
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FUNC, &func));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_REF, &ref));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_VALUE_MASK, &mask));
- return { static_cast<uint32_t>(func), ref, static_cast<uint32_t>(mask) };
+ return { Enum<gfx::StencilFunctionType>::from(func), ref, static_cast<uint32_t>(mask) };
}
const constexpr StencilTest::Type StencilTest::Default;
@@ -111,9 +111,9 @@ StencilTest::Type StencilTest::Get() {
const constexpr StencilOp::Type StencilOp::Default;
void StencilOp::Set(const Type& value) {
- MBGL_CHECK_ERROR(glStencilOp(static_cast<GLenum>(value.sfail),
- static_cast<GLenum>(value.dpfail),
- static_cast<GLenum>(value.dppass)));
+ MBGL_CHECK_ERROR(glStencilOp(Enum<gfx::StencilOpType>::to(value.sfail),
+ Enum<gfx::StencilOpType>::to(value.dpfail),
+ Enum<gfx::StencilOpType>::to(value.dppass)));
}
StencilOp::Type StencilOp::Get() {
@@ -121,8 +121,9 @@ StencilOp::Type StencilOp::Get() {
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FAIL, &sfail));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &dpfail));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &dppass));
- return { static_cast<StencilMode::Op>(sfail), static_cast<StencilMode::Op>(dpfail),
- static_cast<StencilMode::Op>(dppass) };
+ return { Enum<gfx::StencilOpType>::from(sfail),
+ Enum<gfx::StencilOpType>::from(dpfail),
+ Enum<gfx::StencilOpType>::from(dppass) };
}
const constexpr DepthRange::Type DepthRange::Default;
diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp
index d7a8ddf6fe..128eff2dce 100644
--- a/src/mbgl/gl/value.hpp
+++ b/src/mbgl/gl/value.hpp
@@ -2,7 +2,7 @@
#include <mbgl/gl/types.hpp>
#include <mbgl/gfx/depth_mode.hpp>
-#include <mbgl/gl/stencil_mode.hpp>
+#include <mbgl/gfx/stencil_mode.hpp>
#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/gl/cull_face_mode.hpp>
#include <mbgl/gl/attribute.hpp>
@@ -62,11 +62,11 @@ struct ColorMask {
struct StencilFunc {
struct Type {
- uint32_t func;
+ gfx::StencilFunctionType func;
int32_t ref;
uint32_t mask;
};
- static const constexpr Type Default = { StencilMode::Always::func, 0, ~0u };
+ static const constexpr Type Default = { gfx::StencilMode::Always::func, 0, ~0u };
static void Set(const Type&);
static Type Get();
};
@@ -84,11 +84,11 @@ struct StencilTest {
struct StencilOp {
struct Type {
- StencilMode::Op sfail;
- StencilMode::Op dpfail;
- StencilMode::Op dppass;
+ gfx::StencilOpType sfail;
+ gfx::StencilOpType dpfail;
+ gfx::StencilOpType dppass;
};
- static const constexpr Type Default = { StencilMode::Keep, StencilMode::Keep, StencilMode::Keep };
+ static const constexpr Type Default = { gfx::StencilOpType::Keep, gfx::StencilOpType::Keep, gfx::StencilOpType::Keep };
static void Set(const Type&);
static Type Get();
};
diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp
index 434211af3e..43c2c7502d 100644
--- a/src/mbgl/programs/collision_box_program.hpp
+++ b/src/mbgl/programs/collision_box_program.hpp
@@ -59,7 +59,7 @@ public:
void draw(gl::Context& context,
DrawMode drawMode,
gfx::DepthMode depthMode,
- gl::StencilMode stencilMode,
+ gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
@@ -140,7 +140,7 @@ public:
void draw(gl::Context& context,
DrawMode drawMode,
gfx::DepthMode depthMode,
- gl::StencilMode stencilMode,
+ gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index aeeb840fda..17b0af32b1 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -72,7 +72,7 @@ public:
void draw(gl::Context& context,
DrawMode drawMode,
gfx::DepthMode depthMode,
- gl::StencilMode stencilMode,
+ gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const gl::IndexBuffer<DrawMode>& indexBuffer,
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index 6871b2b4b8..8a866c0eca 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -307,7 +307,7 @@ public:
void draw(gl::Context& context,
DrawMode drawMode,
gfx::DepthMode depthMode,
- gl::StencilMode stencilMode,
+ gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const gl::IndexBuffer<DrawMode>& indexBuffer,
diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp
index 21c209d5f0..ce1494f5af 100644
--- a/src/mbgl/renderer/layers/render_background_layer.cpp
+++ b/src/mbgl/renderer/layers/render_background_layer.cpp
@@ -69,7 +69,7 @@ void RenderBackgroundLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.context,
gfx::Triangles(),
parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
parameters.staticData.quadTriangleIndexBuffer,
diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp
index 1754111335..0a5950637c 100644
--- a/src/mbgl/renderer/layers/render_circle_layer.cpp
+++ b/src/mbgl/renderer/layers/render_circle_layer.cpp
@@ -100,7 +100,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly),
parameters.mapMode != MapMode::Continuous
? parameters.stencilModeForClipping(tile.clip)
- : gl::StencilMode::disabled(),
+ : gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
*bucket.indexBuffer,
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 4880919c36..bff4640549 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -63,7 +63,7 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*)
// Reset GL state to a known state so the CustomLayer always has a clean slate.
glContext.bindVertexArray = 0;
glContext.setDepthMode(paintParameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly));
- glContext.setStencilMode(gl::StencilMode::disabled());
+ glContext.setStencilMode(gfx::StencilMode::disabled());
glContext.setColorMode(paintParameters.colorModeForRenderPass());
glContext.setCullFaceMode(gl::CullFaceMode::disabled());
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 5ecd0fb7d4..78ad20d8d1 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -68,7 +68,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
// Flag the depth buffer as no longer needing to be cleared for the remainder of this pass.
parameters.staticData.depthRenderbuffer->shouldClear(false);
- parameters.context.setStencilMode(gl::StencilMode::disabled());
+ parameters.context.setStencilMode(gfx::StencilMode::disabled());
parameters.context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, depthClearValue, {});
auto draw = [&](auto& programInstance, const auto& tileBucket, auto&& uniformValues,
@@ -94,7 +94,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
parameters.context,
gfx::Triangles(),
parameters.depthModeFor3D(gfx::DepthMaskType::ReadWrite),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::backCCW(),
*tileBucket.indexBuffer,
@@ -195,7 +195,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
parameters.context,
gfx::Triangles(),
gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
parameters.staticData.quadTriangleIndexBuffer,
diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
index d03cb95261..9a18b35f7f 100644
--- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp
+++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
@@ -93,7 +93,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
const auto stencilMode = parameters.mapMode != MapMode::Continuous
? parameters.stencilModeForClipping(tile.clip)
- : gl::StencilMode::disabled();
+ : gfx::StencilMode::disabled();
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
@@ -169,7 +169,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.context,
gfx::Triangles(),
gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
parameters.staticData.quadTriangleIndexBuffer,
diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
index 732a0c909c..f492464b4d 100644
--- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp
+++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
@@ -98,7 +98,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
parameters.context,
gfx::Triangles(),
parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
indexBuffer,
@@ -159,7 +159,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
parameters.context,
gfx::Triangles(),
parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
parameters.staticData.quadTriangleIndexBuffer,
diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp
index 494ef0d094..86dd0ca61b 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.cpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.cpp
@@ -112,7 +112,7 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
parameters.context,
gfx::Triangles(),
parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
indexBuffer,
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 466e988cd0..f87482fed4 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -120,7 +120,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
values_.pitchAlignment == AlignmentType::Map
? parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly)
: gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
*buffers.indexBuffer,
@@ -253,7 +253,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.context,
gfx::Lines { 1.0f },
gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
CollisionBoxProgram::UniformValues {
@@ -288,7 +288,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.context,
gfx::Triangles(),
gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
gl::CullFaceMode::disabled(),
CollisionCircleProgram::UniformValues {
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp
index 0c7ae7a857..2237b016d2 100644
--- a/src/mbgl/renderer/paint_parameters.cpp
+++ b/src/mbgl/renderer/paint_parameters.cpp
@@ -68,14 +68,14 @@ gfx::DepthMode PaintParameters::depthModeFor3D(gfx::DepthMaskType mask) const {
return gfx::DepthMode { gfx::DepthFunctionType::LessEqual, mask, { 0.0, 1.0 } };
}
-gl::StencilMode PaintParameters::stencilModeForClipping(const ClipID& id) const {
- return gl::StencilMode {
- gl::StencilMode::Equal { static_cast<uint32_t>(id.mask.to_ulong()) },
+gfx::StencilMode PaintParameters::stencilModeForClipping(const ClipID& id) const {
+ return gfx::StencilMode {
+ gfx::StencilMode::Equal { static_cast<uint32_t>(id.mask.to_ulong()) },
static_cast<int32_t>(id.reference.to_ulong()),
0,
- gl::StencilMode::Keep,
- gl::StencilMode::Keep,
- gl::StencilMode::Replace
+ gfx::StencilOpType::Keep,
+ gfx::StencilOpType::Keep,
+ gfx::StencilOpType::Replace
};
}
diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp
index ccfd12b409..ea3b41adfe 100644
--- a/src/mbgl/renderer/paint_parameters.hpp
+++ b/src/mbgl/renderer/paint_parameters.hpp
@@ -5,7 +5,7 @@
#include <mbgl/renderer/mode.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/gfx/depth_mode.hpp>
-#include <mbgl/gl/stencil_mode.hpp>
+#include <mbgl/gfx/stencil_mode.hpp>
#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/algorithm/generate_clip_ids.hpp>
@@ -63,7 +63,7 @@ public:
gfx::DepthMode depthModeForSublayer(uint8_t n, gfx::DepthMaskType) const;
gfx::DepthMode depthModeFor3D(gfx::DepthMaskType) const;
- gl::StencilMode stencilModeForClipping(const ClipID&) const;
+ gfx::StencilMode stencilModeForClipping(const ClipID&) const;
gfx::ColorMode colorModeForRenderPass() const;
mat4 matrixForTile(const UnwrappedTileID&, bool aligned = false) const;
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 514d02808e..9575efbb81 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -444,13 +444,13 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
parameters.context,
gfx::Triangles(),
gfx::DepthMode::disabled(),
- gl::StencilMode {
- gl::StencilMode::Always(),
+ gfx::StencilMode {
+ gfx::StencilMode::Always(),
static_cast<int32_t>(clipID.second.reference.to_ulong()),
0b11111111,
- gl::StencilMode::Keep,
- gl::StencilMode::Keep,
- gl::StencilMode::Replace
+ gfx::StencilOpType::Keep,
+ gfx::StencilOpType::Keep,
+ gfx::StencilOpType::Replace
},
gfx::ColorMode::disabled(),
gl::CullFaceMode::disabled(),
@@ -477,7 +477,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
#if not MBGL_USE_GLES2 and not defined(NDEBUG)
// Render tile clip boundaries, using stencil buffer to calculate fill color.
if (parameters.debugOptions & MapDebugOptions::StencilClip) {
- parameters.context.setStencilMode(gl::StencilMode::disabled());
+ parameters.context.setStencilMode(gfx::StencilMode::disabled());
parameters.context.setDepthMode(gfx::DepthMode::disabled());
parameters.context.setColorMode(gfx::ColorMode::unblended());
parameters.context.program = 0;
@@ -560,7 +560,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
#if not MBGL_USE_GLES2 and not defined(NDEBUG)
// Render the depth buffer.
if (parameters.debugOptions & MapDebugOptions::DepthBuffer) {
- parameters.context.setStencilMode(gl::StencilMode::disabled());
+ parameters.context.setStencilMode(gfx::StencilMode::disabled());
parameters.context.setDepthMode(gfx::DepthMode::disabled());
parameters.context.setColorMode(gfx::ColorMode::unblended());
parameters.context.program = 0;
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 25fa0ba038..1d1a656363 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -65,7 +65,7 @@ void RenderImageSource::finishRender(PaintParameters& parameters) {
parameters.context,
gfx::LineStrip { 4.0f * parameters.pixelRatio },
gfx::DepthMode::disabled(),
- gl::StencilMode::disabled(),
+ gfx::StencilMode::disabled(),
gfx::ColorMode::unblended(),
gl::CullFaceMode::disabled(),
parameters.staticData.tileBorderIndexBuffer,