Merge commit 'b0dfe26232b318e520887af65cd579ec87016636' into amzn-tommy/gitflow_211116_o3de2
Signed-off-by: Tommy Walton <waltont@amazon.com>
This commit is contained in:
@@ -40,7 +40,7 @@ namespace AZ
|
||||
//! Set the timestamp value when the ProcessJob() started.
|
||||
//! This is needed to synchronize between the ShaderAsset and ShaderVariantAsset when hot-reloading shaders.
|
||||
//! The idea is that this timestamp must be greater or equal than the ShaderAsset.
|
||||
void SetBuildTimestamp(AZStd::sys_time_t buildTimestamp);
|
||||
void SetBuildTimestamp(AZ::u64 buildTimestamp);
|
||||
|
||||
//! Assigns a shaderStageFunction, which contains the byte code, to the slot dictated by the shader stage.
|
||||
void SetShaderFunction(RHI::ShaderStage shaderStage, RHI::Ptr<RHI::ShaderStageFunction> shaderStageFunction);
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace AZ
|
||||
Name m_drawListName;
|
||||
|
||||
//! Use to synchronize versions of the ShaderAsset and ShaderVariantTreeAsset, especially during hot-reload.
|
||||
AZStd::sys_time_t m_buildTimestamp = 0;
|
||||
AZ::u64 m_buildTimestamp = 0;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace AZ
|
||||
|
||||
//! Return the timestamp when this asset was built, and it must be >= than the timestamp of the main ShaderAsset.
|
||||
//! This is used to synchronize versions of the ShaderAsset and ShaderVariantAsset, especially during hot-reload.
|
||||
AZStd::sys_time_t GetBuildTimestamp() const;
|
||||
AZ::u64 GetBuildTimestamp() const;
|
||||
|
||||
bool IsRootVariant() const { return m_stableId == RPI::RootShaderVariantStableId; }
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace AZ
|
||||
AZStd::array<RHI::Ptr<RHI::ShaderStageFunction>, RHI::ShaderStageCount> m_functionsByStage;
|
||||
|
||||
//! Used to synchronize versions of the ShaderAsset and ShaderVariantAsset, especially during hot-reload.
|
||||
AZStd::sys_time_t m_buildTimestamp = 0;
|
||||
AZ::u64 m_buildTimestamp = 0;
|
||||
};
|
||||
|
||||
class ShaderVariantAssetHandler final
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace AZ
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Methods for all shader variant types
|
||||
|
||||
void ShaderVariantAssetCreator::SetBuildTimestamp(AZStd::sys_time_t buildTimestamp)
|
||||
void ShaderVariantAssetCreator::SetBuildTimestamp(AZ::u64 buildTimestamp)
|
||||
{
|
||||
if (ValidateIsReady())
|
||||
{
|
||||
|
||||
@@ -202,17 +202,17 @@ namespace AZ
|
||||
return;
|
||||
}
|
||||
AZ_Assert(m_asset->m_buildTimestamp == m_reloadedRootShaderVariantAsset->GetBuildTimestamp(),
|
||||
"shaderAsset timeStamp=%lld, but Root ShaderVariantAsset timeStamp=%lld",
|
||||
"shaderAsset '%s' timeStamp=%lld, but Root ShaderVariantAsset timeStamp=%lld", m_asset.GetHint().c_str(),
|
||||
m_asset->m_buildTimestamp, m_reloadedRootShaderVariantAsset->GetBuildTimestamp());
|
||||
m_asset->UpdateRootShaderVariantAsset(m_supervariantIndex, m_reloadedRootShaderVariantAsset);
|
||||
m_reloadedRootShaderVariantAsset = {}; // Clear the temporary reference.
|
||||
|
||||
if (ShaderReloadDebugTracker::IsEnabled())
|
||||
{
|
||||
auto makeTimeString = [](AZStd::sys_time_t timestamp, AZStd::sys_time_t now)
|
||||
auto makeTimeString = [](AZ::u64 timestamp, AZ::u64 now)
|
||||
{
|
||||
AZStd::sys_time_t elapsedMicroseconds = now - timestamp;
|
||||
double elapsedSeconds = aznumeric_cast<double>(elapsedMicroseconds / 1'000'000);
|
||||
AZ::u64 elapsedMillis = now - timestamp;
|
||||
double elapsedSeconds = aznumeric_cast<double>(elapsedMillis / 1'000);
|
||||
AZStd::string timeString = AZStd::string::format("%lld (%f seconds ago)", timestamp, elapsedSeconds);
|
||||
return timeString;
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::sys_time_t ShaderVariantAsset::GetBuildTimestamp() const
|
||||
AZ::u64 ShaderVariantAsset::GetBuildTimestamp() const
|
||||
{
|
||||
return m_buildTimestamp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user