|
57 | 57 | #include "dxc/dxcapi.h" |
58 | 58 | #include "dxc/dxcapi.internal.h" |
59 | 59 | #include "dxc/dxctools.h" |
60 | | -#include "llvm/IR/DebugInfo.h" |
61 | 60 | #include "llvm/Option/ArgList.h" |
62 | 61 | #include "llvm/Option/OptTable.h" |
63 | 62 | #include "llvm/Support/MemoryBuffer.h" |
64 | 63 | #include "llvm/Support/Path.h" |
65 | 64 | #include "llvm/Support/raw_ostream.h" |
66 | | - |
67 | 65 | #ifdef _WIN32 |
68 | 66 | #include <comdef.h> |
69 | 67 | #include <dia2.h> |
@@ -162,8 +160,6 @@ class DxcContext { |
162 | 160 | : m_Opts(Opts), m_dxcSupport(dxcSupport) {} |
163 | 161 |
|
164 | 162 | int Compile(); |
165 | | - void RunExternalValidatorAndMaybePrintValidationErrors( |
166 | | - CComPtr<IDxcOperationResult> pCompilerResult); |
167 | 163 | void Recompile(IDxcBlob *pSource, IDxcLibrary *pLibrary, |
168 | 164 | IDxcCompiler *pCompiler, std::vector<LPCWSTR> &args, |
169 | 165 | std::wstring &outputPDBPath, CComPtr<IDxcBlob> &pDebugBlob, |
@@ -813,39 +809,6 @@ void DxcContext::Recompile(IDxcBlob *pSource, IDxcLibrary *pLibrary, |
813 | 809 | *ppCompileResult = pResult.Detach(); |
814 | 810 | } |
815 | 811 |
|
816 | | -void DxcContext::RunExternalValidatorAndMaybePrintValidationErrors( |
817 | | - CComPtr<IDxcOperationResult> pCompileResult) { |
818 | | - |
819 | | - if (!pCompileResult) { |
820 | | - return; |
821 | | - } |
822 | | - |
823 | | - CComPtr<IDxcValidator> pValidator; |
824 | | - IFT(CreateInstance(CLSID_DxcValidator, &pValidator)); |
825 | | - |
826 | | - CComPtr<IDxcValidator2> pValidator2; |
827 | | - pValidator.QueryInterface(&pValidator2); |
828 | | - |
829 | | - CComPtr<IDxcBlob> pProgram; |
830 | | - CComPtr<IDxcOperationResult> pValResult; |
831 | | - |
832 | | - IFT(pCompileResult->GetResult(&pProgram)); |
833 | | - /*if (llvm::getDebugMetadataVersionFromModule(pProgram) != 0) { |
834 | | - llvmModuleWithDebugInfo.reset(llvm::CloneModule(inputs.pM.get())); |
835 | | - }*/ |
836 | | - IFT(pValidator->Validate(pProgram, |
837 | | - DxcValidatorFlags_RootSignatureOnly | |
838 | | - DxcValidatorFlags_InPlaceEdit, |
839 | | - &pValResult)); |
840 | | - CComPtr<IDxcResult> pResult; |
841 | | - HRESULT ValHR; |
842 | | - pValResult->GetStatus(&ValHR); |
843 | | - if (DXC_FAILED(ValHR)) |
844 | | - if (SUCCEEDED(pCompileResult->QueryInterface(&pResult))) { |
845 | | - WriteDxcOutputToFile(DXC_OUT_ERRORS, pResult, m_Opts.DefaultTextCodePage); |
846 | | - } |
847 | | -} |
848 | | - |
849 | 812 | int DxcContext::Compile() { |
850 | 813 | CComPtr<IDxcCompiler> pCompiler; |
851 | 814 | CComPtr<IDxcOperationResult> pCompileResult; |
@@ -928,8 +891,31 @@ int DxcContext::Compile() { |
928 | 891 | IID_PPV_ARGS(&pCompileResult))); |
929 | 892 |
|
930 | 893 | // Then validate |
931 | | - if (!m_Opts.DisableValidation) |
932 | | - RunExternalValidator(pCompileResult); |
| 894 | + if (!m_Opts.DisableValidation) { |
| 895 | + |
| 896 | + CComPtr<IDxcValidator> pValidator; |
| 897 | + IFT(CreateInstance(CLSID_DxcValidator, &pValidator)); |
| 898 | + |
| 899 | + CComPtr<IDxcBlob> pProgram; |
| 900 | + CComPtr<IDxcOperationResult> pValResult; |
| 901 | + |
| 902 | + IFT(pCompileResult->GetResult(&pProgram)); |
| 903 | + /*if (llvm::getDebugMetadataVersionFromModule(pProgram) != 0) { |
| 904 | + llvmModuleWithDebugInfo.reset(llvm::CloneModule(inputs.pM.get())); |
| 905 | + }*/ |
| 906 | + IFT(pValidator->Validate(pProgram, |
| 907 | + DxcValidatorFlags_RootSignatureOnly | |
| 908 | + DxcValidatorFlags_InPlaceEdit, |
| 909 | + &pValResult)); |
| 910 | + CComPtr<IDxcResult> pResult; |
| 911 | + HRESULT ValHR; |
| 912 | + pValResult->GetStatus(&ValHR); |
| 913 | + if (DXC_FAILED(ValHR)) { |
| 914 | + if (SUCCEEDED(pCompileResult->QueryInterface(&pResult))) |
| 915 | + WriteDxcOutputToFile(DXC_OUT_ERRORS, pResult, |
| 916 | + m_Opts.DefaultTextCodePage); |
| 917 | + } |
| 918 | + } |
933 | 919 | } |
934 | 920 | } |
935 | 921 | } |
|
0 commit comments