[core] move StencilMode to gfx namespace
This commit is contained in:
@@ -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",
|
||||
|
||||
56
src/mbgl/gfx/stencil_mode.hpp
Normal file
56
src/mbgl/gfx/stencil_mode.hpp
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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&);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user