From b58ff893a57f3bb165ae77fd28a942c29b86b418 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Thu, 17 Apr 2025 17:37:06 -0500 Subject: [PATCH] tests/hlsl: Add tests for 3D textures. --- tests/hlsl/sampler.shader_test | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/hlsl/sampler.shader_test b/tests/hlsl/sampler.shader_test index 7e5db1153..09e906061 100644 --- a/tests/hlsl/sampler.shader_test +++ b/tests/hlsl/sampler.shader_test @@ -50,6 +50,31 @@ float4 main() : sv_target return tex2D(s, float2(0.0, 0.0)) + tex3D(s, float3(0.0, 0.0, 0.0)); } +[sampler 0] +filter linear linear linear +address clamp clamp clamp + +[srv 0] +size (3d, 2, 2, 2) +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 + +0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 +0.0 1.0 0.0 0.0 1.0 1.0 1.0 0.0 + +[pixel shader] +sampler s; +Texture3D t; + +float4 main() : sv_target +{ + return t.Sample(s, float3(0.5, 0.5, 0.5)); +} + +[test] +draw quad +probe (0, 0) f32(0.25, 0.5, 0.25, 0) + [require] options: backcompat @@ -164,6 +189,26 @@ draw quad if(sm<4) probe (0, 0) rgba(243, 243, 243, 111) if(sm>=4) probe (0, 0) rgba(234, 234, 234, 111) +[srv 0] +size (3d, 2, 2, 2) +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 + +0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 +0.0 1.0 0.0 0.0 1.0 1.0 1.0 0.0 + +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] +sampler s; + +float4 main() : sv_target +{ + return tex3D(s, float3(0.5, 0.5, 0.5)); +} + +[test] +draw quad +probe (0, 0) f32(0.25, 0.5, 0.25, 0) + [require] shader model >= 4.0