blob: 4fdab4ba2a469a117c48993cbc5a25c5df5a5d79 [file] [log] [blame]
[email protected]bac37fd32013-08-16 17:31:001// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
6#define GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
7
[email protected]baed42c2013-10-01 05:06:358#include <vector>
9
[email protected]fff7cb32013-10-02 07:07:3710#include "base/callback.h"
[email protected]baed42c2013-10-01 05:06:3511#include "gpu/command_buffer/common/mailbox.h"
[email protected]744e0792013-09-27 01:18:3512#include "gpu/command_buffer/common/types.h"
[email protected]bac37fd32013-08-16 17:31:0013#include "gpu/gpu_export.h"
14
15namespace gfx {
16class GpuMemoryBuffer;
17}
18
19namespace gpu {
[email protected]f44d5552013-10-29 04:56:2920struct ManagedMemoryStats;
[email protected]bac37fd32013-08-16 17:31:0021
22// Common interface for GpuControl implementations.
23class GPU_EXPORT GpuControl {
24 public:
25 GpuControl() {}
26 virtual ~GpuControl() {}
27
[email protected]744e0792013-09-27 01:18:3528 virtual bool SupportsGpuMemoryBuffer() = 0;
29
[email protected]bac37fd32013-08-16 17:31:0030 // Create a gpu memory buffer of the given dimensions and format. Returns
31 // its ID or -1 on error.
32 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
33 size_t width,
34 size_t height,
35 unsigned internalformat,
36 int32* id) = 0;
37
38 // Destroy a gpu memory buffer. The ID must be positive.
39 virtual void DestroyGpuMemoryBuffer(int32 id) = 0;
40
[email protected]baed42c2013-10-01 05:06:3541 // Generates n unique mailbox names that can be used with
42 // GL_texture_mailbox_CHROMIUM.
43 virtual bool GenerateMailboxNames(unsigned num,
44 std::vector<gpu::Mailbox>* names) = 0;
45
[email protected]fff7cb32013-10-02 07:07:3746 // Inserts a sync point, returning its ID. Sync point IDs are global and can
47 // be used for cross-context synchronization.
48 virtual uint32 InsertSyncPoint() = 0;
49
50 // Runs |callback| when a sync point is reached.
51 virtual void SignalSyncPoint(uint32 sync_point,
52 const base::Closure& callback) = 0;
53
[email protected]b88a48cc2013-10-05 05:10:1054 // Runs |callback| when a query created via glCreateQueryEXT() has cleared
55 // passed the glEndQueryEXT() point.
56 virtual void SignalQuery(uint32 query, const base::Closure& callback) = 0;
57
[email protected]f44d5552013-10-29 04:56:2958 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0;
59
[email protected]bac37fd32013-08-16 17:31:0060 private:
61 DISALLOW_COPY_AND_ASSIGN(GpuControl);
62};
63
64} // namespace gpu
65
66#endif // GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_