Browse Source

Merge remote-tracking branch 'origin/main' into Atom/santorac/NewLayeringWorkflow

Chris Santora 4 years ago
parent
commit
2bc0d761ea

+ 26 - 10
Gem/Code/Source/DecalContainer.cpp

@@ -34,8 +34,8 @@ namespace AtomSampleViewer
         };
     }
 
-    DecalContainer::DecalContainer(AZ::Render::DecalFeatureProcessorInterface* fp)
-        : m_decalFeatureProcessor(fp)
+    DecalContainer::DecalContainer(AZ::Render::DecalFeatureProcessorInterface* fp, const AZ::Vector3 position)
+        : m_decalFeatureProcessor(fp), m_position(position)
     {
         SetupDecals();
     }
@@ -45,14 +45,14 @@ namespace AtomSampleViewer
         const float HalfLength = 0.25f;
         const float HalfProjectionDepth = 10.0f;
         const AZ::Vector3 halfSize(HalfLength, HalfLength, HalfProjectionDepth);
-        SetupNewDecal(AZ::Vector3(-0.75f, -0.25f, 1), halfSize, DecalMaterialNames[0]);
-        SetupNewDecal(AZ::Vector3(-0.25f, -0.25f, 1), halfSize, DecalMaterialNames[1]);
-        SetupNewDecal(AZ::Vector3(0.25f, -0.25f, 1), halfSize, DecalMaterialNames[2]);
-        SetupNewDecal(AZ::Vector3(0.75f, -0.25f, 1), halfSize, DecalMaterialNames[3]);
-        SetupNewDecal(AZ::Vector3(-0.75f, 0.25f, 1), halfSize, DecalMaterialNames[4]);
-        SetupNewDecal(AZ::Vector3(-0.25f, 0.25f, 1), halfSize, DecalMaterialNames[5]);
-        SetupNewDecal(AZ::Vector3(0.25f, 0.25f, 1), halfSize, DecalMaterialNames[6]);
-        SetupNewDecal(AZ::Vector3(0.75f, 0.25f, 1), halfSize, DecalMaterialNames[7]);
+        SetupNewDecal(AZ::Vector3(-0.75f, -0.25f, 1) + m_position, halfSize, DecalMaterialNames[0]);
+        SetupNewDecal(AZ::Vector3(-0.25f, -0.25f, 1) + m_position, halfSize, DecalMaterialNames[1]);
+        SetupNewDecal(AZ::Vector3(0.25f, -0.25f, 1) + m_position, halfSize, DecalMaterialNames[2]);
+        SetupNewDecal(AZ::Vector3(0.75f, -0.25f, 1) + m_position, halfSize, DecalMaterialNames[3]);
+        SetupNewDecal(AZ::Vector3(-0.75f, 0.25f, 1) + m_position, halfSize, DecalMaterialNames[4]);
+        SetupNewDecal(AZ::Vector3(-0.25f, 0.25f, 1) + m_position, halfSize, DecalMaterialNames[5]);
+        SetupNewDecal(AZ::Vector3(0.25f, 0.25f, 1) + m_position, halfSize, DecalMaterialNames[6]);
+        SetupNewDecal(AZ::Vector3(0.75f, 0.25f, 1) + m_position, halfSize, DecalMaterialNames[7]);
     }
 
     DecalContainer::~DecalContainer()
@@ -113,4 +113,20 @@ namespace AtomSampleViewer
         m_decalFeatureProcessor->ReleaseDecal(decal.m_decalHandle);
         decal.m_decalHandle = AZ::Render::DecalFeatureProcessorInterface::DecalHandle::Null;
     }
+
+    void DecalContainer::CloneFrom(const DecalContainer& containerToClone)
+    {
+        SetNumDecalsActive(0);
+        for (size_t i = 0; i < containerToClone.GetNumDecalsActive() ; ++i)
+        {
+            Decal& ourDecal = m_decals[i];
+            const Decal& otherDecal = containerToClone.m_decals[i];
+
+            ourDecal.m_decalHandle = m_decalFeatureProcessor->CloneDecal(otherDecal.m_decalHandle);
+
+            // Cloning sets the decal position to overlap the existing decal, lets move it so that it is visible
+            m_decalFeatureProcessor->SetDecalPosition(ourDecal.m_decalHandle, ourDecal.m_position);
+        }
+    }
+
 }

+ 3 - 1
Gem/Code/Source/DecalContainer.h

@@ -24,7 +24,7 @@ namespace AtomSampleViewer
     {
     public:
 
-        DecalContainer(AZ::Render::DecalFeatureProcessorInterface* fp);
+        DecalContainer(AZ::Render::DecalFeatureProcessorInterface* fp, const AZ::Vector3 position);
         DecalContainer(const DecalContainer&) = delete;
         DecalContainer& operator=(const DecalContainer&) = delete;
         ~DecalContainer();
@@ -32,6 +32,7 @@ namespace AtomSampleViewer
         void SetNumDecalsActive(int numDecals);
         int GetMaxDecals() const { return aznumeric_cast<int>(m_decals.size()); }
         int GetNumDecalsActive() const { return m_numDecalsActive; }
+        void CloneFrom(const DecalContainer& containerToClone);
 
     private:
 
@@ -52,5 +53,6 @@ namespace AtomSampleViewer
         AZStd::vector<Decal> m_decals;
         AZ::Render::DecalFeatureProcessorInterface* m_decalFeatureProcessor = nullptr;
         int m_numDecalsActive = 0;
+        AZ::Vector3 m_position;
     };
 } // namespace AtomSampleViewer

+ 16 - 3
Gem/Code/Source/DecalExampleComponent.cpp

@@ -87,8 +87,8 @@ namespace AtomSampleViewer
 
     void DecalExampleComponent::ScaleObjectToFitDecals()
     {
-        const AZ::Transform doubleSize = AZ::Transform::CreateScale(AZ::Vector3(2.0f, 1.0f, 1.0f));
-        GetMeshFeatureProcessor()->SetTransform(m_meshHandle, doubleSize);
+        const AZ::Transform transform = AZ::Transform::CreateScale(AZ::Vector3(4.0f, 1.0f, 1.0f));
+        GetMeshFeatureProcessor()->SetTransform(m_meshHandle, transform);
     }
 
     void DecalExampleComponent::Deactivate()
@@ -139,6 +139,18 @@ namespace AtomSampleViewer
             m_decalContainer->SetNumDecalsActive(numDecalsActive);
         }
 
+        if (ScriptableImGui::Checkbox("Clone decals", &m_cloneDecalsEnabled))
+        {
+            if (m_cloneDecalsEnabled)
+            {
+                m_decalContainerClone->CloneFrom(*m_decalContainer.get());
+            }
+            else
+            {
+                m_decalContainerClone->SetNumDecalsActive(0);
+            }
+        }
+
         m_imguiSidebar.End();
     }
 
@@ -146,7 +158,8 @@ namespace AtomSampleViewer
     {
         const AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
         const auto decalFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DecalFeatureProcessorInterface>();
-        m_decalContainer = AZStd::make_unique<DecalContainer>(decalFeatureProcessor);
+        m_decalContainer = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(1,0,0));
+        m_decalContainerClone = AZStd::make_unique<DecalContainer>(decalFeatureProcessor, AZ::Vector3(-1,0,0));
     }
 
 }

+ 3 - 0
Gem/Code/Source/DecalExampleComponent.h

@@ -58,7 +58,10 @@ namespace AtomSampleViewer
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         Utils::DefaultIBL m_defaultIbl;
         AZStd::unique_ptr<DecalContainer> m_decalContainer;
+        // Used to test the DecalFeatureProcessor::Clone() function
+        AZStd::unique_ptr<DecalContainer> m_decalContainerClone;
         ImGuiSidebar m_imguiSidebar;
+        bool m_cloneDecalsEnabled = false;
 
         // CommonSampleComponentBase overrides...
         void OnAllAssetsReadyActivate() override;

+ 70 - 0
Gem/Code/Source/MeshExampleComponent.cpp

@@ -81,6 +81,37 @@ namespace AtomSampleViewer
         };
     }
 
+    void MeshExampleComponent::DefaultWindowCreated()
+    {
+        AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_windowContext, &AZ::Render::Bootstrap::DefaultWindowBus::Events::GetDefaultWindowContext);
+    }
+
+    void MeshExampleComponent::CreateLowEndPipeline()
+    {
+        // Create low end pipeline
+        AZ::RPI::RenderPipelineDescriptor pipelineDesc;
+        pipelineDesc.m_mainViewTagName = "MainCamera";
+        pipelineDesc.m_name = "LowEndPipeline";
+        pipelineDesc.m_rootPassTemplate = "LowEndPipelineTemplate";
+        pipelineDesc.m_renderSettings.m_multisampleState.m_samples = 4;
+
+        m_lowEndPipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
+
+        // Add it to the scene
+        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
+        m_originalPipeline = defaultScene->GetDefaultRenderPipeline();
+        defaultScene->AddRenderPipeline(m_lowEndPipeline);
+        m_lowEndPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
+        m_lowEndPipeline->RemoveFromRenderTick();
+    }
+
+    void MeshExampleComponent::DestroyLowEndPipeline()
+    {
+        AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
+        defaultScene->RemoveRenderPipeline(m_lowEndPipeline->GetId());
+        m_lowEndPipeline = nullptr;
+    }
+
     void MeshExampleComponent::Activate()
     {
         UseArcBallCameraController();
@@ -118,10 +149,18 @@ namespace AtomSampleViewer
         m_groundPlaneModelAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/plane.azmodel", AZ::RPI::AssetUtils::TraceLevel::Assert);
 
         AZ::TickBus::Handler::BusConnect();
+        AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusConnect();
+        CreateLowEndPipeline();
     }
 
     void MeshExampleComponent::Deactivate()
     {
+        if (m_useLowEndPipeline)
+        {
+            DeactivateLowEndPipeline();
+        }
+        DestroyLowEndPipeline();
+        AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler::BusDisconnect();
         AZ::TickBus::Handler::BusDisconnect();
 
         m_imguiSidebar.Deactivate();
@@ -142,16 +181,47 @@ namespace AtomSampleViewer
         ShutdownLightingPresets();
     }
 
