OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 contains the ErrorState class. | 5 // This file contains the ErrorState class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 error_state->SetGLError(__FILE__, __LINE__, error, function_name, msg) | 24 error_state->SetGLError(__FILE__, __LINE__, error, function_name, msg) |
25 | 25 |
26 // Use to synthesize an INVALID_ENUM GL error on the error_state. Will attempt | 26 // Use to synthesize an INVALID_ENUM GL error on the error_state. Will attempt |
27 // to expand the enum to a string. | 27 // to expand the enum to a string. |
28 #define ERRORSTATE_SET_GL_ERROR_INVALID_ENUM( \ | 28 #define ERRORSTATE_SET_GL_ERROR_INVALID_ENUM( \ |
29 error_state, function_name, value, label) \ | 29 error_state, function_name, value, label) \ |
30 error_state->SetGLErrorInvalidEnum( \ | 30 error_state->SetGLErrorInvalidEnum( \ |
31 __FILE__, __LINE__, function_name, value, label) | 31 __FILE__, __LINE__, function_name, value, label) |
32 | 32 |
33 // Use to synthesize a GL error on the error_state for an invalid enum based | 33 // Use to synthesize a GL error on the error_state for an invalid enum based |
34 // parameter. Will attempt to expand the parameter to a string. | 34 // integer parameter. Will attempt to expand the parameter to a string. |
35 #define ERRORSTATE_SET_GL_ERROR_INVALID_PARAM( \ | 35 #define ERRORSTATE_SET_GL_ERROR_INVALID_PARAMI( \ |
36 error_state, error, function_name, pname, param) \ | 36 error_state, error, function_name, pname, param) \ |
37 error_state->SetGLErrorInvalidParam( \ | 37 error_state->SetGLErrorInvalidParami( \ |
| 38 __FILE__, __LINE__, error, function_name, pname, param) |
| 39 |
| 40 // Use to synthesize a GL error on the error_state for an invalid enum based |
| 41 // float parameter. Will attempt to expand the parameter to a string. |
| 42 #define ERRORSTATE_SET_GL_ERROR_INVALID_PARAMF( \ |
| 43 error_state, error, function_name, pname, param) \ |
| 44 error_state->SetGLErrorInvalidParamf( \ |
38 __FILE__, __LINE__, error, function_name, pname, param) | 45 __FILE__, __LINE__, error, function_name, pname, param) |
39 | 46 |
40 // Use to move all pending error to the wrapper so on your next GL call | 47 // Use to move all pending error to the wrapper so on your next GL call |
41 // you can see if that call generates an error. | 48 // you can see if that call generates an error. |
42 #define ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name) \ | 49 #define ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name) \ |
43 error_state->CopyRealGLErrorsToWrapper(__FILE__, __LINE__, function_name) | 50 error_state->CopyRealGLErrorsToWrapper(__FILE__, __LINE__, function_name) |
44 // Use to look at the real GL error and still pass it on to the user. | 51 // Use to look at the real GL error and still pass it on to the user. |
45 #define ERRORSTATE_PEEK_GL_ERROR(error_state, function_name) \ | 52 #define ERRORSTATE_PEEK_GL_ERROR(error_state, function_name) \ |
46 error_state->PeekGLError(__FILE__, __LINE__, function_name) | 53 error_state->PeekGLError(__FILE__, __LINE__, function_name) |
47 // Use to clear all current GL errors. FAILS if there are any. | 54 // Use to clear all current GL errors. FAILS if there are any. |
(...skipping 14 matching lines...) Expand all Loading... |
62 int line, | 69 int line, |
63 unsigned int error, | 70 unsigned int error, |
64 const char* function_name, | 71 const char* function_name, |
65 const char* msg) = 0; | 72 const char* msg) = 0; |
66 virtual void SetGLErrorInvalidEnum( | 73 virtual void SetGLErrorInvalidEnum( |
67 const char* filename, | 74 const char* filename, |
68 int line, | 75 int line, |
69 const char* function_name, | 76 const char* function_name, |
70 unsigned int value, | 77 unsigned int value, |
71 const char* label) = 0; | 78 const char* label) = 0; |
72 virtual void SetGLErrorInvalidParam( | 79 virtual void SetGLErrorInvalidParami( |
73 const char* filename, | 80 const char* filename, |
74 int line, | 81 int line, |
75 unsigned int error, | 82 unsigned int error, |
76 const char* function_name, | 83 const char* function_name, |
77 unsigned int pname, | 84 unsigned int pname, |
78 int param) = 0; | 85 int param) = 0; |
| 86 virtual void SetGLErrorInvalidParamf( |
| 87 const char* filename, |
| 88 int line, |
| 89 unsigned int error, |
| 90 const char* function_name, |
| 91 unsigned int pname, |
| 92 float param) = 0; |
79 | 93 |
80 // Gets the GLError and stores it in our wrapper. Effectively | 94 // Gets the GLError and stores it in our wrapper. Effectively |
81 // this lets us peek at the error without losing it. | 95 // this lets us peek at the error without losing it. |
82 virtual unsigned int PeekGLError( | 96 virtual unsigned int PeekGLError( |
83 const char* filename, int line, const char* function_name) = 0; | 97 const char* filename, int line, const char* function_name) = 0; |
84 | 98 |
85 // Copies the real GL errors to the wrapper. This is so we can | 99 // Copies the real GL errors to the wrapper. This is so we can |
86 // make sure there are no native GL errors before calling some GL function | 100 // make sure there are no native GL errors before calling some GL function |
87 // so that on return we know any error generated was for that specific | 101 // so that on return we know any error generated was for that specific |
88 // command. | 102 // command. |
89 virtual void CopyRealGLErrorsToWrapper( | 103 virtual void CopyRealGLErrorsToWrapper( |
90 const char* filename, int line, const char* function_name) = 0; | 104 const char* filename, int line, const char* function_name) = 0; |
91 | 105 |
92 // Clear all real GL errors. This is to prevent the client from seeing any | 106 // Clear all real GL errors. This is to prevent the client from seeing any |
93 // errors caused by GL calls that it was not responsible for issuing. | 107 // errors caused by GL calls that it was not responsible for issuing. |
94 virtual void ClearRealGLErrors( | 108 virtual void ClearRealGLErrors( |
95 const char* filename, int line, const char* function_name) = 0; | 109 const char* filename, int line, const char* function_name) = 0; |
96 | 110 |
97 protected: | 111 protected: |
98 ErrorState(); | 112 ErrorState(); |
99 | 113 |
100 DISALLOW_COPY_AND_ASSIGN(ErrorState); | 114 DISALLOW_COPY_AND_ASSIGN(ErrorState); |
101 }; | 115 }; |
102 | 116 |
103 } // namespace gles2 | 117 } // namespace gles2 |
104 } // namespace gpu | 118 } // namespace gpu |
105 | 119 |
106 #endif // GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 120 #endif // GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
107 | 121 |
OLD | NEW |