summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-02-28 16:19:33 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-03-01 09:33:37 +0100
commitda6e1390c68e01e02652104586c759d46e04c7fd (patch)
tree002942c69e886a2ad86ac7bea8272d36a16c28e2
parentfd37d9065029c732d97e6fa59bc0a0d27ecd3c72 (diff)
downloadqtlocation-mapboxgl-da6e1390c68e01e02652104586c759d46e04c7fd.tar.gz
[core] move ColorMode to gfx namespace
-rw-r--r--src/core-files.json3
-rw-r--r--src/mbgl/gfx/color_mode.hpp (renamed from src/mbgl/gl/color_mode.hpp)58
-rw-r--r--src/mbgl/gl/color_mode.cpp44
-rw-r--r--src/mbgl/gl/context.cpp6
-rw-r--r--src/mbgl/gl/context.hpp4
-rw-r--r--src/mbgl/gl/program.hpp2
-rw-r--r--src/mbgl/gl/value.cpp75
-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_heatmap_layer.cpp2
-rw-r--r--src/mbgl/renderer/paint_parameters.cpp16
-rw-r--r--src/mbgl/renderer/paint_parameters.hpp4
-rw-r--r--src/mbgl/renderer/render_tile.cpp6
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp6
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp2
17 files changed, 135 insertions, 115 deletions
diff --git a/src/core-files.json b/src/core-files.json
index 11209e3504..aa53ec9ede 100644
--- a/src/core-files.json
+++ b/src/core-files.json
@@ -17,7 +17,6 @@
"src/mbgl/geometry/feature_index.cpp",
"src/mbgl/geometry/line_atlas.cpp",
"src/mbgl/gl/attribute.cpp",
- "src/mbgl/gl/color_mode.cpp",
"src/mbgl/gl/context.cpp",
"src/mbgl/gl/cull_face_mode.cpp",
"src/mbgl/gl/debugging.cpp",
@@ -499,12 +498,12 @@
"mbgl/geometry/feature_index.hpp": "src/mbgl/geometry/feature_index.hpp",
"mbgl/geometry/line_atlas.hpp": "src/mbgl/geometry/line_atlas.hpp",
"mbgl/gfx/attribute.hpp": "src/mbgl/gfx/attribute.hpp",
+ "mbgl/gfx/color_mode.hpp": "src/mbgl/gfx/color_mode.hpp",
"mbgl/gfx/draw_mode.hpp": "src/mbgl/gfx/draw_mode.hpp",
"mbgl/gfx/primitives.hpp": "src/mbgl/gfx/primitives.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",
- "mbgl/gl/color_mode.hpp": "src/mbgl/gl/color_mode.hpp",
"mbgl/gl/context.hpp": "src/mbgl/gl/context.hpp",
"mbgl/gl/cull_face_mode.hpp": "src/mbgl/gl/cull_face_mode.hpp",
"mbgl/gl/debugging.hpp": "src/mbgl/gl/debugging.hpp",
diff --git a/src/mbgl/gl/color_mode.hpp b/src/mbgl/gfx/color_mode.hpp
index e394f43501..97bbc24096 100644
--- a/src/mbgl/gl/color_mode.hpp
+++ b/src/mbgl/gfx/color_mode.hpp
@@ -4,39 +4,39 @@
#include <mbgl/util/color.hpp>
namespace mbgl {
-namespace gl {
+namespace gfx {
class ColorMode {
public:
enum class BlendEquation {
- Add = 0x8006,
- Subtract = 0x800A,
- ReverseSubtract = 0x800B
+ Add,
+ Subtract,
+ ReverseSubtract
};
- enum BlendFactor {
- Zero = 0x0000,
- One = 0x0001,
- SrcColor = 0x0300,
- OneMinusSrcColor = 0x0301,
- SrcAlpha = 0x0302,
- OneMinusSrcAlpha = 0x0303,
- DstAlpha = 0x0304,
- OneMinusDstAlpha = 0x0305,
- DstColor = 0x0306,
- OneMinusDstColor = 0x0307,
- SrcAlphaSaturate = 0x0308,
- ConstantColor = 0x8001,
- OneMinusConstantColor = 0x8002,
- ConstantAlpha = 0x8003,
- OneMinusConstantAlpha = 0x8004
+ enum class BlendFactor {
+ Zero,
+ One,
+ SrcColor,
+ OneMinusSrcColor,
+ SrcAlpha,
+ OneMinusSrcAlpha,
+ DstAlpha,
+ OneMinusDstAlpha,
+ DstColor,
+ OneMinusDstColor,
+ SrcAlphaSaturate,
+ ConstantColor,
+ OneMinusConstantColor,
+ ConstantAlpha,
+ OneMinusConstantAlpha
};
template <BlendEquation E>
struct ConstantBlend {
static constexpr BlendEquation equation = E;
- static constexpr BlendFactor srcFactor = One;
- static constexpr BlendFactor dstFactor = One;
+ static constexpr BlendFactor srcFactor = BlendFactor::One;
+ static constexpr BlendFactor dstFactor = BlendFactor::One;
};
template <BlendEquation E>
@@ -48,8 +48,8 @@ public:
struct Replace {
static constexpr BlendEquation equation = BlendEquation::Add;
- static constexpr BlendFactor srcFactor = One;
- static constexpr BlendFactor dstFactor = Zero;
+ static constexpr BlendFactor srcFactor = BlendFactor::One;
+ static constexpr BlendFactor dstFactor = BlendFactor::Zero;
};
using Add = LinearBlend<BlendEquation::Add>;
@@ -75,19 +75,19 @@ public:
Mask mask;
static ColorMode disabled() {
- return ColorMode { Replace(), {}, { false, false, false, false } };
+ return { Replace{}, {}, { false, false, false, false } };
}
static ColorMode unblended() {
- return ColorMode { Replace(), {}, { true, true, true, true } };
+ return { Replace{}, {}, { true, true, true, true } };
}
static ColorMode alphaBlended() {
- return ColorMode { Add { One, OneMinusSrcAlpha }, {}, { true, true, true, true } };
+ return { Add{ BlendFactor::One, BlendFactor::OneMinusSrcAlpha }, {}, { true, true, true, true } };
}
static ColorMode additive() {
- return ColorMode { Add { One, One }, {}, { true, true, true, true } };
+ return { Add{ BlendFactor::One, BlendFactor::One }, {}, { true, true, true, true } };
}
};
@@ -95,5 +95,5 @@ constexpr bool operator!=(const ColorMode::Mask& a, const ColorMode::Mask& b) {
return a.r != b.r || a.g != b.g || a.b != b.b || a.a != b.a;
}
-} // namespace gl
+} // namespace gfx
} // namespace mbgl
diff --git a/src/mbgl/gl/color_mode.cpp b/src/mbgl/gl/color_mode.cpp
deleted file mode 100644
index e524bfdf98..0000000000
--- a/src/mbgl/gl/color_mode.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <mbgl/gl/color_mode.hpp>
-#include <mbgl/gl/defines.hpp>
-#include <mbgl/util/traits.hpp>
-
-namespace mbgl {
-namespace gl {
-
-static_assert(underlying_type(ColorMode::BlendEquation::Add) == GL_FUNC_ADD, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::BlendEquation::Subtract) == GL_FUNC_SUBTRACT, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::BlendEquation::ReverseSubtract) == GL_FUNC_REVERSE_SUBTRACT, "OpenGL enum mismatch");
-
-static_assert(underlying_type(ColorMode::Zero) == GL_ZERO, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::One) == GL_ONE, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::SrcColor) == GL_SRC_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusSrcColor) == GL_ONE_MINUS_SRC_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::DstColor) == GL_DST_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusDstColor) == GL_ONE_MINUS_DST_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::SrcAlpha) == GL_SRC_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusSrcAlpha) == GL_ONE_MINUS_SRC_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::DstAlpha) == GL_DST_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusDstAlpha) == GL_ONE_MINUS_DST_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::ConstantColor) == GL_CONSTANT_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusConstantColor) == GL_ONE_MINUS_CONSTANT_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::ConstantAlpha) == GL_CONSTANT_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusConstantAlpha) == GL_ONE_MINUS_CONSTANT_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::SrcAlphaSaturate) == GL_SRC_ALPHA_SATURATE, "OpenGL enum mismatch");
-
-static_assert(underlying_type(ColorMode::Zero) == GL_ZERO, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::One) == GL_ONE, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::SrcColor) == GL_SRC_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusSrcColor) == GL_ONE_MINUS_SRC_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::DstColor) == GL_DST_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusDstColor) == GL_ONE_MINUS_DST_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::SrcAlpha) == GL_SRC_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusSrcAlpha) == GL_ONE_MINUS_SRC_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::DstAlpha) == GL_DST_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusDstAlpha) == GL_ONE_MINUS_DST_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::ConstantColor) == GL_CONSTANT_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusConstantColor) == GL_ONE_MINUS_CONSTANT_COLOR, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::ConstantAlpha) == GL_CONSTANT_ALPHA, "OpenGL enum mismatch");
-static_assert(underlying_type(ColorMode::OneMinusConstantAlpha) == GL_ONE_MINUS_CONSTANT_ALPHA, "OpenGL enum mismatch");
-
-} // namespace gl
-} // namespace mbgl
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 64365a1018..ee82fa76ae 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -728,14 +728,14 @@ void Context::setStencilMode(const StencilMode& stencil) {
}
}
-void Context::setColorMode(const ColorMode& color) {
- if (color.blendFunction.is<ColorMode::Replace>()) {
+void Context::setColorMode(const gfx::ColorMode& color) {
+ if (color.blendFunction.is<gfx::ColorMode::Replace>()) {
blend = false;
} else {
blend = true;
blendColor = color.blendColor;
apply_visitor([&] (const auto& blendFunction) {
- blendEquation = ColorMode::BlendEquation(blendFunction.equation);
+ blendEquation = gfx::ColorMode::BlendEquation(blendFunction.equation);
blendFunc = { blendFunction.srcFactor, blendFunction.dstFactor };
}, color.blendFunction);
}
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index b09c64de5a..ceab6aadf1 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -14,7 +14,7 @@
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/gl/depth_mode.hpp>
#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/noncopyable.hpp>
@@ -172,7 +172,7 @@ public:
void setDepthMode(const DepthMode&);
void setStencilMode(const StencilMode&);
- void setColorMode(const ColorMode&);
+ void setColorMode(const gfx::ColorMode&);
void setCullFaceMode(const CullFaceMode&);
void draw(gfx::PrimitiveType,
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index 3ef7955949..83dd9a86f6 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -117,7 +117,7 @@ public:
DrawMode drawMode,
DepthMode depthMode,
StencilMode stencilMode,
- ColorMode colorMode,
+ gfx::ColorMode colorMode,
CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
VertexArray& vertexArray,
diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp
index d685e533a5..b926f599ee 100644
--- a/src/mbgl/gl/value.cpp
+++ b/src/mbgl/gl/value.cpp
@@ -8,6 +8,9 @@ namespace value {
using namespace platform;
+template <class T>
+T fromGLenum(const GLint);
+
const constexpr ClearDepth::Type ClearDepth::Default;
void ClearDepth::Set(const Type& value) {
@@ -174,29 +177,91 @@ Blend::Type Blend::Get() {
const constexpr BlendEquation::Type BlendEquation::Default;
+GLenum toGLenum(const gfx::ColorMode::BlendEquation blendEquation) {
+ switch (blendEquation) {
+ case gfx::ColorMode::BlendEquation::Add: return GL_FUNC_ADD;
+ case gfx::ColorMode::BlendEquation::Subtract: return GL_FUNC_SUBTRACT;
+ case gfx::ColorMode::BlendEquation::ReverseSubtract: return GL_FUNC_REVERSE_SUBTRACT;
+ }
+ return GL_INVALID_ENUM;
+}
+
void BlendEquation::Set(const Type& value) {
- MBGL_CHECK_ERROR(glBlendEquation(static_cast<GLenum>(value)));
+ MBGL_CHECK_ERROR(glBlendEquation(toGLenum(value)));
+}
+
+template <>
+gfx::ColorMode::BlendEquation fromGLenum<gfx::ColorMode::BlendEquation>(const GLint blendEquation) {
+ switch (blendEquation) {
+ case GL_FUNC_ADD: return gfx::ColorMode::BlendEquation::Add;
+ case GL_FUNC_SUBTRACT: return gfx::ColorMode::BlendEquation::Subtract;
+ case GL_FUNC_REVERSE_SUBTRACT: return gfx::ColorMode::BlendEquation::ReverseSubtract;
+ }
+ return {};
}
BlendEquation::Type BlendEquation::Get() {
GLint blend;
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_EQUATION_RGB, &blend));
- return static_cast<Type>(blend);
+ return fromGLenum<gfx::ColorMode::BlendEquation>(blend);
}
const constexpr BlendFunc::Type BlendFunc::Default;
+GLenum toGLenum(const gfx::ColorMode::BlendFactor blendFactor) {
+ switch (blendFactor) {
+ case gfx::ColorMode::BlendFactor::Zero: return GL_ZERO;
+ case gfx::ColorMode::BlendFactor::One: return GL_ONE;
+ case gfx::ColorMode::BlendFactor::SrcColor: return GL_SRC_COLOR;
+ case gfx::ColorMode::BlendFactor::OneMinusSrcColor: return GL_ONE_MINUS_SRC_COLOR;
+ case gfx::ColorMode::BlendFactor::DstColor: return GL_DST_COLOR;
+ case gfx::ColorMode::BlendFactor::OneMinusDstColor: return GL_ONE_MINUS_DST_COLOR;
+ case gfx::ColorMode::BlendFactor::SrcAlpha: return GL_SRC_ALPHA;
+ case gfx::ColorMode::BlendFactor::OneMinusSrcAlpha: return GL_ONE_MINUS_SRC_ALPHA;
+ case gfx::ColorMode::BlendFactor::DstAlpha: return GL_DST_ALPHA;
+ case gfx::ColorMode::BlendFactor::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA;
+ case gfx::ColorMode::BlendFactor::ConstantColor: return GL_CONSTANT_COLOR;
+ case gfx::ColorMode::BlendFactor::OneMinusConstantColor: return GL_ONE_MINUS_CONSTANT_COLOR;
+ case gfx::ColorMode::BlendFactor::ConstantAlpha: return GL_CONSTANT_ALPHA;
+ case gfx::ColorMode::BlendFactor::OneMinusConstantAlpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
+ case gfx::ColorMode::BlendFactor::SrcAlphaSaturate: return GL_SRC_ALPHA_SATURATE;
+ }
+ return GL_INVALID_ENUM;
+}
+
void BlendFunc::Set(const Type& value) {
MBGL_CHECK_ERROR(
- glBlendFunc(static_cast<GLenum>(value.sfactor), static_cast<GLenum>(value.dfactor)));
+ glBlendFunc(toGLenum(value.sfactor), toGLenum(value.dfactor)));
+}
+
+template <>
+gfx::ColorMode::BlendFactor fromGLenum<gfx::ColorMode::BlendFactor>(const GLint blendFactor) {
+ switch (blendFactor) {
+ case GL_ZERO: return gfx::ColorMode::BlendFactor::Zero;
+ case GL_ONE: return gfx::ColorMode::BlendFactor::One;
+ case GL_SRC_COLOR: return gfx::ColorMode::BlendFactor::SrcColor;
+ case GL_ONE_MINUS_SRC_COLOR: return gfx::ColorMode::BlendFactor::OneMinusSrcColor;
+ case GL_DST_COLOR: return gfx::ColorMode::BlendFactor::DstColor;
+ case GL_ONE_MINUS_DST_COLOR: return gfx::ColorMode::BlendFactor::OneMinusDstColor;
+ case GL_SRC_ALPHA: return gfx::ColorMode::BlendFactor::SrcAlpha;
+ case GL_ONE_MINUS_SRC_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusSrcAlpha;
+ case GL_DST_ALPHA: return gfx::ColorMode::BlendFactor::DstAlpha;
+ case GL_ONE_MINUS_DST_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusDstAlpha;
+ case GL_CONSTANT_COLOR: return gfx::ColorMode::BlendFactor::ConstantColor;
+ case GL_ONE_MINUS_CONSTANT_COLOR: return gfx::ColorMode::BlendFactor::OneMinusConstantColor;
+ case GL_CONSTANT_ALPHA: return gfx::ColorMode::BlendFactor::ConstantAlpha;
+ case GL_ONE_MINUS_CONSTANT_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusConstantAlpha;
+ case GL_SRC_ALPHA_SATURATE: return gfx::ColorMode::BlendFactor::SrcAlphaSaturate;
+ }
+ return {};
}
BlendFunc::Type BlendFunc::Get() {
GLint sfactor, dfactor;
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_SRC_ALPHA, &sfactor));
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_DST_ALPHA, &dfactor));
- return { static_cast<ColorMode::BlendFactor>(sfactor),
- static_cast<ColorMode::BlendFactor>(dfactor) };
+ return { fromGLenum<gfx::ColorMode::BlendFactor>(sfactor),
+ fromGLenum<gfx::ColorMode::BlendFactor>(dfactor) };
}
const BlendColor::Type BlendColor::Default { 0, 0, 0, 0 };
diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp
index 8e2c995e11..8bc5c624bf 100644
--- a/src/mbgl/gl/value.hpp
+++ b/src/mbgl/gl/value.hpp
@@ -3,7 +3,7 @@
#include <mbgl/gl/types.hpp>
#include <mbgl/gl/depth_mode.hpp>
#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/gl/cull_face_mode.hpp>
#include <mbgl/gl/attribute.hpp>
#include <mbgl/platform/gl_functions.hpp>
@@ -54,7 +54,7 @@ struct DepthMask {
};
struct ColorMask {
- using Type = ColorMode::Mask;
+ using Type = gfx::ColorMode::Mask;
static const constexpr Type Default = { true, true, true, true };
static void Set(const Type&);
static Type Get();
@@ -126,18 +126,18 @@ struct Blend {
};
struct BlendEquation {
- using Type = ColorMode::BlendEquation;
- static const constexpr Type Default = ColorMode::BlendEquation::Add;
+ using Type = gfx::ColorMode::BlendEquation;
+ static const constexpr Type Default = gfx::ColorMode::BlendEquation::Add;
static void Set(const Type&);
static Type Get();
};
struct BlendFunc {
struct Type {
- ColorMode::BlendFactor sfactor;
- ColorMode::BlendFactor dfactor;
+ gfx::ColorMode::BlendFactor sfactor;
+ gfx::ColorMode::BlendFactor dfactor;
};
- static const constexpr Type Default = { ColorMode::One, ColorMode::Zero };
+ static const constexpr Type Default = { gfx::ColorMode::BlendFactor::One, gfx::ColorMode::BlendFactor::Zero };
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 1adfadf794..98f4f9320c 100644
--- a/src/mbgl/programs/collision_box_program.hpp
+++ b/src/mbgl/programs/collision_box_program.hpp
@@ -60,7 +60,7 @@ public:
DrawMode drawMode,
gl::DepthMode depthMode,
gl::StencilMode stencilMode,
- gl::ColorMode colorMode,
+ gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
@@ -141,7 +141,7 @@ public:
DrawMode drawMode,
gl::DepthMode depthMode,
gl::StencilMode stencilMode,
- gl::ColorMode colorMode,
+ gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index 429937dd7d..0f70c25ded 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -73,7 +73,7 @@ public:
DrawMode drawMode,
gl::DepthMode depthMode,
gl::StencilMode stencilMode,
- gl::ColorMode colorMode,
+ gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const SegmentVector<Attributes>& segments,
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index ebe40f15b4..64157b6baf 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -308,7 +308,7 @@ public:
DrawMode drawMode,
gl::DepthMode depthMode,
gl::StencilMode stencilMode,
- gl::ColorMode colorMode,
+ gfx::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const SegmentVector<Attributes>& segments,
diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
index d380afea00..ef0f378022 100644
--- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp
+++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp
@@ -122,7 +122,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
stencilMode,
- gl::ColorMode::additive(),
+ gfx::ColorMode::additive(),
gl::CullFaceMode::disabled(),
*bucket.indexBuffer,
bucket.segments,
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp
index a7f621eb61..7ab232731c 100644
--- a/src/mbgl/renderer/paint_parameters.cpp
+++ b/src/mbgl/renderer/paint_parameters.cpp
@@ -79,21 +79,21 @@ gl::StencilMode PaintParameters::stencilModeForClipping(const ClipID& id) const
};
}
-gl::ColorMode PaintParameters::colorModeForRenderPass() const {
+gfx::ColorMode PaintParameters::colorModeForRenderPass() const {
if (debugOptions & MapDebugOptions::Overdraw) {
const float overdraw = 1.0f / 8.0f;
- return gl::ColorMode {
- gl::ColorMode::Add {
- gl::ColorMode::ConstantColor,
- gl::ColorMode::One
+ return gfx::ColorMode {
+ gfx::ColorMode::Add {
+ gfx::ColorMode::BlendFactor::ConstantColor,
+ gfx::ColorMode::BlendFactor::One
},
Color { overdraw, overdraw, overdraw, 0.0f },
- gl::ColorMode::Mask { true, true, true, true }
+ gfx::ColorMode::Mask { true, true, true, true }
};
} else if (pass == RenderPass::Translucent) {
- return gl::ColorMode::alphaBlended();
+ return gfx::ColorMode::alphaBlended();
} else {
- return gl::ColorMode::unblended();
+ return gfx::ColorMode::unblended();
}
}
diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp
index cd95003ac0..8045ef7291 100644
--- a/src/mbgl/renderer/paint_parameters.hpp
+++ b/src/mbgl/renderer/paint_parameters.hpp
@@ -6,7 +6,7 @@
#include <mbgl/map/mode.hpp>
#include <mbgl/gl/depth_mode.hpp>
#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/gfx/color_mode.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/algorithm/generate_clip_ids.hpp>
@@ -64,7 +64,7 @@ public:
gl::DepthMode depthModeForSublayer(uint8_t n, gl::DepthMode::Mask) const;
gl::DepthMode depthModeFor3D(gl::DepthMode::Mask) const;
gl::StencilMode stencilModeForClipping(const ClipID&) const;
- gl::ColorMode colorModeForRenderPass() const;
+ gfx::ColorMode colorModeForRenderPass() const;
mat4 matrixForTile(const UnwrappedTileID&, bool aligned = false) const;
diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp
index e4af47937d..5aea1da023 100644
--- a/src/mbgl/renderer/render_tile.cpp
+++ b/src/mbgl/renderer/render_tile.cpp
@@ -98,7 +98,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
gfx::Lines { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
- gl::ColorMode::unblended(),
+ gfx::ColorMode::unblended(),
gl::CullFaceMode::disabled(),
*tile.debugBucket->indexBuffer,
tile.debugBucket->segments,
@@ -120,7 +120,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
gfx::Lines { 2.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
- gl::ColorMode::unblended(),
+ gfx::ColorMode::unblended(),
gl::CullFaceMode::disabled(),
*tile.debugBucket->indexBuffer,
tile.debugBucket->segments,
@@ -144,7 +144,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
gfx::LineStrip { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
- gl::ColorMode::unblended(),
+ gfx::ColorMode::unblended(),
gl::CullFaceMode::disabled(),
parameters.staticData.tileBorderIndexBuffer,
parameters.staticData.tileBorderSegments,
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 14cb291a31..d975d5d9a7 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -452,7 +452,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
gl::StencilMode::Keep,
gl::StencilMode::Replace
},
- gl::ColorMode::disabled(),
+ gfx::ColorMode::disabled(),
gl::CullFaceMode::disabled(),
parameters.staticData.quadTriangleIndexBuffer,
parameters.staticData.tileTriangleSegments,
@@ -479,7 +479,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
if (parameters.debugOptions & MapDebugOptions::StencilClip) {
parameters.context.setStencilMode(gl::StencilMode::disabled());
parameters.context.setDepthMode(gl::DepthMode::disabled());
- parameters.context.setColorMode(gl::ColorMode::unblended());
+ parameters.context.setColorMode(gfx::ColorMode::unblended());
parameters.context.program = 0;
// Reset the value in case someone else changed it, or it's dirty.
@@ -562,7 +562,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
if (parameters.debugOptions & MapDebugOptions::DepthBuffer) {
parameters.context.setStencilMode(gl::StencilMode::disabled());
parameters.context.setDepthMode(gl::DepthMode::disabled());
- parameters.context.setColorMode(gl::ColorMode::unblended());
+ parameters.context.setColorMode(gfx::ColorMode::unblended());
parameters.context.program = 0;
// Scales the values in the depth buffer so that they cover the entire grayscale range. This
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index a020d6ff13..c2abb72962 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -66,7 +66,7 @@ void RenderImageSource::finishRender(PaintParameters& parameters) {
gfx::LineStrip { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
- gl::ColorMode::unblended(),
+ gfx::ColorMode::unblended(),
gl::CullFaceMode::disabled(),
parameters.staticData.tileBorderIndexBuffer,
parameters.staticData.tileBorderSegments,