| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CONTEXT_SUPPORT_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ContextSupport { | 22 class ContextSupport { |
| 23 public: | 23 public: |
| 24 // Runs |callback| when a sync token is signalled. | 24 // Runs |callback| when a sync token is signalled. |
| 25 virtual void SignalSyncToken(const SyncToken& sync_token, | 25 virtual void SignalSyncToken(const SyncToken& sync_token, |
| 26 const base::Closure& callback) = 0; | 26 const base::Closure& callback) = 0; |
| 27 | 27 |
| 28 // Runs |callback| when a query created via glCreateQueryEXT() has cleared | 28 // Runs |callback| when a query created via glCreateQueryEXT() has cleared |
| 29 // passed the glEndQueryEXT() point. | 29 // passed the glEndQueryEXT() point. |
| 30 virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; | 30 virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; |
| 31 | 31 |
| 32 // Indicates whether the context should aggressively free allocated resources. | 32 // Causes ContextSupport to trim allocated resources, reducing memory usage. |
| 33 // If set to true, the context will purge all temporary resources when | 33 virtual void TrimResources() = 0; |
| 34 // flushed. | |
| 35 virtual void SetAggressivelyFreeResources( | |
| 36 bool aggressively_free_resources) = 0; | |
| 37 | 34 |
| 38 virtual void Swap() = 0; | 35 virtual void Swap() = 0; |
| 39 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; | 36 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; |
| 40 virtual void CommitOverlayPlanes() = 0; | 37 virtual void CommitOverlayPlanes() = 0; |
| 41 | 38 |
| 42 // Schedule a texture to be presented as an overlay synchronously with the | 39 // Schedule a texture to be presented as an overlay synchronously with the |
| 43 // primary surface during the next buffer swap or CommitOverlayPlanes. | 40 // primary surface during the next buffer swap or CommitOverlayPlanes. |
| 44 // This method is not stateful and needs to be re-scheduled every frame. | 41 // This method is not stateful and needs to be re-scheduled every frame. |
| 45 virtual void ScheduleOverlayPlane(int plane_z_order, | 42 virtual void ScheduleOverlayPlane(int plane_z_order, |
| 46 gfx::OverlayTransform plane_transform, | 43 gfx::OverlayTransform plane_transform, |
| 47 unsigned overlay_texture_id, | 44 unsigned overlay_texture_id, |
| 48 const gfx::Rect& display_bounds, | 45 const gfx::Rect& display_bounds, |
| 49 const gfx::RectF& uv_rect) = 0; | 46 const gfx::RectF& uv_rect) = 0; |
| 50 | 47 |
| 51 // Returns an ID that can be used to globally identify the share group that | 48 // Returns an ID that can be used to globally identify the share group that |
| 52 // this context's resources belong to. | 49 // this context's resources belong to. |
| 53 virtual uint64_t ShareGroupTracingGUID() const = 0; | 50 virtual uint64_t ShareGroupTracingGUID() const = 0; |
| 54 | 51 |
| 55 // Sets a callback to be run when an error occurs. | 52 // Sets a callback to be run when an error occurs. |
| 56 virtual void SetErrorMessageCallback( | 53 virtual void SetErrorMessageCallback( |
| 57 const base::Callback<void(const char*, int32_t)>& callback) = 0; | 54 const base::Callback<void(const char*, int32_t)>& callback) = 0; |
| 58 | 55 |
| 59 // Called when a client of the context has changed visibility. | 56 class ScopedVisibility {}; |
| 60 virtual void SetClientVisible(int client_id, bool is_visible) = 0; | 57 virtual std::unique_ptr<ScopedVisibility> ClientBecameVisible() = 0; |
| 58 virtual void ClientBecameNotVisible( |
| 59 std::unique_ptr<ScopedVisibility> visibility) = 0; |
| 61 virtual bool AnyClientsVisible() const = 0; | 60 virtual bool AnyClientsVisible() const = 0; |
| 62 | 61 |
| 63 protected: | 62 protected: |
| 64 ContextSupport() {} | 63 ContextSupport() {} |
| 65 virtual ~ContextSupport() {} | 64 virtual ~ContextSupport() {} |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 } | 67 } |
| 69 | 68 |
| 70 #endif // GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ | 69 #endif // GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ |
| OLD | NEW |