Fix: EEVEE: Material without Closure flag skip rendering

If a deferred layer doesn't contain any material with
a non-null closure flag, the deferred layer is skipped.

However, material with null closure flag exists and
still need to render opaque.

Fix this case by modifying the closure bits for the
deferred and probe pipelines.

Candidate for backporting to 4.2

Fix #126459
This commit is contained in:
Clément Foucault
2024-08-23 16:44:54 +02:00
parent 205d95107e
commit 0d4c76c986

View File

@@ -750,6 +750,12 @@ PassMain::Sub *DeferredLayer::prepass_add(::Material *blender_mat,
PassMain::Sub *DeferredLayer::material_add(::Material *blender_mat, GPUMaterial *gpumat)
{
eClosureBits closure_bits = shader_closure_bits_from_flag(gpumat);
if (closure_bits == eClosureBits(0)) {
/* Fix the case where there is no active closure in the shader.
* In this case we force the evaluation of emission to avoid disabling the entire layer by
* accident, see #126459. */
closure_bits |= CLOSURE_EMISSION;
}
closure_bits_ |= closure_bits;
closure_count_ = max_ii(closure_count_, count_bits_i(closure_bits));
@@ -1269,6 +1275,12 @@ PassMain::Sub *DeferredProbePipeline::prepass_add(::Material *blender_mat, GPUMa
PassMain::Sub *DeferredProbePipeline::material_add(::Material *blender_mat, GPUMaterial *gpumat)
{
eClosureBits closure_bits = shader_closure_bits_from_flag(gpumat);
if (closure_bits == eClosureBits(0)) {
/* Fix the case where there is no active closure in the shader.
* In this case we force the evaluation of emission to avoid disabling the entire layer by
* accident, see #126459. */
closure_bits |= CLOSURE_EMISSION;
}
opaque_layer_.closure_bits_ |= closure_bits;
opaque_layer_.closure_count_ = max_ii(opaque_layer_.closure_count_, count_bits_i(closure_bits));
@@ -1380,6 +1392,12 @@ PassMain::Sub *PlanarProbePipeline::prepass_add(::Material *blender_mat, GPUMate
PassMain::Sub *PlanarProbePipeline::material_add(::Material *blender_mat, GPUMaterial *gpumat)
{
eClosureBits closure_bits = shader_closure_bits_from_flag(gpumat);
if (closure_bits == eClosureBits(0)) {
/* Fix the case where there is no active closure in the shader.
* In this case we force the evaluation of emission to avoid disabling the entire layer by
* accident, see #126459. */
closure_bits |= CLOSURE_EMISSION;
}
closure_bits_ |= closure_bits;
closure_count_ = max_ii(closure_count_, count_bits_i(closure_bits));