+    void MeshExampleComponent::ActivateLowEndPipeline()
+    {
+        m_lowEndPipeline->AddToRenderTick();
+        m_originalPipeline->RemoveFromRenderTick();
+        m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ m_lowEndPipeline->GetId().GetCStr(), "ImGuiPass" }));
+    }
+
+    void MeshExampleComponent::DeactivateLowEndPipeline()
+    {
+        m_originalPipeline->AddToRenderTick();
+        m_lowEndPipeline->RemoveFromRenderTick();
+        m_imguiScope = {}; // restores previous ImGui context.
+    }
+
     void MeshExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
     {
         bool modelNeedsUpdate = false;
 
+        // Switch pipeline before any imGui actions (switching pipelines switches imGui scope)
+        if (m_switchPipeline)
+        {
+            if (m_useLowEndPipeline)
+            {
+                ActivateLowEndPipeline();
+            }
+            else
+            {
+                DeactivateLowEndPipeline();
+            }
+
+            m_switchPipeline = false;
+        }
+
         if (m_imguiSidebar.Begin())
         {
             ImGuiLightingPreset();
 
             ImGuiAssetBrowser::WidgetSettings assetBrowserSettings;
 
+            m_switchPipeline = ScriptableImGui::Checkbox("Use Low End Pipeline", &m_useLowEndPipeline) || m_switchPipeline;
+
             modelNeedsUpdate |= ScriptableImGui::Checkbox("Enable Material Override", &m_enableMaterialOverride);
            
             if (ScriptableImGui::Checkbox("Show Ground Plane", &m_showGroundPlane))

+ 20 - 0
Gem/Code/Source/MeshExampleComponent.h

@@ -23,12 +23,15 @@
 #include <Utils/ImGuiMaterialDetails.h>
 #include <Utils/ImGuiAssetBrowser.h>
 
+#include <Atom/Bootstrap/DefaultWindowBus.h>
+#include <Atom/Feature/ImGui/ImGuiUtils.h>
 #include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
 
 namespace AtomSampleViewer
 {
     class MeshExampleComponent final
         : public CommonSampleComponentBase
+        , public AZ::Render::Bootstrap::DefaultWindowNotificationBus::Handler
         , public AZ::TickBus::Handler
     {
     public:
@@ -63,6 +66,20 @@ namespace AtomSampleViewer
         void SetArcBallControllerParams();
         void ResetCameraController();
 
+        void DefaultWindowCreated() override;
+
+        void CreateLowEndPipeline();
+        void DestroyLowEndPipeline();
+
+        void ActivateLowEndPipeline();
+        void DeactivateLowEndPipeline();
+
+        AZ::RPI::RenderPipelinePtr m_lowEndPipeline;
+        AZ::RPI::RenderPipelinePtr m_originalPipeline;
+
+        AZStd::shared_ptr<AZ::RPI::WindowContext> m_windowContext;
+        AZ::Render::ImGuiActiveContextScope m_imguiScope;
+
         enum class CameraControllerType : int32_t 
         {
             ArcBall = 0,
@@ -95,6 +112,9 @@ namespace AtomSampleViewer
 
         bool m_cameraControllerDisabled = false;
 
+        bool m_useLowEndPipeline = false;
+        bool m_switchPipeline = false;
+
         AZ::Data::Instance<AZ::RPI::Material> m_materialOverrideInstance; //< Holds a copy of the material instance being used when m_enableMaterialOverride is true.
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         AZ::Data::Asset<AZ::RPI::ModelAsset> m_modelAsset;

+ 8 - 6
Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.cpp

@@ -128,19 +128,21 @@ namespace AZ
 
             if (!m_rayTracingShaderTable)
             {
+                RHI::Ptr<RHI::Device> device = RHI::RHISystemInterface::Get()->GetDevice();
+                RHI::RayTracingBufferPools& rayTracingBufferPools = m_rayTracingFeatureProcessor->GetBufferPools();
+
                 // Build shader table once. Since we are not using local srg so we don't need to rebuild it even when scene changed 
                 m_rayTracingShaderTable = RHI::Factory::Get().CreateRayTracingShaderTable();
-                RHI::RayTracingShaderTableDescriptor descriptor;
-                descriptor.Build(AZ::Name("RayTracingAOShaderTable"), m_rayTracingPipelineState)
+                m_rayTracingShaderTable->Init(*device.get(), rayTracingBufferPools);
+
+                AZStd::shared_ptr<RHI::RayTracingShaderTableDescriptor> descriptor = AZStd::make_shared<RHI::RayTracingShaderTableDescriptor>();
+                descriptor->Build(AZ::Name("RayTracingAOShaderTable"), m_rayTracingPipelineState)
                     ->RayGenerationRecord(AZ::Name("AoRayGen"))
                     ->MissRecord(AZ::Name("AoMiss"))
                     ->HitGroupRecord(AZ::Name("ClosestHitGroup"))
                     ;
 
-                RHI::Ptr<RHI::Device> device = RHI::RHISystemInterface::Get()->GetDevice();
-                RHI::RayTracingBufferPools& rayTracingBufferPools = m_rayTracingFeatureProcessor->GetBufferPools();
-
-                m_rayTracingShaderTable->Init(*device.get(), &descriptor, rayTracingBufferPools);
+                m_rayTracingShaderTable->Build(descriptor);
             }
 
             RenderPass::FrameBeginInternal(params);

+ 2 - 2
Gem/Code/Source/RHI/BindlessPrototypeExampleComponent.cpp

@@ -393,8 +393,8 @@ namespace AtomSampleViewer
 
         // Set up the SRGs
         {
-            const char* floatBufferSrgPath = "shaderlib/atom/rpi/shaderresourcegroups/bindlessprototypesrg_floatbuffersrg.azsrg";
-            const char* imageSrgPath = "shaderlib/atom/rpi/shaderresourcegroups/bindlessprototypesrg_imagesrg.azsrg";
+            const char* floatBufferSrgPath = "shaders/rhi/bindlessprototypesrg_floatbuffersrg.azsrg";
+            const char* imageSrgPath = "shaders/rhi/bindlessprototypesrg_imagesrg.azsrg";
 
             // Set the FloatBufferSrg
             m_bindlessSrg = std::make_unique<BindlessSrg>(BindlessSrg({

+ 51 - 76
Gem/Code/Source/RHI/RayTracingExampleComponent.cpp

@@ -42,6 +42,30 @@ namespace AtomSampleViewer
         m_supportRHISamplePipeline = true;
     }
 
+    void RayTracingExampleComponent::Activate()
+    {
+        CreateResourcePools();
+        CreateGeometry();
+        CreateFullScreenBuffer();
+        CreateOutputTexture();
+        CreateRasterShader();
+        CreateRayTracingAccelerationStructureObjects();
+        CreateRayTracingPipelineState();
+        CreateRayTracingShaderTable();
+        CreateRayTracingAccelerationTableScope();
+        CreateRayTracingDispatchScope();
+        CreateRasterScope();
+
+        RHI::RHISystemNotificationBus::Handler::BusConnect();
+    }
+
+    void RayTracingExampleComponent::Deactivate()
+    {
+        RHI::RHISystemNotificationBus::Handler::BusDisconnect();
+        m_windowContext = nullptr;
+        m_scopeProducers.clear();
+    }
+
     void RayTracingExampleComponent::CreateResourcePools()
     {
         RHI::Ptr<RHI::Device> device = Utils::GetRHIDevice();
@@ -295,55 +319,11 @@ namespace AtomSampleViewer
         m_rayTracingPipelineState->Init(*device.get(), &descriptor);
     }
 
-    void RayTracingExampleComponent::CreateRayTracingShaderTableScope()
+    void RayTracingExampleComponent::CreateRayTracingShaderTable()
     {
-        struct ScopeData
-        {
-        };
-
-        const auto prepareFunction = [this]([[maybe_unused]] RHI::FrameGraphInterface& scopeBuilder, [[maybe_unused]] ScopeData& scopeData)
-        {
-        };
-
-        const auto compileFunction = [this]([[maybe_unused]] const RHI::FrameGraphCompileContext& context, [[maybe_unused]] const ScopeData& scopeData)
-        {
-        };
-
-        const auto executeFunction = [this]([[maybe_unused]] const RHI::FrameGraphExecuteContext& context, [[maybe_unused]] const ScopeData& scopeData)
-        {
-            RHI::Ptr<RHI::Device> device = Utils::GetRHIDevice();
-
-            // build the ray tracing shader table descriptor
-            RHI::RayTracingShaderTableDescriptor descriptor;
-            descriptor.Build(AZ::Name("RayTracingExampleShaderTable"), m_rayTracingPipelineState)
-                ->RayGenerationRecord(AZ::Name("RayGenerationShader"))
-                ->MissRecord(AZ::Name("MissShader"))
-                ->HitGroupRecord(AZ::Name("HitGroupGradient")) // triangle1
-                ->HitGroupRecord(AZ::Name("HitGroupGradient")) // triangle2
-                ->HitGroupRecord(AZ::Name("HitGroupSolid")) // triangle3
-                ->HitGroupRecord(AZ::Name("HitGroupSolid")) // rectangle
-            ;
-
-            // initialize the ray tracing shader table object
-            m_rayTracingShaderTable->Init(*device.get(), &descriptor, *m_rayTracingBufferPools);
-        };
-
-        // create the shader table once, outside of the scope
+        RHI::Ptr<RHI::Device> device = Utils::GetRHIDevice();
         m_rayTracingShaderTable = RHI::Factory::Get().CreateRayTracingShaderTable();
-
-        m_scopeProducers.emplace_back(
-            aznew RHI::ScopeProducerFunction<
-            ScopeData,
-            decltype(prepareFunction),
-            decltype(compileFunction),
-            decltype(executeFunction)>(
-                RHI::ScopeId{ "RayTracingBuildShaderTable" },
-                ScopeData{},
-                prepareFunction,
-                compileFunction,
-                executeFunction));
-
-        m_shaderTableScopeId = m_scopeProducers.back()->GetScopeId();
+        m_rayTracingShaderTable->Init(*device.get(), *m_rayTracingBufferPools);
     }
 
     void RayTracingExampleComponent::CreateRayTracingAccelerationTableScope()
@@ -463,6 +443,16 @@ namespace AtomSampleViewer
             m_rayTracingTlas->CreateBuffers(*device, &tlasDescriptor, *m_rayTracingBufferPools);
 
             m_tlasBufferViewDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, (uint32_t)m_rayTracingTlas->GetTlasBuffer()->GetDescriptor().m_byteCount);
+
+            [[maybe_unused]] RHI::ResultCode result = frameGraph.GetAttachmentDatabase().ImportBuffer(m_tlasBufferAttachmentId, m_rayTracingTlas->GetTlasBuffer());
+            AZ_Error(RayTracingExampleName, result == RHI::ResultCode::Success, "Failed to import TLAS buffer with error %d", result);
+
+            RHI::BufferScopeAttachmentDescriptor desc;
+            desc.m_attachmentId = m_tlasBufferAttachmentId;
+            desc.m_bufferViewDescriptor = m_tlasBufferViewDescriptor;
+            desc.m_loadStoreAction.m_loadAction = RHI::AttachmentLoadAction::Load;
+
+            frameGraph.UseShaderAttachment(desc, RHI::ScopeAttachmentAccess::ReadWrite);
         };
 
         RHI::EmptyCompileFunction<ScopeData> compileFunction;
@@ -513,18 +503,14 @@ namespace AtomSampleViewer
             // attach TLAS buffer
             if (m_rayTracingTlas->GetTlasBuffer())
             {
-                [[maybe_unused]] RHI::ResultCode result = frameGraph.GetAttachmentDatabase().ImportBuffer(m_tlasBufferAttachmentId, m_rayTracingTlas->GetTlasBuffer());
-                AZ_Error(RayTracingExampleName, result == RHI::ResultCode::Success, "Failed to import TLAS buffer with error %d", result);
-
                 RHI::BufferScopeAttachmentDescriptor desc;
                 desc.m_attachmentId = m_tlasBufferAttachmentId;
                 desc.m_bufferViewDescriptor = m_tlasBufferViewDescriptor;
                 desc.m_loadStoreAction.m_loadAction = RHI::AttachmentLoadAction::Load;
 
-                frameGraph.UseShaderAttachment(desc, RHI::ScopeAttachmentAccess::Read);
+                frameGraph.UseShaderAttachment(desc, RHI::ScopeAttachmentAccess::ReadWrite);
             }
 
-            frameGraph.ExecuteAfter(m_shaderTableScopeId);
             frameGraph.SetEstimatedItemCount(1);
         };
 
@@ -586,6 +572,19 @@ namespace AtomSampleViewer
 
                 m_globalSrg->SetConstantArray(hitSolidDataConstantIndex, hitSolidData);
                 m_globalSrg->Compile();
+
+                // update the ray tracing shader table
+                AZStd::shared_ptr<RHI::RayTracingShaderTableDescriptor> descriptor = AZStd::make_shared<RHI::RayTracingShaderTableDescriptor>();
+                descriptor->Build(AZ::Name("RayTracingExampleShaderTable"), m_rayTracingPipelineState)
+                    ->RayGenerationRecord(AZ::Name("RayGenerationShader"))
+                    ->MissRecord(AZ::Name("MissShader"))
+                    ->HitGroupRecord(AZ::Name("HitGroupGradient")) // triangle1
+                    ->HitGroupRecord(AZ::Name("HitGroupGradient")) // triangle2
+                    ->HitGroupRecord(AZ::Name("HitGroupSolid")) // triangle3
+                    ->HitGroupRecord(AZ::Name("HitGroupSolid")) // rectangle
+                    ;
+
+                m_rayTracingShaderTable->Build(descriptor);
             }
         };
 
@@ -704,28 +703,4 @@ namespace AtomSampleViewer
                 compileFunction,
                 executeFunction));
     }
