Fixed some fixups not being applied to DSL code
Change-Id: I11c473a7a683282d6bd4f73d2c90f23de63f8cc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426557
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/SkSLDSLTest.cpp b/tests/SkSLDSLTest.cpp
index 5a4daf6..03efb58 100644
--- a/tests/SkSLDSLTest.cpp
+++ b/tests/SkSLDSLTest.cpp
@@ -1961,3 +1961,20 @@
vars.emplace_back(DSLVar(kInt_Type, "x"));
REPORTER_ASSERT(r, DSLWriter::Var(*vars[0])->name() == "x");
}
+
+DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLRTAdjust, r, ctxInfo) {
+ AutoDSLContext context(ctxInfo.directContext()->priv().getGpu(), no_mark_vars_declared(),
+ SkSL::ProgramKind::kVertex);
+ DSLVar rtAdjust(kUniform_Modifier, kFloat4_Type, "sk_RTAdjust");
+ DeclareGlobal(rtAdjust);
+ DSLFunction(kVoid_Type, "main").define(
+ sk_Position() = Half4(0)
+ );
+ REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 2);
+ EXPECT_EQUAL(*DSLWriter::ProgramElements()[1],
+ "void main() {"
+ "(sk_PerVertex.sk_Position = float4(0.0));"
+ "(sk_PerVertex.sk_Position = float4(((sk_PerVertex.sk_Position.xy * sk_RTAdjust.xz) + "
+ "(sk_PerVertex.sk_Position.ww * sk_RTAdjust.yw)), 0.0, sk_PerVertex.sk_Position.w));"
+ "}");
+}