Got PassBuilder shader dependency working and removed critical flag from shader builder
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Atom/RHI/RHISystemInterface.h>
|
||||
|
||||
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderAsset.h>
|
||||
|
||||
#include <Atom/RPI.Public/RPIUtils.h>
|
||||
@@ -20,7 +21,7 @@ namespace AZ
|
||||
namespace RPI
|
||||
{
|
||||
|
||||
Data::AssetId GetShaderAssetId(const AZStd::string& shaderFilePath)
|
||||
Data::AssetId GetShaderAssetId(const AZStd::string& shaderFilePath, bool isCritical)
|
||||
{
|
||||
Data::AssetId shaderAssetId;
|
||||
|
||||
@@ -34,6 +35,19 @@ namespace AZ
|
||||
|
||||
if (!shaderAssetId.IsValid())
|
||||
{
|
||||
if (isCritical)
|
||||
{
|
||||
Data::Asset<RPI::ShaderAsset> shaderAsset = RPI::AssetUtils::LoadCriticalAsset<RPI::ShaderAsset>(shaderFilePath);
|
||||
if (shaderAsset.IsReady())
|
||||
{
|
||||
return shaderAsset.GetId();
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("RPI Utils", false, "Could not load critical shader [%s]", shaderFilePath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
AZ_Error("RPI Utils", false, "Failed to get asset id for shader [%s]", shaderFilePath.c_str());
|
||||
}
|
||||
|
||||
@@ -83,11 +97,23 @@ namespace AZ
|
||||
return FindShaderAsset(GetShaderAssetId(shaderFilePath), shaderFilePath);
|
||||
}
|
||||
|
||||
Data::Asset<ShaderAsset> FindCriticalShaderAsset(const AZStd::string& shaderFilePath)
|
||||
{
|
||||
const bool isCritical = true;
|
||||
return FindShaderAsset(GetShaderAssetId(shaderFilePath, isCritical), shaderFilePath);
|
||||
}
|
||||
|
||||
Data::Instance<Shader> LoadShader(const AZStd::string& shaderFilePath)
|
||||
{
|
||||
return LoadShader(GetShaderAssetId(shaderFilePath), shaderFilePath);
|
||||
}
|
||||
|
||||
Data::Instance<Shader> LoadCriticalShader(const AZStd::string& shaderFilePath)
|
||||
{
|
||||
const bool isCritical = true;
|
||||
return LoadShader(GetShaderAssetId(shaderFilePath, isCritical), shaderFilePath);
|
||||
}
|
||||
|
||||
AZ::Data::Instance<RPI::StreamingImage> LoadStreamingTexture(AZStd::string_view path)
|
||||
{
|
||||
AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown;
|
||||
|
||||
Reference in New Issue
Block a user