瀏覽代碼

Avoid double underscore from breaking glsl compiler, fixes #12880

Juan Linietsky 6 年之前
父節點
當前提交
f00b522705
共有 2 個文件被更改,包括 4 次插入6 次删除
  1. 2 5
      drivers/gles2/shader_compiler_gles2.cpp
  2. 2 1
      drivers/gles3/shader_compiler_gles3.cpp

+ 2 - 5
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) {

+ 2 - 1
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) {