summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/painter.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-02-27 18:33:16 +0100
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-23 14:50:11 -0700
commite67abfbe67d7c08e90fdbd8727c4e9ed17dfa1ed (patch)
tree8bf1a6ae813afdfe44bd8d6210337141acd53bae /src/mbgl/renderer/painter.cpp
parent234384ece9c70f2a803ed2b1d1eb55b248ec43d1 (diff)
downloadqtlocation-mapboxgl-e67abfbe67d7c08e90fdbd8727c4e9ed17dfa1ed.tar.gz
[core] Refactor OpenGL extension loading mechanism
Previously, we initialized global variables that held pointers to the extension functions. While this seemed to work, the spec doesn't guarantee that the function pointers are identical for different OpenGL contexts. Therefore, we are now making them a member variable of the Context object.
Diffstat (limited to 'src/mbgl/renderer/painter.cpp')
-rw-r--r--src/mbgl/renderer/painter.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 73a084c8c6..f7a498ecae 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -150,7 +150,7 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
// - UPLOAD PASS -------------------------------------------------------------------------------
// Uploads all required buffers and images before we do any actual rendering.
{
- MBGL_DEBUG_GROUP("upload");
+ MBGL_DEBUG_GROUP(context, "upload");
spriteAtlas->upload(context, 0);
@@ -170,7 +170,7 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
// Renders the backdrop of the OpenGL view. This also paints in areas where we don't have any
// tiles whatsoever.
{
- MBGL_DEBUG_GROUP("clear");
+ MBGL_DEBUG_GROUP(context, "clear");
view.bind();
context.clear(paintMode() == PaintMode::Overdraw
? Color::black()
@@ -182,7 +182,7 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
// - CLIPPING MASKS ----------------------------------------------------------------------------
// Draws the clipping masks to the stencil buffer.
{
- MBGL_DEBUG_GROUP("clip");
+ MBGL_DEBUG_GROUP(context, "clip");
// Update all clipping IDs.
algorithm::ClipIDGenerator generator;
@@ -190,10 +190,10 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
source->baseImpl->startRender(generator, projMatrix, state);
}
- MBGL_DEBUG_GROUP("clipping masks");
+ MBGL_DEBUG_GROUP(context, "clipping masks");
for (const auto& stencil : generator.getStencils()) {
- MBGL_DEBUG_GROUP(std::string{ "mask: " } + util::toString(stencil.first));
+ MBGL_DEBUG_GROUP(context, std::string{ "mask: " } + util::toString(stencil.first));
renderClippingMask(stencil.first, stencil.second);
}
}
@@ -230,7 +230,7 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
// - DEBUG PASS --------------------------------------------------------------------------------
// Renders debug overlays.
{
- MBGL_DEBUG_GROUP("debug");
+ MBGL_DEBUG_GROUP(context, "debug");
// Finalize the rendering, e.g. by calling debug render calls per tile.
// This guarantees that we have at least one function per tile called.
@@ -250,7 +250,7 @@ void Painter::render(const Style& style, const FrameData& frame_, View& view, Sp
// TODO: Find a better way to unbind VAOs after we're done with them without introducing
// unnecessary bind(0)/bind(N) sequences.
{
- MBGL_DEBUG_GROUP("cleanup");
+ MBGL_DEBUG_GROUP(context, "cleanup");
context.activeTexture = 1;
context.texture[1] = 0;
@@ -268,7 +268,7 @@ void Painter::renderPass(PaintParameters& parameters,
uint32_t i, int8_t increment) {
pass = pass_;
- MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");
+ MBGL_DEBUG_GROUP(context, pass == RenderPass::Opaque ? "opaque" : "translucent");
if (debug::renderTree) {
Log::Info(Event::Render, "%*s%s {", indent++ * 4, "",
@@ -285,10 +285,10 @@ void Painter::renderPass(PaintParameters& parameters,
continue;
if (layer.is<BackgroundLayer>()) {
- MBGL_DEBUG_GROUP("background");
+ MBGL_DEBUG_GROUP(context, "background");
renderBackground(parameters, *layer.as<BackgroundLayer>());
} else if (layer.is<CustomLayer>()) {
- MBGL_DEBUG_GROUP(layer.baseImpl->id + " - custom");
+ MBGL_DEBUG_GROUP(context, layer.baseImpl->id + " - custom");
// Reset GL state to a known state so the CustomLayer always has a clean slate.
context.vertexArrayObject = 0;
@@ -303,7 +303,7 @@ void Painter::renderPass(PaintParameters& parameters,
parameters.view.bind();
context.setDirtyState();
} else {
- MBGL_DEBUG_GROUP(layer.baseImpl->id + " - " + util::toString(item.tile->id));
+ MBGL_DEBUG_GROUP(context, layer.baseImpl->id + " - " + util::toString(item.tile->id));
item.bucket->render(*this, parameters, layer, *item.tile);
}
}