[Tizen] Let we use legacy rounded blur algorithm for gles2.0 18/307318/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 7 Mar 2024 06:21:03 +0000 (15:21 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 7 Mar 2024 06:23:54 +0000 (15:23 +0900)
Change-Id: I50ad32c09da384e9ddc8a18423e67681f8824a5c
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/graphics/shaders/color-visual-shader.frag
dali-toolkit/internal/visuals/color/color-visual.cpp

index 5be7b02..d374851 100644 (file)
@@ -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()
 {
index 645d22e..cef1d26 100644 (file)
@@ -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);