From fff79c311028cc8a5cff310a9c493b23af68eb0c Mon Sep 17 00:00:00 2001 From: venkataram-nv Date: Mon, 1 Jul 2024 16:01:21 -0700 Subject: Support HLSL `.sample` operators for MS textures (#4524) * Add `.sample` operator for MS texture types * Adding filecheck tests for `.sample` --- tests/hlsl/texture-sample-operator.slang | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/hlsl/texture-sample-operator.slang (limited to 'tests/hlsl') diff --git a/tests/hlsl/texture-sample-operator.slang b/tests/hlsl/texture-sample-operator.slang new file mode 100644 index 000000000..175470367 --- /dev/null +++ b/tests/hlsl/texture-sample-operator.slang @@ -0,0 +1,27 @@ +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage vertex +//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage vertex +//TEST:SIMPLE(filecheck=METAL): -target metal -stage vertex +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -stage vertex +//TEST:SIMPLE(filecheck=SPIRV): -target spirv-asm -stage vertex + +Texture2DMS t1; +Texture2DMSArray t2; + +float4 main() +{ + // HLSL: .sample + // GLSL: texelFetch + // SPIRV: OpImageFetch %v4int {{.*}} Sample {{.*}} + // METAL: .read + uint2 p1 = uint2(1, 2); + int3 a1 = t1.sample[7][p1]; + + // HLSL: .sample + // GLSL: texelFetch + // SPIRV: OpImageFetch %v4float {{.*}} Sample {{.*}} + // METAL: .read + uint p2 = uint(1); + float4 a2 = t2.sample[p2][uint3(1, 2, 3)]; + + return float4(float3(a1), 0) + a2; +} -- cgit v1.2.3