Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Task.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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 skgpu_graphite_task_Task_DEFINED
9#define skgpu_graphite_task_Task_DEFINED
10
13
14namespace skgpu::graphite {
15
16class CommandBuffer;
17class Context;
19class RuntimeEffectDictionary;
20class Texture;
21
22class Task : public SkRefCnt {
23public:
24 // Holds a render target and translation to use in the task's work, if necessary.
29
30 enum class Status {
31 // The task step (prepareResources or addCommands) succeeded, proceed to the next task.
32 // If the Recording is replayed, this task should be executed again.
34 // The task step succeeded, but it was a one-time-only operation and should be removed from
35 // the task list. If this is returned from prepareResources(), the task is removed before
36 // addCommands() will ever be called. If this is returned from addCommands(), it will not
37 // be part of any replayed Recording, but any added commands from the first call will be
38 // executed once.
39 //
40 // NOTE: If a task step needs to be conditionally processed but repeatable, it should
41 // internally skip work and still return kSuccess instead of kDiscard.
43 // The step failed and cannot be recovered so the Recording is invalidated.
44 kFail
45 };
46
47 // Instantiate and prepare any Resources that must happen while the Task is still on the
48 // Recorder.
50
51 // Returns true on success; false on failure.
53};
54
55} // namespace skgpu::graphite
56
57#endif // skgpu_graphite_task_Task_DEFINED
virtual Status addCommands(Context *, CommandBuffer *, ReplayTargetData)=0
virtual Status prepareResources(ResourceProvider *, const RuntimeEffectDictionary *)=0