- Home /
Compiling shaders to OpenGL ES 2.0, Xbox 360, PS3, Flash or DX11 requires both vertex and fragment programs
This shader comes from the sewer example level if I remember correct (Unity 2 or 3) With the 4.5 update it generates the following warning:
Compiling shaders to OpenGL ES 2.0, Xbox 360, PS3, Flash or DX11 requires both vertex and fragment programs
The line error is the one with CGPROGRAM I don't know enough of shaders to fix this :/ I see it has a #pragma fragment so I guess it needs a #pragma vertex, trying to add it myself resulted in a brown texture instead of water :) Or can the warning be ignored?
Also unrelated to this error, I commented out some stuff that does not seem to have a visual effect, in the assumption this will increase performance?
Shader "River"
{
Properties
{
_Color ("Color", color) = (1,1,1,0)
_BumpAmt ("Distortion", range (0,128)) = 10
_DistortSpeed ("Disort speed", range (0.01,0.50)) = 0.04
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Bumpmap (RGB)", 2D) = "bump" {}
}
SubShader
{
Tags
{
"Queue" = "Transparent-10"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
}
GrabPass
{
Name "BASE"
Tags
{
"LightMode" = "Always"
}
}
Pass
{
Name "BASE"
Tags
{
"LightMode" = "Always"
}
zwrite off
Cull Back
CGPROGRAM
#pragma exclude_renderers gles
#pragma fragment frag
//#pragma fragmentoption ARB_precision_hint_fastest
//#pragma fragmentoption ARB_fog_exp2
//#include "UnityCG.cginc"
sampler2D _GrabTexture : register(s0);
float4 _GrabTexture_TexelSize;
sampler2D _BumpMap : register(s1);
sampler2D _MainTex : register(s2);
struct v2f
{
float4 uvgrab : TEXCOORD0;
float2 uvbump : TEXCOORD1;
float2 uvmain : TEXCOORD2;
};
uniform float _BumpAmt;
uniform float _DistortSpeed;
float4 _Color;
half4 frag( v2f i ) : COLOR
{
half2 bump = tex2D( _BumpMap, i.uvbump + _Time * _DistortSpeed ).rg * 2 - 1;
float2 offset = bump * _BumpAmt;
offset *= _GrabTexture_TexelSize.xy;
i.uvgrab.xy = offset * i.uvgrab.z + i.uvgrab.xy;
half4 col = tex2Dproj( _GrabTexture, i.uvgrab.xyw );
half4 tint = tex2D( _MainTex, i.uvmain );
return col *_Color;
}
ENDCG
// Does not show any visual changes
//SetTexture [_GrabTexture] {} // Texture we grabbed in the pass above
//SetTexture [_BumpMap] {} // Perturbation bumpmap
//SetTexture [_MainTex] {} // Color tint
}
}
SubShader
{
Blend DstColor Zero
Pass
{
Name "BASE"
SetTexture [_MainTex] { combine texture }
}
}
FallBack "Transparant/Bumped Diffuse"
}
Hm since its a warning and I am not using Xbox 360, PS3, Flash or DX11 I can ignore it?
Your answer
![](https://koobas.hobune.stream/wayback/20220613152848im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can i trust the Unity shader compiler more than i can trust myself? 0 Answers
Shader compiler error - failed to read correct magic number 2 Answers
Shader error in ... : Syntax error at line 30 1 Answer
Compile Shader Variants Taking a Very Long Time 2 Answers
How can I use UnityShaderCompiler.exe? 2 Answers