From: Mikko Rasa Date: Tue, 20 Apr 2021 15:15:08 +0000 (+0300) Subject: Make sure folded float constants appear as correct type X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=29fb23fb9c6eb32b1157a09cf79754a630702f9e;p=libs%2Fgl.git 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. --- 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;