SamplerStates and Textures in shaders

My problem is my texture is not showing up when I send it to a shader it just colors my object with black.

When I am drawing I send the texture and the samplerState like this:

gd.SamplerStates[0] = samplerState;
gd.Textures[0] = t;

And this is how I am using them in the shader:

Texture2D Texture : register(t0);
SamplerState MySampler : register(s0);

float4 MainPS(VertexShaderOutput input) : COLOR
	float4 textureColor = Texture.Sample(MySampler, input.Texture);
	textureColor.a = 1;

	return textureColor;

But my object is just black doing this.

However when I send the texture via the effect parameters and use a Sampler2d in the shader and the tex2D function the texture shows up but I can’t edit any of the filters which is what I want to do.
I have looked everywhere and I saw a post from 2017 about this and it was said to be a “bug”, and if it is I am confused why until now it hasn’t been fixed…
The method I am using above is the workaround they mentiond and it just doesn’t work.


What is your vertex declaration type?
I think the problem is your MainPS

You need to have as input the texture coordinates , something like this

void MainPS(in  float2 inTexCoord : TEXCOORD0,
                     out float4 outColor   : COLOR)
//... other code here for example
    outColor = tex2D(colorMapSampler, inTexCoord  );

so the input is the texture coordinates that will be used when sampling, in your code I do not see it using in the sampler. I don’t know what else you are trying to do, but if you post more of your code I may be able to find the issue.