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