diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-02-28 11:23:26 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-03-01 09:33:37 +0100 |
commit | 4982933a78229085ee7a404fded70ad0cf2abc25 (patch) | |
tree | 022c4913aa389782bab7e202550eaf3468650c04 /src | |
parent | fde7c20f36ce2ecfdd79d2722fc2f0bee72e7e99 (diff) | |
download | qtlocation-mapboxgl-4982933a78229085ee7a404fded70ad0cf2abc25.tar.gz |
[core] move DepthMode to gfx namespace
Diffstat (limited to 'src')
30 files changed, 140 insertions, 123 deletions
diff --git a/src/core-files.json b/src/core-files.json index aced36c2b4..e9dc01c64d 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -21,7 +21,6 @@ "src/mbgl/gl/cull_face_mode.cpp", "src/mbgl/gl/debugging.cpp", "src/mbgl/gl/debugging_extension.cpp", - "src/mbgl/gl/depth_mode.cpp", "src/mbgl/gl/enum.cpp", "src/mbgl/gl/object.cpp", "src/mbgl/gl/stencil_mode.cpp", @@ -500,6 +499,7 @@ "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/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/types.hpp": "src/mbgl/gfx/types.hpp", @@ -510,7 +510,6 @@ "mbgl/gl/debugging.hpp": "src/mbgl/gl/debugging.hpp", "mbgl/gl/debugging_extension.hpp": "src/mbgl/gl/debugging_extension.hpp", "mbgl/gl/defines.hpp": "src/mbgl/gl/defines.hpp", - "mbgl/gl/depth_mode.hpp": "src/mbgl/gl/depth_mode.hpp", "mbgl/gl/enum.hpp": "src/mbgl/gl/enum.hpp", "mbgl/gl/extension.hpp": "src/mbgl/gl/extension.hpp", "mbgl/gl/features.hpp": "src/mbgl/gl/features.hpp", diff --git a/src/mbgl/gfx/depth_mode.hpp b/src/mbgl/gfx/depth_mode.hpp new file mode 100644 index 0000000000..93a13be091 --- /dev/null +++ b/src/mbgl/gfx/depth_mode.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include <mbgl/gfx/types.hpp> +#include <mbgl/util/range.hpp> + +namespace mbgl { +namespace gfx { + +class DepthMode { +public: + DepthFunctionType func; + DepthMaskType mask; + Range<float> range; + + static DepthMode disabled() { + return DepthMode { DepthFunctionType::Always, DepthMaskType::ReadOnly, { 0.0, 1.0 } }; + } +}; + +} // namespace gfx +} // namespace mbgl diff --git a/src/mbgl/gfx/types.hpp b/src/mbgl/gfx/types.hpp index adf3395db0..264fa67b04 100644 --- a/src/mbgl/gfx/types.hpp +++ b/src/mbgl/gfx/types.hpp @@ -12,13 +12,13 @@ enum class PrimitiveType : uint8_t { LineStrip, Triangles, TriangleStrip, - TriangleFan + TriangleFan, }; enum class ColorBlendEquationType : uint8_t { Add, Subtract, - ReverseSubtract + ReverseSubtract, }; enum class ColorBlendFactorType : uint8_t { @@ -36,7 +36,23 @@ enum class ColorBlendFactorType : uint8_t { ConstantColor, OneMinusConstantColor, ConstantAlpha, - OneMinusConstantAlpha + OneMinusConstantAlpha, +}; + +enum class DepthFunctionType : uint8_t { + Never, + Less, + Equal, + LessEqual, + Greater, + NotEqual, + GreaterEqual, + Always, +}; + +enum class DepthMaskType : bool { + ReadOnly = false, + ReadWrite = true, }; } // namespace gfx diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index a7b40b6448..1be6a32f2b 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -698,8 +698,8 @@ void Context::setDrawMode(const gfx::Triangles&) { void Context::setDrawMode(const gfx::TriangleStrip&) { } -void Context::setDepthMode(const DepthMode& depth) { - if (depth.func == DepthMode::Always && !depth.mask) { +void Context::setDepthMode(const gfx::DepthMode& depth) { + if (depth.func == gfx::DepthFunctionType::Always && depth.mask != gfx::DepthMaskType::ReadWrite) { depthTest = false; // Workaround for rendering errors on Adreno 2xx GPUs. Depth-related state should diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index ceab6aadf1..e296e81452 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -12,7 +12,7 @@ #include <mbgl/gl/vertex_array.hpp> #include <mbgl/gl/types.hpp> #include <mbgl/gfx/draw_mode.hpp> -#include <mbgl/gl/depth_mode.hpp> +#include <mbgl/gfx/depth_mode.hpp> #include <mbgl/gl/stencil_mode.hpp> #include <mbgl/gfx/color_mode.hpp> #include <mbgl/platform/gl_functions.hpp> @@ -170,7 +170,7 @@ public: void setDrawMode(const gfx::Triangles&); void setDrawMode(const gfx::TriangleStrip&); - void setDepthMode(const DepthMode&); + void setDepthMode(const gfx::DepthMode&); void setStencilMode(const StencilMode&); void setColorMode(const gfx::ColorMode&); void setCullFaceMode(const CullFaceMode&); diff --git a/src/mbgl/gl/depth_mode.cpp b/src/mbgl/gl/depth_mode.cpp deleted file mode 100644 index fdd9cf31d1..0000000000 --- a/src/mbgl/gl/depth_mode.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include <mbgl/gl/depth_mode.hpp> -#include <mbgl/gl/defines.hpp> -#include <mbgl/util/traits.hpp> - -namespace mbgl { -namespace gl { - -static_assert(underlying_type(DepthMode::Never) == GL_NEVER, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::Less) == GL_LESS, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::Equal) == GL_EQUAL, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::LessEqual) == GL_LEQUAL, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::Greater) == GL_GREATER, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::NotEqual) == GL_NOTEQUAL, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::GreaterEqual) == GL_GEQUAL, "OpenGL enum mismatch"); -static_assert(underlying_type(DepthMode::Always) == GL_ALWAYS, "OpenGL enum mismatch"); - -} // namespace gl -} // namespace mbgl diff --git a/src/mbgl/gl/depth_mode.hpp b/src/mbgl/gl/depth_mode.hpp deleted file mode 100644 index 37617e3c34..0000000000 --- a/src/mbgl/gl/depth_mode.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include <mbgl/util/range.hpp> - -namespace mbgl { -namespace gl { - -class DepthMode { -public: - enum Function { - Never = 0x0200, - Less = 0x0201, - Equal = 0x0202, - LessEqual = 0x0203, - Greater = 0x0204, - NotEqual = 0x0205, - GreaterEqual = 0x0206, - Always = 0x0207 - }; - - enum Mask : bool { - ReadOnly = false, - ReadWrite = true - }; - - Function func; - Mask mask; - Range<float> range; - - static DepthMode disabled() { - return DepthMode { Always, ReadOnly, { 0.0, 1.0 } }; - } -}; - -} // namespace gl -} // namespace mbgl diff --git a/src/mbgl/gl/enum.cpp b/src/mbgl/gl/enum.cpp index 87b3a96284..a6f251a438 100644 --- a/src/mbgl/gl/enum.cpp +++ b/src/mbgl/gl/enum.cpp @@ -5,16 +5,6 @@ namespace mbgl { namespace gl { -// template <> -// gfx::PrimitiveType Enum::from(const platform::GLint value) { - -// } - -// template <> -// platform::GLenum Enum::to(const gfx::PrimitiveType value) { - -// } - template <> platform::GLenum Enum<gfx::PrimitiveType>::to(const gfx::PrimitiveType value) { switch (value) { @@ -50,8 +40,8 @@ platform::GLenum Enum<gfx::ColorBlendEquationType>::to(const gfx::ColorBlendEqua } template <> -gfx::ColorBlendFactorType Enum<gfx::ColorBlendFactorType>::from(const platform::GLint blendFactor) { - switch (blendFactor) { +gfx::ColorBlendFactorType Enum<gfx::ColorBlendFactorType>::from(const platform::GLint value) { + switch (value) { case GL_ZERO: return gfx::ColorBlendFactorType::Zero; case GL_ONE: return gfx::ColorBlendFactorType::One; case GL_SRC_COLOR: return gfx::ColorBlendFactorType::SrcColor; @@ -93,5 +83,45 @@ platform::GLenum Enum<gfx::ColorBlendFactorType>::to(const gfx::ColorBlendFactor return GL_INVALID_ENUM; } +template <> +gfx::DepthFunctionType Enum<gfx::DepthFunctionType>::from(const platform::GLint value) { + switch (value) { + case GL_NEVER: return gfx::DepthFunctionType::Never; + case GL_LESS: return gfx::DepthFunctionType::Less; + case GL_EQUAL: return gfx::DepthFunctionType::Equal; + case GL_LEQUAL: return gfx::DepthFunctionType::LessEqual; + case GL_GREATER: return gfx::DepthFunctionType::Greater; + case GL_NOTEQUAL: return gfx::DepthFunctionType::NotEqual; + case GL_GEQUAL: return gfx::DepthFunctionType::GreaterEqual; + case GL_ALWAYS: return gfx::DepthFunctionType::Always; + } + return {}; +} + +template <> +platform::GLenum Enum<gfx::DepthFunctionType>::to(const gfx::DepthFunctionType value) { + switch (value) { + case gfx::DepthFunctionType::Never: return GL_NEVER; + case gfx::DepthFunctionType::Less: return GL_LESS; + case gfx::DepthFunctionType::Equal: return GL_EQUAL; + case gfx::DepthFunctionType::LessEqual: return GL_LEQUAL; + case gfx::DepthFunctionType::Greater: return GL_GREATER; + case gfx::DepthFunctionType::NotEqual: return GL_NOTEQUAL; + case gfx::DepthFunctionType::GreaterEqual: return GL_GEQUAL; + case gfx::DepthFunctionType::Always: return GL_ALWAYS; + } + return GL_INVALID_ENUM; +} + +template <> +gfx::DepthMaskType Enum<gfx::DepthMaskType>::from(const platform::GLboolean value) { + return value ? gfx::DepthMaskType::ReadWrite : gfx::DepthMaskType::ReadOnly; +} + +template <> +platform::GLboolean Enum<gfx::DepthMaskType>::to(const gfx::DepthMaskType value) { + return value == gfx::DepthMaskType::ReadWrite ? GL_TRUE : GL_FALSE; +} + } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/enum.hpp b/src/mbgl/gl/enum.hpp index aaed3a962b..6aa29efdb1 100644 --- a/src/mbgl/gl/enum.hpp +++ b/src/mbgl/gl/enum.hpp @@ -2,14 +2,19 @@ #include <mbgl/platform/gl_functions.hpp> +#include <type_traits> + namespace mbgl { namespace gl { template <typename T> class Enum { public: - static T from(const platform::GLint); - static platform::GLenum to(T); + using InType = std::conditional_t<std::is_same<std::underlying_type_t<T>, bool>::value, platform::GLboolean, platform::GLint>; + using OutType = std::conditional_t<std::is_same<std::underlying_type_t<T>, bool>::value, platform::GLboolean, platform::GLenum>; + + static T from(const InType); + static OutType to(T); }; } // namespace gl diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 83dd9a86f6..de51e8dcb6 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -115,7 +115,7 @@ public: template <class DrawMode> void draw(Context& context, DrawMode drawMode, - DepthMode depthMode, + gfx::DepthMode depthMode, StencilMode stencilMode, gfx::ColorMode colorMode, CullFaceMode cullFaceMode, diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp index d17ffb6714..800c39a9d6 100644 --- a/src/mbgl/gl/value.cpp +++ b/src/mbgl/gl/value.cpp @@ -60,13 +60,13 @@ StencilMask::Type StencilMask::Get() { const constexpr DepthMask::Type DepthMask::Default; void DepthMask::Set(const Type& value) { - MBGL_CHECK_ERROR(glDepthMask(value)); + MBGL_CHECK_ERROR(glDepthMask(Enum<gfx::DepthMaskType>::to(value))); } DepthMask::Type DepthMask::Get() { GLboolean depthMask; MBGL_CHECK_ERROR(glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask)); - return depthMask; + return Enum<gfx::DepthMaskType>::from(depthMask); } const constexpr ColorMask::Type ColorMask::Default; diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp index b284ada51b..d7a8ddf6fe 100644 --- a/src/mbgl/gl/value.hpp +++ b/src/mbgl/gl/value.hpp @@ -1,7 +1,7 @@ #pragma once #include <mbgl/gl/types.hpp> -#include <mbgl/gl/depth_mode.hpp> +#include <mbgl/gfx/depth_mode.hpp> #include <mbgl/gl/stencil_mode.hpp> #include <mbgl/gfx/color_mode.hpp> #include <mbgl/gl/cull_face_mode.hpp> @@ -47,8 +47,8 @@ struct StencilMask { }; struct DepthMask { - using Type = bool; - static const constexpr Type Default = true; + using Type = gfx::DepthMaskType; + static const constexpr Type Default = gfx::DepthMaskType::ReadWrite; static void Set(const Type&); static Type Get(); }; @@ -112,8 +112,8 @@ struct DepthTest { }; struct DepthFunc { - using Type = DepthMode::Function; - static const constexpr Type Default = DepthMode::Less; + using Type = gfx::DepthFunctionType; + static const constexpr Type Default = gfx::DepthFunctionType::Less; 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 98f4f9320c..434211af3e 100644 --- a/src/mbgl/programs/collision_box_program.hpp +++ b/src/mbgl/programs/collision_box_program.hpp @@ -58,7 +58,7 @@ public: template <class DrawMode> void draw(gl::Context& context, DrawMode drawMode, - gl::DepthMode depthMode, + gfx::DepthMode depthMode, gl::StencilMode stencilMode, gfx::ColorMode colorMode, gl::CullFaceMode cullFaceMode, @@ -139,7 +139,7 @@ public: template <class DrawMode> void draw(gl::Context& context, DrawMode drawMode, - gl::DepthMode depthMode, + gfx::DepthMode depthMode, gl::StencilMode stencilMode, gfx::ColorMode colorMode, gl::CullFaceMode cullFaceMode, diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index 0f70c25ded..aeeb840fda 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -71,7 +71,7 @@ public: template <class DrawMode> void draw(gl::Context& context, DrawMode drawMode, - gl::DepthMode depthMode, + gfx::DepthMode depthMode, gl::StencilMode stencilMode, gfx::ColorMode colorMode, gl::CullFaceMode cullFaceMode, diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 64157b6baf..6871b2b4b8 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -306,7 +306,7 @@ public: template <class DrawMode> void draw(gl::Context& context, DrawMode drawMode, - gl::DepthMode depthMode, + gfx::DepthMode depthMode, gl::StencilMode stencilMode, gfx::ColorMode colorMode, gl::CullFaceMode cullFaceMode, diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp index df22514677..21c209d5f0 100644 --- a/src/mbgl/renderer/layers/render_background_layer.cpp +++ b/src/mbgl/renderer/layers/render_background_layer.cpp @@ -68,7 +68,7 @@ void RenderBackgroundLayer::render(PaintParameters& parameters, RenderSource*) { program.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 888cc190a3..1754111335 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -97,7 +97,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) { programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), parameters.mapMode != MapMode::Continuous ? parameters.stencilModeForClipping(tile.clip) : gl::StencilMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index 5ff0f1f812..4880919c36 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -62,7 +62,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, gl::DepthMode::ReadOnly)); + glContext.setDepthMode(paintParameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly)); glContext.setStencilMode(gl::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 0552092f20..5ecd0fb7d4 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -93,7 +93,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeFor3D(gl::DepthMode::ReadWrite), + parameters.depthModeFor3D(gfx::DepthMaskType::ReadWrite), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::backCCW(), @@ -194,7 +194,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* programInstance.draw( parameters.context, gfx::Triangles(), - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 303120d815..d529831997 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -121,8 +121,8 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { draw(parameters.programs.getFillLayerPrograms().fill, gfx::Triangles(), parameters.depthModeForSublayer(1, parameters.pass == RenderPass::Opaque - ? gl::DepthMode::ReadWrite - : gl::DepthMode::ReadOnly), + ? gfx::DepthMaskType::ReadWrite + : gfx::DepthMaskType::ReadOnly), *bucket.triangleIndexBuffer, bucket.triangleSegments); } @@ -132,7 +132,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { gfx::Lines{ 2.0f }, parameters.depthModeForSublayer( unevaluated.get<FillOutlineColor>().isUndefined() ? 2 : 0, - gl::DepthMode::ReadOnly), + gfx::DepthMaskType::ReadOnly), *bucket.lineIndexBuffer, bucket.lineSegments); } @@ -206,14 +206,14 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { draw(parameters.programs.getFillLayerPrograms().fillPattern, gfx::Triangles(), - parameters.depthModeForSublayer(1, gl::DepthMode::ReadWrite), + parameters.depthModeForSublayer(1, gfx::DepthMaskType::ReadWrite), *bucket.triangleIndexBuffer, bucket.triangleSegments); if (evaluated.get<FillAntialias>() && unevaluated.get<FillOutlineColor>().isUndefined()) { draw(parameters.programs.getFillLayerPrograms().fillOutlinePattern, gfx::Lines { 2.0f }, - parameters.depthModeForSublayer(2, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(2, gfx::DepthMaskType::ReadOnly), *bucket.lineIndexBuffer, bucket.lineSegments); } diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index ef0f378022..d03cb95261 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -120,7 +120,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), stencilMode, gfx::ColorMode::additive(), gl::CullFaceMode::disabled(), @@ -168,7 +168,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { programInstance.draw( parameters.context, gfx::Triangles(), - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 9b94e5145c..732a0c909c 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -97,7 +97,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), @@ -158,7 +158,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 98fedd9bd7..8b303890eb 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -88,7 +88,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) { programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), parameters.stencilModeForClipping(tile.clip), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index 666a2ab913..494ef0d094 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -111,7 +111,7 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source programInstance.draw( parameters.context, gfx::Triangles(), - parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly), + parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index eb1ae26a8d..466e988cd0 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -118,8 +118,8 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { parameters.context, gfx::Triangles(), values_.pitchAlignment == AlignmentType::Map - ? parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly) - : gl::DepthMode::disabled(), + ? parameters.depthModeForSublayer(0, gfx::DepthMaskType::ReadOnly) + : gfx::DepthMode::disabled(), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), @@ -252,7 +252,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { parameters.programs.getSymbolLayerPrograms().collisionBox.draw( parameters.context, gfx::Lines { 1.0f }, - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), @@ -287,7 +287,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { parameters.programs.getSymbolLayerPrograms().collisionCircle.draw( parameters.context, gfx::Triangles(), - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index bdea5989d4..0c7ae7a857 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -58,14 +58,14 @@ mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID, bool aligned) return matrix; } -gl::DepthMode PaintParameters::depthModeForSublayer(uint8_t n, gl::DepthMode::Mask mask) const { +gfx::DepthMode PaintParameters::depthModeForSublayer(uint8_t n, gfx::DepthMaskType mask) const { float nearDepth = ((1 + currentLayer) * numSublayers + n) * depthEpsilon; float farDepth = nearDepth + depthRangeSize; - return gl::DepthMode { gl::DepthMode::LessEqual, mask, { nearDepth, farDepth } }; + return gfx::DepthMode { gfx::DepthFunctionType::LessEqual, mask, { nearDepth, farDepth } }; } -gl::DepthMode PaintParameters::depthModeFor3D(gl::DepthMode::Mask mask) const { - return gl::DepthMode { gl::DepthMode::LessEqual, mask, { 0.0, 1.0 } }; +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 { diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp index 8045ef7291..ccfd12b409 100644 --- a/src/mbgl/renderer/paint_parameters.hpp +++ b/src/mbgl/renderer/paint_parameters.hpp @@ -4,7 +4,7 @@ #include <mbgl/renderer/render_light.hpp> #include <mbgl/renderer/mode.hpp> #include <mbgl/map/mode.hpp> -#include <mbgl/gl/depth_mode.hpp> +#include <mbgl/gfx/depth_mode.hpp> #include <mbgl/gl/stencil_mode.hpp> #include <mbgl/gfx/color_mode.hpp> #include <mbgl/util/mat4.hpp> @@ -61,8 +61,8 @@ public: Programs& programs; - gl::DepthMode depthModeForSublayer(uint8_t n, gl::DepthMode::Mask) const; - gl::DepthMode depthModeFor3D(gl::DepthMode::Mask) const; + gfx::DepthMode depthModeForSublayer(uint8_t n, gfx::DepthMaskType) const; + gfx::DepthMode depthModeFor3D(gfx::DepthMaskType) const; gl::StencilMode stencilModeForClipping(const ClipID&) const; gfx::ColorMode colorModeForRenderPass() const; diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index 5aea1da023..358965847f 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -96,7 +96,7 @@ void RenderTile::finishRender(PaintParameters& parameters) { program.draw( parameters.context, gfx::Lines { 4.0f * parameters.pixelRatio }, - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), parameters.stencilModeForClipping(clip), gfx::ColorMode::unblended(), gl::CullFaceMode::disabled(), @@ -118,7 +118,7 @@ void RenderTile::finishRender(PaintParameters& parameters) { program.draw( parameters.context, gfx::Lines { 2.0f * parameters.pixelRatio }, - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), parameters.stencilModeForClipping(clip), gfx::ColorMode::unblended(), gl::CullFaceMode::disabled(), @@ -142,7 +142,7 @@ void RenderTile::finishRender(PaintParameters& parameters) { parameters.programs.debug.draw( parameters.context, gfx::LineStrip { 4.0f * parameters.pixelRatio }, - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), parameters.stencilModeForClipping(clip), gfx::ColorMode::unblended(), gl::CullFaceMode::disabled(), diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index d975d5d9a7..514d02808e 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -443,7 +443,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { program.draw( parameters.context, gfx::Triangles(), - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode { gl::StencilMode::Always(), static_cast<int32_t>(clipID.second.reference.to_ulong()), @@ -478,7 +478,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { // Render tile clip boundaries, using stencil buffer to calculate fill color. if (parameters.debugOptions & MapDebugOptions::StencilClip) { parameters.context.setStencilMode(gl::StencilMode::disabled()); - parameters.context.setDepthMode(gl::DepthMode::disabled()); + parameters.context.setDepthMode(gfx::DepthMode::disabled()); parameters.context.setColorMode(gfx::ColorMode::unblended()); parameters.context.program = 0; @@ -561,7 +561,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { // Render the depth buffer. if (parameters.debugOptions & MapDebugOptions::DepthBuffer) { parameters.context.setStencilMode(gl::StencilMode::disabled()); - parameters.context.setDepthMode(gl::DepthMode::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 c2abb72962..25fa0ba038 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -64,7 +64,7 @@ void RenderImageSource::finishRender(PaintParameters& parameters) { programInstance.draw( parameters.context, gfx::LineStrip { 4.0f * parameters.pixelRatio }, - gl::DepthMode::disabled(), + gfx::DepthMode::disabled(), gl::StencilMode::disabled(), gfx::ColorMode::unblended(), gl::CullFaceMode::disabled(), |