Skip to content

Commit 8338a65

Browse files
committed
self review
1 parent dcca9fb commit 8338a65

File tree

3 files changed

+29
-44
lines changed

3 files changed

+29
-44
lines changed

include/dxc/Support/dxcapi.extval.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class DxcDllExtValidationLoader : public DllLoader {
7474
dxc::SpecificDllLoader DxCompilerSupport;
7575
dxc::SpecificDllLoader DxilExtValSupport;
7676
std::string DxilDllPath;
77-
ExternalValidationHelper ValWrapperObj;
7877

7978
public:
8079
std::string GetDxilDllPath() { return DxilDllPath; }

tools/clang/tools/dxclib/dxc.cpp

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@
5757
#include "dxc/dxcapi.h"
5858
#include "dxc/dxcapi.internal.h"
5959
#include "dxc/dxctools.h"
60-
#include "llvm/IR/DebugInfo.h"
6160
#include "llvm/Option/ArgList.h"
6261
#include "llvm/Option/OptTable.h"
6362
#include "llvm/Support/MemoryBuffer.h"
6463
#include "llvm/Support/Path.h"
6564
#include "llvm/Support/raw_ostream.h"
66-
6765
#ifdef _WIN32
6866
#include <comdef.h>
6967
#include <dia2.h>
@@ -162,8 +160,6 @@ class DxcContext {
162160
: m_Opts(Opts), m_dxcSupport(dxcSupport) {}
163161

164162
int Compile();
165-
void RunExternalValidatorAndMaybePrintValidationErrors(
166-
CComPtr<IDxcOperationResult> pCompilerResult);
167163
void Recompile(IDxcBlob *pSource, IDxcLibrary *pLibrary,
168164
IDxcCompiler *pCompiler, std::vector<LPCWSTR> &args,
169165
std::wstring &outputPDBPath, CComPtr<IDxcBlob> &pDebugBlob,
@@ -813,39 +809,6 @@ void DxcContext::Recompile(IDxcBlob *pSource, IDxcLibrary *pLibrary,
813809
*ppCompileResult = pResult.Detach();
814810
}
815811

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-
849812
int DxcContext::Compile() {
850813
CComPtr<IDxcCompiler> pCompiler;
851814
CComPtr<IDxcOperationResult> pCompileResult;
@@ -928,8 +891,31 @@ int DxcContext::Compile() {
928891
IID_PPV_ARGS(&pCompileResult)));
929892

930893
// 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+
}
933919
}
934920
}
935921
}

tools/clang/tools/dxcompiler/dxcompilerobj.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ class DxcCompiler : public IDxcCompiler3,
745745

746746
// Parse and apply
747747
if (opts.BindingTableDefine.size()) {
748-
// Just pas the define for now because preprocessor is not available
748+
// Just pass the define for now because preprocessor is not available
749749
// yet.
750750
struct BindingTableParserImpl
751751
: public CodeGenOptions::BindingTableParserType {
@@ -828,9 +828,6 @@ class DxcCompiler : public IDxcCompiler3,
828828
compiler.getLangOpts().HLSLEntryFunction =
829829
compiler.getCodeGenOpts().HLSLEntryFunction = "";
830830

831-
// NOTE: this calls the built-in validator by default. An external
832-
// validator can be opted into via the DXC_DXIL_DLL_PATH environment
833-
// variable
834831
produceFullContainer = !opts.CodeGenHighLevel && !opts.AstDump &&
835832
!opts.OptDump && rootSigMajor == 0 &&
836833
!opts.DumpDependencies &&
@@ -929,6 +926,9 @@ class DxcCompiler : public IDxcCompiler3,
929926
if (validateRootSigContainer && !opts.DisableValidation) {
930927
CComPtr<IDxcBlobEncoding> pValErrors;
931928
// Validation failure communicated through diagnostic error
929+
// NOTE: this calls the built-in validator by default. An external
930+
// validator can be opted into via the DXC_DXIL_DLL_PATH environment
931+
// variable
932932
dxcutil::ValidateRootSignatureInContainer(
933933
pOutputBlob, &compiler.getDiagnostics());
934934
}

0 commit comments

Comments
 (0)