aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLSPIRVCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/SkSLSPIRVCodeGenerator.cpp')
-rw-r--r--src/sksl/SkSLSPIRVCodeGenerator.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 7d3726a8c1..dadab91753 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -684,7 +684,11 @@ SpvId SPIRVCodeGenerator::writeIntrinsicCall(const FunctionCall& c, OutputStream
SpvId result = this->nextId();
std::vector<SpvId> arguments;
for (size_t i = 0; i < c.fArguments.size(); i++) {
- arguments.push_back(this->writeExpression(*c.fArguments[i], out));
+ if (c.fFunction.fParameters[i]->fModifiers.fFlags & Modifiers::kOut_Flag) {
+ arguments.push_back(this->getLValue(*c.fArguments[i], out)->getPointer());
+ } else {
+ arguments.push_back(this->writeExpression(*c.fArguments[i], out));
+ }
}
this->writeOpCode(SpvOpExtInst, 5 + (int32_t) arguments.size(), out);
this->writeWord(this->getType(c.fType), out);
@@ -700,7 +704,11 @@ SpvId SPIRVCodeGenerator::writeIntrinsicCall(const FunctionCall& c, OutputStream
SpvId result = this->nextId();
std::vector<SpvId> arguments;
for (size_t i = 0; i < c.fArguments.size(); i++) {
- arguments.push_back(this->writeExpression(*c.fArguments[i], out));
+ if (c.fFunction.fParameters[i]->fModifiers.fFlags & Modifiers::kOut_Flag) {
+ arguments.push_back(this->getLValue(*c.fArguments[i], out)->getPointer());
+ } else {
+ arguments.push_back(this->writeExpression(*c.fArguments[i], out));
+ }
}
if (c.fType != *fContext.fVoid_Type) {
this->writeOpCode((SpvOp_) intrinsicId, 3 + (int32_t) arguments.size(), out);
@@ -1574,9 +1582,9 @@ std::unique_ptr<SPIRVCodeGenerator::LValue> SPIRVCodeGenerator::getLValue(const
auto entry = fVariableMap.find(&var);
ASSERT(entry != fVariableMap.end());
return std::unique_ptr<SPIRVCodeGenerator::LValue>(new PointerLValue(
- *this,
- entry->second,
- this->getType(expr.fType)));
+ *this,
+ entry->second,
+ this->getType(expr.fType)));
}
case Expression::kIndex_Kind: // fall through
case Expression::kFieldAccess_Kind: {
@@ -1589,9 +1597,9 @@ std::unique_ptr<SPIRVCodeGenerator::LValue> SPIRVCodeGenerator::getLValue(const
this->writeWord(idx, out);
}
return std::unique_ptr<SPIRVCodeGenerator::LValue>(new PointerLValue(
- *this,
- member,
- this->getType(expr.fType)));
+ *this,
+ member,
+ this->getType(expr.fType)));
}
case Expression::kSwizzle_Kind: {
Swizzle& swizzle = (Swizzle&) expr;