Allow usage of depth texture when contact shadows are disabled

This commit is contained in:
KaadmY 2019-02-01 12:46:43 -08:00
parent 869887641f
commit d116705538
2 changed files with 7 additions and 1 deletions

View File

@ -2343,6 +2343,10 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
state.used_screen_texture = true; state.used_screen_texture = true;
} }
if (p_material->shader->spatial.uses_depth_texture) {
state.used_depth_texture = true;
}
if (p_depth_pass) { 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)) 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; current_material_index = 0;
state.used_sss = false; state.used_sss = false;
state.used_screen_texture = false; state.used_screen_texture = false;
state.used_depth_texture = false;
//fill list //fill list
for (int i = 0; i < p_cull_count; i++) { 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); 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); glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
glReadBuffer(GL_COLOR_ATTACHMENT0); glReadBuffer(GL_COLOR_ATTACHMENT0);

View File

@ -204,6 +204,7 @@ public:
bool cull_disabled; bool cull_disabled;
bool used_sss; bool used_sss;
bool used_screen_texture; bool used_screen_texture;
bool used_depth_texture;
bool using_contact_shadows; bool using_contact_shadows;
VS::ViewportDebugDraw debug_draw; VS::ViewportDebugDraw debug_draw;