vkd3d/tests/hlsl/strings.shader_test

143 lines
2.8 KiB
Plaintext
Raw Normal View History

[pixel shader fail(sm>=6)]
String s = "text";
string s2 = "text2";
sTring s3 = "text3";
float4 main() : sv_target
{
return 0;
}
[pixel shader]
typedef float4 sTring;
sTring var = float4(1, 2, 3, 4);
float4 main() : sv_target
{
return 0;
}
[pixel shader fail(sm>=6)]
// Uninitialized strings are allowed for non-fx profiles
String s;
float4 main() : sv_target
{
return 0;
}
[pixel shader fail]
typedef float4 string;
float4 main() : sv_target
{
return 0;
}
[pixel shader fail(sm<6)]
typedef float4 String;
float4 main() : sv_target
{
return 0;
}
[pixel shader fail(sm<6)]
float4 String;
float4 main() : sv_target
{
return 0;
}
2024-07-17 12:14:01 -07:00
2024-08-07 13:57:02 -07:00
% This crashes on fxc using ps_5_0
[pixel shader fail]
struct
{
float a;
string b;
} apple = {1, "foobar"};
float4 main() : sv_target
{
return apple.a;
}
[pixel shader fail]
2024-08-07 13:57:02 -07:00
struct apple
{
float a;
string b;
};
float4 main(struct apple ap = {1, "foobar"}) : sv_target
{
return ap.a;
}
[pixel shader fail]
2024-08-07 13:57:02 -07:00
float4 main(string s = "foobar") : sv_target
{
return 0;
}
[pixel shader fail(sm>=6)]
2024-08-07 13:57:02 -07:00
string strs[2] = {"foo", "bar"};
float4 main() : sv_target { return 0; }
% Test string concatenation
[pixel shader todo]
string str = "foo" "bar"
"baz";
float4 main() : sv_target { return 0; }
2024-07-17 12:14:01 -07:00
% Escape sequences are hanlded differently in DXC.
% Octal, hexadecimal, and unicode escape sequences that are out of range are considered errors.
[pixel shader fail(sm>=6)]
2024-07-17 12:14:01 -07:00
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]
2024-07-17 12:14:01 -07:00
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
// }