Skip to content

[SPIR-V][Feature Request][SM6.7] Implement SampleCmpLevel #6613

Description

SM6.7 added SampleCmlLevel which is similar to SampleCmp, but which fixes the LOD at which the comparison is done.

Texture2D<float> tex;
SamplerComparisonState samplerComparisonState;

float4 main() : SV_Target {
  float tmp = tex.SampleCmpLevel(samplerComparisonState, float2(0, 0), 2, 3);
  return tmp.xxxx;
}
$ dxc -T ps_6_7 shader.hlsl -spirv -fspv-target-env=vulkan1.3
shader.hlsl:7:19: error: intrinsic 'SampleCmpLevel' method unimplemented
  float tmp = tex.SampleCmpLevel(samplerComparisonState, float2(0, 0), 2, 3);

Seems like this could be implemented with a small change in DXC: SampleCmpLevelZero uses the correct instruction, but fixes the LOD to 0. But passing a register is possible, so seems like implementation will be straightforward.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions