diff options
author | Bastiaan Olij <mux213@gmail.com> | 2021-08-15 13:38:36 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-15 13:38:36 +1000 |
commit | 57e16812a1a4b89058de29e81247351afdd09087 (patch) | |
tree | f387beef1574661b5de7822ffbe0def52a22bee3 /servers/rendering/renderer_rd/forward_mobile | |
parent | 8781c9536e56164c999badd360aa984c0ed8ae42 (diff) | |
parent | 4002650cb93302a7898a7119145a0e7091c05379 (diff) |
Merge pull request #51507 from BastiaanOlij/fix_screen_and_depth_texture
Fix read from screen and depth texture
Diffstat (limited to 'servers/rendering/renderer_rd/forward_mobile')
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index f810ae2454..ddd2a26d71 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -414,7 +414,8 @@ RID RenderForwardMobile::_setup_render_pass_uniform_set(RenderListType p_render_ RD::Uniform u; u.binding = 9; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID texture = (false && rb && rb->depth.is_valid()) ? rb->depth : storage->texture_rd_get_default(RendererStorageRD::DEFAULT_RD_TEXTURE_WHITE); + RID dbt = rb ? render_buffers_get_back_depth_texture(p_render_data->render_buffers) : RID(); + RID texture = (dbt.is_valid()) ? dbt : storage->texture_rd_get_default(RendererStorageRD::DEFAULT_RD_TEXTURE_WHITE); u.ids.push_back(texture); uniforms.push_back(u); } @@ -752,6 +753,16 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color RD::get_singleton()->draw_command_end_label(); // Render 3D Pass / Render Reflection Probe Pass } + if (scene_state.used_screen_texture) { + // Copy screen texture to backbuffer so we can read from it + _render_buffers_copy_screen_texture(p_render_data); + } + + if (scene_state.used_depth_texture) { + // Copy depth texture to backbuffer so we can read from it + _render_buffers_copy_depth_texture(p_render_data); + } + // transparent pass RD::get_singleton()->draw_command_begin_label("Render Transparent Subpass"); |