vkd3d-shader/hlsl: Discern between signed and unsigned ints when parsing.

This commit is contained in:
Francisco Casas 2023-11-16 15:32:16 -03:00 committed by Alexandre Julliard
parent 1ee9e23e00
commit 4e1bf5e163
Notes: Alexandre Julliard 2023-11-22 22:49:11 +01:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/478
3 changed files with 27 additions and 5 deletions

View File

@ -203,18 +203,30 @@ while {return KW_WHILE; }
yylval->floatval = atof(yytext);
return C_FLOAT;
}
0x[0-9a-fA-F]+[uU]? {
0x[0-9a-fA-F]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
0[0-7]+[uU]? {
0[0-7]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
[0-9]+[uU]? {
[0-9]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER;
}
0x[0-9a-fA-F]+([uU]|[uU][lL]|[lL][uU]) {
yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
0[0-7]+([uU]|[uU][lL]|[lL][uU]) {
yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
[0-9]+([uU]|[uU][lL]|[lL][uU]) {
yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
{WS}+ {}
{NEWLINE} {

View File

@ -4975,6 +4975,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls
%token <floatval> C_FLOAT
%token <intval> C_INTEGER
%token <intval> C_UNSIGNED
%token <intval> PRE_LINE
%type <list> type_specs
@ -6709,6 +6710,15 @@ primary_expr:
if (!($$ = make_block(ctx, c)))
YYABORT;
}
| C_UNSIGNED
{
struct hlsl_ir_node *c;
if (!(c = hlsl_new_uint_constant(ctx, $1, &@1)))
YYABORT;
if (!($$ = make_block(ctx, c)))
YYABORT;
}
| boolean
{
struct hlsl_ir_node *c;

View File

@ -57,7 +57,7 @@ float4 main() : sv_target
[test]
draw quad
todo(sm<6) probe all rgba (3.0, 250.0, 16.0, 4.2949673e+009) 4
probe all rgba (3.0, 250.0, 16.0, 4.2949673e+009) 4
[require]
@ -73,4 +73,4 @@ float4 main() : sv_target
[test]
draw quad
todo probe all rgba (-1294967296.0, 3000000000.0, 0.0, 0.0) 4
probe all rgba (-1294967296.0, 3000000000.0, 0.0, 0.0) 4