CGPROGRAM parse error

hi, I’m learning to write shaders and I’ve come across a very annoying problem on my very first shader.
The erros says “parse error” at line 8, but line 8 contains only “CGPROGRAM”… please help me with this. Here is the code i wrote

Shader "Real_Slim_Shaders/flatColor"{
	
	Properties{
		_Color("Color", Color) = (1.0,1.0,1.0)
		}
	SubShader{
		Pass{
			CGPROGRAM
			
			//pragmas
			#pragma vertex vert
			#pragma fragment frag
			
			//user defined variables
			uniform float4 _Color;
			
			//base input structs
			struct vertexInput{
				float4 vertex : POSITION;
				}
			
			struct vertexOutput{
				float4 pos : SV_POSITION;
				}
			
			//vertex function
			vertexOutput vert(vertexInput v){
				vertexOutput o;
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
				return o;
				}
			
			//fragment function
			float4 frag(vertexOutput i) : COLOR{
				return _Color;
				}
			
			ENDCG
			
			}
			
		}
		Fallback "Diffuse"
	}

1 Answer

1

You’re missing semicolons at the end of your struct definitions.

struct vertexInput{
  float4 vertex : POSITION;
};
 
struct vertexOutput{
  float4 pos : SV_POSITION;
};

wow… thanks a lot, I've spent so much time on this silly little problem but couldn't find it. another persons view sure does help a lot.