From 1b474afdb085748042e2d17c5c2b40b4e8f8a6c1 Mon Sep 17 00:00:00 2001 From: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> Date: Wed, 7 Jul 2021 14:55:36 -0700 Subject: [PATCH 1/7] ATOM-14322 Random crashes when exist RHI/Raytracing sample running __fullTestSuite__ (#1926) Signed-off-by: Tao --- Gems/Atom/RHI/Code/Source/RHI/RayTracingPipelineState.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/Atom/RHI/Code/Source/RHI/RayTracingPipelineState.cpp b/Gems/Atom/RHI/Code/Source/RHI/RayTracingPipelineState.cpp index 5e5932456e..480c11b7c9 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RayTracingPipelineState.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RayTracingPipelineState.cpp @@ -142,6 +142,8 @@ namespace AZ void RayTracingPipelineState::Shutdown() { + ShutdownInternal(); + DeviceObject::Shutdown(); } } } From 5b9647c11b319b5cc3b898754d70730180466e5d Mon Sep 17 00:00:00 2001 From: Tommy Walton <82672795+amzn-tommy@users.noreply.github.com> Date: Wed, 7 Jul 2021 15:08:57 -0700 Subject: [PATCH 2/7] Fix for ATOM-15923 : Editor Spends Several Minutes Entering/Ending Play Game Mode (#1846) * Cut off kd-tree generation if more than 10 percent of triangles straddle split axis Signed-off-by: amzn-tommy * Switched to aznumeric_cast and added a comment with a JIRA to follow up on Signed-off-by: amzn-tommy --- .../RPI/Code/Include/Atom/RPI.Reflect/Model/ModelKdTree.h | 3 ++- Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelKdTree.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelKdTree.h index cd3f1968bf..fc915bcd07 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelKdTree.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelKdTree.h @@ -67,7 +67,8 @@ namespace AZ void ConstructMeshList(const ModelAsset* model, const AZ::Transform& matParent); static const int s_MinimumVertexSizeInLeafNode = 3 * 10; - + // Stop splitting the tree if more than 10% of the triangles are straddling the split axis + static constexpr float s_MaximumSplitAxisStraddlingTriangles = 1.1; AZStd::unique_ptr m_pRootNode; struct MeshData diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp index 54ec002893..ace4df5c0b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp @@ -84,7 +84,11 @@ namespace AZ // If either the top or bottom contain all the input indices, the triangles are too close to cut any // further and the split failed - return indices.size() != outInfo.m_aboveIndices.size() && indices.size() != outInfo.m_belowIndices.size(); + // Additionally, if too many triangles straddle the split-axis, + // the triangles are too close and the split failed + // [ATOM-15944] - Use a more sophisticated method to terminate KdTree generation + return indices.size() != outInfo.m_aboveIndices.size() && indices.size() != outInfo.m_belowIndices.size() + && aznumeric_cast(outInfo.m_aboveIndices.size() + outInfo.m_belowIndices.size()) / aznumeric_cast(indices.size()) < s_MaximumSplitAxisStraddlingTriangles; } bool ModelKdTree::Build(const ModelAsset* model) From f177f671ac14d24ac46d10df835aa611df4a8f30 Mon Sep 17 00:00:00 2001 From: Tommy Walton <82672795+amzn-tommy@users.noreply.github.com> Date: Wed, 7 Jul 2021 15:09:14 -0700 Subject: [PATCH 3/7] Fix for LYN-4594: [Atom][EMFX] Loading a saved level with entity and an actor component causes the editor to freeze. (DCO fixup) (#1878) * Queue shader loads and register with the dynamic draw context after the shader is loaded to avoid a deadlock when there are multiple scenes processing at the same time. Signed-off-by: amzn-tommy * Fixed AzCore case in AtomFont.h and two other files I found while searching Signed-off-by: amzn-tommy * Switched to a utility that will both get the assetId and create the Asset, without calling GetAsset explicitely Signed-off-by: amzn-tommy * Fixing typos in error message Signed-off-by: amzn-tommy --- .../AtomLyIntegration/AtomFont/AtomFont.h | 5 ++ .../AtomFont/Code/Source/AtomFont.cpp | 56 +++++++++++++------ ...tomViewportDisplayIconsSystemComponent.cpp | 39 +++++++++---- .../AtomViewportDisplayIconsSystemComponent.h | 4 ++ Gems/Blast/Code/Include/Blast/BlastDebug.h | 2 +- .../Code/Source/Family/ActorRenderManager.h | 2 +- 6 files changed, 78 insertions(+), 30 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h index 9fe3f2c25b..9e6c38a939 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ namespace AZ class AtomFont : public ICryFont , public AzFramework::FontQueryInterface + , private Data::AssetBus::Handler { friend class FFont; @@ -122,6 +124,9 @@ namespace AZ //! \param outputFullPath Full path to loaded font family, may need resolving with PathUtil::MakeGamePath. XmlNodeRef LoadFontFamilyXml(const char* fontFamilyName, string& outputDirectory, string& outputFullPath); + // Data::AssetBus::Handler overrides... + void OnAssetReady(Data::Asset asset) override; + private: AzFramework::ISceneSystem::SceneEvent::Handler m_sceneEventHandler; diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp index 114dbf62bb..cb157b95f6 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp @@ -29,6 +29,7 @@ #include #include +#include // Static member definitions const AZ::AtomFont::GlyphSize AZ::AtomFont::defaultGlyphSize = AZ::AtomFont::GlyphSize(ICryFont::defaultGlyphSizeX, ICryFont::defaultGlyphSizeY); @@ -349,30 +350,18 @@ AZ::AtomFont::AtomFont(ISystem* system) #endif AZ::Interface::Register(this); - // register font per viewport dynamic draw context. + // Queue a load for the font per viewport dynamic draw context shader, and wait for it to load static const char* shaderFilepath = "Shaders/SimpleTextured.azshader"; - AZ::AtomBridge::PerViewportDynamicDraw::Get()->RegisterDynamicDrawContext( - AZ::Name(AZ::AtomFontDynamicDrawContextName), - [](RPI::Ptr drawContext) - { - Data::Instance shader = AZ::RPI::LoadShader(shaderFilepath); - AZ::RPI::ShaderOptionList shaderOptions; - shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_useColorChannels"), AZ::Name("false"))); - shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_clamp"), AZ::Name("true"))); - drawContext->InitShaderWithVariant(shader, &shaderOptions); - drawContext->InitVertexFormat( - { - {"POSITION", RHI::Format::R32G32B32_FLOAT}, - {"COLOR", RHI::Format::B8G8R8A8_UNORM}, - {"TEXCOORD0", RHI::Format::R32G32_FLOAT} - }); - drawContext->EndInit(); - }); + Data::Asset shaderAsset = RPI::AssetUtils::GetAssetByProductPath(shaderFilepath, RPI::AssetUtils::TraceLevel::Assert); + shaderAsset.QueueLoad(); + Data::AssetBus::Handler::BusConnect(shaderAsset.GetId()); } AZ::AtomFont::~AtomFont() { + Data::AssetBus::Handler::BusDisconnect(); + AZ::Interface::Unregister(this); m_defaultFontDrawInterface = nullptr; @@ -864,5 +853,36 @@ XmlNodeRef AZ::AtomFont::LoadFontFamilyXml(const char* fontFamilyName, string& o return root; } + +void AZ::AtomFont::OnAssetReady(Data::Asset asset) +{ + Data::Asset shaderAsset = asset; + + AZ::AtomBridge::PerViewportDynamicDraw::Get()->RegisterDynamicDrawContext( + AZ::Name(AZ::AtomFontDynamicDrawContextName), + [shaderAsset](RPI::Ptr drawContext) + { + AZ_Assert(shaderAsset->IsReady(), "Attempting to register the AtomFont" + " dynamic draw context before the shader asset is loaded. The shader should be loaded first" + " to avoid a blocking asset load and potential deadlock, since the DynamicDrawContext lambda" + " will be executed during scene processing and there may be multiple scenes executing in parallel."); + + Data::Instance shader = RPI::Shader::FindOrCreate(shaderAsset); + AZ::RPI::ShaderOptionList shaderOptions; + shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_useColorChannels"), AZ::Name("false"))); + shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_clamp"), AZ::Name("true"))); + drawContext->InitShaderWithVariant(shader, &shaderOptions); + drawContext->InitVertexFormat( + { + {"POSITION", RHI::Format::R32G32B32_FLOAT}, + {"COLOR", RHI::Format::B8G8R8A8_UNORM}, + {"TEXCOORD0", RHI::Format::R32G32_FLOAT} + }); + drawContext->EndInit(); + }); + + Data::AssetBus::Handler::BusDisconnect(); +} + #endif diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp index 305fad8ad0..f3f06a2efc 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp +++ b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -87,6 +88,7 @@ namespace AZ::Render void AtomViewportDisplayIconsSystemComponent::Deactivate() { + Data::AssetBus::Handler::BusDisconnect(); Bootstrap::NotificationBus::Handler::BusDisconnect(); auto perViewportDynamicDrawInterface = AtomBridge::PerViewportDynamicDraw::Get(); @@ -338,15 +340,32 @@ namespace AZ::Render void AtomViewportDisplayIconsSystemComponent::OnBootstrapSceneReady([[maybe_unused]]AZ::RPI::Scene* bootstrapScene) { - AtomBridge::PerViewportDynamicDraw::Get()->RegisterDynamicDrawContext(m_drawContextName, [](RPI::Ptr drawContext) - { - auto shader = RPI::LoadShader(DrawContextShaderPath); - drawContext->InitShader(shader); - drawContext->InitVertexFormat( - {{"POSITION", RHI::Format::R32G32B32_FLOAT}, - {"COLOR", RHI::Format::R8G8B8A8_UNORM}, - {"TEXCOORD", RHI::Format::R32G32_FLOAT}}); - drawContext->EndInit(); - }); + // Queue a load for the draw context shader, and wait for it to load + Data::Asset shaderAsset = RPI::AssetUtils::GetAssetByProductPath(DrawContextShaderPath, RPI::AssetUtils::TraceLevel::Assert); + shaderAsset.QueueLoad(); + Data::AssetBus::Handler::BusConnect(shaderAsset.GetId()); + } + + void AtomViewportDisplayIconsSystemComponent::OnAssetReady(Data::Asset asset) + { + // Once the shader is loaded, register it with the dynamic draw context + Data::Asset shaderAsset = asset; + AtomBridge::PerViewportDynamicDraw::Get()->RegisterDynamicDrawContext(m_drawContextName, [shaderAsset](RPI::Ptr drawContext) + { + AZ_Assert(shaderAsset->IsReady(), "Attempting to register the AtomViewportDisplayIconsSystemComponent" + " dynamic draw context before the shader asset is loaded. The shader should be loaded first" + " to avoid a blocking asset load and potential deadlock, since the DynamicDrawContext lambda" + " will be executed during scene processing and there may be multiple scenes executing in parallel."); + + Data::Instance shader = RPI::Shader::FindOrCreate(shaderAsset); + drawContext->InitShader(shader); + drawContext->InitVertexFormat( + { {"POSITION", RHI::Format::R32G32B32_FLOAT}, + {"COLOR", RHI::Format::R8G8B8A8_UNORM}, + {"TEXCOORD", RHI::Format::R32G32_FLOAT} }); + drawContext->EndInit(); + }); + + Data::AssetBus::Handler::BusDisconnect(); } } // namespace AZ::Render diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.h b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.h index 8cb268d36a..cd6fddf745 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.h +++ b/Gems/AtomLyIntegration/AtomViewportDisplayIcons/Code/Source/AtomViewportDisplayIconsSystemComponent.h @@ -27,6 +27,7 @@ namespace AZ : public AZ::Component , public AzToolsFramework::EditorViewportIconDisplayInterface , public AZ::Render::Bootstrap::NotificationBus::Handler + , private Data::AssetBus::Handler { public: AZ_COMPONENT(AtomViewportDisplayIconsSystemComponent, "{AEC1D3E1-1D9A-437A-B4C6-CFAEE620C160}"); @@ -51,6 +52,9 @@ namespace AZ // AZ::Render::Bootstrap::NotificationBus::Handler overrides... void OnBootstrapSceneReady(AZ::RPI::Scene* bootstrapScene) override; + // Data::AssetBus::Handler overrides... + void OnAssetReady(Data::Asset asset) override; + private: static constexpr const char* DrawContextShaderPath = "Shaders/TexturedIcon.azshader"; static constexpr QSize MinimumRenderedSvgSize = QSize(128, 128); diff --git a/Gems/Blast/Code/Include/Blast/BlastDebug.h b/Gems/Blast/Code/Include/Blast/BlastDebug.h index 2530eb4217..9613b94ff5 100644 --- a/Gems/Blast/Code/Include/Blast/BlastDebug.h +++ b/Gems/Blast/Code/Include/Blast/BlastDebug.h @@ -8,7 +8,7 @@ #include #include -#include +#include namespace Blast { diff --git a/Gems/Blast/Code/Source/Family/ActorRenderManager.h b/Gems/Blast/Code/Source/Family/ActorRenderManager.h index c4037bb638..c0cdda158c 100644 --- a/Gems/Blast/Code/Source/Family/ActorRenderManager.h +++ b/Gems/Blast/Code/Source/Family/ActorRenderManager.h @@ -8,7 +8,7 @@ #include #include -#include +#include namespace Blast { From 992f5aab1bc38568d99f81f2460b9f13a2cea81e Mon Sep 17 00:00:00 2001 From: Shirang Jia Date: Wed, 7 Jul 2021 15:12:10 -0700 Subject: [PATCH 4/7] Convert Incremental scripts to Python3 (#1934) Convert incremental build script to Python3 --- scripts/build/Jenkins/Jenkinsfile | 8 +- .../build/bootstrap/incremental_build_util.py | 84 +++++++++---------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index 8e73524878..a7a796f3b7 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -269,8 +269,8 @@ def PreBuildCommonSteps(Map pipelineConfig, String repositoryName, String projec unstash name: 'incremental_build_script' def pythonCmd = '' - if(env.IS_UNIX) pythonCmd = 'sudo -E python -u ' - else pythonCmd = 'python -u ' + if(env.IS_UNIX) pythonCmd = 'sudo -E python3 -u ' + else pythonCmd = 'python3 -u ' if(env.RECREATE_VOLUME?.toBoolean()) { palSh("${pythonCmd} ${INCREMENTAL_BUILD_SCRIPT_PATH} --action delete --repository_name ${repositoryName} --project ${projectName} --pipeline ${pipeline} --branch ${branchName} --platform ${platform} --build_type ${buildType}", 'Deleting volume', winSlashReplacement=false) @@ -382,8 +382,8 @@ def PostBuildCommonSteps(String workspace, boolean mount = true) { if (mount) { def pythonCmd = '' - if(env.IS_UNIX) pythonCmd = 'sudo -E python -u ' - else pythonCmd = 'python -u ' + if(env.IS_UNIX) pythonCmd = 'sudo -E python3 -u ' + else pythonCmd = 'python3 -u ' try { timeout(5) { diff --git a/scripts/build/bootstrap/incremental_build_util.py b/scripts/build/bootstrap/incremental_build_util.py index 0a1dce5130..ef49a27bb1 100755 --- a/scripts/build/bootstrap/incremental_build_util.py +++ b/scripts/build/bootstrap/incremental_build_util.py @@ -7,7 +7,7 @@ import argparse import ast import boto3 import datetime -import urllib2 +import urllib.request, urllib.error, urllib.parse import os import psutil import time @@ -49,7 +49,7 @@ if os.name == 'nt': def is_dir_symlink(path): FILE_ATTRIBUTE_REPARSE_POINT = 0x0400 - return os.path.isdir(path) and (ctypes.windll.kernel32.GetFileAttributesW(unicode(path)) & FILE_ATTRIBUTE_REPARSE_POINT) + return os.path.isdir(path) and (ctypes.windll.kernel32.GetFileAttributesW(str(path)) & FILE_ATTRIBUTE_REPARSE_POINT) def get_free_space_mb(path): if sys.version_info < (3,): # Python 2? @@ -84,7 +84,7 @@ else: return st.f_bavail * st.f_frsize / 1024 / 1024 def error(message): - print message + print(message) exit(1) def parse_args(): @@ -137,19 +137,19 @@ def get_ec2_client(region): def get_ec2_instance_id(): try: - instance_id = urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read() - return instance_id + instance_id = urllib.request.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read() + return instance_id.decode("utf-8") except Exception as e: - print e.message + print(e.message) error('No EC2 metadata! Check if you are running this script on an EC2 instance.') def get_availability_zone(): try: - availability_zone = urllib2.urlopen('http://169.254.169.254/latest/meta-data/placement/availability-zone').read() - return availability_zone + availability_zone = urllib.request.urlopen('http://169.254.169.254/latest/meta-data/placement/availability-zone').read() + return availability_zone.decode("utf-8") except Exception as e: - print e.message + print(e.message) error('No EC2 metadata! Check if you are running this script on an EC2 instance.') @@ -158,11 +158,11 @@ def kill_processes(workspace='/dev/'): Kills all processes that have open file paths associated with the workspace. Uses PSUtil for cross-platform compatibility ''' - print 'Checking for any stuck processes...' + print('Checking for any stuck processes...') for proc in psutil.process_iter(): try: if workspace in str(proc.open_files()): - print "{} has open files in {}. Terminating".format(proc.name(), proc.open_files()) + print("{} has open files in {}. Terminating".format(proc.name(), proc.open_files())) proc.kill() time.sleep(1) # Just to make sure a parent process has time to close except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): @@ -171,7 +171,7 @@ def kill_processes(workspace='/dev/'): def delete_volume(ec2_client, volume_id): response = ec2_client.delete_volume(VolumeId=volume_id) - print 'Volume {} deleted'.format(volume_id) + print('Volume {} deleted'.format(volume_id)) def find_snapshot_id(ec2_client, repository_name, project, pipeline, platform, build_type, disk_size): mount_name = get_mount_name(repository_name, project, pipeline, 'stabilization_2106', platform, build_type) # we take snapshots out of stabilization_2106 @@ -234,29 +234,29 @@ def create_volume(ec2_client, availability_zone, repository_name, project, pipel time.sleep(1) response = ec2_client.describe_volumes(VolumeIds=[volume_id, ]) - print("Volume {} created\n\tSnapshot: {}\n\tRepository {}\n\tProject {}\n\tPipeline {}\n\tBranch {}\n\tPlatform: {}\n\tBuild type: {}" - .format(volume_id, snapshot_id, repository_name, project, pipeline, branch, platform, build_type)) + print(("Volume {} created\n\tSnapshot: {}\n\tRepository {}\n\tProject {}\n\tPipeline {}\n\tBranch {}\n\tPlatform: {}\n\tBuild type: {}" + .format(volume_id, snapshot_id, repository_name, project, pipeline, branch, platform, build_type))) return volume_id, created def mount_volume(created): - print 'Mounting volume...' + print('Mounting volume...') if os.name == 'nt': f = tempfile.NamedTemporaryFile(delete=False) f.write(""" select disk 1 online disk attribute disk clear readonly - """) # assume disk # for now + """.encode('utf-8')) # assume disk # for now if created: - print 'Creating filesystem on new volume' + print('Creating filesystem on new volume') f.write("""create partition primary select partition 1 format quick fs=ntfs assign active - """) + """.encode('utf-8')) f.close() @@ -267,7 +267,7 @@ def mount_volume(created): drives_after = win32api.GetLogicalDriveStrings() drives_after = drives_after.split('\000')[:-1] - print drives_after + print(drives_after) #drive_letter = next(item for item in drives_after if item not in drives_before) drive_letter = MOUNT_PATH @@ -284,7 +284,7 @@ def mount_volume(created): def attach_volume(volume, volume_id, instance_id, timeout=DEFAULT_TIMEOUT): - print 'Attaching volume {} to instance {}'.format(volume_id, instance_id) + print('Attaching volume {} to instance {}'.format(volume_id, instance_id)) volume.attach_to_instance(Device='xvdf', InstanceId=instance_id, VolumeId=volume_id) @@ -297,7 +297,7 @@ def attach_volume(volume, volume_id, instance_id, timeout=DEFAULT_TIMEOUT): time.sleep(1) volume.load() if (time.clock() - timeout_init) > timeout: - print 'ERROR: Timeout reached trying to mount EBS' + print('ERROR: Timeout reached trying to mount EBS') exit(1) volume.create_tags( Tags=[ @@ -307,11 +307,11 @@ def attach_volume(volume, volume_id, instance_id, timeout=DEFAULT_TIMEOUT): }, ] ) - print 'Volume {} has been attached to instance {}'.format(volume_id, instance_id) + print('Volume {} has been attached to instance {}'.format(volume_id, instance_id)) def unmount_volume(): - print 'Umounting volume...' + print('Umounting volume...') if os.name == 'nt': kill_processes(MOUNT_PATH + 'workspace') f = tempfile.NamedTemporaryFile(delete=False) @@ -328,7 +328,7 @@ def unmount_volume(): def detach_volume(volume, ec2_instance_id, force, timeout=DEFAULT_TIMEOUT): - print 'Detaching volume {} from instance {}'.format(volume.volume_id, ec2_instance_id) + print('Detaching volume {} from instance {}'.format(volume.volume_id, ec2_instance_id)) volume.detach_from_instance(Device='xvdf', Force=force, InstanceId=ec2_instance_id, @@ -338,16 +338,16 @@ def detach_volume(volume, ec2_instance_id, force, timeout=DEFAULT_TIMEOUT): time.sleep(1) volume.load() if (time.clock() - timeout_init) > timeout: - print 'ERROR: Timeout reached trying to unmount EBS.' + print('ERROR: Timeout reached trying to unmount EBS.') volume.detach_from_instance(Device='xvdf',Force=True,InstanceId=ec2_instance_id,VolumeId=volume.volume_id) exit(1) - print 'Volume {} has been detached from instance {}'.format(volume.volume_id, ec2_instance_id) + print('Volume {} has been detached from instance {}'.format(volume.volume_id, ec2_instance_id)) volume.load() if len(volume.attachments): - print 'Volume still has attachments' + print('Volume still has attachments') for attachment in volume.attachments: - print 'Volume {} {} to instance {}'.format(attachment['VolumeId'], attachment['State'], attachment['InstanceId']) + print('Volume {} {} to instance {}'.format(attachment['VolumeId'], attachment['State'], attachment['InstanceId'])) def attach_ebs_and_create_partition_with_retry(volume, volume_id, ec2_instance_id, created): @@ -379,10 +379,10 @@ def mount_ebs(repository_name, project, pipeline, branch, platform, build_type, for volume in ec2_instance.volumes.all(): for attachment in volume.attachments: - print 'attachment device: {}'.format(attachment['Device']) + print('attachment device: {}'.format(attachment['Device'])) if 'xvdf' in attachment['Device'] and attachment['State'] != 'detached': - print 'A device is already attached to xvdf. This likely means a previous build failed to detach its ' \ - 'build volume. This volume is considered orphaned and will be detached from this instance.' + print('A device is already attached to xvdf. This likely means a previous build failed to detach its ' \ + 'build volume. This volume is considered orphaned and will be detached from this instance.') unmount_volume() detach_volume(volume, ec2_instance_id, False) # Force unmounts should not be used, as that will cause the EBS block device driver to fail the remount @@ -393,21 +393,21 @@ def mount_ebs(repository_name, project, pipeline, branch, platform, build_type, created = False if 'Volumes' in response and not len(response['Volumes']): - print 'Volume for {} doesn\'t exist creating it...'.format(mount_name) + print('Volume for {} doesn\'t exist creating it...'.format(mount_name)) # volume doesn't exist, create it volume_id, created = create_volume(ec2_client, ec2_availability_zone, repository_name, project, pipeline, branch, platform, build_type, disk_size, disk_type) else: volume = response['Volumes'][0] volume_id = volume['VolumeId'] - print 'Current volume {} is a {} GB {}'.format(volume_id, volume['Size'], volume['VolumeType']) + print('Current volume {} is a {} GB {}'.format(volume_id, volume['Size'], volume['VolumeType'])) if (volume['Size'] != disk_size or volume['VolumeType'] != disk_type): - print 'Override disk attributes does not match the existing volume, deleting {} and replacing the volume'.format(volume_id) + print('Override disk attributes does not match the existing volume, deleting {} and replacing the volume'.format(volume_id)) delete_volume(ec2_client, volume_id) volume_id, created = create_volume(ec2_client, ec2_availability_zone, repository_name, project, pipeline, branch, platform, build_type, disk_size, disk_type) if len(volume['Attachments']): # this is bad we shouldn't be attached, we should have detached at the end of a build attachment = volume['Attachments'][0] - print ('Volume already has attachment {}, detaching...'.format(attachment)) + print(('Volume already has attachment {}, detaching...'.format(attachment))) detach_volume(ec2_resource.Volume(volume_id), attachment['InstanceId'], True) volume = ec2_resource.Volume(volume_id) @@ -416,23 +416,23 @@ def mount_ebs(repository_name, project, pipeline, branch, platform, build_type, drives_before = win32api.GetLogicalDriveStrings() drives_before = drives_before.split('\000')[:-1] - print drives_before + print(drives_before) attach_ebs_and_create_partition_with_retry(volume, volume_id, ec2_instance_id, created) free_space_mb = get_free_space_mb(MOUNT_PATH) - print 'Free disk space {}MB'.format(free_space_mb) + print('Free disk space {}MB'.format(free_space_mb)) if free_space_mb < LOW_EBS_DISK_SPACE_LIMIT: - print 'Volume is running below EBS free disk space treshhold {}MB. Recreating volume and running clean build.'.format(LOW_EBS_DISK_SPACE_LIMIT) + print('Volume is running below EBS free disk space treshhold {}MB. Recreating volume and running clean build.'.format(LOW_EBS_DISK_SPACE_LIMIT)) unmount_volume() detach_volume(volume, ec2_instance_id, False) delete_volume(ec2_client, volume_id) new_disk_size = int(volume.size * 1.25) if new_disk_size > MAX_EBS_DISK_SIZE: - print 'Error: EBS disk size reached to the allowed maximum disk size {}MB, please contact ly-infra@ and ly-build@ to investigate.'.format(MAX_EBS_DISK_SIZE) + print('Error: EBS disk size reached to the allowed maximum disk size {}MB, please contact ly-infra@ and ly-build@ to investigate.'.format(MAX_EBS_DISK_SIZE)) exit(1) - print 'Recreating the EBS with disk size {}'.format(new_disk_size) + print('Recreating the EBS with disk size {}'.format(new_disk_size)) volume_id, created = create_volume(ec2_client, ec2_availability_zone, repository_name, project, pipeline, branch, platform, build_type, new_disk_size, disk_type) volume = ec2_resource.Volume(volume_id) attach_ebs_and_create_partition_with_retry(volume, volume_id, ec2_instance_id, created) @@ -454,13 +454,13 @@ def unmount_ebs(): for attached_volume in ec2_instance.volumes.all(): for attachment in attached_volume.attachments: - print 'attachment device: {}'.format(attachment['Device']) + print('attachment device: {}'.format(attachment['Device'])) if attachment['Device'] == 'xvdf': volume = attached_volume if not volume: # volume is not mounted - print 'Volume is not mounted' + print('Volume is not mounted') else: unmount_volume() detach_volume(volume, ec2_instance_id, False) From b9964bbb5a3c360b4ead64939b445c0ed698102e Mon Sep 17 00:00:00 2001 From: Twolewis Date: Wed, 7 Jul 2021 17:16:09 -0500 Subject: [PATCH 5/7] Fixed Material Editor not launching (#1920) * Fixed Material Editor not launching Explicitly providing project-path as part of launch parameters. Signed-off-by: Lloyd Tullues * Update Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: Lloyd Tullues * Minor - adding whitespace for consistency Signed-off-by: Lloyd Tullues Co-authored-by: Lloyd Tullues Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- .../Code/Source/Material/EditorMaterialSystemComponent.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp index a8d6270c7e..efb79bb06c 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp @@ -130,6 +130,12 @@ namespace AZ arguments.append(QString("--rhi=%1").arg(apiName.GetCStr())); } + AZ::IO::FixedMaxPathString projectPath(AZ::Utils::GetProjectPath()); + if (!projectPath.empty()) + { + arguments.append(QString("--project-path=%1").arg(projectPath.c_str())); + } + AtomToolsFramework::LaunchTool("MaterialEditor", ".exe", arguments); } From 9ca7a698dfa0af31c61db28ab70e6e40b3d5c37e Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 7 Jul 2021 16:17:40 -0700 Subject: [PATCH 6/7] Fix Mac Editor crash when adding PhysX Collider component to an entity. (#1930) Signed-off-by: amzn-sj --- Code/Framework/AzFramework/AzFramework/Physics/Material.cpp | 4 ++-- Code/Framework/AzFramework/AzFramework/Physics/Material.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp index cdcdbe4655..05f41cc8da 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp @@ -504,7 +504,7 @@ namespace Physics } } - const AZ::Data::Asset& MaterialSelection::GetMaterialLibrary() + AZ::Data::Asset MaterialSelection::GetMaterialLibrary() { if (auto* physicsSystem = AZ::Interface::Get()) { @@ -516,7 +516,7 @@ namespace Physics return s_invalidMaterialLibrary; } - const AZ::Data::AssetId& MaterialSelection::GetMaterialLibraryId() + AZ::Data::AssetId MaterialSelection::GetMaterialLibraryId() { return GetMaterialLibrary().GetId(); } diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Material.h b/Code/Framework/AzFramework/AzFramework/Physics/Material.h index bd15dd338e..455da207d1 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Material.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Material.h @@ -306,8 +306,8 @@ namespace Physics void SyncSelectionToMaterialLibrary(); - static const AZ::Data::Asset& GetMaterialLibrary(); - static const AZ::Data::AssetId& GetMaterialLibraryId(); + static AZ::Data::Asset GetMaterialLibrary(); + static AZ::Data::AssetId GetMaterialLibraryId(); bool AreMaterialSlotsReadOnly() const; From 55a3b412226b5485f3f5bf5c1c52c4142c3de017 Mon Sep 17 00:00:00 2001 From: Shirang Jia Date: Wed, 7 Jul 2021 16:44:42 -0700 Subject: [PATCH 7/7] Fix unmounting error (#1940) --- scripts/build/bootstrap/incremental_build_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/bootstrap/incremental_build_util.py b/scripts/build/bootstrap/incremental_build_util.py index ef49a27bb1..32a6b0f526 100755 --- a/scripts/build/bootstrap/incremental_build_util.py +++ b/scripts/build/bootstrap/incremental_build_util.py @@ -318,7 +318,7 @@ def unmount_volume(): f.write(""" select disk 1 offline disk - """) + """.encode('utf-8')) f.close() subprocess.call('diskpart /s %s' % f.name) os.unlink(f.name)