From 95401fafa911ce77573e0453092d2d6d7d36cb7e Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 7 Mar 2024 15:21:03 +0900 Subject: [PATCH] [Tizen] Let we use legacy rounded blur algorithm for gles2.0 Change-Id: I50ad32c09da384e9ddc8a18423e67681f8824a5c Signed-off-by: Eunki, Hong --- .../internal/graphics/shaders/color-visual-shader.frag | 14 ++++++++++++++ dali-toolkit/internal/visuals/color/color-visual.cpp | 13 +++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) 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); -- 2.7.4