fixed SPIR-V constant swizzling

Bug: skia:
Change-Id: I27ccb48351eab7faa46ba65d0c4ec26592da383d
Reviewed-on: https://skia-review.googlesource.com/c/195122
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2019-02-25 14:29:11 -05:00 committed by Skia Commit-Bot
parent dfe5000a5f
commit 0b2c05470b

View File

@ -1831,7 +1831,7 @@ SpvId SPIRVCodeGenerator::writeSwizzle(const Swizzle& swizzle, OutputStream& out
FloatLiteral zero(fContext, -1, 0); FloatLiteral zero(fContext, -1, 0);
SpvId zeroId = this->writeFloatLiteral(zero); SpvId zeroId = this->writeFloatLiteral(zero);
FloatLiteral one(fContext, -1, 1); FloatLiteral one(fContext, -1, 1);
SpvId oneId = this->writeFloatLiteral(zero); SpvId oneId = this->writeFloatLiteral(one);
SpvId type = this->getType(*fContext.fFloat2_Type); SpvId type = this->getType(*fContext.fFloat2_Type);
fConstantZeroOneVector = this->nextId(); fConstantZeroOneVector = this->nextId();
this->writeOpCode(SpvOpConstantComposite, 5, fConstantBuffer); this->writeOpCode(SpvOpConstantComposite, 5, fConstantBuffer);
@ -1847,9 +1847,9 @@ SpvId SPIRVCodeGenerator::writeSwizzle(const Swizzle& swizzle, OutputStream& out
this->writeWord(other, out); this->writeWord(other, out);
for (int component : swizzle.fComponents) { for (int component : swizzle.fComponents) {
if (component == SKSL_SWIZZLE_0) { if (component == SKSL_SWIZZLE_0) {
this->writeWord(swizzle.fType.columns(), out); this->writeWord(swizzle.fBase->fType.columns(), out);
} else if (component == SKSL_SWIZZLE_1) { } else if (component == SKSL_SWIZZLE_1) {
this->writeWord(swizzle.fType.columns() + 1, out); this->writeWord(swizzle.fBase->fType.columns() + 1, out);
} else { } else {
this->writeWord(component, out); this->writeWord(component, out);
} }