Fix: EEVEE-Next: Volume: Missing nullptr checks

This was a misusage of the API as it is clearly
written that these functions can return `nullptr`.

Fixes #114131
This commit is contained in:
Clément Foucault
2024-04-18 12:21:10 +02:00
parent d31b459927
commit 5b3bf8f4c9
2 changed files with 13 additions and 6 deletions

View File

@@ -144,11 +144,14 @@ void WorldVolumePipeline::sync(GPUMaterial *gpumat)
world_ps_.material_set(*inst_.manager, gpumat);
/* Bind correct dummy texture for attributes defaults. */
volume_sub_pass(world_ps_, nullptr, nullptr, gpumat);
PassSimple::Sub *sub = volume_sub_pass(world_ps_, nullptr, nullptr, gpumat);
world_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
/* Sync with object property pass. */
world_ps_.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
is_valid_ = (sub != nullptr);
if (is_valid_) {
world_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
/* Sync with object property pass. */
world_ps_.barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS);
}
}
void WorldVolumePipeline::render(View &view)

View File

@@ -84,7 +84,9 @@ static inline void volume_call(
{
if (matpass.sub_pass != nullptr) {
PassMain::Sub *object_pass = volume_sub_pass(*matpass.sub_pass, scene, ob, matpass.gpumat);
object_pass->draw(geom, res_handle);
if (object_pass != nullptr) {
object_pass->draw(geom, res_handle);
}
}
}
@@ -359,7 +361,9 @@ void SyncModule::sync_volume(Object *ob, ObjectHandle & /*ob_handle*/, ResourceH
}
PassMain::Sub *object_pass = volume_sub_pass(
*matpass.sub_pass, inst_.scene, ob, matpass.gpumat);
object_pass->draw(geom, res_handle);
if (object_pass != nullptr) {
object_pass->draw(geom, res_handle);
}
};
drawcall_add(material.volume_occupancy, geom, res_handle);