aboutsummaryrefslogtreecommitdiff
path: root/src/gpu/graphite/GpuWorkSubmission.h
blob: 263a20f7777d472e61009aadcb1401b1a1c2680c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright 2021 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef skgpu_graphite_GpuWorkSubmission_DEFINED
#define skgpu_graphite_GpuWorkSubmission_DEFINED

#include "include/core/SkRefCnt.h"

#include <memory>

namespace skgpu::graphite {
class CommandBuffer;
class SharedContext;
class QueueManager;

class GpuWorkSubmission {
public:
    virtual ~GpuWorkSubmission();

    bool isFinished();
    void waitUntilFinished();

protected:
    CommandBuffer* commandBuffer() { return fCommandBuffer.get(); }

    GpuWorkSubmission(std::unique_ptr<CommandBuffer> cmdBuffer, QueueManager* queueManager);

private:
    virtual bool onIsFinished() = 0;
    virtual void onWaitUntilFinished() = 0;

    std::unique_ptr<CommandBuffer> fCommandBuffer;
    sk_sp<SkRefCnt> fOutstandingAsyncMapCounter;
    QueueManager* fQueueManager;
};

} // namespace skgpu::graphite

#endif // skgpu_graphite_GpuWorkSubmission_DEFINED