summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-11-10 10:48:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-11-10 10:48:18 -0300
commitf00b52270503de8bebc01f5bd8e813f54ee9b62c (patch)
tree68d79d5b268fa34177e5f3f41a17037598376ba2
parent3226b44f793ec18f92341819e11ae20d68d0193e (diff)
Avoid double underscore from breaking glsl compiler, fixes #12880
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp7
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp3
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 082c520480..723c44f2f6 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -80,11 +80,8 @@ static String _opstr(SL::Operator p_op) {
static String _mkid(const String &p_id) {
- StringBuffer<> id;
- id += "m_";
- id += p_id;
-
- return id.as_string();
+ String id = "m_" + p_id;
+ return id.replace("__", "_dus_"); //doubleunderscore is reserverd in glsl
}
static String f2sp0(float p_float) {
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index be36b41417..03619b941c 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -167,7 +167,8 @@ static String _opstr(SL::Operator p_op) {
static String _mkid(const String &p_id) {
- return "m_" + p_id;
+ String id = "m_" + p_id;
+ return id.replace("__", "_dus_"); //doubleunderscore is reserverd in glsl
}
static String f2sp0(float p_float) {