1/**************************************************************************
2 *
3 * Copyright 2010 Luca Barbieri
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27import "d3dcommon.idl";
28
29typedef enum D3D11_SHADER_VERSION_TYPE
30{
31	D3D11_SHVER_PIXEL_SHADER,
32	D3D11_SHVER_VERTEX_SHADER,
33	D3D11_SHVER_GEOMETRY_SHADER,
34
35	D3D11_SHVER_HULL_SHADER,
36	D3D11_SHVER_DOMAIN_SHADER,
37	D3D11_SHVER_COMPUTE_SHADER,
38} D3D11_SHADER_VERSION_TYPE;
39
40cpp_quote("#define D3D11_SHVER_GET_TYPE(v) (((v) >> 16) & 0xffff)")
41cpp_quote("#define D3D11_SHVER_GET_MAJOR(v) (((v) >> 4) & 0xf)")
42cpp_quote("#define D3D11_SHVER_GET_MINOR(v) (((v) >> 0) & 0xf)")
43
44typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
45typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
46
47typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
48{
49	LPCSTR SemanticName;
50	UINT SemanticIndex;
51	UINT Register;
52	D3D_NAME SystemValueType;
53	D3D_REGISTER_COMPONENT_TYPE ComponentType;
54	BYTE Mask;
55	BYTE ReadWriteMask;
56	UINT Stream;
57} D3D11_SIGNATURE_PARAMETER_DESC;
58
59typedef struct _D3D11_SHADER_BUFFER_DESC
60{
61	LPCSTR Name;
62	D3D_CBUFFER_TYPE Type;
63	UINT Variables;
64	UINT Size;
65	UINT uFlags;
66} D3D11_SHADER_BUFFER_DESC;
67
68typedef struct _D3D11_SHADER_VARIABLE_DESC
69{
70	LPCSTR Name;
71	UINT StartOffset;
72	UINT Size;
73	UINT uFlags;
74	LPVOID DefaultValue;
75	UINT StartTexture;
76	UINT TextureSize;
77	UINT StartSampler;
78	UINT SamplerSize;
79} D3D11_SHADER_VARIABLE_DESC;
80
81typedef struct _D3D11_SHADER_TYPE_DESC
82{
83	D3D_SHADER_VARIABLE_CLASS Class;
84	D3D_SHADER_VARIABLE_TYPE Type;
85	UINT Rows;
86	UINT Columns;
87	UINT Elements;
88	UINT Members;
89	UINT Offset;
90	LPCSTR Name;
91} D3D11_SHADER_TYPE_DESC;
92
93typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
94typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
95typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
96
97typedef struct _D3D11_SHADER_DESC
98{
99	UINT Version;
100	LPCSTR Creator;
101	UINT Flags;
102
103	UINT ConstantBuffers;
104	UINT BoundResources;
105	UINT InputParameters;
106	UINT OutputParameters;
107
108	UINT InstructionCount;
109	UINT TempRegisterCount;
110	UINT TempArrayCount;
111	UINT DefCount;
112	UINT DclCount;
113	UINT TextureNormalInstructions;
114	UINT TextureLoadInstructions;
115	UINT TextureCompInstructions;
116	UINT TextureBiasInstructions;
117	UINT TextureGradientInstructions;
118	UINT FloatInstructionCount;
119	UINT IntInstructionCount;
120	UINT UintInstructionCount;
121	UINT StaticFlowControlCount;
122	UINT DynamicFlowControlCount;
123	UINT MacroInstructionCount;
124	UINT ArrayInstructionCount;
125	UINT CutInstructionCount;
126	UINT EmitInstructionCount;
127	D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
128	UINT GSMaxOutputVertexCount;
129	D3D_PRIMITIVE InputPrimitive;
130	UINT PatchConstantParameters;
131	UINT cGSInstanceCount;
132	UINT cControlPoints;
133	D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
134	D3D_TESSELLATOR_PARTITIONING HSPartitioning;
135	D3D_TESSELLATOR_DOMAIN TessellatorDomain;
136
137	UINT cBarrierInstructions;
138	UINT cInterlockedInstructions;
139	UINT cTextureStoreInstructions;
140} D3D11_SHADER_DESC;
141
142typedef struct _D3D11_SHADER_INPUT_BIND_DESC
143{
144	LPCSTR Name;
145	D3D_SHADER_INPUT_TYPE Type;
146	UINT BindPoint;
147	UINT BindCount;
148
149	UINT uFlags;
150	D3D_RESOURCE_RETURN_TYPE ReturnType;
151	D3D_SRV_DIMENSION Dimension;
152	UINT NumSamples;
153} D3D11_SHADER_INPUT_BIND_DESC;
154
155[local, object, uuid("6e6ffa6a-9bae-4613-a51e-91652d508c21")]
156interface ID3D11ShaderReflectionType
157{
158	HRESULT GetDesc(
159		[out] D3D11_SHADER_TYPE_DESC *a
160	);
161
162	ID3D11ShaderReflectionType* GetMemberTypeByIndex(
163		[in] UINT a
164	);
165
166	ID3D11ShaderReflectionType* GetMemberTypeByName(
167		[in] LPCSTR a
168	);
169
170	LPCSTR GetMemberTypeName(
171		[in] UINT a
172	);
173
174	HRESULT IsEqual(
175		[in] ID3D11ShaderReflectionType* a
176	);
177	ID3D11ShaderReflectionType* GetSubType();
178	ID3D11ShaderReflectionType* GetBaseClass();
179	UINT GetNumInterfaces();
180	ID3D11ShaderReflectionType* GetInterfaceByIndex(
181		[in] UINT a
182	);
183	HRESULT IsOfType(
184		[in] ID3D11ShaderReflectionType* a
185	);
186	HRESULT ImplementsInterface(
187		[in] ID3D11ShaderReflectionType* a
188	);
189};
190
191interface ID3D11ShaderReflectionConstantBuffer;
192
193[object, local, uuid("51f23923-f3e5-4bd1-91cb-606177d8db4c")]
194interface ID3D11ShaderReflectionVariable
195{
196	HRESULT GetDesc(
197		[out] D3D11_SHADER_VARIABLE_DESC *a
198	);
199
200	ID3D11ShaderReflectionType* GetType();
201	ID3D11ShaderReflectionConstantBuffer* GetBuffer();
202
203	UINT GetInterfaceSlot(
204		[in] UINT a
205	);
206};
207
208[object, local, uuid("eb62d63d-93dd-4318-8ae8-c6f83ad371b8")]
209interface ID3D11ShaderReflectionConstantBuffer
210{
211	HRESULT GetDesc(
212		[out] D3D11_SHADER_BUFFER_DESC *a
213	);
214
215	ID3D11ShaderReflectionVariable* GetVariableByIndex(
216		[in] UINT a
217	);
218
219	ID3D11ShaderReflectionVariable* GetVariableByName(
220		[in] LPCSTR a
221	);
222};
223
224[object,local,uuid("0a233719-3960-4578-9d7c-203b8b1d9cc1")]
225interface ID3D11ShaderReflection
226{
227	HRESULT GetDesc(
228		[out] D3D11_SHADER_DESC *a
229	);
230
231	ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex(
232		[in] UINT a
233	);
234
235	ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName(
236		[in] LPCSTR a
237	);
238
239	HRESULT GetResourceBindingDesc(
240		[in] UINT a,
241		[out] D3D11_SHADER_INPUT_BIND_DESC *b
242	);
243
244	HRESULT GetInputParameterDesc(
245		[in] UINT a,
246		[out] D3D11_SIGNATURE_PARAMETER_DESC *b
247	);
248
249	HRESULT GetOutputParameterDesc
250	(
251		[in] UINT a,
252		[out] D3D11_SIGNATURE_PARAMETER_DESC *b
253	);
254
255	HRESULT GetPatchConstantParameterDesc(
256		[in] UINT a,
257		[out] D3D11_SIGNATURE_PARAMETER_DESC *b
258	);
259
260	ID3D11ShaderReflectionVariable* GetVariableByName(
261		[in] LPCSTR a
262	);
263
264	HRESULT GetResourceBindingDescByName(
265		[in] LPCSTR a,
266		[out] D3D11_SHADER_INPUT_BIND_DESC *b
267	);
268
269	UINT GetMovInstructionCount();
270	UINT GetMovcInstructionCount();
271	UINT GetConversionInstructionCount();
272	UINT GetBitwiseInstructionCount();
273	D3D_PRIMITIVE GetGSInputPrimitive();
274	BOOL IsSampleFrequencyShader();
275	UINT GetNumInterfaceSlots();
276
277	HRESULT GetMinFeatureLevel(
278		[out] D3D_FEATURE_LEVEL* a
279	);
280
281	UINT GetThreadGroupSize(
282		[out,optional] UINT* a,
283		[out,optional] UINT* b,
284		[out,optional] UINT* c
285	);
286};
287
288