diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-05 15:25:20 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-05 15:45:49 +0300 |
commit | 91250022d003ec8909e1a602445a637d51124dc0 (patch) | |
tree | f9c25150a74c4570caaed903eb87e93bebf03e44 /source/blender/draw/engines | |
parent | f6ce2c1f7862ac572582681ef466aef5c8997289 (diff) |
EEVEE-Next: Depth Of Field: Avoid Framebuffer setup cost for each redraw
Using 2 framebuffer, if the temp textures are the same across redraws,
we can avoid the setup cost.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc | 5 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_depth_of_field.hh | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc index 4b136e183bc..3700076153e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc @@ -685,6 +685,7 @@ void DepthOfField::render(GPUTexture **input_tx, SwapChain<TextureFromPool, 2> &color_tx = is_background ? color_bg_tx_ : color_fg_tx_; SwapChain<TextureFromPool, 2> &weight_tx = is_background ? weight_bg_tx_ : weight_fg_tx_; + Framebuffer &scatter_fb = is_background ? scatter_bg_fb_ : scatter_fg_fb_; DRWPass *gather_ps = is_background ? gather_bg_ps_ : gather_fg_ps_; DRWPass *filter_ps = is_background ? filter_bg_ps_ : filter_fg_ps_; DRWPass *scatter_ps = is_background ? scatter_bg_ps_ : scatter_fg_ps_; @@ -711,9 +712,9 @@ void DepthOfField::render(GPUTexture **input_tx, GPU_memory_barrier(GPU_BARRIER_FRAMEBUFFER); - scatter_fb_.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(color_tx.current())); + scatter_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(color_tx.current())); - GPU_framebuffer_bind(scatter_fb_); + GPU_framebuffer_bind(scatter_fb); DRW_draw_pass(scatter_ps); /* Used by scatter pass. */ diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.hh b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.hh index 6b235489d18..8c291b241bd 100644 --- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.hh +++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.hh @@ -122,7 +122,8 @@ class DepthOfField { DRWPass *filter_bg_ps_ = nullptr; /** Scatter convolution: A quad is emitted for every 4 bright enough half pixels. */ - Framebuffer scatter_fb_ = {"dof_scatter"}; + Framebuffer scatter_fg_fb_ = {"dof_scatter_fg"}; + Framebuffer scatter_bg_fb_ = {"dof_scatter_bg"}; DRWPass *scatter_fg_ps_ = nullptr; DRWPass *scatter_bg_ps_ = nullptr; |