Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::graphite::TaskList Class Reference

#include <TaskList.h>

Public Member Functions

 TaskList ()=default
 
void add (TaskList &&tasks)
 
void add (sk_sp< Task > task)
 
void reset ()
 
int size () const
 
bool hasTasks () const
 
Task::Status prepareResources (ResourceProvider *, const RuntimeEffectDictionary *)
 
Task::Status addCommands (Context *, CommandBuffer *, Task::ReplayTargetData)
 
template<typename Fn >
Status visitTasks (Fn fn)
 

Detailed Description

Definition at line 20 of file TaskList.h.

Constructor & Destructor Documentation

◆ TaskList()

skgpu::graphite::TaskList::TaskList ( )
default

Member Function Documentation

◆ add() [1/2]

void skgpu::graphite::TaskList::add ( sk_sp< Task task)
inline

Definition at line 25 of file TaskList.h.

25{ fTasks.emplace_back(std::move(task)); }

◆ add() [2/2]

void skgpu::graphite::TaskList::add ( TaskList &&  tasks)
inline

Definition at line 24 of file TaskList.h.

24{ fTasks.move_back(tasks.fTasks); }

◆ addCommands()

Status skgpu::graphite::TaskList::addCommands ( Context context,
CommandBuffer commandBuffer,
Task::ReplayTargetData  replayData 
)

Definition at line 44 of file TaskList.cpp.

46 {
47 TRACE_EVENT1("skia.gpu", TRACE_FUNC, "# tasks", fTasks.size());
48 return this->visitTasks([&](Task* task) {
49 return task->addCommands(context, commandBuffer, replayData);
50 });
51}
#define TRACE_FUNC
Definition DM.cpp:1161
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)

◆ hasTasks()

bool skgpu::graphite::TaskList::hasTasks ( ) const
inline

Definition at line 29 of file TaskList.h.

29{ return !fTasks.empty(); }

◆ prepareResources()

Status skgpu::graphite::TaskList::prepareResources ( ResourceProvider resourceProvider,
const RuntimeEffectDictionary runtimeDict 
)

Definition at line 36 of file TaskList.cpp.

37 {
38 TRACE_EVENT1("skia.gpu", TRACE_FUNC, "# tasks", fTasks.size());
39 return this->visitTasks([&](Task* task) {
40 return task->prepareResources(resourceProvider, runtimeDict);
41 });
42}

◆ reset()

void skgpu::graphite::TaskList::reset ( )
inline

Definition at line 26 of file TaskList.h.

26{ fTasks.clear(); }

◆ size()

int skgpu::graphite::TaskList::size ( ) const
inline

Definition at line 28 of file TaskList.h.

28{ return fTasks.size(); }

◆ visitTasks()

template<typename Fn >
Status skgpu::graphite::TaskList::visitTasks ( Fn  fn)

Definition at line 16 of file TaskList.cpp.

16 {
17 int discardCount = 0;
18 for (sk_sp<Task>& task: fTasks) {
19 if (!task) {
20 discardCount++;
21 continue; // Skip over discarded tasks
22 }
23
24 Status status = fn(task.get());
25 if (status == Status::kFail) {
26 return Status::kFail;
27 } else if (status == Status::kDiscard) {
28 task.reset();
29 discardCount++;
30 }
31 }
32
33 return discardCount == fTasks.size() ? Status::kDiscard : Status::kSuccess;
34}
Task::Status Status
Definition TaskList.cpp:13

The documentation for this class was generated from the following files: