Don't key progams/pipelines on origin.
SkSL language features that are origin sensitive now use a uniform
to conditionally flip their result rather than generating different
code.
Previously we would insert a "rt height" uniform if sk_FragCoord needed
to be flipped. sk_FragCoord,y was implemented as "realFragCoord.y" or
"rtHeight - realFragCoord.y" depending on SkSL::ProgramSettings::fFlipY.
Now we instead use a two component vector rtFlip and sk_FragCoord.y is
always "rtFlip.x + rtFlip.y*realFragCoord.y". We configure rtFlip as
either (0, 1) or (rtHeight, -1). sk_Clockwise and dFdy simiarly use
rtFlip.y to emit code that always works with either origin.
Bug: skia:12037
Change-Id: I7a09d0caac60a58d72b76645ff31bcabde4086b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414796
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/GrSPIRVUniformHandler.cpp b/src/gpu/GrSPIRVUniformHandler.cpp
index 50e1c2e..f073496 100644
--- a/src/gpu/GrSPIRVUniformHandler.cpp
+++ b/src/gpu/GrSPIRVUniformHandler.cpp
@@ -318,7 +318,7 @@
}
}
-uint32_t GrSPIRVUniformHandler::getRTHeightOffset() const {
+uint32_t GrSPIRVUniformHandler::getRTFlipOffset() const {
uint32_t currentOffset = fCurrentUBOOffset;
- return get_ubo_offset(¤tOffset, kFloat_GrSLType, 0);
+ return get_ubo_offset(¤tOffset, kFloat2_GrSLType, 0);
}