clean up gl::group() structure

This commit is contained in:
Konstantin Käfer
2014-05-12 18:25:48 +02:00
parent 6136ab6d21
commit 6ebb4c21f7
3 changed files with 7 additions and 10 deletions

View File

@@ -432,6 +432,8 @@ void Map::render() {
// ever visit a tile during rendering.
for (auto &pair : sources) {
Source &source = *pair.second;
const std::string &name = pair.first;
gl::group group(std::string("debug ") + name);
source.finishRender();
}
@@ -475,6 +477,8 @@ void Map::renderLayers(const std::vector<LayerDescription>& layers) {
}
void Map::renderLayer(const LayerDescription& layer_desc) {
gl::group group(std::string("layer: ") + layer_desc.name);
if (layer_desc.child_layer.size()) {
// This is a layer group.
// TODO: create framebuffer

View File

@@ -48,6 +48,7 @@ size_t Source::prepareRender(const TransformState &transform) {
size_t masks = 0;
for (Tile& tile : tiles) {
gl::group group(util::sprintf<32>("mask %d/%d/%d", tile.id.z, tile.id.y, tile.id.z));
transform.matrixFor(tile.matrix, tile.id);
matrix::multiply(tile.matrix, painter.projMatrix, tile.matrix);
painter.drawClippingMask(tile.matrix, tile.clip);

View File

@@ -141,7 +141,6 @@ void Painter::prepareClippingMask() {
}
void Painter::drawClippingMask(const mat4& matrix, const ClipID &clip) {
gl::group group("mask");
plainShader->setMatrix(matrix);
GLint id = clip.mask.to_ulong();
@@ -205,7 +204,7 @@ void Painter::setStrata(float value) {
void Painter::prepareTile(const Tile& tile) {
matrix = tile.matrix;
GLint id = tile.clip.mask.to_ulong();
GLint id = (GLint)tile.clip.mask.to_ulong();
GLuint mask = clipMask[tile.clip.length];
glStencilFunc(GL_EQUAL, id, mask);
}
@@ -225,6 +224,7 @@ void Painter::renderTileLayer(const Tile& tile, const LayerDescription &layer_de
}
void Painter::renderTileDebug(const Tile& tile) {
gl::group group(util::sprintf<32>("debug %d/%d/%d", tile.id.z, tile.id.y, tile.id.z));
assert(tile.data);
if (debug) {
prepareTile(tile);
@@ -257,8 +257,6 @@ void Painter::renderRaster(RasterBucket& bucket, const std::string& layer_name,
const RasterProperties& properties = raster_properties_it->second;
if (!properties.enabled) return;
gl::group group(layer_name + " (raster)");
depthMask(false);
useProgram(rasterShader->program);
@@ -304,7 +302,6 @@ void Painter::renderFill(FillBucket& bucket, const std::string& layer_name, cons
translateLayer(properties.translate);
gl::group group(layer_name + " (fill)");
// Because we're drawing top-to-bottom, and we update the stencil mask
// below, we have to draw the outline first (!)
if (outline && pass == Translucent) {
@@ -441,7 +438,6 @@ void Painter::renderLine(LineBucket& bucket, const std::string& layer_name, cons
translateLayer(properties.translate);
gl::group group(layer_name + " (line)");
glDepthRange(strata, 1.0f);
// We're only drawing end caps + round line joins if the line is > 2px. Otherwise, they aren't visible anyway.
@@ -512,8 +508,6 @@ void Painter::renderPoint(PointBucket& bucket, const std::string& layer_name, co
translateLayer(properties.translate);
gl::group group(layer_name + " (point)");
Color color = properties.color;
color[0] *= properties.opacity;
color[1] *= properties.opacity;
@@ -588,8 +582,6 @@ void Painter::renderText(TextBucket& bucket, const std::string& layer_name, cons
translateLayer(properties.translate);
gl::group group(layer_name + " (text)");
mat4 exMatrix;
matrix::copy(exMatrix, projMatrix);
if (bucket.geom_desc.path == TextPathType::Curve) {