summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_scene_gles3.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-12 11:38:44 +0100
committerGitHub <noreply@github.com>2019-02-12 11:38:44 +0100
commit279bfb3503ff034615d38df6405b7ebd7751ce95 (patch)
tree5ad8ee751386d1876944e9bdc5b06f9ac8bebc5f /drivers/gles3/rasterizer_scene_gles3.cpp
parentf60e5efadd57d7d8330a6082f524b835e0378902 (diff)
parentd116705538fe0c625e0b40d56f3d6ecfe3bbb4aa (diff)
Merge pull request #25557 from kaadmy/master
Allow usage of depth texture when contact shadows are disabled
Diffstat (limited to 'drivers/gles3/rasterizer_scene_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 966466d9bc..31f42493a3 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -2343,6 +2343,10 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
state.used_screen_texture = true;
}
+ if (p_material->shader->spatial.uses_depth_texture) {
+ state.used_depth_texture = true;
+ }
+
if (p_depth_pass) {
if (has_blend_alpha || p_material->shader->spatial.uses_depth_texture || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS))
@@ -3159,6 +3163,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
current_material_index = 0;
state.used_sss = false;
state.used_screen_texture = false;
+ state.used_depth_texture = false;
//fill list
for (int i = 0; i < p_cull_count; i++) {
@@ -4169,7 +4174,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glColorMask(1, 1, 1, 1);
- if (state.used_contact_shadows) {
+ if (state.used_contact_shadows || state.used_depth_texture) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
glReadBuffer(GL_COLOR_ATTACHMENT0);