From 5dd27a26da9b6b6191f3b1eba0f38f85714c1ae3 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 17 Apr 2024 22:14:34 -0700 Subject: 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> --- tests/hlsl/combined-texture-sampler.slang | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/hlsl/combined-texture-sampler.slang (limited to 'tests/hlsl') 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 sampler_texture{{.*}} : register(t0); +// CHECK-DAG: SamplerState sampler_sampler{{.*}} : register(s0); +Sampler2D sampler; + +// CHECK-DAG: Texture2D followingTexture{{.*}} : register(t1); +Texture2D followingTexture; + +// CHECK-DAG: SamplerState followingSamplerState{{.*}} : register(s1); +SamplerState followingSamplerState; + +// CHECK-DAG: Texture2D 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 -- cgit v1.2.3