| 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "gpu/command_buffer/client/ref_counted.h" | 28 #include "gpu/command_buffer/client/ref_counted.h" |
| 29 #include "gpu/command_buffer/client/ring_buffer.h" | 29 #include "gpu/command_buffer/client/ring_buffer.h" |
| 30 #include "gpu/command_buffer/client/share_group.h" | 30 #include "gpu/command_buffer/client/share_group.h" |
| 31 #include "gpu/command_buffer/common/debug_marker_manager.h" | 31 #include "gpu/command_buffer/common/debug_marker_manager.h" |
| 32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 33 | 33 |
| 34 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT | 34 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT |
| 35 #if defined(GLES2_INLINE_OPTIMIZATION) | 35 #if defined(GLES2_INLINE_OPTIMIZATION) |
| 36 // TODO(gman): Replace with macros that work with inline optmization. | 36 // TODO(gman): Replace with macros that work with inline optmization. |
| 37 #define GPU_CLIENT_SINGLE_THREAD_CHECK() | 37 #define GPU_CLIENT_SINGLE_THREAD_CHECK() |
| 38 #define GPU_CLIENT_LOG(args) | |
| 39 #define GPU_CLIENT_LOG_CODE_BLOCK(code) | |
| 40 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) | 38 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) |
| 41 #else | 39 #else |
| 42 #include "base/logging.h" | 40 #include "base/logging.h" |
| 43 #define GPU_CLIENT_SINGLE_THREAD_CHECK() SingleThreadChecker checker(this); | 41 #define GPU_CLIENT_SINGLE_THREAD_CHECK() SingleThreadChecker checker(this); |
| 44 #define GPU_CLIENT_LOG(args) DLOG_IF(INFO, debug_) << args; | |
| 45 #define GPU_CLIENT_LOG_CODE_BLOCK(code) code | |
| 46 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) code | 42 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) code |
| 47 #define GPU_CLIENT_DEBUG | |
| 48 #endif | 43 #endif |
| 49 #else | 44 #else |
| 50 #define GPU_CLIENT_SINGLE_THREAD_CHECK() | 45 #define GPU_CLIENT_SINGLE_THREAD_CHECK() |
| 51 #define GPU_CLIENT_LOG(args) | |
| 52 #define GPU_CLIENT_LOG_CODE_BLOCK(code) | |
| 53 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) | 46 #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) |
| 54 #endif | 47 #endif |
| 55 | 48 |
| 56 #if defined(GPU_CLIENT_DEBUG) | 49 // Set to 1 to have the client fail when a GL error is generated. |
| 57 // Set to 1 to have the client fail when a GL error is generated. | 50 // This helps find bugs in the renderer since the debugger stops on the error. |
| 58 // This helps find bugs in the renderer since the debugger stops on the error. | 51 #if 0 |
| 59 # if 0 | 52 # define GL_CLIENT_FAIL_GL_ERRORS |
| 60 # define GL_CLIENT_FAIL_GL_ERRORS | |
| 61 # endif | |
| 62 #endif | 53 #endif |
| 63 | 54 |
| 64 // Check that destination pointers point to initialized memory. | 55 // Check that destination pointers point to initialized memory. |
| 65 // When the context is lost, calling GL function has no effect so if destination | 56 // When the context is lost, calling GL function has no effect so if destination |
| 66 // pointers point to initialized memory it can often lead to crash bugs. eg. | 57 // pointers point to initialized memory it can often lead to crash bugs. eg. |
| 67 // | 58 // |
| 68 // GLsizei len; | 59 // GLsizei len; |
| 69 // glGetShaderSource(shader, max_size, &len, buffer); | 60 // glGetShaderSource(shader, max_size, &len, buffer); |
| 70 // std::string src(buffer, buffer + len); // len can be uninitialized here!!! | 61 // std::string src(buffer, buffer + len); // len can be uninitialized here!!! |
| 71 // | 62 // |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 | 636 |
| 646 // Client side management for vertex array objects. Needed to correctly | 637 // Client side management for vertex array objects. Needed to correctly |
| 647 // track client side arrays. | 638 // track client side arrays. |
| 648 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 639 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
| 649 | 640 |
| 650 GLuint reserved_ids_[2]; | 641 GLuint reserved_ids_[2]; |
| 651 | 642 |
| 652 // Current GL error bits. | 643 // Current GL error bits. |
| 653 uint32 error_bits_; | 644 uint32 error_bits_; |
| 654 | 645 |
| 655 // Whether or not to print debugging info. | |
| 656 bool debug_; | |
| 657 | |
| 658 // Used to check for single threaded access. | 646 // Used to check for single threaded access. |
| 659 int use_count_; | 647 int use_count_; |
| 660 | 648 |
| 661 // Map of GLenum to Strings for glGetString. We need to cache these because | 649 // Map of GLenum to Strings for glGetString. We need to cache these because |
| 662 // the pointer passed back to the client has to remain valid for eternity. | 650 // the pointer passed back to the client has to remain valid for eternity. |
| 663 typedef std::map<uint32, std::set<std::string> > GLStringMap; | 651 typedef std::map<uint32, std::set<std::string> > GLStringMap; |
| 664 GLStringMap gl_strings_; | 652 GLStringMap gl_strings_; |
| 665 | 653 |
| 666 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't | 654 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't |
| 667 // have an enum for this so handle it separately. | 655 // have an enum for this so handle it separately. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 | 713 |
| 726 inline bool GLES2Implementation::GetTexParameterivHelper( | 714 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 727 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 715 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 728 return false; | 716 return false; |
| 729 } | 717 } |
| 730 | 718 |
| 731 } // namespace gles2 | 719 } // namespace gles2 |
| 732 } // namespace gpu | 720 } // namespace gpu |
| 733 | 721 |
| 734 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 722 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |