summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-14 16:33:55 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-14 17:01:16 -0800
commit4a803f1a78d6d9adc603129c369cb75592c408b7 (patch)
tree190cba5a37bbe81bda97e9c5b67617e507d11b5d
parent95cef66e229f3ae346a66ea87f95a8a660c3108f (diff)
downloadqtlocation-mapboxgl-4a803f1a78d6d9adc603129c369cb75592c408b7.tar.gz
[core] Don't use glClear optimization for layers that aren't the bottommost
Fixes #3292
-rw-r--r--package.json2
-rw-r--r--src/mbgl/renderer/painter.cpp17
-rw-r--r--src/mbgl/style/style.cpp4
3 files changed, 17 insertions, 6 deletions
diff --git a/package.json b/package.json
index 7ebe666fa0..a96d5fb3ff 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
],
"devDependencies": {
"aws-sdk": "^2.2.21",
- "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#78bde0077848b4af0efd490d124bde3ea9f56ec9",
+ "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#48d397ea31e551324f85f0eb2088a5017023cab5",
"node-gyp": "^3.2.1",
"request": "^2.67.0",
"tape": "^4.2.2"
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index f9d3270792..3ecfe8c34f 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -255,8 +255,8 @@ void Painter::renderPass(RenderPass pass_,
}
void Painter::renderBackground(const BackgroundLayer& layer) {
- // Note: This function is only called for textured background. Otherwise, the background color
- // is created with glClear.
+ // Note that for bottommost layers without a pattern, the background color is drawn with
+ // glClear rather than this method.
const BackgroundPaintProperties& properties = layer.paint;
if (!properties.pattern.value.to.empty()) {
@@ -316,13 +316,24 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
backgroundBuffer.bind();
patternShader->bind(0);
spriteAtlas->bind(true);
+ } else {
+ Color color = properties.color;
+ color[0] *= properties.opacity;
+ color[1] *= properties.opacity;
+ color[2] *= properties.opacity;
+ color[3] *= properties.opacity;
+
+ config.program = plainShader->program;
+ plainShader->u_matrix = identityMatrix;
+ plainShader->u_color = color;
+ backgroundArray.bind(*plainShader, backgroundBuffer, BUFFER_OFFSET(0));
}
config.stencilTest = GL_FALSE;
config.depthFunc.reset();
config.depthTest = GL_TRUE;
config.depthMask = GL_FALSE;
- config.depthRange = { 1.0f, 1.0f };
+ setDepthSublayer(0);
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
}
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index a328b890d8..d82689f220 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -236,7 +236,7 @@ RenderData Style::getRenderData() const {
continue;
if (const BackgroundLayer* background = layer->as<BackgroundLayer>()) {
- if (background->paint.pattern.value.from.empty()) {
+ if (layer.get() == layers[0].get() && background->paint.pattern.value.from.empty()) {
// This is a solid background. We can use glClear().
result.backgroundColor = background->paint.color;
result.backgroundColor[0] *= background->paint.opacity;
@@ -244,7 +244,7 @@ RenderData Style::getRenderData() const {
result.backgroundColor[2] *= background->paint.opacity;
result.backgroundColor[3] *= background->paint.opacity;
} else {
- // This is a textured background. We need to render it with a quad.
+ // This is a textured background, or not the bottommost layer. We need to render it with a quad.
result.order.emplace_back(*layer);
}
continue;