summaryrefslogtreecommitdiff
path: root/tests/metal/texture.slang
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-05-14 20:28:28 -0700
committerGitHub <noreply@github.com>2024-05-14 20:28:28 -0700
commitcc88530a722cc2ce7a09f2a39dadeeb504e2f221 (patch)
tree2b2c3e56a4f4e13044a370f792e3d386b3d3f2ac /tests/metal/texture.slang
parent4edc72e4dea47cf549b4e28940e3509a5ab61439 (diff)
Support combined textures for Metal target (#4169)
Diffstat (limited to 'tests/metal/texture.slang')
-rw-r--r--tests/metal/texture.slang28
1 files changed, 9 insertions, 19 deletions
diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang
index fc9347bea..be93d3a5f 100644
--- a/tests/metal/texture.slang
+++ b/tests/metal/texture.slang
@@ -12,12 +12,6 @@
#define NEED_TO_TEST_FOR_METAL_CAPABILITY 1
#endif
-#if defined(EMIT_SOURCE)
- // It appears that Slang-test doesn't initialize the depth cube texture
- // properly.
- #define TEST_WHEN_DEPTH_CUBE_WORKS
-#endif
-
//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
@@ -92,7 +86,7 @@ typealias depthcube_array = __TextureImpl<
//TEST_INPUT: Texture2D(size=4, content = one):name d2D
depth2d<float> d2D;
-//TEST_INPUT: Texture2D(size=4, content = one):name dCube
+//TEST_INPUT: TextureCube(size=4, content = one):name dCube
depthcube<float> dCube;
//TEST_INPUT: Texture2D(size=4, content = one, arrayLength=2):name d2DArray
depth2d_array<float> d2DArray;
@@ -248,7 +242,7 @@ bool TEST_texture_float()
// METAL: tCube{{.*}}.calculate_clamped_lod({{.*}}
// METALLIB: call {{.*}}.calculate_clamped_lod_texture_cube(
- && float(0) == tCube.CalculateLevelOfDetail(samplerState, float3(u, u, u))
+ && float(0) == tCube.CalculateLevelOfDetail(samplerState, normalize(float3(u, 1 - u, u)))
// METAL: t2DArray{{.*}}.calculate_clamped_lod({{.*}}
// METALLIB: call {{.*}}.calculate_clamped_lod_texture_2d_array(
@@ -256,7 +250,7 @@ bool TEST_texture_float()
// METAL: tCubeArray{{.*}}.calculate_clamped_lod({{.*}}
// METALLIB: call {{.*}}.calculate_clamped_lod_texture_cube_array(
- && float(0) == tCubeArray.CalculateLevelOfDetail(samplerState, float3(u, u, u))
+ && float(0) == tCubeArray.CalculateLevelOfDetail(samplerState, normalize(float3(u, 1 - u, u)))
// ========================================
// float CalculateLevelOfDetailUnclamped()
@@ -317,7 +311,7 @@ bool TEST_texture_float()
// METAL: tCubeArray{{.*}}.sample({{.*}}
// METALLIB: call {{.*}}.sample_texture_cube_array.v4f32(
- && all(Tv(1) == tCubeArray.Sample(samplerState, normalize(float4(u, 1 - u, u, 0))))
+ && all(Tv(1) == tCubeArray.Sample(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// Offset variant
@@ -387,7 +381,7 @@ bool TEST_texture_float()
// METAL: tCubeArray{{.*}}.sample({{.*}}
// METALLIB: call {{.*}}.sample_texture_cube_array.v4f32(
- && all(Tv(1) == tCubeArray.SampleBias(samplerState, normalize(float4(u, 1 - u, u, 0)), float(-1)))
+ && all(Tv(1) == tCubeArray.SampleBias(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), float(-1)))
// Offset variant
@@ -469,17 +463,15 @@ bool TEST_texture_float()
// METAL: d2DArray{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32(
- && float(1) == d2DArray.SampleCmp(shadowSampler, normalize(float3(u, 1 - u, u)), 0)
+ && float(1) == d2DArray.SampleCmp(shadowSampler, float3(u, u, 0), 0)
-#if defined(TEST_WHEN_DEPTH_CUBE_WORKS)
// METAL: dCube{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_cube.f32(
&& float(1) == dCube.SampleCmp(shadowSampler, normalize(float3(u, 1 - u, u)), 0)
// METAL: dCubeArray{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32(
- && float(1) == dCubeArray.SampleCmp(shadowSampler, normalize(float4(u, 1-u, u, u)), 0)
-#endif
+ && float(1) == dCubeArray.SampleCmp(shadowSampler, float4(normalize(float3(u, 1 - u, u)), 0), 0)
// Offset variant
@@ -497,17 +489,15 @@ bool TEST_texture_float()
// METAL: d2DArray{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_2d_array.f32(
- && float(1) == d2DArray.SampleCmpLevelZero(shadowSampler, normalize(float3(u, 1 - u, u)), 0)
+ && float(1) == d2DArray.SampleCmpLevelZero(shadowSampler, float3(u, u, 0), 0)
-#if defined(TEST_WHEN_DEPTH_CUBE_WORKS)
// METAL: dCube{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_cube.f32(
&& float(1) == dCube.SampleCmpLevelZero(shadowSampler, normalize(float3(u, 1 - u, u)), 0)
// METAL: dCubeArray{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_cube_array.f32(
- && float(1) == dCubeArray.SampleCmpLevelZero(shadowSampler, normalize(float4(u, 1-u, u, u)), 0)
-#endif
+ && float(1) == dCubeArray.SampleCmpLevelZero(shadowSampler, float4(normalize(float3(u, 1-u, u)), 0), 0)
// Offset variant