From 8ee92978f4e96a91b3ef1350d009b2ddaa45bbca Mon Sep 17 00:00:00 2001 From: greerdv Date: Mon, 12 Apr 2021 13:07:40 +0100 Subject: [PATCH 01/20] setting max value for scale --- .../AzCore/AzCore/Component/NonUniformScaleBus.h | 3 --- Code/Framework/AzCore/AzCore/Math/Transform.h | 7 +++++++ .../AzFramework/Components/NonUniformScaleComponent.cpp | 5 +++-- .../ToolsComponents/EditorNonUniformScaleComponent.cpp | 9 ++++++--- .../ToolsComponents/TransformComponent.cpp | 1 - .../ToolsComponents/TransformScalePropertyHandler.cpp | 5 +++-- .../EditorTransformComponentSelection.cpp | 2 +- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Component/NonUniformScaleBus.h b/Code/Framework/AzCore/AzCore/Component/NonUniformScaleBus.h index af2fe20a50..9b52fc1794 100644 --- a/Code/Framework/AzCore/AzCore/Component/NonUniformScaleBus.h +++ b/Code/Framework/AzCore/AzCore/Component/NonUniformScaleBus.h @@ -19,9 +19,6 @@ namespace AZ { class Vector3; - //! Do not allow the scale to be zero to avoid problems with inverting scale. - static constexpr float MinNonUniformScale = 1e-3f; - using NonUniformScaleChangedEvent = AZ::Event; //! Requests for working with non-uniform scale. diff --git a/Code/Framework/AzCore/AzCore/Math/Transform.h b/Code/Framework/AzCore/AzCore/Math/Transform.h index 6c96a9a6a6..eb1a12a912 100644 --- a/Code/Framework/AzCore/AzCore/Math/Transform.h +++ b/Code/Framework/AzCore/AzCore/Math/Transform.h @@ -38,6 +38,13 @@ namespace AZ bool CompareValueData(const void* lhs, const void* rhs) override; }; + //! Limits for transform scale values. + //! The scale should not be zero to avoid problems with inverting. + //! @{ + static constexpr float MinTransformScale = 1e-2f; + static constexpr float MaxTransformScale = 1e9f; + //! @} + //! The basic transformation class, represented using a quaternion rotation, vector scale and vector translation. //! By design, cannot represent skew transformations. class Transform diff --git a/Code/Framework/AzFramework/AzFramework/Components/NonUniformScaleComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/NonUniformScaleComponent.cpp index 630dbb0322..095d986fa1 100644 --- a/Code/Framework/AzFramework/AzFramework/Components/NonUniformScaleComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Components/NonUniformScaleComponent.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -81,13 +82,13 @@ namespace AzFramework void NonUniformScaleComponent::SetScale(const AZ::Vector3& scale) { - if (scale.GetMinElement() >= AZ::MinNonUniformScale) + if (scale.GetMinElement() >= AZ::MinTransformScale && scale.GetMaxElement() <= AZ::MaxTransformScale) { m_scale = scale; } else { - AZ::Vector3 clampedScale = scale.GetMax(AZ::Vector3(AZ::MinNonUniformScale)); + AZ::Vector3 clampedScale = scale.GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale)); AZ_Warning("Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s", AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str()); m_scale = clampedScale; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.cpp index 7c4d72dbbf..5e928a382a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace AzToolsFramework @@ -44,7 +45,9 @@ namespace AzToolsFramework ->DataElement( AZ::Edit::UIHandlers::Default, &EditorNonUniformScaleComponent::m_scale, "Non-uniform Scale", "Non-uniform scale for this entity only (does not propagate through hierarchy)") - ->Attribute(AZ::Edit::Attributes::Min, AZ::MinNonUniformScale) + ->Attribute(AZ::Edit::Attributes::Min, AZ::MinTransformScale) + ->Attribute(AZ::Edit::Attributes::Max, AZ::MaxTransformScale) + ->Attribute(AZ::Edit::Attributes::Step, 0.1f) ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNonUniformScaleComponent::OnScaleChanged) ; } @@ -106,13 +109,13 @@ namespace AzToolsFramework void EditorNonUniformScaleComponent::SetScale(const AZ::Vector3& scale) { - if (scale.GetMinElement() >= AZ::MinNonUniformScale) + if (scale.GetMinElement() >= AZ::MinTransformScale && scale.GetMaxElement() <= AZ::MaxTransformScale) { m_scale = scale; } else { - AZ::Vector3 clampedScale = scale.GetMax(AZ::Vector3(AZ::MinNonUniformScale)); + AZ::Vector3 clampedScale = scale.GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale)); AZ_Warning("Editor Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s", AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str()); m_scale = clampedScale; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp index 2ceb97adfd..7ce11e5957 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp @@ -1276,7 +1276,6 @@ namespace AzToolsFramework Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushableOnSliceRoot)-> DataElement(TransformScaleHandler, &EditorTransform::m_scale, "Scale", "Local Scale")-> Attribute(AZ::Edit::Attributes::Step, 0.1f)-> - Attribute(AZ::Edit::Attributes::Min, 0.01f)-> Attribute(AZ::Edit::Attributes::ReadOnly, &EditorTransform::m_locked) ; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp index 0105d9bbad..94d0113bcf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp @@ -12,6 +12,7 @@ #include "AzToolsFramework_precompiled.h" #include +#include #include namespace AzToolsFramework @@ -36,8 +37,8 @@ namespace AzToolsFramework AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, newCtrl); }); - newCtrl->setMinimum(0.01f); - newCtrl->setMaximum(std::numeric_limits::max()); + newCtrl->setMinimum(AZ::MinTransformScale); + newCtrl->setMaximum(AZ::MaxTransformScale); return newCtrl; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index 27222e9aac..83632708d9 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -1603,7 +1603,7 @@ namespace AzToolsFramework const AZ::Vector3 uniformScale = AZ::Vector3(action.m_start.m_sign * sumVectorElements(action.LocalScaleOffset())); const AZ::Vector3 scale = (AZ::Vector3::CreateOne() + - (uniformScale / initialScale)).GetMax(AZ::Vector3(0.01f)); + (uniformScale / initialScale)).GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale)); const AZ::Transform scaleTransform = AZ::Transform::CreateScale(scale); if (action.m_modifiers.Alt()) From f188e1c9a7b77ce41ff83bc1e13169e01d677529 Mon Sep 17 00:00:00 2001 From: mnaumov Date: Mon, 12 Apr 2021 16:03:10 -0700 Subject: [PATCH 02/20] Fixing ShaderVariantAsyncLoader shutdown not releasing it's assets --- .../Code/Source/RPI.Public/Shader/ShaderVariantAsyncLoader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderVariantAsyncLoader.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderVariantAsyncLoader.cpp index 5b58e6ec6c..fa4fd241df 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderVariantAsyncLoader.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderVariantAsyncLoader.cpp @@ -174,6 +174,7 @@ namespace AZ m_serviceThread.join(); Data::AssetBus::MultiHandler::BusDisconnect(); + m_newShaderVariantPendingRequests.clear(); m_shaderVariantTreePendingRequests.clear(); m_shaderVariantPendingRequests.clear(); m_shaderVariantData.clear(); From ea7b8309b513b3f64fbf8f8e5185beefb242a30f Mon Sep 17 00:00:00 2001 From: mcgarrah Date: Tue, 13 Apr 2021 00:43:33 -0500 Subject: [PATCH 03/20] Updating the FOLDER filtering in the LyTestWrappers.cmake custom targets to remove leading '..' from the VS folder filter --- cmake/LYTestWrappers.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/LYTestWrappers.cmake b/cmake/LYTestWrappers.cmake index 4f8d0bc169..73a212ee0b 100644 --- a/cmake/LYTestWrappers.cmake +++ b/cmake/LYTestWrappers.cmake @@ -213,8 +213,14 @@ function(ly_add_test) add_custom_target(${unaliased_test_name} COMMAND ${CMAKE_COMMAND} -E true ${args_TEST_COMMAND} ${args_TEST_ARGUMENTS}) file(RELATIVE_PATH project_path ${LY_ROOT_FOLDER} ${CMAKE_CURRENT_SOURCE_DIR}) + set(ide_path ${project_path}) + # Visual Studio doesn't support a folder layout that starts with ".." + # So strip away the parent directory of a relative path + if (${project_path} MATCHES [[^(\.\./)+(.*)]]) + set(ide_path "${CMAKE_MATCH_2}") + endif() set_target_properties(${unaliased_test_name} PROPERTIES - FOLDER "${project_path}" + FOLDER "${ide_path}" VS_DEBUGGER_COMMAND ${test_command} VS_DEBUGGER_COMMAND_ARGUMENTS "${test_arguments_line}" ) From 16ba08c9179aa88a1816506340a2591d5aee6622 Mon Sep 17 00:00:00 2001 From: moudgils Date: Tue, 13 Apr 2021 11:03:27 -0700 Subject: [PATCH 04/20] Mac compile fixes, Fix imgui rendering, Introduce a new RHI::BufferBindFlag, Fix a crash in AsyncStreaming, Fix shader build errors --- .../UI/Outliner/EntityOutlinerWidget.cpp | 2 +- .../AzslShaderBuilderSystemComponent.cpp | 6 ++--- .../Common/Code/Source/ImGui/ImGuiPass.cpp | 4 +-- .../Atom/RHI.Reflect/BufferDescriptor.h | 26 +++++++++++-------- .../RHI.Reflect/ReflectSystemComponent.cpp | 3 ++- .../Code/Source/RHI/BufferMemoryAllocator.cpp | 2 +- .../RHI/DX12/Code/Source/RHI/BufferPool.cpp | 3 ++- .../RHI.Builders/ShaderPlatformInterface.cpp | 13 +++++++--- .../Code/Source/RHI/AsyncUploadQueue.cpp | 2 +- .../RHI/Metal/Code/Source/RHI/Conversions.cpp | 5 ++++ .../RHI/Vulkan/Code/Source/RHI/BufferPool.cpp | 1 + .../RHI/Vulkan/Code/Source/RHI/Conversion.cpp | 6 ++--- .../DefaultDynInputBufferPool.resourcepool | 4 +-- .../RPI.Public/DynamicDraw/DynamicBuffer.h | 2 +- .../Code/Source/RPI.Public/Buffer/Buffer.cpp | 6 +++-- .../Source/RPI.Public/Buffer/BufferSystem.cpp | 2 +- .../DynamicDraw/DynamicBufferAllocator.cpp | 1 + .../Source/RPI.Public/Pass/PassAttachment.cpp | 2 +- 18 files changed, 56 insertions(+), 34 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index ad16423143..54d7dca292 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp @@ -807,7 +807,7 @@ namespace AzToolsFramework #ifdef Q_OS_MAC // "Alt+Return" translates to Option+Return on macOS m_actionToRenameSelection->setShortcut(tr("Alt+Return")); -#elseif Q_OS_WIN + #elif Q_OS_WIN m_actionToRenameSelection->setShortcut(tr("F2")); #endif m_actionToRenameSelection->setShortcutContext(Qt::WidgetWithChildrenShortcut); diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp index 0a85d463e5..528121fa56 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp @@ -102,7 +102,7 @@ namespace AZ // Register Shader Resource Group Layout Builder AssetBuilderSDK::AssetBuilderDesc srgLayoutBuilderDescriptor; srgLayoutBuilderDescriptor.m_name = "Shader Resource Group Layout Builder"; - srgLayoutBuilderDescriptor.m_version = 51; // SPEC-6065 + srgLayoutBuilderDescriptor.m_version = 52; // ATOM-15196 srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.azsl", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.azsli", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string::format("*.%s", SrgLayoutBuilder::MergedPartialSrgsExtension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); @@ -117,7 +117,7 @@ namespace AZ // Register Shader Asset Builder AssetBuilderSDK::AssetBuilderDesc shaderAssetBuilderDescriptor; shaderAssetBuilderDescriptor.m_name = "Shader Asset Builder"; - shaderAssetBuilderDescriptor.m_version = 96; // SPEC-6065 + shaderAssetBuilderDescriptor.m_version = 97; // ATOM-15196 // .shader file changes trigger rebuilds shaderAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern( AZStd::string::format("*.%s", RPI::ShaderSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); shaderAssetBuilderDescriptor.m_busId = azrtti_typeid(); @@ -132,7 +132,7 @@ namespace AZ shaderVariantAssetBuilderDescriptor.m_name = "Shader Variant Asset Builder"; // Both "Shader Variant Asset Builder" and "Shader Asset Builder" produce ShaderVariantAsset products. If you update // ShaderVariantAsset you will need to update BOTH version numbers, not just "Shader Variant Asset Builder". - shaderVariantAssetBuilderDescriptor.m_version = 17; // SPEC-6065 + shaderVariantAssetBuilderDescriptor.m_version = 18; // ATOM-15196 shaderVariantAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string::format("*.%s", RPI::ShaderVariantListSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); shaderVariantAssetBuilderDescriptor.m_busId = azrtti_typeid(); shaderVariantAssetBuilderDescriptor.m_createJobFunction = AZStd::bind(&ShaderVariantAssetBuilder::CreateJobs, &m_shaderVariantAssetBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index 2628eb9dc4..fef0e2af7b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp @@ -646,8 +646,8 @@ namespace AZ return 0; // Nothing to draw. } - auto vertexBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(totalVtxBufferSize); - auto indexBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(totalIdxBufferSize); + auto vertexBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(totalVtxBufferSize, RHI::Alignment::InputAssembly); + auto indexBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(totalIdxBufferSize, RHI::Alignment::InputAssembly); if (!vertexBuffer || !indexBuffer) { diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h index 4c0a490b70..f5ec9feebb 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h @@ -30,38 +30,42 @@ namespace AZ { None = 0, - /// Supports input assembly access through a IndexBufferView or StreamBufferView. + /// Supports input assembly access through a IndexBufferView or StreamBufferView. This flag is for buffers that are not updated often InputAssembly = AZ_BIT(0), - + + /// Supports input assembly access through a IndexBufferView or StreamBufferView. This flag is for buffers that are updated perf frame + DynamicInputAssembly = AZ_BIT(1), + /// Supports constant access through a ShaderResourceGroup. - Constant = AZ_BIT(1), + Constant = AZ_BIT(2), /// Supports read access through a ShaderResourceGroup. - ShaderRead = AZ_BIT(2), + ShaderRead = AZ_BIT(3), /// Supports write access through ShaderResourceGroup. - ShaderWrite = AZ_BIT(3), + ShaderWrite = AZ_BIT(4), /// Supports read-write access through a ShaderResourceGroup. ShaderReadWrite = ShaderRead | ShaderWrite, /// Supports read access for GPU copy operations. - CopyRead = AZ_BIT(4), + CopyRead = AZ_BIT(5), /// Supports write access for GPU copy operations. - CopyWrite = AZ_BIT(5), + CopyWrite = AZ_BIT(6), /// Supports predication access for conditional rendering. - Predication = AZ_BIT(6), + Predication = AZ_BIT(7), /// Supports indirect buffer access for indirect draw/dispatch. - Indirect = AZ_BIT(7), + Indirect = AZ_BIT(8), /// Supports ray tracing acceleration structure usage. - RayTracingAccelerationStructure = AZ_BIT(8), + RayTracingAccelerationStructure = AZ_BIT(9), /// Supports ray tracing shader table usage. - RayTracingShaderTable = AZ_BIT(9) + RayTracingShaderTable = AZ_BIT(10) + }; AZ_DEFINE_ENUM_BITWISE_OPERATORS(AZ::RHI::BufferBindFlags); diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp index 841183d96a..09a9a8316d 100644 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp @@ -54,7 +54,7 @@ namespace AZ if (SerializeContext* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(2); + ->Version(3); } ReflectNamedEnums(context); @@ -264,6 +264,7 @@ namespace AZ serializeContext->Enum() ->Value("None", BufferBindFlags::None) ->Value("InputAssembly", BufferBindFlags::InputAssembly) + ->Value("DynamicInputAssembly", BufferBindFlags::DynamicInputAssembly) ->Value("Constant", BufferBindFlags::Constant) ->Value("CopyRead", BufferBindFlags::CopyRead) ->Value("CopyWrite", BufferBindFlags::CopyWrite) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferMemoryAllocator.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferMemoryAllocator.cpp index 50f4f736cc..b2c1a5fcaf 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferMemoryAllocator.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferMemoryAllocator.cpp @@ -39,7 +39,7 @@ namespace AZ // needs to be a multiple of elementsize as well as divisible by DX12::Alignment types. m_usePageAllocator = false; - if (!RHI::CheckBitsAny(descriptor.m_bindFlags, RHI::BufferBindFlags::ShaderWrite | RHI::BufferBindFlags::CopyWrite | RHI::BufferBindFlags::InputAssembly)) + if (!RHI::CheckBitsAny(descriptor.m_bindFlags, RHI::BufferBindFlags::ShaderWrite | RHI::BufferBindFlags::CopyWrite | RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { m_usePageAllocator = true; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp index 7134621d87..ca1c1ae56e 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp @@ -39,7 +39,8 @@ namespace AZ { m_device = &device; - if (RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::InputAssembly)) + if (RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::InputAssembly) || + RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::DynamicInputAssembly)) { m_readOnlyState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER | D3D12_RESOURCE_STATE_INDEX_BUFFER; } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp index b2219754aa..866c355dad 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp @@ -670,7 +670,13 @@ namespace AZ } else { - result &= AddExistingResourceEntry("texture", resourceStartPos, regId, argBufferStr); + bool isAdditionSuccessfull = AddExistingResourceEntry("texture", resourceStartPos, regId, argBufferStr); + if(!isAdditionSuccessfull) + { + //In metal depth textures use keyword depth2d/depth2d_array/depthcube/depthcube_array/depth2d_ms/depth2d_ms_array + isAdditionSuccessfull |= AddExistingResourceEntry("depth", resourceStartPos, regId, argBufferStr); + } + result &= isAdditionSuccessfull; } } return result; @@ -827,10 +833,11 @@ namespace AZ AZStd::string& argBufferStr) const { size_t prevEndOfLine = argBufferStr.rfind("\n", resourceStartPos); + size_t nextEndOfLine = argBufferStr.find("\n", resourceStartPos); size_t startOfEntryPos = argBufferStr.find(resourceStr, prevEndOfLine); - if(startOfEntryPos == AZStd::string::npos) + if(startOfEntryPos == AZStd::string::npos || startOfEntryPos > nextEndOfLine) { - AZ_Error(MetalShaderPlatformName, false, "Entry-> %s not found within Descriptor set %s", resourceStr, argBufferStr.c_str()); + AZ_Error(MetalShaderPlatformName, startOfEntryPos != AZStd::string::npos, "Entry-> %s not found within Descriptor set %s", resourceStr, argBufferStr.c_str()); return false; } else diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp index f831c3a9b0..891f9ea2f3 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp @@ -295,7 +295,7 @@ namespace AZ const RHI::Size sourceSize = RHI::Size(subresourceLayout.m_size.m_width, heightToCopy, 1); const RHI::Origin sourceOrigin = RHI::Origin(0, destHeight, depth); - CopyBufferToImage(framePacket, image, stagingRowPitch, stagingSlicePitch, + CopyBufferToImage(framePacket, image, stagingRowPitch, bytesCopied, curMip, arraySlice, sourceSize, sourceOrigin); framePacket->m_dataOffset += stagingSize; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp index fbd50661cb..d6b2b2c906 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp @@ -210,6 +210,11 @@ namespace AZ { return GetCPUGPUMemoryMode(); } + + if (RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::DynamicInputAssembly)) + { + return MTLStorageModeShared; + } return GetCPUGPUMemoryMode(); } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp index b9d146d84e..081469b39a 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp @@ -107,6 +107,7 @@ namespace AZ bool forceUnique = RHI::CheckBitsAny( bufferDescriptor.m_bindFlags, RHI::BufferBindFlags::InputAssembly | + RHI::BufferBindFlags::DynamicInputAssembly | RHI::BufferBindFlags::RayTracingAccelerationStructure | RHI::BufferBindFlags::RayTracingShaderTable); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp index 6ac761a929..accc18b5ec 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp @@ -685,7 +685,7 @@ namespace AZ using BindFlags = RHI::BufferBindFlags; VkBufferUsageFlags usageFlags{ 0 }; - if (RHI::CheckBitsAny(bindFlags, BindFlags::InputAssembly)) + if (RHI::CheckBitsAny(bindFlags, BindFlags::InputAssembly | BindFlags::DynamicInputAssembly)) { usageFlags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT | @@ -932,7 +932,7 @@ namespace AZ VkPipelineStageFlags GetResourcePipelineStateFlags(const RHI::BufferBindFlags& bindFlags) { VkPipelineStageFlags stagesFlags = {}; - if (RHI::CheckBitsAny(bindFlags, RHI::BufferBindFlags::InputAssembly)) + if (RHI::CheckBitsAny(bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { stagesFlags |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT; } @@ -1042,7 +1042,7 @@ namespace AZ VkAccessFlags GetResourceAccessFlags(const RHI::BufferBindFlags& bindFlags) { VkAccessFlags accessFlags = {}; - if (RHI::CheckBitsAny(bindFlags, RHI::BufferBindFlags::InputAssembly)) + if (RHI::CheckBitsAny(bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { accessFlags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | VK_ACCESS_INDEX_READ_BIT; } diff --git a/Gems/Atom/RPI/Assets/ResourcePools/DefaultDynInputBufferPool.resourcepool b/Gems/Atom/RPI/Assets/ResourcePools/DefaultDynInputBufferPool.resourcepool index c80734cc38..0f2cb48580 100644 --- a/Gems/Atom/RPI/Assets/ResourcePools/DefaultDynInputBufferPool.resourcepool +++ b/Gems/Atom/RPI/Assets/ResourcePools/DefaultDynInputBufferPool.resourcepool @@ -8,6 +8,6 @@ "BudgetInBytes": 25165824, "BufferPoolHeapMemoryLevel": "Host", "BufferPoolhostMemoryAccess": "Write", - "BufferPoolBindFlags": "InputAssembly" + "BufferPoolBindFlags": "DynamicInputAssembly" } -} \ No newline at end of file +} diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/DynamicDraw/DynamicBuffer.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/DynamicDraw/DynamicBuffer.h index 9b6caeeaef..a1bbcd8d78 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/DynamicDraw/DynamicBuffer.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/DynamicDraw/DynamicBuffer.h @@ -36,7 +36,7 @@ namespace AZ //! buffer->Write(data, size); //! // Use the buffer view for DrawItem or etc. //! } - //! Note: DynamicBuffer should only be used for InputAssembly buffer or Constant buffer (not supported yet). + //! Note: DynamicBuffer should only be used for DynamicInputAssembly buffer or Constant buffer (not supported yet). class DynamicBuffer : public AZStd::intrusive_base { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp index 7bfcc588f1..cb2ad7d2ed 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp @@ -74,7 +74,8 @@ namespace AZ const RHI::BufferView* Buffer::GetBufferView() const { - if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly) + if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly || + m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::DynamicInputAssembly) { AZ_Assert(false, "Input assembly buffer doesn't need a regular buffer view, it requires a stream or index buffer view."); return nullptr; @@ -203,7 +204,8 @@ namespace AZ void Buffer::InitBufferView() { // Skip buffer view creation for input assembly buffers - if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly) + if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly || + m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::DynamicInputAssembly) { return; } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp index 5f279ba533..fd2d029ddb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp @@ -105,7 +105,7 @@ namespace AZ bufferPoolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; break; case CommonBufferPoolType::DynamicInputAssembly: - bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::InputAssembly; + bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::DynamicInputAssembly; bufferPoolDesc.m_heapMemoryLevel = RHI::HeapMemoryLevel::Host; bufferPoolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; break; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicBufferAllocator.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicBufferAllocator.cpp index e4599901a9..e79aa2e1bb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicBufferAllocator.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicBufferAllocator.cpp @@ -63,6 +63,7 @@ namespace AZ // [GFX TODO][ATOM-13182] Add unit tests for DynamicBufferAllocator's Allocate function RHI::Ptr DynamicBufferAllocator::Allocate(uint32_t size, [[maybe_unused]]uint32_t alignment) { + size = RHI::AlignUp(size, alignment); uint32_t allocatePosition = 0; //m_ringBufferStartAddress can be null for Null back end diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassAttachment.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassAttachment.cpp index d0262f7f83..a5082c5ee6 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassAttachment.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassAttachment.cpp @@ -174,7 +174,7 @@ namespace AZ } else if (GetAttachmentType() == RHI::AttachmentType::Buffer) { - bool isInputAssembly = RHI::CheckBitsAny(m_descriptor.m_buffer.m_bindFlags, RHI::BufferBindFlags::InputAssembly); + bool isInputAssembly = RHI::CheckBitsAny(m_descriptor.m_buffer.m_bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly); bool isConstant = RHI::CheckBitsAny(m_descriptor.m_buffer.m_bindFlags, RHI::BufferBindFlags::Constant); // Since InputAssembly and Constant cannot be inferred they are set manually. If those flags are set we don't want to add inferred flags on top as it may have a performance penalty From a532cc1217b2f67a025bae3205d16102ba4909d2 Mon Sep 17 00:00:00 2001 From: moudgils Date: Tue, 13 Apr 2021 14:27:11 -0700 Subject: [PATCH 05/20] Compile fix --- .../AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index 54d7dca292..f9c9431039 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp @@ -804,10 +804,10 @@ namespace AzToolsFramework addAction(m_actionToDeleteSelectionAndDescendants); m_actionToRenameSelection = new QAction(tr("Rename"), this); - #ifdef Q_OS_MAC + #if defined(Q_OS_MAC) // "Alt+Return" translates to Option+Return on macOS m_actionToRenameSelection->setShortcut(tr("Alt+Return")); - #elif Q_OS_WIN + #elif defined(Q_OS_WIN) m_actionToRenameSelection->setShortcut(tr("F2")); #endif m_actionToRenameSelection->setShortcutContext(Qt::WidgetWithChildrenShortcut); From fa9366b81017a29f92ba1cd3ad158eccd3118ade Mon Sep 17 00:00:00 2001 From: mcgarrah Date: Tue, 13 Apr 2021 19:35:59 -0500 Subject: [PATCH 06/20] Updating the AutomatedTesting project to support being built as an External Project --- AutomatedTesting/CMakeLists.txt | 40 +++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/AutomatedTesting/CMakeLists.txt b/AutomatedTesting/CMakeLists.txt index b2d9a18c6a..289d0a6565 100644 --- a/AutomatedTesting/CMakeLists.txt +++ b/AutomatedTesting/CMakeLists.txt @@ -9,12 +9,38 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # -file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json) +#! Adds the --project-path argument to the VS IDE debugger command arguments +function(add_vs_debugger_arguments) + # Inject the project root into the --project-path argument into the Visual Studio Debugger arguments by defaults + list(APPEND app_targets AutomatedTesting.GameLauncher AutomatedTesting.ServerLauncher) + list(APPEND app_targets AssetBuilder AssetProcessor AssetProcessorBatch Editor) + foreach(app_target IN LISTS app_targets) + if (TARGET ${app_target}) + set_property(TARGET ${app_target} APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${CMAKE_CURRENT_LIST_DIR}\"") + endif() + endforeach() +endfunction() -string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name") -if(${json_error}) - message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'") -endif() +if(NOT PROJECT_NAME) + cmake_minimum_required(VERSION 3.19) + project(AutomatedTesting + LANGUAGES C CXX + VERSION 1.0.0.0 + ) + include(EngineFinder.cmake OPTIONAL) + find_package(o3de REQUIRED) + o3de_initialize() + add_vs_debugger_arguments() +else() + # Add the project_name to global LY_PROJECTS_TARGET_NAME property + file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json) -set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name}) -add_subdirectory(Gem) + string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name") + if(json_error) + message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'") + endif() + + set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name}) + + add_subdirectory(Gem) +endif() \ No newline at end of file From 92b8e590ce850090f197b18b328a23ab68a3e60b Mon Sep 17 00:00:00 2001 From: mcgarrah Date: Tue, 13 Apr 2021 19:42:30 -0500 Subject: [PATCH 07/20] Added better error message around when the Unified Launcher target for a Project cannot be configured due to issues querying the project name from the provided project path --- Code/LauncherUnified/CMakeLists.txt | 15 +++++++++++++++ Templates/DefaultProject/Template/CMakeLists.txt | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index 0d056686b8..2cd53bdb41 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -73,6 +73,21 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC # If the project_path is relative, it is evaluated relative to the ${LY_ROOT_FOLDER} # Otherwise the the absolute project_path is returned with symlinks resolved file(REAL_PATH ${project_path} project_real_path BASE_DIRECTORY ${LY_ROOT_FOLDER}) + if(NOT project_name) + if(NOT EXISTS ${project_real_path}/project.json) + message(FATAL_ERROR "The specified project path of ${project_real_path} does not contain a project.json file with a \"project name\" entry in it") + else() + # Add the project_name to global LY_PROJECTS_TARGET_NAME property + file(READ "${project_real_path}/project.json" project_json) + string(JSON project_name ERROR_VARIABLE json_error GET ${project_json} "project_name") + if(json_error) + message(FATAL_ERROR "There is an error reading the \"project_name\" key from the '${project_real_path}/project.json' file: ${json_error}") + endif() + message(WARNING "The project located at path ${project_real_path} has a valid \"project name\" of '${project_name}' read from it's project.json file." + " This indicates that the ${project_real_path}/CMakeLists.txt is not properly appending the \"project name\" " + "to the LY_PROJECTS_TARGET_NAME global property. Other configuration errors might occur") + endif() + endif() ################################################################################ # Monolithic game ################################################################################ diff --git a/Templates/DefaultProject/Template/CMakeLists.txt b/Templates/DefaultProject/Template/CMakeLists.txt index 24b229d05b..c314f0da5c 100644 --- a/Templates/DefaultProject/Template/CMakeLists.txt +++ b/Templates/DefaultProject/Template/CMakeLists.txt @@ -38,7 +38,7 @@ else() file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json) string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name") - if(${json_error}) + if(json_error) message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'") endif() From 957945f8093c0fbc9ced20e5bebec14e2d03ee38 Mon Sep 17 00:00:00 2001 From: mcgarrah Date: Tue, 13 Apr 2021 19:50:06 -0500 Subject: [PATCH 08/20] Clarified the error message that is output when the project.json is not found --- Code/LauncherUnified/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index 2cd53bdb41..f0eb361f42 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -75,7 +75,7 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC file(REAL_PATH ${project_path} project_real_path BASE_DIRECTORY ${LY_ROOT_FOLDER}) if(NOT project_name) if(NOT EXISTS ${project_real_path}/project.json) - message(FATAL_ERROR "The specified project path of ${project_real_path} does not contain a project.json file with a \"project name\" entry in it") + message(FATAL_ERROR "The specified project path of ${project_real_path} does not contain a project.json file") else() # Add the project_name to global LY_PROJECTS_TARGET_NAME property file(READ "${project_real_path}/project.json" project_json) From 7b6ecc036b406561bac3ce117166c8e51afeb55c Mon Sep 17 00:00:00 2001 From: moudgils Date: Tue, 13 Apr 2021 21:16:04 -0700 Subject: [PATCH 09/20] Minor updates --- Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h | 2 +- .../Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp | 2 ++ Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h index f5ec9feebb..d12d30284e 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h @@ -33,7 +33,7 @@ namespace AZ /// Supports input assembly access through a IndexBufferView or StreamBufferView. This flag is for buffers that are not updated often InputAssembly = AZ_BIT(0), - /// Supports input assembly access through a IndexBufferView or StreamBufferView. This flag is for buffers that are updated perf frame + /// Supports input assembly access through a IndexBufferView or StreamBufferView. This flag is for buffers that are updated frequently DynamicInputAssembly = AZ_BIT(1), /// Supports constant access through a ShaderResourceGroup. diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp index 866c355dad..841c71126a 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp @@ -835,6 +835,8 @@ namespace AZ size_t prevEndOfLine = argBufferStr.rfind("\n", resourceStartPos); size_t nextEndOfLine = argBufferStr.find("\n", resourceStartPos); size_t startOfEntryPos = argBufferStr.find(resourceStr, prevEndOfLine); + + //Check to see if a valid entry is found. if(startOfEntryPos == AZStd::string::npos || startOfEntryPos > nextEndOfLine) { AZ_Error(MetalShaderPlatformName, startOfEntryPos != AZStd::string::npos, "Entry-> %s not found within Descriptor set %s", resourceStr, argBufferStr.c_str()); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp index d6b2b2c906..f95e871d33 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Conversions.cpp @@ -211,6 +211,7 @@ namespace AZ return GetCPUGPUMemoryMode(); } + //This flag is used for IA buffers that is updated frequently and hence shared mmory is the best fit if (RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::DynamicInputAssembly)) { return MTLStorageModeShared; From 6f67aabd67278ce906ec211e93ec2b763511d142 Mon Sep 17 00:00:00 2001 From: moudgils Date: Wed, 14 Apr 2021 09:42:13 -0700 Subject: [PATCH 10/20] Minor cleanup --- Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp | 3 +-- Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp index 8247ceb41a..9eb5638186 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp @@ -39,8 +39,7 @@ namespace AZ { m_device = &device; - if (RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::InputAssembly) || - RHI::CheckBitsAll(descriptor.m_bindFlags, RHI::BufferBindFlags::DynamicInputAssembly)) + if(RHI::CheckBitsAny(descriptor.m_bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { m_readOnlyState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER | D3D12_RESOURCE_STATE_INDEX_BUFFER; } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp index cb2ad7d2ed..81fd9e751b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp @@ -74,9 +74,9 @@ namespace AZ const RHI::BufferView* Buffer::GetBufferView() const { - if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly || - m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::DynamicInputAssembly) + if(RHI::CheckBitsAny(m_rhiBuffer->GetDescriptor().m_bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { + AZ_Assert(false, "Input assembly buffer doesn't need a regular buffer view, it requires a stream or index buffer view."); return nullptr; } @@ -204,12 +204,11 @@ namespace AZ void Buffer::InitBufferView() { // Skip buffer view creation for input assembly buffers - if (m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::InputAssembly || - m_rhiBuffer->GetDescriptor().m_bindFlags == RHI::BufferBindFlags::DynamicInputAssembly) + if(RHI::CheckBitsAny(m_rhiBuffer->GetDescriptor().m_bindFlags, RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::DynamicInputAssembly)) { return; } - + m_bufferView = m_rhiBuffer->GetBufferView(m_bufferViewDescriptor); if(!m_bufferView.get()) From fff97cda3bace16af52335a4856ea7acd95d70b7 Mon Sep 17 00:00:00 2001 From: amzn-sj Date: Wed, 14 Apr 2021 13:09:21 -0700 Subject: [PATCH 11/20] Cache runtime dependencies for targets to speed up iOS configuration. --- cmake/Platform/iOS/RuntimeDependencies_ios.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/Platform/iOS/RuntimeDependencies_ios.cmake b/cmake/Platform/iOS/RuntimeDependencies_ios.cmake index 37c1d6d976..d558c6f12a 100644 --- a/cmake/Platform/iOS/RuntimeDependencies_ios.cmake +++ b/cmake/Platform/iOS/RuntimeDependencies_ios.cmake @@ -28,6 +28,17 @@ function(ios_get_dependencies_recursive ios_DEPENDENCIES ly_TARGET) return() # Nothing to do endif() + # See if we already have dependencies cached. + get_property(are_dependencies_cached GLOBAL PROPERTY LY_RUNTIME_DEPENDENCIES_${ly_TARGET} SET) + if(are_dependencies_cached) + + # We already walked through this target + get_property(cached_dependencies GLOBAL PROPERTY LY_RUNTIME_DEPENDENCIES_${ly_TARGET}) + set(${ios_DEPENDENCIES} ${cached_dependencies} PARENT_SCOPE) + return() + + endif() + # Collect all direct dependencies. unset(direct_dependencies) unset(dependencies) @@ -102,6 +113,7 @@ function(ios_get_dependencies_recursive ios_DEPENDENCIES ly_TARGET) # Remove duplicate dependencies and return. list(REMOVE_DUPLICATES all_dependencies) + set_property(GLOBAL PROPERTY LY_RUNTIME_DEPENDENCIES_${ly_TARGET} "${all_dependencies}") set(${ios_DEPENDENCIES} ${all_dependencies} PARENT_SCOPE) endfunction() From a1f0baeefffb280064ad46568580410715fcbc49 Mon Sep 17 00:00:00 2001 From: Brian Herrera Date: Wed, 14 Apr 2021 14:43:01 -0700 Subject: [PATCH 12/20] Prevent skipping build if it's from a pull request Also add safe navigation operator on parameters. This avoids encoutering NullPointerException when accessing build parameters on the first build since these values will be set to null. --- scripts/build/Jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index 21f3411e8c..177ac5199d 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -270,7 +270,7 @@ def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline, if(env.IS_UNIX) pythonCmd = 'sudo -E python -u ' else pythonCmd = 'python -u ' - if(env.RECREATE_VOLUME.toBoolean()) { + if(env.RECREATE_VOLUME?.toBoolean()) { palSh("${pythonCmd} ${INCREMENTAL_BUILD_SCRIPT_PATH} --action delete --project ${projectName} --pipeline ${pipeline} --branch ${branchName} --platform ${platform} --build_type ${buildType}", 'Deleting volume') } timeout(5) { @@ -291,7 +291,7 @@ def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline, // Cleanup previous repo location, we are currently at the root of the workspace, if we have a .git folder // we need to cleanup. Once all branches take this relocation, we can remove this - if(env.CLEAN_WORKSPACE.toBoolean() || fileExists("${workspace}/.git")) { + if(env.CLEAN_WORKSPACE?.toBoolean() || fileExists("${workspace}/.git")) { if(fileExists(workspace)) { palRmDir(workspace) } @@ -315,7 +315,7 @@ def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline, script: 'python/get_python.bat' } - if(env.CLEAN_OUTPUT_DIRECTORY.toBoolean() || env.CLEAN_ASSETS.toBoolean()) { + if(env.CLEAN_OUTPUT_DIRECTORY?.toBoolean() || env.CLEAN_ASSETS?.toBoolean()) { def command = "${pipelineConfig.BUILD_ENTRY_POINT} --platform ${platform} --type clean" if (env.IS_UNIX) { sh label: "Running ${platform} clean", @@ -457,7 +457,7 @@ try { } } - if(env.BUILD_NUMBER == '1') { + if(env.BUILD_NUMBER == '1' && !branchName.startsWith('PR-')) { // Exit pipeline early on the intial build. This allows Jenkins to load the pipeline for the branch and enables users // to select build parameters on their first actual build. See https://issues.jenkins.io/browse/JENKINS-41929 currentBuild.result = 'SUCCESS' From 7609248c49e947a79fb3f391481109dde8935b07 Mon Sep 17 00:00:00 2001 From: amzn-sj Date: Wed, 14 Apr 2021 15:42:24 -0700 Subject: [PATCH 13/20] Fix build errors --- ..._iOS.mm => O3DEApplicationDelegate_iOS.mm} | 20 +++++++++---------- ...lication_iOS.mm => O3DEApplication_iOS.mm} | 8 ++++---- .../Platform/iOS/platform_ios_files.cmake | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) rename Code/LauncherUnified/Platform/iOS/{LumberyardApplicationDelegate_iOS.mm => O3DEApplicationDelegate_iOS.mm} (86%) rename Code/LauncherUnified/Platform/iOS/{LumberyardApplication_iOS.mm => O3DEApplication_iOS.mm} (92%) diff --git a/Code/LauncherUnified/Platform/iOS/LumberyardApplicationDelegate_iOS.mm b/Code/LauncherUnified/Platform/iOS/O3DEApplicationDelegate_iOS.mm similarity index 86% rename from Code/LauncherUnified/Platform/iOS/LumberyardApplicationDelegate_iOS.mm rename to Code/LauncherUnified/Platform/iOS/O3DEApplicationDelegate_iOS.mm index fc589a4780..ca7ab2def0 100644 --- a/Code/LauncherUnified/Platform/iOS/LumberyardApplicationDelegate_iOS.mm +++ b/Code/LauncherUnified/Platform/iOS/O3DEApplicationDelegate_iOS.mm @@ -39,15 +39,15 @@ namespace } -@interface LumberyardApplicationDelegate_iOS : NSObject +@interface O3DEApplicationDelegate_iOS : NSObject { } -@end // LumberyardApplicationDelegate_iOS Interface +@end // O3DEApplicationDelegate_iOS Interface -@implementation LumberyardApplicationDelegate_iOS +@implementation O3DEApplicationDelegate_iOS -- (int)runLumberyardApplication +- (int)runO3DEApplication { #if AZ_TESTS_ENABLED @@ -55,7 +55,7 @@ namespace return static_cast(ReturnCode::ErrUnitTestNotSupported); #else - using namespace LumberyardLauncher; + using namespace O3DELauncher; PlatformMainInfo mainInfo; mainInfo.m_updateResourceLimits = IncreaseResourceLimits; @@ -79,19 +79,19 @@ namespace #endif // AZ_TESTS_ENABLED } -- (void)launchLumberyardApplication +- (void)launchO3DEApplication { - const int exitCode = [self runLumberyardApplication]; + const int exitCode = [self runO3DEApplication]; exit(exitCode); } - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - // prevent the lumberyard runtime from running when launched in a xctest environment, otherwise the + // prevent the o3de runtime from running when launched in a xctest environment, otherwise the // testing framework will kill the "app" due to the lengthy bootstrap process if ([[NSProcessInfo processInfo] environment][@"XCTestConfigurationFilePath"] == nil) { - [self performSelector:@selector(launchLumberyardApplication) withObject:nil afterDelay:0.0]; + [self performSelector:@selector(launchO3DEApplication) withObject:nil afterDelay:0.0]; } return YES; } @@ -132,4 +132,4 @@ namespace &AzFramework::IosLifecycleEvents::Bus::Events::OnDidReceiveMemoryWarning); } -@end // LumberyardApplicationDelegate_iOS Implementation +@end // O3DEApplicationDelegate_iOS Implementation diff --git a/Code/LauncherUnified/Platform/iOS/LumberyardApplication_iOS.mm b/Code/LauncherUnified/Platform/iOS/O3DEApplication_iOS.mm similarity index 92% rename from Code/LauncherUnified/Platform/iOS/LumberyardApplication_iOS.mm rename to Code/LauncherUnified/Platform/iOS/O3DEApplication_iOS.mm index f2fa9498d5..c76c2f69ab 100644 --- a/Code/LauncherUnified/Platform/iOS/LumberyardApplication_iOS.mm +++ b/Code/LauncherUnified/Platform/iOS/O3DEApplication_iOS.mm @@ -16,12 +16,12 @@ #include -@interface LumberyardApplication_iOS : UIApplication +@interface O3DEApplication_iOS : UIApplication { } -@end // LumberyardApplication_iOS Interface +@end // O3DEApplication_iOS Interface -@implementation LumberyardApplication_iOS +@implementation O3DEApplication_iOS - (void)touchesBegan: (NSSet*)touches withEvent: (UIEvent*)event { @@ -65,4 +65,4 @@ [self touchesEnded: touches withEvent: event]; } -@end // LumberyardApplication_iOS Implementation +@end // O3DEApplication_iOS Implementation diff --git a/Code/LauncherUnified/Platform/iOS/platform_ios_files.cmake b/Code/LauncherUnified/Platform/iOS/platform_ios_files.cmake index c1a642481f..d5711ed04c 100644 --- a/Code/LauncherUnified/Platform/iOS/platform_ios_files.cmake +++ b/Code/LauncherUnified/Platform/iOS/platform_ios_files.cmake @@ -13,8 +13,8 @@ set(FILES Launcher_iOS.mm Launcher_Traits_iOS.h Launcher_Traits_Platform.h - LumberyardApplication_iOS.mm - LumberyardApplicationDelegate_iOS.mm + O3DEApplication_iOS.mm + O3DEApplicationDelegate_iOS.mm ../Common/Apple/Launcher_Apple.mm ../Common/Apple/Launcher_Apple.h ../Common/UnixLike/Launcher_UnixLike.cpp From f7aabebb375e9bd0e4e3b1dff4661ea3827aa1ca Mon Sep 17 00:00:00 2001 From: nvsickle Date: Wed, 14 Apr 2021 16:56:23 -0700 Subject: [PATCH 14/20] Fix context menu popping up when it shouldn't --- Code/Sandbox/Editor/LegacyViewportCameraController.cpp | 9 +++++++++ Code/Sandbox/Editor/LegacyViewportCameraController.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Code/Sandbox/Editor/LegacyViewportCameraController.cpp b/Code/Sandbox/Editor/LegacyViewportCameraController.cpp index 44b722d222..7a33dff377 100644 --- a/Code/Sandbox/Editor/LegacyViewportCameraController.cpp +++ b/Code/Sandbox/Editor/LegacyViewportCameraController.cpp @@ -96,6 +96,11 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove( speedScale *= gSettings.cameraFastMoveSpeed; } + if (m_inMoveMode || m_inOrbitMode || m_inRotateMode || m_inZoomMode) + { + m_totalMouseMoveDelta += (QPoint(currentMousePos.m_x, currentMousePos.m_y)-QPoint(previousMousePos.m_x, previousMousePos.m_y)).manhattanLength(); + } + if ((m_inRotateMode && m_inMoveMode) || m_inZoomMode) { Matrix34 m = AZTransformToLYTransform(viewportContext->GetCameraTransform()); @@ -343,11 +348,15 @@ bool LegacyViewportCameraControllerInstance::HandleInputChannelEvent(const AzFra } shouldCaptureCursor = true; + // Record how much the cursor has been moved to see if we should own the mouse up event. + m_totalMouseMoveDelta = 0; } else if (state == InputChannel::State::Ended) { m_inZoomMode = false; m_inRotateMode = false; + // If we've moved the cursor more than a couple pixels, we should eat this mouse up event to prevent the context menu controller from seeing it. + shouldConsumeEvent = m_totalMouseMoveDelta > 2; shouldCaptureCursor = false; } } diff --git a/Code/Sandbox/Editor/LegacyViewportCameraController.h b/Code/Sandbox/Editor/LegacyViewportCameraController.h index 3f211f49b7..b4a36f44a5 100644 --- a/Code/Sandbox/Editor/LegacyViewportCameraController.h +++ b/Code/Sandbox/Editor/LegacyViewportCameraController.h @@ -58,6 +58,7 @@ namespace SandboxEditor bool m_inMoveMode = false; bool m_inOrbitMode = false; bool m_inZoomMode = false; + int m_totalMouseMoveDelta = 0; float m_orbitDistance = 10.f; float m_moveSpeed = 1.f; AZ::Vector3 m_orbitTarget = {}; From 8b265d2e8d73c6ebd8100a08b06606704e630e81 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:38:57 -0700 Subject: [PATCH 15/20] Initial version that I need to test out (#60) LYN-2585 Add cmake/install job to Jenkins --- scripts/build/Jenkins/Jenkinsfile | 5 +++++ scripts/build/Platform/Windows/build_config.json | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index 177ac5199d..3d9ddd0411 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -214,6 +214,11 @@ def CheckoutBootstrapScripts(String branchName) { } def CheckoutRepo(boolean disableSubmodules = false) { + + if (!fileExists(ENGINE_REPOSITORY_NAME)) { + palMkdir(ENGINE_REPOSITORY_NAME) + } + palSh('git lfs uninstall', 'Git LFS Uninstall') // Prevent git from pulling lfs objects during checkout if(fileExists('.git')) { diff --git a/scripts/build/Platform/Windows/build_config.json b/scripts/build/Platform/Windows/build_config.json index a1290a254f..666c0ab5e7 100644 --- a/scripts/build/Platform/Windows/build_config.json +++ b/scripts/build/Platform/Windows/build_config.json @@ -281,5 +281,19 @@ "CMAKE_TARGET": "ALL_BUILD", "CMAKE_NATIVE_BUILD_ARGS": "/m /nologo" } + }, + "install_profile_vs2019": { + "TAGS": [ + "nightly" + ], + "COMMAND": "build_windows.cmd", + "PARAMETERS": { + "CONFIGURATION": "profile", + "OUTPUT_DIRECTORY": "build\\windows_vs2019", + "CMAKE_OPTIONS": "-G \"Visual Studio 16 2019\" -DCMAKE_SYSTEM_VERSION=10.0 -DLY_UNITY_BUILD=TRUE -DCMAKE_INSTALL_PREFIX=build\\install", + "CMAKE_LY_PROJECTS": "", + "CMAKE_TARGET": "INSTALL", + "CMAKE_NATIVE_BUILD_ARGS": "/m /nologo" + } } } From 2410d299c1ba6de8392751f0c9f6b0e7b72e8b03 Mon Sep 17 00:00:00 2001 From: srikappa Date: Wed, 14 Apr 2021 17:51:15 -0700 Subject: [PATCH 16/20] Make creation of new prefabs use a relative path to the project --- .../Prefab/PrefabPublicHandler.cpp | 2 +- .../Prefab/PrefabPublicHandler.h | 2 +- .../Prefab/PrefabPublicInterface.h | 2 +- .../UI/Prefab/PrefabIntegrationManager.cpp | 16 ++++++++++++++-- .../UI/Prefab/PrefabIntegrationManager.h | 4 ++++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 417a524e77..26191c97af 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -58,7 +58,7 @@ namespace AzToolsFramework m_prefabUndoCache.Destroy(); } - PrefabOperationResult PrefabPublicHandler::CreatePrefab(const AZStd::vector& entityIds, AZStd::string_view filePath) + PrefabOperationResult PrefabPublicHandler::CreatePrefab(const AZStd::vector& entityIds, AZ::IO::PathView filePath) { // Retrieve entityList from entityIds EntityList inputEntityList; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index 46a7f946ba..80f28d7edb 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -42,7 +42,7 @@ namespace AzToolsFramework void UnregisterPrefabPublicHandlerInterface(); // PrefabPublicInterface... - PrefabOperationResult CreatePrefab(const AZStd::vector& entityIds, AZStd::string_view filePath) override; + PrefabOperationResult CreatePrefab(const AZStd::vector& entityIds, AZ::IO::PathView filePath) override; PrefabOperationResult InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, AZ::Vector3 position) override; PrefabOperationResult SavePrefab(AZ::IO::Path filePath) override; PrefabEntityResult CreateEntity(AZ::EntityId parentId, const AZ::Vector3& position) override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicInterface.h index 81a5258d91..4e59729ab2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicInterface.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicInterface.h @@ -49,7 +49,7 @@ namespace AzToolsFramework * @param filePath The path for the new prefab file. * @return An outcome object; on failure, it comes with an error message detailing the cause of the error. */ - virtual PrefabOperationResult CreatePrefab(const AZStd::vector& entityIds, AZStd::string_view filePath) = 0; + virtual PrefabOperationResult CreatePrefab(const AZStd::vector& entityIds, AZ::IO::PathView filePath) = 0; /** * Instantiate a prefab from a prefab file. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp index 1e71b545b5..6ce3fdc755 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -39,9 +40,12 @@ namespace AzToolsFramework { namespace Prefab { + EditorEntityUiInterface* PrefabIntegrationManager::s_editorEntityUiInterface = nullptr; PrefabPublicInterface* PrefabIntegrationManager::s_prefabPublicInterface = nullptr; PrefabEditInterface* PrefabIntegrationManager::s_prefabEditInterface = nullptr; + PrefabLoaderInterface* PrefabIntegrationManager::s_prefabLoaderInterface = nullptr; + const AZStd::string PrefabIntegrationManager::s_prefabFileExtension = ".prefab"; void PrefabUserSettings::Reflect(AZ::ReflectContext* context) @@ -79,6 +83,13 @@ namespace AzToolsFramework return; } + s_prefabLoaderInterface = AZ::Interface::Get(); + if (s_prefabLoaderInterface == nullptr) + { + AZ_Assert(false, "Prefab - could not get PrefabLoaderInterface on PrefabIntegrationManager construction."); + return; + } + EditorContextMenuBus::Handler::BusConnect(); PrefabInstanceContainerNotificationBus::Handler::BusConnect(); AZ::Interface::Register(this); @@ -320,14 +331,15 @@ namespace AzToolsFramework GenerateSuggestedFilenameFromEntities(prefabRootEntities, suggestedName); - if (!QueryUserForPrefabSaveLocation(suggestedName, targetDirectory, AZ_CRC("PrefabUserSettings"), activeWindow, prefabName, prefabFilePath)) + if (!QueryUserForPrefabSaveLocation( + suggestedName, targetDirectory, AZ_CRC("PrefabUserSettings"), activeWindow, prefabName, prefabFilePath)) { // User canceled prefab creation, or error prevented continuation. return; } } - auto createPrefabOutcome = s_prefabPublicInterface->CreatePrefab(selectedEntities, prefabFilePath); + auto createPrefabOutcome = s_prefabPublicInterface->CreatePrefab(selectedEntities, s_prefabLoaderInterface->GetRelativePathToProject(prefabFilePath.data())); if (!createPrefabOutcome.IsSuccess()) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h index 66a047df28..c9b846aa5b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h @@ -29,6 +29,9 @@ namespace AzToolsFramework { namespace Prefab { + + class PrefabLoaderInterface; + //! Structure for saving/retrieving user settings related to prefab workflows. class PrefabUserSettings : public AZ::UserSettings @@ -129,6 +132,7 @@ namespace AzToolsFramework static EditorEntityUiInterface* s_editorEntityUiInterface; static PrefabPublicInterface* s_prefabPublicInterface; static PrefabEditInterface* s_prefabEditInterface; + static PrefabLoaderInterface* s_prefabLoaderInterface; }; } } From 243af5f697155ff8489d0a310ceaae1bd84eb90b Mon Sep 17 00:00:00 2001 From: pruiksma Date: Wed, 14 Apr 2021 23:13:31 -0500 Subject: [PATCH 17/20] ATOM-15240 Fixing thumbnails attempting to use a feature processor that no longer exists. Adding simple point and simple spot feature processors to the thumbnail scene descriptor. --- .../Rendering/ThumbnailRendererSteps/InitializeStep.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/ThumbnailRendererSteps/InitializeStep.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/ThumbnailRendererSteps/InitializeStep.cpp index 238cbb3a3c..2a447ce3ec 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/ThumbnailRendererSteps/InitializeStep.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/ThumbnailRendererSteps/InitializeStep.cpp @@ -54,8 +54,9 @@ namespace AZ RPI::SceneDescriptor sceneDesc; sceneDesc.m_featureProcessorNames.push_back("AZ::Render::TransformServiceFeatureProcessor"); sceneDesc.m_featureProcessorNames.push_back("AZ::Render::MeshFeatureProcessor"); + sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimplePointLightFeatureProcessor"); + sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimpleSpotLightFeatureProcessor"); sceneDesc.m_featureProcessorNames.push_back("AZ::Render::PointLightFeatureProcessor"); - sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SpotLightFeatureProcessor"); // There is currently a bug where having multiple DirectionalLightFeatureProcessors active can result in shadow flickering [ATOM-13568] // as well as continually rebuilding MeshDrawPackets [ATOM-13633]. Lets just disable the directional light FP for now. // Possibly re-enable with [GFX TODO][ATOM-13639] From 20c1454e4b0b626a9bec6c7eb81c400aa6516f58 Mon Sep 17 00:00:00 2001 From: dmcdiar Date: Thu, 15 Apr 2021 03:41:20 -0700 Subject: [PATCH 18/20] Added the ShaderRead buffer bind flag to the static and dynamic input assembly pools, and one creation of a static input assembly buffer. --- Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp | 4 ++-- Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp index fd2d029ddb..491f57deec 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp @@ -100,12 +100,12 @@ namespace AZ bufferPoolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; break; case CommonBufferPoolType::StaticInputAssembly: - bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::InputAssembly; + bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::InputAssembly | RHI::BufferBindFlags::ShaderRead; bufferPoolDesc.m_heapMemoryLevel = RHI::HeapMemoryLevel::Device; bufferPoolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; break; case CommonBufferPoolType::DynamicInputAssembly: - bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::DynamicInputAssembly; + bufferPoolDesc.m_bindFlags = RHI::BufferBindFlags::DynamicInputAssembly | RHI::BufferBindFlags::ShaderRead; bufferPoolDesc.m_heapMemoryLevel = RHI::HeapMemoryLevel::Host; bufferPoolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; break; diff --git a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h index 0a6cfafee7..bea6de5898 100644 --- a/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h +++ b/Gems/WhiteBox/Code/Source/Rendering/Atom/WhiteBoxBuffer.h @@ -98,7 +98,7 @@ namespace WhiteBox // specify the data format for vertex stream data AZ::RHI::BufferDescriptor bufferDescriptor; - bufferDescriptor.m_bindFlags = AZ::RHI::BufferBindFlags::InputAssembly; + bufferDescriptor.m_bindFlags = AZ::RHI::BufferBindFlags::InputAssembly | AZ::RHI::BufferBindFlags::ShaderRead; bufferDescriptor.m_byteCount = bufferSize; bufferDescriptor.m_alignment = elementSize; From ebebc05cd1709369171fdd87885c5de92a295a51 Mon Sep 17 00:00:00 2001 From: Ulugbek Adilbekov Date: Thu, 15 Apr 2021 16:16:31 +0100 Subject: [PATCH 19/20] Reenable Blast Automated tests (#42) Co-authored-by: Ulugbek Adilbekov --- .../Gem/Code/runtime_dependencies.cmake | 2 +- .../Gem/Code/tool_dependencies.cmake | 1 + .../Gem/PythonTests/Blast/TestSuite_Active.py | 14 +++++----- .../Gem/PythonTests/CMakeLists.txt | 26 +++++++++---------- AutomatedTesting/default.blastconfiguration | 2 +- .../Editor/EditorBlastMeshDataComponent.cpp | 2 +- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/AutomatedTesting/Gem/Code/runtime_dependencies.cmake b/AutomatedTesting/Gem/Code/runtime_dependencies.cmake index d281f64954..c8e66740e4 100644 --- a/AutomatedTesting/Gem/Code/runtime_dependencies.cmake +++ b/AutomatedTesting/Gem/Code/runtime_dependencies.cmake @@ -42,7 +42,6 @@ set(GEM_DEPENDENCIES Gem::SurfaceData Gem::GradientSignal Gem::Vegetation - Gem::Atom_RHI.Private Gem::Atom_RPI.Private Gem::Atom_Feature_Common @@ -54,4 +53,5 @@ set(GEM_DEPENDENCIES Gem::ImguiAtom Gem::Atom_AtomBridge Gem::AtomFont + Gem::Blast ) diff --git a/AutomatedTesting/Gem/Code/tool_dependencies.cmake b/AutomatedTesting/Gem/Code/tool_dependencies.cmake index 22132da686..8c5da63f42 100644 --- a/AutomatedTesting/Gem/Code/tool_dependencies.cmake +++ b/AutomatedTesting/Gem/Code/tool_dependencies.cmake @@ -68,4 +68,5 @@ set(GEM_DEPENDENCIES Gem::ImguiAtom Gem::AtomFont Gem::AtomToolsFramework.Editor + Gem::Blast.Editor ) diff --git a/AutomatedTesting/Gem/PythonTests/Blast/TestSuite_Active.py b/AutomatedTesting/Gem/PythonTests/Blast/TestSuite_Active.py index 947ea8363d..066a55c78c 100755 --- a/AutomatedTesting/Gem/PythonTests/Blast/TestSuite_Active.py +++ b/AutomatedTesting/Gem/PythonTests/Blast/TestSuite_Active.py @@ -27,28 +27,28 @@ from base import TestAutomationBase class TestAutomation(TestAutomationBase): def test_ActorSplitsAfterCollision(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterCollision as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterRadialDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterRadialDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterCapsuleDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterCapsuleDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterImpactSpreadDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterImpactSpreadDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterShearDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterShearDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterTriangleDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterTriangleDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) + self._run_test(request, workspace, editor, test_module) def test_ActorSplitsAfterStressDamage(self, request, workspace, editor, launcher_platform): from . import ActorSplitsAfterStressDamage as test_module - self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"]) \ No newline at end of file + self._run_test(request, workspace, editor, test_module) diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt index 3bd5f84312..ea9c365978 100644 --- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt @@ -135,20 +135,18 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) endif() ## Blast ## -# Disabled until AutomatedTesting runs with Atom. -# if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) -# ly_add_pytest( -# NAME AutomatedTesting::BlastTests -# TEST_SERIAL TRUE -# PATH ${CMAKE_CURRENT_LIST_DIR}/Blast/TestSuite_Active.py -# TIMEOUT 500 -# RUNTIME_DEPENDENCIES -# Legacy::Editor -# Legacy::CryRenderNULL -# AZ::AssetProcessor -# AutomatedTesting.Assets -# ) -# endif() +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) + ly_add_pytest( + NAME AutomatedTesting::BlastTests + TEST_SERIAL TRUE + PATH ${CMAKE_CURRENT_LIST_DIR}/Blast/TestSuite_Active.py + TIMEOUT 3600 + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + ) +endif() ############# diff --git a/AutomatedTesting/default.blastconfiguration b/AutomatedTesting/default.blastconfiguration index 96a23ecbb8..6318a5002f 100644 --- a/AutomatedTesting/default.blastconfiguration +++ b/AutomatedTesting/default.blastconfiguration @@ -1,6 +1,6 @@ - + diff --git a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp index d2aa81900b..51789f68da 100644 --- a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp +++ b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp @@ -179,7 +179,7 @@ namespace Blast void EditorBlastMeshDataComponent::RegisterModel() { - if (m_meshFeatureProcessor && m_meshAssets[0].GetId().IsValid()) + if (m_meshFeatureProcessor && !m_meshAssets.empty() && m_meshAssets[0].GetId().IsValid()) { AZ::Render::MaterialAssignmentMap materials; AZ::Render::MaterialComponentRequestBus::EventResult( From 020d7801bb625b8b7211dfb62bc45129b7cf7533 Mon Sep 17 00:00:00 2001 From: Terry Michaels <81711813+tjmichaels@users.noreply.github.com> Date: Thu, 15 Apr 2021 14:28:57 -0500 Subject: [PATCH 20/20] Make sure Recent Files list is correctly enabled/disabled when the list changes (#73) Make sure Recent Files list is correctly enabled/disabled when the recent files list changes --- .../AssetEditor/AssetEditorWidget.cpp | 20 ++++++++++++++++++- .../AssetEditor/AssetEditorWidget.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp index 603c7a8023..706d8243e2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp @@ -256,6 +256,8 @@ namespace AzToolsFramework m_userSettings = AZ::UserSettings::CreateFind(k_assetEditorWidgetSettings, AZ::UserSettings::CT_LOCAL); + UpdateRecentFileListState(); + QObject::connect(m_recentFileMenu, &QMenu::aboutToShow, this, &AssetEditorWidget::PopulateRecentMenu); } @@ -952,7 +954,8 @@ namespace AzToolsFramework void AssetEditorWidget::AddRecentPath(const AZStd::string& recentPath) { - m_userSettings->AddRecentPath(recentPath); + m_userSettings->AddRecentPath(recentPath); + UpdateRecentFileListState(); } void AssetEditorWidget::PopulateRecentMenu() @@ -989,6 +992,21 @@ namespace AzToolsFramework m_saveAsAssetAction->setEnabled(true); } + void AssetEditorWidget::UpdateRecentFileListState() + { + if (m_recentFileMenu) + { + if (!m_userSettings || m_userSettings->m_recentPaths.empty()) + { + m_recentFileMenu->setEnabled(false); + } + else + { + m_recentFileMenu->setEnabled(true); + } + } + } + } // namespace AssetEditor } // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.h index b27d69dba5..4379fc27ed 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.h @@ -122,6 +122,8 @@ namespace AzToolsFramework void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override; void OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo) override; + void UpdateRecentFileListState(); + private: void DirtyAsset();