HLSL is More Strict on the Xbox 360
I ran into this problem recently, and I thought it would be a good point to note, especially for anyone who doesn’t have access to an Xbox but would like their code to work on one.
When writing shaders, remember that the Xbox is more strict than a PC. Make sure your input parameters match the vertex definition (and likewise, the other way around). So if you’re using a VertexPositionColor, make sure you’re looking for something like this:
VertexToPixel myVertexShader(float4 inPos : POSITION, float4 inColor : COLOR0)
Likewise, if you’re looking for a texture coordinate, don’t use the COLOR semantic, even if that’s what you’re going to be using it for. e.g., if you’re passing a VertexPositionTexture3 (a 3D texture coordinate you may have defined) but your vertex shader looks like this:
VertexToPixel myVertexShader(float4 inPos : POSITION, float3 inColor : COLOR0)
It’s not going to work…and worse yet, it’s not going to tell you why. This can be particularly troublesome if you’re developing without an Xbox on hand. Make sure your shader takes the correct parameters instead:
VertexToPixel myVertexShader(float4 inPos : POSITION, float3 inTex : TEXCOORD0)
While the former may work on a PC, it won’t work on the Xbox 360.