summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-06 11:00:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-06 11:00:23 +0100
commitd321bae91e14c8049a8e5fe3e7f0529fa49fa480 (patch)
tree746fca4e6a79fffd1b816e36513310a1d673991b /drivers/gles3
parent85602efef6c1be4c7e251f1748af385442842011 (diff)
parentac6b25f33ea2f9ddd6fafae5b855a33f87787f67 (diff)
Merge pull request #69633 from clayjohn/GLES3-textures
Use internal texture name when setting texture uniform location in OpenGL renderer
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shader_gles3.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 1dcd17ea0e..69c3ff7c8e 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -36,6 +36,11 @@
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
+static String _mkid(const String &p_id) {
+ String id = "m_" + p_id.replace("__", "_dus_");
+ return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl
+}
+
void ShaderGLES3::_add_stage(const char *p_code, StageType p_stage_type) {
Vector<String> lines = String(p_code).split("\n");
@@ -425,7 +430,7 @@ void ShaderGLES3::_compile_specialization(Version::Specialization &spec, uint32_
}
// textures
for (int i = 0; i < p_version->texture_uniforms.size(); i++) {
- String native_uniform_name = p_version->texture_uniforms[i];
+ String native_uniform_name = _mkid(p_version->texture_uniforms[i]);
GLint location = glGetUniformLocation(spec.id, (native_uniform_name).ascii().get_data());
glUniform1i(location, i + base_texture_index);
}