| 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 contains the GLES2Decoder class. | 5 // This file contains the GLES2Decoder class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
| 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "gpu/command_buffer/service/common_decoder.h" | 16 #include "gpu/command_buffer/service/common_decoder.h" |
| 17 #include "gpu/command_buffer/service/logger.h" |
| 17 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
| 18 #include "ui/gl/gl_context.h" | 19 #include "ui/gl/gl_context.h" |
| 19 | 20 |
| 20 // Use these macro to synthesize GL errors instead of calling the decoder | |
| 21 // functions directly as they will propogate the __FILE__ and __LINE__ | |
| 22 | |
| 23 // Use to synthesize a GL error on the decoder. | |
| 24 #define GLESDECODER_SET_GL_ERROR(decoder, error, function_name, msg) \ | |
| 25 decoder->SetGLError(__FILE__, __LINE__, error, function_name, msg) | |
| 26 | |
| 27 // Use to synthesize an INVALID_ENUM GL error on the decoder. Will attempt to | |
| 28 // expand the enum to a string. | |
| 29 #define GLESDECODER_SET_GL_ERROR_INVALID_ENUM( \ | |
| 30 decoder, function_name, value, label) \ | |
| 31 decoder->SetGLErrorInvalidEnum( \ | |
| 32 __FILE__, __LINE__, function_name, value, label) | |
| 33 | |
| 34 // Use to synthesize a GL error on the decoder for an invalid enum based | |
| 35 // parameter. Will attempt to expand the parameter to a string. | |
| 36 #define GLESDECODER_SET_GL_ERROR_INVALID_PARAM( \ | |
| 37 decoder, error, function_name, pname, param) \ | |
| 38 decoder->SetGLErrorInvalidParam( \ | |
| 39 __FILE__, __LINE__, error, function_name, pname, param) | |
| 40 | |
| 41 // Use to move all pending error to the wrapper so on your next GL call | |
| 42 // you can see if that call generates an error. | |
| 43 #define GLESDECODER_COPY_REAL_GL_ERRORS_TO_WRAPPER(decoder, function_name) \ | |
| 44 decoder->CopyRealGLErrorsToWrapper(__FILE__, __LINE__, function_name) | |
| 45 // Use to look at the real GL error and still pass it on to the user. | |
| 46 #define GLESDECODER_PEEK_GL_ERROR(decoder, function_name) \ | |
| 47 decoder->PeekGLError(__FILE__, __LINE__, function_name) | |
| 48 // Use to clear all current GL errors. FAILS if there are any. | |
| 49 #define GLESDECODER_CLEAR_REAL_GL_ERRORS(decoder, function_name) \ | |
| 50 decoder->ClearRealGLErrors(__FILE__, __LINE__, function_name) | |
| 51 | |
| 52 namespace gfx { | 21 namespace gfx { |
| 53 class GLContext; | 22 class GLContext; |
| 54 class GLSurface; | 23 class GLSurface; |
| 55 class AsyncPixelTransferDelegate; | 24 class AsyncPixelTransferDelegate; |
| 56 } | 25 } |
| 57 | 26 |
| 58 namespace gpu { | 27 namespace gpu { |
| 59 | 28 |
| 60 class StreamTextureManager; | 29 class StreamTextureManager; |
| 61 | 30 |
| 62 namespace gles2 { | 31 namespace gles2 { |
| 63 | 32 |
| 64 class ContextGroup; | 33 class ContextGroup; |
| 34 class ErrorState; |
| 65 class GLES2Util; | 35 class GLES2Util; |
| 66 class Logger; | 36 class Logger; |
| 67 class QueryManager; | 37 class QueryManager; |
| 68 class VertexArrayManager; | 38 class VertexArrayManager; |
| 69 | 39 |
| 70 struct DisallowedFeatures { | 40 struct DisallowedFeatures { |
| 71 DisallowedFeatures() | 41 DisallowedFeatures() |
| 72 : multisampling(false), | 42 : multisampling(false), |
| 73 swap_buffer_complete_callback(false), | 43 swap_buffer_complete_callback(false), |
| 74 gpu_memory_manager(false) { | 44 gpu_memory_manager(false) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 unsigned service_id, | 195 unsigned service_id, |
| 226 unsigned bind_target, | 196 unsigned bind_target, |
| 227 unsigned target, | 197 unsigned target, |
| 228 int level, | 198 int level, |
| 229 unsigned format, | 199 unsigned format, |
| 230 unsigned type, | 200 unsigned type, |
| 231 int width, | 201 int width, |
| 232 int height, | 202 int height, |
| 233 bool is_texture_immutable) = 0; | 203 bool is_texture_immutable) = 0; |
| 234 | 204 |
| 235 // Gets the GL error for this context. | 205 virtual ErrorState* GetErrorState() = 0; |
| 236 virtual uint32 GetGLError() = 0; | |
| 237 | |
| 238 // Sets a GL error. | |
| 239 virtual void SetGLError( | |
| 240 const char* filename, | |
| 241 int line, | |
| 242 unsigned error, | |
| 243 const char* function_name, | |
| 244 const char* msg) = 0; | |
| 245 virtual void SetGLErrorInvalidEnum( | |
| 246 const char* filename, | |
| 247 int line, | |
| 248 const char* function_name, | |
| 249 unsigned value, | |
| 250 const char* label) = 0; | |
| 251 virtual void SetGLErrorInvalidParam( | |
| 252 const char* filename, | |
| 253 int line, | |
| 254 unsigned error, | |
| 255 const char* function_name, | |
| 256 unsigned pname, | |
| 257 int param) = 0; | |
| 258 | |
| 259 // Copies the real GL errors to the wrapper. This is so we can | |
| 260 // make sure there are no native GL errors before calling some GL function | |
| 261 // so that on return we know any error generated was for that specific | |
| 262 // command. | |
| 263 virtual void CopyRealGLErrorsToWrapper( | |
| 264 const char* file, int line, const char* filename) = 0; | |
| 265 | |
| 266 // Gets the GLError and stores it in our wrapper. Effectively | |
| 267 // this lets us peek at the error without losing it. | |
| 268 virtual unsigned PeekGLError( | |
| 269 const char* file, int line, const char* filename) = 0; | |
| 270 | |
| 271 // Clear all real GL errors. This is to prevent the client from seeing any | |
| 272 // errors caused by GL calls that it was not responsible for issuing. | |
| 273 virtual void ClearRealGLErrors( | |
| 274 const char* file, int line, const char* filename) = 0; | |
| 275 | 206 |
| 276 // A callback for messages from the decoder. | 207 // A callback for messages from the decoder. |
| 277 virtual void SetShaderCacheCallback(const ShaderCacheCallback& callback) = 0; | 208 virtual void SetShaderCacheCallback(const ShaderCacheCallback& callback) = 0; |
| 278 | 209 |
| 279 // Sets the callback for waiting on a sync point. The callback returns the | 210 // Sets the callback for waiting on a sync point. The callback returns the |
| 280 // scheduling status (i.e. true if the channel is still scheduled). | 211 // scheduling status (i.e. true if the channel is still scheduled). |
| 281 virtual void SetWaitSyncPointCallback( | 212 virtual void SetWaitSyncPointCallback( |
| 282 const WaitSyncPointCallback& callback) = 0; | 213 const WaitSyncPointCallback& callback) = 0; |
| 283 | 214 |
| 284 virtual uint32 GetTextureUploadCount() = 0; | 215 virtual uint32 GetTextureUploadCount() = 0; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 307 bool debug_; | 238 bool debug_; |
| 308 bool log_commands_; | 239 bool log_commands_; |
| 309 static bool testing_force_is_angle_; | 240 static bool testing_force_is_angle_; |
| 310 | 241 |
| 311 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); | 242 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); |
| 312 }; | 243 }; |
| 313 | 244 |
| 314 } // namespace gles2 | 245 } // namespace gles2 |
| 315 } // namespace gpu | 246 } // namespace gpu |
| 316 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 247 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
| OLD | NEW |