From 2249d6ffb19e4db8580c76ccb04ab4ca3ddc8394 Mon Sep 17 00:00:00 2001 From: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Date: Wed, 8 Jan 2025 22:50:57 -0500 Subject: Add SampleCmpLevel intrinsics (#6004) * add SampleCmpLevel intrinsics * update tests * fix typo * fix broken glsl test * refactor SampleCmpLevelZero * fix metallib test * fix broken test on dx12 --------- Co-authored-by: Yong He --- tests/metal/texture-sampler-less.slang | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/metal/texture-sampler-less.slang') diff --git a/tests/metal/texture-sampler-less.slang b/tests/metal/texture-sampler-less.slang index 188b15469..78d092e17 100644 --- a/tests/metal/texture-sampler-less.slang +++ b/tests/metal/texture-sampler-less.slang @@ -448,6 +448,33 @@ bool TEST_texture_float() // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(1) == d2D.SampleCmpLevelZero(float2(u2, u), 0, int2(0, 0)) + // =================================== + // float SampleCmpLevel() + // =================================== + + // METAL: d2D{{.*}}.sample_compare( + // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( + && float(1) == d2D.SampleCmpLevel(float2(u, u), 0, 1.0) + + // METAL: d2DArray{{.*}}.sample_compare( + // METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32( + && float(1) == d2DArray.SampleCmpLevel(float3(u, u, 0), 0, 1.0) + + // METAL: dCube{{.*}}.sample_compare( + // METALLIB: call {{.*}}.sample_compare_depth_cube.f32( + && float(1) == dCube.SampleCmpLevel(normalize(float3(u, 1 - u, u)), 0, 1.0) + + // METAL: dCubeArray{{.*}}.sample_compare( + // METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32( + && float(1) == dCubeArray.SampleCmpLevel(float4(normalize(float3(u, 1-u, u)), 0), 0, 1.0) + + // Offset variant + + // METAL: d2D{{.*}}.sample_compare( + // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( + && float(1) == d2D.SampleCmpLevel(float2(u2, u), 0, 1.0, int2(0, 0)) + + // ================================== // vector Gather() // ================================== -- cgit v1.2.3