summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/painter_raster.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-21 17:22:51 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-01 19:47:35 +0300
commita17b0bcd82ebe8628b69588d19773d26596b86da (patch)
tree06e53bf42b059b28780e995020733aaaeb6487b1 /src/mbgl/renderer/painter_raster.cpp
parenteb7cfea7eacad8a179fb3167b88508f8f1f7fdd2 (diff)
downloadqtlocation-mapboxgl-a17b0bcd82ebe8628b69588d19773d26596b86da.tar.gz
[core] Fix overdraw mode on Linux
- Use glBindAttribLocation for GLSL attributes. - Create a separate shader for each shader that supports overdraw. Needed because each uniform location must be known for every program. - Create a separate VAO for each shader inside buckets. Needed because we can only bind a VAO to a specific shader. Fixes #5435.
Diffstat (limited to 'src/mbgl/renderer/painter_raster.cpp')
-rw-r--r--src/mbgl/renderer/painter_raster.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mbgl/renderer/painter_raster.cpp b/src/mbgl/renderer/painter_raster.cpp
index 783879892e..c137caf2f6 100644
--- a/src/mbgl/renderer/painter_raster.cpp
+++ b/src/mbgl/renderer/painter_raster.cpp
@@ -18,26 +18,28 @@ void Painter::renderRaster(RasterBucket& bucket,
const RasterPaintProperties& properties = layer.impl->paint;
if (bucket.hasData()) {
- config.program = isOverdraw() ? rasterShader->getOverdrawID() : rasterShader->getID();
- rasterShader->u_matrix = matrix;
- rasterShader->u_buffer = 0;
- rasterShader->u_opacity = properties.rasterOpacity;
- rasterShader->u_brightness_low = properties.rasterBrightnessMin;
- rasterShader->u_brightness_high = properties.rasterBrightnessMax;
- rasterShader->u_saturation_factor = saturationFactor(properties.rasterSaturation);
- rasterShader->u_contrast_factor = contrastFactor(properties.rasterContrast);
- rasterShader->u_spin_weights = spinWeights(properties.rasterHueRotate);
+ const auto& shaderRaster = isOverdraw() ? rasterOverdrawShader : rasterShader;
+ auto& vaoRaster = isOverdraw() ? coveringRasterOverdrawArray : coveringRasterArray;
+ config.program = shaderRaster->getID();
+ shaderRaster->u_matrix = matrix;
+ shaderRaster->u_buffer = 0;
+ shaderRaster->u_opacity = properties.rasterOpacity;
+ shaderRaster->u_brightness_low = properties.rasterBrightnessMin;
+ shaderRaster->u_brightness_high = properties.rasterBrightnessMax;
+ shaderRaster->u_saturation_factor = saturationFactor(properties.rasterSaturation);
+ shaderRaster->u_contrast_factor = contrastFactor(properties.rasterContrast);
+ shaderRaster->u_spin_weights = spinWeights(properties.rasterHueRotate);
config.stencilTest = GL_FALSE;
- rasterShader->u_image = 0;
+ shaderRaster->u_image = 0;
config.activeTexture = GL_TEXTURE0;
config.depthFunc.reset();
config.depthTest = GL_TRUE;
config.depthMask = GL_FALSE;
setDepthSublayer(0);
- bucket.drawRaster(*rasterShader, tileStencilBuffer, coveringRasterArray, store);
+ bucket.drawRaster(*shaderRaster, tileStencilBuffer, vaoRaster, store);
}
}