| 1 |
/* |
| 2 |
* Copyright 2020 Google LLC |
| 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 |
#include "include/private/SkSLSampleUsage.h" |
| 9 |
|
| 10 |
#include <algorithm> |
| 11 |
|
| 12 |
namespace SkSL { |
| 13 |
|
| 14 |
SampleUsage SampleUsage::merge(const SampleUsage& other) { |
| 15 |
// This function is only used in Analysis::MergeSampleUsageVisitor to determine the combined |
| 16 |
// SampleUsage for a child fp/shader/etc. We should never see matrix sampling here. |
| 17 |
SkASSERT(fKind != Kind::kUniformMatrix && other.fKind != Kind::kUniformMatrix); |
| 18 |
|
| 19 |
static_assert(Kind::kExplicit > Kind::kPassThrough); |
| 20 |
static_assert(Kind::kPassThrough > Kind::kNone); |
| 21 |
fKind = std::max(fKind, other.fKind); |
| 22 |
|
| 23 |
return *this; |
| 24 |
} |
| 25 |
|
| 26 |
} // namespace SkSL |