blob: 81ebf8c016f663661de47861c76fd608e7a3ad69 [file] [log] [blame]
Adlai Holler08f53112021-01-20 17:44:15 -05001/*
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"
Brian Osmana5842bc2021-05-11 13:41:46 -040012#include "include/core/SkSpan.h"
Adlai Holler08f53112021-01-20 17:44:15 -050013#include "src/core/SkTInternalLList.h"
14
15class 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.
26bool GrClusterRenderTasks(SkSpan<const sk_sp<GrRenderTask>> input,
27 SkTInternalLList<GrRenderTask>* llist);
28
29#endif