summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-04 15:40:05 +0100
committerGitHub <noreply@github.com>2019-01-04 15:40:05 +0100
commit1504c961125c76f007bc2ff061c3854effbe3e56 (patch)
tree192a5581b86e46cc5f0cad7ab9709a33bc769174 /drivers/gles3
parent99c4faf83769f7016a8657ff6aa82ef26766fa14 (diff)
parent9f266cf7e5aa0c9953599453595a5720e9d0b08f (diff)
Merge pull request #24539 from BastiaanOlij/override_gl_position
Override GL_position
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shaders/scene.glsl8
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 7e41323697..56446b33ff 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -838,6 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
+ actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
@@ -903,6 +904,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 8b1f18ccbd..df1645db1f 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -306,6 +306,10 @@ void main() {
uv2_interp = uv2_attrib;
#endif
+#ifdef OVERRIDE_POSITION
+ highp vec4 position;
+#endif
+
#if defined(USE_INSTANCING) && defined(ENABLE_INSTANCE_CUSTOM)
vec4 instance_custom = instance_custom_data;
#else
@@ -461,7 +465,11 @@ VERTEX_SHADER_CODE
#endif //RENDER_DEPTH
+#ifdef OVERRIDE_POSITION
+ gl_Position = position;
+#else
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
+#endif
position_interp = gl_Position;