OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GPU_CONTROL_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
11 #include "gpu/command_buffer/common/capabilities.h" | 14 #include "gpu/command_buffer/common/capabilities.h" |
12 #include "gpu/command_buffer/common/mailbox.h" | 15 #include "gpu/command_buffer/common/mailbox.h" |
13 #include "gpu/command_buffer/common/types.h" | |
14 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
15 | 17 |
16 namespace gfx { | 18 namespace gfx { |
17 class GpuMemoryBuffer; | 19 class GpuMemoryBuffer; |
18 } | 20 } |
19 | 21 |
20 namespace gpu { | 22 namespace gpu { |
21 struct ManagedMemoryStats; | 23 struct ManagedMemoryStats; |
22 | 24 |
23 // Common interface for GpuControl implementations. | 25 // Common interface for GpuControl implementations. |
24 class GPU_EXPORT GpuControl { | 26 class GPU_EXPORT GpuControl { |
25 public: | 27 public: |
26 GpuControl() {} | 28 GpuControl() {} |
27 virtual ~GpuControl() {} | 29 virtual ~GpuControl() {} |
28 | 30 |
29 virtual Capabilities GetCapabilities() = 0; | 31 virtual Capabilities GetCapabilities() = 0; |
30 | 32 |
31 // Create a gpu memory buffer of the given dimensions and format. Returns | 33 // Create a gpu memory buffer of the given dimensions and format. Returns |
32 // its ID or -1 on error. | 34 // its ID or -1 on error. |
33 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( | 35 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( |
34 size_t width, | 36 size_t width, |
35 size_t height, | 37 size_t height, |
36 unsigned internalformat, | 38 unsigned internalformat, |
37 int32* id) = 0; | 39 int32_t* id) = 0; |
38 | 40 |
39 // Destroy a gpu memory buffer. The ID must be positive. | 41 // Destroy a gpu memory buffer. The ID must be positive. |
40 virtual void DestroyGpuMemoryBuffer(int32 id) = 0; | 42 virtual void DestroyGpuMemoryBuffer(int32_t id) = 0; |
41 | 43 |
42 // Inserts a sync point, returning its ID. Sync point IDs are global and can | 44 // Inserts a sync point, returning its ID. Sync point IDs are global and can |
43 // be used for cross-context synchronization. | 45 // be used for cross-context synchronization. |
44 virtual uint32 InsertSyncPoint() = 0; | 46 virtual uint32_t InsertSyncPoint() = 0; |
45 | 47 |
46 // Runs |callback| when a sync point is reached. | 48 // Runs |callback| when a sync point is reached. |
47 virtual void SignalSyncPoint(uint32 sync_point, | 49 virtual void SignalSyncPoint(uint32_t sync_point, |
48 const base::Closure& callback) = 0; | 50 const base::Closure& callback) = 0; |
49 | 51 |
50 // Runs |callback| when a query created via glCreateQueryEXT() has cleared | 52 // Runs |callback| when a query created via glCreateQueryEXT() has cleared |
51 // passed the glEndQueryEXT() point. | 53 // passed the glEndQueryEXT() point. |
52 virtual void SignalQuery(uint32 query, const base::Closure& callback) = 0; | 54 virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; |
53 | 55 |
54 virtual void SetSurfaceVisible(bool visible) = 0; | 56 virtual void SetSurfaceVisible(bool visible) = 0; |
55 | 57 |
56 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0; | 58 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0; |
57 | 59 |
58 // Invokes the callback once the context has been flushed. | 60 // Invokes the callback once the context has been flushed. |
59 virtual void Echo(const base::Closure& callback) = 0; | 61 virtual void Echo(const base::Closure& callback) = 0; |
60 | 62 |
61 // Attaches an external stream to the texture given by |texture_id| and | 63 // Attaches an external stream to the texture given by |texture_id| and |
62 // returns a stream identifier. | 64 // returns a stream identifier. |
63 virtual uint32 CreateStreamTexture(uint32 texture_id) = 0; | 65 virtual uint32_t CreateStreamTexture(uint32_t texture_id) = 0; |
64 | 66 |
65 private: | 67 private: |
66 DISALLOW_COPY_AND_ASSIGN(GpuControl); | 68 DISALLOW_COPY_AND_ASSIGN(GpuControl); |
67 }; | 69 }; |
68 | 70 |
69 } // namespace gpu | 71 } // namespace gpu |
70 | 72 |
71 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ | 73 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
OLD | NEW |