Ver Fonte

Fix RHI/OpenXr and Features/OpenXr sample (#587)

Signed-off-by: moudgils <[email protected]>
moudgils há 2 anos atrás
pai
commit
b818bafb6b

+ 5 - 0
Gem/Code/Source/Platform/Android/SampleComponentManager_Android.cpp

@@ -29,6 +29,11 @@ namespace AtomSampleViewer
         return "LowEndPipelineTemplate";
     }
 
+    const char* SampleComponentManager::GetMaterialPipelineName()
+    {
+        return "LowEndPipeline";
+    }
+
     int SampleComponentManager::GetDefaultNumMSAASamples()
     {
         return 1;

+ 5 - 0
Gem/Code/Source/Platform/Linux/SampleComponentManager_Linux.cpp

@@ -24,6 +24,11 @@ namespace AtomSampleViewer
         return "MainPipeline";
     }
     
+    const char* SampleComponentManager::GetMaterialPipelineName()
+    {
+        return "MainPipeline";
+    }
+
     int SampleComponentManager::GetDefaultNumMSAASamples()
     {
         return 4;

+ 5 - 0
Gem/Code/Source/Platform/Mac/SampleComponentManager_Mac.cpp

@@ -24,6 +24,11 @@ namespace AtomSampleViewer
         return "MainPipeline";
     }
 
+    const char* SampleComponentManager::GetMaterialPipelineName()
+    {
+        return "MainPipeline";
+    }
+
     int SampleComponentManager::GetDefaultNumMSAASamples()
     {
         return 4;

+ 11 - 0
Gem/Code/Source/Platform/Windows/SampleComponentManager_Windows.cpp

@@ -30,6 +30,17 @@ namespace AtomSampleViewer
         return "MainPipeline";
     }
 
+    const char* SampleComponentManager::GetMaterialPipelineName()
+    {
+        // Use Low end pipeline template for VR
+        AZ::RPI::XRRenderingInterface* xrSystem = AZ::RPI::RPISystemInterface::Get()->GetXRSystem();
+        if (xrSystem)
+        {
+            return "LowEndPipeline";
+        }
+        return "MainPipeline";
+    }
+
     int SampleComponentManager::GetDefaultNumMSAASamples()
     {
         // Use sample count of 1 for VR pipelines

+ 5 - 0
Gem/Code/Source/Platform/iOS/SampleComponentManager_iOS.cpp

@@ -29,6 +29,11 @@ namespace AtomSampleViewer
         return "LowEndPipelineTemplate";
     }
 
+    const char* SampleComponentManager::GetMaterialPipelineName()
+    {
+        return "LowEndPipeline";
+    }
+
     int SampleComponentManager::GetDefaultNumMSAASamples()
     {
         return 1;

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

@@ -1734,6 +1734,7 @@ namespace AtomSampleViewer
             RPI::RenderPipelineDescriptor pipelineDesc;
             pipelineDesc.m_name = "RPISamplePipeline";
             pipelineDesc.m_rootPassTemplate = GetRootPassTemplateName();
+            pipelineDesc.m_materialPipelineTag = GetMaterialPipelineName();
             pipelineDesc.m_mainViewTagName = "MainCamera";
             pipelineDesc.m_allowModification = true;
             pipelineDesc.m_renderSettings.m_multisampleState.m_samples = static_cast<uint16_t>(m_numMSAASamples);
@@ -1769,11 +1770,13 @@ namespace AtomSampleViewer
 
             // Build the pipeline for left eye
             xrPipelineDesc.m_name = "RPISamplePipelineXRLeft";
+            xrPipelineDesc.m_materialPipelineTag = "MultiViewPipeline";
             xrPipelineDesc.m_rootPassTemplate = "MultiViewXRLeftPipelineTemplate";
             RPI::RenderPipelinePtr renderPipelineLeft = RPI::RenderPipeline::CreateRenderPipelineForWindow(xrPipelineDesc, *m_windowContext.get(), AZ::RPI::ViewType::XrLeft);
 
             // Build the pipeline for right eye
             xrPipelineDesc.m_name = "RHISamplePipelineXRRight";
+            xrPipelineDesc.m_materialPipelineTag = "MultiViewPipeline";
             xrPipelineDesc.m_rootPassTemplate = "MultiViewXRRightPipelineTemplate";
             RPI::RenderPipelinePtr renderPipelineRight = RPI::RenderPipeline::CreateRenderPipelineForWindow(xrPipelineDesc, *m_windowContext.get(), AZ::RPI::ViewType::XrRight);
 

+ 2 - 1
Gem/Code/Source/SampleComponentManager.h

@@ -181,6 +181,7 @@ namespace AtomSampleViewer
         static bool IsMultiViewportSwapchainSampleSupported();
         void AdjustImGuiFontScale();
         const char* GetRootPassTemplateName();
+        const char* GetMaterialPipelineName();
         int GetDefaultNumMSAASamples();
 
         // ---------- variables -----------------
@@ -189,7 +190,7 @@ namespace AtomSampleViewer
 
         AZStd::vector<SampleEntry> m_availableSamples;
         // Maps from parent menu item name to a vector of indices into the available samples vector above
-        // Note: we specifically use an ordered map to ensure menus are alphabatized.
+        // Note: we specifically use an ordered map to ensure menus are alphabetized.
         AZStd::map<AZStd::string, AZStd::vector<int32_t>> m_groupedSamples;
 
         // Entity to hold only example component. It doesn't need an entity context.