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" 12 #include "include/core/SkSpan.h" 13 #include "src/core/SkTInternalLList.h" 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, returns false. 21 // Otherwise, returns true and populates the provided llist as such: 22 // - Contains the same set of tasks as `input`. 23 // - Obeys the dependency rules in `input`. 24 // - Places tasks with the same target adjacent to each other. 25 // - Tasks with multiple targets act as reordering barriers for all their targets. 26 bool GrClusterRenderTasks(SkSpan<const sk_sp<GrRenderTask>> input, 27 SkTInternalLList<GrRenderTask>* llist); 28 29 #endif 30