Updated shader source to set precision explicitly 93/29993/2
authorDavid Steele <david.steele@partner.samsung.com>
Thu, 6 Nov 2014 15:58:29 +0000 (15:58 +0000)
committerDavid Steele <david.steele@partner.samsung.com>
Fri, 7 Nov 2014 12:49:43 +0000 (12:49 +0000)
Change-Id: I686d1baf948d352f65e37f21018067a9c1190128
Signed-off-by: David Steele <david.steele@partner.samsung.com>
27 files changed:
base/dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
base/dali-toolkit/public-api/shader-effects/bouncing-effect.cpp
base/dali-toolkit/public-api/shader-effects/image-region-effect.cpp
optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
optional/dali-toolkit/internal/filters/blur-two-pass-filter.cpp
optional/dali-toolkit/internal/filters/emboss-filter.cpp
optional/dali-toolkit/internal/filters/spread-filter.cpp
optional/dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp
optional/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.h
optional/dali-toolkit/public-api/shader-effects/alpha-discard-effect.cpp
optional/dali-toolkit/public-api/shader-effects/blind-effect.cpp
optional/dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.cpp
optional/dali-toolkit/public-api/shader-effects/carousel-effect.cpp
optional/dali-toolkit/public-api/shader-effects/displacement-effect.cpp
optional/dali-toolkit/public-api/shader-effects/dissolve-effect.cpp
optional/dali-toolkit/public-api/shader-effects/dissolve-local-effect.cpp
optional/dali-toolkit/public-api/shader-effects/distance-field-effect.cpp
optional/dali-toolkit/public-api/shader-effects/iris-effect.cpp
optional/dali-toolkit/public-api/shader-effects/mirror-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-stretch-effect.cpp
optional/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp
optional/dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.cpp
optional/dali-toolkit/public-api/shader-effects/ripple2d-effect.cpp
optional/dali-toolkit/public-api/shader-effects/spot-effect.cpp
optional/dali-toolkit/public-api/shader-effects/square-dissolve-effect.cpp
optional/dali-toolkit/public-api/shader-effects/swirl-effect.cpp

index 237e81a..7301a8b 100644 (file)
@@ -100,7 +100,7 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   meshActor.SetAffectedByLighting(false);
 
   Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( "", MESH_FRAGMENT_SHADER,
-                                                             GEOMETRY_TYPE_MESH,
+                                                             GEOMETRY_TYPE_UNTEXTURED_MESH,
                                                              Dali::ShaderEffect::HINT_BLENDING );
   meshActor.SetShaderEffect(shaderEffect);
 
