Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-07-22 21:32:17 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-07-22 21:32:17 +0300
commit676a2f690c3e3fffe2e515208d4d308e0a96e8e6 (patch)
tree1bd40c9540c5f3ca2631666ebd910fe0132fa2a2 /source/blender/draw
parent35843ddcd80e5957656b157650da950f228d2808 (diff)
EEVEE-Next: Fix render not working
The swaps during accumulation were ignored because of the way the `SwapChain<>` implementation works. Using external references and updating them fixes the issue.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_film.cc20
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_film.hh6
2 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_film.cc b/source/blender/draw/engines/eevee_next/eevee_film.cc
index d3b09beedaa..486413a0834 100644
--- a/source/blender/draw/engines/eevee_next/eevee_film.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_film.cc
@@ -393,10 +393,10 @@ void Film::sync()
/* NOTE(@fclem): 16 is the max number of sampled texture in many implementations.
* If we need more, we need to pack more of the similar passes in the same textures as arrays or
* use image binding instead. */
- DRW_shgroup_uniform_image_ref(grp, "in_weight_img", &weight_tx_.current());
- DRW_shgroup_uniform_image_ref(grp, "out_weight_img", &weight_tx_.next());
- DRW_shgroup_uniform_texture_ref_ex(grp, "in_combined_tx", &combined_tx_.current(), filter);
- DRW_shgroup_uniform_image_ref(grp, "out_combined_img", &combined_tx_.next());
+ DRW_shgroup_uniform_image_ref(grp, "in_weight_img", &weight_src_tx_);
+ DRW_shgroup_uniform_image_ref(grp, "out_weight_img", &weight_dst_tx_);
+ DRW_shgroup_uniform_texture_ref_ex(grp, "in_combined_tx", &combined_src_tx_, filter);
+ DRW_shgroup_uniform_image_ref(grp, "out_combined_img", &combined_dst_tx_);
DRW_shgroup_uniform_image_ref(grp, "depth_img", &depth_tx_);
DRW_shgroup_uniform_image_ref(grp, "color_accum_img", &color_accum_tx_);
DRW_shgroup_uniform_image_ref(grp, "value_accum_img", &value_accum_tx_);
@@ -541,6 +541,12 @@ void Film::accumulate(const DRWView *view)
update_sample_table();
+ /* Need to update the static references as there could have change from a previous swap. */
+ weight_src_tx_ = weight_tx_.current();
+ weight_dst_tx_ = weight_tx_.next();
+ combined_src_tx_ = combined_tx_.current();
+ combined_dst_tx_ = combined_tx_.next();
+
data_.display_only = false;
data_.push_update();
@@ -567,6 +573,12 @@ void Film::display()
GPU_framebuffer_bind(dfbl->default_fb);
GPU_framebuffer_viewport_set(dfbl->default_fb, UNPACK2(data_.offset), UNPACK2(data_.extent));
+ /* Need to update the static references as there could have change from a previous swap. */
+ weight_src_tx_ = weight_tx_.current();
+ weight_dst_tx_ = weight_tx_.next();
+ combined_src_tx_ = combined_tx_.current();
+ combined_dst_tx_ = combined_tx_.next();
+
data_.display_only = true;
data_.push_update();
diff --git a/source/blender/draw/engines/eevee_next/eevee_film.hh b/source/blender/draw/engines/eevee_next/eevee_film.hh
index 1be95b3ac6b..4ccd5684396 100644
--- a/source/blender/draw/engines/eevee_next/eevee_film.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_film.hh
@@ -45,8 +45,14 @@ class Film {
Texture depth_tx_;
/** Combined "Color" buffer. Double buffered to allow re-projection. */
SwapChain<Texture, 2> combined_tx_;
+ /** Static reference as SwapChain does not actually move the objects when swapping. */
+ GPUTexture *combined_src_tx_ = nullptr;
+ GPUTexture *combined_dst_tx_ = nullptr;
/** Weight buffers. Double buffered to allow updating it during accumulation. */
SwapChain<Texture, 2> weight_tx_;
+ /** Static reference as SwapChain does not actually move the objects when swapping. */
+ GPUTexture *weight_src_tx_ = nullptr;
+ GPUTexture *weight_dst_tx_ = nullptr;
/** Extent used by the render buffers when rendering the main views. */
int2 render_extent_ = int2(-1);
/** User setting to disable reprojection. Useful for debugging or have a more precise render. */