-
-    void RayTracingExampleComponent::Activate()
-    {
-        CreateResourcePools();
-        CreateGeometry();
-        CreateFullScreenBuffer();
-        CreateOutputTexture();
-        CreateRasterShader();
-        CreateRayTracingAccelerationStructureObjects();
-        CreateRayTracingPipelineState();
-        CreateRayTracingShaderTableScope();
-        CreateRayTracingAccelerationTableScope();
-        CreateRayTracingDispatchScope();
-        CreateRasterScope();
-
-        RHI::RHISystemNotificationBus::Handler::BusConnect();
-    }
-
-    void RayTracingExampleComponent::Deactivate()
-    {
-        RHI::RHISystemNotificationBus::Handler::BusDisconnect();
-        m_windowContext = nullptr;
-        m_scopeProducers.clear();
-    }
 } // namespace AtomSampleViewer

+ 1 - 2
Gem/Code/Source/RHI/RayTracingExampleComponent.h

@@ -61,7 +61,7 @@ namespace AtomSampleViewer
         void CreateRasterShader();
         void CreateRayTracingAccelerationStructureObjects();
         void CreateRayTracingPipelineState();
-        void CreateRayTracingShaderTableScope();
+        void CreateRayTracingShaderTable();
         void CreateRayTracingAccelerationTableScope();
         void CreateRayTracingDispatchScope();
         void CreateRasterScope();
@@ -106,7 +106,6 @@ namespace AtomSampleViewer
 
         // ray tracing shader table
         RHI::Ptr<RHI::RayTracingShaderTable> m_rayTracingShaderTable;
-        RHI::ScopeId m_shaderTableScopeId;
 
         // ray tracing global shader resource group and pipeline state
         Data::Instance<RPI::ShaderResourceGroup> m_globalSrg;

+ 11 - 0
Gem/Code/Source/SampleComponentManager.cpp

@@ -333,6 +333,17 @@ namespace AtomSampleViewer
         auto* passSystem = RPI::PassSystemInterface::Get();
         passSystem->AddPassCreator(Name("RHISamplePass"), &AtomSampleViewer::RHISamplePass::Create);
 
+        // Load ASV's own pass templates mapping
+        // It can be loaded here and it doesn't need be added via OnReadyLoadTemplatesEvent::Handler
+        // since the first render pipeline is created after this point.
+        const char* asvPassTemplatesFile = "Passes/ASV/PassTemplates.azasset";
+        bool loaded = passSystem->LoadPassTemplateMappings(asvPassTemplatesFile);
+        if (!loaded)
+        {
+            AZ_Fatal("SampleComponentManager", "Failed to load AtomSampleViewer's pass templates at %s", asvPassTemplatesFile);
+            return;
+        }
+
         // Use scene and render pipeline for RHI samples as default scene and render pipeline
         CreateSceneForRHISample();
 

+ 0 - 1
Gem/Code/Source/SsaoExampleComponent.cpp

@@ -178,7 +178,6 @@ namespace AtomSampleViewer
 
         AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
         defaultScene->AddRenderPipeline(m_originalPipeline);
-        AZ::RPI::RenderPipelineDescriptor pipelineDesc;
         defaultScene->RemoveRenderPipeline(m_ssaoPipeline->GetId());
         DestroySsaoPipeline();
     }

+ 0 - 12
Gem/Code/runtime_dependencies.cmake

@@ -16,19 +16,7 @@ set(GEM_DEPENDENCIES
     Gem::LmbrCentral
     Gem::LyShine
     Gem::Camera
-    Gem::Atom_RHI.Private
-    Gem::Atom_RHI_Metal.Private
     Gem::EMotionFX
-    Gem::Atom_RHI_Vulkan.Private
-    Gem::Atom_RPI.Private
-    Gem::Atom_Feature_Common
-    Gem::Atom_Bootstrap
-    Gem::Atom_RHI_DX12.Private
-    Gem::Atom_RHI_Null.Private
-    Gem::Atom_Component_DebugCamera
-    Gem::AtomLyIntegration_CommonFeatures
-    Gem::EMotionFX_Atom
-    Gem::ImguiAtom
     Gem::Atom_AtomBridge
     Gem::AtomSampleViewer
 )

+ 0 - 22
Gem/Code/tool_dependencies.cmake

@@ -18,31 +18,9 @@ set(GEM_DEPENDENCIES
     Gem::SceneProcessing.Editor
     Gem::EditorPythonBindings.Editor
     Gem::Camera.Editor
-    Gem::Atom_RHI.Private
     Gem::EMotionFX.Editor
-    Gem::Atom_RHI_Vulkan.Private
-    Gem::Atom_RHI_Vulkan.Builders
-    Gem::Atom_RHI_Metal.Private
-    Gem::Atom_RHI_Metal.Builders
-    Gem::Atom_RPI.Builders
-    Gem::Atom_RPI.Editor
-    Gem::Atom_Feature_Common.Builders
-    Gem::Atom_Feature_Common.Editor
     Gem::ImGui.Editor
-    Gem::Atom_Bootstrap
-    Gem::Atom_Asset_Shader.Builders
-    Gem::Atom_RHI_DX12.Private
-    Gem::Atom_RHI_DX12.Builders
-    Gem::Atom_RHI_Null.Private
-    Gem::Atom_RHI_Null.Builders
-    Gem::Atom_Component_DebugCamera
-    Gem::AtomImGuiTools
-    Gem::AtomLyIntegration_CommonFeatures.Editor
-    Gem::EMotionFX_Atom.Editor
-    Gem::ImageProcessingAtom.Editor
     Gem::Atom_AtomBridge.Editor
     Gem::AtomSampleViewer
     Gem::AtomSampleViewer.Tools
-    Gem::ImguiAtom
-    Gem::AtomToolsFramework.Editor
 )

+ 2 - 2
Objects/bunny.fbx

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:ee81db4d3aa5c76316cb51c700d6b35f500bc599d91b9f62d057df16ed9be929
-size 3266108
+oid sha256:ef71257b240a7e704731806f8cd4b966af5d3c60f22881f9c6a6320180ee71a4
+size 2496384

