SamplerStates and Setting a Texture

I realised that adjusting the sampler states using:

sampler ShadowMapSampler = sampler_state
    Texture = <ShadowMap>;
	minfilter = point;
	magfilter = point;
	mipfilter = point;

Doesn’t seem to do anything in MonoGame.

So I used (in the C# code):

    var pointsampler = new SamplerState
        AddressU = TextureAddressMode.Wrap,
        AddressV = TextureAddressMode.Wrap,
        AddressW = TextureAddressMode.Wrap,
        Filter = TextureFilter.Point,

    GraphicsDevice.SamplerStates[0] = linearsampler;

And in the HLSL:

sampler ShadowMapSampler : register(s0);

My question is: How do I set the texture part like I used to?

I would have been able to just sample using:

distanceStoredInDepthMap = tex2D(ShadowMapSampler, lightSamplePos);

But I can’t because there’s no texture set in the sampler.

I’m confused.

What issues are you having with your first approach? MG does support setting sampler state in shaders and it should work like you posted it.

It does? Oh ok, It just seemed like the first approach was making no difference what I changed the sample state to and I read somewhere (I thought) that I had to do it differently.