1 // Copyright 2021 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4 #ifndef SortTypes_DEFINED
5 #define SortTypes_DEFINED
7 #include "include/gpu/GrTypes.h"
14 // This is strictly used to check if we get the order of draw operations we expected. It is
15 // pretty much the same as painters order though.
18 explicit ID(int id) : fID(id) {
26 bool isValid() const { return fID != -1; }
28 bool operator==(ID other) const { return fID == other.fID; }
30 int toInt() const { return fID; }
38 // This class just serves to strictly differentiate between painter's order and the sort/draw Zs
41 PaintersOrder() : fPaintersOrder(0) {}
43 explicit PaintersOrder(uint32_t paintersOrder) : fPaintersOrder(paintersOrder) {
44 SkASSERT(paintersOrder != 0);
47 static PaintersOrder Invalid() {
48 return PaintersOrder();
51 bool isValid() const { return fPaintersOrder != 0; }
53 uint32_t toUInt() const { return fPaintersOrder; }
56 uint32_t fPaintersOrder = 0;