Mohammad Faizan khan
Mohammad Faizan khan

Reputation: 1235

vert: function return value missing semantics

I am just trying to running this code from unity site

Shader  "UnityExample/Vertex and Fragment/3-Behind Bars" {
    SubShader{
            Pass{
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct vertOut{
                float4 pos: SV_POSITION;
                float4 scrPos;
            };

            vertOut vert(appdata_base v){
                vertOut o;
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.scrPos = ComputeScreenPos(o.pos);
                return o;
            }

            fixed4 frag(vertOut i) : SV_Target{
                float2 wcoord  = (i.scrPos.xy/i.scrPos.w);
                fixed4 color;

                if(fmod(20.0 * wcoord.x,2.0)<1.0){
                    color = fixed4(wcoord.xy,0.0,1.0);
                } else{
                    color = fixed4(0.3,0.3,0.3,1.0);
                }
                return color;
            }
            ENDCG
        }
    }
}

This code is showing me an error on this line

vertOut vert(appdata_base v)

vert: function return value missing semantics

I am using unity 4.6

Upvotes: 1

Views: 4246

Answers (1)

game development germ
game development germ

Reputation: 1334

Semantics is missing for scrPos.

float4 scrPos : TEXCOORD0;

Upvotes: 3

Related Questions