From 4b2e847d1161071db1b1dd18d659fba9c2114310 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Wed, 17 Jul 2024 15:14:01 -0400 Subject: [PATCH] tests: Test string escape sequences. --- tests/hlsl/strings.shader_test | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/hlsl/strings.shader_test b/tests/hlsl/strings.shader_test index 6954ef20..546da7f5 100644 --- a/tests/hlsl/strings.shader_test +++ b/tests/hlsl/strings.shader_test @@ -49,3 +49,52 @@ float4 main() : sv_target { return 0; } + + +% Escape sequences are hanlded differently in DXC. +% Octal, hexadecimal, and unicode escape sequences that are out of range are considered errors. +[pixel shader todo fail(sm>=6)] +string a = "\nAAA\tBBB\rCCC\fDDD\vEEE\sFFF"; +string b = "\\AAA\"BBB\'CCC\?DDD\aEEE\bFFF\sGGG"; +string c = "\52 AAA\052 BBB\0521 CCC\52a DDD\241 EEE\441 FFF\02 GGG\0 HHH"; +string d = "\x AAA\x8 BBB\x2A CCC\x2A1 DDD\241 EEE"; +string e = "AAA\x21111111111111121 BBB\x2ah CCC\xFFFF2a GGG\X0"; +string f = "\e[41m AAA\e41 \u002a \U002a BBB\80CCC "; + +float4 main() : sv_target { return 0; } + + +[require] +shader model >= 5.0 +shader model < 6.0 + +[effect todo] +float4 f +< + string a = "\nAAA\tBBB\rCCC\fDDD\vEEE\sFFF"; + string b = "\\AAA\"BBB\'CCC\?DDD\aEEE\bFFF\sGGG"; + string c = "\52 AAA\052 BBB\0521 CCC\52a DDD\241 EEE\441 FFF\02 GGG\0 HHH"; + string d = "\x AAA\x8 BBB\x2A CCC\x2A1 DDD\241 EEE"; + string e = "AAA\x21111111111111121 BBB\x2ah CCC\xFFFF2a GGG\X0"; + string f = "\e[41m AAA\e41 \u002a \U002a BBB\80CCC "; +>; + +float4 main() : sv_target { return 0; } + +// Native compiler's output is: +// +// cbuffer $Globals +// { +// float4 f +// < +// String a = " +// CCC BBB +// DDD +// EEEsFFF"; +// String b = "\AAA"BBB'CCC?DDDEEFFFsGGG"; +// String c = "* AAA* BBB*1 CCC*a DDD¡ EEE! FFF GGG"; +// String d = "x AA BBB* CCC¡ DDD¡ EEE"; +// String e = "AAA! BBB*h CCC* GGGX0"; +// String f = "e[41m AAAe41 u002a U002a BBB80CCC "; +// >; // Offset: 0, size: 16 +// }