blob: 996c44f22cf4fd8c9c5b85c5abb3dd5574adb757 [file] [log] [blame]
[email protected]a37d7ff2014-01-17 21:31:001// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ui/gl/gl_version_info.h"
6
7#include "base/strings/string_util.h"
8
9namespace gfx {
10
[email protected]17a961192014-02-14 15:20:5211GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str)
[email protected]a37d7ff2014-01-17 21:31:0012 : is_es(false),
13 is_es1(false),
14 is_es2(false),
15 is_es3(false),
16 is_gl1(false),
17 is_gl2(false),
18 is_gl3(false),
[email protected]17a961192014-02-14 15:20:5219 is_gl4(false),
20 is_angle(false) {
[email protected]a37d7ff2014-01-17 21:31:0021 if (version_str) {
22 std::string lstr(StringToLowerASCII(std::string(version_str)));
23 is_es = (lstr.substr(0, 9) == "opengl es");
24 if (is_es) {
25 is_es1 = (lstr.substr(9, 2) == "-c" && lstr.substr(13, 2) == "1.");
26 is_es2 = (lstr.substr(9, 3) == " 2.");
27 is_es3 = (lstr.substr(9, 3) == " 3.");
28 } else {
29 is_gl2 = (lstr.substr(0, 2) == "2.");
30 is_gl3 = (lstr.substr(0, 2) == "3.");
31 is_gl4 = (lstr.substr(0, 2) == "4.");
32 // In early GL versions, GetString output format is implementation
33 // dependent.
34 is_gl1 = !is_gl2 && !is_gl3 && !is_gl4;
35 }
36 }
[email protected]17a961192014-02-14 15:20:5237 if (renderer_str) {
38 is_angle = StartsWithASCII(renderer_str, "ANGLE", true);
39 }
[email protected]a37d7ff2014-01-17 21:31:0040}
41
42} // namespace gfx