DSL var values are now specified at construction time rather than in
Declare
This solves several issues caused by the lack of ordering guarantees in
C++; it was possible for the SkSL backend to look for the value of a
variable before its Declare() call gets processed. Moving the initial
value out of Declare should fix this whole class of problems.
Change-Id: I428fe230f1c312a0128c1f00c2a36cb95f4590a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380358
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 9e5a686..8ec4ffb 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -44,8 +44,8 @@
StartFragmentProcessor(this, &args);
Var edgeArray(kUniform_Modifier, Array(kHalf3, cpe.getEdgeCount()));
fEdgeUniform = VarUniformHandle(edgeArray);
- Var alpha(kHalf, "alpha");
- Declare(alpha, 1);
+ Var alpha(kHalf, "alpha", 1);
+ Declare(alpha);
Var edge(kHalf, "edge");
Declare(edge);
for (int i = 0; i < cpe.getEdgeCount(); ++i) {