Stop requiring RTAdjust var when it is an interface block field
We were previously relying on the RTAdjust var's (essentially
meaningless in that case) value being non-null even when RTAdjust was
an interface block field instead of a var. This breaks runtime effects
built by the DSLParser, which does not set RTAdjust unless there's
actually an RTAdjust var.
Change-Id: I0938e1562ebf997af7b1f4dd9beb60fcd7909a20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445096
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index a41e6a7..51ced68 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -553,7 +553,8 @@
using OwnerKind = SkSL::FieldAccess::OwnerKind;
// If this is a vertex program that uses RTAdjust, and this is main()...
- if (fRTAdjust && decl.isMain() && ProgramKind::kVertex == this->programKind()) {
+ if ((fRTAdjust || fRTAdjustInterfaceBlock) && decl.isMain() &&
+ ProgramKind::kVertex == this->programKind()) {
// ... append a line to the end of the function body which fixes up sk_Position.
const Variable* skPerVertex = nullptr;
if (const ProgramElement* perVertexDecl = fIntrinsics->find(Compiler::PERVERTEX_NAME)) {