Bladeren bron

Revert dxilpipelinestatevalidation namespaces

Young Kim 7 jaren geleden
bovenliggende
commit
0bc25bd790

+ 1 - 8
include/dxc/HLSL/DxilPipelineStateValidation.h

@@ -14,10 +14,6 @@
 
 #include <stdint.h>
 #include <string.h>
-namespace hlsl {
-namespace DXIL {
-namespace PSV {
-
 #ifndef UINT_MAX
 #define UINT_MAX 0xffffffff
 #endif
@@ -826,9 +822,6 @@ public:
     return PSVDependencyTable();
   }
 };
-} // namespace PSV
-} // namespace DXIL
-} // namespace hlsl
 
 namespace hlsl {
 
@@ -847,7 +840,7 @@ namespace hlsl {
       InvalidPSV,
     };
     virtual ~ViewIDValidator() {}
-    virtual Result ValidateStage(const DXIL::PSV::DxilPipelineStateValidation &PSV,
+    virtual Result ValidateStage(const DxilPipelineStateValidation &PSV,
                                  bool bFinalStage,
                                  bool bExpandInputOnly,
                                  unsigned &mismatchElementId) = 0;

+ 28 - 28
include/dxc/HLSL/ViewIDPipelineValidation.inl

@@ -16,7 +16,7 @@ namespace {
 
 typedef std::vector<DxilSignatureAllocator::DummyElement> ElementVec;
 
-struct ComponentMask : public DXIL::PSV::PSVComponentMask {
+struct ComponentMask : public PSVComponentMask {
   uint32_t Data[4];
   ComponentMask() : PSVComponentMask(Data, 0) {
     memset(Data, 0, sizeof(Data));
@@ -30,7 +30,7 @@ struct ComponentMask : public DXIL::PSV::PSVComponentMask {
   ComponentMask &operator=(const PSVComponentMask &other) {
     NumVectors = other.NumVectors;
     if (other.Mask && NumVectors) {
-      memcpy(Data, other.Mask, sizeof(uint32_t) * DXIL::PSV::PSVComputeMaskDwordsFromVectors(NumVectors));
+      memcpy(Data, other.Mask, sizeof(uint32_t) * PSVComputeMaskDwordsFromVectors(NumVectors));
     }
     else {
       memset(Data, 0, sizeof(Data));
@@ -49,7 +49,7 @@ struct ComponentMask : public DXIL::PSV::PSVComponentMask {
 };
 
 static void InitElement(DxilSignatureAllocator::DummyElement &eOut,
-                        const DXIL::PSV::PSVSignatureElement &eIn,
+                        const PSVSignatureElement &eIn,
                         DXIL::SigPointKind sigPoint) {
   eOut.rows = eIn.GetRows();
   eOut.cols = eIn.GetCols();
@@ -69,7 +69,7 @@ static void CopyElements( ElementVec &outElements,
                           DXIL::SigPointKind sigPoint,
                           unsigned numElements,
                           unsigned streamIndex,
-                          std::function<DXIL::PSV::PSVSignatureElement(unsigned)> getElement) {
+                          std::function<PSVSignatureElement(unsigned)> getElement) {
   outElements.clear();
   outElements.reserve(numElements);
   for (unsigned i = 0; i < numElements; i++) {
@@ -84,7 +84,7 @@ static void CopyElements( ElementVec &outElements,
 
 static void AddViewIDElements(ElementVec &outElements,
                               ElementVec &inElements,
-                              DXIL::PSV::PSVComponentMask &mask,
+                              PSVComponentMask &mask,
                               unsigned viewIDCount) {
   // Compute needed elements
   for (unsigned adding = 0; adding < 2; adding++) {
@@ -185,7 +185,7 @@ static bool MergeElements(const ElementVec &priorElements,
 static void PropagateMask(const ComponentMask &priorMask,
                           ElementVec &inputElements,
                           ComponentMask &outMask,
-                          std::function<DXIL::PSV::PSVComponentMask(unsigned)> getMask) {
+                          std::function<PSVComponentMask(unsigned)> getMask) {
   // Iterate elements
   for (auto &E : inputElements) {
     for (unsigned row = 0; row < E.GetRows(); row++) {
@@ -238,7 +238,7 @@ public:
       m_GSRastStreamIndex(gsRastStreamIndex)
   {}
   virtual ~ViewIDValidator_impl() {}
-  __override Result ValidateStage(const DXIL::PSV::DxilPipelineStateValidation &PSV,
+  __override Result ValidateStage(const DxilPipelineStateValidation &PSV,
                                   bool bFinalStage,
                                   bool bExpandInputOnly,
                                   unsigned &mismatchElementId) {
@@ -248,7 +248,7 @@ public:
       return Result::InvalidPSVVersion;
 
     switch (PSV.GetShaderKind()) {
-    case DXIL::PSV::PSVShaderKind::Vertex: {
+    case PSVShaderKind::Vertex: {
       if (bExpandInputOnly)
         return Result::InvalidUsage;
 
@@ -258,7 +258,7 @@ public:
       // capture output signature
       ElementVec outSig;
       CopyElements( outSig, DXIL::SigPointKind::VSOut, PSV.GetSigOutputElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetOutputElement0(i));
                     });
 
@@ -270,7 +270,7 @@ public:
 
       break;
     }
-    case DXIL::PSV::PSVShaderKind::Hull: {
+    case PSVShaderKind::Hull: {
       if (bFinalStage)
         return Result::InvalidUsage;
 
@@ -281,7 +281,7 @@ public:
       // capture signatures
       ElementVec inSig, outSig, pcSig;
       CopyElements( inSig, DXIL::SigPointKind::HSCPIn, PSV.GetSigInputElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetInputElement0(i));
                     });
 
@@ -303,22 +303,22 @@ public:
       }
 
       CopyElements(outSig, DXIL::SigPointKind::HSCPOut, PSV.GetSigOutputElements(), 0,
-        [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+        [&](unsigned i) -> PSVSignatureElement {
         return PSV.GetSignatureElement(PSV.GetOutputElement0(i));
       });
       CopyElements(pcSig, DXIL::SigPointKind::PCOut, PSV.GetSigPatchConstantElements(), 0,
-        [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+        [&](unsigned i) -> PSVSignatureElement {
         return PSV.GetSignatureElement(PSV.GetPatchConstantElement0(i));
       });
 
       // Propagate prior mask through input-output dependencies
       if (PSV.GetInputToOutputTable(0).IsValid()) {
         PropagateMask(m_PriorOutputMask, inSig, outputMask,
-                      [&](unsigned i) -> DXIL::PSV::PSVComponentMask { return PSV.GetInputToOutputTable(0).GetMaskForInput(i); });
+                      [&](unsigned i) -> PSVComponentMask { return PSV.GetInputToOutputTable(0).GetMaskForInput(i); });
       }
       if (PSV.GetInputToPCOutputTable().IsValid()) {
         PropagateMask(m_PriorOutputMask, inSig, pcMask,
-                      [&](unsigned i) -> DXIL::PSV::PSVComponentMask { return PSV.GetInputToPCOutputTable().GetMaskForInput(i); });
+                      [&](unsigned i) -> PSVComponentMask { return PSV.GetInputToPCOutputTable().GetMaskForInput(i); });
       }
 
       // Copy mask to prior mask
@@ -335,18 +335,18 @@ public:
 
       break;
     }
-    case DXIL::PSV::PSVShaderKind::Domain: {
+    case PSVShaderKind::Domain: {
       // Initialize mask with direct ViewID dependent outputs
       ComponentMask mask(PSV.GetViewIDOutputMask(0));
 
       // capture signatures
       ElementVec inSig, pcSig, outSig;
       CopyElements( inSig, DXIL::SigPointKind::DSCPIn, PSV.GetSigInputElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetInputElement0(i));
                     });
       CopyElements( pcSig, DXIL::SigPointKind::DSIn, PSV.GetSigPatchConstantElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetPatchConstantElement0(i));
                     });
 
@@ -382,18 +382,18 @@ public:
       }
 
       CopyElements(outSig, DXIL::SigPointKind::DSOut, PSV.GetSigOutputElements(), 0,
-        [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+        [&](unsigned i) -> PSVSignatureElement {
         return PSV.GetSignatureElement(PSV.GetOutputElement0(i));
       });
 
       // Propagate prior mask through input-output dependencies
       if (PSV.GetInputToOutputTable(0).IsValid()) {
         PropagateMask(m_PriorOutputMask, inSig, mask,
-                      [&](unsigned i) -> DXIL::PSV::PSVComponentMask { return PSV.GetInputToOutputTable(0).GetMaskForInput(i); });
+                      [&](unsigned i) -> PSVComponentMask { return PSV.GetInputToOutputTable(0).GetMaskForInput(i); });
       }
       if (PSV.GetPCInputToOutputTable().IsValid()) {
         PropagateMask(m_PriorPCMask, pcSig, mask,
-                      [&](unsigned i) -> DXIL::PSV::PSVComponentMask { return PSV.GetPCInputToOutputTable().GetMaskForInput(i); });
+                      [&](unsigned i) -> PSVComponentMask { return PSV.GetPCInputToOutputTable().GetMaskForInput(i); });
       }
 
       // Copy mask to prior mask
@@ -406,11 +406,11 @@ public:
 
       break;
     }
-    case DXIL::PSV::PSVShaderKind::Geometry: {
+    case PSVShaderKind::Geometry: {
       // capture signatures
       ElementVec inSig, outSig[4];
       CopyElements( inSig, DXIL::SigPointKind::GSVIn, PSV.GetSigInputElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetInputElement0(i));
                     });
 
@@ -436,7 +436,7 @@ public:
         ComponentMask mask(PSV.GetViewIDOutputMask(streamIndex));
 
         CopyElements( outSig[streamIndex], DXIL::SigPointKind::GSOut, PSV.GetSigOutputElements(), streamIndex,
-                      [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                      [&](unsigned i) -> PSVSignatureElement {
                         return PSV.GetSignatureElement(PSV.GetOutputElement0(i));
                       });
 
@@ -444,7 +444,7 @@ public:
           // Propagate prior mask through input-output dependencies
           if (PSV.GetInputToOutputTable(streamIndex).IsValid()) {
             PropagateMask(m_PriorOutputMask, inSig, mask,
-              [&](unsigned i) -> DXIL::PSV::PSVComponentMask { return PSV.GetInputToOutputTable(streamIndex).GetMaskForInput(i); });
+              [&](unsigned i) -> PSVComponentMask { return PSV.GetInputToOutputTable(streamIndex).GetMaskForInput(i); });
           }
 
           // Create new version with ViewID elements from prior signature
@@ -473,11 +473,11 @@ public:
 
       return Result::Success;
     }
-    case DXIL::PSV::PSVShaderKind::Pixel: {
+    case PSVShaderKind::Pixel: {
       // capture signatures
       ElementVec inSig;
       CopyElements( inSig, DXIL::SigPointKind::PSIn, PSV.GetSigInputElements(), 0,
-                    [&](unsigned i) -> DXIL::PSV::PSVSignatureElement {
+                    [&](unsigned i) -> PSVSignatureElement {
                       return PSV.GetSignatureElement(PSV.GetInputElement0(i));
                     });
 
@@ -500,7 +500,7 @@ public:
       // PS has to be the last stage, so return.
       return Result::Success;
     }
-    case DXIL::PSV::PSVShaderKind::Compute:
+    case PSVShaderKind::Compute:
     default:
       return Result::InvalidUsage;
     }

+ 0 - 1
lib/HLSL/DxilContainerAssembler.cpp

@@ -34,7 +34,6 @@
 
 using namespace llvm;
 using namespace hlsl;
-using namespace hlsl::DXIL::PSV;
 using namespace hlsl::DXIL::RDAT;
 
 static DxilProgramSigSemantic KindToSystemValue(Semantic::Kind kind, DXIL::TessellatorDomain domain) {

+ 1 - 2
lib/HLSL/DxilRootSignature.cpp

@@ -769,7 +769,7 @@ void RootSignatureVerifier::VerifyShader(DxilShaderVisibility VisType,
                                          const void *pPSVData,
                                          uint32_t PSVSize,
                                          DiagnosticPrinter &DiagPrinter) {
-  DXIL::PSV::DxilPipelineStateValidation PSV;
+  DxilPipelineStateValidation PSV;
   IFTBOOL(PSV.InitFromPSV0(pPSVData, PSVSize), E_INVALIDARG);
 
   bool bShaderDeniedByRootSig = false;
@@ -806,7 +806,6 @@ void RootSignatureVerifier::VerifyShader(DxilShaderVisibility VisType,
   bool bShaderHasRootBindings = false;
 
   for (unsigned iResource = 0; iResource < PSV.GetBindCount(); iResource++) {
-    using namespace DXIL::PSV;
     const PSVResourceBindInfo0 *pBindInfo0 = PSV.GetPSVResourceBindInfo0(iResource);
     DXASSERT_NOMSG(pBindInfo0);
 

+ 1 - 1
tools/clang/tools/dxcompiler/dxcdisassembler.cpp

@@ -1032,7 +1032,7 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
      << comment << "\n";
 
   const unsigned offset = sizeof(unsigned);
-  const hlsl::DXIL::PSV::PSVRuntimeInfo0 *pInfo = (hlsl::DXIL::PSV::PSVRuntimeInfo0 *)(pBuffer + offset);
+  const PSVRuntimeInfo0 *pInfo = (PSVRuntimeInfo0 *)(pBuffer + offset);
 
   switch (shaderKind) {
   case DXIL::ShaderKind::Hull: {