| 1 |
/* |
| 2 |
* Copyright 2021 Google Inc. |
| 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 GrRenderTaskCluster_DEFINED |
| 9 |
#define GrRenderTaskCluster_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkRefCnt.h" // IWYU pragma: keep |
| 12 |
#include "include/core/SkSpan.h" |
| 13 |
#include "src/base/SkTInternalLList.h" // IWYU pragma: keep |
| 14 |
|
| 15 |
class GrRenderTask; |
| 16 |
|
| 17 |
// Take a topologically-sorted DAG and cluster the tasks together while maintaining the |
| 18 |
// dependencies. |
| 19 |
// |
| 20 |
// If no clustering is possible the llist is populated with the nodes in the original order and |
| 21 |
// false is returned. |
| 22 |
// Otherwise, returns true and populates the provided llist as such: |
| 23 |
// - Contains the same set of tasks as `input`. |
| 24 |
// - Obeys the dependency rules in `input`. |
| 25 |
// - Places tasks with the same target adjacent to each other. |
| 26 |
// - Tasks with multiple targets act as reordering barriers for all their targets. |
| 27 |
bool GrClusterRenderTasks(SkSpan<const sk_sp<GrRenderTask>> input, |
| 28 |
SkTInternalLList<GrRenderTask>* llist); |
| 29 |
|
| 30 |
#endif |