summaryrefslogtreecommitdiff
path: root/tests/hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hlsl')
-rw-r--r--tests/hlsl/combined-texture-sampler.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/hlsl/combined-texture-sampler.slang b/tests/hlsl/combined-texture-sampler.slang
new file mode 100644
index 000000000..986ac3468
--- /dev/null
+++ b/tests/hlsl/combined-texture-sampler.slang
@@ -0,0 +1,25 @@
+//TEST:SIMPLE(filecheck=CHECK): -target hlsl -entry fragMain -profile ps_6_0
+//TEST:SIMPLE(filecheck=DXIL): -target dxil -entry fragMain -profile ps_6_0
+
+// Check that we can correctly cross compile combined texture samplers to HLSL.
+
+// DXIL: define void @fragMain()
+
+// CHECK-DAG: Texture2D<float4 > sampler_texture{{.*}} : register(t0);
+// CHECK-DAG: SamplerState sampler_sampler{{.*}} : register(s0);
+Sampler2D sampler;
+
+// CHECK-DAG: Texture2D<float4 > followingTexture{{.*}} : register(t1);
+Texture2D followingTexture;
+
+// CHECK-DAG: SamplerState followingSamplerState{{.*}} : register(s1);
+SamplerState followingSamplerState;
+
+// CHECK-DAG: Texture2D<float4 > explicitBindingSampler_texture{{.*}} : register(t4);
+// CHECK-DAG: SamplerState explicitBindingSampler_sampler{{.*}} : register(s3);
+Sampler2D explicitBindingSampler : register(t4): register(s3);
+
+float4 fragMain() : SV_Target
+{
+ return sampler.Sample(float2(0, 0)) + explicitBindingSampler.Sample(float2(0, 0)) + followingTexture.Sample(followingSamplerState, float2(0,0));
+} \ No newline at end of file