EEVEE: Compile probe passes in parallel
Right now probe passes are compiled one by one, since passes are only requested if `materials.queued_shaders_count` is 0 and requesting a pass will increase the number. This splits the logic into 2 functions, one for checking if sync is needed and another to check if pass shaders are needed. This allows compiling the shaders in parallel. Pull Request: https://projects.blender.org/blender/blender/pulls/122799
This commit is contained in:
@@ -371,26 +371,24 @@ void Instance::render_sync()
|
||||
DRW_curves_update();
|
||||
}
|
||||
|
||||
bool Instance::needs_lightprobe_sphere_passes() const
|
||||
{
|
||||
return sphere_probes.update_probes_this_sample_;
|
||||
}
|
||||
|
||||
bool Instance::do_lightprobe_sphere_sync() const
|
||||
{
|
||||
if (!sphere_probes.update_probes_this_sample_) {
|
||||
return false;
|
||||
}
|
||||
if (materials.queued_shaders_count > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (materials.queued_shaders_count == 0) && needs_lightprobe_sphere_passes();
|
||||
}
|
||||
|
||||
bool Instance::needs_planar_probe_passes() const
|
||||
{
|
||||
return planar_probes.update_probes_;
|
||||
}
|
||||
|
||||
bool Instance::do_planar_probe_sync() const
|
||||
{
|
||||
if (!planar_probes.update_probes_) {
|
||||
return false;
|
||||
}
|
||||
if (materials.queued_shaders_count > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (materials.queued_shaders_count == 0) && needs_planar_probe_passes();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -197,6 +197,13 @@ class Instance {
|
||||
bool do_lightprobe_sphere_sync() const;
|
||||
bool do_planar_probe_sync() const;
|
||||
|
||||
/**
|
||||
* Return true when probe passes should be loaded.
|
||||
* It can be true even if do_<type>_probe_sync() is false due to shaders still being compiled.
|
||||
*/
|
||||
bool needs_lightprobe_sphere_passes() const;
|
||||
bool needs_planar_probe_passes() const;
|
||||
|
||||
/* Render. */
|
||||
|
||||
void render_sync();
|
||||
|
||||
@@ -322,7 +322,8 @@ Material &MaterialModule::material_sync(Object *ob,
|
||||
mat.overlap_masking = MaterialPass();
|
||||
mat.capture = MaterialPass();
|
||||
|
||||
if (inst_.do_lightprobe_sphere_sync() && !(ob->visibility_flag & OB_HIDE_PROBE_CUBEMAP)) {
|
||||
if (inst_.needs_lightprobe_sphere_passes() && !(ob->visibility_flag & OB_HIDE_PROBE_CUBEMAP))
|
||||
{
|
||||
mat.lightprobe_sphere_prepass = material_pass_get(
|
||||
ob, blender_mat, MAT_PIPE_PREPASS_DEFERRED, geometry_type, MAT_PROBE_REFLECTION);
|
||||
mat.lightprobe_sphere_shading = material_pass_get(
|
||||
@@ -333,7 +334,7 @@ Material &MaterialModule::material_sync(Object *ob,
|
||||
mat.lightprobe_sphere_shading = MaterialPass();
|
||||
}
|
||||
|
||||
if (inst_.do_planar_probe_sync() && !(ob->visibility_flag & OB_HIDE_PROBE_PLANAR)) {
|
||||
if (inst_.needs_planar_probe_passes() && !(ob->visibility_flag & OB_HIDE_PROBE_PLANAR)) {
|
||||
mat.planar_probe_prepass = material_pass_get(
|
||||
ob, blender_mat, MAT_PIPE_PREPASS_PLANAR, geometry_type, MAT_PROBE_PLANAR);
|
||||
mat.planar_probe_shading = material_pass_get(
|
||||
|
||||
Reference in New Issue
Block a user