From 29fb23fb9c6eb32b1157a09cf79754a630702f9e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 20 Apr 2021 18:15:08 +0300 Subject: [PATCH] Make sure folded float constants appear as correct type If the value has no fractional part, the default conversion will not add a decimal point. --- source/glsl/optimize.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 63dfcb5c..044dd4e5 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "optimize.h" #include "reflect.h" @@ -617,7 +618,11 @@ void ConstantFolder::visit(RefPtr &expr) else if(r_constant_value.check_type()) literal->token = lexical_cast(r_constant_value.value()); else if(r_constant_value.check_type()) + { literal->token = lexical_cast(r_constant_value.value()); + if(isnumrc(literal->token)) + literal->token += ".0"; + } else { r_constant = false; -- 2.45.2