+ 2 - 2
Objects/suzanne.fbx

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:832ebacab9593d877d59419e2970901806e514b12cccfc72808d6bcd031050db
-size 45436
+oid sha256:e3bcfac5de831c269dac58e7d73d1dc61eb8d9f6d8a241f5c029537b6bcdf166
+size 1088304

+ 117 - 0
Passes/ASV/PassTemplates.azasset

@@ -0,0 +1,117 @@
+{
+    "Type": "JsonSerialization",
+    "Version": 1,
+    "ClassName": "AssetAliasesSourceData",
+    "ClassData": {
+        "AssetPaths": [
+            {
+                "Name": "MainPipeline_Mobile",
+                "Path": "Passes/MainPipeline_Mobile.pass"
+            },
+            {
+                "Name": "ImGuiOnlyPipeline",
+                "Path": "Passes/ImGuiOnlyPipeline.pass"
+            },
+            {
+                "Name": "ImGuiNoInputPassTemplate",
+                "Path": "Passes/ImGuiNoInput.pass"
+            },
+            {
+                "Name": "ColorBlindPassTemplate",
+                "Path": "Passes/ColorblindnessSimulation.pass"
+            },
+            {
+                "Name": "ComplexPipeline",
+                "Path": "Passes/ComplexPipeline.pass"
+            },
+            {
+                "Name": "CheckerboardResolveColorTemplate",
+                "Path": "Passes/CheckerboardResolveColor.pass"
+            },
+            {
+                "Name": "CheckerboardResolveDepthTemplate",
+                "Path": "Passes/CheckerboardResolveDepth.pass"
+            },
+            {
+                "Name": "ForwardCheckerboardPassTemplate",
+                "Path": "Passes/ForwardCheckerboard.pass"
+            },
+            {
+                "Name": "DepthCheckerboardPassTemplate",
+                "Path": "Passes/DepthCheckerboard.pass"
+            },
+            {
+                "Name": "CheckerboardPipeline",
+                "Path": "Passes/CheckerboardPipeline.pass"
+            },
+            {
+                "Name": "MonochromeTemplate",
+                "Path": "Passes/Monochrome.pass"
+            },
+            {
+                "Name": "MSAA_RPI_Pipeline_Core",
+                "Path": "Passes/MSAA_RPI_Pipeline_Core.pass"
+            },
+            {
+                "Name": "MSAA_2x_RPI_Pipeline",
+                "Path": "Passes/MSAA_2x_RPI_Pipeline.pass"
+            },
+            {
+                "Name": "MSAA_4x_RPI_Pipeline",
+                "Path": "Passes/MSAA_4x_RPI_Pipeline.pass"
+            },
+            {
+                "Name": "MSAA_8x_RPI_Pipeline",
+                "Path": "Passes/MSAA_8x_RPI_Pipeline.pass"
+            },
+            {
+                "Name": "No_MSAA_RPI_Pipeline",
+                "Path": "Passes/No_MSAA_RPI_Pipeline.pass"
+            },
+            {
+                "Name": "ColorInvertCS",
+                "Path": "Passes/ColorInvertCS.pass"
+            },
+            {
+                "Name": "LuxCoreTexturePassTemplate",
+                "Path": "Passes/LuxCoreTexture.pass"
+            },
+            {
+                "Name": "RenderTextureTemplate",
+                "Path": "Passes/RenderTexture.pass"
+            },
+            {
+                "Name": "ReflectionsParentPass_nomsaaTemplate",
+                "Path": "Passes/Reflections_nomsaa.pass"
+            },
+            {
+                "Name": "ReflectionGlobalFullscreenPass_nomsaaTemplate",
+                "Path": "Passes/ReflectionGlobalFullscreen_nomsaa.pass"
+            },
+            {
+                "Name": "RHISamplePassTemplate",
+                "Path": "Passes/RHISamplePass.pass"
+            },
+            {
+                "Name": "RHISamplePipelineTemplate",
+                "Path": "Passes/RHISamplePipeline.pass"
+            },
+            {
+                "Name": "SsaoPipeline",
+                "Path": "Passes/SsaoPipeline.pass"
+            },
+            {
+                "Name": "DiffuseGlobalFullscreenPass_nomsaaTemplate",
+                "Path": "Passes/DiffuseGlobalFullscreen_nomsaa.pass"
+            },
+            {
+                "Name": "RayTracingAmbientOcclusionPassTemplate",
+                "Path": "Passes/RayTracingAmbientOcclusion.pass"
+            },
+            {
+                "Name": "SelectorPassTemplate",
+                "Path": "Passes/SelectorPass.pass"
+            }
+        ]
+    }
+}

+ 1 - 1
Passes/CheckerboardPipeline.pass

