diff options
Diffstat (limited to 'drivers/gles2/shader_gles2.cpp')
| -rw-r--r-- | drivers/gles2/shader_gles2.cpp | 14 | 
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index 628a57c06d..c5a67d4e75 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -196,6 +196,12 @@ static void _display_error_with_code(const String &p_error, const Vector<const c  	ERR_PRINTS(p_error);  } +static String _mkid(const String &p_id) { + +	String id = "m_" + p_id; +	return id.replace("__", "_dus_"); //doubleunderscore is reserverd in glsl +} +  ShaderGLES2::Version *ShaderGLES2::get_current_version() {  	Version *_v = version_map.getptr(conditional_version); @@ -492,15 +498,15 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {  	if (cc) {  		// uniforms  		for (int i = 0; i < cc->custom_uniforms.size(); i++) { -			StringName native_uniform_name = "m_" + cc->custom_uniforms[i]; -			GLint location = glGetUniformLocation(v.id, ((String)native_uniform_name).ascii().get_data()); +			String native_uniform_name = _mkid(cc->custom_uniforms[i]); +			GLint location = glGetUniformLocation(v.id, (native_uniform_name).ascii().get_data());  			v.custom_uniform_locations[cc->custom_uniforms[i]] = location;  		}  		// textures  		for (int i = 0; i < cc->texture_uniforms.size(); i++) { -			StringName native_uniform_name = "m_" + cc->texture_uniforms[i]; -			GLint location = glGetUniformLocation(v.id, ((String)native_uniform_name).ascii().get_data()); +			String native_uniform_name = _mkid(cc->texture_uniforms[i]); +			GLint location = glGetUniformLocation(v.id, (native_uniform_name).ascii().get_data());  			v.custom_uniform_locations[cc->texture_uniforms[i]] = location;  		}  	}  |