From: Eunki, Hong Date: Thu, 7 Mar 2024 06:21:03 +0000 (+0900) Subject: [Tizen] Let we use legacy rounded blur algorithm for gles2.0 X-Git-Tag: accepted/tizen/7.0/unified/20240314.152347~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F18%2F307318%2F1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git [Tizen] Let we use legacy rounded blur algorithm for gles2.0 Change-Id: I50ad32c09da384e9ddc8a18423e67681f8824a5c Signed-off-by: Eunki, Hong --- diff --git a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag index 5be7b02..d374851 100644 --- a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag @@ -192,6 +192,19 @@ mediump float calculateCornerOpacity() #endif #ifdef IS_REQUIRED_BLUR +#ifdef GLSL_VERSION_1_0 +// Legacy code for low version glsl +mediump float calculateBlurOpacity() +{ + highp float potential = gPotential; + + highp float alias = min(gRadius, 1.0); + highp float potentialMin = gMinOutlinePotential - blurRadius - alias; + highp float potentialMax = gMaxOutlinePotential + blurRadius + alias; + + return 1.0 - smoothstep(potentialMin, potentialMax, potential); +} +#else mediump float calculateBlurOpacity() { // Don't use borderline! @@ -259,6 +272,7 @@ mediump float calculateBlurOpacity() return 1.0 - smoothstep(potentialMin, potentialMax, potential); } #endif +#endif void main() { diff --git a/dali-toolkit/internal/visuals/color/color-visual.cpp b/dali-toolkit/internal/visuals/color/color-visual.cpp index 645d22e..cef1d26 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.cpp +++ b/dali-toolkit/internal/visuals/color/color-visual.cpp @@ -242,12 +242,6 @@ Shader ColorVisual::GenerateShader() const // If we use blur, just ignore borderline borderline = false; shaderTypeFlag |= ColorVisualRequireFlag::BLUR; - - // If shader version doesn't support blur with corner radius, ignore corner radius - if(DALI_UNLIKELY(Dali::Shader::GetShaderLanguageVersion() < MINIMUM_SHADER_VERSION_SUPPORT_ROUNDED_BLUR)) - { - roundedCorner = false; - } } if(roundedCorner) { @@ -279,6 +273,13 @@ Shader ColorVisual::GenerateShader() const vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n"; fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n"; } + + // If shader version doesn't support blur with corner radius, Let we use legacy code. + if(DALI_UNLIKELY(Dali::Shader::GetShaderLanguageVersion() < MINIMUM_SHADER_VERSION_SUPPORT_ROUNDED_BLUR)) + { + fragmentShaderPrefixList += "#define GLSL_VERSION_1_0\n"; + } + shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_VERT.data(), Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_FRAG.data()); mFactoryCache.SaveShader(shaderType, shader);