Discard fragments out of corner radius 33/259833/3
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Jun 2021 05:33:34 +0000 (14:33 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Jun 2021 06:07:30 +0000 (15:07 +0900)
discard of some fragments so we can clip rounded corner when ClippingMode::CLIP_CHILDREN.

Note : This patch doesn't decrease performance.
Below table show average FPS of perf-scroll.example + corner radius

       | Ubuntu | NikeM2 | TM1    | Meson  |
before | 44.241 | 54.549 | 27.113 | 48.442 |
after  | 44.414 | 54.953 | 27.207 | 48.315 |

Change-Id: I01f18f9d7025c629ee46f57e02361d24eaf76280
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/devel-api/visuals/visual-properties-devel.h
dali-toolkit/internal/graphics/shaders/color-visual-shader.frag
dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag
dali-toolkit/internal/graphics/shaders/image-visual-shader.frag

index ddb02d5..5d620bb 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -76,6 +76,8 @@ enum Type
    * @details Name "cornerRadius", type Property::FLOAT or Prooperty::VECTOR4, animatable
    * @note By default, it is Vector::ZERO.
    * @note Only Property::Vector4 can be animated.
+   * @note Each radius will clamp internally to the half of smaller of the visual width and visual height.
+   * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN
    * @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner.
    *       When radius is Vector4(x, y, z, w)
    *       x    y
@@ -113,7 +115,7 @@ enum Type
    * @brief The offset from the visual borderline (recommend [-1.0f to 1.0f]).
    * @details Name "borderlineOffset", type Property::FLOAT, animatable
    * @note Default value is 0.0f.
-   * @note This value will be clipped by [-1.0f to 1.0f].
+   * @note This value will clamp internally to [-1.0f to 1.0f].
    */
   BORDERLINE_OFFSET = OPACITY + 6,
 };
index bf93629..92b29a6 100644 (file)
@@ -156,8 +156,8 @@ mediump float calculateCornerOpacity()
   // calculate borderline opacity by potential
   if(potential > gMaxOutlinePotential)
   {
-    // potential is out of borderline range
-    opacity = 0.0;
+    // potential is out of borderline range. just discard here
+    discard;
   }
   else if(potential > gMinOutlinePotential)
   {
index 305ff92..9c897b4 100644 (file)
@@ -155,8 +155,8 @@ mediump float calculateCornerOpacity()
   // calculate borderline opacity by potential
   if(potential > gMaxOutlinePotential)
   {
-    // potential is out of borderline range
-    opacity = 0.0;
+    // potential is out of borderline range. just discard here
+    discard;
   }
   else if(potential > gMinOutlinePotential)
   {
index e83d463..b0dcfec 100644 (file)
@@ -177,8 +177,8 @@ mediump float calculateCornerOpacity()
   // calculate borderline opacity by potential
   if(potential > gMaxOutlinePotential)
   {
-    // potential is out of borderline range
-    opacity = 0.0;
+    // potential is out of borderline range. just discard here
+    discard;
   }
   else if(potential > gMinOutlinePotential)
   {