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

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

Issue 5254006: 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
« no previous file with comments | « app/gfx/gl/gl_context.cc ('k') | chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 &&
86 strstr(gl_extensions_string, "GL_ARB_shading_language_100")) {
86 gl_hlsl_major = 1; 87 gl_hlsl_major = 1;
87 gl_hlsl_minor = 0; 88 gl_hlsl_minor = 0;
88 } 89 }
89 } else if (gl_major_version > 1) { 90 } else if (gl_major_version > 1) {
90 char *glsl_version_string = (char*)glGetString(GL_SHADING_LANGUAGE_VERSION); 91 const char *glsl_version_string =
92 (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
91 if (glsl_version_string) 93 if (glsl_version_string)
92 sscanf(glsl_version_string, "%u.%u", &gl_hlsl_major, &gl_hlsl_minor); 94 sscanf(glsl_version_string, "%u.%u", &gl_hlsl_major, &gl_hlsl_minor);
93 } 95 }
94 96
95 shader_version = (gl_hlsl_major << 8) | (gl_hlsl_minor & 0xFF); 97 shader_version = (gl_hlsl_major << 8) | (gl_hlsl_minor & 0xFF);
96 return shader_version; 98 return shader_version;
97 } 99 }
98 100
99 101
100 static std::wstring CStringToWString(const char *s) { 102 static std::wstring CStringToWString(const char *s) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 shader_version, 164 shader_version,
163 gl_version, 165 gl_version,
164 false); 166 false);
165 167
166 gpu_info->SetProgress(GPUInfo::kComplete); 168 gpu_info->SetProgress(GPUInfo::kComplete);
167 169
168 return true; 170 return true;
169 } 171 }
170 172
171 } // namespace gpu_info_collector 173 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « app/gfx/gl/gl_context.cc ('k') | chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698