43 {
44 {
48 };
49 static const Varying kVaryings[]{
52 };
53 static constexpr char kVS[] = R"(
54 half4 unswizzle_color(half4 color) { return color.garb; }
55
56 Varyings main(const in Attributes attributes) {
57 Varyings varyings;
58 varyings.color = unswizzle_color(attributes.brag);
59 varyings.uv = attributes.xuyv.yw;
60 varyings.position = attributes.xuyv.xz;
61 return varyings;
62 }
63 )";
64 static constexpr char kFS[] = R"(
65 uniform colorFilter filter;
66
67 float2 main(const in Varyings varyings, out float4 color) {
68 color = filter.eval(varyings.color);
69 return varyings.uv;
70 }
71 )";
73 sizeof(ColorVertex),
74 kVaryings,
77 if (!spec) {
79 }
80 fSpecWithColor = std::move(spec);
81 }
82 {
85 };
86 static const Varying kVaryings[]{
88 };
89 static constexpr char kVS[] = R"(
90 Varyings main(const in Attributes a) {
91 Varyings v;
92 v.vux2 = 2*a.xuyv.wy;
93 v.position = a.xuyv.xz;
94 return v;
95 }
96 )";
97 static constexpr char kFS[] = R"(
98 float2 helper(in float2 vux2) { return vux2.yx/2; }
99 float2 main(const in Varyings varyings) {
100 return helper(varyings.vux2);
101 }
102 )";
104 sizeof(NoColorVertex),
105 kVaryings,
108 if (!spec) {
110 }
111 fSpecWithNoColor = std::move(spec);
112 }
113
116 3,
118 nullptr,
119 2,
121 }
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorWHITE
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs)
const uint8_t uint32_t uint32_t GError ** error
static const std::map< std::string, VerticesBuilder::AttributeType > kAttributes