Bläddra i källkod

Treat RT entry like export - flatten params and don't clone

Tex Riddell 7 år sedan
förälder
incheckning
e67ee2ae17

+ 3 - 1
lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp

@@ -5060,7 +5060,9 @@ void SROA_Parameter_HLSL::flattenArgument(
   Function *Entry = m_pHLModule->GetEntryFunction();
   bool hasShaderInputOutput = F == Entry;
   if (m_pHLModule->HasDxilFunctionProps(F)) {
-    hasShaderInputOutput = true;
+    DxilFunctionProps &funcProps = m_pHLModule->GetDxilFunctionProps(F);
+    if (!funcProps.IsRay())
+      hasShaderInputOutput = true;
   }
   if (m_pHLModule->HasDxilFunctionProps(Entry)) {
     DxilFunctionProps &funcProps = m_pHLModule->GetDxilFunctionProps(Entry);

+ 4 - 0
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -4263,6 +4263,10 @@ void CGMSHLSLRuntime::FinishCodeGen() {
     }
   } else {
     for (auto &it : entryFunctionMap) {
+      // skip clone if RT entry
+      if (m_pHLModule->GetDxilFunctionProps(it.second.Func).IsRay())
+        continue;
+
       CloneShaderEntry(it.second.Func, it.getKey(), *m_pHLModule);
 
       auto AttrIter = HSEntryPatchConstantFuncAttr.find(it.second.Func);