Reland "Don't key progams/pipelines on origin.""
Reland works around Adreno issue with this formulation of sk_Clockwise:
(sk_RTFlip.y < 0.0 ? !gl_FrontFacing : gl_FrontFacing)
and instead adds this to the top of the function:
bool sk_Clockwise = gl_FrontFacing;
if (sk_RTFlip.y < 0.0) {
sk_Clockwise = !sk_Clockwise;
}
Original description:
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: I3a2ad6f5667eb4dcd823b939abd5698f89b58929
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425178
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/sksl/SkSLProgramSettings.h b/src/sksl/SkSLProgramSettings.h
index ddd9e10..e477dfb 100644
--- a/src/sksl/SkSLProgramSettings.h
+++ b/src/sksl/SkSLProgramSettings.h
@@ -21,9 +21,6 @@
* Holds the compiler settings for a program.
*/
struct ProgramSettings {
- // if false, sk_FragCoord is exactly the same as gl_FragCoord. If true, the y coordinate
- // must be flipped.
- bool fFlipY = false;
// If true the destination fragment color is read sk_FragColor. It must be declared inout.
bool fFragColorIsInOut = false;
// if true, Setting objects (e.g. sk_Caps.fbFetchSupport) should be replaced with their
@@ -33,13 +30,13 @@
bool fForceHighPrecision = false;
// if true, add -0.5 bias to LOD of all texture lookups
bool fSharpenTextures = false;
- // if the program needs to create an RTHeight uniform, this is its offset in the uniform
+ // if the program needs to create an RTFlip uniform, this is its offset in the uniform
// buffer
- int fRTHeightOffset = -1;
- // if the program needs to create an RTHeight uniform and is creating spriv, this is the
+ int fRTFlipOffset = -1;
+ // if the program needs to create an RTFlip uniform and is creating spriv, this is the
// binding and set number of the uniform buffer.
- int fRTHeightBinding = -1;
- int fRTHeightSet = -1;
+ int fRTFlipBinding = -1;
+ int fRTFlipSet = -1;
// If layout(set=S, binding=B) is not specified for a uniform, these values will be used.
// At present, zero is always used by our backends.
int fDefaultUniformSet = 0;
@@ -75,6 +72,8 @@
bool fDSLMangling = true;
// If true, the DSL should automatically mark variables declared upon creation.
bool fDSLMarkVarsDeclared = false;
+ // If true, the DSL should install a memory pool when possible.
+ bool fDSLUseMemoryPool = true;
// External functions available for use in runtime effects. These values are registered in the
// symbol table of the Program, but ownership is *not* transferred. It is up to the caller to
// keep them alive.