[core] Reset GL values when needed
This commit is contained in:
@@ -110,11 +110,14 @@ void Painter::changeMatrix() {
|
||||
|
||||
void Painter::clear() {
|
||||
MBGL_DEBUG_GROUP("clear");
|
||||
config.stencilFunc.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
config.stencilMask = 0xFF;
|
||||
config.depthTest = GL_FALSE;
|
||||
config.depthMask = GL_TRUE;
|
||||
config.clearColor = { background[0], background[1], background[2], background[3] };
|
||||
config.clearStencil = 0;
|
||||
config.clearDepth = 1;
|
||||
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||
}
|
||||
|
||||
@@ -243,6 +246,7 @@ void Painter::renderPass(RenderPass pass_,
|
||||
}
|
||||
|
||||
if (pass == RenderPass::Translucent) {
|
||||
config.blendFunc.reset();
|
||||
config.blend = GL_TRUE;
|
||||
} else {
|
||||
config.blend = GL_FALSE;
|
||||
@@ -403,6 +407,7 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
|
||||
}
|
||||
|
||||
config.stencilTest = GL_FALSE;
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
config.depthRange = { 1.0f, 1.0f };
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ void Painter::drawClippingMasks(const std::set<Source*>& sources) {
|
||||
MBGL_DEBUG_GROUP("clipping masks");
|
||||
|
||||
config.program = plainShader->program;
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
config.depthMask = GL_FALSE;
|
||||
config.colorMask = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE };
|
||||
|
||||
@@ -47,6 +47,7 @@ void Painter::renderDebugText(TileData& tileData, const mat4 &matrix) {
|
||||
config.lineWidth = 2.0f * data.pixelRatio;
|
||||
tileData.debugBucket->drawLines(*plainShader);
|
||||
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -57,6 +58,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
|
||||
// but *don't* disable stencil test, as we want to clip the red tile border
|
||||
// to the tile viewport.
|
||||
config.depthTest = GL_FALSE;
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
|
||||
config.program = plainShader->program;
|
||||
|
||||
@@ -36,7 +36,9 @@ void Painter::renderFill(FillBucket& bucket, const FillLayer& layer, const TileI
|
||||
bool outline = properties.antialias && !pattern && stroke_color != fill_color;
|
||||
bool fringeline = properties.antialias && !pattern && stroke_color == fill_color;
|
||||
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
|
||||
// Because we're drawing top-to-bottom, and we update the stencil mask
|
||||
|
||||
@@ -17,7 +17,9 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
|
||||
// Abort early.
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
config.depthMask = GL_FALSE;
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ void Painter::renderRaster(RasterBucket& bucket, const RasterLayer& layer, const
|
||||
rasterShader->u_contrast_factor = contrastFactor(properties.contrast);
|
||||
rasterShader->u_spin_weights = spinWeights(properties.hue_rotate);
|
||||
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
setDepthSublayer(0);
|
||||
bucket.drawRaster(*rasterShader, tileStencilBuffer, coveringRasterArray);
|
||||
|
||||
@@ -144,6 +144,7 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
|
||||
config.depthMask = GL_FALSE;
|
||||
|
||||
if (bucket.hasCollisionBoxData()) {
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
|
||||
config.program = collisionBoxShader->program;
|
||||
@@ -170,11 +171,17 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
|
||||
if (drawAcrossEdges) {
|
||||
config.stencilTest = GL_FALSE;
|
||||
} else {
|
||||
config.stencilOp.reset();
|
||||
config.stencilTest = GL_TRUE;
|
||||
}
|
||||
|
||||
if (bucket.hasIconData()) {
|
||||
config.depthTest = layout.icon.rotation_alignment == RotationAlignmentType::Map;
|
||||
if (layout.icon.rotation_alignment == RotationAlignmentType::Map) {
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
} else {
|
||||
config.depthTest = GL_FALSE;
|
||||
}
|
||||
|
||||
bool sdf = bucket.sdfIcons;
|
||||
|
||||
@@ -246,7 +253,12 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
|
||||
}
|
||||
|
||||
if (bucket.hasTextData()) {
|
||||
config.depthTest = layout.text.rotation_alignment == RotationAlignmentType::Map;
|
||||
if (layout.text.rotation_alignment == RotationAlignmentType::Map) {
|
||||
config.depthFunc.reset();
|
||||
config.depthTest = GL_TRUE;
|
||||
} else {
|
||||
config.depthTest = GL_FALSE;
|
||||
}
|
||||
|
||||
glyphAtlas->bind();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user