Flutter Engine
The Flutter Engine
Functions
GrRenderTaskCluster.h File Reference
#include "include/core/SkRefCnt.h"
#include "include/core/SkSpan.h"
#include "src/base/SkTInternalLList.h"

Go to the source code of this file.

Functions

bool GrClusterRenderTasks (SkSpan< const sk_sp< GrRenderTask > > input, SkTInternalLList< GrRenderTask > *llist)
 

Function Documentation

◆ GrClusterRenderTasks()

bool GrClusterRenderTasks ( SkSpan< const sk_sp< GrRenderTask > >  input,
SkTInternalLList< GrRenderTask > *  llist 
)

Definition at line 159 of file GrRenderTaskCluster.cpp.

160 {
161 SkASSERT(llist->isEmpty());
162
163 if (input.size() < 3) {
164 for (const auto& t : input) {
165 llist->addToTail(t.get());
166 }
167 return false;
168 }
169
170 CLUSTER_DEBUGF("Cluster: Original order is %s\n", describe_tasks(input).c_str());
171
173 bool didReorder = false;
174 for (const auto& t : input) {
175 didReorder |= task_cluster_visit(t.get(), llist, &lastTaskMap);
176 llist->addToTail(t.get());
177 CLUSTER_DEBUGF("Cluster: Output order is now: %s\n", describe_tasks(*llist).c_str());
178 }
179
180#ifdef SK_DEBUG
181 if (didReorder) {
182 validate(input, *llist);
183 }
184#endif
185
186 return didReorder;
187}
#define CLUSTER_DEBUGF(...)
static bool task_cluster_visit(GrRenderTask *task, SkTInternalLList< GrRenderTask > *llist, THashMap< GrSurfaceProxy *, GrRenderTask * > *lastTaskMap)
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr size_t size() const
Definition: SkSpan_impl.h:95
void addToTail(T *entry)
bool isEmpty() const