vkd3d-shader/hlsl: Handle error instructions in add_shader_compilation().
[vkd3d.git] / tests / dxcompiler.idl
blob17f8f5bd9a15fe77d6168c4085c8f7fa3c595354
1 /*
2 * Copyright 2023 Conor McCarthy for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 import "vkd3d_windows.h";
21 #include "vkd3d_unknown.idl"
23 /* The linux build of dxcompiler does not apply the ms_abi calling convention to its COM interfaces,
24 * so they default to sysv_abi. The '__stdcall' macro is set in vkd3d_windows.h to ms_abi, and widl
25 * emits STDMETHODCALLTYPE for COM interfaces, so '__stdcall' must be temporarily undefined. Doing
26 * this in a PE build (x86 or x64) is unnecessary since the default calling convention is identical.
27 * A 32-bit linux release of dxcompiler is not available.
28 * TODO: modily widl to optionally omit STDMETHODCALLTYPE? */
29 cpp_quote("#if defined(__x86_64__) && !defined(_WIN32)")
30 cpp_quote("# pragma push_macro(\"__stdcall\")")
31 cpp_quote("# undef __stdcall")
32 cpp_quote("# define __stdcall")
33 cpp_quote("#endif")
35 static const HRESULT DXC_E_LLVM_CAST_ERROR = 0x80aa001d;
38 uuid(73e22d93-e6ce-47f3-b5bf-f0664f39c1b0)
40 coclass DxcCompiler
45 uuid(8ba5fb08-5195-40e2-ac58-0d989c3a0102),
46 object,
47 local,
49 interface IDxcBlob : IUnknown
51 void *GetBufferPointer();
52 SIZE_T GetBufferSize();
56 uuid(7241d424-2646-4191-97c0-98e96e42fc68),
57 object,
58 local,
60 interface IDxcBlobEncoding : IDxcBlob
62 HRESULT GetEncoding(BOOL *known, UINT32 *code_page);
66 uuid(3da636c9-ba71-4024-a301-30cbf125305b),
67 object,
68 local,
70 interface IDxcBlobUtf8 : IDxcBlobEncoding
72 const char *GetStringPointer();
73 SIZE_T GetStringLength();
77 uuid(a3f84eab-0faa-497e-a39c-ee6ed60b2d84),
78 object,
79 local,
81 interface IDxcBlobUtf16 : IDxcBlobEncoding
83 const WCHAR *GetStringPointer();
84 SIZE_T GetStringLength();
88 uuid(7f61fc7d-950d-467f-b3e3-3c02fb49187c),
89 object,
90 local,
92 interface IDxcIncludeHandler : IUnknown
94 HRESULT LoadSource(const WCHAR *filename, IDxcBlob **include_source);
97 typedef struct DxcBuffer
99 const void *Ptr;
100 SIZE_T Size;
101 UINT Encoding;
102 } DxcBuffer;
105 uuid(cedb484a-d4e9-445a-b991-ca21ca157dc2),
106 object,
107 local,
109 interface IDxcOperationResult : IUnknown
111 HRESULT GetStatus(HRESULT *status);
113 HRESULT GetResult(IDxcBlob **result);
115 HRESULT GetErrorBuffer(IDxcBlobEncoding **errors);
118 typedef enum DXC_OUT_KIND
120 DXC_OUT_NONE = 0,
121 DXC_OUT_OBJECT = 1,
122 DXC_OUT_ERRORS = 2,
123 DXC_OUT_PDB = 3,
124 DXC_OUT_SHADER_HASH = 4,
125 DXC_OUT_DISASSEMBLY = 5,
126 DXC_OUT_HLSL = 6,
127 DXC_OUT_TEXT = 7,
128 DXC_OUT_REFLECTION = 8,
129 DXC_OUT_ROOT_SIGNATURE = 9,
130 DXC_OUT_EXTRA_OUTPUTS = 10,
132 DXC_OUT_FORCE_DWORD = 0xFFFFFFFF
133 } DXC_OUT_KIND;
136 uuid(58346cda-dde7-4497-9461-6f87af5e0659),
137 object,
138 local,
140 interface IDxcResult : IDxcOperationResult
142 BOOL HasOutput(DXC_OUT_KIND dxc_out_kind);
143 HRESULT GetOutput(DXC_OUT_KIND dxc_out_kind,
144 REFIID iid, void **object, IDxcBlobUtf16 **output_name);
146 UINT32 GetNumOutputs();
147 DXC_OUT_KIND GetOutputByIndex(UINT32 index);
148 DXC_OUT_KIND PrimaryOutput();
152 uuid(228b4687-5a6a-4730-900c-9702b2203f54),
153 object,
154 local,
156 interface IDxcCompiler3 : IUnknown
158 HRESULT Compile(const DxcBuffer *source, const WCHAR **arguments, UINT32 arg_count,
159 IDxcIncludeHandler *include_handler, REFIID riid, void **result);
161 HRESULT Disassemble(const DxcBuffer *object, REFIID riid, void **result);
164 typedef HRESULT (__stdcall *DxcCreateInstanceProc)(const IID *rclsid, REFIID riid, void **ppv);
166 cpp_quote("#if defined(__x86_64__) && !defined(_WIN32)")
167 cpp_quote("# pragma pop_macro(\"__stdcall\")")
168 cpp_quote("#endif")