struct VertexShaderOutput
{
float4 Position : POSITION;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
The above is unused and is only needed if you actually are using a vertex shader.
In that case this would be the input to the pixel shader.
Since there is none im surmising from shown code you are using this pixel shader with sprite batch or intend too. In that case the input to the (your) pixel shader that you sent to spriteBatch.Begin(…) must match BasicEffects VertexShader output. Like so…
//float4 PsSpriteBatch(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
//{
// float4 col = tex2D(TextureSampler, texCoord) * color;
// return col;
//}
//technique SpriteBatchPixelShader
//{
// pass P0
// {
// PixelShader = compile PS_SHADERMODEL
// PsSpriteBatch();
// }
//}
also…
_spriteBatch.Draw(screenTexture, Vector2.Zero, Color.White);
The texture sampler you use in your shader needs to be assigned specifically to registers and textures that match what and were spritebatch is recieving the texture itself.
//Texture2D Texture : register(t0);
//sampler TextureSampler : register(s0)
//{
// Texture = (Texture);
//};
if you are going to use your own…
Texture2D SpriteTexture;
sampler2D SpriteTextureSampler = sampler_state
{
Texture = (SpriteTexture);
// AddressU = CLAMP;
// AddressV = CLAMP;
// MagFilter = LINEAR;
// MinFilter = LINEAR;
// Mipfilter = LINEAR;
};
Then that has to be additionally set from Game1 by setting it to your effect.
That is accomplished as follows.
effect.Parameters[“SpriteTexture”].SetValue( YourContentLoadedTextureHere );
Just prior or after begin should be fine to your previously shown Game1 draw code.
_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, effect);
_spriteBatch.Draw(screenTexture, Vector2.Zero, Color.White);
_spriteBatch.End();
That is a somewhat ambitious starting shader.
I would also suggest using SpriteSortMode.Immediate mode for now till you get more experience.