| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 void CheckGLError() { } | 683 void CheckGLError() { } |
| 684 void FailGLError(GLenum /* error */) { } | 684 void FailGLError(GLenum /* error */) { } |
| 685 #endif | 685 #endif |
| 686 | 686 |
| 687 void RemoveMappedBufferRangeByTarget(GLenum target); | 687 void RemoveMappedBufferRangeByTarget(GLenum target); |
| 688 void RemoveMappedBufferRangeById(GLuint buffer); | 688 void RemoveMappedBufferRangeById(GLuint buffer); |
| 689 void ClearMappedBufferRangeMap(); | 689 void ClearMappedBufferRangeMap(); |
| 690 | 690 |
| 691 void DrawElementsImpl(GLenum mode, GLsizei count, GLenum type, | 691 void DrawElementsImpl(GLenum mode, GLsizei count, GLenum type, |
| 692 const void* indices, const char* func_name); | 692 const void* indices, const char* func_name); |
| 693 void UpdateCachedExtensionsIfNeeded(); |
| 694 void InvalidateCachedExtensions(); |
| 693 | 695 |
| 694 GLES2Util util_; | 696 GLES2Util util_; |
| 695 GLES2CmdHelper* helper_; | 697 GLES2CmdHelper* helper_; |
| 696 TransferBufferInterface* transfer_buffer_; | 698 TransferBufferInterface* transfer_buffer_; |
| 697 std::string last_error_; | 699 std::string last_error_; |
| 698 DebugMarkerManager debug_marker_manager_; | 700 DebugMarkerManager debug_marker_manager_; |
| 699 std::string this_in_hex_; | 701 std::string this_in_hex_; |
| 700 | 702 |
| 701 std::queue<int32_t> swap_buffers_tokens_; | 703 std::queue<int32_t> swap_buffers_tokens_; |
| 702 std::queue<int32_t> rate_limit_tokens_; | 704 std::queue<int32_t> rate_limit_tokens_; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 783 |
| 782 // Used to check for single threaded access. | 784 // Used to check for single threaded access. |
| 783 int use_count_; | 785 int use_count_; |
| 784 | 786 |
| 785 // Maximum amount of extra memory from the mapped memory pool to use when | 787 // Maximum amount of extra memory from the mapped memory pool to use when |
| 786 // needing to transfer something exceeding the default transfer buffer. | 788 // needing to transfer something exceeding the default transfer buffer. |
| 787 // This should be 0 for low memory devices since they are already memory | 789 // This should be 0 for low memory devices since they are already memory |
| 788 // constrained. | 790 // constrained. |
| 789 const uint32_t max_extra_transfer_buffer_size_; | 791 const uint32_t max_extra_transfer_buffer_size_; |
| 790 | 792 |
| 791 // Map of GLenum to Strings for glGetString. We need to cache these because | 793 // Set of strings returned from glGetString. We need to cache these because |
| 792 // the pointer passed back to the client has to remain valid for eternity. | 794 // the pointer passed back to the client has to remain valid for eternity. |
| 793 typedef std::map<uint32_t, std::set<std::string>> GLStringMap; | 795 std::set<std::string> gl_strings_; |
| 794 GLStringMap gl_strings_; | |
| 795 | |
| 796 // Similar cache for glGetRequestableExtensionsCHROMIUM. We don't | |
| 797 // have an enum for this so handle it separately. | |
| 798 std::set<std::string> requestable_extensions_set_; | |
| 799 | 796 |
| 800 typedef std::map<const void*, MappedBuffer> MappedBufferMap; | 797 typedef std::map<const void*, MappedBuffer> MappedBufferMap; |
| 801 MappedBufferMap mapped_buffers_; | 798 MappedBufferMap mapped_buffers_; |
| 802 | 799 |
| 803 // TODO(zmo): Consolidate |mapped_buffers_| and |mapped_buffer_range_map_|. | 800 // TODO(zmo): Consolidate |mapped_buffers_| and |mapped_buffer_range_map_|. |
| 804 typedef base::hash_map<GLuint, MappedBuffer> MappedBufferRangeMap; | 801 typedef base::hash_map<GLuint, MappedBuffer> MappedBufferRangeMap; |
| 805 MappedBufferRangeMap mapped_buffer_range_map_; | 802 MappedBufferRangeMap mapped_buffer_range_map_; |
| 806 | 803 |
| 807 typedef std::map<const void*, MappedTexture> MappedTextureMap; | 804 typedef std::map<const void*, MappedTexture> MappedTextureMap; |
| 808 MappedTextureMap mapped_textures_; | 805 MappedTextureMap mapped_textures_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 822 int current_trace_stack_; | 819 int current_trace_stack_; |
| 823 | 820 |
| 824 GpuControl* gpu_control_; | 821 GpuControl* gpu_control_; |
| 825 | 822 |
| 826 Capabilities capabilities_; | 823 Capabilities capabilities_; |
| 827 | 824 |
| 828 // Flag to indicate whether the implementation can retain resources, or | 825 // Flag to indicate whether the implementation can retain resources, or |
| 829 // whether it should aggressively free them. | 826 // whether it should aggressively free them. |
| 830 bool aggressively_free_resources_; | 827 bool aggressively_free_resources_; |
| 831 | 828 |
| 829 // Result of last GetString(GL_EXTENSIONS), used to keep |
| 830 // GetString(GL_EXTENSIONS), GetStringi(GL_EXTENSIONS, index) and |
| 831 // GetIntegerv(GL_NUM_EXTENSIONS) in sync. This points to gl_strings, valid |
| 832 // forever. |
| 833 const char* cached_extension_string_; |
| 834 |
| 835 // Populated if cached_extension_string_ != nullptr. These point to |
| 836 // gl_strings, valid forever. |
| 837 std::vector<const char*> cached_extensions_; |
| 838 |
| 832 base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_; | 839 base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_; |
| 833 | 840 |
| 834 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 841 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 835 }; | 842 }; |
| 836 | 843 |
| 837 inline bool GLES2Implementation::GetBufferParameteri64vHelper( | 844 inline bool GLES2Implementation::GetBufferParameteri64vHelper( |
| 838 GLenum /* target */, GLenum /* pname */, GLint64* /* params */) { | 845 GLenum /* target */, GLenum /* pname */, GLint64* /* params */) { |
| 839 return false; | 846 return false; |
| 840 } | 847 } |
| 841 | 848 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 869 | 876 |
| 870 inline bool GLES2Implementation::GetTexParameterivHelper( | 877 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 871 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 878 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 872 return false; | 879 return false; |
| 873 } | 880 } |
| 874 | 881 |
| 875 } // namespace gles2 | 882 } // namespace gles2 |
| 876 } // namespace gpu | 883 } // namespace gpu |
| 877 | 884 |
| 878 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 885 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |