| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "gpu/command_buffer/service/gl_utils.h" | 5 #include "gpu/command_buffer/service/gl_utils.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "gpu/command_buffer/common/capabilities.h" | 8 #include "gpu/command_buffer/common/capabilities.h" |
| 9 #include "gpu/command_buffer/service/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
| 10 #include "ui/gl/gl_version_info.h" | 10 #include "ui/gl/gl_version_info.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 255 } |
| 256 | 256 |
| 257 const char* GetServiceShadingLanguageVersionString( | 257 const char* GetServiceShadingLanguageVersionString( |
| 258 const FeatureInfo* feature_info) { | 258 const FeatureInfo* feature_info) { |
| 259 if (feature_info->IsWebGL2OrES3Context()) | 259 if (feature_info->IsWebGL2OrES3Context()) |
| 260 return "OpenGL ES GLSL ES 3.0 Chromium"; | 260 return "OpenGL ES GLSL ES 3.0 Chromium"; |
| 261 else | 261 else |
| 262 return "OpenGL ES GLSL ES 1.0 Chromium"; | 262 return "OpenGL ES GLSL ES 1.0 Chromium"; |
| 263 } | 263 } |
| 264 | 264 |
| 265 const char* GetServiceRendererString(const FeatureInfo* feature_info) { | |
| 266 // Return the unmasked RENDERER string for WebGL contexts. | |
| 267 // It is used by WEBGL_debug_renderer_info. | |
| 268 if (!feature_info->IsWebGLContext()) | |
| 269 return "Chromium"; | |
| 270 else | |
| 271 return reinterpret_cast<const char*>(glGetString(GL_RENDERER)); | |
| 272 } | |
| 273 | |
| 274 const char* GetServiceVendorString(const FeatureInfo* feature_info) { | |
| 275 // Return the unmasked VENDOR string for WebGL contexts. | |
| 276 // It is used by WEBGL_debug_renderer_info. | |
| 277 if (!feature_info->IsWebGLContext()) | |
| 278 return "Chromium"; | |
| 279 else | |
| 280 return reinterpret_cast<const char*>(glGetString(GL_VENDOR)); | |
| 281 } | |
| 282 | |
| 283 void APIENTRY LogGLDebugMessage(GLenum source, | 265 void APIENTRY LogGLDebugMessage(GLenum source, |
| 284 GLenum type, | 266 GLenum type, |
| 285 GLuint id, | 267 GLuint id, |
| 286 GLenum severity, | 268 GLenum severity, |
| 287 GLsizei length, | 269 GLsizei length, |
| 288 const GLchar* message, | 270 const GLchar* message, |
| 289 GLvoid* user_param) { | 271 GLvoid* user_param) { |
| 290 LOG(ERROR) << "GL Driver Message (" << GetDebugSourceString(source) << ", " | 272 LOG(ERROR) << "GL Driver Message (" << GetDebugSourceString(source) << ", " |
| 291 << GetDebugTypeString(type) << ", " << id << ", " | 273 << GetDebugTypeString(type) << ", " << id << ", " |
| 292 << GetDebugSeverityString(severity) << "): " << message; | 274 << GetDebugSeverityString(severity) << "): " << message; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 304 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW, 0, | 286 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW, 0, |
| 305 nullptr, GL_FALSE); | 287 nullptr, GL_FALSE); |
| 306 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, | 288 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, |
| 307 GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE); | 289 GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE); |
| 308 | 290 |
| 309 glDebugMessageCallback(&LogGLDebugMessage, nullptr); | 291 glDebugMessageCallback(&LogGLDebugMessage, nullptr); |
| 310 } | 292 } |
| 311 | 293 |
| 312 } // namespace gles2 | 294 } // namespace gles2 |
| 313 } // namespace gpu | 295 } // namespace gpu |
| OLD | NEW |