diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-23 09:25:40 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-23 16:07:24 +0000 |
commit | 0f21c2327ea018becec6948e60104645d3b7df26 (patch) | |
tree | d072d14283c037202fc51332ef34896d070f3470 /src | |
parent | 006736906123a64465f40390c0fc886aa8b684a2 (diff) |
fixed a bug with SPIR-V ternaries
When both the true and false values are constants, we use OpSelect to
choose between them instead of branching. However, it turns out that
this fails when the values are vectors, because then OpSelect does
componentwise selection and expects the input condition to be a vector
as well.
Bug: skia:
Change-Id: Ia30aadc590ac1d1760c7df933595c2c867c472cd
Reviewed-on: https://skia-review.googlesource.com/142885
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sksl/SkSLSPIRVCodeGenerator.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp index 3357faaa6e..a97a7ceaf9 100644 --- a/src/sksl/SkSLSPIRVCodeGenerator.cpp +++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp @@ -2278,7 +2278,7 @@ SpvId SPIRVCodeGenerator::writeLogicalOr(const BinaryExpression& o, OutputStream SpvId SPIRVCodeGenerator::writeTernaryExpression(const TernaryExpression& t, OutputStream& out) { SpvId test = this->writeExpression(*t.fTest, out); - if (t.fIfTrue->isConstant() && t.fIfFalse->isConstant()) { + if (t.fIfTrue->fType.columns() == 1 && t.fIfTrue->isConstant() && t.fIfFalse->isConstant()) { // both true and false are constants, can just use OpSelect SpvId result = this->nextId(); SpvId trueId = this->writeExpression(*t.fIfTrue, out); |