Custom effect compile error: Input limit exceeded

The effect compiler that MonoGame uses seems to be less optimized than the XNA one. Most of my effects were just below the 64 instruction limit, but with MonoGame they are over the limit.

This pixel shader input struct worked fine in XNA, but MonoGame gives the error “Input limit (8) exceeded, shader uses 9 inputs”. Why is that, and how do I fix it…

struct VertexShaderOutput
{
    float4	PositionPS	: POSITION;		// POSITION may not be used in Pixel shader
	float2	TexCoord	: TEXCOORD0;
	float4	PositionWS	: TEXCOORD1;
	float3	NormalWS	: TEXCOORD2;
	float4	Diffuse		: COLOR0;		// diffuse.rgb and alpha
	
	float3 Reflection : TEXCOORD3; // for reflection/environment mapping
    float3 Fresnel : COLOR1;	// for reflection/environment mapping
    float2 DistanceFromViewer : TEXCOORD4;
    float4 ScreenPosition : TEXCOORD5; // copy the screen pos. info here...
    float2 ScanLinesTexCoords	: TEXCOORD6;
};

What shader model are you using, changing that might help you out

I am using ps_4_0_level_9_3.

try to change to 4_0 or 5_0

Thanks. I got it to build with ps_4_0.
This raises the hardware requirements but I will use it for now, just to get the project running…

judging from your input it doesn’t look like you target hardware from before 2004 (which would be 9_3) anyways :slight_smile:

EDIT: Here you go
4_0_level_9_3 is basically sm 2.0 ( - 2.0 (4_0_level_9_3) )

No I don’t. The CPU requirements are much higher than a 2004 pc could handle.
Perhaps I should use this opportunity to upgrade the graphics requirements so they come more in step with the other hardware requirements.