Skip to content

Cannot create SamplerComparisonState in HLSL #10

@LilithSilver

Description

@LilithSilver

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions