diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-08 22:50:57 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 19:50:57 -0800 |
| commit | 2249d6ffb19e4db8580c76ccb04ab4ca3ddc8394 (patch) | |
| tree | a5d975e79c60fe735a5d9f5948a5534e3a37ec5b /tests/hlsl-intrinsic | |
| parent | 63b8d9e1d0b0bba66f13013aa6b80bd9fab4036b (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/hlsl-intrinsic')
| -rw-r--r-- | tests/hlsl-intrinsic/texture-lod-shadow.slang | 8 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/texture/texture-intrinsics.slang | 27 |
2 files changed, 29 insertions, 6 deletions
diff --git a/tests/hlsl-intrinsic/texture-lod-shadow.slang b/tests/hlsl-intrinsic/texture-lod-shadow.slang index bc78a9382..bfe2e10fc 100644 --- a/tests/hlsl-intrinsic/texture-lod-shadow.slang +++ b/tests/hlsl-intrinsic/texture-lod-shadow.slang @@ -6,10 +6,14 @@ RWStructuredBuffer<float4> result; SamplerComparisonState s; // CHECK: OpSourceExtension "GL_EXT_texture_shadow_lod" -// CHECK: %{{[0-9]*}} = OpImageSampleDrefExplicitLod %float %{{[0-9]*}} %{{[0-9]*}} %float_0_5 Lod|ConstOffset %float_0 %{{[0-9]*}} +// CHECK: %{{[0-9]*}} = OpImageSampleDrefExplicitLod %float %{{[0-9]*}} %{{[0-9]*}} %{{[0-9]*}} Lod|ConstOffset %float_0 %{{[0-9]*}} +// CHECK: %{{[0-9]*}} = OpImageSampleDrefExplicitLod %float %{{[0-9]*}} %{{[0-9]*}} %{{[0-9]*}} Lod|ConstOffset %float_1_5 %{{[0-9]*}} [numthreads(1,1,1)] void computeMain() { result[0] = t2dArray.SampleCmpLevelZero(s, float3(1, 2, 3), 0.5, int2(0, 0)); -}
\ No newline at end of file + + float level = 1.5; + result[1] = t2dArray.SampleCmpLevel(s, float3(1, 2, 3), 0.5, level, int2(0, 0)); +} diff --git a/tests/hlsl-intrinsic/texture/texture-intrinsics.slang b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang index 0543c71b2..e13389ccb 100644 --- a/tests/hlsl-intrinsic/texture/texture-intrinsics.slang +++ b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang @@ -105,6 +105,25 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) #endif /* + float Object.SampleCmpLevel(). + These require SM 6.7 for dx12 but functional compute tests currently do not run with the cs_6_7, + hence only enable these for vk. + */ +#if defined(VK) + float level = 1.0; + val += t1D.SampleCmpLevel(shadowSampler, u, 0, level); + val += t2D.SampleCmpLevel(shadowSampler, float2(u, u), 0, level); + val += t1DArray.SampleCmpLevel(shadowSampler, float2(u, u), 0, level); + val += tCube.SampleCmpLevel(shadowSampler, normalize(float3(u, 1 - u, u)), 0, level); + val += t2DArray.SampleCmpLevel(shadowSampler, normalize(float3(u, 1 - u, u)), 0, level); + val += tCubeArray.SampleCmpLevel(shadowSampler, normalize(float4(u, 1-u, u, u)), 0, level); + + // Offset variant + val += t1D.SampleCmpLevel(shadowSampler, u, 0, level, 0); + val += t2D.SampleCmpLevel(shadowSampler, float2(u, u), 0, level, int2(0, 0)); +#endif + + /* void Object.GetDimensions() */ t1D.GetDimensions(width); @@ -353,7 +372,7 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) // DX12CS6: 377 // DX12CS6: 377 // DX12CS6: 377 -// VK: 351 -// VK: 351 -// VK: 351 -// VK: 351
\ No newline at end of file +// VK: 359 +// VK: 359 +// VK: 359 +// VK: 359 |
