Home | History | Annotate | Download | only in effects
      1 /*
      2  * Copyright 2017 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 enum class Mode {
      9     kGaussian   = 0,
     10     kSmoothStep = 1
     11 };
     12 
     13 layout(key) in Mode mode;
     14 
     15 void main() {
     16     half factor = 1.0 - sk_InColor.a;
     17     @switch (mode) {
     18         case Mode::kGaussian:
     19             factor = exp(-factor * factor * 4.0) - 0.018;
     20             break;
     21         case Mode::kSmoothStep:
     22             factor = smoothstep(1.0, 0.0, factor);
     23             break;
     24     }
     25     sk_OutColor = half4(factor);
     26 }
     27