Chromium Code Reviews| 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" |
| 11 #include "ui/gfx/overlay_transform.h" | 11 #include "ui/gfx/overlay_transform.h" |
| 12 | 12 |
| 13 namespace base { | |
| 14 class SingleThreadTaskRunner; | |
| 15 } | |
| 16 | |
| 13 namespace gfx { | 17 namespace gfx { |
| 14 class Rect; | 18 class Rect; |
| 15 class RectF; | 19 class RectF; |
| 16 } | 20 } |
| 17 | 21 |
| 18 namespace gpu { | 22 namespace gpu { |
| 19 | 23 |
| 20 struct SyncToken; | 24 struct SyncToken; |
| 21 | 25 |
| 22 class ContextSupport { | 26 class ContextSupport { |
| 23 public: | 27 public: |
| 24 // Runs |callback| when a sync token is signalled. | 28 // Runs |callback| when a sync token is signalled. |
| 25 virtual void SignalSyncToken(const SyncToken& sync_token, | 29 virtual void SignalSyncToken(const SyncToken& sync_token, |
| 26 const base::Closure& callback) = 0; | 30 const base::Closure& callback) = 0; |
| 27 | 31 |
| 28 // Runs |callback| when a query created via glCreateQueryEXT() has cleared | 32 // Runs |callback| when a query created via glCreateQueryEXT() has cleared |
| 29 // passed the glEndQueryEXT() point. | 33 // passed the glEndQueryEXT() point. |
| 30 virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; | 34 virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; |
| 31 | 35 |
| 32 // Indicates whether the context should aggressively free allocated resources. | 36 // Indicates whether the context should aggressively free allocated resources. |
| 33 // If set to true, the context will purge all temporary resources when | 37 // If set to true, the context will purge all temporary resources when |
| 34 // flushed. | 38 // flushed. |
| 35 virtual void SetAggressivelyFreeResources( | 39 virtual void SetAggressivelyFreeResources( |
| 36 bool aggressively_free_resources) = 0; | 40 bool aggressively_free_resources) = 0; |
| 37 | 41 |
| 42 // Similar to temporarily calling SetAggressivelyFreeResources(true), this | |
|
danakj
2016/08/23 01:26:24
We now have 3 functions we can call to free things
| |
| 43 // causes a one-time purge of all temporary resources. | |
| 44 virtual void TrimResources() = 0; | |
| 45 | |
| 38 virtual void Swap() = 0; | 46 virtual void Swap() = 0; |
| 39 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; | 47 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; |
| 40 virtual void CommitOverlayPlanes() = 0; | 48 virtual void CommitOverlayPlanes() = 0; |
| 41 | 49 |
| 42 // Schedule a texture to be presented as an overlay synchronously with the | 50 // Schedule a texture to be presented as an overlay synchronously with the |
| 43 // primary surface during the next buffer swap or CommitOverlayPlanes. | 51 // primary surface during the next buffer swap or CommitOverlayPlanes. |
| 44 // This method is not stateful and needs to be re-scheduled every frame. | 52 // This method is not stateful and needs to be re-scheduled every frame. |
| 45 virtual void ScheduleOverlayPlane(int plane_z_order, | 53 virtual void ScheduleOverlayPlane(int plane_z_order, |
| 46 gfx::OverlayTransform plane_transform, | 54 gfx::OverlayTransform plane_transform, |
| 47 unsigned overlay_texture_id, | 55 unsigned overlay_texture_id, |
| 48 const gfx::Rect& display_bounds, | 56 const gfx::Rect& display_bounds, |
| 49 const gfx::RectF& uv_rect) = 0; | 57 const gfx::RectF& uv_rect) = 0; |
| 50 | 58 |
| 51 // Returns an ID that can be used to globally identify the share group that | 59 // Returns an ID that can be used to globally identify the share group that |
| 52 // this context's resources belong to. | 60 // this context's resources belong to. |
| 53 virtual uint64_t ShareGroupTracingGUID() const = 0; | 61 virtual uint64_t ShareGroupTracingGUID() const = 0; |
| 54 | 62 |
| 55 // Sets a callback to be run when an error occurs. | 63 // Sets a callback to be run when an error occurs. |
| 56 virtual void SetErrorMessageCallback( | 64 virtual void SetErrorMessageCallback( |
| 57 const base::Callback<void(const char*, int32_t)>& callback) = 0; | 65 const base::Callback<void(const char*, int32_t)>& callback) = 0; |
| 58 | 66 |
| 59 class ScopedVisibility {}; | 67 class ScopedVisibility {}; |
| 60 virtual std::unique_ptr<ScopedVisibility> ClientBecameVisible() = 0; | 68 virtual std::unique_ptr<ScopedVisibility> ClientBecameVisible() = 0; |
| 61 virtual void ClientBecameNotVisible( | 69 virtual void ClientBecameNotVisible( |
| 62 std::unique_ptr<ScopedVisibility> visibility) = 0; | 70 std::unique_ptr<ScopedVisibility> visibility) = 0; |
| 63 virtual bool AnyClientsVisible() const = 0; | 71 virtual bool AnyClientsVisible() const = 0; |
| 64 | 72 |
| 73 class ScopedBusy {}; | |
| 74 virtual std::unique_ptr<ScopedBusy> ClientBecameBusy() = 0; | |
| 75 virtual void ClientBecameNotBusy(std::unique_ptr<ScopedBusy> busy) = 0; | |
| 76 | |
| 77 // A callback which will be invoked when the context is considered idle. The | |
| 78 // callback will be invoked on the provided callback_task_runner. | |
| 79 virtual void SetIdleCallback( | |
| 80 const base::Closure& callback, | |
| 81 scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner) = 0; | |
| 82 | |
| 65 protected: | 83 protected: |
| 66 ContextSupport() {} | 84 ContextSupport() {} |
| 67 virtual ~ContextSupport() {} | 85 virtual ~ContextSupport() {} |
| 68 }; | 86 }; |
| 69 | 87 |
| 70 } | 88 } |
| 71 | 89 |
| 72 #endif // GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ | 90 #endif // GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ |
| OLD | NEW |