summaryrefslogtreecommitdiffstats
path: root/tests/hlsl
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-04-17 22:14:34 -0700
committerGitHub <noreply@github.com>2024-04-17 22:14:34 -0700
commit5dd27a26da9b6b6191f3b1eba0f38f85714c1ae3 (patch)
tree2a596911523b003746e2cfda2847ffd02d332ef3 /tests/hlsl
parent355a8d8f923ef67f11092ae706b50d028b09f9ad (diff)
Support combined texture sampler when targeting HLSL. (#3963)
* Support combined texture sampler when targeting HLSL. * Fix glsl intrinsics. * Update source/slang/slang-ir-lower-combined-texture-sampler.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> * Update source/slang/slang-ir-lower-combined-texture-sampler.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> * Update source/slang/slang-ir-lower-combined-texture-sampler.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> * Fix., * Enhance test. * Remove unused field. * Fix indentation --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
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