index c0433f5..9961fdf 100644 (file)
@@ -48,6 +48,7 @@ BouncingEffect::~BouncingEffect()
 BouncingEffect BouncingEffect::New( const Vector4& color )
 {
   std::string fragmentShader = MAKE_STRING(
+      precision mediump float;\n
       uniform float uProgressRate;\n
       uniform vec4 uAssignedColor;\n
       void main()\n
@@ -81,7 +82,8 @@ BouncingEffect BouncingEffect::New( const Vector4& color )
   );
 
   ShaderEffect shaderEffect;
-  shaderEffect = ShaderEffect::New( "", fragmentShader, GeometryType( GEOMETRY_TYPE_IMAGE),
+  shaderEffect = ShaderEffect::New( "", fragmentShader,
+                                    GeometryType( GEOMETRY_TYPE_IMAGE),
                                     ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
   BouncingEffect handle( shaderEffect );
 
index b597c92..ee9b256 100644 (file)
@@ -49,11 +49,11 @@ ImageRegionEffect::~ImageRegionEffect()
 ImageRegionEffect ImageRegionEffect::New()
 {
   std::string vertexShader(
-    "uniform vec2 uTopLeft;\n"
-    "uniform vec2 uBottomRight;\n"
+    "uniform mediump vec2 uTopLeft;\n"
+    "uniform mediump vec2 uBottomRight;\n"
     "void main()\n"
     "{\n"
-    "  vec4 position = vec4(aPosition,1.0);\n"
+    "  mediump vec4 position = vec4(aPosition,1.0);\n"
     "  gl_Position = uMvpMatrix * position;\n"
     // The line below is doing the same as the following commented lines:
     //"  vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n"
@@ -98,4 +98,3 @@ const std::string& ImageRegionEffect::GetBottomRightPropertyName() const
 } // namespace Toolkit
 
 } // namespace Dali
-
index 371fded..0aed88f 100644 (file)
@@ -97,8 +97,8 @@ const float GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE = 0.5f;
 const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
 
 const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE =
-    "uniform vec2 uSampleOffsets[NUM_SAMPLES];\n"
-    "uniform float uSampleWeights[NUM_SAMPLES];\n"
+    "uniform mediump vec2 uSampleOffsets[NUM_SAMPLES];\n"
+    "uniform mediump float uSampleWeights[NUM_SAMPLES];\n"
 
     "void main()\n"
     "{\n"
index b9cd038..6544046 100644 (file)
@@ -60,6 +60,7 @@ const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
 
 const char* BLUR_TWO_PASS_FRAGMENT_SOURCE =
 {
+ "precision highp float;\n"
  "uniform vec2 uSampleOffsets[NUM_SAMPLES];\n"
  "uniform float uSampleWeights[NUM_SAMPLES];\n"
  "void main()\n"
index 9601b0b..b715e11 100644 (file)
@@ -43,6 +43,7 @@ const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
 
 const char* EMBOSS_FRAGMENT_SOURCE1 =
 {
+ "precision highp float;\n"
  "uniform vec2 uTexScale;\n"
  "\n"
  "void main()\n"
@@ -72,6 +73,7 @@ const char* EMBOSS_FRAGMENT_SOURCE1 =
 
 const char* EMBOSS_FRAGMENT_SOURCE2 =
 {
+ "precision highp float;\n"
  "uniform vec2 uTexScale;\n"
  "\n"
  "void main()\n"
index ac230cc..b04d173 100644 (file)
@@ -42,6 +42,7 @@ const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
 
 const char* const SPREAD_FRAGMENT_SOURCE =
 {
+ "precision highp float;\n"
  "uniform float uSpread;\n"
  "uniform vec2 uTexScale;\n"
  "void main()\n"
index 350e6b6..d3d5ecf 100644 (file)
@@ -158,6 +158,7 @@ Toolkit::PageTurnEffect PageTurnEffect::CreateShaderEffect( bool enableBlending
      * ([3][2]) float curveHeight: The height of the interpolated hermite curve.
      * ([3][3]) float currentLength: The length from the current center to the curveEnd.
      */
+    precision mediump float;\n
     uniform mat4 uCommonParameters;\n
     \n
     uniform vec2 uPageSize;\n
@@ -321,6 +322,7 @@ Toolkit::PageTurnEffect PageTurnEffect::CreateShaderEffect( bool enableBlending
   std::string vertexShaderEnd("}");
 
   std::string fragmentShaderPartOne = MAKE_STRING(
+    precision mediump float;\n
     uniform vec2 uPageSize;\n
     uniform vec2 uSpineShadowParameter;\n
     varying vec3 vNormal;\n
index bad335a..b2a0312 100644 (file)
@@ -69,7 +69,7 @@ public:
   static FullAreaImageCreator New()
   {
     std::string vertexShader(
-      "uniform vec4 uRegion; \n"
+      "uniform mediump vec4 uRegion; \n"
        "void main() \n"
       "{\n"
       "  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
@@ -79,7 +79,7 @@ public:
     );
 
     std::string fragmentShader(
-      "uniform vec4 uRegion; \n"
+      "uniform mediump vec4 uRegion; \n"
       "void main() \n"
       "{\n"
       "  if( vTexCoord.s > 0.0 && vTexCoord.s < 1.0 && vTexCoord.t > 0.0 && vTexCoord.t < 1.0) \n"
index 86e8da0..c09f7c0 100644 (file)
@@ -37,7 +37,7 @@ AlphaDiscardEffect AlphaDiscardEffect::New()
   const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
       "void main()                                                    \n"
       "{                                                              \n"
-      "  vec4 color = texture2D( sTexture, vTexCoord );               \n"
+      "  mediump vec4 color = texture2D( sTexture, vTexCoord );       \n"
       "  if(color.a <= 0.0001)                                        \n"
       "  {                                                            \n"
       "    discard;                                                   \n"
index 4e2abc3..f2b74d9 100644 (file)
@@ -48,14 +48,14 @@ BlindEffect::~BlindEffect()
 BlindEffect BlindEffect::New()
 {
   std::string fragmentShader(
-    "uniform float uStep;                                                                \n"
+    "uniform mediump float uStep;                                                        \n"
     "void main()                                                                         \n"
     "{                                                                                   \n"
-    "    vec4 alphaColor;                                                                \n"
-    "    vec4 baseColor;                                                                 \n"
+    "    mediump vec4 alphaColor;                                                        \n"
+    "    mediump vec4 baseColor;                                                         \n"
     "    baseColor = texture2D( sTexture, vTexCoord);                                    \n"
     "    alphaColor = vec4(0.1,0.1,0.1,1.0);                                             \n"
-    "    float index = 0.0;                                                              \n"
+    "    lowp float index = 0.0;                                                         \n"
     "    index = floor(vTexCoord.y/0.1);                                                 \n"
     "    if((vTexCoord.y < (index * 0.1 + uStep * 0.005)) && (vTexCoord.y > index * 0.1))\n"
     "    {                                                                               \n"
index 63ee87e..d335d37 100644 (file)
@@ -57,6 +57,7 @@ BubbleEffect BubbleEffect::New( unsigned int numberOfBubble, const std::string&
   std::ostringstream vertexShaderStringStream;
   vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numberOfBubble << "\n";
   std::string vertexShader(
+    "  precision mediump float;\n"
     // the gravity applied to the y direction
     "  uniform float uGravity; \n"
     // Width of the texture in pixels
@@ -127,6 +128,7 @@ BubbleEffect BubbleEffect::New( unsigned int numberOfBubble, const std::string&
   vertexShaderStringStream << vertexShader;
 
   std::string fragmentShader(
+    "  precision mediump float;\n"
     "  varying float vPercentage;\n"
     "  varying vec2  vEffectTexCoord;\n"
     "\n"
@@ -140,15 +142,17 @@ BubbleEffect BubbleEffect::New( unsigned int numberOfBubble, const std::string&
     "    gl_FragColor = fragColor;\n"
     "  }\n");
 
-  ShaderEffect shaderEffect = ShaderEffect::New( vertexShaderStringStream.str(), fragmentShader,
-                                                 GeometryType( GEOMETRY_TYPE_TEXTURED_MESH),
-                                                 ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+  ShaderEffect shaderEffect = ShaderEffect::New(
+    vertexShaderStringStream.str(),
+    fragmentShader,
+    GeometryType( GEOMETRY_TYPE_TEXTURED_MESH),
+    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+
   BubbleEffect handle( shaderEffect );
 
   handle.mNumberOfBubbles = numberOfBubble;
   handle.SetMovementArea( Stage::GetCurrent().GetSize() );
 
-
   handle.SetUniform( "uGravity", 50.f );
   handle.SetUniform( "uMagnification", 1.f );
   handle.SetUniform( "uDynamicScale", 1.f );
index 5b1e324..9e360c2 100644 (file)
@@ -57,10 +57,10 @@ CarouselEffect CarouselEffect::New()
               "\n"
               "void main()\n"
               "{\n"
-              "    vec4 world = uModelView * vec4(aPosition,1.0);\n"
-              "    vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
-              "    float a = length(d);\n"
-              "    float cs = cos(radians(a));\n"
+              "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
+              "    mediump vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
+              "    mediump float a = length(d);\n"
+              "    mediump float cs = cos(radians(a));\n"
               "    world.z -= cs * uRadius;\n"
               "    gl_Position = uProjection * world;\n"
               "    \n"
index 7e3158c..c0c142c 100644 (file)
@@ -80,7 +80,7 @@ DisplacementEffect DisplacementEffect::New(Type type)
 
     "void main()\n"
     "{\n"
-    "   vec4 col = texture2D(sTexture, vTexCoord);\n"
+    "  vec4 col = texture2D(sTexture, vTexCoord);\n"
     // calc lighting
     "  float intensity = dot(uLightDirection, uFixedNormal);"
     "  vec3 lighting = (intensity * uDiffuseLightColor) + uAmbientLightColor;\n"
@@ -238,4 +238,3 @@ void DisplacementEffect::SetFixedNormalProperty(const Vector3 fixedNormal)
 }
 
 }
-
index 149e225..70d2f5c 100644 (file)
@@ -90,13 +90,13 @@ DissolveEffect DissolveEffect::New( bool useHighPrecision )
   Dali::ShaderEffect shaderEffectCustom;
   if( useHighPrecision )
   {
-    shaderEffectCustom =  Dali::ShaderEffect::New( vertexShader, prefixHighPrecision + fragmentShader,
+    shaderEffectCustom =  Dali::ShaderEffect::New( prefixHighPrecision+vertexShader, prefixHighPrecision + fragmentShader,
                                                GeometryType( GEOMETRY_TYPE_IMAGE),
                                                ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
   }
   else
   {
-    shaderEffectCustom =  Dali::ShaderEffect::New( vertexShader, prefixMediumPrecision + fragmentShader,
+    shaderEffectCustom =  Dali::ShaderEffect::New( prefixMediumPrecision+vertexShader, prefixMediumPrecision + fragmentShader,
                                                GeometryType( GEOMETRY_TYPE_IMAGE),
                                                ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING ) );
   }
index f5b7387..5d85ebf 100644 (file)
@@ -56,6 +56,7 @@ DissolveLocalEffect DissolveLocalEffect::New( unsigned int numberOfDimples )
   std::ostringstream vertexShaderStringStream;
   vertexShaderStringStream << "#define NUMBER_OF_DIMPLE "<< numberOfDimples << "\n";
   std::string vertexShader(
+    "precision highp float;\n"
     "uniform vec2 uCenter[ NUMBER_OF_DIMPLE ];\n"
     "uniform float uRadius[ NUMBER_OF_DIMPLE ]; \n"
     "uniform float uPercentage[ NUMBER_OF_DIMPLE ]; \n"
index 5c37f36..6c120b2 100644 (file)
@@ -112,7 +112,7 @@ DistanceFieldEffect DistanceFieldEffect::New()
       "\n"
       "  else // (uDoShadow > 0.0)\n"
       "  {\n"
-      "    float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
+      "    mediump float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n"
       "    mediump float inText = alphaFactor;\n"
       "    mediump float inShadow = smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, shadowDistance);\n"
       "\n"
index 635caab..38a83dd 100644 (file)
@@ -48,11 +48,11 @@ IrisEffect IrisEffect::New()
   // append the default version
   std::string vertexShader(
               "uniform mediump vec2 uCenter;\n"
-              "varying vec2 vRelativePosition;\n"
+              "varying mediump vec2 vRelativePosition;\n"
               "\n"
               "void main()\n"
               "{\n"
-              "    vec4 world = uModelView * vec4(aPosition,1.0);\n"
+              "    mediump vec4 world = uModelView * vec4(aPosition,1.0);\n"
               "    gl_Position = uProjection * world;\n"
               "    \n"
               "    vTexCoord = aTexCoord;\n"
@@ -60,12 +60,12 @@ IrisEffect IrisEffect::New()
               "}\n");
 
   std::string fragmentShader(
-              "uniform float uRadius;                                                           \n"
-              "uniform float uBlendFactor;                                                      \n"
-              "varying vec2 vRelativePosition;                                                  \n"
+              "uniform mediump float uRadius;                                                           \n"
+              "uniform mediump float uBlendFactor;                                                      \n"
+              "varying mediump vec2 vRelativePosition;                                                  \n"
               "void main()                                                                      \n"
               "{                                                                                \n"
-              "   float delta = (length(vRelativePosition) - uRadius);                          \n"
+              "   mediump float delta = (length(vRelativePosition) - uRadius);                          \n"
               "   delta = clamp(0.0 - delta * uBlendFactor, 0.0, 1.0);                          \n"
               "   gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;                       \n"
               "   gl_FragColor.a *= delta;                                                      \n"
@@ -118,4 +118,3 @@ const std::string& IrisEffect::GetCenterPropertyName() const
 
 }
 }
-
index 2663567..8a11c06 100644 (file)
@@ -48,20 +48,19 @@ MirrorEffect::~MirrorEffect()
 MirrorEffect MirrorEffect::New()
 {
 
-  std::string vertextShader(
-      "precision mediump float;                     \n"
+  std::string vertexShader(
       "void main()                                  \n"
       "{                                            \n"
-      "  vec3 pos = aPosition;                      \n"
+      "  mediump vec3 pos = aPosition;              \n"
       "  pos.y = pos.y * 3.0;                       \n"
-      "  vec4 world = uModelView * vec4(pos,1.0);   \n"
+      "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
       "  gl_Position = uProjection * world;         \n"
       "  vTexCoord = aTexCoord;                     \n"
       "}                                            \n" );
 
   std::string fragmentShader(
-      "uniform  float  uDepth;                      \n"
-      "uniform  float  uAlpha;                      \n"
+      "uniform  mediump float  uDepth;              \n"
+      "uniform  mediump float  uAlpha;              \n"
       "void main()                                  \n"
       "{                                            \n"
       " if(vTexCoord.y < 1.0 / 3.0)                 \n"
@@ -75,9 +74,9 @@ MirrorEffect MirrorEffect::New()
       " }                                           \n"
       " else                                        \n"
       " {                                           \n"
-      "   float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
+      "   highp float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
       "   darkness = (1.0 - 1.0 / uDepth + darkness * 1.0/ uDepth) * 0.65;                            \n"
-      "   vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
+      "   highp vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
       "   color.a *= uAlpha;                                                                          \n"
       "   gl_FragColor = color * vec4(darkness, darkness, darkness, darkness);                        \n"
       " }                                           \n"
@@ -85,7 +84,7 @@ MirrorEffect MirrorEffect::New()
 
   // Create the implementation, temporarily owned on stack,
   Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertextShader,
+      vertexShader,
       fragmentShader,
       GeometryType( GEOMETRY_TYPE_IMAGE ),
       ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));
index 0eb84a9..1b77466 100644 (file)
@@ -114,6 +114,7 @@ MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
   // varying   vec2  vTexCoord;
   std::string vertexSource;
   vertexSource =
+    "precision mediump float;\n"
     "uniform mat4 uModelLastFrame;\n"
     "uniform float uTimeDelta;\n"
 
@@ -186,7 +187,6 @@ MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
   std::string fragmentSource;
   fragmentSource =
     "precision mediump float;\n"
-
     "uniform vec2 uObjectFadeStart;\n"
     "uniform vec2 uObjectFadeEnd;\n"
     "uniform float uAlphaScale;\n"
@@ -227,8 +227,7 @@ MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
     "}\n";
 
   // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
-  ShaderEffect shader = ShaderEffect::New( vertexSource,
-                                           fragmentSource,
+  ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource,
                                            GEOMETRY_TYPE_IMAGE,
                                            ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) );
 
@@ -331,4 +330,3 @@ const std::string& MotionBlurEffect::GetAlphaScalePropertyName() const
 }
 
 }
-
index 4df2ebb..48dff1d 100644 (file)
@@ -123,6 +123,7 @@ MotionStretchEffect MotionStretchEffect::New()
   // varying   vec2  vTexCoord;
   std::string vertexSource;
   vertexSource =
+    "precision mediump float;\n"
     "uniform mat4  uModelLastFrame;\n"
     "uniform float uTimeDelta;\n"
 
@@ -223,10 +224,9 @@ MotionStretchEffect MotionStretchEffect::New()
     "}";
 
   // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
-  ShaderEffect shader = ShaderEffect::New( vertexSource,
-                                           fragmentSource,
-                                           GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                           ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
+  ShaderEffect shader = ShaderEffect::New(
+    vertexSource, fragmentSource, GeometryType( GEOMETRY_TYPE_IMAGE ),
+    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ) );
 
 
 
@@ -302,4 +302,3 @@ const std::string& MotionStretchEffect::GetAlphaScalePropertyName() const
 }
 
 }
-
index ca75378..bfaba3d 100644 (file)
@@ -42,6 +42,7 @@ struct NinePatchMaskEffectSizeConstraint
 static void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder )
 {
   const char* ALPHA_MASK_VERTEX_SHADER_SOURCE =
+  "precision mediump float;\n"
   "uniform vec2 uImageSize;                                                       \n"
   "uniform vec2 uMaskSize;                                                        \n"
   "varying vec2 vMaskTexCoord;                                                    \n"
@@ -68,7 +69,7 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto
   "}                                                                              \n";
 
   const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE =
-  "varying vec2 vMaskTexCoord;                                                    \n"
+  "varying mediump vec2 vMaskTexCoord;                                            \n"
   "                                                                               \n"
   "void main()                                                                    \n"
   "{                                                                              \n"
@@ -76,10 +77,11 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto
   "  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n"
   "}                                                                              \n";
 
-  ShaderEffect maskEffect = ShaderEffect::New( ALPHA_MASK_VERTEX_SHADER_SOURCE,
-                                               ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
-                                               GeometryType( GEOMETRY_TYPE_IMAGE ),
-                                               ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
+  ShaderEffect maskEffect = ShaderEffect::New(
+    ALPHA_MASK_VERTEX_SHADER_SOURCE,
+    ALPHA_MASK_FRAGMENT_SHADER_SOURCE,
+    GeometryType( GEOMETRY_TYPE_IMAGE ),
+    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
 
   maskEffect.SetEffectImage( Image::New( maskImage ) );
 
index e936106..eae9ac7 100644 (file)
@@ -60,6 +60,7 @@ PageTurnBookSpineEffect::~PageTurnBookSpineEffect()
 PageTurnBookSpineEffect PageTurnBookSpineEffect::New()
 {
   std::string vertexSource(
+  "precision mediump float;\n"
   "uniform float uShadowWidth;\n"
   "  void main()\n"
   "  {\n"
@@ -70,6 +71,7 @@ PageTurnBookSpineEffect PageTurnBookSpineEffect::New()
 
   // the simplified version of the fragment shader of page turn effect
   std::string fragmentSource(
+  "precision mediump float;\n"
   "uniform float uIsBackImageVisible;\n"
   "uniform float uPageWidth;\n"
   "uniform vec2 uSpineShadowParameter;\n"
@@ -99,7 +101,7 @@ PageTurnBookSpineEffect PageTurnBookSpineEffect::New()
   "  }" );
 
   ShaderEffect shader;
-  shader = ShaderEffect::New( vertexSource,fragmentSource );
+  shader = ShaderEffect::New( vertexSource, fragmentSource );
   PageTurnBookSpineEffect handle( shader );
   handle.SetUniform( IS_BACK_IMAGE_VISIBLE_PROPERTY_NAME, -1.f );
   handle.SetUniform( SHADOW_WIDTH_PROPERTY_NAME, DEFAULT_SHADOW_WIDTH );
index 43f2c02..cfbb685 100644 (file)
@@ -52,6 +52,7 @@ Ripple2DEffect Ripple2DEffect::New()
 {
     // append the default version
     std::string fragmentShader(
+        "precision mediump float;\n"
         "uniform float uAmplitude;\n"
         "uniform float uTime;\n"
         "void main()\n"
@@ -65,10 +66,9 @@ Ripple2DEffect Ripple2DEffect::New()
 
   // Create the implementation, temporarily owned on stack
   Dali::ShaderEffect shaderEffect =  Dali::ShaderEffect::New(
-      "",
-      fragmentShader,
-      Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
-      ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
+    "", fragmentShader,
+    Dali::GeometryType( GEOMETRY_TYPE_IMAGE ),
+    ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID ));
 
   /* Pass ownership to Ripple2DEffect through overloaded constructor, So that it now has access to the
      Dali::ShaderEffect implementation */
index 5755dd3..2eef696 100644 (file)
@@ -56,12 +56,12 @@ SpotEffect SpotEffect::New()
       "\n"
       "void main()\n"
       "{\n"
-      "  vec4 world = vec4(aPosition, 1.0);\n"
+      "  mediump vec4 world = vec4(aPosition, 1.0);\n"
       "  \n"
-      "  vec2 d = vec2(world.xy - uCenter);\n"
-      "  float dist = length(d);\n"
+      "  mediump vec2 d = vec2(world.xy - uCenter);\n"
+      "  mediump float dist = length(d);\n"
       "  \n"
-      "  float range = (uRadius - dist) / (uRadius);\n"
+      "  mediump float range = (uRadius - dist) / (uRadius);\n"
       "  vRange = max(0.1, range);\n"
       "  \n"
       "  gl_Position = uMvpMatrix * world;\n"
index 89328fb..0d3d348 100644 (file)
@@ -51,18 +51,18 @@ SquareDissolveEffect SquareDissolveEffect::New()
 {
   // variable "uStep" range scope : [0.0, 1.0]
   std::string fragmentShader(
-      "uniform  vec2   texSize;                   \n"
-      "uniform  float  uStep;                     \n"
-      "uniform  float  uRows;                     \n"
-      "uniform  float  uColumns;                  \n"
-      "void main()                                \n"
-      "{                                          \n"
-      "  vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns);                               \n"
-      "  vec2 intXY = vec2(vTexCoord.x * texSize.x, vTexCoord.y * texSize.y);               \n"
-      "  vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
-      "  vec2 UVMosaic = vec2(XYMosaic.x /texSize.x, XYMosaic.y / texSize.y);               \n"
-      "  vec4 noiseVec = texture2D(sEffect, UVMosaic);                                      \n"
-      "  float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0;   \n"
+      "uniform  mediump vec2   texSize;\n"
+      "uniform  mediump float  uStep;\n"
+      "uniform  mediump float  uRows;\n"
+      "uniform  mediump float  uColumns;\n"
+      "void main()\n"
+      "{\n"
+      "  mediump vec2 mosaicSize = vec2(1.0 / uRows, 1.0 / uColumns);                               \n"
+      "  mediump vec2 intXY = vec2(vTexCoord.x * texSize.x, vTexCoord.y * texSize.y);               \n"
+      "  mediump vec2 XYMosaic = vec2(floor(intXY.x / mosaicSize.x) * mosaicSize.x, floor(intXY.y / mosaicSize.y) * mosaicSize.y); \n"
+      "  mediump vec2 UVMosaic = vec2(XYMosaic.x /texSize.x, XYMosaic.y / texSize.y);               \n"
+      "  mediump vec4 noiseVec = texture2D(sEffect, UVMosaic);                                      \n"
+      "  mediump float intensity = (noiseVec[0] + noiseVec[1] + noiseVec[2] + noiseVec[3]) / 4.0;   \n"
       "  if(intensity < uStep)                                                              \n"
       "    gl_FragColor = vec4(0.1, 0.1, 0.1, 1.0);                                         \n"
       "  else                                                                               \n"
index a2624ba..67cf84d 100644 (file)
@@ -51,21 +51,21 @@ SwirlEffect SwirlEffect::New(bool warp)
 {
   // append the default version
   std::string fragmentShader(
-      "uniform vec2  uTextureSize;\n"
-      "uniform float uRadius;\n"
-      "uniform float uAngle;\n"
-      "uniform vec2  uCenter;\n"
+      "uniform mediump vec2  uTextureSize;\n"
+      "uniform highp float uRadius;\n"
+      "uniform highp float uAngle;\n"
+      "uniform mediump vec2  uCenter;\n"
       "void main()\n"
       "{\n"
-      "  vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
+      "  highp vec2 textureCenter = (sTextureRect.xy + sTextureRect.zw) * 0.5;\n"
       "  textureCenter = vTexCoord.st - textureCenter;\n"
-      "  float distance = length(textureCenter);\n"
+      "  highp float distance = length(textureCenter);\n"
       "  if (distance >= uRadius)\n"
       "     discard;\n"
-      "  float percent = (uRadius - distance) / uRadius;\n"
-      "  float theta = percent * percent * uAngle * 4.0;\n"
-      "  float sinTheta = sin(theta);\n"
-      "  float cosTheta = cos(theta);\n" );
+      "  highp float percent = (uRadius - distance) / uRadius;\n"
+      "  highp float theta = percent * percent * uAngle * 4.0;\n"
+      "  highp float sinTheta = sin(theta);\n"
+      "  highp float cosTheta = cos(theta);\n" );
       // if warp, loose the sign from sin
   if( warp )
   {