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 context, ref_ptr 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 tempDevice = MTLCreateSystemDefaultDevice(); - if (tempDevice) - return dp::ApiVersion::Metal; + if (GetFramework().LoadMetalAllowed()) + { + id 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 50b6bd4058..2fcc8980b7 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 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 u_colorTex [[texture(0)]], - sampler u_colorTexSampler [[sampler(0)]]) + constant Uniforms_T & uniforms [[buffer(1)]]) { TexturingFragment_T out;