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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "gpu/command_buffer/common/capabilities.h" | 14 #include "gpu/command_buffer/common/capabilities.h" |
15 #include "gpu/command_buffer/common/mailbox.h" | 15 #include "gpu/command_buffer/common/mailbox.h" |
16 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
17 | 17 |
| 18 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
| 19 |
18 namespace gfx { | 20 namespace gfx { |
19 class GpuMemoryBuffer; | 21 class GpuMemoryBuffer; |
20 } | 22 } |
21 | 23 |
22 namespace gpu { | 24 namespace gpu { |
23 | 25 |
24 // Common interface for GpuControl implementations. | 26 // Common interface for GpuControl implementations. |
25 class GPU_EXPORT GpuControl { | 27 class GPU_EXPORT GpuControl { |
26 public: | 28 public: |
27 GpuControl() {} | 29 GpuControl() {} |
28 virtual ~GpuControl() {} | 30 virtual ~GpuControl() {} |
29 | 31 |
30 virtual Capabilities GetCapabilities() = 0; | 32 virtual Capabilities GetCapabilities() = 0; |
31 | 33 |
32 // Create a gpu memory buffer of the given dimensions and format. Returns | 34 // Create an image for a client buffer with the given dimensions and |
33 // its ID or -1 on error. | 35 // format. Returns its ID or -1 on error. |
34 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( | 36 virtual int32_t CreateImage(ClientBuffer buffer, |
35 size_t width, | 37 size_t width, |
36 size_t height, | 38 size_t height, |
37 unsigned internalformat, | 39 unsigned internalformat) = 0; |
38 unsigned usage, | |
39 int32_t* id) = 0; | |
40 | 40 |
41 // Destroy a gpu memory buffer. The ID must be positive. | 41 // Destroy an image. The ID must be positive. |
42 virtual void DestroyGpuMemoryBuffer(int32_t id) = 0; | 42 virtual void DestroyImage(int32_t id) = 0; |
| 43 |
| 44 // Create a gpu memory buffer backed image with the given dimensions and |
| 45 // format for |usage|. Returns its ID or -1 on error. |
| 46 virtual int32_t CreateGpuMemoryBufferImage(size_t width, |
| 47 size_t height, |
| 48 unsigned internalformat, |
| 49 unsigned usage) = 0; |
43 | 50 |
44 // Inserts a sync point, returning its ID. Sync point IDs are global and can | 51 // Inserts a sync point, returning its ID. Sync point IDs are global and can |
45 // be used for cross-context synchronization. | 52 // be used for cross-context synchronization. |
46 virtual uint32_t InsertSyncPoint() = 0; | 53 virtual uint32_t InsertSyncPoint() = 0; |
47 | 54 |
48 // Inserts a future sync point, returning its ID. Sync point IDs are global | 55 // Inserts a future sync point, returning its ID. Sync point IDs are global |
49 // and can be used for cross-context synchronization. The sync point won't be | 56 // and can be used for cross-context synchronization. The sync point won't be |
50 // retired immediately. | 57 // retired immediately. |
51 virtual uint32_t InsertFutureSyncPoint() = 0; | 58 virtual uint32_t InsertFutureSyncPoint() = 0; |
52 | 59 |
(...skipping 15 matching lines...) Expand all Loading... |
68 // returns a stream identifier. | 75 // returns a stream identifier. |
69 virtual uint32_t CreateStreamTexture(uint32_t texture_id) = 0; | 76 virtual uint32_t CreateStreamTexture(uint32_t texture_id) = 0; |
70 | 77 |
71 private: | 78 private: |
72 DISALLOW_COPY_AND_ASSIGN(GpuControl); | 79 DISALLOW_COPY_AND_ASSIGN(GpuControl); |
73 }; | 80 }; |
74 | 81 |
75 } // namespace gpu | 82 } // namespace gpu |
76 | 83 |
77 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ | 84 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ |
OLD | NEW |