MonoGame
MonoGame copied to clipboard
Cannot create SamplerComparisonState in HLSL
This does not work:
SamplerComparisonState MySampler
{
Filter = COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
AddressU = Clamp;
AddressV = Clamp;
ComparisonFunc = LESS;
};
Nor does this:
SamplerComparisonState MySampler
{
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = POINT;
AddressU = Clamp;
AddressV = Clamp;
ComparisonFunc = LESS;
};
But this does work:
SamplerComparisonState MySampler : register(ps, s0);
var mySampler = new SamplerState()
{
Filter = TextureFilter.LinearMipPoint,
FilterMode = TextureFilterMode.Comparison,
AddressU = TextureAddressMode.Clamp,
AddressV = TextureAddressMode.Clamp,
ComparisonFunction = CompareFunction.Less,
};
device.SamplerStates[0] = mySampler;
However, all 3 compile fine. If this behavior is expected, an error should be produced in the HLSL case.