Hey there,
Global shaders have the ability to provide a hint to a distributed shader mangers (UBA practically speaking), that maybe it shouldn’t attempt to group them together.
e.g:
static EShaderCompileJobPriority GetOverrideJobPriority() { // FClusteredShadingPS takes up to 11s on average return EShaderCompileJobPriority::ExtraHigh; }
We recently found the need to do this in materials (a very specific and naughty uber material was hogging up UBA for like 15 minutes on a single job), locally I’ve done this by adding this to the UMaterialInstance class:
#if WITH_EDITORONLY_DATA UPROPERTY() uint8 bSlowCompileMaterial : 1 = 0; #endif // WITH_EDITORONLY_DATA
And inside of `FMaterialShaderMap::SubmitCompileJobs`, jimmied this in:
#if WITH_EDITORONLY_DATA if (UMaterialInterface* Interface = Material->GetMaterialInterface()) { // If the material is a "slow compile" and isn't set to force-local, change it to extra-high. // This causes a distributed job to only be a single shader, rather than a group, preventing // batches from taking an excessive amount of time and hogging UBA nodes. if (Interface->bSlowCompileMaterial && (InPriority != EShaderCompileJobPriority::ForceLocal)) { InPriority = EShaderCompileJobPriority::ExtraHigh; } } #endif // WITH_EDITORONLY_DATA
I was recommended that this may be something worth suggesting, as I’m sure we’re not the only ones with cumbersome to compile materials.
Many thanks,
Alister