[core] remove gl/context.hpp from more files, cast where necessary
This commit is contained in:
@@ -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<const gl::Context&>(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<const gl::Context&>(context).getDebuggingExtension()) {
|
||||
if (debugging->popDebugGroup) {
|
||||
MBGL_CHECK_ERROR(debugging->popDebugGroup());
|
||||
} else if (debugging->popGroupMarkerEXT) {
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gl/program.hpp>
|
||||
#include <mbgl/math/clamp.hpp>
|
||||
#include <mbgl/util/interpolate.hpp>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <mbgl/util/tile_cover.hpp>
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <mbgl/style/layers/circle_layer_impl.hpp>
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/intersection_tests.hpp>
|
||||
|
||||
|
||||
@@ -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<gl::Context&>(paintParameters.context);
|
||||
const TransformState& state = paintParameters.state;
|
||||
|
||||
// Reset GL state to a known state so the CustomLayer always has a clean slate.
|
||||
|
||||
@@ -51,6 +51,9 @@ bool RenderFillExtrusionLayer::hasCrossfade() const {
|
||||
}
|
||||
|
||||
void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
// TODO: remove cast
|
||||
gl::Context& glContext = reinterpret_cast<gl::Context&>(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<ImagePosition>& patternPositionA,
|
||||
|
||||
@@ -63,6 +63,9 @@ bool RenderFillLayer::hasCrossfade() const {
|
||||
}
|
||||
|
||||
void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
// TODO: remove cast
|
||||
gl::Context& glContext = reinterpret_cast<gl::Context&>(parameters.context);
|
||||
|
||||
if (unevaluated.get<FillPattern>().isUndefined()) {
|
||||
for (const RenderTile& tile : renderTiles) {
|
||||
auto bucket_ = tile.tile.getBucket<FillBucket>(*baseImpl);
|
||||
@@ -88,7 +91,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
evaluated.get<FillTranslateAnchor>(),
|
||||
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<FillTranslate>(),
|
||||
evaluated.get<FillTranslateAnchor>(),
|
||||
parameters.state),
|
||||
parameters.context.viewport.getCurrentValue().size,
|
||||
glContext.viewport.getCurrentValue().size,
|
||||
geometryTile.iconAtlasTexture->size,
|
||||
crossfade,
|
||||
tile.id,
|
||||
|
||||
@@ -52,12 +52,15 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: remove cast
|
||||
gl::Context& glContext = reinterpret_cast<gl::Context&>(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<HeatmapBucket>(*baseImpl);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/util/geo.hpp>
|
||||
#include <mbgl/util/offscreen_texture.hpp>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
#include <mbgl/style/layers/line_layer_impl.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/intersection_tests.hpp>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <mbgl/programs/raster_program.hpp>
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/style/layers/raster_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <mbgl/tile/geometry_tile_data.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_impl.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/layout/symbol_projection.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
PaintParameters::PaintParameters(gl::Context& context_,
|
||||
PaintParameters::PaintParameters(gfx::Context& context_,
|
||||
float pixelRatio_,
|
||||
GLContextMode contextMode_,
|
||||
RendererBackend& backend_,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -99,22 +99,25 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters,
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeBindingCount > parameters.context.maximumVertexBindingCount) {
|
||||
// TODO: remove cast
|
||||
auto& glContext = reinterpret_cast<gl::Context&>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mbgl/renderer/render_static_data.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gfx/context.hpp>
|
||||
#include <mbgl/programs/program_parameters.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -48,7 +48,7 @@ static gfx::VertexVector<ExtrusionTextureLayoutVertex> extrusionTextureVertices(
|
||||
return result;
|
||||
}
|
||||
|
||||
RenderStaticData::RenderStaticData(gl::Context& context, float pixelRatio, const optional<std::string>& programCacheDir)
|
||||
RenderStaticData::RenderStaticData(gfx::Context& context, float pixelRatio, const optional<std::string>& programCacheDir)
|
||||
: tileVertexBuffer(context.createVertexBuffer(tileVertices())),
|
||||
rasterVertexBuffer(context.createVertexBuffer(rasterVertices())),
|
||||
extrusionTextureVertexBuffer(context.createVertexBuffer(extrusionTextureVertices())),
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
class Context;
|
||||
} // namespace gfx
|
||||
|
||||
class RenderStaticData {
|
||||
public:
|
||||
RenderStaticData(gl::Context&, float pixelRatio, const optional<std::string>& programCacheDir);
|
||||
RenderStaticData(gfx::Context&, float pixelRatio, const optional<std::string>& programCacheDir);
|
||||
|
||||
gfx::VertexBuffer<gfx::Vertex<PositionOnlyLayoutAttributes>> tileVertexBuffer;
|
||||
gfx::VertexBuffer<RasterLayoutVertex> rasterVertexBuffer;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <mbgl/renderer/render_static_data.hpp>
|
||||
#include <mbgl/programs/programs.hpp>
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <mbgl/renderer/query.hpp>
|
||||
#include <mbgl/renderer/backend_scope.hpp>
|
||||
#include <mbgl/renderer/image_manager.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gl/debugging.hpp>
|
||||
#include <mbgl/geometry/line_atlas.hpp>
|
||||
#include <mbgl/style/source_impl.hpp>
|
||||
@@ -278,8 +279,11 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
|
||||
backend.updateAssumedState();
|
||||
|
||||
// TODO: remove cast
|
||||
gl::Context& glContext = reinterpret_cast<gl::Context&>(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<gl::RenderbufferType::DepthComponent>(parameters.staticData.backendSize);
|
||||
glContext.createRenderbuffer<gl::RenderbufferType::DepthComponent>(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<AlphaImage, gfx::TexturePixelType::Stencil>(viewport.size, false);
|
||||
const auto viewport = glContext.viewport.getCurrentValue();
|
||||
auto image = glContext.readFramebuffer<AlphaImage, gfx::TexturePixelType::Stencil>(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<AlphaImage, gfx::TexturePixelType::Depth>(viewport.size, false);
|
||||
auto viewport = glContext.viewport.getCurrentValue();
|
||||
auto image = glContext.readFramebuffer<AlphaImage, gfx::TexturePixelType::Depth>(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<Feature> Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <mbgl/renderer/tile_parameters.hpp>
|
||||
#include <mbgl/renderer/render_static_data.hpp>
|
||||
#include <mbgl/programs/programs.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gfx/cull_face_mode.hpp>
|
||||
#include <mbgl/util/tile_coordinate.hpp>
|
||||
#include <mbgl/util/tile_cover.hpp>
|
||||
#include <mbgl/util/logging.hpp>
|
||||
|
||||
@@ -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<Impl>(context, std::move(size), type)) {
|
||||
// TODO: remove cast
|
||||
: impl(std::make_unique<Impl>(reinterpret_cast<gl::Context&>(context), std::move(size), type)) {
|
||||
assert(!size.isEmpty());
|
||||
}
|
||||
|
||||
OffscreenTexture::OffscreenTexture(gl::Context& context,
|
||||
OffscreenTexture::OffscreenTexture(gfx::Context& context,
|
||||
const Size size,
|
||||
gl::Renderbuffer<gl::RenderbufferType::DepthComponent>& renderbuffer,
|
||||
const gfx::TextureChannelDataType type)
|
||||
: impl(std::make_unique<Impl>(context, std::move(size), renderbuffer, type)) {
|
||||
// TODO: remove cast
|
||||
: impl(std::make_unique<Impl>(reinterpret_cast<gl::Context&>(context), std::move(size), renderbuffer, type)) {
|
||||
assert(!size.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@@ -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<gl::RenderbufferType::DepthComponent>&,
|
||||
gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte);
|
||||
|
||||
Reference in New Issue
Block a user