Fix: EEVEE: Missing world if only an empty volume object is present

With the latest fixes of #124061, the `pipelines.volume.is_enabled`
predicate is now obsolete.
Replace it by `!current_objects_.is_empty()`.

Fixes #124159
This commit is contained in:
Clément Foucault 2024-07-04 20:32:26 +02:00
parent 26ea1f42c3
commit 3777e53acb
3 changed files with 2 additions and 12 deletions

@ -1099,7 +1099,6 @@ void VolumeLayer::render(View &view, Texture &occupancy_tx)
void VolumePipeline::sync()
{
object_integration_range_ = std::nullopt;
enabled_ = false;
has_scatter_ = false;
has_absorption_ = false;
for (auto &layer : layers_) {
@ -1109,8 +1108,6 @@ void VolumePipeline::sync()
void VolumePipeline::render(View &view, Texture &occupancy_tx)
{
BLI_assert_msg(enabled_, "Trying to run the volume object pipeline with no actual volume calls");
for (auto &layer : layers_) {
layer->render(view, occupancy_tx);
}
@ -1156,7 +1153,6 @@ VolumeLayer *VolumePipeline::register_and_get_layer(Object *ob)
VolumeObjectBounds object_bounds(inst_.camera, ob);
object_integration_range_ = bounds::merge(object_integration_range_, object_bounds.z_range);
enabled_ = true;
/* Do linear search in all layers in order. This can be optimized. */
for (auto &layer : layers_) {
if (!layer->bounds_overlaps(object_bounds)) {

@ -447,8 +447,6 @@ class VolumePipeline {
/* Combined bounds in Z. Allow tighter integration bounds. */
std::optional<Bounds<float>> object_integration_range_;
/* True if any volume (any object type) creates a volume draw-call. Enables the volume module. */
bool enabled_ = false;
/* Aggregated properties of all volume objects. */
bool has_scatter_ = false;
bool has_absorption_ = false;
@ -467,10 +465,6 @@ class VolumePipeline {
std::optional<Bounds<float>> object_integration_range() const;
bool is_enabled() const
{
return enabled_;
}
bool has_scatter() const
{
for (auto &layer : layers_) {

@ -89,7 +89,7 @@ void VolumeModule::object_sync(const ObjectHandle &ob_handle)
void VolumeModule::end_sync()
{
enabled_ = inst_.world.has_volume() || inst_.pipelines.volume.is_enabled();
enabled_ = inst_.world.has_volume() || !current_objects_.is_empty();
const Scene *scene_eval = inst_.scene;
@ -405,7 +405,7 @@ void VolumeModule::draw_prepass(View &main_view)
* We need custom culling for these but that's not implemented yet. */
volume_view.visibility_test(false);
if (inst_.pipelines.volume.is_enabled()) {
if (!current_objects_.is_empty()) {
inst_.pipelines.volume.render(volume_view, occupancy_tx_);
}
DRW_stats_group_end();