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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 class GpuControl; | 104 class GpuControl; |
105 class ScopedTransferBufferPtr; | 105 class ScopedTransferBufferPtr; |
106 class TransferBufferInterface; | 106 class TransferBufferInterface; |
107 | 107 |
108 namespace gles2 { | 108 namespace gles2 { |
109 | 109 |
110 class ImageFactory; | 110 class ImageFactory; |
111 class VertexArrayObjectManager; | 111 class VertexArrayObjectManager; |
112 | 112 |
| 113 class GLES2ImplementationErrorMessageCallback { |
| 114 public: |
| 115 virtual ~GLES2ImplementationErrorMessageCallback() { } |
| 116 virtual void OnErrorMessage(const char* msg, int id) = 0; |
| 117 }; |
| 118 |
113 // This class emulates GLES2 over command buffers. It can be used by a client | 119 // This class emulates GLES2 over command buffers. It can be used by a client |
114 // program so that the program does not need deal with shared memory and command | 120 // program so that the program does not need deal with shared memory and command |
115 // buffer management. See gl2_lib.h. Note that there is a performance gain to | 121 // buffer management. See gl2_lib.h. Note that there is a performance gain to |
116 // be had by changing your code to use command buffers directly by using the | 122 // be had by changing your code to use command buffers directly by using the |
117 // GLES2CmdHelper but that entails changing your code to use and deal with | 123 // GLES2CmdHelper but that entails changing your code to use and deal with |
118 // shared memory and synchronization issues. | 124 // shared memory and synchronization issues. |
119 class GLES2_IMPL_EXPORT GLES2Implementation | 125 class GLES2_IMPL_EXPORT GLES2Implementation |
120 : NON_EXPORTED_BASE(public GLES2Interface), | 126 : NON_EXPORTED_BASE(public GLES2Interface), |
121 NON_EXPORTED_BASE(public ContextSupport) { | 127 NON_EXPORTED_BASE(public ContextSupport) { |
122 public: | 128 public: |
123 enum MappedMemoryLimit { | 129 enum MappedMemoryLimit { |
124 kNoLimit = MappedMemoryManager::kNoLimit, | 130 kNoLimit = MappedMemoryManager::kNoLimit, |
125 }; | 131 }; |
126 class ErrorMessageCallback { | |
127 public: | |
128 virtual ~ErrorMessageCallback() { } | |
129 virtual void OnErrorMessage(const char* msg, int id) = 0; | |
130 }; | |
131 | 132 |
132 // Stores GL state that never changes. | 133 // Stores GL state that never changes. |
133 struct GLES2_IMPL_EXPORT GLStaticState { | 134 struct GLES2_IMPL_EXPORT GLStaticState { |
134 GLStaticState(); | 135 GLStaticState(); |
135 ~GLStaticState(); | 136 ~GLStaticState(); |
136 | 137 |
137 struct GLES2_IMPL_EXPORT IntState { | 138 struct GLES2_IMPL_EXPORT IntState { |
138 IntState(); | 139 IntState(); |
139 GLint max_combined_texture_image_units; | 140 GLint max_combined_texture_image_units; |
140 GLint max_cube_map_texture_size; | 141 GLint max_cube_map_texture_size; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 243 |
243 // ContextSupport implementation. | 244 // ContextSupport implementation. |
244 virtual void SignalSyncPoint(uint32 sync_point, | 245 virtual void SignalSyncPoint(uint32 sync_point, |
245 const base::Closure& callback) OVERRIDE; | 246 const base::Closure& callback) OVERRIDE; |
246 virtual void SignalQuery(uint32 query, | 247 virtual void SignalQuery(uint32 query, |
247 const base::Closure& callback) OVERRIDE; | 248 const base::Closure& callback) OVERRIDE; |
248 virtual void SetSurfaceVisible(bool visible) OVERRIDE; | 249 virtual void SetSurfaceVisible(bool visible) OVERRIDE; |
249 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) | 250 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) |
250 OVERRIDE; | 251 OVERRIDE; |
251 | 252 |
252 void SetErrorMessageCallback(ErrorMessageCallback* callback) { | 253 void SetErrorMessageCallback( |
| 254 GLES2ImplementationErrorMessageCallback* callback) { |
253 error_message_callback_ = callback; | 255 error_message_callback_ = callback; |
254 } | 256 } |
255 | 257 |
256 ShareGroup* share_group() const { | 258 ShareGroup* share_group() const { |
257 return share_group_.get(); | 259 return share_group_.get(); |
258 } | 260 } |
259 | 261 |
260 const Capabilities& capabilities() const { | 262 const Capabilities& capabilities() const { |
261 return capabilities_; | 263 return capabilities_; |
262 } | 264 } |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 ShareGroupContextData share_group_context_data_; | 764 ShareGroupContextData share_group_context_data_; |
763 | 765 |
764 scoped_ptr<QueryTracker> query_tracker_; | 766 scoped_ptr<QueryTracker> query_tracker_; |
765 typedef std::map<GLuint, QueryTracker::Query*> QueryMap; | 767 typedef std::map<GLuint, QueryTracker::Query*> QueryMap; |
766 QueryMap current_queries_; | 768 QueryMap current_queries_; |
767 | 769 |
768 scoped_ptr<BufferTracker> buffer_tracker_; | 770 scoped_ptr<BufferTracker> buffer_tracker_; |
769 | 771 |
770 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; | 772 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; |
771 | 773 |
772 ErrorMessageCallback* error_message_callback_; | 774 GLES2ImplementationErrorMessageCallback* error_message_callback_; |
773 | 775 |
774 scoped_ptr<std::string> current_trace_name_; | 776 scoped_ptr<std::string> current_trace_name_; |
775 | 777 |
776 GpuControl* gpu_control_; | 778 GpuControl* gpu_control_; |
777 | 779 |
778 Capabilities capabilities_; | 780 Capabilities capabilities_; |
779 | 781 |
780 base::Closure swap_buffers_complete_callback_; | 782 base::Closure swap_buffers_complete_callback_; |
781 | 783 |
782 base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_; | 784 base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 816 |
815 inline bool GLES2Implementation::GetTexParameterivHelper( | 817 inline bool GLES2Implementation::GetTexParameterivHelper( |
816 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 818 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
817 return false; | 819 return false; |
818 } | 820 } |
819 | 821 |
820 } // namespace gles2 | 822 } // namespace gles2 |
821 } // namespace gpu | 823 } // namespace gpu |
822 | 824 |
823 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 825 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |