From: Eunki, Hong Date: Wed, 16 Jun 2021 05:33:34 +0000 (+0900) Subject: Discard fragments out of corner radius X-Git-Tag: dali_2.0.32~8^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=8f4d5a39821629b1bd6cf636a787a49b835f077b;hp=6ae6f36998b3be4efa1114e2df856e51628bf812 Discard fragments out of corner radius 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 --- diff --git a/dali-toolkit/devel-api/visuals/visual-properties-devel.h b/dali-toolkit/devel-api/visuals/visual-properties-devel.h index ddb02d5..5d620bb 100644 --- a/dali-toolkit/devel-api/visuals/visual-properties-devel.h +++ b/dali-toolkit/devel-api/visuals/visual-properties-devel.h @@ -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, }; diff --git a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag index bf93629..92b29a6 100644 --- a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag @@ -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) { diff --git a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag index 305ff92..9c897b4 100644 --- a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag @@ -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) { diff --git a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag index e83d463..b0dcfec 100644 --- a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag @@ -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) {