diff options
| author | Yong He <yonghe@outlook.com> | 2025-01-24 21:39:13 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-24 21:39:13 -0800 |
| commit | 3ecbeacd3b02e2a8c1b9796df1caced0aa34224f (patch) | |
| tree | 6e8ddd208082ca042a7ebac2f5125337b4216a13 /tests | |
| parent | a7958afa5ace2c92e10e1765a5bc33c891d09079 (diff) | |
Fix depth texture sampling on Metal. (#6168)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/metal/depth-texture.slang | 12 | ||||
| -rw-r--r-- | tests/metal/texture.slang | 30 |
2 files changed, 27 insertions, 15 deletions
diff --git a/tests/metal/depth-texture.slang b/tests/metal/depth-texture.slang new file mode 100644 index 000000000..ac15b3f1a --- /dev/null +++ b/tests/metal/depth-texture.slang @@ -0,0 +1,12 @@ +//TEST:SIMPLE(filecheck=CHECK): -target metallib +//CHECK: sample_compare_depth_2d +Texture2D texture; +SamplerComparisonState sampler; + +RWStructuredBuffer<float> output; + +[numthreads(1,1,1)] +void computeMain() +{ + output[0] = texture.SampleCmpLevelZero(sampler, float2(0, 0), 0); +}
\ No newline at end of file diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang index 12274edef..90a42e3d6 100644 --- a/tests/metal/texture.slang +++ b/tests/metal/texture.slang @@ -566,25 +566,25 @@ bool TEST_texture<T>( // float SampleCmp() // ================== - // METAL: d2D{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmp(shadowSampler, float2(u, u), 0) - // METAL: d2DArray{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32( && float(0) == d2DArray.SampleCmp(shadowSampler, float3(u, u, 0), 0) - // METAL: dCube{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_cube.f32( && float(0) == dCube.SampleCmp(shadowSampler, normalize(float3(u, 1 - u, u)), 0) - // METAL: dCubeArray{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32( && float(0) == dCubeArray.SampleCmp(shadowSampler, float4(normalize(float3(u, 1 - u, u)), 0), 0) // Offset variant - // METAL: d2D{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmp(shadowSampler, float2(u2, u), 0, int2(0, 0)) @@ -592,25 +592,25 @@ bool TEST_texture<T>( // float SampleCmpLevelZero() // =================================== - // METAL: d2D{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmpLevelZero(shadowSampler, float2(u, u), 0) - // METAL: d2DArray{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32( && float(0) == d2DArray.SampleCmpLevelZero(shadowSampler, float3(u, u, 0), 0) - // METAL: dCube{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_cube.f32( && float(0) == dCube.SampleCmpLevelZero(shadowSampler, normalize(float3(u, 1 - u, u)), 0) - // METAL: dCubeArray{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32( && float(0) == dCubeArray.SampleCmpLevelZero(shadowSampler, float4(normalize(float3(u, 1-u, u)), 0), 0) // Offset variant - // METAL: d2D{{.*}}.sample_compare( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmpLevelZero(shadowSampler, float2(u2, u), 0, int2(0, 0)) @@ -620,25 +620,25 @@ bool TEST_texture<T>( // 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( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmpLevel(shadowSampler, float2(u, u), 0, 0.0) - // METAL: d2DArray{{.*}}.sample_compare( + // METAL: {{.*}}.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( + // METAL: {{.*}}.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( + // METAL: {{.*}}.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( + // METAL: {{.*}}.sample_compare( // METALLIB: call {{.*}}.sample_compare_depth_2d.f32( && float(0) == d2D.SampleCmpLevel(shadowSampler, float2(u2, u), 0, 0.0, int2(0, 0)) #endif |
