Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-09-17 19:35:40 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-09-19 18:52:53 +0300
commitfca360f496a0d3969cf7d7919e2578712a241b55 (patch)
tree611ceac16abdd188d16ac47e00713ad376b4dcb2
parent486ff9554f46cf76a02bd02ce510e65cb7868cb9 (diff)
[drape][metal] Use Metal API if it is allowed by the settings.drape-metal
-rw-r--r--drape/metal/render_state_metal.mm1
-rw-r--r--iphone/Maps/Classes/EAGLView.mm11
-rw-r--r--map/framework.cpp31
-rw-r--r--map/framework.hpp5
-rw-r--r--shaders/Metal/map.metal4
5 files changed, 45 insertions, 7 deletions
diff --git a/drape/metal/render_state_metal.mm b/drape/metal/render_state_metal.mm
index 8ab6517f39..9eede60da4 100644
--- a/drape/metal/render_state_metal.mm
+++ b/drape/metal/render_state_metal.mm
@@ -42,6 +42,7 @@ void ApplyTexturesForMetal(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram>
if (t == nullptr)
continue;
+ t->SetFilter(state.GetTextureFilter());
dp::HWTexture::Params const & params = t->GetParams();
// Set texture to the vertex shader.
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index 6907acbf70..160fc6a2b4 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -57,9 +57,12 @@ double getExactDPI(double contentScaleFactor)
- (dp::ApiVersion)getSupportedApiVersion
{
- id<MTLDevice> tempDevice = MTLCreateSystemDefaultDevice();
- if (tempDevice)
- return dp::ApiVersion::Metal;
+ if (GetFramework().LoadMetalAllowed())
+ {
+ id<MTLDevice> tempDevice = MTLCreateSystemDefaultDevice();
+ if (tempDevice)
+ return dp::ApiVersion::Metal;
+ }
EAGLContext * tempContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (tempContext != nil)
@@ -108,7 +111,7 @@ double getExactDPI(double contentScaleFactor)
- (void)createDrapeEngineWithWidth:(int)width height:(int)height
{
- LOG(LINFO, ("CreateDrapeEngine Started", width, height));
+ LOG(LINFO, ("CreateDrapeEngine Started", width, height, m_apiVersion));
CHECK(m_factory != nullptr, ());
Framework::DrapeCreationParams p;
diff --git a/map/framework.cpp b/map/framework.cpp
index b6385596e8..fa63318c68 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -136,6 +136,10 @@ char const kTrafficSimplifiedColorsKey[] = "TrafficSimplifiedColors";
char const kLargeFontsSize[] = "LargeFontsSize";
char const kTranslitMode[] = "TransliterationMode";
+#if defined(OMIM_OS_IPHONE)
+char const kMetalAllowed[] = "MetalAllowed";
+#endif
+
#if defined(OMIM_OS_ANDROID)
char const kICUDataFile[] = "icudt57l.dat";
#endif
@@ -2493,6 +2497,21 @@ void Framework::UpdateSavedDataVersion()
int64_t Framework::GetCurrentDataVersion() const { return m_storage.GetCurrentDataVersion(); }
+#if defined(OMIM_OS_IPHONE)
+bool Framework::LoadMetalAllowed()
+{
+ bool allowed;
+ if (settings::Get(kMetalAllowed, allowed))
+ return allowed;
+ return false;
+}
+
+void Framework::SaveMetalAllowed(bool allowed)
+{
+ settings::Set(kMetalAllowed, allowed);
+}
+#endif
+
void Framework::AllowTransliteration(bool allowTranslit)
{
Transliteration::Instance().SetMode(allowTranslit ? Transliteration::Mode::Enabled
@@ -2767,6 +2786,18 @@ bool Framework::ParseDrapeDebugCommand(string const & query)
m_drapeEngine->EnableDebugRectRendering(false /* shown */);
return true;
}
+#if defined(OMIM_OS_IPHONE)
+ if (query == "?metal")
+ {
+ SaveMetalAllowed(true);
+ return true;
+ }
+ if (query == "?gl")
+ {
+ SaveMetalAllowed(false);
+ return true;
+ }
+#endif
return false;
}
diff --git a/map/framework.hpp b/map/framework.hpp
index 8710e76ad8..4badf63e62 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -774,6 +774,11 @@ public:
bool LoadTransitSchemeEnabled();
void SaveTransitSchemeEnabled(bool enabled);
+#if defined(OMIM_OS_IPHONE)
+ bool LoadMetalAllowed();
+ void SaveMetalAllowed(bool allowed);
+#endif
+
public:
template <typename ResultCallback>
uint32_t Discover(discovery::ClientParams && params, ResultCallback const & onResult,
diff --git a/shaders/Metal/map.metal b/shaders/Metal/map.metal
index 451b30129d..47ff342646 100644
--- a/shaders/Metal/map.metal
+++ b/shaders/Metal/map.metal
@@ -660,9 +660,7 @@ typedef struct
} TexturingFragment_T;
vertex TexturingFragment_T vsTexturing(const TexturingVertex_T in [[stage_in]],
- constant Uniforms_T & uniforms [[buffer(1)]],
- texture2d<float> u_colorTex [[texture(0)]],
- sampler u_colorTexSampler [[sampler(0)]])
+ constant Uniforms_T & uniforms [[buffer(1)]])
{
TexturingFragment_T out;