summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2019-02-08 15:45:05 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-02-12 19:42:08 +0200
commit690833ef9212756cbdd1945e2f447f22cc05816e (patch)
tree4dca89518c6b54c60c669aacd8fbff9c15801418
parent470b01847db1046bbae872f932b0e83ebf3af5f8 (diff)
downloadqtlocation-mapboxgl-690833ef9212756cbdd1945e2f447f22cc05816e.tar.gz
[core] Switch to the new OpenGL abstraction
This patch will make Mapbox GL Core never use OpenGL directly. We should consider locking into OpenGL ES 2.0 to simplify the code path and remove #ifdefs.
-rw-r--r--platform/android/core-files.json1
-rw-r--r--platform/ios/core-files.json1
-rw-r--r--platform/linux/config.cmake3
-rw-r--r--platform/macos/core-files.json1
-rw-r--r--platform/qt/config.cmake2
-rw-r--r--platform/qt/qt.cmake1
-rw-r--r--src/core-files.json5
-rw-r--r--src/mbgl/gl/attribute.cpp4
-rw-r--r--src/mbgl/gl/color_mode.cpp2
-rw-r--r--src/mbgl/gl/context.cpp3
-rw-r--r--src/mbgl/gl/context.hpp1
-rw-r--r--src/mbgl/gl/cull_face_mode.cpp2
-rw-r--r--src/mbgl/gl/debugging.cpp2
-rw-r--r--src/mbgl/gl/debugging_extension.hpp4
-rw-r--r--src/mbgl/gl/depth_mode.cpp2
-rw-r--r--src/mbgl/gl/gl.cpp71
-rw-r--r--src/mbgl/gl/gl.hpp24
-rw-r--r--src/mbgl/gl/program_binary_extension.hpp2
-rw-r--r--src/mbgl/gl/stencil_mode.cpp2
-rw-r--r--src/mbgl/gl/uniform.cpp8
-rw-r--r--src/mbgl/gl/value.cpp11
-rw-r--r--src/mbgl/gl/value.hpp1
-rw-r--r--src/mbgl/gl/vertex_array.cpp1
-rw-r--r--src/mbgl/gl/vertex_array_extension.hpp8
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp6
-rw-r--r--test/api/custom_geometry_source.test.cpp1
-rw-r--r--test/api/custom_layer.test.cpp4
-rw-r--r--test/gl/context.test.cpp4
-rw-r--r--test/util/offscreen_texture.test.cpp4
29 files changed, 51 insertions, 130 deletions
diff --git a/platform/android/core-files.json b/platform/android/core-files.json
index c1dc9e8429..875e61ece9 100644
--- a/platform/android/core-files.json
+++ b/platform/android/core-files.json
@@ -81,6 +81,7 @@
"platform/android/src/style/value.cpp",
"platform/android/src/text/collator.cpp",
"platform/android/src/text/local_glyph_rasterizer.cpp",
+ "platform/android/src/gl_functions.cpp",
"platform/android/src/thread.cpp",
"platform/android/src/timer.cpp",
"platform/android/src/unaccent.cpp",
diff --git a/platform/ios/core-files.json b/platform/ios/core-files.json
index 18a8ed5b86..f161e98710 100644
--- a/platform/ios/core-files.json
+++ b/platform/ios/core-files.json
@@ -2,6 +2,7 @@
"//": "This file can be edited manually and is the canonical source.",
"sources": [
"platform/darwin/src/collator.mm",
+ "platform/darwin/src/gl_functions.cpp",
"platform/darwin/src/headless_backend_eagl.mm",
"platform/darwin/src/image.mm",
"platform/darwin/src/local_glyph_rasterizer.mm",
diff --git a/platform/linux/config.cmake b/platform/linux/config.cmake
index 1df501a84e..6d4715e451 100644
--- a/platform/linux/config.cmake
+++ b/platform/linux/config.cmake
@@ -41,6 +41,9 @@ macro(mbgl_platform_core)
endif()
target_sources(mbgl-core
+ # GL
+ PRIVATE platform/linux/src/gl_functions.cpp
+
# Misc
PRIVATE platform/default/src/mbgl/util/logging_stderr.cpp
PRIVATE platform/default/src/mbgl/util/string_stdlib.cpp
diff --git a/platform/macos/core-files.json b/platform/macos/core-files.json
index bfc63d5027..9ec41f651a 100644
--- a/platform/macos/core-files.json
+++ b/platform/macos/core-files.json
@@ -2,6 +2,7 @@
"//": "This file can be edited manually and is the canonical source.",
"sources": [
"platform/darwin/src/collator.mm",
+ "platform/darwin/src/gl_functions.cpp",
"platform/darwin/src/image.mm",
"platform/darwin/src/local_glyph_rasterizer.mm",
"platform/darwin/src/logging_nslog.mm",
diff --git a/platform/qt/config.cmake b/platform/qt/config.cmake
index 68b32b9eb9..9249f846e8 100644
--- a/platform/qt/config.cmake
+++ b/platform/qt/config.cmake
@@ -6,9 +6,9 @@ macro(mbgl_platform_core)
)
target_include_directories(mbgl-core
- PUBLIC platform/default/include
PRIVATE platform/qt
PRIVATE platform/qt/include
+ PUBLIC platform/default/include
)
target_link_libraries(mbgl-core PRIVATE
diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake
index e651b8c0c7..63723aa9ba 100644
--- a/platform/qt/qt.cmake
+++ b/platform/qt/qt.cmake
@@ -38,6 +38,7 @@ set(MBGL_QT_CORE_FILES
PRIVATE platform/qt/src/timer.cpp
PRIVATE platform/qt/src/timer_impl.hpp
PRIVATE platform/qt/src/utf.cpp
+ PRIVATE platform/qt/src/gl_functions.cpp
PRIVATE platform/default/src/mbgl/text/collator.cpp
PRIVATE platform/default/src/mbgl/text/unaccent.cpp
diff --git a/src/core-files.json b/src/core-files.json
index 51e48eae76..a173cdd461 100644
--- a/src/core-files.json
+++ b/src/core-files.json
@@ -23,7 +23,6 @@
"src/mbgl/gl/debugging.cpp",
"src/mbgl/gl/debugging_extension.cpp",
"src/mbgl/gl/depth_mode.cpp",
- "src/mbgl/gl/gl.cpp",
"src/mbgl/gl/object.cpp",
"src/mbgl/gl/stencil_mode.cpp",
"src/mbgl/gl/uniform.cpp",
@@ -50,6 +49,7 @@
"src/mbgl/map/transform.cpp",
"src/mbgl/map/transform_state.cpp",
"src/mbgl/math/log2.cpp",
+ "src/mbgl/platform/gl_functions.cpp",
"src/mbgl/programs/background_program.cpp",
"src/mbgl/programs/binary_program.cpp",
"src/mbgl/programs/circle_program.cpp",
@@ -336,6 +336,7 @@
"mbgl/math/log2.hpp": "include/mbgl/math/log2.hpp",
"mbgl/math/minmax.hpp": "include/mbgl/math/minmax.hpp",
"mbgl/math/wrap.hpp": "include/mbgl/math/wrap.hpp",
+ "mbgl/platform/gl_functions.hpp": "include/mbgl/platform/gl_functions.hpp",
"mbgl/renderer/backend_scope.hpp": "include/mbgl/renderer/backend_scope.hpp",
"mbgl/renderer/mode.hpp": "include/mbgl/renderer/mode.hpp",
"mbgl/renderer/query.hpp": "include/mbgl/renderer/query.hpp",
@@ -502,12 +503,12 @@
"mbgl/gl/cull_face_mode.hpp": "src/mbgl/gl/cull_face_mode.hpp",
"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/draw_mode.hpp": "src/mbgl/gl/draw_mode.hpp",
"mbgl/gl/extension.hpp": "src/mbgl/gl/extension.hpp",
"mbgl/gl/features.hpp": "src/mbgl/gl/features.hpp",
"mbgl/gl/framebuffer.hpp": "src/mbgl/gl/framebuffer.hpp",
- "mbgl/gl/gl.hpp": "src/mbgl/gl/gl.hpp",
"mbgl/gl/index_buffer.hpp": "src/mbgl/gl/index_buffer.hpp",
"mbgl/gl/object.hpp": "src/mbgl/gl/object.hpp",
"mbgl/gl/primitives.hpp": "src/mbgl/gl/primitives.hpp",
diff --git a/src/mbgl/gl/attribute.cpp b/src/mbgl/gl/attribute.cpp
index b2d05fe665..4983a8c204 100644
--- a/src/mbgl/gl/attribute.cpp
+++ b/src/mbgl/gl/attribute.cpp
@@ -1,10 +1,12 @@
#include <mbgl/gl/attribute.hpp>
#include <mbgl/gl/context.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
namespace mbgl {
namespace gl {
+using namespace platform;
+
void bindAttributeLocation(Context& context, ProgramID id, AttributeLocation location, const char* name) {
// We're using sequentially numberered attribute locations starting with 0. Therefore we can use
// the location as a proxy for the number of attributes.
diff --git a/src/mbgl/gl/color_mode.cpp b/src/mbgl/gl/color_mode.cpp
index e838c8e2ff..e524bfdf98 100644
--- a/src/mbgl/gl/color_mode.cpp
+++ b/src/mbgl/gl/color_mode.cpp
@@ -1,5 +1,5 @@
#include <mbgl/gl/color_mode.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/util/traits.hpp>
namespace mbgl {
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 18ab38e684..2463993cf0 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -1,5 +1,4 @@
#include <mbgl/gl/context.hpp>
-#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/debugging_extension.hpp>
#include <mbgl/gl/vertex_array_extension.hpp>
#include <mbgl/gl/program_binary_extension.hpp>
@@ -12,6 +11,8 @@
namespace mbgl {
namespace gl {
+using namespace platform;
+
static_assert(underlying_type(ShaderType::Vertex) == GL_VERTEX_SHADER, "OpenGL type mismatch");
static_assert(underlying_type(ShaderType::Fragment) == GL_FRAGMENT_SHADER, "OpenGL type mismatch");
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index bd682f44da..810fb41990 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -15,6 +15,7 @@
#include <mbgl/gl/depth_mode.hpp>
#include <mbgl/gl/stencil_mode.hpp>
#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/noncopyable.hpp>
diff --git a/src/mbgl/gl/cull_face_mode.cpp b/src/mbgl/gl/cull_face_mode.cpp
index 42729aeea7..53dd340204 100644
--- a/src/mbgl/gl/cull_face_mode.cpp
+++ b/src/mbgl/gl/cull_face_mode.cpp
@@ -1,5 +1,5 @@
#include <mbgl/gl/cull_face_mode.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/util/traits.hpp>
namespace mbgl {
diff --git a/src/mbgl/gl/debugging.cpp b/src/mbgl/gl/debugging.cpp
index 366b4d63c7..7b8121f003 100644
--- a/src/mbgl/gl/debugging.cpp
+++ b/src/mbgl/gl/debugging.cpp
@@ -5,6 +5,8 @@
namespace mbgl {
namespace gl {
+using namespace platform;
+
#ifndef NDEBUG
DebugGroup::DebugGroup(const Context& context_, const std::string& name) : context(context_) {
diff --git a/src/mbgl/gl/debugging_extension.hpp b/src/mbgl/gl/debugging_extension.hpp
index 5657bbde88..0fa5a7b424 100644
--- a/src/mbgl/gl/debugging_extension.hpp
+++ b/src/mbgl/gl/debugging_extension.hpp
@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/gl/extension.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
@@ -51,6 +51,8 @@ namespace mbgl {
namespace gl {
namespace extension {
+using namespace platform;
+
class Debugging {
public:
using Callback = void (*)(GLenum source,
diff --git a/src/mbgl/gl/depth_mode.cpp b/src/mbgl/gl/depth_mode.cpp
index 21af75a391..fdd9cf31d1 100644
--- a/src/mbgl/gl/depth_mode.cpp
+++ b/src/mbgl/gl/depth_mode.cpp
@@ -1,5 +1,5 @@
#include <mbgl/gl/depth_mode.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/util/traits.hpp>
namespace mbgl {
diff --git a/src/mbgl/gl/gl.cpp b/src/mbgl/gl/gl.cpp
deleted file mode 100644
index bd6d7b192d..0000000000
--- a/src/mbgl/gl/gl.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <mbgl/gl/gl.hpp>
-#include <mbgl/util/string.hpp>
-#include <mbgl/util/util.hpp>
-
-namespace mbgl {
-namespace gl {
-
-namespace {
-
-MBGL_CONSTEXPR const char* stringFromError(GLenum err) {
- switch (err) {
- case GL_INVALID_ENUM:
- return "GL_INVALID_ENUM";
-
- case GL_INVALID_VALUE:
- return "GL_INVALID_VALUE";
-
- case GL_INVALID_OPERATION:
- return "GL_INVALID_OPERATION";
-
- case GL_INVALID_FRAMEBUFFER_OPERATION:
- return "GL_INVALID_FRAMEBUFFER_OPERATION";
-
- case GL_OUT_OF_MEMORY:
- return "GL_OUT_OF_MEMORY";
-
-#ifdef GL_TABLE_TOO_LARGE
- case GL_TABLE_TOO_LARGE:
- return "GL_TABLE_TOO_LARGE";
-#endif
-
-#ifdef GL_STACK_OVERFLOW
- case GL_STACK_OVERFLOW:
- return "GL_STACK_OVERFLOW";
-#endif
-
-#ifdef GL_STACK_UNDERFLOW
- case GL_STACK_UNDERFLOW:
- return "GL_STACK_UNDERFLOW";
-#endif
-
-#ifdef GL_CONTEXT_LOST
- case GL_CONTEXT_LOST:
- return "GL_CONTEXT_LOST";
-#endif
-
- default:
- return "GL_UNKNOWN";
- }
-}
-
-} // namespace
-
-void checkError(const char* cmd, const char* file, int line) {
-// fprintf(stderr, "cmd: %s\n", cmd);
- GLenum err = GL_NO_ERROR;
- if ((err = glGetError()) != GL_NO_ERROR) {
- std::string message = std::string(cmd) + ": Error " + stringFromError(err);
-
- // Check for further errors
- while ((err = glGetError()) != GL_NO_ERROR) {
- message += ", ";
- message += stringFromError(err);
- }
-
- throw Error(message + " at " + file + ":" + util::toString(line));
- }
-}
-
-} // namespace gl
-} // namespace mbgl
diff --git a/src/mbgl/gl/gl.hpp b/src/mbgl/gl/gl.hpp
deleted file mode 100644
index 976b7d2f74..0000000000
--- a/src/mbgl/gl/gl.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <mbgl/gl/gl_impl.hpp>
-
-#include <stdexcept>
-#include <limits>
-
-namespace mbgl {
-namespace gl {
-
-struct Error : std::runtime_error {
- using std::runtime_error::runtime_error;
-};
-
-void checkError(const char *cmd, const char *file, int line);
-
-#ifndef NDEBUG
-#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() noexcept(false) { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }())
-#else
-#define MBGL_CHECK_ERROR(cmd) (cmd)
-#endif
-
-} // namespace gl
-} // namespace mbgl
diff --git a/src/mbgl/gl/program_binary_extension.hpp b/src/mbgl/gl/program_binary_extension.hpp
index a4aa1eeefc..b14876728b 100644
--- a/src/mbgl/gl/program_binary_extension.hpp
+++ b/src/mbgl/gl/program_binary_extension.hpp
@@ -2,7 +2,7 @@
#include <mbgl/gl/features.hpp>
#include <mbgl/gl/extension.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
#if MBGL_HAS_BINARY_PROGRAMS
diff --git a/src/mbgl/gl/stencil_mode.cpp b/src/mbgl/gl/stencil_mode.cpp
index 6858d6d106..fc6f3076dc 100644
--- a/src/mbgl/gl/stencil_mode.cpp
+++ b/src/mbgl/gl/stencil_mode.cpp
@@ -1,5 +1,5 @@
#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/util/traits.hpp>
namespace mbgl {
diff --git a/src/mbgl/gl/uniform.cpp b/src/mbgl/gl/uniform.cpp
index 3d8a8d53d9..e6c77be50b 100644
--- a/src/mbgl/gl/uniform.cpp
+++ b/src/mbgl/gl/uniform.cpp
@@ -1,5 +1,6 @@
#include <mbgl/gl/uniform.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/size.hpp>
#include <mbgl/util/convert.hpp>
@@ -9,6 +10,8 @@
namespace mbgl {
namespace gl {
+using namespace platform;
+
UniformLocation uniformLocation(ProgramID id, const char* name) {
return MBGL_CHECK_ERROR(glGetUniformLocation(id, name));
}
@@ -101,8 +104,7 @@ ActiveUniforms activeUniforms(ProgramID id) {
GLint size;
GLenum type;
for (GLint index = 0; index < count; index++) {
- MBGL_CHECK_ERROR(
- glGetActiveUniform(id, index, maxLength, &length, &size, &type, name.get()));
+ MBGL_CHECK_ERROR(glGetActiveUniform(id, index, maxLength, &length, &size, &type, name.get()));
active.emplace(
std::string{ name.get(), static_cast<size_t>(length) },
ActiveUniform{ static_cast<size_t>(size), static_cast<UniformDataType>(type) });
diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp
index 581acd0358..d685e533a5 100644
--- a/src/mbgl/gl/value.cpp
+++ b/src/mbgl/gl/value.cpp
@@ -1,5 +1,4 @@
#include <mbgl/gl/value.hpp>
-#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/vertex_array_extension.hpp>
@@ -7,14 +6,12 @@ namespace mbgl {
namespace gl {
namespace value {
+using namespace platform;
+
const constexpr ClearDepth::Type ClearDepth::Default;
void ClearDepth::Set(const Type& value) {
-#if MBGL_USE_GLES2
MBGL_CHECK_ERROR(glClearDepthf(value));
-#else
- MBGL_CHECK_ERROR(glClearDepth(value));
-#endif
}
ClearDepth::Type ClearDepth::Get() {
@@ -130,11 +127,7 @@ StencilOp::Type StencilOp::Get() {
const constexpr DepthRange::Type DepthRange::Default;
void DepthRange::Set(const Type& value) {
-#if MBGL_USE_GLES2
MBGL_CHECK_ERROR(glDepthRangef(value.min, value.max));
-#else
- MBGL_CHECK_ERROR(glDepthRange(value.min, value.max));
-#endif
}
DepthRange::Type DepthRange::Get() {
diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp
index 25f22aa038..8e2c995e11 100644
--- a/src/mbgl/gl/value.hpp
+++ b/src/mbgl/gl/value.hpp
@@ -6,6 +6,7 @@
#include <mbgl/gl/color_mode.hpp>
#include <mbgl/gl/cull_face_mode.hpp>
#include <mbgl/gl/attribute.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/size.hpp>
#include <mbgl/util/range.hpp>
diff --git a/src/mbgl/gl/vertex_array.cpp b/src/mbgl/gl/vertex_array.cpp
index d552a8292e..0892c3b08b 100644
--- a/src/mbgl/gl/vertex_array.cpp
+++ b/src/mbgl/gl/vertex_array.cpp
@@ -1,6 +1,5 @@
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/context.hpp>
-#include <mbgl/gl/gl.hpp>
namespace mbgl {
namespace gl {
diff --git a/src/mbgl/gl/vertex_array_extension.hpp b/src/mbgl/gl/vertex_array_extension.hpp
index 707a20e6f0..8c6abdc609 100644
--- a/src/mbgl/gl/vertex_array_extension.hpp
+++ b/src/mbgl/gl/vertex_array_extension.hpp
@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/gl/extension.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/gl/defines.hpp>
namespace mbgl {
namespace gl {
@@ -25,11 +25,11 @@ public:
{ "GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE" } })) {
}
- const ExtensionFunction<void(GLuint array)> bindVertexArray;
+ const ExtensionFunction<void(platform::GLuint array)> bindVertexArray;
- const ExtensionFunction<void(GLsizei n, const GLuint* arrays)> deleteVertexArrays;
+ const ExtensionFunction<void(platform::GLsizei n, const platform::GLuint* arrays)> deleteVertexArrays;
- const ExtensionFunction<void(GLsizei n, GLuint* arrays)> genVertexArrays;
+ const ExtensionFunction<void(platform::GLsizei n, platform::GLuint* arrays)> genVertexArrays;
};
} // namespace extension
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 9e65830faf..22c1b4c5d2 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -3,9 +3,9 @@
#include <mbgl/renderer/backend_scope.hpp>
#include <mbgl/renderer/renderer_backend.hpp>
#include <mbgl/renderer/bucket.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/map/transform_state.hpp>
-#include <mbgl/gl/gl.hpp>
#include <mbgl/util/mat4.hpp>
namespace mbgl {
@@ -15,7 +15,7 @@ using namespace style;
RenderCustomLayer::RenderCustomLayer(Immutable<style::CustomLayer::Impl> _impl)
: RenderLayer(std::move(_impl)), host(impl().host) {
assert(BackendScope::exists());
- host->initialize();
+ MBGL_CHECK_ERROR(host->initialize());
}
RenderCustomLayer::~RenderCustomLayer() {
@@ -23,7 +23,7 @@ RenderCustomLayer::~RenderCustomLayer() {
if (contextDestroyed) {
host->contextLost();
} else {
- host->deinitialize();
+ MBGL_CHECK_ERROR(host->deinitialize());
}
}
diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp
index 83d1543a0a..51d026e30d 100644
--- a/test/api/custom_geometry_source.test.cpp
+++ b/test/api/custom_geometry_source.test.cpp
@@ -1,6 +1,5 @@
#include <mbgl/test/util.hpp>
-#include <mbgl/gl/gl.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index a94cf122bf..c2a0797483 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -1,9 +1,10 @@
#include <mbgl/test/util.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
@@ -14,6 +15,7 @@
using namespace mbgl;
using namespace mbgl::style;
+using namespace mbgl::platform;
// Note that custom layers need to draw geometry with a z value of 1 to take advantage of
// depth-based fragment culling.
diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp
index 3818544021..176257916f 100644
--- a/test/gl/context.test.cpp
+++ b/test/gl/context.test.cpp
@@ -1,10 +1,11 @@
#include <mbgl/test/util.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
@@ -16,6 +17,7 @@
using namespace mbgl;
using namespace mbgl::style;
+using namespace mbgl::platform;
static const GLchar* vertexShaderSource = R"MBGL_SHADER(
#ifdef GL_ES
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp
index 09c940c4c3..83c0fab509 100644
--- a/test/util/offscreen_texture.test.cpp
+++ b/test/util/offscreen_texture.test.cpp
@@ -1,13 +1,15 @@
#include <mbgl/test/util.hpp>
-#include <mbgl/gl/gl.hpp>
+#include <mbgl/platform/gl_functions.hpp>
#include <mbgl/gl/context.hpp>
+#include <mbgl/gl/defines.hpp>
#include <mbgl/gl/headless_backend.hpp>
#include <mbgl/renderer/backend_scope.hpp>
#include <mbgl/util/offscreen_texture.hpp>
using namespace mbgl;
+using namespace mbgl::platform;
TEST(OffscreenTexture, EmptyRed) {
HeadlessBackend backend({ 512, 256 });