Fixed a couple builders to avoid adding job dependencies on source files that don't exist.
This removes mostly benign (but noisy) messages about "Failed to find builder dependency". Changed AssetUtils::GetPossibleDepenencyPaths to return all possible source paths, rather than stopping when one is found. This function is now used to report a list of all possible source dependencies, so that CreateJobs will get called by the AP whenever a file shows up at one of those locations. If a file was missing before and then appears, this will cause the builders to wake up and add the appropriate job dependencies on the new files. In ShaderVariantAssetBuilder and MaterialBuilder, we now use GetPossibleDepenencyPaths to report source dependencies rather than job dependencies. We only report a job dependency when the actual source file has been identified. This should all now be consistent with the intended design of the AP's dependency systems (the prior approach was a hack based on misunderstanding of what source dependencies are). SrgLayoutBuilder's change is a bit tricky. The above changes did not fix all of the "Failed to find builder dependency" messages because AzslBuilder sometimes skips particular files in CreateJobs. When this happens, it is invalid to report an AzslBuilder job dependency on that file. So I copied the same conditional code that is used to skip an azsli file in CreateJobs, and used that to skip AddAzslBuilderJobDependency() in SrgLayoutBuilder as well. With all these changes combined, I do think we've solved the issue where jobs fail to evict outdated jobs, as described in ATOM-15134. However, we are not yet seeing the iteration time improvements we were hoping for. Before these changes I was seeing roughly a 0.5 minute delay for the initial change, and a 2 minute delay for a subsequent change. With these changes it's more like 0.5 mibutes and 1.5 minutes. It appears that the AP scan is being starved by all the AssetBuilder processing going on, and perhaps IO contention. I suspect that this will be greatly improved on the development branch where we no longer have AzslBuilder and SrgLayoutBuilder slowing things down. ATOM-15136 Builder dependency errors reported in mainline ATOM-15134 Replace GetPossibleDepenencyPaths Approach with Source Dependencies
This commit is contained in:
@@ -109,31 +109,16 @@ namespace AZ
|
||||
|
||||
AZStd::vector<AZStd::string> GetPossibleDepenencyPaths(const AZStd::string& originatingSourceFilePath, const AZStd::string& referencedSourceFilePath)
|
||||
{
|
||||
// We potentially add the parent dependency as both a direct path and a relative path rather than use AssetUtils::ResolvePathReference
|
||||
// because there is no guarantee that the Asset Processor has seen the parent file yet (which ResolvePathReference requires).
|
||||
// In that case, we have to add both possible locations because we don't know where it will show up.
|
||||
|
||||
AZStd::vector<AZStd::string> results;
|
||||
|
||||
// The first dependency we add is using the referencedSourceFilePath as a relative path. This gives relative paths priority over asset-root paths.
|
||||
// Use the referencedSourceFilePath as a relative path starting at originatingSourceFilePath
|
||||
AZStd::string combinedPath = originatingSourceFilePath;
|
||||
AzFramework::StringFunc::Path::StripFullName(combinedPath);
|
||||
AzFramework::StringFunc::Path::Join(combinedPath.c_str(), referencedSourceFilePath.c_str(), combinedPath);
|
||||
results.push_back(combinedPath);
|
||||
|
||||
// If the parent file exists at the relative path, then there is no need to report a dependency on the asset-root path.
|
||||
bool assetFound = false;
|
||||
AZ::Data::AssetInfo sourceInfo;
|
||||
AZStd::string watchFolder;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(assetFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GetSourceInfoBySourcePath, combinedPath.c_str(), sourceInfo, watchFolder);
|
||||
|
||||
if (!assetFound)
|
||||
{
|
||||
// The parent file wasn't found at the relative path, so we need a dependency on the asset-root path in case the file
|
||||
// exists there. Note, we still keep the relative path dependency above because we don't know whether it's missing because
|
||||
// it doesn't exist, or just because the AP hasn't found it yet.
|
||||
results.push_back(referencedSourceFilePath);
|
||||
}
|
||||
// Use the referencedSourceFilePath as a standard asset path
|
||||
results.push_back(referencedSourceFilePath);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user