| Index: src/gpu/instanced/InstancedRenderingTypes.h
|
| diff --git a/src/gpu/instanced/InstancedRenderingTypes.h b/src/gpu/instanced/InstancedRenderingTypes.h
|
| index ff9471c428488ab7d406daa2bf3ab1e54ec80814..5dca43581b339524b9bb249af7de3f8bf0f898aa 100644
|
| --- a/src/gpu/instanced/InstancedRenderingTypes.h
|
| +++ b/src/gpu/instanced/InstancedRenderingTypes.h
|
| @@ -124,31 +124,14 @@ GR_STATIC_ASSERT(4 * 4 == sizeof(ParamsTexel));
|
| */
|
| struct BatchInfo {
|
| BatchInfo() : fData(0) {}
|
| + explicit BatchInfo(uint32_t data) : fData(data) {}
|
| +
|
| + static bool CanCombine(const BatchInfo& a, const BatchInfo& b);
|
|
|
| bool isSimpleRects() const {
|
| return !((fShapeTypes & ~kRect_ShapeFlag) | fInnerShapeTypes);
|
| }
|
|
|
| - bool canJoin(BatchInfo that) const {
|
| - if (fAntialiasMode != that.fAntialiasMode) {
|
| - return false;
|
| - }
|
| - if (SkToBool(fInnerShapeTypes) != SkToBool(that.fInnerShapeTypes)) {
|
| - // GrInstanceProcessor can't currently combine draws with and without inner shapes.
|
| - return false;
|
| - }
|
| - if (fCannotDiscard != that.fCannotDiscard) {
|
| - // For stencil draws, the use of discard can be a requirement.
|
| - return false;
|
| - }
|
| - return true;
|
| - }
|
| -
|
| - void join(BatchInfo that) {
|
| - SkASSERT(this->canJoin(that));
|
| - fData |= that.fData;
|
| - }
|
| -
|
| union {
|
| struct {
|
| AntialiasMode fAntialiasMode;
|
| @@ -170,6 +153,26 @@ struct BatchInfo {
|
| GR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(BatchInfo));
|
| GR_STATIC_ASSERT(kNumShapeTypes <= 8);
|
|
|
| +inline bool BatchInfo::CanCombine(const BatchInfo& a, const BatchInfo& b) {
|
| + if (a.fAntialiasMode != b.fAntialiasMode) {
|
| + return false;
|
| + }
|
| + if (SkToBool(a.fInnerShapeTypes) != SkToBool(b.fInnerShapeTypes)) {
|
| + // GrInstanceProcessor can't currently combine draws with and without inner shapes.
|
| + return false;
|
| + }
|
| + if (a.fCannotDiscard != b.fCannotDiscard) {
|
| + // For stencil draws, the use of discard can be a requirement.
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +inline BatchInfo operator|(const BatchInfo& a, const BatchInfo& b) {
|
| + SkASSERT(BatchInfo::CanCombine(a, b));
|
| + return BatchInfo(a.fData | b.fData);
|
| +}
|
| +
|
| template<typename T> struct TRange {
|
| bool operator ==(const TRange& that) const {
|
| return fStart == that.fStart && fCount == that.fCount;
|
|
|