diff options
author | clayjohn <claynjohn@gmail.com> | 2024-04-17 15:19:20 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2024-04-17 15:19:20 -0700 |
commit | adfc9ccc440bb1491de7e0debfee8facb8b7a05d (patch) | |
tree | ae98153558705c7976c1b7bcd3943d2434a7e301 /servers/rendering/renderer_rd/effects/copy_effects.cpp | |
parent | 3b1806182a3564736ad64793b203c2c13c251f56 (diff) | |
download | redot-engine-adfc9ccc440bb1491de7e0debfee8facb8b7a05d.tar.gz |
Use a src rect for copying from screen with CanvasGroup in the mobile backend
Diffstat (limited to 'servers/rendering/renderer_rd/effects/copy_effects.cpp')
-rw-r--r-- | servers/rendering/renderer_rd/effects/copy_effects.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/effects/copy_effects.cpp b/servers/rendering/renderer_rd/effects/copy_effects.cpp index 1568867663..a363b03dd8 100644 --- a/servers/rendering/renderer_rd/effects/copy_effects.cpp +++ b/servers/rendering/renderer_rd/effects/copy_effects.cpp @@ -533,7 +533,7 @@ void CopyEffects::copy_to_atlas_fb(RID p_source_rd_texture, RID p_dest_framebuff RD::get_singleton()->draw_list_draw(draw_list, true); } -void CopyEffects::copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y, bool p_force_luminance, bool p_alpha_to_zero, bool p_srgb, RID p_secondary, bool p_multiview, bool p_alpha_to_one, bool p_linear, bool p_normal) { +void CopyEffects::copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y, bool p_force_luminance, bool p_alpha_to_zero, bool p_srgb, RID p_secondary, bool p_multiview, bool p_alpha_to_one, bool p_linear, bool p_normal, const Rect2 &p_src_rect) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); MaterialStorage *material_storage = MaterialStorage::get_singleton(); @@ -568,6 +568,14 @@ void CopyEffects::copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffe copy_to_fb.push_constant.flags |= COPY_TO_FB_FLAG_NORMAL; } + if (p_src_rect != Rect2()) { + copy_to_fb.push_constant.section[0] = p_src_rect.position.x; + copy_to_fb.push_constant.section[1] = p_src_rect.position.y; + copy_to_fb.push_constant.section[2] = p_src_rect.size.x; + copy_to_fb.push_constant.section[3] = p_src_rect.size.y; + copy_to_fb.push_constant.flags |= COPY_TO_FB_FLAG_USE_SRC_SECTION; + } + // setup our uniforms RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); |