From a4ca0918883f877f6ce48cedeb4e6050fbb2c74f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 8 Feb 2022 09:52:15 +0300 Subject: [PATCH] vkd3d-shader/hlsl: Fix floating point literals matching. Signed-off-by: Nikolay Sivov Signed-off-by: Giovanni Mascellani Signed-off-by: Henri Verbeet Signed-off-by: Matteo Bruni Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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 c1edfe7e..267c8c30 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 2fce3909..40576887 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