Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: ui/gl/gl_version_info.cc

Issue 1938493002: [Reland] Fix ReadPixels from float fbo buffer in ES2/WebGL1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_version_info.h" 5 #include "ui/gl/gl_version_info.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
(...skipping 25 matching lines...) Expand all
36 is_desktop_core_profile = 36 is_desktop_core_profile =
37 DesktopCoreCommonCheck(is_es, major_version, minor_version) && 37 DesktopCoreCommonCheck(is_es, major_version, minor_version) &&
38 extensions.find("GL_ARB_compatibility") == extensions.end(); 38 extensions.find("GL_ARB_compatibility") == extensions.end();
39 } 39 }
40 40
41 GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str) 41 GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str)
42 : is_es(false), 42 : is_es(false),
43 is_angle(false), 43 is_angle(false),
44 major_version(0), 44 major_version(0),
45 minor_version(0), 45 minor_version(0),
46 is_es2(false),
46 is_es3(false), 47 is_es3(false),
47 is_desktop_core_profile(false) { 48 is_desktop_core_profile(false) {
48 if (version_str) { 49 if (version_str) {
49 ParseVersionString(version_str, &major_version, &minor_version, 50 ParseVersionString(version_str, &major_version, &minor_version,
50 &is_es, &is_es3); 51 &is_es, &is_es2, &is_es3);
51 } 52 }
52 if (renderer_str) { 53 if (renderer_str) {
53 is_angle = base::StartsWith(renderer_str, "ANGLE", 54 is_angle = base::StartsWith(renderer_str, "ANGLE",
54 base::CompareCase::SENSITIVE); 55 base::CompareCase::SENSITIVE);
55 } 56 }
56 } 57 }
57 58
58 void GLVersionInfo::ParseVersionString(const char* version_str, 59 void GLVersionInfo::ParseVersionString(const char* version_str,
59 unsigned* major_version, 60 unsigned* major_version,
60 unsigned* minor_version, 61 unsigned* minor_version,
61 bool* is_es, 62 bool* is_es,
63 bool* is_es2,
62 bool* is_es3) { 64 bool* is_es3) {
63 // Make sure the outputs are always initialized. 65 // Make sure the outputs are always initialized.
64 *major_version = 0; 66 *major_version = 0;
65 *minor_version = 0; 67 *minor_version = 0;
66 *is_es = false; 68 *is_es = false;
69 *is_es2 = false;
67 *is_es3 = false; 70 *is_es3 = false;
68 if (!version_str) 71 if (!version_str)
69 return; 72 return;
70 std::string lstr(base::ToLowerASCII(version_str)); 73 std::string lstr(base::ToLowerASCII(version_str));
71 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); 74 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es");
72 if (*is_es) 75 if (*is_es)
73 lstr = lstr.substr(10, 3); 76 lstr = lstr.substr(10, 3);
74 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); 77 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), ".");
75 unsigned major, minor; 78 unsigned major, minor;
76 if (tokenizer.GetNext() && 79 if (tokenizer.GetNext() &&
77 base::StringToUint(tokenizer.token_piece(), &major)) { 80 base::StringToUint(tokenizer.token_piece(), &major)) {
78 *major_version = major; 81 *major_version = major;
79 if (tokenizer.GetNext() && 82 if (tokenizer.GetNext() &&
80 base::StringToUint(tokenizer.token_piece(), &minor)) { 83 base::StringToUint(tokenizer.token_piece(), &minor)) {
81 *minor_version = minor; 84 *minor_version = minor;
82 } 85 }
83 } 86 }
87 if (*is_es && *major_version == 2)
88 *is_es2 = true;
84 if (*is_es && *major_version == 3) 89 if (*is_es && *major_version == 3)
85 *is_es3 = true; 90 *is_es3 = true;
86 DCHECK(major_version != 0); 91 DCHECK(major_version != 0);
87 } 92 }
88 93
89 } // namespace gfx 94 } // namespace gfx
OLDNEW
« gpu/command_buffer/tests/gl_readback_unittest.cc ('K') | « ui/gl/gl_version_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698