forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
9f38888d36
commit
c5137f2f79
3 changed files with 37 additions and 20 deletions
|
@ -134,9 +134,9 @@ private:
|
|||
};
|
||||
|
||||
#if defined(DEBUG) || defined(DEBUG_DRAPE_XCODE)
|
||||
#define DEBUG_LABEL(labelName, context, labelText) DebugLabelGuard labelName(context, labelText);
|
||||
#define DEBUG_LABEL(context, labelText) DebugLabelGuard __debugLabel(context, labelText);
|
||||
#else
|
||||
#define DEBUG_LABEL(labelName, context, labelText)
|
||||
#define DEBUG_LABEL(context, labelText)
|
||||
#endif
|
||||
} // namespace
|
||||
|
||||
|
@ -1275,13 +1275,13 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView, bool activeFram
|
|||
|
||||
uint32_t clearBits = dp::ClearBits::ColorBit | dp::ClearBits::DepthBit;
|
||||
if (m_apiVersion == dp::ApiVersion::OpenGLES2 || m_apiVersion == dp::ApiVersion::OpenGLES3)
|
||||
clearBits = clearBits | dp::ClearBits::StencilBit;
|
||||
clearBits |= dp::ClearBits::StencilBit;
|
||||
|
||||
uint32_t storeBits = dp::ClearBits::ColorBit;
|
||||
if (m_postprocessRenderer->IsEffectEnabled(PostprocessRenderer::Effect::Antialiasing))
|
||||
{
|
||||
clearBits = clearBits | dp::ClearBits::StencilBit;
|
||||
storeBits = storeBits | dp::ClearBits::StencilBit;
|
||||
clearBits |= dp::ClearBits::StencilBit;
|
||||
storeBits |= dp::ClearBits::StencilBit;
|
||||
m_context->SetStencilReferenceValue(2 /* write this value to the stencil buffer */);
|
||||
}
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ void FrontendRenderer::Render2dLayer(ScreenBase const & modelView)
|
|||
layer2d.Sort(make_ref(m_overlayTree));
|
||||
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(render2dLayerLabel, m_context, "2D Layer");
|
||||
DEBUG_LABEL(m_context, "2D Layer");
|
||||
for (drape_ptr<RenderGroup> const & group : layer2d.m_renderGroups)
|
||||
RenderSingleGroup(m_context, modelView, make_ref(group));
|
||||
}
|
||||
|
@ -1416,7 +1416,7 @@ void FrontendRenderer::Render3dLayer(ScreenBase const & modelView)
|
|||
if (layer.m_renderGroups.empty())
|
||||
return;
|
||||
|
||||
DEBUG_LABEL(render3dLayerLabel, m_context, "3D Layer");
|
||||
DEBUG_LABEL(m_context, "3D Layer");
|
||||
if (m_buildingsFramebuffer->IsSupported())
|
||||
{
|
||||
float const kOpacity = 0.7f;
|
||||
|
@ -1439,7 +1439,7 @@ void FrontendRenderer::Render3dLayer(ScreenBase const & modelView)
|
|||
void FrontendRenderer::RenderOverlayLayer(ScreenBase const & modelView)
|
||||
{
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(renderOverlayLayerLabel, m_context, "Overlay Layer");
|
||||
DEBUG_LABEL(m_context, "Overlay Layer");
|
||||
RenderLayer & overlay = m_layers[static_cast<size_t>(DepthLayer::OverlayLayer)];
|
||||
BuildOverlayTree(modelView);
|
||||
for (drape_ptr<RenderGroup> & group : overlay.m_renderGroups)
|
||||
|
@ -1452,7 +1452,7 @@ void FrontendRenderer::RenderOverlayLayer(ScreenBase const & modelView)
|
|||
void FrontendRenderer::RenderNavigationOverlayLayer(ScreenBase const & modelView)
|
||||
{
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(renderNavigationOverlayLayerLabel, m_context, "Navigation Overlay Layer");
|
||||
DEBUG_LABEL(m_context, "Navigation Overlay Layer");
|
||||
RenderLayer & navOverlayLayer = m_layers[static_cast<size_t>(DepthLayer::NavigationLayer)];
|
||||
for (auto & group : navOverlayLayer.m_renderGroups)
|
||||
{
|
||||
|
@ -1476,7 +1476,7 @@ void FrontendRenderer::RenderTransitSchemeLayer(ScreenBase const & modelView)
|
|||
CHECK(m_context != nullptr, ());
|
||||
if (m_transitSchemeEnabled && m_transitSchemeRenderer->IsSchemeVisible(m_currentZoomLevel))
|
||||
{
|
||||
DEBUG_LABEL(renderTransitSchemeLayerLabel, m_context, "Transit Scheme");
|
||||
DEBUG_LABEL(m_context, "Transit Scheme");
|
||||
m_context->Clear(dp::ClearBits::DepthBit, dp::kClearBitsStoreAll);
|
||||
RenderTransitBackground();
|
||||
m_transitSchemeRenderer->RenderTransit(m_context, make_ref(m_gpuProgramManager), modelView,
|
||||
|
@ -1490,7 +1490,7 @@ void FrontendRenderer::RenderTrafficLayer(ScreenBase const & modelView)
|
|||
CHECK(m_context != nullptr, ());
|
||||
if (m_trafficRenderer->HasRenderData())
|
||||
{
|
||||
DEBUG_LABEL(renderTrafficLayerLabel, m_context, "Traffic Layer");
|
||||
DEBUG_LABEL(m_context, "Traffic Layer");
|
||||
m_context->Clear(dp::ClearBits::DepthBit, dp::kClearBitsStoreAll);
|
||||
m_trafficRenderer->RenderTraffic(m_context, make_ref(m_gpuProgramManager), modelView,
|
||||
m_currentZoomLevel, 1.0f /* opacity */, m_frameValues);
|
||||
|
@ -1503,7 +1503,7 @@ void FrontendRenderer::RenderTransitBackground()
|
|||
return;
|
||||
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(renderTransitBackgroundLabel, m_context, "Transit Background");
|
||||
DEBUG_LABEL(m_context, "Transit Background");
|
||||
|
||||
dp::TextureManager::ColorRegion region;
|
||||
m_texMng->GetColorRegion(df::GetColorConstant(kTransitBackgroundColor), region);
|
||||
|
@ -1523,7 +1523,7 @@ void FrontendRenderer::RenderRouteLayer(ScreenBase const & modelView)
|
|||
if (m_routeRenderer->HasData() || m_routeRenderer->HasPreviewData())
|
||||
{
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(renderRouteLayerLabel, m_context, "Route Layer");
|
||||
DEBUG_LABEL(m_context, "Route Layer");
|
||||
m_context->Clear(dp::ClearBits::DepthBit, dp::kClearBitsStoreAll);
|
||||
m_routeRenderer->RenderRoute(m_context, make_ref(m_gpuProgramManager), modelView,
|
||||
m_trafficRenderer->HasRenderData(), m_frameValues);
|
||||
|
@ -1537,7 +1537,7 @@ void FrontendRenderer::RenderUserMarksLayer(ScreenBase const & modelView, DepthL
|
|||
return;
|
||||
|
||||
CHECK(m_context != nullptr, ());
|
||||
DEBUG_LABEL(renderUserMarksLayerLabel, m_context, "User Marks: " + DebugPrint(layerId));
|
||||
DEBUG_LABEL(m_context, "User Marks: " + DebugPrint(layerId));
|
||||
m_context->Clear(dp::ClearBits::DepthBit, dp::kClearBitsStoreAll);
|
||||
|
||||
for (drape_ptr<RenderGroup> & group : renderGroups)
|
||||
|
|
|
@ -159,8 +159,9 @@ class ScaleFpsLabelHandle : public MutableLabelHandle
|
|||
{
|
||||
using TBase = MutableLabelHandle;
|
||||
public:
|
||||
ScaleFpsLabelHandle(uint32_t id, ref_ptr<dp::TextureManager> textures)
|
||||
: TBase(id, dp::LeftBottom, m2::PointF::Zero(), textures), m_scale(0)
|
||||
ScaleFpsLabelHandle(uint32_t id, ref_ptr<dp::TextureManager> textures, std::string const & apiLabel)
|
||||
: TBase(id, dp::LeftBottom, m2::PointF::Zero(), textures)
|
||||
, m_apiLabel(apiLabel)
|
||||
{
|
||||
SetIsVisible(true);
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ public:
|
|||
m_fps = helper.GetFps();
|
||||
m_isPaused = helper.IsPaused();
|
||||
std::stringstream ss;
|
||||
ss << "Scale: " << m_scale << " / FPS: " << m_fps;
|
||||
ss << m_apiLabel << ": Scale: " << m_scale << " / FPS: " << m_fps;
|
||||
if (m_isPaused)
|
||||
ss << " (PAUSED)";
|
||||
SetContent(ss.str());
|
||||
|
@ -191,6 +192,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
std::string const m_apiLabel;
|
||||
int m_scale = 1;
|
||||
uint32_t m_fps = 0;
|
||||
bool m_isPaused = false;
|
||||
|
@ -374,14 +376,23 @@ m2::PointF LayerCacher::CacheScaleFpsLabel(ref_ptr<dp::GraphicsContext> context,
|
|||
ref_ptr<dp::TextureManager> textures)
|
||||
{
|
||||
MutableLabelDrawer::Params params;
|
||||
params.m_alphabet = "FPSAUEDcale: 1234567890/()";
|
||||
params.m_alphabet = "MGLFPSAUEDcale: 1234567890/()";
|
||||
params.m_maxLength = 30;
|
||||
params.m_anchor = position.m_anchor;
|
||||
params.m_font = DrapeGui::GetGuiTextFont();
|
||||
params.m_pivot = position.m_pixelPivot;
|
||||
params.m_handleCreator = [textures](dp::Anchor, m2::PointF const &)
|
||||
auto const apiVersion = context->GetApiVersion();
|
||||
params.m_handleCreator = [textures, apiVersion](dp::Anchor, m2::PointF const &)
|
||||
{
|
||||
return make_unique_dp<ScaleFpsLabelHandle>(EGuiHandle::GuiHandleScaleLabel, textures);
|
||||
std::string apiLabel;
|
||||
switch (apiVersion)
|
||||
{
|
||||
case dp::ApiVersion::OpenGLES2: apiLabel = "GL2"; break;
|
||||
case dp::ApiVersion::OpenGLES3: apiLabel = "GL3"; break;
|
||||
case dp::ApiVersion::Metal: apiLabel = "M"; break;
|
||||
case dp::ApiVersion::Invalid: CHECK(false, ("Invalid API version.")); break;
|
||||
}
|
||||
return make_unique_dp<ScaleFpsLabelHandle>(EGuiHandle::GuiHandleScaleLabel, textures, apiLabel);
|
||||
};
|
||||
|
||||
drape_ptr<ShapeRenderer> scaleRenderer = make_unique_dp<ShapeRenderer>();
|
||||
|
|
|
@ -729,6 +729,8 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
MTL_OPTIMIZATION_LEVEL = 0;
|
||||
SUPPORTED_PLATFORMS = "macosx iphoneos";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -736,6 +738,8 @@
|
|||
4598438121394BE000F8CAB2 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MTL_FAST_MATH = YES;
|
||||
MTL_OPTIMIZATION_LEVEL = 3;
|
||||
SUPPORTED_PLATFORMS = "macosx iphoneos";
|
||||
};
|
||||
name = Release;
|
||||
|
@ -743,6 +747,8 @@
|
|||
4598438221394BE000F8CAB2 /* Production Full */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MTL_FAST_MATH = YES;
|
||||
MTL_OPTIMIZATION_LEVEL = 3;
|
||||
SUPPORTED_PLATFORMS = "macosx iphoneos";
|
||||
};
|
||||
name = "Production Full";
|
||||
|
|
Loading…
Add table
Reference in a new issue