From 15358b808be0cf6ab20ff2d2e23b82fa9a2cf30d Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Fri, 31 Jan 2020 09:11:17 +0300 Subject: [PATCH] Fix shader crash if using multiple underscores in identifier names --- drivers/gles2/shader_compiler_gles2.cpp | 2 +- drivers/gles3/shader_compiler_gles3.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 24b89aedc27..5dec6f2fee6 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -80,7 +80,7 @@ static String _opstr(SL::Operator p_op) { static String _mkid(const String &p_id) { - String id = "m_" + p_id; + String id = "m_" + p_id.replace("__", "_dus_"); return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl } diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index f43943bdff2..4e4d896bd7e 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -166,7 +166,7 @@ static String _opstr(SL::Operator p_op) { static String _mkid(const String &p_id) { - String id = "m_" + p_id; + String id = "m_" + p_id.replace("__", "_dus_"); return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl }