Ver Fonte

Skip validation patch and collect shader flags for lib.

Xiang Li há 8 anos atrás
pai
commit
7878c0168e

+ 1 - 1
lib/HLSL/DxilGenerationPass.cpp

@@ -1555,7 +1555,7 @@ void DxilLegalizeResourceUsePass::PromoteLocalResource(Function &F) {
           // Skip for unpromotable for lib.
           if (!isAllocaPromotable(AI) && IsLib)
             continue;
-
+          DXASSERT(isAllocaPromotable(AI), "otherwise, non-promotable resource array alloca found");
           Allocas.push_back(AI);
         }
       }

+ 0 - 3
lib/HLSL/DxilModule.cpp

@@ -354,9 +354,6 @@ void DxilModule::CollectShaderFlags(ShaderFlags &Flags) {
     GetValidatorVersion(valMajor, valMinor);
     hasMulticomponentUAVLoadsBackCompat = valMajor <= 1 && valMinor == 0;
   }
-  // Don't check hasMulticomponentUAVLoads for lib.
-  if (m_pSM->IsLib())
-    hasMulticomponentUAVLoads = true;
 
   Type *int16Ty = Type::getInt16Ty(GetCtx());
   Type *int64Ty = Type::getInt64Ty(GetCtx());

+ 18 - 9
lib/HLSL/DxilPreparePasses.cpp

@@ -207,12 +207,18 @@ public:
       DxilModule &DM = M.GetDxilModule();
       // Remove store undef output.
       hlsl::OP *hlslOP = M.GetDxilModule().GetOP();
-      unsigned ValMajor = 0;
-      unsigned ValMinor = 0;
-      M.GetDxilModule().GetValidatorVersion(ValMajor, ValMinor);
-      if (ValMajor == 1 && ValMinor <= 1) {
-        patchValidation_1_1(M);
+
+      bool IsLib = DM.GetShaderModel()->IsLib();
+      // Skip patch for lib.
+      if (!IsLib) {
+        unsigned ValMajor = 0;
+        unsigned ValMinor = 0;
+        M.GetDxilModule().GetValidatorVersion(ValMajor, ValMinor);
+        if (ValMajor == 1 && ValMinor <= 1) {
+          patchValidation_1_1(M);
+        }
       }
+
       for (iplist<Function>::iterator F : M.getFunctionList()) {
         if (!hlslOP->IsDxilOpFunc(F))
           continue;
@@ -252,7 +258,6 @@ public:
       // patchconstant function.
       Function *EntryFunc = DM.GetEntryFunction();
       Function *PatchConstantFunc = DM.GetPatchConstantFunction();
-      bool IsLib = DM.GetShaderModel()->IsLib();
 
       std::vector<Function *> deadList;
       for (iplist<Function>::iterator F : M.getFunctionList()) {
@@ -345,9 +350,13 @@ public:
         }
       }
 
-      DM.CollectShaderFlags(); // Update flags to reflect any changes.
-                               // Update Validator Version
-      DM.UpgradeToMinValidatorVersion();
+      // Skip shader flag for library.
+      if (!IsLib) {
+        DM.CollectShaderFlags(); // Update flags to reflect any changes.
+                                 // Update Validator Version
+        DM.UpgradeToMinValidatorVersion();
+      }
+
       return true;
     }