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

support_manager.cpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6a6844908699fc6a3b8e33b8f469b7d0c627a6f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "drape/support_manager.hpp"
#include "drape/glfunctions.hpp"

#include "base/logging.hpp"

#include "std/algorithm.hpp"
#include "std/vector.hpp"

#include "3party/Alohalytics/src/alohalytics.h"

namespace dp
{

void SupportManager::Init()
{
  string const renderer = GLFunctions::glGetString(gl_const::GLRenderer);
  string const version = GLFunctions::glGetString(gl_const::GLVersion);
  LOG(LINFO, ("Renderer =", renderer, "Api =", GLFunctions::CurrentApiVersion, "Driver version =", version));

  // On Android the engine may be recreated. Here we guarantee that GPU info is sent once per session.
  static bool gpuInfoSent = false;
  if (!gpuInfoSent)
  {
    alohalytics::Stats::Instance().LogEvent("GPU", renderer);
    gpuInfoSent = true;
  }

  m_isSamsungGoogleNexus = (renderer == "PowerVR SGX 540" && version.find("GOOGLENEXUS.ED945322") != string::npos);
  if (m_isSamsungGoogleNexus)
    LOG(LINFO, ("Samsung Google Nexus detected."));

  if (renderer.find("Adreno") != string::npos)
  {
    vector<string> const models = { "200", "203", "205", "220", "225" };
    for (auto const & model : models)
    {
      if (renderer.find(model) != string::npos)
      {
        LOG(LINFO, ("Adreno 200 device detected."));
        m_isAdreno200 = true;
        break;
      }
    }
  }

  m_isTegra = (renderer.find("Tegra") != string::npos);
  if (m_isTegra)
    LOG(LINFO, ("NVidia Tegra device detected."));

  m_maxLineWidth = max(1, GLFunctions::glGetMaxLineWidth());
  LOG(LINFO, ("Max line width =", m_maxLineWidth));
}

bool SupportManager::IsSamsungGoogleNexus() const
{
  return m_isSamsungGoogleNexus;
}

bool SupportManager::IsAdreno200Device() const
{
  return m_isAdreno200;
}

bool SupportManager::IsTegraDevice() const
{
  return m_isTegra;
}

int SupportManager::GetMaxLineWidth() const
{
  return m_maxLineWidth;
}

SupportManager & SupportManager::Instance()
{
  static SupportManager manager;
  return manager;
}

} // namespace dp