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 <stdint.h> |
| 11 |
10 #include <string> | 12 #include <string> |
11 #include <vector> | 13 #include <vector> |
12 | 14 |
13 #include "base/basictypes.h" | |
14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "gpu/command_buffer/common/capabilities.h" | 21 #include "gpu/command_buffer/common/capabilities.h" |
21 #include "gpu/command_buffer/common/constants.h" | 22 #include "gpu/command_buffer/common/constants.h" |
22 #include "gpu/command_buffer/service/common_decoder.h" | 23 #include "gpu/command_buffer/service/common_decoder.h" |
23 #include "gpu/gpu_export.h" | 24 #include "gpu/gpu_export.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 58 |
58 typedef base::Callback<void(const std::string& key, | 59 typedef base::Callback<void(const std::string& key, |
59 const std::string& shader)> ShaderCacheCallback; | 60 const std::string& shader)> ShaderCacheCallback; |
60 | 61 |
61 // This class implements the AsyncAPIInterface interface, decoding GLES2 | 62 // This class implements the AsyncAPIInterface interface, decoding GLES2 |
62 // commands and calling GL. | 63 // commands and calling GL. |
63 class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, | 64 class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, |
64 public CommonDecoder { | 65 public CommonDecoder { |
65 public: | 66 public: |
66 typedef error::Error Error; | 67 typedef error::Error Error; |
67 typedef base::Callback<bool(uint32 id)> WaitSyncPointCallback; | 68 typedef base::Callback<bool(uint32_t id)> WaitSyncPointCallback; |
68 typedef base::Callback<void(uint64_t release)> FenceSyncReleaseCallback; | 69 typedef base::Callback<void(uint64_t release)> FenceSyncReleaseCallback; |
69 typedef base::Callback<bool(gpu::CommandBufferNamespace namespace_id, | 70 typedef base::Callback<bool(gpu::CommandBufferNamespace namespace_id, |
70 uint64_t command_buffer_id, | 71 uint64_t command_buffer_id, |
71 uint64_t release)> WaitFenceSyncCallback; | 72 uint64_t release)> WaitFenceSyncCallback; |
72 | 73 |
73 // The default stencil mask, which has all bits set. This really should be a | 74 // The default stencil mask, which has all bits set. This really should be a |
74 // GLuint, but we can't #include gl_bindings.h in this file without causing | 75 // GLuint, but we can't #include gl_bindings.h in this file without causing |
75 // macro redefinitions. | 76 // macro redefinitions. |
76 static const unsigned int kDefaultStencilMask; | 77 static const unsigned int kDefaultStencilMask; |
77 | 78 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // bound, offscreen contexts render to an internal buffer, onscreen ones | 125 // bound, offscreen contexts render to an internal buffer, onscreen ones |
125 // to the surface. | 126 // to the surface. |
126 // offscreen_size: the size if the GL context is offscreen. | 127 // offscreen_size: the size if the GL context is offscreen. |
127 // Returns: | 128 // Returns: |
128 // true if successful. | 129 // true if successful. |
129 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 130 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
130 const scoped_refptr<gfx::GLContext>& context, | 131 const scoped_refptr<gfx::GLContext>& context, |
131 bool offscreen, | 132 bool offscreen, |
132 const gfx::Size& offscreen_size, | 133 const gfx::Size& offscreen_size, |
133 const DisallowedFeatures& disallowed_features, | 134 const DisallowedFeatures& disallowed_features, |
134 const std::vector<int32>& attribs) = 0; | 135 const std::vector<int32_t>& attribs) = 0; |
135 | 136 |
136 // Destroys the graphics context. | 137 // Destroys the graphics context. |
137 virtual void Destroy(bool have_context) = 0; | 138 virtual void Destroy(bool have_context) = 0; |
138 | 139 |
139 // Set the surface associated with the default FBO. | 140 // Set the surface associated with the default FBO. |
140 virtual void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) = 0; | 141 virtual void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) = 0; |
141 | 142 |
142 virtual void ProduceFrontBuffer(const Mailbox& mailbox) = 0; | 143 virtual void ProduceFrontBuffer(const Mailbox& mailbox) = 0; |
143 | 144 |
144 // Resize an offscreen frame buffer. | 145 // Resize an offscreen frame buffer. |
(...skipping 27 matching lines...) Expand all Loading... |
172 virtual void RestoreGlobalState() const = 0; | 173 virtual void RestoreGlobalState() const = 0; |
173 virtual void RestoreProgramBindings() const = 0; | 174 virtual void RestoreProgramBindings() const = 0; |
174 virtual void RestoreTextureState(unsigned service_id) const = 0; | 175 virtual void RestoreTextureState(unsigned service_id) const = 0; |
175 virtual void RestoreTextureUnitBindings(unsigned unit) const = 0; | 176 virtual void RestoreTextureUnitBindings(unsigned unit) const = 0; |
176 | 177 |
177 virtual void ClearAllAttributes() const = 0; | 178 virtual void ClearAllAttributes() const = 0; |
178 virtual void RestoreAllAttributes() const = 0; | 179 virtual void RestoreAllAttributes() const = 0; |
179 | 180 |
180 virtual void SetIgnoreCachedStateForTest(bool ignore) = 0; | 181 virtual void SetIgnoreCachedStateForTest(bool ignore) = 0; |
181 virtual void SetForceShaderNameHashingForTest(bool force) = 0; | 182 virtual void SetForceShaderNameHashingForTest(bool force) = 0; |
182 virtual uint32 GetAndClearBackbufferClearBitsForTest(); | 183 virtual uint32_t GetAndClearBackbufferClearBitsForTest(); |
183 | 184 |
184 // Gets the QueryManager for this context. | 185 // Gets the QueryManager for this context. |
185 virtual QueryManager* GetQueryManager() = 0; | 186 virtual QueryManager* GetQueryManager() = 0; |
186 | 187 |
187 // Gets the VertexArrayManager for this context. | 188 // Gets the VertexArrayManager for this context. |
188 virtual VertexArrayManager* GetVertexArrayManager() = 0; | 189 virtual VertexArrayManager* GetVertexArrayManager() = 0; |
189 | 190 |
190 // Gets the ImageManager for this context. | 191 // Gets the ImageManager for this context. |
191 virtual ImageManager* GetImageManager() = 0; | 192 virtual ImageManager* GetImageManager() = 0; |
192 | 193 |
193 // Gets the ValuebufferManager for this context. | 194 // Gets the ValuebufferManager for this context. |
194 virtual ValuebufferManager* GetValuebufferManager() = 0; | 195 virtual ValuebufferManager* GetValuebufferManager() = 0; |
195 | 196 |
196 // Returns false if there are no pending queries. | 197 // Returns false if there are no pending queries. |
197 virtual bool HasPendingQueries() const = 0; | 198 virtual bool HasPendingQueries() const = 0; |
198 | 199 |
199 // Process any pending queries. | 200 // Process any pending queries. |
200 virtual void ProcessPendingQueries(bool did_finish) = 0; | 201 virtual void ProcessPendingQueries(bool did_finish) = 0; |
201 | 202 |
202 // Returns false if there is no idle work to be made. | 203 // Returns false if there is no idle work to be made. |
203 virtual bool HasMoreIdleWork() const = 0; | 204 virtual bool HasMoreIdleWork() const = 0; |
204 | 205 |
205 // Perform any idle work that needs to be made. | 206 // Perform any idle work that needs to be made. |
206 virtual void PerformIdleWork() = 0; | 207 virtual void PerformIdleWork() = 0; |
207 | 208 |
208 // Get the service texture ID corresponding to a client texture ID. | 209 // Get the service texture ID corresponding to a client texture ID. |
209 // If no such record is found then return false. | 210 // If no such record is found then return false. |
210 virtual bool GetServiceTextureId(uint32 client_texture_id, | 211 virtual bool GetServiceTextureId(uint32_t client_texture_id, |
211 uint32* service_texture_id); | 212 uint32_t* service_texture_id); |
212 | 213 |
213 // Provides detail about a lost context if one occurred. | 214 // Provides detail about a lost context if one occurred. |
214 virtual error::ContextLostReason GetContextLostReason() = 0; | 215 virtual error::ContextLostReason GetContextLostReason() = 0; |
215 | 216 |
216 // Clears a level sub area of a texture | 217 // Clears a level sub area of a texture |
217 // Returns false if a GL error should be generated. | 218 // Returns false if a GL error should be generated. |
218 virtual bool ClearLevel(Texture* texture, | 219 virtual bool ClearLevel(Texture* texture, |
219 unsigned target, | 220 unsigned target, |
220 int level, | 221 int level, |
221 unsigned format, | 222 unsigned format, |
(...skipping 14 matching lines...) Expand all Loading... |
236 const WaitSyncPointCallback& callback) = 0; | 237 const WaitSyncPointCallback& callback) = 0; |
237 | 238 |
238 // Sets the callback for fence sync release and wait calls. The wait call | 239 // Sets the callback for fence sync release and wait calls. The wait call |
239 // returns true if the channel is still scheduled. | 240 // returns true if the channel is still scheduled. |
240 virtual void SetFenceSyncReleaseCallback( | 241 virtual void SetFenceSyncReleaseCallback( |
241 const FenceSyncReleaseCallback& callback) = 0; | 242 const FenceSyncReleaseCallback& callback) = 0; |
242 virtual void SetWaitFenceSyncCallback( | 243 virtual void SetWaitFenceSyncCallback( |
243 const WaitFenceSyncCallback& callback) = 0; | 244 const WaitFenceSyncCallback& callback) = 0; |
244 | 245 |
245 virtual void WaitForReadPixels(base::Closure callback) = 0; | 246 virtual void WaitForReadPixels(base::Closure callback) = 0; |
246 virtual uint32 GetTextureUploadCount() = 0; | 247 virtual uint32_t GetTextureUploadCount() = 0; |
247 virtual base::TimeDelta GetTotalTextureUploadTime() = 0; | 248 virtual base::TimeDelta GetTotalTextureUploadTime() = 0; |
248 virtual base::TimeDelta GetTotalProcessingCommandsTime() = 0; | 249 virtual base::TimeDelta GetTotalProcessingCommandsTime() = 0; |
249 virtual void AddProcessingCommandsTime(base::TimeDelta) = 0; | 250 virtual void AddProcessingCommandsTime(base::TimeDelta) = 0; |
250 | 251 |
251 // Returns true if the context was lost either by GL_ARB_robustness, forced | 252 // Returns true if the context was lost either by GL_ARB_robustness, forced |
252 // context loss or command buffer parse error. | 253 // context loss or command buffer parse error. |
253 virtual bool WasContextLost() const = 0; | 254 virtual bool WasContextLost() const = 0; |
254 | 255 |
255 // Returns true if the context was lost specifically by GL_ARB_robustness. | 256 // Returns true if the context was lost specifically by GL_ARB_robustness. |
256 virtual bool WasContextLostByRobustnessExtension() const = 0; | 257 virtual bool WasContextLostByRobustnessExtension() const = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
274 bool log_commands_; | 275 bool log_commands_; |
275 bool unsafe_es3_apis_enabled_; | 276 bool unsafe_es3_apis_enabled_; |
276 bool force_shader_name_hashing_for_test_; | 277 bool force_shader_name_hashing_for_test_; |
277 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); | 278 DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); |
278 }; | 279 }; |
279 | 280 |
280 } // namespace gles2 | 281 } // namespace gles2 |
281 } // namespace gpu | 282 } // namespace gpu |
282 | 283 |
283 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ | 284 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ |
OLD | NEW |