Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Keenuts opened this issue May 13, 2024 · 0 comments · Fixed by #6618
Closed

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

Keenuts opened this issue May 13, 2024 · 0 comments · Fixed by #6618
Labels
enhancement Feature suggestion sm6.7 spirv Work related to SPIR-V

Comments

@Keenuts
Copy link
Collaborator

Keenuts commented May 13, 2024

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.

@Keenuts Keenuts added enhancement Feature suggestion spirv Work related to SPIR-V sm6.7 labels May 13, 2024
Keenuts added a commit to Keenuts/DirectXShaderCompiler that referenced this issue May 14, 2024
SampleCmpLevel is similar to SampleCmpLevel0, except the LOD level can
be specified using either a const-offset, or a variable.
This should be available starting SM6.7

Fixes microsoft#6613

Signed-off-by: Nathan Gauër <[email protected]>
Keenuts added a commit that referenced this issue May 22, 2024
SampleCmpLevel is similar to SampleCmpLevel0, except the LOD level can
be specified using either a const-offset, or a variable. This should be
available starting SM6.7

Fixes #6613

---------

Signed-off-by: Nathan Gauër <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature suggestion sm6.7 spirv Work related to SPIR-V
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant