From 725735a87b9d223c2afc83bbd049055b1e44a976 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 May 2024 10:43:49 -0700 Subject: RasterizerOrder resource for spirv and metal. (#4175) * RasterizerOrder resource for spirv and metal. Also fixes the byte address buffer logic for metal. * Fix. * Delete commented lines. --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> --- tests/hlsl/raster-order-resource.slang | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/hlsl/raster-order-resource.slang (limited to 'tests/hlsl') diff --git a/tests/hlsl/raster-order-resource.slang b/tests/hlsl/raster-order-resource.slang new file mode 100644 index 000000000..2db9f31dc --- /dev/null +++ b/tests/hlsl/raster-order-resource.slang @@ -0,0 +1,50 @@ +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -fvk-use-entrypoint-name +//TEST:SIMPLE(filecheck=METAL): -target metal +//TEST:SIMPLE(filecheck=METALASM): -target metallib + + +// METAL-DAG: {{.*}}{{\[\[}}raster_order_group(0){{\]\]}} {{\[\[}}buffer(0) +// METAL-DAG: {{.*}}{{\[\[}}raster_order_group(0){{\]\]}} {{\[\[}}texture(0) +// METAL-DAG: {{.*}}{{\[\[}}raster_order_group(0){{\]\]}} {{\[\[}}buffer(1) + +// METALASM: @fragMain + +RasterizerOrderedByteAddressBuffer buffer; + +[shader("fragment")] +float4 fragMain() : SV_Target +{ + // SPIRV: %fragMain_0 = OpFunction + // SPIRV: OpBeginInvocationInterlockEXT + // SPIRV: OpEndInvocationInterlockEXT + + buffer.Store(0, 0x12345678); + return float4(1, 0, 0, 1); +} + +RasterizerOrderedTexture2D tex; + +[shader("fragment")] +float4 fragMain2() : SV_Target +{ + // SPIRV: %fragMain2_0 = OpFunction + // SPIRV: OpBeginInvocationInterlockEXT + // SPIRV: OpEndInvocationInterlockEXT + + tex[uint2(0, 0)] = float4(1, 0, 0, 1); + return float4(1, 0, 0, 1); +} + +RasterizerOrderedStructuredBuffer buffer2; + +[shader("fragment")] +float4 fragMain3() : SV_Target +{ + // SPIRV: %fragMain3_0 = OpFunction + // SPIRV: OpBeginInvocationInterlockEXT + // SPIRV: OpEndInvocationInterlockEXT + + buffer2[0] = 1; + return float4(1, 0, 0, 1); +} + -- cgit v1.2.3