summaryrefslogtreecommitdiffstats
path: root/tests/metal
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-01-08 22:50:57 -0500
committerGitHub <noreply@github.com>2025-01-08 19:50:57 -0800
commit2249d6ffb19e4db8580c76ccb04ab4ca3ddc8394 (patch)
treea5d975e79c60fe735a5d9f5948a5534e3a37ec5b /tests/metal
parent63b8d9e1d0b0bba66f13013aa6b80bd9fab4036b (diff)
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 <yonghe@outlook.com>
Diffstat (limited to 'tests/metal')
-rw-r--r--tests/metal/texture-sampler-less.slang27
-rw-r--r--tests/metal/texture.slang31
2 files changed, 57 insertions, 1 deletions
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<T,4> Gather()
// ==================================
diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang
index 37c8fa286..feb0b4738 100644
--- a/tests/metal/texture.slang
+++ b/tests/metal/texture.slang
@@ -3,7 +3,7 @@
//TEST:SIMPLE(filecheck=HLSL): -stage compute -entry computeMain -target hlsl -DEXCLUDE_INTEGER_TYPE
//TEST:SIMPLE(filecheck=SPIR): -stage compute -entry computeMain -target spirv -emit-spirv-directly -DEXCLUDE_HALF_TYPE -DEXCLUDE_SHORT_TYPE
-//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-slang -compute -dx12 -profile cs_6_6 -use-dxil -shaderobj -output-using-type -xslang -DEXCLUDE_INTEGER_TYPE
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-slang -compute -dx12 -profile cs_6_6 -use-dxil -shaderobj -output-using-type -xslang -DEXCLUDE_INTEGER_TYPE -xslang -DEXCLUDE_SM_6_7
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DEXCLUDE_HALF_TYPE -xslang -DEXCLUDE_SHORT_TYPE
//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer
@@ -567,6 +567,35 @@ bool TEST_texture(
// METALLIB: call {{.*}}.sample_compare_depth_2d.f32(
&& float(0) == d2D.SampleCmpLevelZero(shadowSampler, float2(u2, u), 0, int2(0, 0))
+ // ===================================
+ // float SampleCmpLevel()
+ // ===================================
+
+ // These require SM 6.7 for dx12 but functional compute tests currently do not run with the cs_6_7.
+#if !defined(EXCLUDE_SM_6_7)
+ // METAL: d2D{{.*}}.sample_compare(
+ // METALLIB: call {{.*}}.sample_compare_depth_2d.f32(
+ && float(0) == d2D.SampleCmpLevel(shadowSampler, float2(u, u), 0, 0.0)
+
+ // METAL: d2DArray{{.*}}.sample_compare(
+ // METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32(
+ && float(0) == d2DArray.SampleCmpLevel(shadowSampler, float3(u, u, 0), 0, 0.0)
+
+ // METAL: dCube{{.*}}.sample_compare(
+ // METALLIB: call {{.*}}.sample_compare_depth_cube.f32(
+ && float(0) == dCube.SampleCmpLevel(shadowSampler, normalize(float3(u, 1 - u, u)), 0, 0.0)
+
+ // METAL: dCubeArray{{.*}}.sample_compare(
+ // METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32(
+ && float(0) == dCubeArray.SampleCmpLevel(shadowSampler, float4(normalize(float3(u, 1-u, u)), 0), 0, 0.0)
+
+ // Offset variant
+
+ // METAL: d2D{{.*}}.sample_compare(
+ // METALLIB: call {{.*}}.sample_compare_depth_2d.f32(
+ && float(0) == d2D.SampleCmpLevel(shadowSampler, float2(u2, u), 0, 0.0, int2(0, 0))
+#endif
+
// ==================================
// vector<T,4> Gather()
// ==================================