• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrBufferTransferRenderTask_DEFINED
9 #define GrBufferTransferRenderTask_DEFINED
10 
11 #include "src/gpu/ganesh/GrRenderTask.h"
12 
13 class GrGpuBuffer;
14 
15 class GrBufferTransferRenderTask final : public GrRenderTask {
16 public:
17     static sk_sp<GrRenderTask> Make(sk_sp<GrGpuBuffer> src,
18                                     size_t srcOffset,
19                                     sk_sp<GrGpuBuffer> dst,
20                                     size_t dstOffset,
21                                     size_t size);
22 
23     ~GrBufferTransferRenderTask() override;
24 
25 private:
26     GrBufferTransferRenderTask(sk_sp<GrGpuBuffer> src,
27                                size_t srcOffset,
28                                sk_sp<GrGpuBuffer> dst,
29                                size_t dstOffset,
30                                size_t size);
31 
onIsUsed(GrSurfaceProxy * proxy)32     bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; }
gatherProxyIntervals(GrResourceAllocator *)33     void gatherProxyIntervals(GrResourceAllocator*) const override {} // no proxies
onMakeClosed(GrRecordingContext *,SkIRect * targetUpdateBounds)34     ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override {
35         return ExpectedOutcome::kTargetUnchanged;  // no target
36     }
37     bool onExecute(GrOpFlushState*) override;
38 
39 #if GR_TEST_UTILS
name()40     const char* name() const final { return "BufferTransfer"; }
41 #endif
42 #ifdef SK_DEBUG
visitProxies_debugOnly(const GrVisitProxyFunc &)43     void visitProxies_debugOnly(const GrVisitProxyFunc&) const override {}
44 #endif
45 
46     sk_sp<GrGpuBuffer> fSrc;
47     sk_sp<GrGpuBuffer> fDst;
48 
49     size_t fSrcOffset;
50     size_t fDstOffset;
51     size_t fSize;
52 };
53 
54 #endif
55