| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file includes all the necessary GL headers and implements some useful | 5 // This file includes all the necessary GL headers and implements some useful |
| 6 // utilities. | 6 // utilities. |
| 7 | 7 |
| 8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ | 8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ |
| 9 #define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ | 9 #define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
| 15 | 15 |
| 16 // Define this for extra GL error debugging (slower). | 16 // Define this for extra GL error debugging (slower). |
| 17 // #define GL_ERROR_DEBUGGING | 17 // #define GL_ERROR_DEBUGGING |
| 18 #ifdef GL_ERROR_DEBUGGING | 18 #ifdef GL_ERROR_DEBUGGING |
| 19 #define CHECK_GL_ERROR() do { \ | 19 #define CHECK_GL_ERROR() do { \ |
| 20 GLenum gl_error = glGetError(); \ | 20 GLenum gl_error = glGetError(); \ |
| 21 LOG_IF(ERROR, gl_error != GL_NO_ERROR) << "GL Error :" << gl_error; \ | 21 LOG_IF(ERROR, gl_error != GL_NO_ERROR) << "GL Error :" << gl_error; \ |
| 22 } while (0) | 22 } while (0) |
| 23 #else // GL_ERROR_DEBUGGING | 23 #else // GL_ERROR_DEBUGGING |
| 24 #define CHECK_GL_ERROR() void(0) | 24 #define CHECK_GL_ERROR() void(0) |
| 25 #endif // GL_ERROR_DEBUGGING | 25 #endif // GL_ERROR_DEBUGGING |
| 26 | 26 |
| 27 namespace gl { |
| 28 struct GLVersionInfo; |
| 29 } |
| 30 |
| 27 namespace gpu { | 31 namespace gpu { |
| 32 |
| 33 struct Capabilities; |
| 34 class FeatureInfo; |
| 35 |
| 28 namespace gles2 { | 36 namespace gles2 { |
| 29 | 37 |
| 30 std::vector<int> GetAllGLErrors(); | 38 std::vector<int> GetAllGLErrors(); |
| 31 | 39 |
| 40 bool PrecisionMeetsSpecForHighpFloat(GLint rangeMin, |
| 41 GLint rangeMax, |
| 42 GLint precision); |
| 43 void QueryShaderPrecisionFormat(const gl::GLVersionInfo& gl_version_info, |
| 44 GLenum shader_type, |
| 45 GLenum precision_type, |
| 46 GLint* range, |
| 47 GLint* precision); |
| 48 |
| 49 // Using the provided feature info, query the numeric limits of the underlying |
| 50 // GL and fill in the members of the Capabilities struct. Does not perform any |
| 51 // extension checks. |
| 52 void PopulateNumericCapabilities(Capabilities* caps, |
| 53 const FeatureInfo* feature_info); |
| 54 |
| 32 } // gles2 | 55 } // gles2 |
| 33 } // gpu | 56 } // gpu |
| 34 | 57 |
| 35 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ | 58 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ |
| OLD | NEW |