iOS5 GLSL Shader Problem

My shader is not working anymore on iOS 5 Device (iPhone 4 iOS5.0) - it still works fine on iOS 4.x

Are GLSL Shaders not supported anymore by iOS 5.0 ?

Here is my shader code:

Shader "Water" 
{

	Properties {
		_MainTex ("Texture 1", 2D) = "black" {}
		_Color ("Color", Color) = (1,1,1,1)
		_Color2 ("Color", Color) = (1,1,1,1)
		_SphereTex ("Environment Sphere", 2D) = "black" {}
		
	}
	
	SubShader 
	{
		Tags {
			"RenderType"="Opaque" 
			"Queue"="Transparent-1"
			}
		Cull Back
		
		//AlphaTest Greater 0 
		
		 
		
		zwrite On
		
		Pass 
		{ 
			Name "UNLIT2"
			GLSLPROGRAM
			
			varying mediump vec4 uv;
		 
			varying mediump vec3 normalDirection;
			varying mediump vec3 viewDirection;
			varying mediump vec3 reflectedDirection;
			
		
			#ifdef VERTEX
			uniform mediump vec4 _MainTex_ST;	
			uniform mediump vec4 _MainTex2_ST;	
			uniform mediump vec4 _MyOffsets;			
			uniform mediump vec3 _WorldSpaceCameraPos; // camera position in world space
			uniform mediump mat4 _Object2World; // model matrix
			uniform mediump mat4 _World2Object; // inverse model matrix
			
			void main()
			{       
				gl_Position = gl_ModelViewProjectionMatrix * (gl_Vertex - vec4(0.0, 0.0, 0.0, 0.0));

				uv.xy = gl_MultiTexCoord0.xy * _MainTex_ST.xy + _MainTex_ST.zw + _MyOffsets.xy;
				uv.z += 0.5;
				uv.zw = gl_MultiTexCoord0.xy * _MainTex_ST.xy + _MainTex_ST.zw + _MyOffsets.zw; 
				
				normalDirection = normalize(vec3(vec4(gl_Normal, 0.0) * _World2Object));
				viewDirection = vec3(_Object2World * gl_Vertex - vec4(_WorldSpaceCameraPos, 1.0));		
				 
				reflectedDirection = (normalize(reflect(viewDirection, normalize(normalDirection)))*0.5-0.5) * 0.5 -0.25; 
				
			} 
			
			#endif 
			  
			
			#ifdef FRAGMENT
			
			uniform mediump sampler2D _MainTex;
		 
			uniform mediump sampler2D _SphereTex;
		 
			
			uniform lowp vec4 _Color;
			uniform lowp vec4 _Color2;
			void main()
			{
				mediump float t =  uv.x *1.0 - 0.5;					 
				t*= t * _Color.a;
			 
				mediump vec4 texCol1 = texture2DLod(_MainTex, uv.xy, 0.0);
			 
				texCol1 = texCol1/2.0 + texture2DLod(_MainTex, uv.zw, 0.0)/2.0;
			 
				
			 
				mediump vec4 texCol3 = texture2DLod(_SphereTex, reflectedDirection.xy + texCol1.xy * 0.125, 0.0);
				 
				
				texCol3 = texCol3 * (1.0 - _Color2.a) + _Color2.a * _Color2;
		
				
				gl_FragColor =  texCol3* (1.0 - t) + (t) * _Color;		
			}
			
			#endif
			
			ENDGLSL
		}
	}
}

Can anyone help me out please? The submission should be next week - so I am a bit afraid !:face_with_spiral_eyes:

Try enabling 32 bit for ios5 in build options.

It cames out that texture2DLod is not supported any more on iOS 5.0

have not tried the 32 Bit mode thing, but will do soon. Thank you!

As expected, 32 Bit Buffer does not enable “lod” functions… well no suprise… but anyway it may fix other iOS5.0 issues, thank you anyway. :slight_smile:

I read there were a few ios5 issues solved by going 32 bit, sadly thats not one of them.