Skip to content

[Feature Request] Support full set of comparison sampler variants #5560

@pow2clk

Description

@pow2clk

Is your feature request related to a problem? Please describe.
HLSL is missing the ability to specify comparison samples using mip bias and explicit gradients. Additionally, calculating the level of detail using a comparison sampler is not possible.

Describe the solution you'd like
Add the following build-ins as part of Shader Model 6.8:

  • SampleCmpBias(SamplerComparisonState, ...
  • SampleCmpGrad(SamplerComparisonState, ...
  • CalculateLevelOfDetail(SamplerComparisonState, ...
  • CalculateLevelOfDetailUnclamped(SamplerComparisonState, ...

Describe alternatives you've considered
Plagiarized from Jesse's request below:
The only alternative I can see would be to add a non-comparison sampler to the shader for every comparison sampler, and to rewrite the shader for bias to explicitly compute derivatives, and then for bias/gradient to explicitly compute a mip level (using the non-comparison sampler), and then do an explicit-LOD sample. This is... ugly.

Additional context
See the spec proposal here for details microsoft/hlsl-specs#30

Metadata

Metadata

Assignees

Labels

enhancementFeature suggestionsm6.8Shader Model 6.8

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions