Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
v2: as far as I can tell from testing, it's not allowed to have float literal suffixes without decimal point or exponent.
libs/vkd3d-shader/hlsl.l | 2 +- tests/hlsl-initializer-numeric.shader_test | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index e9281ec..1cc19ad 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -192,7 +192,7 @@ row_major {return KW_ROW_MAJOR; } yylval->floatval = atof(yytext); return C_FLOAT; } -[0-9]+([eE][+-]?[0-9]+)?[h|H|f|F] { +[0-9]+[eE][+-]?[0-9]+[h|H|f|F]? { yylval->floatval = atof(yytext); return C_FLOAT; } diff --git a/tests/hlsl-initializer-numeric.shader_test b/tests/hlsl-initializer-numeric.shader_test index 2fce390..4057688 100644 --- a/tests/hlsl-initializer-numeric.shader_test +++ b/tests/hlsl-initializer-numeric.shader_test @@ -33,3 +33,16 @@ float4 main() : sv_target [test] draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4 + + +[pixel shader] +float4 main() : sv_target +{ + float4 aa = { 1e1, 1e-1, 1., 2.f }; + float4 bb = { .1, .1e1, .2f, 1.e-1f }; + return aa + bb; +} + +[test] +draw quad +probe all rgba (10.1, 1.1, 1.2, 2.1) 4