From 52cf9a1af385113cee523ce826d7c86c8739e0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 15 Mar 2019 13:54:42 +0100 Subject: [core] remove gl/context.hpp from more files, cast where necessary --- src/mbgl/gl/debugging.cpp | 6 +- src/mbgl/gl/debugging.hpp | 9 ++- src/mbgl/programs/symbol_program.hpp | 1 - .../renderer/layers/render_background_layer.cpp | 1 - src/mbgl/renderer/layers/render_circle_layer.cpp | 1 - src/mbgl/renderer/layers/render_custom_layer.cpp | 3 +- .../layers/render_fill_extrusion_layer.cpp | 7 ++- src/mbgl/renderer/layers/render_fill_layer.cpp | 7 ++- src/mbgl/renderer/layers/render_heatmap_layer.cpp | 11 ++-- .../renderer/layers/render_hillshade_layer.cpp | 1 - src/mbgl/renderer/layers/render_line_layer.cpp | 1 - src/mbgl/renderer/layers/render_raster_layer.cpp | 1 - src/mbgl/renderer/layers/render_symbol_layer.cpp | 1 - src/mbgl/renderer/paint_parameters.cpp | 2 +- src/mbgl/renderer/paint_parameters.hpp | 8 +-- src/mbgl/renderer/render_layer.cpp | 11 ++-- src/mbgl/renderer/render_static_data.cpp | 4 +- src/mbgl/renderer/render_static_data.hpp | 5 +- src/mbgl/renderer/render_tile.cpp | 2 +- src/mbgl/renderer/renderer_impl.cpp | 66 ++++++++++++---------- src/mbgl/renderer/sources/render_image_source.cpp | 2 +- src/mbgl/util/offscreen_texture.cpp | 10 ++-- src/mbgl/util/offscreen_texture.hpp | 9 +-- 23 files changed, 92 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/mbgl/gl/debugging.cpp b/src/mbgl/gl/debugging.cpp index 7b8121f003..54cee5fc09 100644 --- a/src/mbgl/gl/debugging.cpp +++ b/src/mbgl/gl/debugging.cpp @@ -9,8 +9,8 @@ using namespace platform; #ifndef NDEBUG -DebugGroup::DebugGroup(const Context& context_, const std::string& name) : context(context_) { - if (auto debugging = context.getDebuggingExtension()) { +DebugGroup::DebugGroup(const gfx::Context& context_, const std::string& name) : context(context_) { + if (auto debugging = reinterpret_cast(context).getDebuggingExtension()) { if (debugging->pushDebugGroup) { MBGL_CHECK_ERROR(debugging->pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(name.size()), name.c_str())); } else if (debugging->pushGroupMarkerEXT) { @@ -20,7 +20,7 @@ DebugGroup::DebugGroup(const Context& context_, const std::string& name) : conte } DebugGroup::~DebugGroup() { - if (auto debugging = context.getDebuggingExtension()) { + if (auto debugging = reinterpret_cast(context).getDebuggingExtension()) { if (debugging->popDebugGroup) { MBGL_CHECK_ERROR(debugging->popDebugGroup()); } else if (debugging->popGroupMarkerEXT) { diff --git a/src/mbgl/gl/debugging.hpp b/src/mbgl/gl/debugging.hpp index d24b727295..d85eb631be 100644 --- a/src/mbgl/gl/debugging.hpp +++ b/src/mbgl/gl/debugging.hpp @@ -5,19 +5,22 @@ #include namespace mbgl { -namespace gl { +namespace gfx { class Context; +} // namespace gfx + +namespace gl { #ifndef NDEBUG class DebugGroup : private util::noncopyable { public: - DebugGroup(const Context&, const std::string&); + DebugGroup(const gfx::Context&, const std::string&); ~DebugGroup(); private: - const Context& context; + const gfx::Context& context; }; #define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 383f5162d8..d5fb153bbb 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp index 32e05a38ab..68c792517c 100644 --- a/src/mbgl/renderer/layers/render_background_layer.cpp +++ b/src/mbgl/renderer/layers/render_background_layer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include namespace mbgl { diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 60a3bf8e01..2cc0d2e329 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index bcb0decb74..8ac7d29ff6 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -57,7 +57,8 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) MBGL_CHECK_ERROR(host->initialize()); } - gl::Context& glContext = paintParameters.context; + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(paintParameters.context); const TransformState& state = paintParameters.state; // Reset GL state to a known state so the CustomLayer always has a clean slate. diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 5af4732aa3..a8c9f7a1c4 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -51,6 +51,9 @@ bool RenderFillExtrusionLayer::hasCrossfade() const { } void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*) { + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.pass == RenderPass::Opaque) { return; } @@ -69,8 +72,8 @@ 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(gfx::StencilMode::disabled()); - parameters.context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, depthClearValue, {}); + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, depthClearValue, {}); auto draw = [&](auto& programInstance, const auto& tileBucket, auto&& uniformValues, const optional& patternPositionA, diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 64f3448c69..b11c2d23b6 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -63,6 +63,9 @@ bool RenderFillLayer::hasCrossfade() const { } void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (unevaluated.get().isUndefined()) { for (const RenderTile& tile : renderTiles) { auto bucket_ = tile.tile.getBucket(*baseImpl); @@ -88,7 +91,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { evaluated.get(), parameters.state) ), - uniforms::u_world::Value( parameters.context.viewport.getCurrentValue().size ), + uniforms::u_world::Value( glContext.viewport.getCurrentValue().size ), }, paintPropertyBinders, evaluated, @@ -175,7 +178,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { tile.translatedMatrix(evaluated.get(), evaluated.get(), parameters.state), - parameters.context.viewport.getCurrentValue().size, + glContext.viewport.getCurrentValue().size, geometryTile.iconAtlasTexture->size, crossfade, tile.id, diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index efc16fb28a..8ec6f7707b 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -52,12 +52,15 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { return; } + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.pass == RenderPass::Pass3D) { const auto& viewportSize = parameters.staticData.backendSize; const auto size = Size{viewportSize.width / 4, viewportSize.height / 4}; if (!renderTexture || renderTexture->getSize() != size) { - if (parameters.context.supportsHalfFloatTextures) { + if (glContext.supportsHalfFloatTextures) { renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::HalfFloat); try { @@ -65,11 +68,11 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { } catch (const std::runtime_error& ex) { // can't render to a half-float texture; falling back to unsigned byte one renderTexture = nullopt; - parameters.context.supportsHalfFloatTextures = false; + glContext.supportsHalfFloatTextures = false; } } - if (!parameters.context.supportsHalfFloatTextures || !renderTexture) { + if (!glContext.supportsHalfFloatTextures || !renderTexture) { renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::UnsignedByte); renderTexture->bind(); } @@ -82,7 +85,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { colorRampTexture = parameters.context.createTexture(colorRamp, gfx::TextureChannelDataType::UnsignedByte); } - parameters.context.clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {}); + glContext.clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {}); for (const RenderTile& tile : renderTiles) { auto bucket_ = tile.tile.getBucket(*baseImpl); diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 00ecad444c..ff1def3d9a 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index eee151ccaa..b52c28e6c6 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index c8f00eb1fd..c237cfe317 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include namespace mbgl { diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index 31d92dd414..fc05439010 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index 2237b016d2..639041202f 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -5,7 +5,7 @@ namespace mbgl { -PaintParameters::PaintParameters(gl::Context& context_, +PaintParameters::PaintParameters(gfx::Context& context_, float pixelRatio_, GLContextMode contextMode_, RendererBackend& backend_, diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp index ea3b41adfe..847093166a 100644 --- a/src/mbgl/renderer/paint_parameters.hpp +++ b/src/mbgl/renderer/paint_parameters.hpp @@ -23,13 +23,13 @@ class ImageManager; class LineAtlas; class UnwrappedTileID; -namespace gl { +namespace gfx { class Context; -} // namespace gl +} // namespace gfx class PaintParameters { public: - PaintParameters(gl::Context&, + PaintParameters(gfx::Context&, float pixelRatio, GLContextMode, RendererBackend&, @@ -39,7 +39,7 @@ public: ImageManager&, LineAtlas&); - gl::Context& context; + gfx::Context& context; RendererBackend& backend; const TransformState& state; diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 32236d0f24..0bec14a0da 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -99,22 +99,25 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters, return; } - if (activeBindingCount > parameters.context.maximumVertexBindingCount) { + // TODO: remove cast + auto& glContext = reinterpret_cast(parameters.context); + + if (activeBindingCount > glContext.maximumVertexBindingCount) { Log::Error(Event::OpenGL, "The layer '%s' uses more data-driven properties than the current device " "supports, and will have rendering errors. To ensure compatibility with this " "device, use %d fewer data driven properties in this layer.", getID().c_str(), - activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); + activeBindingCount - glContext.minimumRequiredVertexBindingCount); hasRenderFailures = true; - } else if (activeBindingCount > parameters.context.minimumRequiredVertexBindingCount) { + } else if (activeBindingCount > glContext.minimumRequiredVertexBindingCount) { Log::Warning(Event::OpenGL, "The layer '%s' uses more data-driven properties than some devices may support. " "Though it will render correctly on this device, it may have rendering errors " "on other devices. To ensure compatibility with all devices, use %d fewer " "data-driven properties in this layer.", getID().c_str(), - activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); + activeBindingCount - glContext.minimumRequiredVertexBindingCount); hasRenderFailures = true; } } diff --git a/src/mbgl/renderer/render_static_data.cpp b/src/mbgl/renderer/render_static_data.cpp index 16d0d64a33..24eed0326c 100644 --- a/src/mbgl/renderer/render_static_data.cpp +++ b/src/mbgl/renderer/render_static_data.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include namespace mbgl { @@ -48,7 +48,7 @@ static gfx::VertexVector extrusionTextureVertices( return result; } -RenderStaticData::RenderStaticData(gl::Context& context, float pixelRatio, const optional& programCacheDir) +RenderStaticData::RenderStaticData(gfx::Context& context, float pixelRatio, const optional& programCacheDir) : tileVertexBuffer(context.createVertexBuffer(tileVertices())), rasterVertexBuffer(context.createVertexBuffer(rasterVertices())), extrusionTextureVertexBuffer(context.createVertexBuffer(extrusionTextureVertices())), diff --git a/src/mbgl/renderer/render_static_data.hpp b/src/mbgl/renderer/render_static_data.hpp index b9b52b09ca..23f632bc12 100644 --- a/src/mbgl/renderer/render_static_data.hpp +++ b/src/mbgl/renderer/render_static_data.hpp @@ -12,10 +12,13 @@ #include namespace mbgl { +namespace gfx { +class Context; +} // namespace gfx class RenderStaticData { public: - RenderStaticData(gl::Context&, float pixelRatio, const optional& programCacheDir); + RenderStaticData(gfx::Context&, float pixelRatio, const optional& programCacheDir); gfx::VertexBuffer> tileVertexBuffer; gfx::VertexBuffer rasterVertexBuffer; diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index 24826bfd78..8490b41d37 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 471536cf40..d12cb00de0 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -278,8 +279,11 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { backend.updateAssumedState(); + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.contextMode == GLContextMode::Shared) { - parameters.context.setDirtyState(); + glContext.setDirtyState(); } Color backgroundColor; @@ -402,7 +406,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { if (!parameters.staticData.depthRenderbuffer || parameters.staticData.depthRenderbuffer->size != parameters.staticData.backendSize) { parameters.staticData.depthRenderbuffer = - parameters.context.createRenderbuffer(parameters.staticData.backendSize); + glContext.createRenderbuffer(parameters.staticData.backendSize); } parameters.staticData.depthRenderbuffer->shouldClear(true); @@ -425,11 +429,11 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { MBGL_DEBUG_GROUP(parameters.context, "clear"); parameters.backend.bind(); if (parameters.debugOptions & MapDebugOptions::Overdraw) { - parameters.context.clear(Color::black(), ClearDepth::Default, ClearStencil::Default); + glContext.clear(Color::black(), ClearDepth::Default, ClearStencil::Default); } else if (parameters.contextMode == GLContextMode::Shared) { - parameters.context.clear({}, ClearDepth::Default, ClearStencil::Default); + glContext.clear({}, ClearDepth::Default, ClearStencil::Default); } else { - parameters.context.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default); + glContext.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default); } } @@ -482,17 +486,17 @@ 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(gfx::StencilMode::disabled()); - parameters.context.setDepthMode(gfx::DepthMode::disabled()); - parameters.context.setColorMode(gfx::ColorMode::unblended()); - parameters.context.program = 0; + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.setDepthMode(gfx::DepthMode::disabled()); + glContext.setColorMode(gfx::ColorMode::unblended()); + glContext.program = 0; // Reset the value in case someone else changed it, or it's dirty. - parameters.context.pixelTransferStencil = gl::value::PixelTransferStencil::Default; + glContext.pixelTransferStencil = gl::value::PixelTransferStencil::Default; // Read the stencil buffer - const auto viewport = parameters.context.viewport.getCurrentValue(); - auto image = parameters.context.readFramebuffer(viewport.size, false); + const auto viewport = glContext.viewport.getCurrentValue(); + auto image = glContext.readFramebuffer(viewport.size, false); // Scale the Stencil buffer to cover the entire color space. auto it = image.data.get(); @@ -502,9 +506,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { *it *= factor; } - parameters.context.pixelZoom = { 1, 1 }; - parameters.context.rasterPos = { -1, -1, 0, 1 }; - parameters.context.drawPixels(image); + glContext.pixelZoom = { 1, 1 }; + glContext.rasterPos = { -1, -1, 0, 1 }; + glContext.drawPixels(image); return; } @@ -565,23 +569,23 @@ 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(gfx::StencilMode::disabled()); - parameters.context.setDepthMode(gfx::DepthMode::disabled()); - parameters.context.setColorMode(gfx::ColorMode::unblended()); - parameters.context.program = 0; + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.setDepthMode(gfx::DepthMode::disabled()); + glContext.setColorMode(gfx::ColorMode::unblended()); + glContext.program = 0; // Scales the values in the depth buffer so that they cover the entire grayscale range. This // makes it easier to spot tiny differences. const float base = 1.0f / (1.0f - parameters.depthRangeSize); - parameters.context.pixelTransferDepth = { base, 1.0f - base }; + glContext.pixelTransferDepth = { base, 1.0f - base }; // Read the stencil buffer - auto viewport = parameters.context.viewport.getCurrentValue(); - auto image = parameters.context.readFramebuffer(viewport.size, false); + auto viewport = glContext.viewport.getCurrentValue(); + auto image = glContext.readFramebuffer(viewport.size, false); - parameters.context.pixelZoom = { 1, 1 }; - parameters.context.rasterPos = { -1, -1, 0, 1 }; - parameters.context.drawPixels(image); + glContext.pixelZoom = { 1, 1 }; + glContext.rasterPos = { -1, -1, 0, 1 }; + glContext.drawPixels(image); } #endif @@ -590,12 +594,12 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { { MBGL_DEBUG_GROUP(parameters.context, "cleanup"); - parameters.context.activeTextureUnit = 1; - parameters.context.texture[1] = 0; - parameters.context.activeTextureUnit = 0; - parameters.context.texture[0] = 0; + glContext.activeTextureUnit = 1; + glContext.texture[1] = 0; + glContext.activeTextureUnit = 0; + glContext.texture[0] = 0; - parameters.context.bindVertexArray = 0; + glContext.bindVertexArray = 0; } observer->onDidFinishRenderingFrame( @@ -611,7 +615,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { } // Cleanup only after signaling completion - parameters.context.performCleanup(); + glContext.performCleanup(); } std::vector Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index 1b135a2838..5bb520be78 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/mbgl/util/offscreen_texture.cpp b/src/mbgl/util/offscreen_texture.cpp index 2a58ff86a3..6bc09c7b16 100644 --- a/src/mbgl/util/offscreen_texture.cpp +++ b/src/mbgl/util/offscreen_texture.cpp @@ -62,18 +62,20 @@ private: const gfx::TextureChannelDataType type; }; -OffscreenTexture::OffscreenTexture(gl::Context& context, +OffscreenTexture::OffscreenTexture(gfx::Context& context, const Size size, const gfx::TextureChannelDataType type) - : impl(std::make_unique(context, std::move(size), type)) { + // TODO: remove cast + : impl(std::make_unique(reinterpret_cast(context), std::move(size), type)) { assert(!size.isEmpty()); } -OffscreenTexture::OffscreenTexture(gl::Context& context, +OffscreenTexture::OffscreenTexture(gfx::Context& context, const Size size, gl::Renderbuffer& renderbuffer, const gfx::TextureChannelDataType type) - : impl(std::make_unique(context, std::move(size), renderbuffer, type)) { + // TODO: remove cast + : impl(std::make_unique(reinterpret_cast(context), std::move(size), renderbuffer, type)) { assert(!size.isEmpty()); } diff --git a/src/mbgl/util/offscreen_texture.hpp b/src/mbgl/util/offscreen_texture.hpp index 9446fabecf..f4459556b8 100644 --- a/src/mbgl/util/offscreen_texture.hpp +++ b/src/mbgl/util/offscreen_texture.hpp @@ -6,20 +6,17 @@ namespace mbgl { -namespace gl { -class Context; -} // namespace gl - namespace gfx { +class Context; class Texture; } // namespace gfx class OffscreenTexture { public: - OffscreenTexture(gl::Context&, + OffscreenTexture(gfx::Context&, Size size = { 256, 256 }, gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte); - OffscreenTexture(gl::Context&, + OffscreenTexture(gfx::Context&, Size size, gl::Renderbuffer&, gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte); -- cgit v1.2.1