77
88namespace dxc {
99
10- class ExternalValidationHelper : public IDxcCompiler3 {
10+ class ExternalValidationHelper3 : public IDxcCompiler3 {
1111
1212public:
13- CComPtr<IDxcCompiler3> m_pCompiler ;
13+ CComPtr<IDxcCompiler3> m_pCompiler3 ;
1414 CComPtr<IDxcValidator> m_pValidator;
1515
16- ExternalValidationHelper () {
17- m_pCompiler = nullptr ;
16+ ExternalValidationHelper3 () {
17+ m_pCompiler3 = nullptr ;
1818 m_pValidator = nullptr ;
1919 }
2020
@@ -37,7 +37,95 @@ class ExternalValidationHelper : public IDxcCompiler3 {
3737 _Out_ LPVOID *ppResult)
3838 override // /< IDxcResult: status, disassembly text, and errors.
3939 {
40- return m_pCompiler->Disassemble (pObject, riid, ppResult);
40+ return m_pCompiler3->Disassemble (pObject, riid, ppResult);
41+ }
42+
43+ HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid,
44+ void **ppvObject) override {
45+ return m_pCompiler3->QueryInterface (riid, ppvObject);
46+ }
47+
48+ ULONG STDMETHODCALLTYPE AddRef () override { return m_pCompiler3.p ->AddRef (); }
49+
50+ ULONG STDMETHODCALLTYPE Release () override {
51+ return m_pCompiler3.p ->Release ();
52+ }
53+
54+ HRESULT STDMETHODCALLTYPE Validate (
55+ IDxcBlob *pShader, // Shader to validate.
56+ UINT32 Flags, // Validation flags.
57+ IDxcOperationResult *
58+ *ppResult // Validation output status, buffer, and errors
59+ ) {
60+ return m_pValidator->Validate (pShader, Flags, ppResult);
61+ }
62+
63+ ExternalValidationHelper3 (CComPtr<IDxcCompiler3> pCompiler,
64+ CComPtr<IDxcValidator> pValidator) {
65+ m_pCompiler3 = pCompiler;
66+ m_pValidator = pValidator;
67+ }
68+ };
69+
70+ class ExternalValidationHelper : public IDxcCompiler {
71+ public:
72+ CComPtr<IDxcCompiler> m_pCompiler;
73+ CComPtr<IDxcValidator> m_pValidator;
74+
75+ ExternalValidationHelper () {
76+ m_pCompiler = nullptr ;
77+ m_pValidator = nullptr ;
78+ }
79+ HRESULT STDMETHODCALLTYPE Compile (
80+ _In_ IDxcBlob *pSource, // Source text to compile.
81+ _In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in
82+ // errors and include handlers.
83+ _In_opt_z_ LPCWSTR pEntryPoint, // Entry point name.
84+ _In_z_ LPCWSTR pTargetProfile, // Shader profile to compile.
85+ _In_opt_count_ (argCount)
86+ LPCWSTR *pArguments, // Array of pointers to arguments.
87+ _In_ UINT32 argCount, // Number of arguments.
88+ _In_count_(defineCount) const DxcDefine *pDefines, // Array of defines.
89+ _In_ UINT32 defineCount, // Number of defines.
90+ _In_opt_ IDxcIncludeHandler
91+ *pIncludeHandler, // User-provided interface to handle #include
92+ // directives (optional).
93+ _COM_Outptr_ IDxcOperationResult *
94+ *ppResult // Compiler output status, buffer, and errors.
95+ ) override ;
96+
97+ // / \brief Preprocess source text.
98+ // /
99+ // / \deprecated Please use IDxcCompiler3::Compile() with the "-P" argument
100+ // / instead.
101+ HRESULT STDMETHODCALLTYPE Preprocess (
102+ _In_ IDxcBlob *pSource, // Source text to preprocess.
103+ _In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in
104+ // errors and include handlers.
105+ _In_opt_count_ (argCount)
106+ LPCWSTR *pArguments, // Array of pointers to arguments.
107+ _In_ UINT32 argCount, // Number of arguments.
108+ _In_count_(defineCount) const DxcDefine *pDefines, // Array of defines.
109+ _In_ UINT32 defineCount, // Number of defines.
110+ _In_opt_ IDxcIncludeHandler
111+ *pIncludeHandler, // user-provided interface to handle #include
112+ // directives (optional).
113+ _COM_Outptr_ IDxcOperationResult *
114+ *ppResult // Preprocessor output status, buffer, and errors.
115+ ) override {
116+ return m_pCompiler->Preprocess (pSource, pSourceName, pArguments, argCount,
117+ pDefines, defineCount, pIncludeHandler,
118+ ppResult);
119+ }
120+
121+ // / \brief Disassemble a program.
122+ // /
123+ // / \deprecated Please use IDxcCompiler3::Disassemble() instead.
124+ HRESULT STDMETHODCALLTYPE Disassemble (
125+ _In_ IDxcBlob *pSource, // Program to disassemble.
126+ _COM_Outptr_ IDxcBlobEncoding **ppDisassembly // Disassembly text.
127+ ) override {
128+ return m_pCompiler->Disassemble (pSource, ppDisassembly);
41129 }
42130
43131 HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid,
@@ -50,6 +138,7 @@ class ExternalValidationHelper : public IDxcCompiler3 {
50138 ULONG STDMETHODCALLTYPE Release () override {
51139 return m_pCompiler.p ->Release ();
52140 }
141+
53142 HRESULT STDMETHODCALLTYPE Validate (
54143 IDxcBlob *pShader, // Shader to validate.
55144 UINT32 Flags, // Validation flags.
@@ -59,7 +148,7 @@ class ExternalValidationHelper : public IDxcCompiler3 {
59148 return m_pValidator->Validate (pShader, Flags, ppResult);
60149 }
61150
62- ExternalValidationHelper (CComPtr<IDxcCompiler3 > pCompiler,
151+ ExternalValidationHelper (CComPtr<IDxcCompiler > pCompiler,
63152 CComPtr<IDxcValidator> pValidator) {
64153 m_pCompiler = pCompiler;
65154 m_pValidator = pValidator;
0 commit comments