summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/shader_gles2.cpp32
-rw-r--r--drivers/gles2/shaders/canvas.glsl2
-rw-r--r--drivers/gles2/shaders/scene.glsl1
3 files changed, 17 insertions, 18 deletions
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 84bd413abb..c0d62117b9 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -364,14 +364,14 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
strings.push_back(fragment_code1.get_data());
if (cc) {
- code_string = cc->fragment.ascii();
+ code_string = cc->light.ascii();
strings.push_back(code_string.get_data());
}
strings.push_back(fragment_code2.get_data());
if (cc) {
- code_string2 = cc->light.ascii();
+ code_string2 = cc->fragment.ascii();
strings.push_back(code_string2.get_data());
}
@@ -588,22 +588,24 @@ void ShaderGLES2::setup(
fragment_code0 = code.substr(0, cpos).ascii();
code = code.substr(cpos + globals_tag.length(), code.length());
- cpos = code.find(code_tag);
+ cpos = code.find(light_code_tag);
- if (cpos == -1) {
- fragment_code1 = code.ascii();
- } else {
+ String code2;
+
+ if (cpos != -1) {
fragment_code1 = code.substr(0, cpos).ascii();
- String code2 = code.substr(cpos + code_tag.length(), code.length());
-
- cpos = code2.find(light_code_tag);
- if (cpos == -1) {
- fragment_code2 = code2.ascii();
- } else {
- fragment_code2 = code2.substr(0, cpos).ascii();
- fragment_code3 = code2.substr(cpos + light_code_tag.length(), code2.length()).ascii();
- }
+ code2 = code.substr(cpos + light_code_tag.length(), code.length());
+ } else {
+ code2 = code;
+ }
+
+ cpos = code2.find(code_tag);
+ if (cpos == -1) {
+ fragment_code2 = code2.ascii();
+ } else {
+ fragment_code2 = code2.substr(0, cpos).ascii();
+ fragment_code3 = code2.substr(cpos + code_tag.length(), code2.length()).ascii();
}
}
}
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 87a615ade1..8d32627bf2 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -73,8 +73,6 @@ void main() {
vec4 outvec = vec4(vertex.xy, 0.0, 1.0);
uv_interp = uv_attrib;
-
-
#endif
{
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 30dc55cc4c..32721c892b 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -1913,7 +1913,6 @@ FRAGMENT_SHADER_CODE
#ifdef USE_SHADOW
{
highp vec4 splane = shadow_coord;
- splane.xyz /= splane.w;
float shadow = sample_shadow(light_shadow_atlas, splane);
light_att *= shadow;