swift - 消除谷歌 GMSMapView 随机白线
问题描述
在地图上滚动时,一条白线偶尔会闪烁。我正在尝试回答以下两个问题:
- 为什么会出现白线?
- 什么可能的解决方案可以确保地图没有闪烁的线条?
任何帮助或提示将不胜感激!请在下面查看我的日志:
下面的屏幕截图显示了一个出现白线的框架:
使用 Xcode 的“Capture GPU Frame”功能,并选择“View Frame by Program”,然后白线出现在“Program Program Object #5”中。
这是来自 gpu 跟踪的代码:
//************************************************************************
// Edits to captured shaders are not saved to the source shader file.
// Copy them back to your shader files when done or retrieve them from
// the GPU Debug Log.
//************************************************************************
precision highp float;
uniform mat4 uMVPMatrix;
uniform float uPixelSize;
uniform float uZoomInterpolation;
uniform float uCameraViewingAngle;
uniform float uCameraZoom;
uniform vec2 uCameraAxis;
uniform float uWidenConstantWidth;
uniform float uWidenIntensity;
attribute vec2 aOrigin;
attribute vec2 aVector;
attribute vec2 aDirection;
attribute mediump vec2 aTombstoneTexCoords;
attribute lowp vec4 aColorStart;
attribute lowp vec4 aColorEnd;
attribute mediump vec2 aWidthRange;
varying lowp vec4 vStrokeColor;
varying mediump vec2 vTombstoneTexCoords;
const float kFixedPointConversionFactor = 0.0000610351562;
const float kFixedPointVectorConversionFactor = 0.0001220703125;
const float kOneEighthsDPConversionFactor = 0.125;
const float kWidenLowViewAngle = 0.685;
const float kWidenHighViewAngle = 0.785;
const float kWidenLowZoomFade = 13.0;
const float kWidenHighZoomFade = 15.0;
const float kWidenLowDepth = 0.5;
const float kWidenHighDepth = 5.0;
const float kWidenLinearDepthWidth = 4.0;
const float kWidenSquaredDepthWidth = 5.333;
float additionalWidth(float z) {
float depth = smoothstep(kWidenLowDepth, kWidenHighDepth, z);
float width = (depth * kWidenLinearDepthWidth) + (depth * depth * kWidenSquaredDepthWidth);
vec2 direction = aDirection * kFixedPointConversionFactor;
float angleFactor = 1.0 - abs(dot(direction, uCameraAxis));
width *= angleFactor;
float viewingAngleFactor =
smoothstep(kWidenLowViewAngle, kWidenHighViewAngle, uCameraViewingAngle);
float zoomFactor = smoothstep(kWidenLowZoomFade, kWidenHighZoomFade, uCameraZoom);
float factor = viewingAngleFactor * zoomFactor * uWidenIntensity;
width *= factor;
return width;
}
void main() {
float strokeWidth = mix(aWidthRange.x, aWidthRange.y, uZoomInterpolation);
strokeWidth *= kOneEighthsDPConversionFactor;
vStrokeColor = mix(aColorStart, aColorEnd, min(uZoomInterpolation, 1.0));
vTombstoneTexCoords = aTombstoneTexCoords * kFixedPointConversionFactor;
vec2 vector = aVector * kFixedPointVectorConversionFactor;
vec2 extrusion = vector * (strokeWidth * uPixelSize);
vec2 origin = aOrigin * kFixedPointConversionFactor;
vec4 position = vec4(origin + extrusion, 0.0, 1.0);
position = uMVPMatrix * position;
strokeWidth += additionalWidth(position.z) + uWidenConstantWidth;
extrusion = vector * (strokeWidth * uPixelSize);
position = vec4(origin + extrusion, 0.0, 1.0);
position = uMVPMatrix * position;
gl_Position = position;
}
解决方案
推荐阅读
- docker - 根据本地目录结构创建docker目录结构
- swift - 无法手动更新 rangeSlider 的最大值和最小值
- c# - 单元测试:如何从模拟接口异步返回值
- xml - 如何使用套件脚本操作 xml?
- sql - 在 PL/SQL 中从字符串中分离和保存地址的最佳方法是什么?
- python - Python文本解析 - 你知道为什么双引号出现在我中间没有任何东西的地方吗?
- c# - 如何在 ASP.NET Core 上使用 Identity 登录后直接获取用户详细信息?
- amazon-ec2 - AWS Boto3:代码在 IPython 控制台中有效,但在 Jupyter Notebook 中无效
- javascript - 关闭和打开后如何在反应本机应用程序上保持登录状态
- c# - 虽然我从 HttpHead 方法发送响应,但客户说“无法得到任何响应”