@@ -363,7 +363,7 @@
                 },
                 {
                     "Name": "SkyBoxPass",
-                    "TemplateName": "SkyBoxTemplate",
+                    "TemplateName": "SkyBoxTwoOutputsTemplate",
                     "Enabled": true,
                     "Connections": [
                         {

+ 0 - 442
Passes/MainPipeline.pass

@@ -1,442 +0,0 @@
-{
-    "Type": "JsonSerialization",
-    "Version": 1,
-    "ClassName": "PassAsset",
-    "ClassData": {
-        "PassTemplate": {
-            "Name": "MainPipeline",
-            "PassClass": "ParentPass",
-            "Slots": [
-                {
-                    "Name": "SwapChainOutput",
-                    "SlotType": "InputOutput",
-                    "ScopeAttachmentUsage": "RenderTarget"
-                }
-            ],
-            "PassRequests": [
-                {
-                    "Name": "MorphTargetPass",
-                    "TemplateName": "MorphTargetPassTemplate"
-                },
-                {
-                    "Name": "SkinningPass",
-                    "TemplateName": "SkinningPassTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "SkinnedMeshOutputStream",
-                            "AttachmentRef": {
-                                "Pass": "MorphTargetPass",
-                                "Attachment": "MorphTargetDeltaOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "RayTracingAccelerationStructurePass",
-                    "TemplateName": "RayTracingAccelerationStructurePassTemplate"
-                },
-                {
-                    "Name": "DiffuseProbeGridUpdatePass",
-                    "TemplateName": "DiffuseProbeGridUpdatePassTemplate",
-                    "ExecuteAfter": [
-                        "RayTracingAccelerationStructurePass"
-                    ]
-                },
-                {
-                    "Name": "DepthPrePass",
-                    "TemplateName": "DepthMSAAParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "SkinnedMeshes",
-                            "AttachmentRef": {
-                                "Pass": "SkinningPass",
-                                "Attachment": "SkinnedMeshOutputStream"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "MotionVectorPass",
-                    "TemplateName": "MotionVectorParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "SkinnedMeshes",
-                            "AttachmentRef": {
-                                "Pass": "SkinningPass",
-                                "Attachment": "SkinnedMeshOutputStream"
-                            }
-                        },
-                        {
-                            "LocalSlot": "Depth",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "Depth"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "LightCullingPass",
-                    "TemplateName": "LightCullingParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "SkinnedMeshes",
-                            "AttachmentRef": {
-                                "Pass": "SkinningPass",
-                                "Attachment": "SkinnedMeshOutputStream"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DepthMSAA",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "DepthMSAA"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "ShadowPass",
-                    "TemplateName": "ShadowParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "SkinnedMeshes",
-                            "AttachmentRef": {
-                                "Pass": "SkinningPass",
-                                "Attachment": "SkinnedMeshOutputStream"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "OpaquePass",
-                    "TemplateName": "OpaqueParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "DirectionalShadowmap",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "DirectionalShadowmap"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DirectionalESM",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "DirectionalESM"
-                            }
-                        },
-                        {
-                            "LocalSlot": "ProjectedShadowmap",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "ProjectedShadowmap"
-                            }
-                        },
-                        {
-                            "LocalSlot": "ProjectedESM",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "ProjectedESM"
-                            }
-                        },
-                        {
-                            "LocalSlot": "TileLightData",
-                            "AttachmentRef": {
-                                "Pass": "LightCullingPass",
-                                "Attachment": "TileLightData"
-                            }
-                        },
-                        {
-                            "LocalSlot": "LightListRemapped",
-                            "AttachmentRef": {
-                                "Pass": "LightCullingPass",
-                                "Attachment": "LightListRemapped"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DepthLinear",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "DepthLinear"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DepthStencil",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "DepthMSAA"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "TransparentPass",
-                    "TemplateName": "TransparentParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "DirectionalShadowmap",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "DirectionalShadowmap"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DirectionalESM",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "DirectionalESM"
-                            }
-                        },
-                        {
-                            "LocalSlot": "ProjectedShadowmap",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "ProjectedShadowmap"
-                            }
-                        },
-                        {
-                            "LocalSlot": "ProjectedESM",
-                            "AttachmentRef": {
-                                "Pass": "ShadowPass",
-                                "Attachment": "ProjectedESM"
-                            }
-                        },
-                        {
-                            "LocalSlot": "TileLightData",
-                            "AttachmentRef": {
-                                "Pass": "LightCullingPass",
-                                "Attachment": "TileLightData"
-                            }
-                        },
-                        {
-                            "LocalSlot": "LightListRemapped",
-                            "AttachmentRef": {
-                                "Pass": "LightCullingPass",
-                                "Attachment": "LightListRemapped"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DepthStencil",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "Depth"
-                            }
-                        },
-                        {
-                            "LocalSlot": "InputOutput",
-                            "AttachmentRef": {
-                                "Pass": "OpaquePass",
-                                "Attachment": "Output"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "DeferredFogPass",
-                    "TemplateName": "DeferredFogPassTemplate",
-                    "Enabled": false,
-                    "Connections": [
-                        {
-                            "LocalSlot": "InputLinearDepth",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "DepthLinear"
-                            }
-                        },
-                        {
-                            "LocalSlot": "InputDepthStencil",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "Depth"
-                            }
-                        },
-                        {
-                            "LocalSlot": "RenderTargetInputOutput",
-                            "AttachmentRef": {
-                                "Pass": "TransparentPass",
-                                "Attachment": "InputOutput"
-                            }
-                        }
-                    ],
-                    "PassData": {
-                        "$type": "FullscreenTrianglePassData",
-                        "ShaderAsset": {
-                            "FilePath": "Shaders/ScreenSpace/DeferredFog.shader"
-                        },
-                        "PipelineViewTag": "MainCamera"
-                    }
-                },
-                {
-                    "Name": "ReflectionCopyFrameBufferPass",
-                    "TemplateName": "ReflectionCopyFrameBufferPassTemplate",
-                    "Enabled": false,
-                    "Connections": [
-                        {
-                            "LocalSlot": "Input",
-                            "AttachmentRef": {
-                                "Pass": "DeferredFogPass",
-                                "Attachment": "RenderTargetInputOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "PostProcessPass",
-                    "TemplateName": "PostProcessParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "LightingInput",
-                            "AttachmentRef": {
-                                "Pass": "DeferredFogPass",
-                                "Attachment": "RenderTargetInputOutput"
-                            }
-                        },
-                        {
-                            "LocalSlot": "Depth",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "Depth"
-                            }
-                        },
-                        {
-                            "LocalSlot": "SwapChainOutput",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "AuxGeomPass",
-                    "TemplateName": "AuxGeomPassTemplate",
-                    "Enabled": true,
-                    "Connections": [
-                        {
-                            "LocalSlot": "ColorInputOutput",
-                            "AttachmentRef": {
-                                "Pass": "PostProcessPass",
-                                "Attachment": "Output"
-                            }
-                        },
-                        {
-                            "LocalSlot": "DepthInputOutput",
-                            "AttachmentRef": {
-                                "Pass": "DepthPrePass",
-                                "Attachment": "Depth"
-                            }
-                        }
-                    ],
-                    "PassData": {
-                        "$type": "RasterPassData",
-                        "DrawListTag": "auxgeom",
-                        "PipelineViewTag": "MainCamera"
-                    }
-                },
-                {
-                    "Name": "DebugOverlayPass",
-                    "TemplateName": "DebugOverlayParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "TileLightData",
-                            "AttachmentRef": {
-                                "Pass": "LightCullingPass",
-                                "Attachment": "TileLightData"
-                            }
-                        },
-                        {
-                            "LocalSlot": "RawLightingInput",
-                            "AttachmentRef": {
-                                "Pass": "PostProcessPass",
-                                "Attachment": "RawLightingOutput"
-                            }
-                        },
-                        {
-                            "LocalSlot": "LuminanceMipChainInput",
-                            "AttachmentRef": {
-                                "Pass": "PostProcessPass",
-                                "Attachment": "LuminanceMipChainOutput"
-                            }
-                        },
-                        {
-                            "LocalSlot": "InputOutput",
-                            "AttachmentRef": {
-                                "Pass": "AuxGeomPass",
-                                "Attachment": "ColorInputOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "UIPass",
-                    "TemplateName": "UIParentTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "InputOutput",
-                            "AttachmentRef": {
-                                "Pass": "DebugOverlayPass",
-                                "Attachment": "InputOutput"
-                            }
-                        }
-                    ]
-                },
-                {
-                    "Name": "CopyToSwapChain",
-                    "TemplateName": "FullscreenCopyTemplate",
-                    "Connections": [
-                        {
-                            "LocalSlot": "Input",
-                            "AttachmentRef": {
-                                "Pass": "UIPass",
-                                "Attachment": "InputOutput"
-                            }
-                        },
-                        {
-                            "LocalSlot": "Output",
-                            "AttachmentRef": {
-                                "Pass": "Parent",
-                                "Attachment": "SwapChainOutput"
-                            }
-                        }
-                    ]
-                }
-            ]
-        }
-    }
-}

+ 0 - 15
Passes/MainRenderPipeline.azasset

@@ -1,15 +0,0 @@
-{
-    "Type": "JsonSerialization",
-    "Version": 1,
-    "ClassName": "RenderPipelineDescriptor",
-    "ClassData": {
-        "Name": "MainPipeline",
-        "MainViewTag": "MainCamera",
-        "RootPassTemplate": "MainPipeline",
-        "RenderSettings": {
-            "MultisampleState": {
-                "samples": 4
-            }
-        }
-    }
-}

+ 0 - 593
Passes/PassTemplates.azasset

@@ -1,593 +0,0 @@
-{
-    "Type": "JsonSerialization",
-    "Version": 1,
-    "ClassName": "AssetAliasesSourceData",
-    "ClassData": {
-        "AssetPaths": [
-            {
-                "Name": "DepthPassTemplate",
-                "Path": "Passes/Depth.pass"
-            },
-            {
-                "Name": "DepthMSAAPassTemplate",
-                "Path": "Passes/DepthMSAA.pass"
-            },
-            {
-                "Name": "DepthMSAA2xPassTemplate",
-                "Path": "Passes/DepthMSAA2x.pass"
-            },
-            {
-                "Name": "DepthMSAA4xPassTemplate",
-                "Path": "Passes/DepthMSAA4x.pass"
-            },
-            {
-                "Name": "DepthMSAA8xPassTemplate",
-                "Path": "Passes/DepthMSAA8x.pass"
-            },
-            {
-                "Name": "DepthMaxPassTemplate",
-                "Path": "Passes/DepthMax.pass"
-            },
-            {
-                "Name": "ForwardPassTemplate",
-                "Path": "Passes/Forward.pass"
-            },
-            {
-                "Name": "ForwardMSAAPassTemplate",
-                "Path": "Passes/ForwardMSAA.pass"
-            },
-            {
-                "Name": "ForwardSubsurfaceMSAAPassTemplate",
-                "Path": "Passes/ForwardSubsurfaceMSAA.pass"
-            },
-            {
-                "Name": "CascadedShadowmapsTemplate",
-                "Path": "Passes/CascadedShadowmaps.pass"
-            },
-            {
-                "Name": "MainPipeline",
-                "Path": "Passes/MainPipeline.pass"
-            },
-            {
-                "Name": "MainPipeline_Mobile",
-                "Path": "Passes/MainPipeline_Mobile.pass"
-            },
-            {
-                "Name": "ImGuiOnlyPipeline",
-                "Path": "Passes/ImGuiOnlyPipeline.pass"
-            },
-            {
-                "Name": "ImGuiNoInputPassTemplate",
-                "Path": "Passes/ImGuiNoInput.pass"
-            },
-            {
-                "Name": "MainPipelineRenderToTexture",
-                "Path": "Passes/MainPipelineRenderToTexture.pass"
-            },
-            {
-                "Name": "FullscreenCopyTemplate",
-                "Path": "Passes/FullscreenCopy.pass"
-            },
-            {
-                "Name": "ModulateTextureTemplate",
-                "Path": "Passes/ModulateTexture.pass"
-            },
-            {
-                "Name": "BlendColorGradingLutsTemplate",
-                "Path": "Passes/BlendColorGradingLuts.pass"
-            },
-            {
-                "Name": "LookModificationCompositeTemplate",
-                "Path": "Passes/LookModificationComposite.pass"
-            },
-            {
-                "Name": "LookModificationTransformTemplate",
-                "Path": "Passes/LookModificationTransform.pass"
-            },
-            {
-                "Name": "ColorBlindPassTemplate",
-                "Path": "Passes/ColorblindnessSimulation.pass"
-            },
-            {
-                "Name": "ComplexPipeline",
-                "Path": "Passes/ComplexPipeline.pass"
-            },
-            {
-                "Name": "CheckerboardResolveColorTemplate",
-                "Path": "Passes/CheckerboardResolveColor.pass"
-            },
-            {
-                "Name": "CheckerboardResolveDepthTemplate",
-                "Path": "Passes/CheckerboardResolveDepth.pass"
-            },
-            {
-                "Name": "ForwardCheckerboardPassTemplate",
-                "Path": "Passes/ForwardCheckerboard.pass"
-            },
-            {
-                "Name": "DepthCheckerboardPassTemplate",
-                "Path": "Passes/DepthCheckerboard.pass"
-            },
-            {
-                "Name": "CheckerboardPipeline",
-                "Path": "Passes/CheckerboardPipeline.pass"
-            },
-            {
-                "Name": "LightCullingTilePrepareMSAATemplate",
-                "Path": "Passes/LightCullingTilePrepareMSAA.pass"
-            },
-            {
-                "Name": "LuminanceHeatmapTemplate",
-                "Path": "Passes/LuminanceHeatmap.pass"
-            },
-            {
-                "Name": "LuminanceHistogramGeneratorTemplate",
-                "Path": "Passes/LuminanceHistogramGenerator.pass"
-            },
-            {
-                "Name": "SkyBoxTemplate",
-                "Path": "Passes/SkyBox.pass"
-            },
-            {
-                "Name": "MonochromeTemplate",
-                "Path": "Passes/Monochrome.pass"
-            },
-            {
-                "Name": "MSAAResolveColorTemplate",
-                "Path": "Passes/MSAAResolveColor.pass"
-            },
-            {
-                "Name": "MSAAResolveCustomTemplate",
-                "Path": "Passes/MSAAResolveCustom.pass"
-            },
-            {
-                "Name": "MSAAResolveDepthTemplate",
-                "Path": "Passes/MSAAResolveDepth.pass"
-            },
-            {
-                "Name": "MSAA_RPI_Pipeline_Core",
-                "Path": "Passes/MSAA_RPI_Pipeline_Core.pass"
-            },
-            {
-                "Name": "MSAA_2x_RPI_Pipeline",
-                "Path": "Passes/MSAA_2x_RPI_Pipeline.pass"
-            },
-            {
-                "Name": "MSAA_4x_RPI_Pipeline",
-                "Path": "Passes/MSAA_4x_RPI_Pipeline.pass"
-            },
-            {
-                "Name": "MSAA_8x_RPI_Pipeline",
-                "Path": "Passes/MSAA_8x_RPI_Pipeline.pass"
-            },
-            {
-                "Name": "No_MSAA_RPI_Pipeline",
-                "Path": "Passes/No_MSAA_RPI_Pipeline.pass"
-            },
-            {
-                "Name": "ColorInvertCS",
-                "Path": "Passes/ColorInvertCS.pass"
-            },
-            {
-                "Name": "EyeAdaptationTemplate",
-                "Path": "Passes/EyeAdaptation.pass"
-            },
-            {
-                "Name": "DownsampleLuminanceMinAvgMaxCS",
-                "Path": "Passes/DownsampleLuminanceMinAvgMaxCS.pass"
-            },
-            {
-                "Name": "DownsampleMinAvgMaxCS",
-                "Path": "Passes/DownsampleMinAvgMaxCS.pass"
-            },
-            {
-                "Name": "DownsampleMipChainTemplate",
-                "Path": "Passes/DownsampleMipChain.pass"
-            },
-            {
-                "Name": "DisplayMapperTemplate",
-                "Path": "Passes/DisplayMapper.pass"
-            },
-            {
-                "Name": "UIPassTemplate",
-                "Path": "Passes/UI.pass"
-            },
-            {
-                "Name": "ImGuiPassTemplate",
-                "Path": "Passes/ImGui.pass"
-            },
-            {
-                "Name": "AuxGeomPassTemplate",
-                "Path": "Passes/AuxGeom.pass"
-            },
-            {
-                "Name": "DepthOfFieldTemplate",
-                "Path": "Passes/DepthOfField.pass"
-            },
-            {
-                "Name": "DepthOfFieldOnBokehTemplate",
-                "Path": "Passes/DepthOfFieldOnBokeh.pass"
-            },
-            {
-                "Name": "DepthOfFieldBlurBokehTemplate",
-                "Path": "Passes/DepthOfFieldBlurBokeh.pass"
-            },
-            {
-                "Name": "DepthOfFieldCompositeTemplate",
-                "Path": "Passes/DepthOfFieldComposite.pass"
-            },
-            {
-                "Name": "DepthOfFieldDownSampleTemplate",
-                "Path": "Passes/DepthOfFieldDownSample.pass"
-            },
-            {
-                "Name": "DepthOfFieldPrepareTemplate",
-                "Path": "Passes/DepthOfFieldPrepare.pass"
-            },
-            {
-                "Name": "DepthOfFieldMaskTemplate",
-                "Path": "Passes/DepthOfFieldMask.pass"
-            },
-            {
-                "Name": "DepthOfFieldReadBackFocusDepthTemplate",
-                "Path": "Passes/DepthOfFieldReadBackFocusDepth.pass"
-            },
-            {
-                "Name": "DepthOfFieldWriteFocusDepthFromGpuTemplate",
-                "Path": "Passes/DepthOfFieldWriteFocusDepthFromGpu.pass"
-            },
-            {
-                "Name": "SkinningPassTemplate",
-                "Path": "Passes/Skinning.pass"
-            },
-            {
-                "Name": "BRDFTexturePipeline",
-                "Path": "Passes/BRDFTexturePipeline.pass"
-            },
-            {
-                "Name": "BRDFTextureTemplate",
-                "Path": "Passes/BRDFTexture.pass"
-            },
-            {
-                "Name": "TransparentPassTemplate",
-                "Path": "Passes/Transparent.pass"
-            },
-            {
-                "Name": "LuxCoreTexturePassTemplate",
-                "Path": "Passes/LuxCoreTexture.pass"
-            },
-            {
-                "Name": "RenderTextureTemplate",
-                "Path": "Passes/RenderTexture.pass"
-            },
-            {
-                "Name": "ConvertToAcescgTemplate",
-                "Path": "Passes/ConvertToAcescg.pass"
-            },
-            {
-                "Name": "DepthExponentiationTemplate",
-                "Path": "Passes/DepthExponentiation.pass"
-            },
-            {
-                "Name": "FilterDepthHorizontalTemplate",
-                "Path": "Passes/FilterDepthHorizontal.pass"
-            },
-            {
-                "Name": "FilterDepthVerticalTemplate",
-                "Path": "Passes/FilterDepthVertical.pass"
-            },
-            {
-                "Name": "EsmShadowmapsTemplate",
-                "Path": "Passes/EsmShadowmaps.pass"
-            },
-            {
-                "Name": "LightCullingHeatmapTemplate",
-                "Path": "Passes/LightCullingHeatmap.pass"
-            },
-            {
-                "Name": "LightCullingTemplate",
-                "Path": "Passes/LightCulling.pass"
-            },
-            {
-                "Name": "LightCullingTilePrepareTemplate",
-                "Path": "Passes/LightCullingTilePrepare.pass"
-            },
-            {
-                "Name": "LightCullingRemapTemplate",
-                "Path": "Passes/LightCullingRemap.pass"
-            },
-            {
-                "Name": "ProjectedShadowmapsTemplate",
-                "Path": "Passes/ProjectedShadowmaps.pass"
-            },
-            {
-                "Name": "EnvironmentCubeMapPipeline",
-                "Path": "Passes/EnvironmentCubeMapPipeline.pass"
-            },
-            {
-                "Name": "EnvironmentCubeMapForwardMSAAPassTemplate",
-                "Path": "Passes/EnvironmentCubeMapForwardMSAA.pass"
-            },
-            {
-                "Name": "EnvironmentCubeMapDepthMSAAPassTemplate",
-                "Path": "Passes/EnvironmentCubeMapDepthMSAA.pass"
-            },
-            {
-                "Name": "DepthToLinearTemplate",
-                "Path": "Passes/DepthToLinearDepth.pass"
-            },
-            {
-                "Name": "DeferredFogPassTemplate",
-                "Path": "Passes/DeferredFog.pass"
-            },
-            {
-                "Name": "SubsurfaceScatteringPassTemplate",
-                "Path": "Passes/SubsurfaceScattering.pass"
-            },
-            {
-                "Name": "DiffuseSpecularMergeTemplate",
-                "Path": "Passes/DiffuseSpecularMerge.pass"
-            },
-            {
-                "Name": "SMAAEdgeDetectionTemplate",
-                "Path": "Passes/SMAAEdgeDetection.pass"
-            },
-            {
-                "Name": "SMAABlendingWeightCalculationTemplate",
-                "Path": "Passes/SMAABlendingWeightCalculation.pass"
-            },
-            {
-                "Name": "SMAANeighborhoodBlendingTemplate",
-                "Path": "Passes/SMAANeighborhoodBlending.pass"
-            },
-            {
-                "Name": "SMAAConvertToPerceptualColorTemplate",
-                "Path": "Passes/SMAAConvertToPerceptualColor.pass"
-            },
-            {
-                "Name": "SMAA1xApplyLinearHDRColorTemplate",
-                "Path": "Passes/SMAA1xApplyLinearHDRColor.pass"
-            },
-            {
-                "Name": "SMAA1xApplyPerceptualColorTemplate",
-                "Path": "Passes/SMAA1xApplyPerceptualColor.pass"
-            },
-            {
-                "Name": "SsaoParentTemplate",
-                "Path": "Passes/SsaoParent.pass"
-            },
-            {
-                "Name": "SsaoComputeTemplate",
-                "Path": "Passes/SsaoCompute.pass"
-            },
-            {
-                "Name": "ReflectionsParentPassTemplate",
-                "Path": "Passes/Reflections.pass"
-            },
-            {
-                "Name": "ReflectionsParentPass_nomsaaTemplate",
-                "Path": "Passes/Reflections_nomsaa.pass"
-            },
-            {
-                "Name": "ReflectionProbeStencilPassTemplate",
-                "Path": "Passes/ReflectionProbeStencil.pass"
-            },
-            {
-                "Name": "ReflectionProbeBlendWeightPassTemplate",
-                "Path": "Passes/ReflectionProbeBlendWeight.pass"
-            },
-            {
-                "Name": "ReflectionGlobalFullscreenPassTemplate",
-                "Path": "Passes/ReflectionGlobalFullscreen.pass"
-            },
-            {
-                "Name": "ReflectionGlobalFullscreenPass_nomsaaTemplate",
-                "Path": "Passes/ReflectionGlobalFullscreen_nomsaa.pass"
-            },
-            {
-                "Name": "ReflectionProbeRenderOuterPassTemplate",
-                "Path": "Passes/ReflectionProbeRenderOuter.pass"
-            },
-            {
-                "Name": "ReflectionProbeRenderInnerPassTemplate",
-                "Path": "Passes/ReflectionProbeRenderInner.pass"
-            },
-            {
-                "Name": "ReflectionCopyFrameBufferPassTemplate",
-                "Path": "Passes/ReflectionCopyFrameBuffer.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpacePassTemplate",
-                "Path": "Passes/ReflectionScreenSpace.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpaceTracePassTemplate",
-                "Path": "Passes/ReflectionScreenSpaceTrace.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpaceBlurPassTemplate",
-                "Path": "Passes/ReflectionScreenSpaceBlur.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpaceBlurVerticalPassTemplate",
-                "Path": "Passes/ReflectionScreenSpaceBlurVertical.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpaceBlurHorizontalPassTemplate",
-                "Path": "Passes/ReflectionScreenSpaceBlurHorizontal.pass"
-            },
-            {
-                "Name": "ReflectionScreenSpaceCompositePassTemplate",
-                "Path": "Passes/ReflectionScreenSpaceComposite.pass"
-            },
-            {
-                "Name": "ReflectionCompositePassTemplate",
-                "Path": "Passes/ReflectionComposite.pass"
-            },
-            {
-                "Name": "CameraMotionVectorPassTemplate",
-                "Path": "Passes/CameraMotionVector.pass"
-            },
-            {
-                "Name": "MeshMotionVectorPassTemplate",
-                "Path": "Passes/MeshMotionVector.pass"
-            },
-            {
-                "Name": "RayTracingAccelerationStructurePassTemplate",
-                "Path": "Passes/RayTracingAccelerationStructure.pass"
-            },
-            {
-                "Name": "RHISamplePassTemplate",
-                "Path": "Passes/RHISamplePass.pass"
-            },
-            {
-                "Name": "RHISamplePipelineTemplate",
-                "Path": "Passes/RHISamplePipeline.pass"
-            },
-            {
-                "Name": "FastDepthAwareBlurTemplate",
-                "Path": "Passes/FastDepthAwareBlur.pass"
-            },
-            {
-                "Name": "FastDepthAwareBlurHorTemplate",
-                "Path": "Passes/FastDepthAwareBlurHor.pass"
-            },
-            {
-                "Name": "FastDepthAwareBlurVerTemplate",
-                "Path": "Passes/FastDepthAwareBlurVer.pass"
-            },
-            {
-                "Name": "DepthDownsampleTemplate",
-                "Path": "Passes/DepthDownsample.pass"
-            },
-            {
-                "Name": "DepthUpsampleTemplate",
-                "Path": "Passes/DepthUpsample.pass"
-            },
-            {
-                "Name": "FullscreenOutputOnlyTemplate",
-                "Path": "Passes/FullscreenOutputOnly.pass"
-            },
-            {
-                "Name": "SsaoPipeline",
-                "Path": "Passes/SsaoPipeline.pass"
-            },
-            {
-                "Name": "BloomDownsamplePassTemplate",
-                "Path": "Passes/BloomDownsample.pass"
-            },
-            {
-                "Name": "BloomBlurPassTemplate",
-                "Path": "Passes/BloomBlur.pass"
-            },
-            {
-                "Name": "BloomCompositePassTemplate",
-                "Path": "Passes/BloomComposite.pass"
-            },
-            {
-                "Name": "BloomPassTemplate",
-                "Path": "Passes/Bloom.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridRayTracingPassTemplate",
-                "Path": "Passes/DiffuseProbeGridRayTracing.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridUpdatePassTemplate",
-                "Path": "Passes/DiffuseProbeGridUpdate.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridBlendIrradiancePassTemplate",
-                "Path": "Passes/DiffuseProbeGridBlendIrradiance.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridBlendDistancePassTemplate",
-                "Path": "Passes/DiffuseProbeGridBlendDistance.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridBorderUpdatePassTemplate",
-                "Path": "Passes/DiffuseProbeGridBorderUpdate.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridRelocationPassTemplate",
-                "Path": "Passes/DiffuseProbeGridRelocation.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridClassificationPassTemplate",
-                "Path": "Passes/DiffuseProbeGridClassification.pass"
-            },
-            {
-                "Name": "DiffuseGlobalIlluminationPassTemplate",
-                "Path": "Passes/DiffuseGlobalIllumination.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridDownsamplePassTemplate",
-                "Path": "Passes/DiffuseProbeGridDownsample.pass"
-            },
-            {
-                "Name": "DiffuseProbeGridRenderPassTemplate",
-                "Path": "Passes/DiffuseProbeGridRender.pass"
-            },
-            {
-                "Name": "DiffuseCompositePassTemplate",
-                "Path": "Passes/DiffuseComposite.pass"
-            },
-            {
-                "Name": "DiffuseGlobalFullscreenPassTemplate",
-                "Path": "Passes/DiffuseGlobalFullscreen.pass"
-            },
-            {
-                "Name": "DiffuseGlobalFullscreenPass_nomsaaTemplate",
-                "Path": "Passes/DiffuseGlobalFullscreen_nomsaa.pass"
-            },
-            {
-                "Name": "MorphTargetPassTemplate",
-                "Path": "Passes/MorphTarget.pass"
-            },
-            {
-                "Name": "DepthMSAAParentTemplate",
-                "Path": "Passes/DepthMSAAParent.pass"
-            },
-            {
-                "Name": "MotionVectorParentTemplate",
-                "Path": "Passes/MotionVectorParent.pass"
-            },
-            {
-                "Name": "LightCullingParentTemplate",
-                "Path": "Passes/LightCullingParent.pass"
-            },
-            {
-                "Name": "ShadowParentTemplate",
-                "Path": "Passes/ShadowParent.pass"
-            },
-            {
-                "Name": "OpaqueParentTemplate",
-                "Path": "Passes/OpaqueParent.pass"
-            },
-            {
-                "Name": "TransparentParentTemplate",
-                "Path": "Passes/TransparentParent.pass"
-            },
-            {
-                "Name": "PostProcessParentTemplate",
-                "Path": "Passes/PostProcessParent.pass"
-            },
-            {
-                "Name": "DebugOverlayParentTemplate",
-                "Path": "Passes/DebugOverlayParent.pass"
-            },
-            {
-                "Name": "UIParentTemplate",
-                "Path": "Passes/UIParent.pass"
-            },
-            {
-                "Name": "RayTracingAmbientOcclusionPassTemplate",
-                "Path": "Passes/RayTracingAmbientOcclusion.pass"
-            },
-            {
-                "Name": "SelectorPassTemplate",
-                "Path": "Passes/SelectorPass.pass"
-            }
-        ]
-    }
-}

+ 3 - 1
Scripts/Decals.bv.lua

@@ -22,8 +22,10 @@ Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
 OpenSample('RPI/Decals')
 ResizeViewport(1600, 900)
 SelectImageComparisonToleranceLevel("Level G")
-ArcBallCameraController_SetDistance(2.0)
+ArcBallCameraController_SetDistance(4.0)
+-- Wait until decals are loaded in
 IdleFrames(5)
+SetImguiValue('Clone decals', true)
 TakeScreenshots()
 
 OpenSample(nil)

+ 2 - 2
Scripts/ExpectedScreenshots/Decals/screenshot_decals.png

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:da89aea3a80053f6bd03f660f9b156872e5d6b2c77e41d5e5fa9ad9598c56d8f
-size 904183
+oid sha256:1a44e936b61fd9181b72d2e4e4decf73a68cd6e0f9b88646f4ad5de5ce819d94
+size 379981

+ 13 - 13
Shaders/RHI/BindlessPrototype.azsl

@@ -13,7 +13,7 @@
 // GlobalSrg::m_floatBuffer
 // PerSceneSrg::m_textureArray
 // PerSceneSrg::m_sampler
-#include <Atom/RPI/ShaderResourceGroups/BindlessPrototypeSrg.azsli>
+#include "BindlessPrototypeSrg.azsli"
 
 struct BindlessMaterial0
 {
@@ -87,15 +87,15 @@ VertexOutput MainVS(VertexInput vsInput)
     uint offset = 0;
     PerObject perObject;
     {
-        SetFloat4x4(perObject.m_localToWorldMatrix, HandleSrg::m_perObjectHandle, offset);
-        SetFloat4(perObject.rotation, HandleSrg::m_perObjectHandle, offset);
+        ReadFromFloatBuffer(perObject.m_localToWorldMatrix, HandleSrg::m_perObjectHandle, offset);
+        ReadFromFloatBuffer(perObject.rotation, HandleSrg::m_perObjectHandle, offset);
     }
 
     // Read the world matrix from the FloatBuffer
     float4x4 worldToClipMatrix;
     offset = 0;
     {
-        SetFloat4x4(worldToClipMatrix, HandleSrg::m_perViewHandle, offset);
+        ReadFromFloatBuffer(worldToClipMatrix, HandleSrg::m_perViewHandle, offset);
     }
 
     const float4 worldPosition = mul(perObject.m_localToWorldMatrix,  float4(vsInput.m_position, 1.0));
@@ -119,22 +119,22 @@ PixelOutput MainPS(VertexOutput psInput)
     // Read the material index to identify the material type
     uint4 materialIndex;
     {
-        SetUint4(materialIndex, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(materialIndex, HandleSrg::m_materialHandle, offset);
     }
     
     // Read the material data from the FloatBuffer depending ont he material index
     if(materialIndex.x == 0) // Albedo material
     {
         BindlessMaterial0 bindlessMaterial0; 
-        SetFloat4(bindlessMaterial0.m_diffuseColor, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial0.m_diffuseColor, HandleSrg::m_materialHandle, offset);
         
         OUT.m_color = float4(bindlessMaterial0.m_diffuseColor.xyz, 1.0);
     }
     else if(materialIndex.x == 1) // Texture sample material
     {
         BindlessMaterial1 bindlessMaterial1; 
-        SetFloat4(bindlessMaterial1.m_diffuseColor, HandleSrg::m_materialHandle, offset);
-        SetUint(bindlessMaterial1.m_diffuseTextureIndex, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial1.m_diffuseColor, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial1.m_diffuseTextureIndex, HandleSrg::m_materialHandle, offset);
 
         Texture2D texture = ImageSrg::m_textureArray[bindlessMaterial1.m_diffuseTextureIndex % 8]; // % 8 for wrap-around texture index as specified in ImageSrg.m_textureArray
         OUT.m_color = texture.Sample(ImageSrg::m_sampler, psInput.m_uv);
@@ -143,17 +143,17 @@ PixelOutput MainPS(VertexOutput psInput)
     {
         float4 color;
         BindlessMaterial2 bindlessMaterial2; 
-        SetFloat4(bindlessMaterial2.m_diffuseColor, HandleSrg::m_materialHandle, offset);
-        SetUint(bindlessMaterial2.m_diffuseTextureIndex, HandleSrg::m_materialHandle, offset);
-        SetUint(bindlessMaterial2.m_normalTextureIndex, HandleSrg::m_materialHandle, offset);
-        SetUint(bindlessMaterial2.m_specularTextureIndex, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial2.m_diffuseColor, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial2.m_diffuseTextureIndex, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial2.m_normalTextureIndex, HandleSrg::m_materialHandle, offset);
+        ReadFromFloatBuffer(bindlessMaterial2.m_specularTextureIndex, HandleSrg::m_materialHandle, offset);
 
         Texture2D texture = ImageSrg::m_textureArray[bindlessMaterial2.m_diffuseTextureIndex % 8]; // % 8 for wrap-around texture index as specified in ImageSrg.m_textureArray
         color = texture.Sample(ImageSrg::m_sampler, psInput.m_uv);
 
         float3 lightDir;
         uint lightOffset = 0;
-        SetFloat3(lightDir, HandleSrg::m_lightHandle, lightOffset); 
+        ReadFromFloatBuffer(lightDir, HandleSrg::m_lightHandle, lightOffset); 
         lightDir = normalize(-lightDir);
 
         color *= dot(lightDir, psInput.m_normal) * 8.0;

+ 136 - 0
Shaders/RHI/BindlessPrototypeSrg.azsli

@@ -0,0 +1,136 @@
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+  
+#pragma once
+
+// NOTE: Nest this array, so Azslc will output a size of the bindingslot to 1
+struct FloatBuffer
+{
+    float buffer;
+};
+
+// Listed on update frequency
+ShaderResourceGroupSemantic FrequencyPerScene 
+{
+    FrequencyId = 6;
+};
+
+ShaderResourceGroupSemantic FloatBufferSemanticId
+{
+    FrequencyId = 7;
+};
+
+ShaderResourceGroup ImageSrg : FrequencyPerScene
+{
+    Sampler m_sampler
+    {
+        MaxAnisotropy = 16;
+        AddressU = Wrap;
+        AddressV = Wrap;
+        AddressW = Wrap;
+    };
+
+    // Array of textures
+    Texture2D m_textureArray[];
+}
+
+ShaderResourceGroup FloatBufferSrg : FloatBufferSemanticId
+{
+    StructuredBuffer<FloatBuffer> m_floatBuffer;
+};
+
+// Helper functions to read data from the FloatBuffer. The FloatBuffer is accessed with an offset and an index.
+// The offset holds the initial offset within the FloatBuffer, and the index is a sub-index, which increments with each property that is being read.
+// The data needs to be read in the same order as it is allocated on the host.
+
+// read floats
+void ReadFromFloatBuffer(out float outFloat, in uint offset, inout uint index)
+{
+    outFloat = FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer;
+    index += 1;
+}
+
+void ReadFromFloatBuffer(out float2 outFloat, in uint offset, inout uint index)
+{
+    outFloat.x = FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer;
+    outFloat.y = FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer;
+    index += 2;
+}
+
+void ReadFromFloatBuffer(out float3 outFloat, in uint offset, inout uint index)
+{
+    outFloat.x = FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer;
+    outFloat.y = FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer;
+    outFloat.z = FloatBufferSrg::m_floatBuffer[offset + index + 2].buffer;
+    index += 3;
+}
+
+void ReadFromFloatBuffer(out float4 outFloat, in uint offset, inout uint index)
+{
+    outFloat.x = FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer;
+    outFloat.y = FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer;
+    outFloat.z = FloatBufferSrg::m_floatBuffer[offset + index + 2].buffer;
+    outFloat.w = FloatBufferSrg::m_floatBuffer[offset + index + 3].buffer;
+    index += 4;
+}
+
+// Read to matrix
+void ReadFromFloatBuffer(out float4x4 outFloat, in uint offset, inout uint index)
+{
+    [unroll(4)] 
+    for(uint i = 0; i < 4; i++)
+    {
+        ReadFromFloatBuffer(outFloat[i], offset, index);
+    }
+}
+
+// read uint
+void ReadFromFloatBuffer(out uint outUInt, in uint offset, inout uint index)
+{
+    outUInt = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer);
+    index += 1;
+}
+
+void ReadFromFloatBuffer(out uint2 outUInt, in uint offset, inout uint index)
+{
+    outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer);
+    outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer);
+    index += 2;
+}
+
+void ReadFromFloatBuffer(out uint3 outUInt, in uint offset, inout uint index)
+{
+    outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer);
+    outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer);
+    outUInt.z = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 2].buffer);
+    index += 3;
+}
+
+void ReadFromFloatBuffer(out uint4 outUInt, in uint offset, inout uint index)
+{
+    outUInt.x = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 0].buffer);
+    outUInt.y = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 1].buffer);
+    outUInt.z = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 2].buffer);
+    outUInt.w = asuint(FloatBufferSrg::m_floatBuffer[offset + index + 3].buffer);
+    index += 4;
+}
+
+// Read double
+void ReadFromFloatBuffer(out double outDouble, in uint offset, inout uint index)
+{
+    uint lowBits;
+    uint highBits;
+    ReadFromFloatBuffer(highBits, offset, index);
+    ReadFromFloatBuffer(lowBits, offset, index);
+
+    outDouble = asdouble(lowBits, highBits);
+}

