23 std::move(processors),
24 std::move(appliedClip));
28 static_assert(skgpu::wangs_formula::length_term<3>(1) == 0.75);
29 static_assert(skgpu::wangs_formula::length_term_p2<3>(1) == 0.5625);
33"float wangs_formula_max_fdiff_p2(float2 p0, float2 p1, float2 p2, float2 p3,"
35 "float2 d0 = matrix * (fma(float2(-2), p1, p2) + p0);"
36 "float2 d1 = matrix * (fma(float2(-2), p2, p3) + p1);"
37 "return max(dot(d0,d0), dot(d1,d1));"
39"float wangs_formula_cubic(float _precision_, float2 p0, float2 p1, float2 p2, float2 p3,"
41 "float m = wangs_formula_max_fdiff_p2(p0, p1, p2, p3, matrix);"
42 "return max(ceil(sqrt(0.75 * _precision_ * sqrt(m))), 1.0);"
44"float wangs_formula_cubic_log2(float _precision_, float2 p0, float2 p1, float2 p2, float2 p3,"
46 "float m = wangs_formula_max_fdiff_p2(p0, p1, p2, p3, matrix);"
47 "return ceil(log2(max(0.5625 * _precision_ * _precision_ * m, 1.0)) * .25);"
49"float wangs_formula_conic_p2(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
51 "float2 C = (min(min(p0, p1), p2) + max(max(p0, p1), p2)) * 0.5;"
57 "float m = sqrt(max(max(dot(p0,p0), dot(p1,p1)), dot(p2,p2)));"
60 "float2 dp = fma(float2(-2.0 * w), p1, p0) + p2;"
61 "float dw = abs(fma(-2.0, w, 2.0));"
65 "float rp_minus_1 = max(0.0, fma(m, _precision_, -1.0));"
66 "float numer = length(dp) * _precision_ + rp_minus_1 * dw;"
67 "float denom = 4 * min(w, 1.0);"
71"float wangs_formula_conic(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
72 "float n2 = wangs_formula_conic_p2(_precision_, p0, p1, p2, w);"
73 "return max(ceil(sqrt(n2)), 1.0);"
75"float wangs_formula_conic_log2(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
76 "float n2 = wangs_formula_conic_p2(_precision_, p0, p1, p2, w);"
77 "return ceil(log2(max(n2, 1.0)) * .5);"
static const char * WangsFormulaSkSL()
static const GrPipeline * MakePipeline(const ProgramArgs &, GrAAType, GrAppliedClip &&, GrProcessorSet &&)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
skgpu::Swizzle fWriteSwizzle
GrDstProxyView fDstProxyView