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

Side by Side Diff: chrome/gpu/gpu_info_collector_mac.mm

Issue 5305005: Initialize destinations variables before calling GL functions... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 "chrome/gpu/gpu_info_collector.h" 5 #include "chrome/gpu/gpu_info_collector.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "app/gfx/gl/gl_bindings.h" 10 #include "app/gfx/gl/gl_bindings.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return s_found; 74 return s_found;
75 } 75 }
76 76
77 // Gets the numeric HLSL version. 77 // Gets the numeric HLSL version.
78 // You pass it the current GL major version, to give it a hint where to look. 78 // You pass it the current GL major version, to give it a hint where to look.
79 static int GetShaderNumericVersion(int gl_major_version) { 79 static int GetShaderNumericVersion(int gl_major_version) {
80 int gl_hlsl_major = 0, gl_hlsl_minor = 0; 80 int gl_hlsl_major = 0, gl_hlsl_minor = 0;
81 int shader_version = 0; 81 int shader_version = 0;
82 82
83 if (gl_major_version == 1) { 83 if (gl_major_version == 1) {
84 char *gl_extensions_string = (char*)glGetString(GL_EXTENSIONS); 84 const char *gl_extensions_string = (const char*)glGetString(GL_EXTENSIONS);
85 if (strstr(gl_extensions_string, "GL_ARB_shading_language_100")) { 85 if (gl_extensions_string && strstr(gl_extensions_string, "GL_ARB_shading_lan guage_100")) {
apatrick 2010/11/24 18:13:04 Do we do 80 chars in objective C files?
86 gl_hlsl_major = 1; 86 gl_hlsl_major = 1;
87 gl_hlsl_minor = 0; 87 gl_hlsl_minor = 0;
88 } 88 }
89 } else if (gl_major_version > 1) { 89 } else if (gl_major_version > 1) {
90 char *glsl_version_string = (char*)glGetString(GL_SHADING_LANGUAGE_VERSION); 90 const char *glsl_version_string = (const char*)glGetString(GL_SHADING_LANGUA GE_VERSION);
apatrick 2010/11/24 18:13:04 Same here if that's the case.
91 if (glsl_version_string) 91 if (glsl_version_string)
92 sscanf(glsl_version_string, "%u.%u", &gl_hlsl_major, &gl_hlsl_minor); 92 sscanf(glsl_version_string, "%u.%u", &gl_hlsl_major, &gl_hlsl_minor);
93 } 93 }
94 94
95 shader_version = (gl_hlsl_major << 8) | (gl_hlsl_minor & 0xFF); 95 shader_version = (gl_hlsl_major << 8) | (gl_hlsl_minor & 0xFF);
96 return shader_version; 96 return shader_version;
97 } 97 }
98 98
99 99
100 static std::wstring CStringToWString(const char *s) { 100 static std::wstring CStringToWString(const char *s) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 shader_version, 162 shader_version,
163 gl_version, 163 gl_version,
164 false); 164 false);
165 165
166 gpu_info->SetProgress(GPUInfo::kComplete); 166 gpu_info->SetProgress(GPUInfo::kComplete);
167 167
168 return true; 168 return true;
169 } 169 }
170 170
171 } // namespace gpu_info_collector 171 } // namespace gpu_info_collector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698