+ 7 - 0
Textures/YokohamaCube.license.txt

@@ -0,0 +1,7 @@
+This yokohamCube.dss is modified from the following source
+
+https://www.humus.name/index.php?page=Textures
+https://www.humus.name/index.php?page=Cubemap&item=Yokohama3
+
+These textures are licensed under a Creative Commons Attribution 3.0 Unported License.
+https://creativecommons.org/licenses/by/3.0/

+ 18 - 1
atomsampleviewer_asset_files.cmake

@@ -22,7 +22,6 @@ set(FILES
     Passes/ImGuiNoInput.pass
     Passes/ImGuiOnlyPipeline.pass
     Passes/LuxCoreTexture.pass
-    Passes/MainPipeline.pass
     Passes/MainPipeline_Mobile.pass
     Passes/Monochrome.pass
     Passes/MSAA_2x_RPI_Pipeline.pass
@@ -30,9 +29,11 @@ set(FILES
     Passes/MSAA_8x_RPI_Pipeline.pass
     Passes/MSAA_RPI_Pipeline_Core.pass
     Passes/No_MSAA_RPI_Pipeline.pass
+    Passes/RayTracingAmbientOcclusion.pass
     Passes/RenderTexture.pass
     Passes/RHISamplePass.pass
     Passes/RHISamplePipeline.pass
+    Passes/SelectorPass.pass
     Passes/SsaoPipeline.pass
     Scripts/AreaLightTest.bv.lua
     Scripts/CheckerboardTest.bv.lua
@@ -54,6 +55,8 @@ set(FILES
     Scripts/ShadowTest.bv.lua
     Scripts/StreamingImageTest.bv.lua
     Scripts/TransparentTest.bv.lua
+    Scripts/_AutomatedPeriodicTestSuite_.bv.lua
+    Scripts/_AutomatedReviewTestSuite_.bv.lua
     Scripts/_FullTestSuite_.bv.lua
     Shaders/DebugVertexNormals.azsl
     Shaders/DebugVertexNormals.materialtype
@@ -78,6 +81,13 @@ set(FILES
     Shaders/PostProcessing/Monochrome.shader
     Shaders/PostProcessing/MSAAResolveDepth.azsl
     Shaders/PostProcessing/MSAAResolveDepth.shader
+    Shaders/RayTracing/RTAOClosestHit.azsl
+    Shaders/RayTracing/RTAOClosestHit.shader
+    Shaders/RayTracing/RTAODefines.azsli
+    Shaders/RayTracing/RTAOGeneration.azsl
+    Shaders/RayTracing/RTAOGeneration.shader
+    Shaders/RayTracing/RTAOMiss.azsl
+    Shaders/RayTracing/RTAOMiss.shader
     Shaders/RHI/AsyncComputeLuminanceMap.azsl
     Shaders/RHI/AsyncComputeLuminanceMap.shader
     Shaders/RHI/AsyncComputeLuminanceReduce.azsl
@@ -120,10 +130,17 @@ set(FILES
     Shaders/RHI/MultipleViewsShadow.shader
     Shaders/RHI/Multithread.azsl
     Shaders/RHI/Multithread.shader
+    Shaders/RHI/RayTracingClosestHitGradient.azsl
+    Shaders/RHI/RayTracingClosestHitGradient.shader
+    Shaders/RHI/RayTracingClosestHitSolid.azsl
+    Shaders/RHI/RayTracingClosestHitSolid.shader
+    Shaders/RHI/RayTracingCommon.azsli
     Shaders/RHI/RayTracingDispatch.azsl
     Shaders/RHI/RayTracingDispatch.shader
     Shaders/RHI/RayTracingDraw.azsl
     Shaders/RHI/RayTracingDraw.shader
+    Shaders/RHI/RayTracingMiss.azsl
+    Shaders/RHI/RayTracingMiss.shader
     Shaders/RHI/SHDemo.azsl
     Shaders/RHI/SHDemo.shader
     Shaders/RHI/SHRender.azsl

+ 16 - 11
generate_asset_cmake.bat

@@ -41,18 +41,23 @@ echo set(FILES>> %OUTPUT_FILE%
         set relativeFilePath=!relativeFilePath:\=/!
         
         
-        :: Filter out files in Materials/HotReloadTest. truncatedPath is the first 23 characters of the relative file path 
-        set truncatedPath=!relativeFilePath:~0,23!
-        if not !truncatedPath! == Materials/HotReloadTest (
-
-            :: Filter only relevant file types
-            if !relativeFilePath:~-4!  == .lua          echo %TAB%!relativeFilePath!
-            if !relativeFilePath:~-5!  == .pass         echo %TAB%!relativeFilePath!
-            if !relativeFilePath:~-5!  == .azsl         echo %TAB%!relativeFilePath!
-            if !relativeFilePath:~-6!  == .azsli        echo %TAB%!relativeFilePath!
-            if !relativeFilePath:~-7!  == .shader       echo %TAB%!relativeFilePath!
-            if !relativeFilePath:~-13! == .materialtype echo %TAB%!relativeFilePath!
+        :: Filter out files in Materials/HotReloadTest. materialHotReloadPath is the first 23 characters of the relative file path 
+        set materialHotReloadPath=!relativeFilePath:~0,23!
+        if not !materialHotReloadPath! == Materials/HotReloadTest (
+
+            :: Filter out files in Cache/. cachePath is the first 6 characters of the relative file path 
+            set cachePath=!relativeFilePath:~0,6!
+            if not !cachePath! == Cache/ (
+
+                :: Filter only relevant file types
+                if !relativeFilePath:~-4!  == .lua          echo %TAB%!relativeFilePath!
+                if !relativeFilePath:~-5!  == .pass         echo %TAB%!relativeFilePath!
+                if !relativeFilePath:~-5!  == .azsl         echo %TAB%!relativeFilePath!
+                if !relativeFilePath:~-6!  == .azsli        echo %TAB%!relativeFilePath!
+                if !relativeFilePath:~-7!  == .shader       echo %TAB%!relativeFilePath!
+                if !relativeFilePath:~-13! == .materialtype echo %TAB%!relativeFilePath!
             
+            )
         )
     )
 ) >> %OUTPUT_FILE%