aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir/SkSLConstructor.h
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-06-12 11:05:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-12 19:16:03 +0000
commitd9d33c33dee064da260301faa313703e465d44c5 (patch)
treef2e9a592acde1715d71381d8ff7c97fdaf58edac /src/sksl/ir/SkSLConstructor.h
parent22be4c4801f957f2820b9001b02b892f4b87a157 (diff)
renamed SkSL's assert macros
Since SkSL needs to run outside of Skia, it was originally using its own ASSERT macro, which mapped to SkASSERT when inside of Skia. This is causing conflicts with one or two other ASSERT macros defined around Skia, so to avoid that I am switching SkSL over to just use Skia's standard naming for these macros. Bug: skia: Change-Id: I115435d7282da03d076c6080f7b13d1972b9eb9f Reviewed-on: https://skia-review.googlesource.com/134322 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLConstructor.h')
-rw-r--r--src/sksl/ir/SkSLConstructor.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h
index b8824ba3d2..5e7c3d0d79 100644
--- a/src/sksl/ir/SkSLConstructor.h
+++ b/src/sksl/ir/SkSLConstructor.h
@@ -83,7 +83,7 @@ struct Constructor : public Expression {
}
bool compareConstant(const Context& context, const Expression& other) const override {
- ASSERT(other.fKind == Expression::kConstructor_Kind && other.fType == fType);
+ SkASSERT(other.fKind == Expression::kConstructor_Kind && other.fType == fType);
Constructor& c = (Constructor&) other;
if (c.fType.kind() == Type::kVector_Kind) {
for (int i = 0; i < fType.columns(); i++) {
@@ -96,14 +96,14 @@ struct Constructor : public Expression {
// shouldn't be possible to have a constant constructor that isn't a vector or matrix;
// a constant scalar constructor should have been collapsed down to the appropriate
// literal
- ASSERT(fType.kind() == Type::kMatrix_Kind);
+ SkASSERT(fType.kind() == Type::kMatrix_Kind);
const FloatLiteral fzero(context, -1, 0);
const IntLiteral izero(context, -1, 0);
const Expression* zero;
if (fType.componentType() == *context.fFloat_Type) {
zero = &fzero;
} else {
- ASSERT(fType.componentType() == *context.fInt_Type);
+ SkASSERT(fType.componentType() == *context.fInt_Type);
zero = &izero;
}
for (int col = 0; col < fType.columns(); col++) {
@@ -121,21 +121,21 @@ struct Constructor : public Expression {
}
const Expression& getVecComponent(int index) const {
- ASSERT(fType.kind() == Type::kVector_Kind);
+ SkASSERT(fType.kind() == Type::kVector_Kind);
if (fArguments.size() == 1 && fArguments[0]->fType.kind() == Type::kScalar_Kind) {
return *fArguments[0];
}
int current = 0;
for (const auto& arg : fArguments) {
- ASSERT(current <= index);
+ SkASSERT(current <= index);
if (arg->fType.kind() == Type::kScalar_Kind) {
if (index == current) {
return *arg;
}
current++;
} else {
- ASSERT(arg->fType.kind() == Type::kVector_Kind);
- ASSERT(arg->fKind == Expression::kConstructor_Kind);
+ SkASSERT(arg->fType.kind() == Type::kVector_Kind);
+ SkASSERT(arg->fKind == Expression::kConstructor_Kind);
if (current + arg->fType.columns() > index) {
return ((const Constructor&) *arg).getVecComponent(index - current);
}
@@ -155,9 +155,9 @@ struct Constructor : public Expression {
// null return should be interpreted as zero
const Expression* getMatComponent(int col, int row) const {
- ASSERT(this->isConstant());
- ASSERT(fType.kind() == Type::kMatrix_Kind);
- ASSERT(col < fType.columns() && row < fType.rows());
+ SkASSERT(this->isConstant());
+ SkASSERT(fType.kind() == Type::kMatrix_Kind);
+ SkASSERT(col < fType.columns() && row < fType.rows());
if (fArguments.size() == 1) {
if (fArguments[0]->fType.kind() == Type::kScalar_Kind) {
// single scalar argument, so matrix is of the form:
@@ -168,7 +168,7 @@ struct Constructor : public Expression {
return col == row ? fArguments[0].get() : nullptr;
}
if (fArguments[0]->fType.kind() == Type::kMatrix_Kind) {
- ASSERT(fArguments[0]->fKind == Expression::kConstructor_Kind);
+ SkASSERT(fArguments[0]->fKind == Expression::kConstructor_Kind);
// single matrix argument. make sure we're within the argument's bounds.
const Type& argType = ((Constructor&) *fArguments[0]).fType;
if (col < argType.columns() && row < argType.rows()) {
@@ -182,14 +182,14 @@ struct Constructor : public Expression {
int currentIndex = 0;
int targetIndex = col * fType.rows() + row;
for (const auto& arg : fArguments) {
- ASSERT(targetIndex >= currentIndex);
- ASSERT(arg->fType.rows() == 1);
+ SkASSERT(targetIndex >= currentIndex);
+ SkASSERT(arg->fType.rows() == 1);
if (currentIndex + arg->fType.columns() > targetIndex) {
if (arg->fType.columns() == 1) {
return arg.get();
} else {
- ASSERT(arg->fType.kind() == Type::kVector_Kind);
- ASSERT(arg->fKind == Expression::kConstructor_Kind);
+ SkASSERT(arg->fType.kind() == Type::kVector_Kind);
+ SkASSERT(arg->fKind == Expression::kConstructor_Kind);
return &((Constructor&) *arg).getVecComponent(targetIndex - currentIndex);
}
}