summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-11-19 23:41:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-11-19 23:41:18 -0300
commit78eae047c6df0c6b78750c9ee84f3689f3ae9609 (patch)
treedcd7128859738b59a2677f6e6dc57bcc99a8c417 /drivers/gles2
parentc500581d321ae6519f59b366bb61786d8b74cd68 (diff)
Fixed how floats are printed to the GLSL shader, closes #19803
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 28c0274afa..d52be09cac 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -86,10 +86,11 @@ static String _mkid(const String &p_id) {
static String f2sp0(float p_float) {
- if (int(p_float) == p_float)
- return itos(p_float) + ".0";
- else
- return rtoss(p_float);
+ String num = rtoss(p_float);
+ if (num.find(".") == -1 && num.find("e") == -1) {
+ num += ".0";
+ }
+ return num;
}
static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {