wbemprox: Add support for enumerating class properties.
[wine] / dlls / d3d10 / effect.c
1 /*
2  * Copyright 2009 Henri Verbeet for CodeWeavers
3  * Copyright 2009 Rico Schüller
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  *
19  */
20
21 #include "config.h"
22 #include "wine/port.h"
23
24 #include "d3d10_private.h"
25
26 #include <float.h>
27
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
29
30 #define D3D10_FX10_TYPE_COLUMN_SHIFT    11
31 #define D3D10_FX10_TYPE_COLUMN_MASK     (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
32
33 #define D3D10_FX10_TYPE_ROW_SHIFT       8
34 #define D3D10_FX10_TYPE_ROW_MASK        (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
35
36 #define D3D10_FX10_TYPE_BASETYPE_SHIFT  3
37 #define D3D10_FX10_TYPE_BASETYPE_MASK   (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
38
39 #define D3D10_FX10_TYPE_CLASS_SHIFT     0
40 #define D3D10_FX10_TYPE_CLASS_MASK      (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
41
42 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
43
44 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
45 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
46 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
47 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
48 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
49 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
50 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
51 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl;
52 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl;
53 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl;
54 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl;
55 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl;
56 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
57 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl;
58 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl;
59 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl;
60 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
61
62 /* null objects - needed for invalid calls */
63 static struct d3d10_effect_technique null_technique = {{&d3d10_effect_technique_vtbl}};
64 static struct d3d10_effect_pass null_pass = {{&d3d10_effect_pass_vtbl}};
65 static struct d3d10_effect_type null_type = {{&d3d10_effect_type_vtbl}};
66 static struct d3d10_effect_variable null_local_buffer = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl},
67         &null_local_buffer, &null_type};
68 static struct d3d10_effect_variable null_variable = {{&d3d10_effect_variable_vtbl},
69         &null_local_buffer, &null_type};
70 static struct d3d10_effect_variable null_scalar_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl},
71         &null_local_buffer, &null_type};
72 static struct d3d10_effect_variable null_vector_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl},
73         &null_local_buffer, &null_type};
74 static struct d3d10_effect_variable null_matrix_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl},
75         &null_local_buffer, &null_type};
76 static struct d3d10_effect_variable null_string_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl},
77         &null_local_buffer, &null_type};
78 static struct d3d10_effect_variable null_shader_resource_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl},
79         &null_local_buffer, &null_type};
80 static struct d3d10_effect_variable null_render_target_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl},
81         &null_local_buffer, &null_type};
82 static struct d3d10_effect_variable null_depth_stencil_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl},
83         &null_local_buffer, &null_type};
84 static struct d3d10_effect_variable null_shader_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
85         &null_local_buffer, &null_type};
86 static struct d3d10_effect_variable null_blend_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl},
87         &null_local_buffer, &null_type};
88 static struct d3d10_effect_variable null_depth_stencil_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl},
89         &null_local_buffer, &null_type};
90 static struct d3d10_effect_variable null_rasterizer_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl},
91         &null_local_buffer, &null_type};
92 static struct d3d10_effect_variable null_sampler_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl},
93         &null_local_buffer, &null_type};
94
95 /* anonymous_shader_type and anonymous_shader */
96 static char anonymous_name[] = "$Anonymous";
97 static char anonymous_vertexshader_name[] = "vertexshader";
98 static char anonymous_pixelshader_name[] = "pixelshader";
99 static char anonymous_geometryshader_name[] = "geometryshader";
100 static struct d3d10_effect_type anonymous_vs_type = {{&d3d10_effect_type_vtbl},
101         anonymous_vertexshader_name, D3D10_SVT_VERTEXSHADER, D3D10_SVC_OBJECT};
102 static struct d3d10_effect_type anonymous_ps_type = {{&d3d10_effect_type_vtbl},
103         anonymous_pixelshader_name, D3D10_SVT_PIXELSHADER, D3D10_SVC_OBJECT};
104 static struct d3d10_effect_type anonymous_gs_type = {{&d3d10_effect_type_vtbl},
105         anonymous_geometryshader_name, D3D10_SVT_GEOMETRYSHADER, D3D10_SVC_OBJECT};
106 static struct d3d10_effect_variable anonymous_vs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
107         &null_local_buffer, &anonymous_vs_type, &null_shader_variable, anonymous_name};
108 static struct d3d10_effect_variable anonymous_ps = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
109         &null_local_buffer, &anonymous_ps_type, &null_shader_variable, anonymous_name};
110 static struct d3d10_effect_variable anonymous_gs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
111         &null_local_buffer, &anonymous_gs_type, &null_shader_variable, anonymous_name};
112
113 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
114
115 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
116 {
117     return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
118 }
119
120 struct d3d10_effect_state_property_info
121 {
122     UINT id;
123     const char *name;
124     D3D_SHADER_VARIABLE_TYPE type;
125     UINT size;
126     UINT count;
127     D3D_SHADER_VARIABLE_TYPE container_type;
128     LONG offset;
129 };
130
131 static const struct d3d10_effect_state_property_info property_info[] =
132 {
133     {0x0c, "RasterizerState.FillMode",                    D3D10_SVT_INT,   1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode)                       },
134     {0x0d, "RasterizerState.CullMode",                    D3D10_SVT_INT,   1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode)                       },
135     {0x0e, "RasterizerState.FrontCounterClockwise",       D3D10_SVT_BOOL,  1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise)          },
136     {0x0f, "RasterizerState.DepthBias",                   D3D10_SVT_INT,   1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias)                      },
137     {0x10, "RasterizerState.DepthBiasClamp",              D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp)                 },
138     {0x11, "RasterizerState.SlopeScaledDepthBias",        D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias)           },
139     {0x12, "RasterizerState.DepthClipEnable",             D3D10_SVT_BOOL,  1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable)                },
140     {0x13, "RasterizerState.ScissorEnable",               D3D10_SVT_BOOL,  1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable)                  },
141     {0x14, "RasterizerState.MultisampleEnable",           D3D10_SVT_BOOL,  1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable)              },
142     {0x15, "RasterizerState.AntialiasedLineEnable",       D3D10_SVT_BOOL,  1, 1, D3D10_SVT_RASTERIZER,   FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable)          },
143     {0x16, "DepthStencilState.DepthEnable",               D3D10_SVT_BOOL,  1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable)                 },
144     {0x17, "DepthStencilState.DepthWriteMask",            D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask)              },
145     {0x18, "DepthStencilState.DepthFunc",                 D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc)                   },
146     {0x19, "DepthStencilState.StencilEnable",             D3D10_SVT_BOOL,  1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable)               },
147     {0x1a, "DepthStencilState.StencilReadMask",           D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask)             },
148     {0x1b, "DepthStencilState.StencilWriteMask",          D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask)            },
149     {0x1c, "DepthStencilState.FrontFaceStencilFail",      D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp)     },
150     {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
151     {0x1e, "DepthStencilState.FrontFaceStencilPass",      D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp)     },
152     {0x1f, "DepthStencilState.FrontFaceStencilFunc",      D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc)       },
153     {0x20, "DepthStencilState.BackFaceStencilFail",       D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp)      },
154     {0x21, "DepthStencilState.BackFaceStencilDepthFail",  D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
155     {0x22, "DepthStencilState.BackFaceStencilPass",       D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp)      },
156     {0x23, "DepthStencilState.BackFaceStencilFunc",       D3D10_SVT_INT,   1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc)        },
157     {0x24, "BlendState.AlphaToCoverageEnable",            D3D10_SVT_BOOL,  1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         AlphaToCoverageEnable)       },
158     {0x25, "BlendState.BlendEnable",                      D3D10_SVT_BOOL,  1, 8, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         BlendEnable)                 },
159     {0x26, "BlendState.SrcBlend",                         D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         SrcBlend)                    },
160     {0x27, "BlendState.DestBlend",                        D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         DestBlend)                   },
161     {0x28, "BlendState.BlendOp",                          D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         BlendOp)                     },
162     {0x29, "BlendState.SrcBlendAlpha",                    D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         SrcBlendAlpha)               },
163     {0x2a, "BlendState.DestBlendAlpha",                   D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         DestBlendAlpha)              },
164     {0x2b, "BlendState.BlendOpAlpha",                     D3D10_SVT_INT,   1, 1, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         BlendOpAlpha)                },
165     {0x2c, "BlendState.RenderTargetWriteMask",            D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND,        FIELD_OFFSET(D3D10_BLEND_DESC,         RenderTargetWriteMask)       },
166     {0x2d, "SamplerState.Filter",                         D3D10_SVT_INT,   1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       Filter)                      },
167     {0x2e, "SamplerState.AddressU",                       D3D10_SVT_INT,   1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       AddressU)                    },
168     {0x2f, "SamplerState.AddressV",                       D3D10_SVT_INT,   1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       AddressV)                    },
169     {0x30, "SamplerState.AddressW",                       D3D10_SVT_INT,   1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       AddressW)                    },
170     {0x31, "SamplerState.MipMapLODBias",                  D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       MipLODBias)                  },
171     {0x32, "SamplerState.MaxAnisotropy",                  D3D10_SVT_UINT,  1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       MaxAnisotropy)               },
172     {0x33, "SamplerState.ComparisonFunc",                 D3D10_SVT_INT,   1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       ComparisonFunc)              },
173     {0x34, "SamplerState.BorderColor",                    D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       BorderColor)                 },
174     {0x35, "SamplerState.MinLOD",                         D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       MinLOD)                      },
175     {0x36, "SamplerState.MaxLOD",                         D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER,      FIELD_OFFSET(D3D10_SAMPLER_DESC,       MaxLOD)                      },
176 };
177
178 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
179 {
180     D3D10_FILL_SOLID,
181     D3D10_CULL_BACK,
182     FALSE,
183     0,
184     0.0f,
185     0.0f,
186     TRUE,
187     FALSE,
188     FALSE,
189     FALSE,
190 };
191
192 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
193 {
194     TRUE,
195     D3D10_DEPTH_WRITE_MASK_ALL,
196     D3D10_COMPARISON_LESS,
197     FALSE,
198     D3D10_DEFAULT_STENCIL_READ_MASK,
199     D3D10_DEFAULT_STENCIL_WRITE_MASK,
200     {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
201     {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
202 };
203
204 static const D3D10_BLEND_DESC default_blend_desc =
205 {
206     FALSE,
207     {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
208     D3D10_BLEND_SRC_ALPHA,
209     D3D10_BLEND_INV_SRC_ALPHA,
210     D3D10_BLEND_OP_ADD,
211     D3D10_BLEND_SRC_ALPHA,
212     D3D10_BLEND_INV_SRC_ALPHA,
213     D3D10_BLEND_OP_ADD,
214     {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
215 };
216
217 static const D3D10_SAMPLER_DESC default_sampler_desc =
218 {
219     D3D10_FILTER_MIN_MAG_MIP_POINT,
220     D3D10_TEXTURE_ADDRESS_WRAP,
221     D3D10_TEXTURE_ADDRESS_WRAP,
222     D3D10_TEXTURE_ADDRESS_WRAP,
223     0.0f,
224     16,
225     D3D10_COMPARISON_NEVER,
226     {0.0f, 0.0f, 0.0f, 0.0f},
227     0.0f,
228     FLT_MAX,
229 };
230
231 struct d3d10_effect_state_storage_info
232 {
233     D3D_SHADER_VARIABLE_TYPE id;
234     size_t size;
235     const void *default_state;
236 };
237
238 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
239 {
240     {D3D10_SVT_RASTERIZER,   sizeof(default_rasterizer_desc),    &default_rasterizer_desc   },
241     {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
242     {D3D10_SVT_BLEND,        sizeof(default_blend_desc),         &default_blend_desc        },
243     {D3D10_SVT_SAMPLER,      sizeof(default_sampler_desc),       &default_sampler_desc      },
244 };
245
246 static BOOL copy_name(const char *ptr, char **name)
247 {
248     size_t name_len;
249
250     if (!ptr) return TRUE;
251
252     name_len = strlen(ptr) + 1;
253     if (name_len == 1)
254     {
255         return TRUE;
256     }
257
258     *name = HeapAlloc(GetProcessHeap(), 0, name_len);
259     if (!*name)
260     {
261         ERR("Failed to allocate name memory.\n");
262         return FALSE;
263     }
264
265     memcpy(*name, ptr, name_len);
266
267     return TRUE;
268 }
269
270 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
271 {
272     D3D10_SIGNATURE_PARAMETER_DESC *e;
273     const char *ptr = data;
274     unsigned int i;
275     DWORD count;
276
277     read_dword(&ptr, &count);
278     TRACE("%u elements\n", count);
279
280     skip_dword_unknown("shader signature", &ptr, 1);
281
282     e = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*e));
283     if (!e)
284     {
285         ERR("Failed to allocate signature memory.\n");
286         return E_OUTOFMEMORY;
287     }
288
289     for (i = 0; i < count; ++i)
290     {
291         UINT name_offset;
292         UINT mask;
293
294         read_dword(&ptr, &name_offset);
295         e[i].SemanticName = data + name_offset;
296         read_dword(&ptr, &e[i].SemanticIndex);
297         read_dword(&ptr, &e[i].SystemValueType);
298         read_dword(&ptr, &e[i].ComponentType);
299         read_dword(&ptr, &e[i].Register);
300         read_dword(&ptr, &mask);
301
302         e[i].ReadWriteMask = mask >> 8;
303         e[i].Mask = mask & 0xff;
304
305         TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
306                 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
307                 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
308                 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
309     }
310
311     s->elements = e;
312     s->element_count = count;
313
314     return S_OK;
315 }
316
317 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
318 {
319     HeapFree(GetProcessHeap(), 0, s->signature);
320     HeapFree(GetProcessHeap(), 0, s->elements);
321 }
322
323 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
324 {
325     struct d3d10_effect_shader_variable *s = ctx;
326     HRESULT hr;
327
328     TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
329
330     TRACE("chunk size: %#x\n", data_size);
331
332     switch(tag)
333     {
334         case TAG_ISGN:
335         case TAG_OSGN:
336         {
337             /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
338             UINT size = 44 + data_size;
339             struct d3d10_effect_shader_signature *sig;
340             char *ptr;
341
342             if (tag == TAG_ISGN) sig = &s->input_signature;
343             else sig = &s->output_signature;
344
345             sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
346             if (!sig->signature)
347             {
348                 ERR("Failed to allocate input signature data\n");
349                 return E_OUTOFMEMORY;
350             }
351             sig->signature_size = size;
352
353             ptr = sig->signature;
354
355             write_dword(&ptr, TAG_DXBC);
356
357             /* signature(?) */
358             write_dword_unknown(&ptr, 0);
359             write_dword_unknown(&ptr, 0);
360             write_dword_unknown(&ptr, 0);
361             write_dword_unknown(&ptr, 0);
362
363             /* seems to be always 1 */
364             write_dword_unknown(&ptr, 1);
365
366             /* DXBC size */
367             write_dword(&ptr, size);
368
369             /* chunk count */
370             write_dword(&ptr, 1);
371
372             /* chunk index */
373             write_dword(&ptr, (ptr - sig->signature) + 4);
374
375             /* chunk */
376             write_dword(&ptr, tag);
377             write_dword(&ptr, data_size);
378             memcpy(ptr, data, data_size);
379
380             hr = shader_parse_signature(ptr, data_size, sig);
381             if (FAILED(hr))
382             {
383                 ERR("Failed to parse shader, hr %#x\n", hr);
384                 shader_free_signature(sig);
385             }
386
387             break;
388         }
389
390         default:
391             FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
392             break;
393     }
394
395     return S_OK;
396 }
397
398 static HRESULT parse_shader(struct d3d10_effect_variable *v, const char *data)
399 {
400     ID3D10Device *device = v->effect->device;
401     struct d3d10_effect_shader_variable *s;
402     const char *ptr = data;
403     DWORD dxbc_size;
404     HRESULT hr;
405
406     s = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*s));
407     if (!s)
408     {
409         ERR("Failed to allocate shader variable memory\n");
410         return E_OUTOFMEMORY;
411     }
412
413     v->data = s;
414
415     if (v->effect->used_shader_current >= v->effect->used_shader_count)
416     {
417         WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
418         return E_FAIL;
419     }
420
421     v->effect->used_shaders[v->effect->used_shader_current] = v;
422     ++v->effect->used_shader_current;
423
424     if (!ptr) return S_OK;
425
426     read_dword(&ptr, &dxbc_size);
427     TRACE("dxbc size: %#x\n", dxbc_size);
428
429     /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
430     if (!dxbc_size) return S_OK;
431
432     switch (v->type->basetype)
433     {
434         case D3D10_SVT_VERTEXSHADER:
435             hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
436             if (FAILED(hr)) return hr;
437             break;
438
439         case D3D10_SVT_PIXELSHADER:
440             hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
441             if (FAILED(hr)) return hr;
442             break;
443
444         case D3D10_SVT_GEOMETRYSHADER:
445             hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
446             if (FAILED(hr)) return hr;
447             break;
448
449         default:
450             ERR("This should not happen!\n");
451             return E_FAIL;
452     }
453
454     return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
455 }
456
457 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
458 {
459     switch (c)
460     {
461         case 1: return D3D10_SVC_SCALAR;
462         case 2: return D3D10_SVC_VECTOR;
463         case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
464                 else return D3D10_SVC_MATRIX_ROWS;
465         default:
466             FIXME("Unknown variable class %#x.\n", c);
467             return 0;
468     }
469 }
470
471 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
472 {
473     if(is_object)
474     {
475         switch (t)
476         {
477             case 1: return D3D10_SVT_STRING;
478             case 2: return D3D10_SVT_BLEND;
479             case 3: return D3D10_SVT_DEPTHSTENCIL;
480             case 4: return D3D10_SVT_RASTERIZER;
481             case 5: return D3D10_SVT_PIXELSHADER;
482             case 6: return D3D10_SVT_VERTEXSHADER;
483             case 7: return D3D10_SVT_GEOMETRYSHADER;
484
485             case 10: return D3D10_SVT_TEXTURE1D;
486             case 11: return D3D10_SVT_TEXTURE1DARRAY;
487             case 12: return D3D10_SVT_TEXTURE2D;
488             case 13: return D3D10_SVT_TEXTURE2DARRAY;
489             case 14: return D3D10_SVT_TEXTURE2DMS;
490             case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
491             case 16: return D3D10_SVT_TEXTURE3D;
492             case 17: return D3D10_SVT_TEXTURECUBE;
493
494             case 19: return D3D10_SVT_RENDERTARGETVIEW;
495             case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
496             case 21: return D3D10_SVT_SAMPLER;
497             case 22: return D3D10_SVT_BUFFER;
498             default:
499                 FIXME("Unknown variable type %#x.\n", t);
500                 return D3D10_SVT_VOID;
501         }
502     }
503     else
504     {
505         switch (t)
506         {
507             case 1: return D3D10_SVT_FLOAT;
508             case 2: return D3D10_SVT_INT;
509             case 3: return D3D10_SVT_UINT;
510             case 4: return D3D10_SVT_BOOL;
511             default:
512                 FIXME("Unknown variable type %#x.\n", t);
513                 return D3D10_SVT_VOID;
514         }
515     }
516 }
517
518 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
519 {
520     DWORD unknown0;
521     DWORD offset;
522     DWORD typeinfo;
523     unsigned int i;
524
525     read_dword(&ptr, &offset);
526     TRACE("Type name at offset %#x.\n", offset);
527
528     if (!copy_name(data + offset, &t->name))
529     {
530         ERR("Failed to copy name.\n");
531         return E_OUTOFMEMORY;
532     }
533     TRACE("Type name: %s.\n", debugstr_a(t->name));
534
535     read_dword(&ptr, &unknown0);
536     TRACE("Unknown 0: %u.\n", unknown0);
537
538     read_dword(&ptr, &t->element_count);
539     TRACE("Element count: %u.\n", t->element_count);
540
541     read_dword(&ptr, &t->size_unpacked);
542     TRACE("Unpacked size: %#x.\n", t->size_unpacked);
543
544     read_dword(&ptr, &t->stride);
545     TRACE("Stride: %#x.\n", t->stride);
546
547     read_dword(&ptr, &t->size_packed);
548     TRACE("Packed size %#x.\n", t->size_packed);
549
550     switch (unknown0)
551     {
552         case 1:
553             t->member_count = 0;
554
555             read_dword(&ptr, &typeinfo);
556             t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
557             t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
558             t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
559             t->type_class = d3d10_variable_class((typeinfo & D3D10_FX10_TYPE_CLASS_MASK) >> D3D10_FX10_TYPE_CLASS_SHIFT, typeinfo & D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK);
560
561             TRACE("Type description: %#x.\n", typeinfo);
562             TRACE("\tcolumns: %u.\n", t->column_count);
563             TRACE("\trows: %u.\n", t->row_count);
564             TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
565             TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
566             TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
567                     | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
568             break;
569
570         case 2:
571             TRACE("Type is an object.\n");
572
573             t->member_count = 0;
574             t->column_count = 0;
575             t->row_count = 0;
576             t->type_class = D3D10_SVC_OBJECT;
577
578             read_dword(&ptr, &typeinfo);
579             t->basetype = d3d10_variable_type(typeinfo, TRUE);
580
581             TRACE("Type description: %#x.\n", typeinfo);
582             TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
583             TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
584             break;
585
586          case 3:
587             TRACE("Type is a structure.\n");
588
589             read_dword(&ptr, &t->member_count);
590             TRACE("Member count: %u.\n", t->member_count);
591
592             t->column_count = 0;
593             t->row_count = 0;
594             t->basetype = 0;
595             t->type_class = D3D10_SVC_STRUCT;
596
597             t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
598             if (!t->members)
599             {
600                 ERR("Failed to allocate members memory.\n");
601                 return E_OUTOFMEMORY;
602             }
603
604             for (i = 0; i < t->member_count; ++i)
605             {
606                 struct d3d10_effect_type_member *typem = &t->members[i];
607
608                 read_dword(&ptr, &offset);
609                 TRACE("Member name at offset %#x.\n", offset);
610
611                 if (!copy_name(data + offset, &typem->name))
612                 {
613                     ERR("Failed to copy name.\n");
614                     return E_OUTOFMEMORY;
615                 }
616                 TRACE("Member name: %s.\n", debugstr_a(typem->name));
617
618                 read_dword(&ptr, &offset);
619                 TRACE("Member semantic at offset %#x.\n", offset);
620
621                 if (!copy_name(data + offset, &typem->semantic))
622                 {
623                     ERR("Failed to copy semantic.\n");
624                     return E_OUTOFMEMORY;
625                 }
626                 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
627
628                 read_dword(&ptr, &typem->buffer_offset);
629                 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
630
631                 read_dword(&ptr, &offset);
632                 TRACE("Member type info at offset %#x.\n", offset);
633
634                 typem->type = get_fx10_type(t->effect, data, offset);
635                 if (!typem->type)
636                 {
637                     ERR("Failed to get variable type.\n");
638                     return E_FAIL;
639                 }
640             }
641             break;
642
643         default:
644             FIXME("Unhandled case %#x.\n", unknown0);
645             return E_FAIL;
646     }
647
648     if (t->element_count)
649     {
650         TRACE("Elementtype for type at offset: %#x\n", t->id);
651
652         /* allocate elementtype - we need only one, because all elements have the same type */
653         t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
654         if (!t->elementtype)
655         {
656             ERR("Failed to allocate members memory.\n");
657             return E_OUTOFMEMORY;
658         }
659
660         /* create a copy of the original type with some minor changes */
661         t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
662         t->elementtype->effect = t->effect;
663
664         if (!copy_name(t->name, &t->elementtype->name))
665         {
666              ERR("Failed to copy name.\n");
667              return E_OUTOFMEMORY;
668         }
669         TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
670
671         t->elementtype->element_count = 0;
672         TRACE("\tElement count: %u.\n", t->elementtype->element_count);
673
674         /*
675          * Not sure if this calculation is 100% correct, but a test
676          * shows that these values work.
677          */
678         t->elementtype->size_unpacked = t->size_packed / t->element_count;
679         TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
680
681         t->elementtype->stride = t->stride;
682         TRACE("\tStride: %#x.\n", t->elementtype->stride);
683
684         t->elementtype->size_packed = t->size_packed / t->element_count;
685         TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
686
687         t->elementtype->member_count = t->member_count;
688         TRACE("\tMember count: %u.\n", t->elementtype->member_count);
689
690         t->elementtype->column_count = t->column_count;
691         TRACE("\tColumns: %u.\n", t->elementtype->column_count);
692
693         t->elementtype->row_count = t->row_count;
694         TRACE("\tRows: %u.\n", t->elementtype->row_count);
695
696         t->elementtype->basetype = t->basetype;
697         TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
698
699         t->elementtype->type_class = t->type_class;
700         TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
701
702         t->elementtype->members = t->members;
703     }
704
705     return S_OK;
706 }
707
708 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
709 {
710     struct d3d10_effect_type *type;
711     struct wine_rb_entry *entry;
712     HRESULT hr;
713
714     entry = wine_rb_get(&effect->types, &offset);
715     if (entry)
716     {
717         TRACE("Returning existing type.\n");
718         return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
719     }
720
721     type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
722     if (!type)
723     {
724         ERR("Failed to allocate type memory.\n");
725         return NULL;
726     }
727
728     type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
729     type->id = offset;
730     type->effect = effect;
731     hr = parse_fx10_type(type, data + offset, data);
732     if (FAILED(hr))
733     {
734         ERR("Failed to parse type info, hr %#x.\n", hr);
735         HeapFree(GetProcessHeap(), 0, type);
736         return NULL;
737     }
738
739     if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
740     {
741         ERR("Failed to insert type entry.\n");
742         HeapFree(GetProcessHeap(), 0, type);
743         return NULL;
744     }
745
746     return type;
747 }
748
749 static void set_variable_vtbl(struct d3d10_effect_variable *v)
750 {
751     const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
752
753     switch (v->type->type_class)
754     {
755         case D3D10_SVC_SCALAR:
756             *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
757             break;
758
759         case D3D10_SVC_VECTOR:
760             *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
761             break;
762
763         case D3D10_SVC_MATRIX_ROWS:
764         case D3D10_SVC_MATRIX_COLUMNS:
765             *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
766             break;
767
768         case D3D10_SVC_STRUCT:
769             *vtbl = &d3d10_effect_variable_vtbl;
770             break;
771
772         case D3D10_SVC_OBJECT:
773             switch(v->type->basetype)
774             {
775                 case D3D10_SVT_STRING:
776                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
777                     break;
778
779                 case D3D10_SVT_TEXTURE1D:
780                 case D3D10_SVT_TEXTURE1DARRAY:
781                 case D3D10_SVT_TEXTURE2D:
782                 case D3D10_SVT_TEXTURE2DARRAY:
783                 case D3D10_SVT_TEXTURE2DMS:
784                 case D3D10_SVT_TEXTURE2DMSARRAY:
785                 case D3D10_SVT_TEXTURE3D:
786                 case D3D10_SVT_TEXTURECUBE:
787                 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
788                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
789                     break;
790
791                 case D3D10_SVT_RENDERTARGETVIEW:
792                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
793                     break;
794
795                 case D3D10_SVT_DEPTHSTENCILVIEW:
796                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
797                     break;
798
799                 case D3D10_SVT_DEPTHSTENCIL:
800                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
801                     break;
802
803                 case D3D10_SVT_VERTEXSHADER:
804                 case D3D10_SVT_GEOMETRYSHADER:
805                 case D3D10_SVT_PIXELSHADER:
806                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
807                     break;
808
809                 case D3D10_SVT_BLEND:
810                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
811                     break;
812
813                 case D3D10_SVT_RASTERIZER:
814                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
815                     break;
816
817                 case D3D10_SVT_SAMPLER:
818                     *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
819                     break;
820
821                 default:
822                     FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
823                     *vtbl = &d3d10_effect_variable_vtbl;
824                     break;
825             }
826             break;
827
828         default:
829             FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
830             *vtbl = &d3d10_effect_variable_vtbl;
831             break;
832     }
833 }
834
835 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
836 {
837     unsigned int i;
838     HRESULT hr;
839
840     if (v->type->member_count)
841     {
842         v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
843         if (!v->members)
844         {
845             ERR("Failed to allocate members memory.\n");
846             return E_OUTOFMEMORY;
847         }
848
849         for (i = 0; i < v->type->member_count; ++i)
850         {
851             struct d3d10_effect_variable *var = &v->members[i];
852             struct d3d10_effect_type_member *typem = &v->type->members[i];
853
854             var->buffer = v->buffer;
855             var->effect = v->effect;
856             var->type = typem->type;
857             set_variable_vtbl(var);
858
859             if (!copy_name(typem->name, &var->name))
860             {
861                 ERR("Failed to copy name.\n");
862                 return E_OUTOFMEMORY;
863             }
864             TRACE("Variable name: %s.\n", debugstr_a(var->name));
865
866             if (!copy_name(typem->semantic, &var->semantic))
867             {
868                 ERR("Failed to copy name.\n");
869                 return E_OUTOFMEMORY;
870             }
871             TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
872
873             var->buffer_offset = v->buffer_offset + typem->buffer_offset;
874             TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
875
876             hr = copy_variableinfo_from_type(var);
877             if (FAILED(hr)) return hr;
878         }
879     }
880
881     if (v->type->element_count)
882     {
883         unsigned int bufferoffset = v->buffer_offset;
884
885         v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
886         if (!v->elements)
887         {
888             ERR("Failed to allocate elements memory.\n");
889             return E_OUTOFMEMORY;
890         }
891
892         for (i = 0; i < v->type->element_count; ++i)
893         {
894             struct d3d10_effect_variable *var = &v->elements[i];
895
896             var->buffer = v->buffer;
897             var->effect = v->effect;
898             var->type = v->type->elementtype;
899             set_variable_vtbl(var);
900
901             if (!copy_name(v->name, &var->name))
902             {
903                 ERR("Failed to copy name.\n");
904                 return E_OUTOFMEMORY;
905             }
906             TRACE("Variable name: %s.\n", debugstr_a(var->name));
907
908             if (!copy_name(v->semantic, &var->semantic))
909             {
910                 ERR("Failed to copy name.\n");
911                 return E_OUTOFMEMORY;
912             }
913             TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
914
915             if (i != 0)
916             {
917                 bufferoffset += v->type->stride;
918             }
919             var->buffer_offset = bufferoffset;
920             TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
921
922             hr = copy_variableinfo_from_type(var);
923             if (FAILED(hr)) return hr;
924         }
925     }
926
927     return S_OK;
928 }
929
930 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
931 {
932     DWORD offset;
933
934     read_dword(ptr, &offset);
935     TRACE("Variable name at offset %#x.\n", offset);
936
937     if (!copy_name(data + offset, &v->name))
938     {
939         ERR("Failed to copy name.\n");
940         return E_OUTOFMEMORY;
941     }
942     TRACE("Variable name: %s.\n", debugstr_a(v->name));
943
944     read_dword(ptr, &offset);
945     TRACE("Variable type info at offset %#x.\n", offset);
946
947     v->type = get_fx10_type(v->effect, data, offset);
948     if (!v->type)
949     {
950         ERR("Failed to get variable type.\n");
951         return E_FAIL;
952     }
953     set_variable_vtbl(v);
954
955     return copy_variableinfo_from_type(v);
956 }
957
958 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
959 {
960     HRESULT hr;
961
962     hr = parse_fx10_variable_head(a, ptr, data);
963     if (FAILED(hr)) return hr;
964
965     skip_dword_unknown("annotation", ptr, 1);
966
967     /* mark the variable as annotation */
968     a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
969
970     return S_OK;
971 }
972
973 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
974     enum d3d10_effect_object_type otype)
975 {
976     struct d3d10_effect_variable *v = &s->shader;
977     struct d3d10_effect_type *t = &s->type;
978     const char *shader = NULL;
979
980     switch (otype)
981     {
982         case D3D10_EOT_VERTEXSHADER:
983             shader = "vertexshader";
984             t->basetype = D3D10_SVT_VERTEXSHADER;
985             break;
986
987         case D3D10_EOT_PIXELSHADER:
988             shader = "pixelshader";
989             t->basetype = D3D10_SVT_PIXELSHADER;
990             break;
991
992         case D3D10_EOT_GEOMETRYSHADER:
993             shader = "geometryshader";
994             t->basetype = D3D10_SVT_GEOMETRYSHADER;
995             break;
996
997         default:
998             FIXME("Unhandled object type %#x.\n", otype);
999             return E_FAIL;
1000     }
1001
1002     if (!copy_name(shader, &t->name))
1003     {
1004         ERR("Failed to copy name.\n");
1005         return E_OUTOFMEMORY;
1006     }
1007     TRACE("Type name: %s.\n", debugstr_a(t->name));
1008
1009     t->type_class = D3D10_SVC_OBJECT;
1010
1011     t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1012
1013     v->type = t;
1014     v->effect = e;
1015     set_variable_vtbl(v);
1016
1017     if (!copy_name("$Anonymous", &v->name))
1018     {
1019         ERR("Failed to copy semantic.\n");
1020         return E_OUTOFMEMORY;
1021     }
1022     TRACE("Variable name: %s.\n", debugstr_a(v->name));
1023
1024     if (!copy_name(NULL, &v->semantic))
1025     {
1026         ERR("Failed to copy semantic.\n");
1027         return E_OUTOFMEMORY;
1028     }
1029     TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1030
1031     return S_OK;
1032 }
1033
1034 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1035 {
1036     unsigned int i;
1037
1038     for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1039     {
1040         if (property_info[i].id == id)
1041             return &property_info[i];
1042     }
1043
1044     return NULL;
1045 }
1046
1047 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1048 {
1049     unsigned int i;
1050
1051     for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1052     {
1053         if (d3d10_effect_state_storage_info[i].id == id)
1054             return &d3d10_effect_state_storage_info[i];
1055     }
1056
1057     return NULL;
1058 }
1059
1060 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1061 {
1062     switch (in_type)
1063     {
1064         case D3D10_SVT_FLOAT:
1065             out_data[idx] = *(float *)&value;
1066             return TRUE;
1067
1068         case D3D10_SVT_INT:
1069             out_data[idx] = (INT)value;
1070             return TRUE;
1071
1072         default:
1073             FIXME("Unhandled in_type %#x.\n", in_type);
1074             return FALSE;
1075     }
1076 }
1077
1078 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1079 {
1080     switch (in_type)
1081     {
1082         case D3D10_SVT_FLOAT:
1083             out_data[idx] = *(float *)&value;
1084             return TRUE;
1085
1086         case D3D10_SVT_INT:
1087         case D3D10_SVT_BOOL:
1088             out_data[idx] = value;
1089             return TRUE;
1090
1091         default:
1092             FIXME("Unhandled in_type %#x.\n", in_type);
1093             return FALSE;
1094     }
1095 }
1096
1097 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1098 {
1099     switch (in_type)
1100     {
1101         case D3D10_SVT_INT:
1102             out_data[idx] = value;
1103             return TRUE;
1104
1105         default:
1106             FIXME("Unhandled in_type %#x.\n", in_type);
1107             return FALSE;
1108     }
1109 }
1110
1111 static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
1112         UINT out_base, UINT out_size, void *out_data)
1113 {
1114     D3D_SHADER_VARIABLE_TYPE in_type;
1115     DWORD t, value;
1116     DWORD count, i;
1117
1118     read_dword(&ptr, &count);
1119     if (count != out_size)
1120         return FALSE;
1121
1122     TRACE("%u values:\n", count);
1123     for (i = 0; i < count; ++i)
1124     {
1125         UINT out_idx = out_base * out_size + i;
1126
1127         read_dword(&ptr, &t);
1128         read_dword(&ptr, &value);
1129
1130         in_type = d3d10_variable_type(t, FALSE);
1131         TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1132
1133         switch (out_type)
1134         {
1135             case D3D10_SVT_FLOAT:
1136                 if (!read_float_value(value, in_type, out_data, out_idx))
1137                     return FALSE;
1138                 break;
1139
1140             case D3D10_SVT_INT:
1141             case D3D10_SVT_UINT:
1142             case D3D10_SVT_BOOL:
1143                 if (!read_int32_value(value, in_type, out_data, out_idx))
1144                     return FALSE;
1145                 break;
1146
1147             case D3D10_SVT_UINT8:
1148                 if (!read_int8_value(value, in_type, out_data, out_idx))
1149                     return FALSE;
1150                 break;
1151
1152             default:
1153                 FIXME("Unhandled out_type %#x.\n", out_type);
1154                 return FALSE;
1155         }
1156     }
1157
1158     return TRUE;
1159 }
1160
1161 static BOOL parse_fx10_state_group(const char **ptr, const char *data,
1162         D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1163 {
1164     const struct d3d10_effect_state_property_info *property_info;
1165     UINT value_offset;
1166     unsigned int i;
1167     DWORD count;
1168     UINT idx;
1169     UINT id;
1170
1171     read_dword(ptr, &count);
1172     TRACE("Property count: %#x.\n", count);
1173
1174     for (i = 0; i < count; ++i)
1175     {
1176         read_dword(ptr, &id);
1177         read_dword(ptr, &idx);
1178         skip_dword_unknown("read property", ptr, 1);
1179         read_dword(ptr, &value_offset);
1180
1181         if (!(property_info = get_property_info(id)))
1182         {
1183             FIXME("Failed to find property info for property %#x.\n", id);
1184             return FALSE;
1185         }
1186
1187         TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1188                 property_info->name, idx, value_offset);
1189
1190         if (property_info->container_type != container_type)
1191         {
1192             ERR("FAIL1\n");
1193             return FALSE;
1194         }
1195
1196         if (idx >= property_info->count)
1197         {
1198             ERR("FAIL2\n");
1199             return FALSE;
1200         }
1201
1202         if (!read_value_list(data + value_offset, property_info->type, idx,
1203                 property_info->size, (char *)container + property_info->offset))
1204         {
1205             ERR("FAIL3\n");
1206             return FALSE;
1207         }
1208     }
1209
1210     return TRUE;
1211 }
1212
1213 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
1214 {
1215     const char *data_ptr = NULL;
1216     DWORD offset;
1217     enum d3d10_effect_object_operation operation;
1218     HRESULT hr;
1219     struct d3d10_effect *effect = o->pass->technique->effect;
1220     ID3D10Effect *e = &effect->ID3D10Effect_iface;
1221
1222     read_dword(ptr, &o->type);
1223     TRACE("Effect object is of type %#x.\n", o->type);
1224
1225     read_dword(ptr, &o->index);
1226     TRACE("Effect object index %#x.\n", o->index);
1227
1228     read_dword(ptr, &operation);
1229     TRACE("Effect object operation %#x.\n", operation);
1230
1231     read_dword(ptr, &offset);
1232     TRACE("Effect object idx is at offset %#x.\n", offset);
1233
1234     switch(operation)
1235     {
1236         case D3D10_EOO_VALUE:
1237             TRACE("Copy variable values\n");
1238
1239             switch (o->type)
1240             {
1241                 case D3D10_EOT_VERTEXSHADER:
1242                     TRACE("Vertex shader\n");
1243                     o->data = &anonymous_vs;
1244                     hr = S_OK;
1245                     break;
1246
1247                 case D3D10_EOT_PIXELSHADER:
1248                     TRACE("Pixel shader\n");
1249                     o->data = &anonymous_ps;
1250                     hr = S_OK;
1251                     break;
1252
1253                 case D3D10_EOT_GEOMETRYSHADER:
1254                     TRACE("Geometry shader\n");
1255                     o->data = &anonymous_gs;
1256                     hr = S_OK;
1257                     break;
1258
1259                 case D3D10_EOT_STENCIL_REF:
1260                     if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1261                     {
1262                         ERR("Failed to read stencil ref.\n");
1263                         return E_FAIL;
1264                     }
1265
1266                     hr = S_OK;
1267                     break;
1268
1269                 case D3D10_EOT_SAMPLE_MASK:
1270                     if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1271                     {
1272                         FIXME("Failed to read sample mask.\n");
1273                         return E_FAIL;
1274                     }
1275
1276                     hr = S_OK;
1277                     break;
1278
1279                 case D3D10_EOT_BLEND_FACTOR:
1280                     if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1281                     {
1282                         FIXME("Failed to read blend factor.\n");
1283                         return E_FAIL;
1284                     }
1285
1286                     hr = S_OK;
1287                     break;
1288
1289                 default:
1290                     FIXME("Unhandled object type %#x\n", o->type);
1291                     hr = E_FAIL;
1292                     break;
1293             }
1294             break;
1295
1296         case D3D10_EOO_PARSED_OBJECT:
1297             /* This is a local object, we've parsed in parse_fx10_local_object. */
1298             TRACE("Shader = %s.\n", data + offset);
1299
1300             o->data = e->lpVtbl->GetVariableByName(e, data + offset);
1301             hr = S_OK;
1302             break;
1303
1304         case D3D10_EOO_PARSED_OBJECT_INDEX:
1305             /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1306             data_ptr = data + offset;
1307             read_dword(&data_ptr, &offset);
1308             read_dword(&data_ptr, &o->index);
1309             TRACE("Shader = %s[%u].\n", data + offset, o->index);
1310
1311             o->data = e->lpVtbl->GetVariableByName(e, data + offset);
1312             hr = S_OK;
1313             break;
1314
1315         case D3D10_EOO_ANONYMOUS_SHADER:
1316             TRACE("Anonymous shader\n");
1317
1318             /* check anonymous_shader_current for validity */
1319             if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1320             {
1321                 ERR("Anonymous shader count is wrong!\n");
1322                 return E_FAIL;
1323             }
1324
1325             data_ptr = data + offset;
1326             read_dword(&data_ptr, &offset);
1327             TRACE("Effect object starts at offset %#x.\n", offset);
1328
1329             data_ptr = data + offset;
1330
1331             hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type);
1332             if (FAILED(hr)) return hr;
1333
1334             o->data = &effect->anonymous_shaders[effect->anonymous_shader_current].shader;
1335             ++effect->anonymous_shader_current;
1336
1337             switch (o->type)
1338             {
1339                 case D3D10_EOT_VERTEXSHADER:
1340                     TRACE("Vertex shader\n");
1341                     hr = parse_shader(o->data, data_ptr);
1342                     break;
1343
1344                 case D3D10_EOT_PIXELSHADER:
1345                     TRACE("Pixel shader\n");
1346                     hr = parse_shader(o->data, data_ptr);
1347                     break;
1348
1349                 case D3D10_EOT_GEOMETRYSHADER:
1350                     TRACE("Geometry shader\n");
1351                     hr = parse_shader(o->data, data_ptr);
1352                     break;
1353
1354                 default:
1355                     FIXME("Unhandled object type %#x\n", o->type);
1356                     hr = E_FAIL;
1357                     break;
1358             }
1359             break;
1360
1361         default:
1362             hr = E_FAIL;
1363             FIXME("Unhandled operation %#x.\n", operation);
1364             break;
1365     }
1366
1367     return hr;
1368 }
1369
1370 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
1371 {
1372     HRESULT hr = S_OK;
1373     unsigned int i;
1374     DWORD offset;
1375
1376     read_dword(ptr, &offset);
1377     TRACE("Pass name at offset %#x.\n", offset);
1378
1379     if (!copy_name(data + offset, &p->name))
1380     {
1381         ERR("Failed to copy name.\n");
1382         return E_OUTOFMEMORY;
1383     }
1384     TRACE("Pass name: %s.\n", debugstr_a(p->name));
1385
1386     read_dword(ptr, &p->object_count);
1387     TRACE("Pass has %u effect objects.\n", p->object_count);
1388
1389     read_dword(ptr, &p->annotation_count);
1390     TRACE("Pass has %u annotations.\n", p->annotation_count);
1391
1392     p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
1393     if (!p->annotations)
1394     {
1395         ERR("Failed to allocate pass annotations memory.\n");
1396         return E_OUTOFMEMORY;
1397     }
1398
1399     for (i = 0; i < p->annotation_count; ++i)
1400     {
1401         struct d3d10_effect_variable *a = &p->annotations[i];
1402
1403         a->effect = p->technique->effect;
1404         a->buffer = &null_local_buffer;
1405
1406         hr = parse_fx10_annotation(a, ptr, data);
1407         if (FAILED(hr)) return hr;
1408     }
1409
1410     p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
1411     if (!p->objects)
1412     {
1413         ERR("Failed to allocate effect objects memory.\n");
1414         return E_OUTOFMEMORY;
1415     }
1416
1417     for (i = 0; i < p->object_count; ++i)
1418     {
1419         struct d3d10_effect_object *o = &p->objects[i];
1420
1421         o->pass = p;
1422
1423         hr = parse_fx10_object(o, ptr, data);
1424         if (FAILED(hr)) return hr;
1425     }
1426
1427     return hr;
1428 }
1429
1430 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
1431 {
1432     unsigned int i;
1433     DWORD offset;
1434     HRESULT hr;
1435
1436     read_dword(ptr, &offset);
1437     TRACE("Technique name at offset %#x.\n", offset);
1438
1439     if (!copy_name(data + offset, &t->name))
1440     {
1441         ERR("Failed to copy name.\n");
1442         return E_OUTOFMEMORY;
1443     }
1444     TRACE("Technique name: %s.\n", debugstr_a(t->name));
1445
1446     read_dword(ptr, &t->pass_count);
1447     TRACE("Technique has %u passes\n", t->pass_count);
1448
1449     read_dword(ptr, &t->annotation_count);
1450     TRACE("Technique has %u annotations.\n", t->annotation_count);
1451
1452     t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
1453     if (!t->annotations)
1454     {
1455         ERR("Failed to allocate technique annotations memory.\n");
1456         return E_OUTOFMEMORY;
1457     }
1458
1459     for (i = 0; i < t->annotation_count; ++i)
1460     {
1461         struct d3d10_effect_variable *a = &t->annotations[i];
1462
1463         a->effect = t->effect;
1464         a->buffer = &null_local_buffer;
1465
1466         hr = parse_fx10_annotation(a, ptr, data);
1467         if (FAILED(hr)) return hr;
1468     }
1469
1470     t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
1471     if (!t->passes)
1472     {
1473         ERR("Failed to allocate passes memory\n");
1474         return E_OUTOFMEMORY;
1475     }
1476
1477     for (i = 0; i < t->pass_count; ++i)
1478     {
1479         struct d3d10_effect_pass *p = &t->passes[i];
1480
1481         p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1482         p->technique = t;
1483
1484         hr = parse_fx10_pass(p, ptr, data);
1485         if (FAILED(hr)) return hr;
1486     }
1487
1488     return S_OK;
1489 }
1490
1491 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1492 {
1493     DWORD offset;
1494     unsigned int i;
1495     HRESULT hr;
1496
1497     hr = parse_fx10_variable_head(v, ptr, data);
1498     if (FAILED(hr)) return hr;
1499
1500     read_dword(ptr, &offset);
1501     TRACE("Variable semantic at offset %#x.\n", offset);
1502
1503     if (!copy_name(data + offset, &v->semantic))
1504     {
1505         ERR("Failed to copy semantic.\n");
1506         return E_OUTOFMEMORY;
1507     }
1508     TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1509
1510     read_dword(ptr, &v->buffer_offset);
1511     TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1512
1513     skip_dword_unknown("variable", ptr, 1);
1514
1515     read_dword(ptr, &v->flag);
1516     TRACE("Variable flag: %#x.\n", v->flag);
1517
1518     read_dword(ptr, &v->annotation_count);
1519     TRACE("Variable has %u annotations.\n", v->annotation_count);
1520
1521     v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1522     if (!v->annotations)
1523     {
1524         ERR("Failed to allocate variable annotations memory.\n");
1525         return E_OUTOFMEMORY;
1526     }
1527
1528     for (i = 0; i < v->annotation_count; ++i)
1529     {
1530         struct d3d10_effect_variable *a = &v->annotations[i];
1531
1532         a->effect = v->effect;
1533         a->buffer = &null_local_buffer;
1534
1535         hr = parse_fx10_annotation(a, ptr, data);
1536         if (FAILED(hr)) return hr;
1537     }
1538
1539     return S_OK;
1540 }
1541
1542 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1543 {
1544     unsigned int i;
1545     HRESULT hr;
1546     DWORD offset;
1547
1548     hr = parse_fx10_variable_head(v, ptr, data);
1549     if (FAILED(hr)) return hr;
1550
1551     read_dword(ptr, &offset);
1552     TRACE("Variable semantic at offset %#x.\n", offset);
1553
1554     if (!copy_name(data + offset, &v->semantic))
1555     {
1556         ERR("Failed to copy semantic.\n");
1557         return E_OUTOFMEMORY;
1558     }
1559     TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1560
1561     skip_dword_unknown("local variable", ptr, 1);
1562
1563     switch (v->type->basetype)
1564     {
1565         case D3D10_SVT_TEXTURE1D:
1566         case D3D10_SVT_TEXTURE1DARRAY:
1567         case D3D10_SVT_TEXTURE2D:
1568         case D3D10_SVT_TEXTURE2DARRAY:
1569         case D3D10_SVT_TEXTURE2DMS:
1570         case D3D10_SVT_TEXTURE2DMSARRAY:
1571         case D3D10_SVT_TEXTURE3D:
1572         case D3D10_SVT_TEXTURECUBE:
1573         case D3D10_SVT_RENDERTARGETVIEW:
1574         case D3D10_SVT_DEPTHSTENCILVIEW:
1575         case D3D10_SVT_BUFFER:
1576             TRACE("SVT could not have elements.\n");
1577             break;
1578
1579         case D3D10_SVT_VERTEXSHADER:
1580         case D3D10_SVT_PIXELSHADER:
1581         case D3D10_SVT_GEOMETRYSHADER:
1582             TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1583             for (i = 0; i < max(v->type->element_count, 1); ++i)
1584             {
1585                 DWORD shader_offset;
1586                 struct d3d10_effect_variable *var;
1587
1588                 if (!v->type->element_count)
1589                 {
1590                     var = v;
1591                 }
1592                 else
1593                 {
1594                     var = &v->elements[i];
1595                 }
1596
1597                 read_dword(ptr, &shader_offset);
1598                 TRACE("Shader offset: %#x.\n", shader_offset);
1599
1600                 hr = parse_shader(var, data + shader_offset);
1601                 if (FAILED(hr)) return hr;
1602             }
1603             break;
1604
1605         case D3D10_SVT_DEPTHSTENCIL:
1606         case D3D10_SVT_BLEND:
1607         case D3D10_SVT_RASTERIZER:
1608         case D3D10_SVT_SAMPLER:
1609             {
1610                 const struct d3d10_effect_state_storage_info *storage_info;
1611                 unsigned int count = max(v->type->element_count, 1);
1612                 unsigned char *desc;
1613
1614                 if (!(storage_info = get_storage_info(v->type->basetype)))
1615                 {
1616                     FIXME("Failed to get backing store info for type %s.\n",
1617                             debug_d3d10_shader_variable_type(v->type->basetype));
1618                     return E_FAIL;
1619                 }
1620
1621                 if (!(desc = HeapAlloc(GetProcessHeap(), 0, count * storage_info->size)))
1622                 {
1623                     ERR("Failed to allocate backing store memory.\n");
1624                     return E_OUTOFMEMORY;
1625                 }
1626
1627                 for (i = 0; i < count; ++i)
1628                 {
1629                     memcpy(&desc[i * storage_info->size], storage_info->default_state, storage_info->size);
1630
1631                     if (!parse_fx10_state_group(ptr, data, v->type->basetype, &desc[i * storage_info->size]))
1632                     {
1633                         ERR("Failed to read property list.\n");
1634                         HeapFree(GetProcessHeap(), 0, desc);
1635                         return E_FAIL;
1636                     }
1637                 }
1638
1639                 v->data = desc;
1640             }
1641             break;
1642
1643         default:
1644             FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1645             return E_FAIL;
1646     }
1647
1648     read_dword(ptr, &v->annotation_count);
1649     TRACE("Variable has %u annotations.\n", v->annotation_count);
1650
1651     v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1652     if (!v->annotations)
1653     {
1654         ERR("Failed to allocate variable annotations memory.\n");
1655         return E_OUTOFMEMORY;
1656     }
1657
1658     for (i = 0; i < v->annotation_count; ++i)
1659     {
1660         struct d3d10_effect_variable *a = &v->annotations[i];
1661
1662         a->effect = v->effect;
1663         a->buffer = &null_local_buffer;
1664
1665         hr = parse_fx10_annotation(a, ptr, data);
1666         if (FAILED(hr)) return hr;
1667     }
1668
1669     return S_OK;
1670 }
1671
1672 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1673 {
1674     unsigned int i;
1675     DWORD offset;
1676     D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1677     HRESULT hr;
1678     unsigned int stride = 0;
1679
1680     /* Generate our own type, it isn't in the fx blob. */
1681     l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1682     if (!l->type)
1683     {
1684         ERR("Failed to allocate local buffer type memory.\n");
1685         return E_OUTOFMEMORY;
1686     }
1687     l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1688     l->type->type_class = D3D10_SVC_OBJECT;
1689     l->type->effect = l->effect;
1690
1691     read_dword(ptr, &offset);
1692     TRACE("Local buffer name at offset %#x.\n", offset);
1693
1694     if (!copy_name(data + offset, &l->name))
1695     {
1696         ERR("Failed to copy name.\n");
1697         return E_OUTOFMEMORY;
1698     }
1699     TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1700
1701     read_dword(ptr, &l->data_size);
1702     TRACE("Local buffer data size: %#x.\n", l->data_size);
1703
1704     read_dword(ptr, &d3d10_cbuffer_type);
1705     TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1706
1707     switch(d3d10_cbuffer_type)
1708     {
1709         case D3D10_CT_CBUFFER:
1710             l->type->basetype = D3D10_SVT_CBUFFER;
1711             if (!copy_name("cbuffer", &l->type->name))
1712             {
1713                 ERR("Failed to copy name.\n");
1714                 return E_OUTOFMEMORY;
1715             }
1716             break;
1717
1718         case D3D10_CT_TBUFFER:
1719             l->type->basetype = D3D10_SVT_TBUFFER;
1720             if (!copy_name("tbuffer", &l->type->name))
1721             {
1722                 ERR("Failed to copy name.\n");
1723                 return E_OUTOFMEMORY;
1724             }
1725             break;
1726
1727         default:
1728             ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1729             return E_FAIL;
1730     }
1731
1732     read_dword(ptr, &l->type->member_count);
1733     TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1734
1735     skip_dword_unknown("local buffer", ptr, 1);
1736
1737     read_dword(ptr, &l->annotation_count);
1738     TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1739
1740     l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1741     if (!l->annotations)
1742     {
1743         ERR("Failed to allocate local buffer annotations memory.\n");
1744         return E_OUTOFMEMORY;
1745     }
1746
1747     for (i = 0; i < l->annotation_count; ++i)
1748     {
1749         struct d3d10_effect_variable *a = &l->annotations[i];
1750
1751         a->effect = l->effect;
1752         a->buffer = &null_local_buffer;
1753
1754         hr = parse_fx10_annotation(a, ptr, data);
1755         if (FAILED(hr)) return hr;
1756     }
1757
1758     l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1759     if (!l->members)
1760     {
1761         ERR("Failed to allocate members memory.\n");
1762         return E_OUTOFMEMORY;
1763     }
1764
1765     l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1766     if (!l->type->members)
1767     {
1768         ERR("Failed to allocate type members memory.\n");
1769         return E_OUTOFMEMORY;
1770     }
1771
1772     for (i = 0; i < l->type->member_count; ++i)
1773     {
1774         struct d3d10_effect_variable *v = &l->members[i];
1775         struct d3d10_effect_type_member *typem = &l->type->members[i];
1776
1777         v->buffer = l;
1778         v->effect = l->effect;
1779
1780         hr = parse_fx10_variable(v, ptr, data);
1781         if (FAILED(hr)) return hr;
1782
1783         /*
1784          * Copy the values from the variable type to the constant buffers type
1785          * members structure, because it is our own generated type.
1786          */
1787         typem->type = v->type;
1788
1789         if (!copy_name(v->name, &typem->name))
1790         {
1791             ERR("Failed to copy name.\n");
1792             return E_OUTOFMEMORY;
1793         }
1794         TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1795
1796         if (!copy_name(v->semantic, &typem->semantic))
1797         {
1798             ERR("Failed to copy name.\n");
1799             return E_OUTOFMEMORY;
1800         }
1801         TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1802
1803         typem->buffer_offset = v->buffer_offset;
1804         TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1805
1806         l->type->size_packed += v->type->size_packed;
1807
1808         /*
1809          * For the complete constantbuffer the size_unpacked = stride,
1810          * the stride is calculated like this:
1811          *
1812          * 1) if the constant buffer variables are packed with packoffset
1813          *    - stride = the highest used constant
1814          *    - the complete stride has to be a multiple of 0x10
1815          *
1816          * 2) if the constant buffer variables are NOT packed with packoffset
1817          *    - sum of unpacked size for all variables which fit in a 0x10 part
1818          *    - if the size exceeds a 0x10 part, the rest of the old part is skipped
1819          *      and a new part is started
1820          *    - if the variable is a struct it is always used a new part
1821          *    - the complete stride has to be a multiple of 0x10
1822          *
1823          *    e.g.:
1824          *             0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1825          *        part 0x10           0x10      0x20     -> 0x40
1826          */
1827         if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1828         {
1829             if ((v->type->size_unpacked + v->buffer_offset) > stride)
1830             {
1831                 stride = v->type->size_unpacked + v->buffer_offset;
1832             }
1833         }
1834         else
1835         {
1836             if (v->type->type_class == D3D10_SVC_STRUCT)
1837             {
1838                 stride = (stride + 0xf) & ~0xf;
1839             }
1840
1841             if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1842             {
1843                 stride = (stride + 0xf) & ~0xf;
1844             }
1845
1846             stride += v->type->size_unpacked;
1847         }
1848     }
1849     l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1850
1851     TRACE("Constant buffer:\n");
1852     TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1853     TRACE("\tElement count: %u.\n", l->type->element_count);
1854     TRACE("\tMember count: %u.\n", l->type->member_count);
1855     TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1856     TRACE("\tStride: %#x.\n", l->type->stride);
1857     TRACE("\tPacked size %#x.\n", l->type->size_packed);
1858     TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1859     TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1860
1861     return S_OK;
1862 }
1863
1864 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1865 {
1866     const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1867     const DWORD *id = key;
1868
1869     return *id - t->id;
1870 }
1871
1872 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1873 {
1874     TRACE("effect type member %p.\n", typem);
1875
1876     /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1877     HeapFree(GetProcessHeap(), 0, typem->semantic);
1878     HeapFree(GetProcessHeap(), 0, typem->name);
1879 }
1880
1881 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1882 {
1883     struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1884
1885     TRACE("effect type %p.\n", t);
1886
1887     if (t->elementtype)
1888     {
1889         HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1890         HeapFree(GetProcessHeap(), 0, t->elementtype);
1891     }
1892
1893     if (t->members)
1894     {
1895         unsigned int i;
1896
1897         for (i = 0; i < t->member_count; ++i)
1898         {
1899             d3d10_effect_type_member_destroy(&t->members[i]);
1900         }
1901         HeapFree(GetProcessHeap(), 0, t->members);
1902     }
1903
1904     HeapFree(GetProcessHeap(), 0, t->name);
1905     HeapFree(GetProcessHeap(), 0, t);
1906 }
1907
1908 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1909 {
1910     d3d10_rb_alloc,
1911     d3d10_rb_realloc,
1912     d3d10_rb_free,
1913     d3d10_effect_type_compare,
1914 };
1915
1916 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1917 {
1918     const char *ptr = data + e->index_offset;
1919     unsigned int i;
1920     HRESULT hr;
1921
1922     if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1923     {
1924         ERR("Failed to initialize type rbtree.\n");
1925         return E_FAIL;
1926     }
1927
1928     e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1929     if (!e->local_buffers)
1930     {
1931         ERR("Failed to allocate local buffer memory.\n");
1932         return E_OUTOFMEMORY;
1933     }
1934
1935     e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1936     if (!e->local_variables)
1937     {
1938         ERR("Failed to allocate local variable memory.\n");
1939         return E_OUTOFMEMORY;
1940     }
1941
1942     e->anonymous_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->anonymous_shader_count * sizeof(*e->anonymous_shaders));
1943     if (!e->anonymous_shaders)
1944     {
1945         ERR("Failed to allocate anonymous shaders memory\n");
1946         return E_OUTOFMEMORY;
1947     }
1948
1949     e->used_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->used_shader_count * sizeof(*e->used_shaders));
1950     if (!e->used_shaders)
1951     {
1952         ERR("Failed to allocate used shaders memory\n");
1953         return E_OUTOFMEMORY;
1954     }
1955
1956     e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
1957     if (!e->techniques)
1958     {
1959         ERR("Failed to allocate techniques memory\n");
1960         return E_OUTOFMEMORY;
1961     }
1962
1963     for (i = 0; i < e->local_buffer_count; ++i)
1964     {
1965         struct d3d10_effect_variable *l = &e->local_buffers[i];
1966         l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
1967         l->effect = e;
1968         l->buffer = &null_local_buffer;
1969
1970         hr = parse_fx10_local_buffer(l, &ptr, data);
1971         if (FAILED(hr)) return hr;
1972     }
1973
1974     for (i = 0; i < e->local_variable_count; ++i)
1975     {
1976         struct d3d10_effect_variable *v = &e->local_variables[i];
1977
1978         v->effect = e;
1979         v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
1980         v->buffer = &null_local_buffer;
1981
1982         hr = parse_fx10_local_variable(v, &ptr, data);
1983         if (FAILED(hr)) return hr;
1984     }
1985
1986     for (i = 0; i < e->technique_count; ++i)
1987     {
1988         struct d3d10_effect_technique *t = &e->techniques[i];
1989
1990         t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
1991         t->effect = e;
1992
1993         hr = parse_fx10_technique(t, &ptr, data);
1994         if (FAILED(hr)) return hr;
1995     }
1996
1997     return S_OK;
1998 }
1999
2000 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2001 {
2002     const char *ptr = data;
2003     DWORD unknown;
2004
2005     /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2006     read_dword(&ptr, &e->version);
2007     TRACE("Target: %#x\n", e->version);
2008
2009     read_dword(&ptr, &e->local_buffer_count);
2010     TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2011
2012     read_dword(&ptr, &e->variable_count);
2013     TRACE("Variable count: %u\n", e->variable_count);
2014
2015     read_dword(&ptr, &e->local_variable_count);
2016     TRACE("Object count: %u\n", e->local_variable_count);
2017
2018     read_dword(&ptr, &e->sharedbuffers_count);
2019     TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2020
2021     /* Number of variables in shared buffers? */
2022     read_dword(&ptr, &unknown);
2023     FIXME("Unknown 0: %u\n", unknown);
2024
2025     read_dword(&ptr, &e->sharedobjects_count);
2026     TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2027
2028     read_dword(&ptr, &e->technique_count);
2029     TRACE("Technique count: %u\n", e->technique_count);
2030
2031     read_dword(&ptr, &e->index_offset);
2032     TRACE("Index offset: %#x\n", e->index_offset);
2033
2034     read_dword(&ptr, &unknown);
2035     FIXME("Unknown 1: %u\n", unknown);
2036
2037     read_dword(&ptr, &e->texture_count);
2038     TRACE("Texture count: %u\n", e->texture_count);
2039
2040     read_dword(&ptr, &e->dephstencilstate_count);
2041     TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2042
2043     read_dword(&ptr, &e->blendstate_count);
2044     TRACE("Blendstate count: %u\n", e->blendstate_count);
2045
2046     read_dword(&ptr, &e->rasterizerstate_count);
2047     TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2048
2049     read_dword(&ptr, &e->samplerstate_count);
2050     TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2051
2052     read_dword(&ptr, &e->rendertargetview_count);
2053     TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2054
2055     read_dword(&ptr, &e->depthstencilview_count);
2056     TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2057
2058     read_dword(&ptr, &e->used_shader_count);
2059     TRACE("Used shader count: %u\n", e->used_shader_count);
2060
2061     read_dword(&ptr, &e->anonymous_shader_count);
2062     TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2063
2064     return parse_fx10_body(e, ptr, data_size - (ptr - data));
2065 }
2066
2067 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2068 {
2069     struct d3d10_effect *e = ctx;
2070
2071     TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2072
2073     TRACE("chunk size: %#x\n", data_size);
2074
2075     switch(tag)
2076     {
2077         case TAG_FX10:
2078             return parse_fx10(e, data, data_size);
2079
2080         default:
2081             FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2082             return S_OK;
2083     }
2084 }
2085
2086 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2087 {
2088     return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2089 }
2090
2091 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2092 {
2093     ID3D10Device *device = o->pass->technique->effect->device;
2094     struct d3d10_effect_variable *v = (struct d3d10_effect_variable*) o->data;
2095
2096     TRACE("effect object %p, type %#x.\n", o, o->type);
2097
2098     switch(o->type)
2099     {
2100         case D3D10_EOT_VERTEXSHADER:
2101             ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.vs);
2102             return S_OK;
2103
2104         case D3D10_EOT_PIXELSHADER:
2105             ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.ps);
2106             return S_OK;
2107
2108         case D3D10_EOT_GEOMETRYSHADER:
2109             ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.gs);
2110             return S_OK;
2111
2112         default:
2113             FIXME("Unhandled effect object type %#x.\n", o->type);
2114             return E_FAIL;
2115     }
2116 }
2117
2118 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2119 {
2120     unsigned int i;
2121
2122     TRACE("variable %p.\n", v);
2123
2124     HeapFree(GetProcessHeap(), 0, v->name);
2125     HeapFree(GetProcessHeap(), 0, v->semantic);
2126     if (v->annotations)
2127     {
2128         for (i = 0; i < v->annotation_count; ++i)
2129         {
2130             d3d10_effect_variable_destroy(&v->annotations[i]);
2131         }
2132         HeapFree(GetProcessHeap(), 0, v->annotations);
2133     }
2134
2135     if (v->members)
2136     {
2137         for (i = 0; i < v->type->member_count; ++i)
2138         {
2139             d3d10_effect_variable_destroy(&v->members[i]);
2140         }
2141         HeapFree(GetProcessHeap(), 0, v->members);
2142     }
2143
2144     if (v->elements)
2145     {
2146         for (i = 0; i < v->type->element_count; ++i)
2147         {
2148             d3d10_effect_variable_destroy(&v->elements[i]);
2149         }
2150         HeapFree(GetProcessHeap(), 0, v->elements);
2151     }
2152
2153     if (v->data)
2154     {
2155         switch(v->type->basetype)
2156         {
2157             case D3D10_SVT_VERTEXSHADER:
2158             case D3D10_SVT_PIXELSHADER:
2159             case D3D10_SVT_GEOMETRYSHADER:
2160                 shader_free_signature(&((struct d3d10_effect_shader_variable *)v->data)->input_signature);
2161                 shader_free_signature(&((struct d3d10_effect_shader_variable *)v->data)->output_signature);
2162                 break;
2163
2164             default:
2165                 break;
2166         }
2167         HeapFree(GetProcessHeap(), 0, v->data);
2168     }
2169 }
2170
2171 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2172 {
2173     unsigned int i;
2174
2175     TRACE("pass %p\n", p);
2176
2177     HeapFree(GetProcessHeap(), 0, p->name);
2178     HeapFree(GetProcessHeap(), 0, p->objects);
2179
2180     if (p->annotations)
2181     {
2182         for (i = 0; i < p->annotation_count; ++i)
2183         {
2184             d3d10_effect_variable_destroy(&p->annotations[i]);
2185         }
2186         HeapFree(GetProcessHeap(), 0, p->annotations);
2187     }
2188 }
2189
2190 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2191 {
2192     unsigned int i;
2193
2194     TRACE("technique %p\n", t);
2195
2196     HeapFree(GetProcessHeap(), 0, t->name);
2197     if (t->passes)
2198     {
2199         for (i = 0; i < t->pass_count; ++i)
2200         {
2201             d3d10_effect_pass_destroy(&t->passes[i]);
2202         }
2203         HeapFree(GetProcessHeap(), 0, t->passes);
2204     }
2205
2206     if (t->annotations)
2207     {
2208         for (i = 0; i < t->annotation_count; ++i)
2209         {
2210             d3d10_effect_variable_destroy(&t->annotations[i]);
2211         }
2212         HeapFree(GetProcessHeap(), 0, t->annotations);
2213     }
2214 }
2215
2216 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2217 {
2218     unsigned int i;
2219
2220     TRACE("local buffer %p.\n", l);
2221
2222     HeapFree(GetProcessHeap(), 0, l->name);
2223     if (l->members)
2224     {
2225         for (i = 0; i < l->type->member_count; ++i)
2226         {
2227             d3d10_effect_variable_destroy(&l->members[i]);
2228         }
2229         HeapFree(GetProcessHeap(), 0, l->members);
2230     }
2231
2232     if (l->type->members)
2233     {
2234         for (i = 0; i < l->type->member_count; ++i)
2235         {
2236             /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2237             HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2238             HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2239         }
2240         HeapFree(GetProcessHeap(), 0, l->type->members);
2241     }
2242     HeapFree(GetProcessHeap(), 0, l->type->name);
2243     HeapFree(GetProcessHeap(), 0, l->type);
2244
2245     if (l->annotations)
2246     {
2247         for (i = 0; i < l->annotation_count; ++i)
2248         {
2249             d3d10_effect_variable_destroy(&l->annotations[i]);
2250         }
2251         HeapFree(GetProcessHeap(), 0, l->annotations);
2252     }
2253 }
2254
2255 /* IUnknown methods */
2256
2257 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2258 {
2259     return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2260 }
2261
2262 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2263 {
2264     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2265
2266     if (IsEqualGUID(riid, &IID_ID3D10Effect)
2267             || IsEqualGUID(riid, &IID_IUnknown))
2268     {
2269         IUnknown_AddRef(iface);
2270         *object = iface;
2271         return S_OK;
2272     }
2273
2274     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2275
2276     *object = NULL;
2277     return E_NOINTERFACE;
2278 }
2279
2280 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2281 {
2282     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2283     ULONG refcount = InterlockedIncrement(&This->refcount);
2284
2285     TRACE("%p increasing refcount to %u\n", This, refcount);
2286
2287     return refcount;
2288 }
2289
2290 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2291 {
2292     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2293     ULONG refcount = InterlockedDecrement(&This->refcount);
2294
2295     TRACE("%p decreasing refcount to %u\n", This, refcount);
2296
2297     if (!refcount)
2298     {
2299         unsigned int i;
2300
2301         if (This->techniques)
2302         {
2303             for (i = 0; i < This->technique_count; ++i)
2304             {
2305                 d3d10_effect_technique_destroy(&This->techniques[i]);
2306             }
2307             HeapFree(GetProcessHeap(), 0, This->techniques);
2308         }
2309
2310         if (This->local_variables)
2311         {
2312             for (i = 0; i < This->local_variable_count; ++i)
2313             {
2314                 d3d10_effect_variable_destroy(&This->local_variables[i]);
2315             }
2316             HeapFree(GetProcessHeap(), 0, This->local_variables);
2317         }
2318
2319         if (This->local_buffers)
2320         {
2321             for (i = 0; i < This->local_buffer_count; ++i)
2322             {
2323                 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2324             }
2325             HeapFree(GetProcessHeap(), 0, This->local_buffers);
2326         }
2327
2328         if (This->anonymous_shaders)
2329         {
2330             for (i = 0; i < This->anonymous_shader_count; ++i)
2331             {
2332                 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2333                 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2334             }
2335             HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2336         }
2337
2338         HeapFree(GetProcessHeap(), 0, This->used_shaders);
2339
2340         wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2341
2342         ID3D10Device_Release(This->device);
2343         HeapFree(GetProcessHeap(), 0, This);
2344     }
2345
2346     return refcount;
2347 }
2348
2349 /* ID3D10Effect methods */
2350
2351 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2352 {
2353     FIXME("iface %p stub!\n", iface);
2354
2355     return FALSE;
2356 }
2357
2358 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2359 {
2360     FIXME("iface %p stub!\n", iface);
2361
2362     return FALSE;
2363 }
2364
2365 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2366 {
2367     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2368
2369     TRACE("iface %p, device %p\n", iface, device);
2370
2371     ID3D10Device_AddRef(This->device);
2372     *device = This->device;
2373
2374     return S_OK;
2375 }
2376
2377 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2378 {
2379     FIXME("iface %p, desc %p stub!\n", iface, desc);
2380
2381     return E_NOTIMPL;
2382 }
2383
2384 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2385         UINT index)
2386 {
2387     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2388     struct d3d10_effect_variable *l;
2389
2390     TRACE("iface %p, index %u\n", iface, index);
2391
2392     if (index >= This->local_buffer_count)
2393     {
2394         WARN("Invalid index specified\n");
2395         return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2396     }
2397
2398     l = &This->local_buffers[index];
2399
2400     TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2401
2402     return (ID3D10EffectConstantBuffer *)l;
2403 }
2404
2405 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2406         LPCSTR name)
2407 {
2408     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2409     unsigned int i;
2410
2411     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2412
2413     for (i = 0; i < This->local_buffer_count; ++i)
2414     {
2415         struct d3d10_effect_variable *l = &This->local_buffers[i];
2416
2417         if (!strcmp(l->name, name))
2418         {
2419             TRACE("Returning buffer %p.\n", l);
2420             return (ID3D10EffectConstantBuffer *)l;
2421         }
2422     }
2423
2424     WARN("Invalid name specified\n");
2425
2426     return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2427 }
2428
2429 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2430 {
2431     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2432     unsigned int i;
2433
2434     TRACE("iface %p, index %u\n", iface, index);
2435
2436     for (i = 0; i < This->local_buffer_count; ++i)
2437     {
2438         struct d3d10_effect_variable *l = &This->local_buffers[i];
2439
2440         if (index < l->type->member_count)
2441         {
2442             struct d3d10_effect_variable *v = &l->members[index];
2443
2444             TRACE("Returning variable %p.\n", v);
2445             return &v->ID3D10EffectVariable_iface;
2446         }
2447         index -= l->type->member_count;
2448     }
2449
2450     if (index < This->local_variable_count)
2451     {
2452         struct d3d10_effect_variable *v = &This->local_variables[index];
2453
2454         TRACE("Returning variable %p.\n", v);
2455         return &v->ID3D10EffectVariable_iface;
2456     }
2457
2458     WARN("Invalid index specified\n");
2459
2460     return &null_variable.ID3D10EffectVariable_iface;
2461 }
2462
2463 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
2464 {
2465     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2466     unsigned int i;
2467
2468     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2469
2470     if (!name)
2471     {
2472         WARN("Invalid name specified\n");
2473         return &null_variable.ID3D10EffectVariable_iface;
2474     }
2475
2476     for (i = 0; i < This->local_buffer_count; ++i)
2477     {
2478         struct d3d10_effect_variable *l = &This->local_buffers[i];
2479         unsigned int j;
2480
2481         for (j = 0; j < l->type->member_count; ++j)
2482         {
2483             struct d3d10_effect_variable *v = &l->members[j];
2484
2485             if (!strcmp(v->name, name))
2486             {
2487                 TRACE("Returning variable %p.\n", v);
2488                 return &v->ID3D10EffectVariable_iface;
2489             }
2490         }
2491     }
2492
2493     for (i = 0; i < This->local_variable_count; ++i)
2494     {
2495         struct d3d10_effect_variable *v = &This->local_variables[i];
2496
2497         if (!strcmp(v->name, name))
2498         {
2499             TRACE("Returning variable %p.\n", v);
2500             return &v->ID3D10EffectVariable_iface;
2501         }
2502     }
2503
2504     WARN("Invalid name specified\n");
2505
2506     return &null_variable.ID3D10EffectVariable_iface;
2507 }
2508
2509 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2510         LPCSTR semantic)
2511 {
2512     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2513     unsigned int i;
2514
2515     TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2516
2517     if (!semantic)
2518     {
2519         WARN("Invalid semantic specified\n");
2520         return &null_variable.ID3D10EffectVariable_iface;
2521     }
2522
2523     for (i = 0; i < This->local_buffer_count; ++i)
2524     {
2525         struct d3d10_effect_variable *l = &This->local_buffers[i];
2526         unsigned int j;
2527
2528         for (j = 0; j < l->type->member_count; ++j)
2529         {
2530             struct d3d10_effect_variable *v = &l->members[j];
2531
2532             if (!strcmp(v->semantic, semantic))
2533             {
2534                 TRACE("Returning variable %p.\n", v);
2535                 return &v->ID3D10EffectVariable_iface;
2536             }
2537         }
2538     }
2539
2540     for (i = 0; i < This->local_variable_count; ++i)
2541     {
2542         struct d3d10_effect_variable *v = &This->local_variables[i];
2543
2544         if (!strcmp(v->semantic, semantic))
2545         {
2546             TRACE("Returning variable %p.\n", v);
2547             return &v->ID3D10EffectVariable_iface;
2548         }
2549     }
2550
2551     WARN("Invalid semantic specified\n");
2552
2553     return &null_variable.ID3D10EffectVariable_iface;
2554 }
2555
2556 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2557         UINT index)
2558 {
2559     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2560     struct d3d10_effect_technique *t;
2561
2562     TRACE("iface %p, index %u\n", iface, index);
2563
2564     if (index >= This->technique_count)
2565     {
2566         WARN("Invalid index specified\n");
2567         return &null_technique.ID3D10EffectTechnique_iface;
2568     }
2569
2570     t = &This->techniques[index];
2571
2572     TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2573
2574     return &t->ID3D10EffectTechnique_iface;
2575 }
2576
2577 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2578         LPCSTR name)
2579 {
2580     struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2581     unsigned int i;
2582
2583     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2584
2585     if (!name)
2586     {
2587         WARN("Invalid name specified\n");
2588         return &null_technique.ID3D10EffectTechnique_iface;
2589     }
2590
2591     for (i = 0; i < This->technique_count; ++i)
2592     {
2593         struct d3d10_effect_technique *t = &This->techniques[i];
2594         if (!strcmp(t->name, name))
2595         {
2596             TRACE("Returning technique %p\n", t);
2597             return &t->ID3D10EffectTechnique_iface;
2598         }
2599     }
2600
2601     WARN("Invalid name specified\n");
2602
2603     return &null_technique.ID3D10EffectTechnique_iface;
2604 }
2605
2606 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2607 {
2608     FIXME("iface %p stub!\n", iface);
2609
2610     return E_NOTIMPL;
2611 }
2612
2613 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2614 {
2615     FIXME("iface %p stub!\n", iface);
2616
2617     return FALSE;
2618 }
2619
2620 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2621 {
2622     /* IUnknown methods */
2623     d3d10_effect_QueryInterface,
2624     d3d10_effect_AddRef,
2625     d3d10_effect_Release,
2626     /* ID3D10Effect methods */
2627     d3d10_effect_IsValid,
2628     d3d10_effect_IsPool,
2629     d3d10_effect_GetDevice,
2630     d3d10_effect_GetDesc,
2631     d3d10_effect_GetConstantBufferByIndex,
2632     d3d10_effect_GetConstantBufferByName,
2633     d3d10_effect_GetVariableByIndex,
2634     d3d10_effect_GetVariableByName,
2635     d3d10_effect_GetVariableBySemantic,
2636     d3d10_effect_GetTechniqueByIndex,
2637     d3d10_effect_GetTechniqueByName,
2638     d3d10_effect_Optimize,
2639     d3d10_effect_IsOptimized,
2640 };
2641
2642 /* ID3D10EffectTechnique methods */
2643
2644 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2645 {
2646     return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2647 }
2648
2649 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2650 {
2651     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2652
2653     TRACE("iface %p\n", iface);
2654
2655     return This != &null_technique;
2656 }
2657
2658 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2659         D3D10_TECHNIQUE_DESC *desc)
2660 {
2661     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2662
2663     TRACE("iface %p, desc %p\n", iface, desc);
2664
2665     if(This == &null_technique)
2666     {
2667         WARN("Null technique specified\n");
2668         return E_FAIL;
2669     }
2670
2671     if(!desc)
2672     {
2673         WARN("Invalid argument specified\n");
2674         return E_INVALIDARG;
2675     }
2676
2677     desc->Name = This->name;
2678     desc->Passes = This->pass_count;
2679     desc->Annotations = This->annotation_count;
2680
2681     return S_OK;
2682 }
2683
2684 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2685         ID3D10EffectTechnique *iface, UINT index)
2686 {
2687     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2688     struct d3d10_effect_variable *a;
2689
2690     TRACE("iface %p, index %u\n", iface, index);
2691
2692     if (index >= This->annotation_count)
2693     {
2694         WARN("Invalid index specified\n");
2695         return &null_variable.ID3D10EffectVariable_iface;
2696     }
2697
2698     a = &This->annotations[index];
2699
2700     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2701
2702     return &a->ID3D10EffectVariable_iface;
2703 }
2704
2705 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2706         ID3D10EffectTechnique *iface, LPCSTR name)
2707 {
2708     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2709     unsigned int i;
2710
2711     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2712
2713     for (i = 0; i < This->annotation_count; ++i)
2714     {
2715         struct d3d10_effect_variable *a = &This->annotations[i];
2716         if (!strcmp(a->name, name))
2717         {
2718             TRACE("Returning annotation %p\n", a);
2719             return &a->ID3D10EffectVariable_iface;
2720         }
2721     }
2722
2723     WARN("Invalid name specified\n");
2724
2725     return &null_variable.ID3D10EffectVariable_iface;
2726 }
2727
2728 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2729         UINT index)
2730 {
2731     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2732     struct d3d10_effect_pass *p;
2733
2734     TRACE("iface %p, index %u\n", iface, index);
2735
2736     if (index >= This->pass_count)
2737     {
2738         WARN("Invalid index specified\n");
2739         return &null_pass.ID3D10EffectPass_iface;
2740     }
2741
2742     p = &This->passes[index];
2743
2744     TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2745
2746     return &p->ID3D10EffectPass_iface;
2747 }
2748
2749 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2750         LPCSTR name)
2751 {
2752     struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2753     unsigned int i;
2754
2755     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2756
2757     /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2758
2759     for (i = 0; i < This->pass_count; ++i)
2760     {
2761         struct d3d10_effect_pass *p = &This->passes[i];
2762         if (!strcmp(p->name, name))
2763         {
2764             TRACE("Returning pass %p\n", p);
2765             return &p->ID3D10EffectPass_iface;
2766         }
2767     }
2768
2769     WARN("Invalid name specified\n");
2770
2771     return &null_pass.ID3D10EffectPass_iface;
2772 }
2773
2774 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2775         D3D10_STATE_BLOCK_MASK *mask)
2776 {
2777     FIXME("iface %p,mask %p stub!\n", iface, mask);
2778
2779     return E_NOTIMPL;
2780 }
2781
2782 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2783 {
2784     /* ID3D10EffectTechnique methods */
2785     d3d10_effect_technique_IsValid,
2786     d3d10_effect_technique_GetDesc,
2787     d3d10_effect_technique_GetAnnotationByIndex,
2788     d3d10_effect_technique_GetAnnotationByName,
2789     d3d10_effect_technique_GetPassByIndex,
2790     d3d10_effect_technique_GetPassByName,
2791     d3d10_effect_technique_ComputeStateBlockMask,
2792 };
2793
2794 /* ID3D10EffectPass methods */
2795
2796 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2797 {
2798     return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2799 }
2800
2801 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2802 {
2803     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2804
2805     TRACE("iface %p\n", iface);
2806
2807     return This != &null_pass;
2808 }
2809
2810 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
2811         D3D10_PASS_DESC *desc)
2812 {
2813     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2814     unsigned int i;
2815
2816     FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2817
2818     if(This == &null_pass)
2819     {
2820         WARN("Null pass specified\n");
2821         return E_FAIL;
2822     }
2823
2824     if(!desc)
2825     {
2826         WARN("Invalid argument specified\n");
2827         return E_INVALIDARG;
2828     }
2829
2830     memset(desc, 0, sizeof(*desc));
2831     desc->Name = This->name;
2832     for (i = 0; i < This->object_count; ++i)
2833     {
2834         struct d3d10_effect_object *o = &This->objects[i];
2835         if (o->type == D3D10_EOT_VERTEXSHADER)
2836         {
2837             struct d3d10_effect_variable *v = o->data;
2838             struct d3d10_effect_shader_variable *s = v->data;
2839             desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
2840             desc->IAInputSignatureSize = s->input_signature.signature_size;
2841             break;
2842         }
2843     }
2844
2845     desc->StencilRef = This->stencil_ref;
2846     desc->SampleMask = This->sample_mask;
2847     memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
2848
2849     return S_OK;
2850 }
2851
2852 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2853         D3D10_PASS_SHADER_DESC *desc)
2854 {
2855     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2856     unsigned int i;
2857
2858     TRACE("iface %p, desc %p\n", iface, desc);
2859
2860     if (This == &null_pass)
2861     {
2862         WARN("Null pass specified\n");
2863         return E_FAIL;
2864     }
2865
2866     if (!desc)
2867     {
2868         WARN("Invalid argument specified\n");
2869         return E_INVALIDARG;
2870     }
2871
2872     for (i = 0; i < This->object_count; ++i)
2873     {
2874         struct d3d10_effect_object *o = &This->objects[i];
2875
2876         if (o->type == D3D10_EOT_VERTEXSHADER)
2877         {
2878             desc->pShaderVariable = o->data;
2879             desc->ShaderIndex = o->index;
2880             return S_OK;
2881         }
2882     }
2883
2884     TRACE("Returning null_shader_variable\n");
2885     desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2886     desc->ShaderIndex = 0;
2887
2888     return S_OK;
2889 }
2890
2891 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2892         D3D10_PASS_SHADER_DESC *desc)
2893 {
2894     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2895     unsigned int i;
2896
2897     TRACE("iface %p, desc %p\n", iface, desc);
2898
2899     if (This == &null_pass)
2900     {
2901         WARN("Null pass specified\n");
2902         return E_FAIL;
2903     }
2904
2905     if (!desc)
2906     {
2907         WARN("Invalid argument specified\n");
2908         return E_INVALIDARG;
2909     }
2910
2911     for (i = 0; i < This->object_count; ++i)
2912     {
2913         struct d3d10_effect_object *o = &This->objects[i];
2914
2915         if (o->type == D3D10_EOT_GEOMETRYSHADER)
2916         {
2917             desc->pShaderVariable = o->data;
2918             desc->ShaderIndex = o->index;
2919             return S_OK;
2920         }
2921     }
2922
2923     TRACE("Returning null_shader_variable\n");
2924     desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2925     desc->ShaderIndex = 0;
2926
2927     return S_OK;
2928 }
2929
2930 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
2931         D3D10_PASS_SHADER_DESC *desc)
2932 {
2933     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2934     unsigned int i;
2935
2936     TRACE("iface %p, desc %p\n", iface, desc);
2937
2938     if (This == &null_pass)
2939     {
2940         WARN("Null pass specified\n");
2941         return E_FAIL;
2942     }
2943
2944     if (!desc)
2945     {
2946         WARN("Invalid argument specified\n");
2947         return E_INVALIDARG;
2948     }
2949
2950     for (i = 0; i < This->object_count; ++i)
2951     {
2952         struct d3d10_effect_object *o = &This->objects[i];
2953
2954         if (o->type == D3D10_EOT_PIXELSHADER)
2955         {
2956             desc->pShaderVariable = o->data;
2957             desc->ShaderIndex = o->index;
2958             return S_OK;
2959         }
2960     }
2961
2962     TRACE("Returning null_shader_variable\n");
2963     desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2964     desc->ShaderIndex = 0;
2965
2966     return S_OK;
2967 }
2968
2969 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
2970         UINT index)
2971 {
2972     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2973     struct d3d10_effect_variable *a;
2974
2975     TRACE("iface %p, index %u\n", iface, index);
2976
2977     if (index >= This->annotation_count)
2978     {
2979         WARN("Invalid index specified\n");
2980         return &null_variable.ID3D10EffectVariable_iface;
2981     }
2982
2983     a = &This->annotations[index];
2984
2985     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2986
2987     return &a->ID3D10EffectVariable_iface;
2988 }
2989
2990 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
2991         LPCSTR name)
2992 {
2993     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2994     unsigned int i;
2995
2996     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2997
2998     for (i = 0; i < This->annotation_count; ++i)
2999     {
3000         struct d3d10_effect_variable *a = &This->annotations[i];
3001         if (!strcmp(a->name, name))
3002         {
3003             TRACE("Returning annotation %p\n", a);
3004             return &a->ID3D10EffectVariable_iface;
3005         }
3006     }
3007
3008     WARN("Invalid name specified\n");
3009
3010     return &null_variable.ID3D10EffectVariable_iface;
3011 }
3012
3013 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3014 {
3015     struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3016     HRESULT hr = S_OK;
3017     unsigned int i;
3018
3019     TRACE("iface %p, flags %#x\n", iface, flags);
3020
3021     if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3022
3023     for (i = 0; i < This->object_count; ++i)
3024     {
3025         hr = d3d10_effect_object_apply(&This->objects[i]);
3026         if (FAILED(hr)) break;
3027     }
3028
3029     return hr;
3030 }
3031
3032 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3033         D3D10_STATE_BLOCK_MASK *mask)
3034 {
3035     FIXME("iface %p, mask %p stub!\n", iface, mask);
3036
3037     return E_NOTIMPL;
3038 }
3039
3040 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3041 {
3042     /* ID3D10EffectPass methods */
3043     d3d10_effect_pass_IsValid,
3044     d3d10_effect_pass_GetDesc,
3045     d3d10_effect_pass_GetVertexShaderDesc,
3046     d3d10_effect_pass_GetGeometryShaderDesc,
3047     d3d10_effect_pass_GetPixelShaderDesc,
3048     d3d10_effect_pass_GetAnnotationByIndex,
3049     d3d10_effect_pass_GetAnnotationByName,
3050     d3d10_effect_pass_Apply,
3051     d3d10_effect_pass_ComputeStateBlockMask,
3052 };
3053
3054 /* ID3D10EffectVariable methods */
3055
3056 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3057 {
3058     TRACE("iface %p\n", iface);
3059
3060     return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3061 }
3062
3063 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3064 {
3065     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3066
3067     TRACE("iface %p\n", iface);
3068
3069     return &This->type->ID3D10EffectType_iface;
3070 }
3071
3072 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3073         D3D10_EFFECT_VARIABLE_DESC *desc)
3074 {
3075     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3076
3077     TRACE("iface %p, desc %p\n", iface, desc);
3078
3079     if (!iface->lpVtbl->IsValid(iface))
3080     {
3081         WARN("Null variable specified\n");
3082         return E_FAIL;
3083     }
3084
3085     if (!desc)
3086     {
3087         WARN("Invalid argument specified\n");
3088         return E_INVALIDARG;
3089     }
3090
3091     /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3092     memset(desc, 0, sizeof(*desc));
3093     desc->Name = This->name;
3094     desc->Semantic = This->semantic;
3095     desc->Flags = This->flag;
3096     desc->Annotations = This->annotation_count;
3097     desc->BufferOffset = This->buffer_offset;
3098
3099     if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3100     {
3101         desc->ExplicitBindPoint = This->buffer_offset;
3102     }
3103
3104     return S_OK;
3105 }
3106
3107 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3108         ID3D10EffectVariable *iface, UINT index)
3109 {
3110     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3111     struct d3d10_effect_variable *a;
3112
3113     TRACE("iface %p, index %u\n", iface, index);
3114
3115     if (index >= This->annotation_count)
3116     {
3117         WARN("Invalid index specified\n");
3118         return &null_variable.ID3D10EffectVariable_iface;
3119     }
3120
3121     a = &This->annotations[index];
3122
3123     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3124
3125     return &a->ID3D10EffectVariable_iface;
3126 }
3127
3128 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3129         ID3D10EffectVariable *iface, LPCSTR name)
3130 {
3131     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3132     unsigned int i;
3133
3134     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3135
3136     for (i = 0; i < This->annotation_count; ++i)
3137     {
3138         struct d3d10_effect_variable *a = &This->annotations[i];
3139         if (!strcmp(a->name, name))
3140         {
3141             TRACE("Returning annotation %p\n", a);
3142             return &a->ID3D10EffectVariable_iface;
3143         }
3144     }
3145
3146     WARN("Invalid name specified\n");
3147
3148     return &null_variable.ID3D10EffectVariable_iface;
3149 }
3150
3151 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3152         ID3D10EffectVariable *iface, UINT index)
3153 {
3154     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3155     struct d3d10_effect_variable *m;
3156
3157     TRACE("iface %p, index %u\n", iface, index);
3158
3159     if (index >= This->type->member_count)
3160     {
3161         WARN("Invalid index specified\n");
3162         return &null_variable.ID3D10EffectVariable_iface;
3163     }
3164
3165     m = &This->members[index];
3166
3167     TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3168
3169     return &m->ID3D10EffectVariable_iface;
3170 }
3171
3172 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3173         ID3D10EffectVariable *iface, LPCSTR name)
3174 {
3175     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3176     unsigned int i;
3177
3178     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3179
3180     if (!name)
3181     {
3182         WARN("Invalid name specified\n");
3183         return &null_variable.ID3D10EffectVariable_iface;
3184     }
3185
3186     for (i = 0; i < This->type->member_count; ++i)
3187     {
3188         struct d3d10_effect_variable *m = &This->members[i];
3189
3190         if (m->name)
3191         {
3192             if (!strcmp(m->name, name))
3193             {
3194                 TRACE("Returning member %p\n", m);
3195                 return &m->ID3D10EffectVariable_iface;
3196             }
3197         }
3198     }
3199
3200     WARN("Invalid name specified\n");
3201
3202     return &null_variable.ID3D10EffectVariable_iface;
3203 }
3204
3205 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3206         ID3D10EffectVariable *iface, LPCSTR semantic)
3207 {
3208     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3209     unsigned int i;
3210
3211     TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3212
3213     if (!semantic)
3214     {
3215         WARN("Invalid semantic specified\n");
3216         return &null_variable.ID3D10EffectVariable_iface;
3217     }
3218
3219     for (i = 0; i < This->type->member_count; ++i)
3220     {
3221         struct d3d10_effect_variable *m = &This->members[i];
3222
3223         if (m->semantic)
3224         {
3225             if (!strcmp(m->semantic, semantic))
3226             {
3227                 TRACE("Returning member %p\n", m);
3228                 return &m->ID3D10EffectVariable_iface;
3229             }
3230         }
3231     }
3232
3233     WARN("Invalid semantic specified\n");
3234
3235     return &null_variable.ID3D10EffectVariable_iface;
3236 }
3237
3238 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3239         ID3D10EffectVariable *iface, UINT index)
3240 {
3241     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3242     struct d3d10_effect_variable *v;
3243
3244     TRACE("iface %p, index %u\n", iface, index);
3245
3246     if (index >= This->type->element_count)
3247     {
3248         WARN("Invalid index specified\n");
3249         return &null_variable.ID3D10EffectVariable_iface;
3250     }
3251
3252     v = &This->elements[index];
3253
3254     TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3255
3256     return &v->ID3D10EffectVariable_iface;
3257 }
3258
3259 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3260         ID3D10EffectVariable *iface)
3261 {
3262     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3263
3264     TRACE("iface %p\n", iface);
3265
3266     return (ID3D10EffectConstantBuffer *)This->buffer;
3267 }
3268
3269 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3270         ID3D10EffectVariable *iface)
3271 {
3272     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3273
3274     TRACE("iface %p\n", iface);
3275
3276     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3277         return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3278
3279     return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3280 }
3281
3282 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3283         ID3D10EffectVariable *iface)
3284 {
3285     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3286
3287     TRACE("iface %p\n", iface);
3288
3289     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3290         return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3291
3292     return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3293 }
3294
3295 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3296         ID3D10EffectVariable *iface)
3297 {
3298     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3299
3300     TRACE("iface %p\n", iface);
3301
3302     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3303         return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3304
3305     return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3306 }
3307
3308 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3309         ID3D10EffectVariable *iface)
3310 {
3311     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3312
3313     TRACE("iface %p\n", iface);
3314
3315     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3316         return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3317
3318     return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3319 }
3320
3321 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3322         ID3D10EffectVariable *iface)
3323 {
3324     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3325
3326     TRACE("iface %p\n", iface);
3327
3328     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3329         return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3330
3331     return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3332 }
3333
3334 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3335         ID3D10EffectVariable *iface)
3336 {
3337     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3338
3339     TRACE("iface %p\n", iface);
3340
3341     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3342         return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3343
3344     return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3345 }
3346
3347 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3348         ID3D10EffectVariable *iface)
3349 {
3350     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3351
3352     TRACE("iface %p\n", iface);
3353
3354     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3355         return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3356
3357     return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3358 }
3359
3360 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3361         ID3D10EffectVariable *iface)
3362 {
3363     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3364
3365     TRACE("iface %p\n", iface);
3366
3367     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3368         return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3369
3370     return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3371 }
3372
3373 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3374         ID3D10EffectVariable *iface)
3375 {
3376     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3377
3378     TRACE("iface %p\n", iface);
3379
3380     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3381         return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3382
3383     return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3384 }
3385
3386 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3387 {
3388     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3389
3390     TRACE("iface %p\n", iface);
3391
3392     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3393         return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3394
3395     return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3396 }
3397
3398 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3399         ID3D10EffectVariable *iface)
3400 {
3401     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3402
3403     TRACE("iface %p\n", iface);
3404
3405     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3406         return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3407
3408     return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3409 }
3410
3411 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3412         ID3D10EffectVariable *iface)
3413 {
3414     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3415
3416     TRACE("iface %p\n", iface);
3417
3418     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3419         return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3420
3421     return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3422 }
3423
3424 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3425         ID3D10EffectVariable *iface)
3426 {
3427     struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3428
3429     TRACE("iface %p\n", iface);
3430
3431     if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3432         return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3433
3434     return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3435 }
3436
3437 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3438         void *data, UINT offset, UINT count)
3439 {
3440     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3441
3442     return E_NOTIMPL;
3443 }
3444
3445 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3446         void *data, UINT offset, UINT count)
3447 {
3448     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3449
3450     return E_NOTIMPL;
3451 }
3452
3453 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3454 {
3455     /* ID3D10EffectVariable methods */
3456     d3d10_effect_variable_IsValid,
3457     d3d10_effect_variable_GetType,
3458     d3d10_effect_variable_GetDesc,
3459     d3d10_effect_variable_GetAnnotationByIndex,
3460     d3d10_effect_variable_GetAnnotationByName,
3461     d3d10_effect_variable_GetMemberByIndex,
3462     d3d10_effect_variable_GetMemberByName,
3463     d3d10_effect_variable_GetMemberBySemantic,
3464     d3d10_effect_variable_GetElement,
3465     d3d10_effect_variable_GetParentConstantBuffer,
3466     d3d10_effect_variable_AsScalar,
3467     d3d10_effect_variable_AsVector,
3468     d3d10_effect_variable_AsMatrix,
3469     d3d10_effect_variable_AsString,
3470     d3d10_effect_variable_AsShaderResource,
3471     d3d10_effect_variable_AsRenderTargetView,
3472     d3d10_effect_variable_AsDepthStencilView,
3473     d3d10_effect_variable_AsConstantBuffer,
3474     d3d10_effect_variable_AsShader,
3475     d3d10_effect_variable_AsBlend,
3476     d3d10_effect_variable_AsDepthStencil,
3477     d3d10_effect_variable_AsRasterizer,
3478     d3d10_effect_variable_AsSampler,
3479     d3d10_effect_variable_SetRawValue,
3480     d3d10_effect_variable_GetRawValue,
3481 };
3482
3483 /* ID3D10EffectVariable methods */
3484 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3485 {
3486     TRACE("iface %p\n", iface);
3487
3488     return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3489 }
3490
3491 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3492 {
3493     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3494 }
3495
3496 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3497         D3D10_EFFECT_VARIABLE_DESC *desc)
3498 {
3499     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3500 }
3501
3502 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3503         ID3D10EffectConstantBuffer *iface, UINT index)
3504 {
3505     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3506 }
3507
3508 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3509         ID3D10EffectConstantBuffer *iface, LPCSTR name)
3510 {
3511     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3512 }
3513
3514 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3515         ID3D10EffectConstantBuffer *iface, UINT index)
3516 {
3517     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3518 }
3519
3520 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3521         ID3D10EffectConstantBuffer *iface, LPCSTR name)
3522 {
3523     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3524 }
3525
3526 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3527         ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
3528 {
3529     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3530 }
3531
3532 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3533         ID3D10EffectConstantBuffer *iface, UINT index)
3534 {
3535     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3536 }
3537
3538 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3539         ID3D10EffectConstantBuffer *iface)
3540 {
3541     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3542 }
3543
3544 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3545         ID3D10EffectConstantBuffer *iface)
3546 {
3547     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3548 }
3549
3550 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3551         ID3D10EffectConstantBuffer *iface)
3552 {
3553     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3554 }
3555
3556 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3557         ID3D10EffectConstantBuffer *iface)
3558 {
3559     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3560 }
3561
3562 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3563         ID3D10EffectConstantBuffer *iface)
3564 {
3565     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3566 }
3567
3568 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3569         ID3D10EffectConstantBuffer *iface)
3570 {
3571     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3572 }
3573
3574 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3575         ID3D10EffectConstantBuffer *iface)
3576 {
3577     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3578 }
3579
3580 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3581         ID3D10EffectConstantBuffer *iface)
3582 {
3583     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3584 }
3585
3586 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3587         ID3D10EffectConstantBuffer *iface)
3588 {
3589     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3590 }
3591
3592 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3593         ID3D10EffectConstantBuffer *iface)
3594 {
3595     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3596 }
3597
3598 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3599 {
3600     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3601 }
3602
3603 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3604         ID3D10EffectConstantBuffer *iface)
3605 {
3606     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3607 }
3608
3609 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3610         ID3D10EffectConstantBuffer *iface)
3611 {
3612     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3613 }
3614
3615 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3616         ID3D10EffectConstantBuffer *iface)
3617 {
3618     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3619 }
3620
3621 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3622         void *data, UINT offset, UINT count)
3623 {
3624     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3625 }
3626
3627 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3628         void *data, UINT offset, UINT count)
3629 {
3630     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3631 }
3632
3633 /* ID3D10EffectConstantBuffer methods */
3634 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3635         ID3D10Buffer *buffer)
3636 {
3637     FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3638
3639     return E_NOTIMPL;
3640 }
3641
3642 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3643         ID3D10Buffer **buffer)
3644 {
3645     FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3646
3647     return E_NOTIMPL;
3648 }
3649
3650 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3651         ID3D10ShaderResourceView *view)
3652 {
3653     FIXME("iface %p, view %p stub!\n", iface, view);
3654
3655     return E_NOTIMPL;
3656 }
3657
3658 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3659         ID3D10ShaderResourceView **view)
3660 {
3661     FIXME("iface %p, view %p stub!\n", iface, view);
3662
3663     return E_NOTIMPL;
3664 }
3665
3666 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3667 {
3668     /* ID3D10EffectVariable methods */
3669     d3d10_effect_constant_buffer_IsValid,
3670     d3d10_effect_constant_buffer_GetType,
3671     d3d10_effect_constant_buffer_GetDesc,
3672     d3d10_effect_constant_buffer_GetAnnotationByIndex,
3673     d3d10_effect_constant_buffer_GetAnnotationByName,
3674     d3d10_effect_constant_buffer_GetMemberByIndex,
3675     d3d10_effect_constant_buffer_GetMemberByName,
3676     d3d10_effect_constant_buffer_GetMemberBySemantic,
3677     d3d10_effect_constant_buffer_GetElement,
3678     d3d10_effect_constant_buffer_GetParentConstantBuffer,
3679     d3d10_effect_constant_buffer_AsScalar,
3680     d3d10_effect_constant_buffer_AsVector,
3681     d3d10_effect_constant_buffer_AsMatrix,
3682     d3d10_effect_constant_buffer_AsString,
3683     d3d10_effect_constant_buffer_AsShaderResource,
3684     d3d10_effect_constant_buffer_AsRenderTargetView,
3685     d3d10_effect_constant_buffer_AsDepthStencilView,
3686     d3d10_effect_constant_buffer_AsConstantBuffer,
3687     d3d10_effect_constant_buffer_AsShader,
3688     d3d10_effect_constant_buffer_AsBlend,
3689     d3d10_effect_constant_buffer_AsDepthStencil,
3690     d3d10_effect_constant_buffer_AsRasterizer,
3691     d3d10_effect_constant_buffer_AsSampler,
3692     d3d10_effect_constant_buffer_SetRawValue,
3693     d3d10_effect_constant_buffer_GetRawValue,
3694     /* ID3D10EffectConstantBuffer methods */
3695     d3d10_effect_constant_buffer_SetConstantBuffer,
3696     d3d10_effect_constant_buffer_GetConstantBuffer,
3697     d3d10_effect_constant_buffer_SetTextureBuffer,
3698     d3d10_effect_constant_buffer_GetTextureBuffer,
3699 };
3700
3701 /* ID3D10EffectVariable methods */
3702
3703 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3704 {
3705     TRACE("iface %p\n", iface);
3706
3707     return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3708 }
3709
3710 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3711         ID3D10EffectScalarVariable *iface)
3712 {
3713     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3714 }
3715
3716 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3717         D3D10_EFFECT_VARIABLE_DESC *desc)
3718 {
3719     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3720 }
3721
3722 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3723         ID3D10EffectScalarVariable *iface, UINT index)
3724 {
3725     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3726 }
3727
3728 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3729         ID3D10EffectScalarVariable *iface, LPCSTR name)
3730 {
3731     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3732 }
3733
3734 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3735         ID3D10EffectScalarVariable *iface, UINT index)
3736 {
3737     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3738 }
3739
3740 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3741         ID3D10EffectScalarVariable *iface, LPCSTR name)
3742 {
3743     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3744 }
3745
3746 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3747         ID3D10EffectScalarVariable *iface, LPCSTR semantic)
3748 {
3749     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3750 }
3751
3752 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3753         ID3D10EffectScalarVariable *iface, UINT index)
3754 {
3755     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3756 }
3757
3758 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3759         ID3D10EffectScalarVariable *iface)
3760 {
3761     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3762 }
3763
3764 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3765         ID3D10EffectScalarVariable *iface)
3766 {
3767     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3768 }
3769
3770 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3771         ID3D10EffectScalarVariable *iface)
3772 {
3773     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3774 }
3775
3776 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3777         ID3D10EffectScalarVariable *iface)
3778 {
3779     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3780 }
3781
3782 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3783         ID3D10EffectScalarVariable *iface)
3784 {
3785     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3786 }
3787
3788 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3789         ID3D10EffectScalarVariable *iface)
3790 {
3791     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3792 }
3793
3794 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3795         ID3D10EffectScalarVariable *iface)
3796 {
3797     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3798 }
3799
3800 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3801         ID3D10EffectScalarVariable *iface)
3802 {
3803     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3804 }
3805
3806 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3807         ID3D10EffectScalarVariable *iface)
3808 {
3809     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3810 }
3811
3812 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3813         ID3D10EffectScalarVariable *iface)
3814 {
3815     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3816 }
3817
3818 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3819         ID3D10EffectScalarVariable *iface)
3820 {
3821     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3822 }
3823
3824 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3825         ID3D10EffectScalarVariable *iface)
3826 {
3827     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3828 }
3829
3830 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3831         ID3D10EffectScalarVariable *iface)
3832 {
3833     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3834 }
3835
3836 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3837         ID3D10EffectScalarVariable *iface)
3838 {
3839     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3840 }
3841
3842 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3843         void *data, UINT offset, UINT count)
3844 {
3845     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3846 }
3847
3848 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3849         void *data, UINT offset, UINT count)
3850 {
3851     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3852 }
3853
3854 /* ID3D10EffectScalarVariable methods */
3855
3856 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3857         float value)
3858 {
3859     FIXME("iface %p, value %.8e stub!\n", iface, value);
3860
3861     return E_NOTIMPL;
3862 }
3863
3864 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3865         float *value)
3866 {
3867     FIXME("iface %p, value %p stub!\n", iface, value);
3868
3869     return E_NOTIMPL;
3870 }
3871
3872 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3873         float *values, UINT offset, UINT count)
3874 {
3875     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3876
3877     return E_NOTIMPL;
3878 }
3879
3880 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
3881         float *values, UINT offset, UINT count)
3882 {
3883     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3884
3885     return E_NOTIMPL;
3886 }
3887
3888 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
3889         int value)
3890 {
3891     FIXME("iface %p, value %d stub!\n", iface, value);
3892
3893     return E_NOTIMPL;
3894 }
3895
3896 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3897         int *value)
3898 {
3899     FIXME("iface %p, value %p stub!\n", iface, value);
3900
3901     return E_NOTIMPL;
3902 }
3903
3904 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3905         int *values, UINT offset, UINT count)
3906 {
3907     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3908
3909     return E_NOTIMPL;
3910 }
3911
3912 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3913         int *values, UINT offset, UINT count)
3914 {
3915     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3916
3917     return E_NOTIMPL;
3918 }
3919
3920 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3921         BOOL value)
3922 {
3923     FIXME("iface %p, value %d stub!\n", iface, value);
3924
3925     return E_NOTIMPL;
3926 }
3927
3928 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3929         BOOL *value)
3930 {
3931     FIXME("iface %p, value %p stub!\n", iface, value);
3932
3933     return E_NOTIMPL;
3934 }
3935
3936 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
3937         BOOL *values, UINT offset, UINT count)
3938 {
3939     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3940
3941     return E_NOTIMPL;
3942 }
3943
3944 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
3945         BOOL *values, UINT offset, UINT count)
3946 {
3947     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3948
3949     return E_NOTIMPL;
3950 }
3951
3952 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
3953 {
3954     /* ID3D10EffectVariable methods */
3955     d3d10_effect_scalar_variable_IsValid,
3956     d3d10_effect_scalar_variable_GetType,
3957     d3d10_effect_scalar_variable_GetDesc,
3958     d3d10_effect_scalar_variable_GetAnnotationByIndex,
3959     d3d10_effect_scalar_variable_GetAnnotationByName,
3960     d3d10_effect_scalar_variable_GetMemberByIndex,
3961     d3d10_effect_scalar_variable_GetMemberByName,
3962     d3d10_effect_scalar_variable_GetMemberBySemantic,
3963     d3d10_effect_scalar_variable_GetElement,
3964     d3d10_effect_scalar_variable_GetParentConstantBuffer,
3965     d3d10_effect_scalar_variable_AsScalar,
3966     d3d10_effect_scalar_variable_AsVector,
3967     d3d10_effect_scalar_variable_AsMatrix,
3968     d3d10_effect_scalar_variable_AsString,
3969     d3d10_effect_scalar_variable_AsShaderResource,
3970     d3d10_effect_scalar_variable_AsRenderTargetView,
3971     d3d10_effect_scalar_variable_AsDepthStencilView,
3972     d3d10_effect_scalar_variable_AsConstantBuffer,
3973     d3d10_effect_scalar_variable_AsShader,
3974     d3d10_effect_scalar_variable_AsBlend,
3975     d3d10_effect_scalar_variable_AsDepthStencil,
3976     d3d10_effect_scalar_variable_AsRasterizer,
3977     d3d10_effect_scalar_variable_AsSampler,
3978     d3d10_effect_scalar_variable_SetRawValue,
3979     d3d10_effect_scalar_variable_GetRawValue,
3980     /* ID3D10EffectScalarVariable methods */
3981     d3d10_effect_scalar_variable_SetFloat,
3982     d3d10_effect_scalar_variable_GetFloat,
3983     d3d10_effect_scalar_variable_SetFloatArray,
3984     d3d10_effect_scalar_variable_GetFloatArray,
3985     d3d10_effect_scalar_variable_SetInt,
3986     d3d10_effect_scalar_variable_GetInt,
3987     d3d10_effect_scalar_variable_SetIntArray,
3988     d3d10_effect_scalar_variable_GetIntArray,
3989     d3d10_effect_scalar_variable_SetBool,
3990     d3d10_effect_scalar_variable_GetBool,
3991     d3d10_effect_scalar_variable_SetBoolArray,
3992     d3d10_effect_scalar_variable_GetBoolArray,
3993 };
3994
3995 /* ID3D10EffectVariable methods */
3996
3997 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
3998 {
3999     TRACE("iface %p\n", iface);
4000
4001     return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4002 }
4003
4004 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4005         ID3D10EffectVectorVariable *iface)
4006 {
4007     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4008 }
4009
4010 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4011         D3D10_EFFECT_VARIABLE_DESC *desc)
4012 {
4013     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4014 }
4015
4016 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4017         ID3D10EffectVectorVariable *iface, UINT index)
4018 {
4019     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4020 }
4021
4022 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4023         ID3D10EffectVectorVariable *iface, LPCSTR name)
4024 {
4025     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4026 }
4027
4028 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4029         ID3D10EffectVectorVariable *iface, UINT index)
4030 {
4031     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4032 }
4033
4034 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4035         ID3D10EffectVectorVariable *iface, LPCSTR name)
4036 {
4037     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4038 }
4039
4040 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4041         ID3D10EffectVectorVariable *iface, LPCSTR semantic)
4042 {
4043     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4044 }
4045
4046 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4047         ID3D10EffectVectorVariable *iface, UINT index)
4048 {
4049     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4050 }
4051
4052 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4053         ID3D10EffectVectorVariable *iface)
4054 {
4055     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4056 }
4057
4058 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4059         ID3D10EffectVectorVariable *iface)
4060 {
4061     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4062 }
4063
4064 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4065         ID3D10EffectVectorVariable *iface)
4066 {
4067     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4068 }
4069
4070 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4071         ID3D10EffectVectorVariable *iface)
4072 {
4073     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4074 }
4075
4076 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4077         ID3D10EffectVectorVariable *iface)
4078 {
4079     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4080 }
4081
4082 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4083         ID3D10EffectVectorVariable *iface)
4084 {
4085     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4086 }
4087
4088 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4089         ID3D10EffectVectorVariable *iface)
4090 {
4091     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4092 }
4093
4094 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4095         ID3D10EffectVectorVariable *iface)
4096 {
4097     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4098 }
4099
4100 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4101         ID3D10EffectVectorVariable *iface)
4102 {
4103     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4104 }
4105
4106 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4107         ID3D10EffectVectorVariable *iface)
4108 {
4109     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4110 }
4111
4112 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4113         ID3D10EffectVectorVariable *iface)
4114 {
4115     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4116 }
4117
4118 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4119         ID3D10EffectVectorVariable *iface)
4120 {
4121     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4122 }
4123
4124 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4125         ID3D10EffectVectorVariable *iface)
4126 {
4127     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4128 }
4129
4130 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4131         ID3D10EffectVectorVariable *iface)
4132 {
4133     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4134 }
4135
4136 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4137         void *data, UINT offset, UINT count)
4138 {
4139     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4140 }
4141
4142 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4143         void *data, UINT offset, UINT count)
4144 {
4145     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4146 }
4147
4148 /* ID3D10EffectVectorVariable methods */
4149
4150 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4151         BOOL *value)
4152 {
4153     FIXME("iface %p, value %p stub!\n", iface, value);
4154
4155     return E_NOTIMPL;
4156 }
4157
4158 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4159         int *value)
4160 {
4161     FIXME("iface %p, value %p stub!\n", iface, value);
4162
4163     return E_NOTIMPL;
4164 }
4165
4166 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4167         float *value)
4168 {
4169     FIXME("iface %p, value %p stub!\n", iface, value);
4170
4171     return E_NOTIMPL;
4172 }
4173
4174 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4175         BOOL *value)
4176 {
4177     FIXME("iface %p, value %p stub!\n", iface, value);
4178
4179     return E_NOTIMPL;
4180 }
4181
4182 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4183         int *value)
4184 {
4185     FIXME("iface %p, value %p stub!\n", iface, value);
4186
4187     return E_NOTIMPL;
4188 }
4189
4190 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4191         float *value)
4192 {
4193     FIXME("iface %p, value %p stub!\n", iface, value);
4194
4195     return E_NOTIMPL;
4196 }
4197
4198 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4199         BOOL *values, UINT offset, UINT count)
4200 {
4201     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4202
4203     return E_NOTIMPL;
4204 }
4205
4206 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4207         int *values, UINT offset, UINT count)
4208 {
4209     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4210
4211     return E_NOTIMPL;
4212 }
4213
4214 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4215         float *values, UINT offset, UINT count)
4216 {
4217     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4218
4219     return E_NOTIMPL;
4220 }
4221
4222 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4223         BOOL *values, UINT offset, UINT count)
4224 {
4225     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4226
4227     return E_NOTIMPL;
4228 }
4229
4230 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4231         int *values, UINT offset, UINT count)
4232 {
4233     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4234
4235     return E_NOTIMPL;
4236 }
4237
4238 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4239         float *values, UINT offset, UINT count)
4240 {
4241     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4242
4243     return E_NOTIMPL;
4244 }
4245
4246 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4247 {
4248     /* ID3D10EffectVariable methods */
4249     d3d10_effect_vector_variable_IsValid,
4250     d3d10_effect_vector_variable_GetType,
4251     d3d10_effect_vector_variable_GetDesc,
4252     d3d10_effect_vector_variable_GetAnnotationByIndex,
4253     d3d10_effect_vector_variable_GetAnnotationByName,
4254     d3d10_effect_vector_variable_GetMemberByIndex,
4255     d3d10_effect_vector_variable_GetMemberByName,
4256     d3d10_effect_vector_variable_GetMemberBySemantic,
4257     d3d10_effect_vector_variable_GetElement,
4258     d3d10_effect_vector_variable_GetParentConstantBuffer,
4259     d3d10_effect_vector_variable_AsScalar,
4260     d3d10_effect_vector_variable_AsVector,
4261     d3d10_effect_vector_variable_AsMatrix,
4262     d3d10_effect_vector_variable_AsString,
4263     d3d10_effect_vector_variable_AsShaderResource,
4264     d3d10_effect_vector_variable_AsRenderTargetView,
4265     d3d10_effect_vector_variable_AsDepthStencilView,
4266     d3d10_effect_vector_variable_AsConstantBuffer,
4267     d3d10_effect_vector_variable_AsShader,
4268     d3d10_effect_vector_variable_AsBlend,
4269     d3d10_effect_vector_variable_AsDepthStencil,
4270     d3d10_effect_vector_variable_AsRasterizer,
4271     d3d10_effect_vector_variable_AsSampler,
4272     d3d10_effect_vector_variable_SetRawValue,
4273     d3d10_effect_vector_variable_GetRawValue,
4274     /* ID3D10EffectVectorVariable methods */
4275     d3d10_effect_vector_variable_SetBoolVector,
4276     d3d10_effect_vector_variable_SetIntVector,
4277     d3d10_effect_vector_variable_SetFloatVector,
4278     d3d10_effect_vector_variable_GetBoolVector,
4279     d3d10_effect_vector_variable_GetIntVector,
4280     d3d10_effect_vector_variable_GetFloatVector,
4281     d3d10_effect_vector_variable_SetBoolVectorArray,
4282     d3d10_effect_vector_variable_SetIntVectorArray,
4283     d3d10_effect_vector_variable_SetFloatVectorArray,
4284     d3d10_effect_vector_variable_GetBoolVectorArray,
4285     d3d10_effect_vector_variable_GetIntVectorArray,
4286     d3d10_effect_vector_variable_GetFloatVectorArray,
4287 };
4288
4289 /* ID3D10EffectVariable methods */
4290
4291 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4292 {
4293     TRACE("iface %p\n", iface);
4294
4295     return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4296 }
4297
4298 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4299         ID3D10EffectMatrixVariable *iface)
4300 {
4301     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4302 }
4303
4304 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4305         D3D10_EFFECT_VARIABLE_DESC *desc)
4306 {
4307     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4308 }
4309
4310 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4311         ID3D10EffectMatrixVariable *iface, UINT index)
4312 {
4313     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4314 }
4315
4316 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4317         ID3D10EffectMatrixVariable *iface, LPCSTR name)
4318 {
4319     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4320 }
4321
4322 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4323         ID3D10EffectMatrixVariable *iface, UINT index)
4324 {
4325     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4326 }
4327
4328 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4329         ID3D10EffectMatrixVariable *iface, LPCSTR name)
4330 {
4331     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4332 }
4333
4334 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4335         ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
4336 {
4337     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4338 }
4339
4340 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4341         ID3D10EffectMatrixVariable *iface, UINT index)
4342 {
4343     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4344 }
4345
4346 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4347         ID3D10EffectMatrixVariable *iface)
4348 {
4349     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4350 }
4351
4352 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4353         ID3D10EffectMatrixVariable *iface)
4354 {
4355     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4356 }
4357
4358 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4359         ID3D10EffectMatrixVariable *iface)
4360 {
4361     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4362 }
4363
4364 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4365         ID3D10EffectMatrixVariable *iface)
4366 {
4367     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4368 }
4369
4370 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4371         ID3D10EffectMatrixVariable *iface)
4372 {
4373     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4374 }
4375
4376 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4377         ID3D10EffectMatrixVariable *iface)
4378 {
4379     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4380 }
4381
4382 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4383         ID3D10EffectMatrixVariable *iface)
4384 {
4385     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4386 }
4387
4388 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4389         ID3D10EffectMatrixVariable *iface)
4390 {
4391     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4392 }
4393
4394 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4395         ID3D10EffectMatrixVariable *iface)
4396 {
4397     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4398 }
4399
4400 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4401         ID3D10EffectMatrixVariable *iface)
4402 {
4403     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4404 }
4405
4406 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4407         ID3D10EffectMatrixVariable *iface)
4408 {
4409     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4410 }
4411
4412 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4413         ID3D10EffectMatrixVariable *iface)
4414 {
4415     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4416 }
4417
4418 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4419         ID3D10EffectMatrixVariable *iface)
4420 {
4421     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4422 }
4423
4424 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4425         ID3D10EffectMatrixVariable *iface)
4426 {
4427     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4428 }
4429
4430 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4431         void *data, UINT offset, UINT count)
4432 {
4433     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4434 }
4435
4436 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4437         void *data, UINT offset, UINT count)
4438 {
4439     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4440 }
4441
4442 /* ID3D10EffectMatrixVariable methods */
4443
4444 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4445         float *data)
4446 {
4447     FIXME("iface %p, data %p stub!\n", iface, data);
4448
4449     return E_NOTIMPL;
4450 }
4451
4452 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4453         float *data)
4454 {
4455     FIXME("iface %p, data %p stub!\n", iface, data);
4456
4457     return E_NOTIMPL;
4458 }
4459
4460 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4461         float *data, UINT offset, UINT count)
4462 {
4463     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4464
4465     return E_NOTIMPL;
4466 }
4467
4468 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4469         float *data, UINT offset, UINT count)
4470 {
4471     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4472
4473     return E_NOTIMPL;
4474 }
4475
4476 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4477         float *data)
4478 {
4479     FIXME("iface %p, data %p stub!\n", iface, data);
4480
4481     return E_NOTIMPL;
4482 }
4483
4484 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4485         float *data)
4486 {
4487     FIXME("iface %p, data %p stub!\n", iface, data);
4488
4489     return E_NOTIMPL;
4490 }
4491
4492 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4493         float *data, UINT offset, UINT count)
4494 {
4495     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4496
4497     return E_NOTIMPL;
4498 }
4499
4500 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4501         float *data, UINT offset, UINT count)
4502 {
4503     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4504
4505     return E_NOTIMPL;
4506 }
4507
4508
4509 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4510 {
4511     /* ID3D10EffectVariable methods */
4512     d3d10_effect_matrix_variable_IsValid,
4513     d3d10_effect_matrix_variable_GetType,
4514     d3d10_effect_matrix_variable_GetDesc,
4515     d3d10_effect_matrix_variable_GetAnnotationByIndex,
4516     d3d10_effect_matrix_variable_GetAnnotationByName,
4517     d3d10_effect_matrix_variable_GetMemberByIndex,
4518     d3d10_effect_matrix_variable_GetMemberByName,
4519     d3d10_effect_matrix_variable_GetMemberBySemantic,
4520     d3d10_effect_matrix_variable_GetElement,
4521     d3d10_effect_matrix_variable_GetParentConstantBuffer,
4522     d3d10_effect_matrix_variable_AsScalar,
4523     d3d10_effect_matrix_variable_AsVector,
4524     d3d10_effect_matrix_variable_AsMatrix,
4525     d3d10_effect_matrix_variable_AsString,
4526     d3d10_effect_matrix_variable_AsShaderResource,
4527     d3d10_effect_matrix_variable_AsRenderTargetView,
4528     d3d10_effect_matrix_variable_AsDepthStencilView,
4529     d3d10_effect_matrix_variable_AsConstantBuffer,
4530     d3d10_effect_matrix_variable_AsShader,
4531     d3d10_effect_matrix_variable_AsBlend,
4532     d3d10_effect_matrix_variable_AsDepthStencil,
4533     d3d10_effect_matrix_variable_AsRasterizer,
4534     d3d10_effect_matrix_variable_AsSampler,
4535     d3d10_effect_matrix_variable_SetRawValue,
4536     d3d10_effect_matrix_variable_GetRawValue,
4537     /* ID3D10EffectMatrixVariable methods */
4538     d3d10_effect_matrix_variable_SetMatrix,
4539     d3d10_effect_matrix_variable_GetMatrix,
4540     d3d10_effect_matrix_variable_SetMatrixArray,
4541     d3d10_effect_matrix_variable_GetMatrixArray,
4542     d3d10_effect_matrix_variable_SetMatrixTranspose,
4543     d3d10_effect_matrix_variable_GetMatrixTranspose,
4544     d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4545     d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4546 };
4547
4548 /* ID3D10EffectVariable methods */
4549
4550 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4551 {
4552     TRACE("iface %p\n", iface);
4553
4554     return (struct d3d10_effect_variable *)iface != &null_string_variable;
4555 }
4556
4557 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4558         ID3D10EffectStringVariable *iface)
4559 {
4560     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4561 }
4562
4563 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4564         D3D10_EFFECT_VARIABLE_DESC *desc)
4565 {
4566     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4567 }
4568
4569 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4570         ID3D10EffectStringVariable *iface, UINT index)
4571 {
4572     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4573 }
4574
4575 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4576         ID3D10EffectStringVariable *iface, LPCSTR name)
4577 {
4578     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4579 }
4580
4581 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4582         ID3D10EffectStringVariable *iface, UINT index)
4583 {
4584     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4585 }
4586
4587 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4588         ID3D10EffectStringVariable *iface, LPCSTR name)
4589 {
4590     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4591 }
4592
4593 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4594         ID3D10EffectStringVariable *iface, LPCSTR semantic)
4595 {
4596     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4597 }
4598
4599 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4600         ID3D10EffectStringVariable *iface, UINT index)
4601 {
4602     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4603 }
4604
4605 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4606         ID3D10EffectStringVariable *iface)
4607 {
4608     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4609 }
4610
4611 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4612         ID3D10EffectStringVariable *iface)
4613 {
4614     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4615 }
4616
4617 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4618         ID3D10EffectStringVariable *iface)
4619 {
4620     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4621 }
4622
4623 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4624         ID3D10EffectStringVariable *iface)
4625 {
4626     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4627 }
4628
4629 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4630         ID3D10EffectStringVariable *iface)
4631 {
4632     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4633 }
4634
4635 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4636         ID3D10EffectStringVariable *iface)
4637 {
4638     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4639 }
4640
4641 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4642         ID3D10EffectStringVariable *iface)
4643 {
4644     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4645 }
4646
4647 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4648         ID3D10EffectStringVariable *iface)
4649 {
4650     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4651 }
4652
4653 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4654         ID3D10EffectStringVariable *iface)
4655 {
4656     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4657 }
4658
4659 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4660         ID3D10EffectStringVariable *iface)
4661 {
4662     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4663 }
4664
4665 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4666         ID3D10EffectStringVariable *iface)
4667 {
4668     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4669 }
4670
4671 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4672         ID3D10EffectStringVariable *iface)
4673 {
4674     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4675 }
4676
4677 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4678         ID3D10EffectStringVariable *iface)
4679 {
4680     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4681 }
4682
4683 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4684         ID3D10EffectStringVariable *iface)
4685 {
4686     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4687 }
4688
4689 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4690         void *data, UINT offset, UINT count)
4691 {
4692     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4693 }
4694
4695 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4696         void *data, UINT offset, UINT count)
4697 {
4698     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4699 }
4700
4701 /* ID3D10EffectStringVariable methods */
4702
4703 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4704         LPCSTR *str)
4705 {
4706     FIXME("iface %p, str %p stub!\n", iface, str);
4707
4708     return E_NOTIMPL;
4709 }
4710
4711 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4712         LPCSTR *strs, UINT offset, UINT count)
4713 {
4714     FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4715
4716     return E_NOTIMPL;
4717 }
4718
4719
4720 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4721 {
4722     /* ID3D10EffectVariable methods */
4723     d3d10_effect_string_variable_IsValid,
4724     d3d10_effect_string_variable_GetType,
4725     d3d10_effect_string_variable_GetDesc,
4726     d3d10_effect_string_variable_GetAnnotationByIndex,
4727     d3d10_effect_string_variable_GetAnnotationByName,
4728     d3d10_effect_string_variable_GetMemberByIndex,
4729     d3d10_effect_string_variable_GetMemberByName,
4730     d3d10_effect_string_variable_GetMemberBySemantic,
4731     d3d10_effect_string_variable_GetElement,
4732     d3d10_effect_string_variable_GetParentConstantBuffer,
4733     d3d10_effect_string_variable_AsScalar,
4734     d3d10_effect_string_variable_AsVector,
4735     d3d10_effect_string_variable_AsMatrix,
4736     d3d10_effect_string_variable_AsString,
4737     d3d10_effect_string_variable_AsShaderResource,
4738     d3d10_effect_string_variable_AsRenderTargetView,
4739     d3d10_effect_string_variable_AsDepthStencilView,
4740     d3d10_effect_string_variable_AsConstantBuffer,
4741     d3d10_effect_string_variable_AsShader,
4742     d3d10_effect_string_variable_AsBlend,
4743     d3d10_effect_string_variable_AsDepthStencil,
4744     d3d10_effect_string_variable_AsRasterizer,
4745     d3d10_effect_string_variable_AsSampler,
4746     d3d10_effect_string_variable_SetRawValue,
4747     d3d10_effect_string_variable_GetRawValue,
4748     /* ID3D10EffectStringVariable methods */
4749     d3d10_effect_string_variable_GetString,
4750     d3d10_effect_string_variable_GetStringArray,
4751 };
4752
4753 /* ID3D10EffectVariable methods */
4754
4755 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4756 {
4757     TRACE("iface %p\n", iface);
4758
4759     return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4760 }
4761
4762 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4763         ID3D10EffectShaderResourceVariable *iface)
4764 {
4765     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4766 }
4767
4768 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4769         ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4770 {
4771     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4772 }
4773
4774 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4775         ID3D10EffectShaderResourceVariable *iface, UINT index)
4776 {
4777     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4778 }
4779
4780 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4781         ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4782 {
4783     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4784 }
4785
4786 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4787         ID3D10EffectShaderResourceVariable *iface, UINT index)
4788 {
4789     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4790 }
4791
4792 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4793         ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4794 {
4795     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4796 }
4797
4798 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4799         ID3D10EffectShaderResourceVariable *iface, LPCSTR semantic)
4800 {
4801     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4802 }
4803
4804 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4805         ID3D10EffectShaderResourceVariable *iface, UINT index)
4806 {
4807     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4808 }
4809
4810 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4811         ID3D10EffectShaderResourceVariable *iface)
4812 {
4813     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4814 }
4815
4816 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4817         ID3D10EffectShaderResourceVariable *iface)
4818 {
4819     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4820 }
4821
4822 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4823         ID3D10EffectShaderResourceVariable *iface)
4824 {
4825     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4826 }
4827
4828 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4829         ID3D10EffectShaderResourceVariable *iface)
4830 {
4831     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4832 }
4833
4834 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4835         ID3D10EffectShaderResourceVariable *iface)
4836 {
4837     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4838 }
4839
4840 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4841         ID3D10EffectShaderResourceVariable *iface)
4842 {
4843     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4844 }
4845
4846 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4847         ID3D10EffectShaderResourceVariable *iface)
4848 {
4849     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4850 }
4851
4852 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4853         ID3D10EffectShaderResourceVariable *iface)
4854 {
4855     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4856 }
4857
4858 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
4859         ID3D10EffectShaderResourceVariable *iface)
4860 {
4861     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4862 }
4863
4864 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
4865         ID3D10EffectShaderResourceVariable *iface)
4866 {
4867     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4868 }
4869
4870 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
4871         ID3D10EffectShaderResourceVariable *iface)
4872 {
4873     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4874 }
4875
4876 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
4877         ID3D10EffectShaderResourceVariable *iface)
4878 {
4879     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4880 }
4881
4882 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
4883         ID3D10EffectShaderResourceVariable *iface)
4884 {
4885     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4886 }
4887
4888 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
4889         ID3D10EffectShaderResourceVariable *iface)
4890 {
4891     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4892 }
4893
4894 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
4895         ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4896 {
4897     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4898 }
4899
4900 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
4901         ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4902 {
4903     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4904 }
4905
4906 /* ID3D10EffectShaderResourceVariable methods */
4907
4908 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
4909         ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
4910 {
4911     FIXME("iface %p, resource %p stub!\n", iface, resource);
4912
4913     return E_NOTIMPL;
4914 }
4915
4916 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
4917         ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
4918 {
4919     FIXME("iface %p, resource %p stub!\n", iface, resource);
4920
4921     return E_NOTIMPL;
4922 }
4923
4924 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
4925         ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
4926 {
4927     FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
4928
4929     return E_NOTIMPL;
4930 }
4931
4932 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
4933         ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
4934 {
4935     FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
4936
4937     return E_NOTIMPL;
4938 }
4939
4940
4941 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
4942 {
4943     /* ID3D10EffectVariable methods */
4944     d3d10_effect_shader_resource_variable_IsValid,
4945     d3d10_effect_shader_resource_variable_GetType,
4946     d3d10_effect_shader_resource_variable_GetDesc,
4947     d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
4948     d3d10_effect_shader_resource_variable_GetAnnotationByName,
4949     d3d10_effect_shader_resource_variable_GetMemberByIndex,
4950     d3d10_effect_shader_resource_variable_GetMemberByName,
4951     d3d10_effect_shader_resource_variable_GetMemberBySemantic,
4952     d3d10_effect_shader_resource_variable_GetElement,
4953     d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
4954     d3d10_effect_shader_resource_variable_AsScalar,
4955     d3d10_effect_shader_resource_variable_AsVector,
4956     d3d10_effect_shader_resource_variable_AsMatrix,
4957     d3d10_effect_shader_resource_variable_AsString,
4958     d3d10_effect_shader_resource_variable_AsShaderResource,
4959     d3d10_effect_shader_resource_variable_AsRenderTargetView,
4960     d3d10_effect_shader_resource_variable_AsDepthStencilView,
4961     d3d10_effect_shader_resource_variable_AsConstantBuffer,
4962     d3d10_effect_shader_resource_variable_AsShader,
4963     d3d10_effect_shader_resource_variable_AsBlend,
4964     d3d10_effect_shader_resource_variable_AsDepthStencil,
4965     d3d10_effect_shader_resource_variable_AsRasterizer,
4966     d3d10_effect_shader_resource_variable_AsSampler,
4967     d3d10_effect_shader_resource_variable_SetRawValue,
4968     d3d10_effect_shader_resource_variable_GetRawValue,
4969     /* ID3D10EffectShaderResourceVariable methods */
4970     d3d10_effect_shader_resource_variable_SetResource,
4971     d3d10_effect_shader_resource_variable_GetResource,
4972     d3d10_effect_shader_resource_variable_SetResourceArray,
4973     d3d10_effect_shader_resource_variable_GetResourceArray,
4974 };
4975
4976 /* ID3D10EffectVariable methods */
4977
4978 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
4979         ID3D10EffectRenderTargetViewVariable *iface)
4980 {
4981     TRACE("iface %p\n", iface);
4982
4983     return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
4984 }
4985
4986 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
4987         ID3D10EffectRenderTargetViewVariable *iface)
4988 {
4989     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4990 }
4991
4992 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
4993         ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4994 {
4995     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4996 }
4997
4998 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
4999         ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5000 {
5001     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5002 }
5003
5004 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5005         ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5006 {
5007     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5008 }
5009
5010 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5011         ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5012 {
5013     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5014 }
5015
5016 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5017         ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5018 {
5019     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5020 }
5021
5022 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5023         ID3D10EffectRenderTargetViewVariable *iface, LPCSTR semantic)
5024 {
5025     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5026 }
5027
5028 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5029         ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5030 {
5031     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5032 }
5033
5034 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5035         ID3D10EffectRenderTargetViewVariable *iface)
5036 {
5037     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5038 }
5039
5040 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5041         ID3D10EffectRenderTargetViewVariable *iface)
5042 {
5043     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5044 }
5045
5046 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5047         ID3D10EffectRenderTargetViewVariable *iface)
5048 {
5049     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5050 }
5051
5052 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5053         ID3D10EffectRenderTargetViewVariable *iface)
5054 {
5055     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5056 }
5057
5058 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5059         ID3D10EffectRenderTargetViewVariable *iface)
5060 {
5061     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5062 }
5063
5064 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5065         ID3D10EffectRenderTargetViewVariable *iface)
5066 {
5067     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5068 }
5069
5070 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5071         ID3D10EffectRenderTargetViewVariable *iface)
5072 {
5073     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5074 }
5075
5076 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5077         ID3D10EffectRenderTargetViewVariable *iface)
5078 {
5079     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5080 }
5081
5082 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5083         ID3D10EffectRenderTargetViewVariable *iface)
5084 {
5085     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5086 }
5087
5088 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5089         ID3D10EffectRenderTargetViewVariable *iface)
5090 {
5091     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5092 }
5093
5094 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5095         ID3D10EffectRenderTargetViewVariable *iface)
5096 {
5097     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5098 }
5099
5100 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5101         ID3D10EffectRenderTargetViewVariable *iface)
5102 {
5103     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5104 }
5105
5106 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5107         ID3D10EffectRenderTargetViewVariable *iface)
5108 {
5109     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5110 }
5111
5112 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5113         ID3D10EffectRenderTargetViewVariable *iface)
5114 {
5115     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5116 }
5117
5118 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5119         ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5120 {
5121     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5122 }
5123
5124 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5125         ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5126 {
5127     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5128 }
5129
5130 /* ID3D10EffectRenderTargetViewVariable methods */
5131
5132 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5133         ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5134 {
5135     FIXME("iface %p, view %p stub!\n", iface, view);
5136
5137     return E_NOTIMPL;
5138 }
5139
5140 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5141         ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5142 {
5143     FIXME("iface %p, view %p stub!\n", iface, view);
5144
5145     return E_NOTIMPL;
5146 }
5147
5148 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5149         ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5150 {
5151     FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5152
5153     return E_NOTIMPL;
5154 }
5155
5156 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5157         ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5158 {
5159     FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5160
5161     return E_NOTIMPL;
5162 }
5163
5164
5165 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5166 {
5167     /* ID3D10EffectVariable methods */
5168     d3d10_effect_render_target_view_variable_IsValid,
5169     d3d10_effect_render_target_view_variable_GetType,
5170     d3d10_effect_render_target_view_variable_GetDesc,
5171     d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5172     d3d10_effect_render_target_view_variable_GetAnnotationByName,
5173     d3d10_effect_render_target_view_variable_GetMemberByIndex,
5174     d3d10_effect_render_target_view_variable_GetMemberByName,
5175     d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5176     d3d10_effect_render_target_view_variable_GetElement,
5177     d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5178     d3d10_effect_render_target_view_variable_AsScalar,
5179     d3d10_effect_render_target_view_variable_AsVector,
5180     d3d10_effect_render_target_view_variable_AsMatrix,
5181     d3d10_effect_render_target_view_variable_AsString,
5182     d3d10_effect_render_target_view_variable_AsShaderResource,
5183     d3d10_effect_render_target_view_variable_AsRenderTargetView,
5184     d3d10_effect_render_target_view_variable_AsDepthStencilView,
5185     d3d10_effect_render_target_view_variable_AsConstantBuffer,
5186     d3d10_effect_render_target_view_variable_AsShader,
5187     d3d10_effect_render_target_view_variable_AsBlend,
5188     d3d10_effect_render_target_view_variable_AsDepthStencil,
5189     d3d10_effect_render_target_view_variable_AsRasterizer,
5190     d3d10_effect_render_target_view_variable_AsSampler,
5191     d3d10_effect_render_target_view_variable_SetRawValue,
5192     d3d10_effect_render_target_view_variable_GetRawValue,
5193     /* ID3D10EffectRenderTargetViewVariable methods */
5194     d3d10_effect_render_target_view_variable_SetRenderTarget,
5195     d3d10_effect_render_target_view_variable_GetRenderTarget,
5196     d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5197     d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5198 };
5199
5200 /* ID3D10EffectVariable methods */
5201
5202 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5203         ID3D10EffectDepthStencilViewVariable *iface)
5204 {
5205     TRACE("iface %p\n", iface);
5206
5207     return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5208 }
5209
5210 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5211         ID3D10EffectDepthStencilViewVariable *iface)
5212 {
5213     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5214 }
5215
5216 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5217         ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5218 {
5219     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5220 }
5221
5222 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5223         ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5224 {
5225     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5226 }
5227
5228 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5229         ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5230 {
5231     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5232 }
5233
5234 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5235         ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5236 {
5237     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5238 }
5239
5240 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5241         ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5242 {
5243     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5244 }
5245
5246 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5247         ID3D10EffectDepthStencilViewVariable *iface, LPCSTR semantic)
5248 {
5249     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5250 }
5251
5252 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5253         ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5254 {
5255     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5256 }
5257
5258 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5259         ID3D10EffectDepthStencilViewVariable *iface)
5260 {
5261     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5262 }
5263
5264 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5265         ID3D10EffectDepthStencilViewVariable *iface)
5266 {
5267     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5268 }
5269
5270 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5271         ID3D10EffectDepthStencilViewVariable *iface)
5272 {
5273     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5274 }
5275
5276 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5277         ID3D10EffectDepthStencilViewVariable *iface)
5278 {
5279     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5280 }
5281
5282 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5283         ID3D10EffectDepthStencilViewVariable *iface)
5284 {
5285     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5286 }
5287
5288 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5289         ID3D10EffectDepthStencilViewVariable *iface)
5290 {
5291     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5292 }
5293
5294 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5295         ID3D10EffectDepthStencilViewVariable *iface)
5296 {
5297     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5298 }
5299
5300 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5301         ID3D10EffectDepthStencilViewVariable *iface)
5302 {
5303     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5304 }
5305
5306 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5307         ID3D10EffectDepthStencilViewVariable *iface)
5308 {
5309     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5310 }
5311
5312 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5313         ID3D10EffectDepthStencilViewVariable *iface)
5314 {
5315     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5316 }
5317
5318 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5319         ID3D10EffectDepthStencilViewVariable *iface)
5320 {
5321     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5322 }
5323
5324 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5325         ID3D10EffectDepthStencilViewVariable *iface)
5326 {
5327     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5328 }
5329
5330 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5331         ID3D10EffectDepthStencilViewVariable *iface)
5332 {
5333     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5334 }
5335
5336 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5337         ID3D10EffectDepthStencilViewVariable *iface)
5338 {
5339     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5340 }
5341
5342 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5343         ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5344 {
5345     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5346 }
5347
5348 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5349         ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5350 {
5351     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5352 }
5353
5354 /* ID3D10EffectDepthStencilViewVariable methods */
5355
5356 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5357         ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5358 {
5359     FIXME("iface %p, view %p stub!\n", iface, view);
5360
5361     return E_NOTIMPL;
5362 }
5363
5364 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5365         ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5366 {
5367     FIXME("iface %p, view %p stub!\n", iface, view);
5368
5369     return E_NOTIMPL;
5370 }
5371
5372 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5373         ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5374 {
5375     FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5376
5377     return E_NOTIMPL;
5378 }
5379
5380 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5381         ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5382 {
5383     FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5384
5385     return E_NOTIMPL;
5386 }
5387
5388
5389 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5390 {
5391     /* ID3D10EffectVariable methods */
5392     d3d10_effect_depth_stencil_view_variable_IsValid,
5393     d3d10_effect_depth_stencil_view_variable_GetType,
5394     d3d10_effect_depth_stencil_view_variable_GetDesc,
5395     d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5396     d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5397     d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5398     d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5399     d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5400     d3d10_effect_depth_stencil_view_variable_GetElement,
5401     d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5402     d3d10_effect_depth_stencil_view_variable_AsScalar,
5403     d3d10_effect_depth_stencil_view_variable_AsVector,
5404     d3d10_effect_depth_stencil_view_variable_AsMatrix,
5405     d3d10_effect_depth_stencil_view_variable_AsString,
5406     d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5407     d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5408     d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5409     d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5410     d3d10_effect_depth_stencil_view_variable_AsShader,
5411     d3d10_effect_depth_stencil_view_variable_AsBlend,
5412     d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5413     d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5414     d3d10_effect_depth_stencil_view_variable_AsSampler,
5415     d3d10_effect_depth_stencil_view_variable_SetRawValue,
5416     d3d10_effect_depth_stencil_view_variable_GetRawValue,
5417     /* ID3D10EffectDepthStencilViewVariable methods */
5418     d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5419     d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5420     d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5421     d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5422 };
5423
5424 /* ID3D10EffectVariable methods */
5425
5426 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5427 {
5428     TRACE("iface %p\n", iface);
5429
5430     return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5431 }
5432
5433 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5434         ID3D10EffectShaderVariable *iface)
5435 {
5436     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5437 }
5438
5439 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5440         D3D10_EFFECT_VARIABLE_DESC *desc)
5441 {
5442     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5443 }
5444
5445 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5446         ID3D10EffectShaderVariable *iface, UINT index)
5447 {
5448     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5449 }
5450
5451 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5452         ID3D10EffectShaderVariable *iface, LPCSTR name)
5453 {
5454     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5455 }
5456
5457 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5458         ID3D10EffectShaderVariable *iface, UINT index)
5459 {
5460     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5461 }
5462
5463 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5464         ID3D10EffectShaderVariable *iface, LPCSTR name)
5465 {
5466     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5467 }
5468
5469 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5470         ID3D10EffectShaderVariable *iface, LPCSTR semantic)
5471 {
5472     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5473 }
5474
5475 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5476         ID3D10EffectShaderVariable *iface, UINT index)
5477 {
5478     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5479 }
5480
5481 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5482         ID3D10EffectShaderVariable *iface)
5483 {
5484     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5485 }
5486
5487 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5488         ID3D10EffectShaderVariable *iface)
5489 {
5490     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5491 }
5492
5493 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5494         ID3D10EffectShaderVariable *iface)
5495 {
5496     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5497 }
5498
5499 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5500         ID3D10EffectShaderVariable *iface)
5501 {
5502     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5503 }
5504
5505 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5506         ID3D10EffectShaderVariable *iface)
5507 {
5508     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5509 }
5510
5511 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5512         ID3D10EffectShaderVariable *iface)
5513 {
5514     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5515 }
5516
5517 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5518         ID3D10EffectShaderVariable *iface)
5519 {
5520     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5521 }
5522
5523 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5524         ID3D10EffectShaderVariable *iface)
5525 {
5526     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5527 }
5528
5529 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5530         ID3D10EffectShaderVariable *iface)
5531 {
5532     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5533 }
5534
5535 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5536         ID3D10EffectShaderVariable *iface)
5537 {
5538     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5539 }
5540
5541 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5542         ID3D10EffectShaderVariable *iface)
5543 {
5544     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5545 }
5546
5547 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5548         ID3D10EffectShaderVariable *iface)
5549 {
5550     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5551 }
5552
5553 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5554         ID3D10EffectShaderVariable *iface)
5555 {
5556     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5557 }
5558
5559 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5560         ID3D10EffectShaderVariable *iface)
5561 {
5562     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5563 }
5564
5565 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5566         ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5567 {
5568     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5569 }
5570
5571 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5572         ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5573 {
5574     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5575 }
5576
5577 /* ID3D10EffectShaderVariable methods */
5578
5579 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5580         ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5581 {
5582     FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5583
5584     return E_NOTIMPL;
5585 }
5586
5587 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5588         ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5589 {
5590     FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5591
5592     return E_NOTIMPL;
5593 }
5594
5595 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5596         ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5597 {
5598     FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5599
5600     return E_NOTIMPL;
5601 }
5602
5603 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5604         ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5605 {
5606     FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5607
5608     return E_NOTIMPL;
5609 }
5610
5611 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5612         ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5613         D3D10_SIGNATURE_PARAMETER_DESC *desc)
5614 {
5615     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5616     struct d3d10_effect_shader_variable *s;
5617     D3D10_SIGNATURE_PARAMETER_DESC *d;
5618
5619     TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5620             iface, shader_index, element_index, desc);
5621
5622     if (!iface->lpVtbl->IsValid(iface))
5623     {
5624         WARN("Null variable specified\n");
5625         return E_FAIL;
5626     }
5627
5628     /* Check shader_index, this crashes on W7/DX10 */
5629     if (shader_index >= This->effect->used_shader_count)
5630     {
5631         WARN("This should crash on W7/DX10!\n");
5632         return E_FAIL;
5633     }
5634
5635     s = This->effect->used_shaders[shader_index]->data;
5636     if (!s->input_signature.signature)
5637     {
5638         WARN("No shader signature\n");
5639         return D3DERR_INVALIDCALL;
5640     }
5641
5642     /* Check desc for NULL, this crashes on W7/DX10 */
5643     if (!desc)
5644     {
5645         WARN("This should crash on W7/DX10!\n");
5646         return E_FAIL;
5647     }
5648
5649     if (element_index >= s->input_signature.element_count)
5650     {
5651         WARN("Invalid element index specified\n");
5652         return E_INVALIDARG;
5653     }
5654
5655     d = &s->input_signature.elements[element_index];
5656     desc->SemanticName = d->SemanticName;
5657     desc->SemanticIndex  =  d->SemanticIndex;
5658     desc->SystemValueType =  d->SystemValueType;
5659     desc->ComponentType =  d->ComponentType;
5660     desc->Register =  d->Register;
5661     desc->ReadWriteMask  =  d->ReadWriteMask;
5662     desc->Mask =  d->Mask;
5663
5664     return S_OK;
5665 }
5666
5667 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5668         ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5669         D3D10_SIGNATURE_PARAMETER_DESC *desc)
5670 {
5671     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5672     struct d3d10_effect_shader_variable *s;
5673     D3D10_SIGNATURE_PARAMETER_DESC *d;
5674
5675     TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5676             iface, shader_index, element_index, desc);
5677
5678     if (!iface->lpVtbl->IsValid(iface))
5679     {
5680         WARN("Null variable specified\n");
5681         return E_FAIL;
5682     }
5683
5684     /* Check shader_index, this crashes on W7/DX10 */
5685     if (shader_index >= This->effect->used_shader_count)
5686     {
5687         WARN("This should crash on W7/DX10!\n");
5688         return E_FAIL;
5689     }
5690
5691     s = This->effect->used_shaders[shader_index]->data;
5692     if (!s->output_signature.signature)
5693     {
5694         WARN("No shader signature\n");
5695         return D3DERR_INVALIDCALL;
5696     }
5697
5698     /* Check desc for NULL, this crashes on W7/DX10 */
5699     if (!desc)
5700     {
5701         WARN("This should crash on W7/DX10!\n");
5702         return E_FAIL;
5703     }
5704
5705     if (element_index >= s->output_signature.element_count)
5706     {
5707         WARN("Invalid element index specified\n");
5708         return E_INVALIDARG;
5709     }
5710
5711     d = &s->output_signature.elements[element_index];
5712     desc->SemanticName = d->SemanticName;
5713     desc->SemanticIndex  =  d->SemanticIndex;
5714     desc->SystemValueType =  d->SystemValueType;
5715     desc->ComponentType =  d->ComponentType;
5716     desc->Register =  d->Register;
5717     desc->ReadWriteMask  =  d->ReadWriteMask;
5718     desc->Mask =  d->Mask;
5719
5720     return S_OK;
5721 }
5722
5723
5724 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5725 {
5726     /* ID3D10EffectVariable methods */
5727     d3d10_effect_shader_variable_IsValid,
5728     d3d10_effect_shader_variable_GetType,
5729     d3d10_effect_shader_variable_GetDesc,
5730     d3d10_effect_shader_variable_GetAnnotationByIndex,
5731     d3d10_effect_shader_variable_GetAnnotationByName,
5732     d3d10_effect_shader_variable_GetMemberByIndex,
5733     d3d10_effect_shader_variable_GetMemberByName,
5734     d3d10_effect_shader_variable_GetMemberBySemantic,
5735     d3d10_effect_shader_variable_GetElement,
5736     d3d10_effect_shader_variable_GetParentConstantBuffer,
5737     d3d10_effect_shader_variable_AsScalar,
5738     d3d10_effect_shader_variable_AsVector,
5739     d3d10_effect_shader_variable_AsMatrix,
5740     d3d10_effect_shader_variable_AsString,
5741     d3d10_effect_shader_variable_AsShaderResource,
5742     d3d10_effect_shader_variable_AsRenderTargetView,
5743     d3d10_effect_shader_variable_AsDepthStencilView,
5744     d3d10_effect_shader_variable_AsConstantBuffer,
5745     d3d10_effect_shader_variable_AsShader,
5746     d3d10_effect_shader_variable_AsBlend,
5747     d3d10_effect_shader_variable_AsDepthStencil,
5748     d3d10_effect_shader_variable_AsRasterizer,
5749     d3d10_effect_shader_variable_AsSampler,
5750     d3d10_effect_shader_variable_SetRawValue,
5751     d3d10_effect_shader_variable_GetRawValue,
5752     /* ID3D10EffectShaderVariable methods */
5753     d3d10_effect_shader_variable_GetShaderDesc,
5754     d3d10_effect_shader_variable_GetVertexShader,
5755     d3d10_effect_shader_variable_GetGeometryShader,
5756     d3d10_effect_shader_variable_GetPixelShader,
5757     d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5758     d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5759 };
5760
5761 /* ID3D10EffectVariable methods */
5762
5763 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5764 {
5765     TRACE("iface %p\n", iface);
5766
5767     return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5768 }
5769
5770 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5771         ID3D10EffectBlendVariable *iface)
5772 {
5773     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5774 }
5775
5776 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5777         D3D10_EFFECT_VARIABLE_DESC *desc)
5778 {
5779     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5780 }
5781
5782 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5783         ID3D10EffectBlendVariable *iface, UINT index)
5784 {
5785     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5786 }
5787
5788 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5789         ID3D10EffectBlendVariable *iface, LPCSTR name)
5790 {
5791     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5792 }
5793
5794 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5795         ID3D10EffectBlendVariable *iface, UINT index)
5796 {
5797     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5798 }
5799
5800 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5801         ID3D10EffectBlendVariable *iface, LPCSTR name)
5802 {
5803     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5804 }
5805
5806 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5807         ID3D10EffectBlendVariable *iface, LPCSTR semantic)
5808 {
5809     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5810 }
5811
5812 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5813         ID3D10EffectBlendVariable *iface, UINT index)
5814 {
5815     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5816 }
5817
5818 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
5819         ID3D10EffectBlendVariable *iface)
5820 {
5821     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5822 }
5823
5824 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
5825         ID3D10EffectBlendVariable *iface)
5826 {
5827     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5828 }
5829
5830 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
5831         ID3D10EffectBlendVariable *iface)
5832 {
5833     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5834 }
5835
5836 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
5837         ID3D10EffectBlendVariable *iface)
5838 {
5839     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5840 }
5841
5842 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
5843         ID3D10EffectBlendVariable *iface)
5844 {
5845     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5846 }
5847
5848 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
5849         ID3D10EffectBlendVariable *iface)
5850 {
5851     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5852 }
5853
5854 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
5855         ID3D10EffectBlendVariable *iface)
5856 {
5857     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5858 }
5859
5860 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
5861         ID3D10EffectBlendVariable *iface)
5862 {
5863     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5864 }
5865
5866 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
5867         ID3D10EffectBlendVariable *iface)
5868 {
5869     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5870 }
5871
5872 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
5873         ID3D10EffectBlendVariable *iface)
5874 {
5875     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5876 }
5877
5878 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
5879         ID3D10EffectBlendVariable *iface)
5880 {
5881     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5882 }
5883
5884 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
5885         ID3D10EffectBlendVariable *iface)
5886 {
5887     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5888 }
5889
5890 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
5891         ID3D10EffectBlendVariable *iface)
5892 {
5893     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5894 }
5895
5896 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
5897         ID3D10EffectBlendVariable *iface)
5898 {
5899     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5900 }
5901
5902 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
5903         void *data, UINT offset, UINT count)
5904 {
5905     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5906 }
5907
5908 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
5909         void *data, UINT offset, UINT count)
5910 {
5911     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5912 }
5913
5914 /* ID3D10EffectBlendVariable methods */
5915
5916 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
5917         UINT index, ID3D10BlendState **blend_state)
5918 {
5919     FIXME("iface %p, index %u, blend_state %p stub!\n", iface, index, blend_state);
5920
5921     return E_NOTIMPL;
5922 }
5923
5924 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
5925         UINT index, D3D10_BLEND_DESC *desc)
5926 {
5927     struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5928
5929     TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
5930
5931     if (index >= max(v->type->element_count, 1))
5932     {
5933         WARN("Invalid index %u.\n", index);
5934         return E_FAIL;
5935     }
5936
5937     *desc = ((D3D10_BLEND_DESC *)v->data)[index];
5938
5939     return S_OK;
5940 }
5941
5942
5943 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
5944 {
5945     /* ID3D10EffectVariable methods */
5946     d3d10_effect_blend_variable_IsValid,
5947     d3d10_effect_blend_variable_GetType,
5948     d3d10_effect_blend_variable_GetDesc,
5949     d3d10_effect_blend_variable_GetAnnotationByIndex,
5950     d3d10_effect_blend_variable_GetAnnotationByName,
5951     d3d10_effect_blend_variable_GetMemberByIndex,
5952     d3d10_effect_blend_variable_GetMemberByName,
5953     d3d10_effect_blend_variable_GetMemberBySemantic,
5954     d3d10_effect_blend_variable_GetElement,
5955     d3d10_effect_blend_variable_GetParentConstantBuffer,
5956     d3d10_effect_blend_variable_AsScalar,
5957     d3d10_effect_blend_variable_AsVector,
5958     d3d10_effect_blend_variable_AsMatrix,
5959     d3d10_effect_blend_variable_AsString,
5960     d3d10_effect_blend_variable_AsShaderResource,
5961     d3d10_effect_blend_variable_AsRenderTargetView,
5962     d3d10_effect_blend_variable_AsDepthStencilView,
5963     d3d10_effect_blend_variable_AsConstantBuffer,
5964     d3d10_effect_blend_variable_AsShader,
5965     d3d10_effect_blend_variable_AsBlend,
5966     d3d10_effect_blend_variable_AsDepthStencil,
5967     d3d10_effect_blend_variable_AsRasterizer,
5968     d3d10_effect_blend_variable_AsSampler,
5969     d3d10_effect_blend_variable_SetRawValue,
5970     d3d10_effect_blend_variable_GetRawValue,
5971     /* ID3D10EffectBlendVariable methods */
5972     d3d10_effect_blend_variable_GetBlendState,
5973     d3d10_effect_blend_variable_GetBackingStore,
5974 };
5975
5976 /* ID3D10EffectVariable methods */
5977
5978 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
5979 {
5980     TRACE("iface %p\n", iface);
5981
5982     return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
5983 }
5984
5985 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
5986         ID3D10EffectDepthStencilVariable *iface)
5987 {
5988     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5989 }
5990
5991 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
5992         D3D10_EFFECT_VARIABLE_DESC *desc)
5993 {
5994     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5995 }
5996
5997 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
5998         ID3D10EffectDepthStencilVariable *iface, UINT index)
5999 {
6000     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6001 }
6002
6003 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6004         ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6005 {
6006     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6007 }
6008
6009 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6010         ID3D10EffectDepthStencilVariable *iface, UINT index)
6011 {
6012     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6013 }
6014
6015 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6016         ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6017 {
6018     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6019 }
6020
6021 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6022         ID3D10EffectDepthStencilVariable *iface, LPCSTR semantic)
6023 {
6024     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6025 }
6026
6027 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6028         ID3D10EffectDepthStencilVariable *iface, UINT index)
6029 {
6030     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6031 }
6032
6033 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6034         ID3D10EffectDepthStencilVariable *iface)
6035 {
6036     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6037 }
6038
6039 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6040         ID3D10EffectDepthStencilVariable *iface)
6041 {
6042     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6043 }
6044
6045 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6046         ID3D10EffectDepthStencilVariable *iface)
6047 {
6048     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6049 }
6050
6051 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6052         ID3D10EffectDepthStencilVariable *iface)
6053 {
6054     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6055 }
6056
6057 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6058         ID3D10EffectDepthStencilVariable *iface)
6059 {
6060     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6061 }
6062
6063 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6064         ID3D10EffectDepthStencilVariable *iface)
6065 {
6066     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6067 }
6068
6069 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6070         ID3D10EffectDepthStencilVariable *iface)
6071 {
6072     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6073 }
6074
6075 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6076         ID3D10EffectDepthStencilVariable *iface)
6077 {
6078     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6079 }
6080
6081 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6082         ID3D10EffectDepthStencilVariable *iface)
6083 {
6084     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6085 }
6086
6087 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6088         ID3D10EffectDepthStencilVariable *iface)
6089 {
6090     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6091 }
6092
6093 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6094         ID3D10EffectDepthStencilVariable *iface)
6095 {
6096     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6097 }
6098
6099 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6100         ID3D10EffectDepthStencilVariable *iface)
6101 {
6102     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6103 }
6104
6105 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6106         ID3D10EffectDepthStencilVariable *iface)
6107 {
6108     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6109 }
6110
6111 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6112         ID3D10EffectDepthStencilVariable *iface)
6113 {
6114     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6115 }
6116
6117 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6118         void *data, UINT offset, UINT count)
6119 {
6120     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6121 }
6122
6123 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6124         void *data, UINT offset, UINT count)
6125 {
6126     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6127 }
6128
6129 /* ID3D10EffectDepthStencilVariable methods */
6130
6131 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6132         UINT index, ID3D10DepthStencilState **depth_stencil_state)
6133 {
6134     FIXME("iface %p, index %u, depth_stencil_state %p stub!\n", iface, index, depth_stencil_state);
6135
6136     return E_NOTIMPL;
6137 }
6138
6139 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6140         UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6141 {
6142     struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6143
6144     TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6145
6146     if (index >= max(v->type->element_count, 1))
6147     {
6148         WARN("Invalid index %u.\n", index);
6149         return E_FAIL;
6150     }
6151
6152     *desc = ((D3D10_DEPTH_STENCIL_DESC *)v->data)[index];
6153
6154     return S_OK;
6155 }
6156
6157
6158 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6159 {
6160     /* ID3D10EffectVariable methods */
6161     d3d10_effect_depth_stencil_variable_IsValid,
6162     d3d10_effect_depth_stencil_variable_GetType,
6163     d3d10_effect_depth_stencil_variable_GetDesc,
6164     d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6165     d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6166     d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6167     d3d10_effect_depth_stencil_variable_GetMemberByName,
6168     d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6169     d3d10_effect_depth_stencil_variable_GetElement,
6170     d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6171     d3d10_effect_depth_stencil_variable_AsScalar,
6172     d3d10_effect_depth_stencil_variable_AsVector,
6173     d3d10_effect_depth_stencil_variable_AsMatrix,
6174     d3d10_effect_depth_stencil_variable_AsString,
6175     d3d10_effect_depth_stencil_variable_AsShaderResource,
6176     d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6177     d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6178     d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6179     d3d10_effect_depth_stencil_variable_AsShader,
6180     d3d10_effect_depth_stencil_variable_AsBlend,
6181     d3d10_effect_depth_stencil_variable_AsDepthStencil,
6182     d3d10_effect_depth_stencil_variable_AsRasterizer,
6183     d3d10_effect_depth_stencil_variable_AsSampler,
6184     d3d10_effect_depth_stencil_variable_SetRawValue,
6185     d3d10_effect_depth_stencil_variable_GetRawValue,
6186     /* ID3D10EffectDepthStencilVariable methods */
6187     d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6188     d3d10_effect_depth_stencil_variable_GetBackingStore,
6189 };
6190
6191 /* ID3D10EffectVariable methods */
6192
6193 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6194 {
6195     TRACE("iface %p\n", iface);
6196
6197     return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6198 }
6199
6200 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6201         ID3D10EffectRasterizerVariable *iface)
6202 {
6203     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6204 }
6205
6206 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6207         D3D10_EFFECT_VARIABLE_DESC *desc)
6208 {
6209     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6210 }
6211
6212 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6213         ID3D10EffectRasterizerVariable *iface, UINT index)
6214 {
6215     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6216 }
6217
6218 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6219         ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6220 {
6221     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6222 }
6223
6224 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6225         ID3D10EffectRasterizerVariable *iface, UINT index)
6226 {
6227     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6228 }
6229
6230 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6231         ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6232 {
6233     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6234 }
6235
6236 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6237         ID3D10EffectRasterizerVariable *iface, LPCSTR semantic)
6238 {
6239     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6240 }
6241
6242 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6243         ID3D10EffectRasterizerVariable *iface, UINT index)
6244 {
6245     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6246 }
6247
6248 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6249         ID3D10EffectRasterizerVariable *iface)
6250 {
6251     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6252 }
6253
6254 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6255         ID3D10EffectRasterizerVariable *iface)
6256 {
6257     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6258 }
6259
6260 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6261         ID3D10EffectRasterizerVariable *iface)
6262 {
6263     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6264 }
6265
6266 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6267         ID3D10EffectRasterizerVariable *iface)
6268 {
6269     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6270 }
6271
6272 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6273         ID3D10EffectRasterizerVariable *iface)
6274 {
6275     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6276 }
6277
6278 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6279         ID3D10EffectRasterizerVariable *iface)
6280 {
6281     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6282 }
6283
6284 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6285         ID3D10EffectRasterizerVariable *iface)
6286 {
6287     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6288 }
6289
6290 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6291         ID3D10EffectRasterizerVariable *iface)
6292 {
6293     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6294 }
6295
6296 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6297         ID3D10EffectRasterizerVariable *iface)
6298 {
6299     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6300 }
6301
6302 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6303         ID3D10EffectRasterizerVariable *iface)
6304 {
6305     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6306 }
6307
6308 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6309         ID3D10EffectRasterizerVariable *iface)
6310 {
6311     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6312 }
6313
6314 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6315         ID3D10EffectRasterizerVariable *iface)
6316 {
6317     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6318 }
6319
6320 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6321         ID3D10EffectRasterizerVariable *iface)
6322 {
6323     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6324 }
6325
6326 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6327         ID3D10EffectRasterizerVariable *iface)
6328 {
6329     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6330 }
6331
6332 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6333         void *data, UINT offset, UINT count)
6334 {
6335     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6336 }
6337
6338 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6339         void *data, UINT offset, UINT count)
6340 {
6341     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6342 }
6343
6344 /* ID3D10EffectRasterizerVariable methods */
6345
6346 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6347         UINT index, ID3D10RasterizerState **rasterizer_state)
6348 {
6349     FIXME("iface %p, index %u, rasterizer_state %p stub!\n", iface, index, rasterizer_state);
6350
6351     return E_NOTIMPL;
6352 }
6353
6354 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6355         UINT index, D3D10_RASTERIZER_DESC *desc)
6356 {
6357     struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6358
6359     TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6360
6361     if (index >= max(v->type->element_count, 1))
6362     {
6363         WARN("Invalid index %u.\n", index);
6364         return E_FAIL;
6365     }
6366
6367     *desc = ((D3D10_RASTERIZER_DESC *)v->data)[index];
6368
6369     return S_OK;
6370 }
6371
6372
6373 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6374 {
6375     /* ID3D10EffectVariable methods */
6376     d3d10_effect_rasterizer_variable_IsValid,
6377     d3d10_effect_rasterizer_variable_GetType,
6378     d3d10_effect_rasterizer_variable_GetDesc,
6379     d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6380     d3d10_effect_rasterizer_variable_GetAnnotationByName,
6381     d3d10_effect_rasterizer_variable_GetMemberByIndex,
6382     d3d10_effect_rasterizer_variable_GetMemberByName,
6383     d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6384     d3d10_effect_rasterizer_variable_GetElement,
6385     d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6386     d3d10_effect_rasterizer_variable_AsScalar,
6387     d3d10_effect_rasterizer_variable_AsVector,
6388     d3d10_effect_rasterizer_variable_AsMatrix,
6389     d3d10_effect_rasterizer_variable_AsString,
6390     d3d10_effect_rasterizer_variable_AsShaderResource,
6391     d3d10_effect_rasterizer_variable_AsRenderTargetView,
6392     d3d10_effect_rasterizer_variable_AsDepthStencilView,
6393     d3d10_effect_rasterizer_variable_AsConstantBuffer,
6394     d3d10_effect_rasterizer_variable_AsShader,
6395     d3d10_effect_rasterizer_variable_AsBlend,
6396     d3d10_effect_rasterizer_variable_AsDepthStencil,
6397     d3d10_effect_rasterizer_variable_AsRasterizer,
6398     d3d10_effect_rasterizer_variable_AsSampler,
6399     d3d10_effect_rasterizer_variable_SetRawValue,
6400     d3d10_effect_rasterizer_variable_GetRawValue,
6401     /* ID3D10EffectRasterizerVariable methods */
6402     d3d10_effect_rasterizer_variable_GetRasterizerState,
6403     d3d10_effect_rasterizer_variable_GetBackingStore,
6404 };
6405
6406 /* ID3D10EffectVariable methods */
6407
6408 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6409 {
6410     TRACE("iface %p\n", iface);
6411
6412     return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6413 }
6414
6415 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6416         ID3D10EffectSamplerVariable *iface)
6417 {
6418     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6419 }
6420
6421 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6422         D3D10_EFFECT_VARIABLE_DESC *desc)
6423 {
6424     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6425 }
6426
6427 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6428         ID3D10EffectSamplerVariable *iface, UINT index)
6429 {
6430     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6431 }
6432
6433 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6434         ID3D10EffectSamplerVariable *iface, LPCSTR name)
6435 {
6436     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6437 }
6438
6439 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6440         ID3D10EffectSamplerVariable *iface, UINT index)
6441 {
6442     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6443 }
6444
6445 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6446         ID3D10EffectSamplerVariable *iface, LPCSTR name)
6447 {
6448     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6449 }
6450
6451 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6452         ID3D10EffectSamplerVariable *iface, LPCSTR semantic)
6453 {
6454     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6455 }
6456
6457 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6458         ID3D10EffectSamplerVariable *iface, UINT index)
6459 {
6460     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6461 }
6462
6463 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6464         ID3D10EffectSamplerVariable *iface)
6465 {
6466     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6467 }
6468
6469 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6470         ID3D10EffectSamplerVariable *iface)
6471 {
6472     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6473 }
6474
6475 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6476         ID3D10EffectSamplerVariable *iface)
6477 {
6478     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6479 }
6480
6481 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6482         ID3D10EffectSamplerVariable *iface)
6483 {
6484     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6485 }
6486
6487 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6488         ID3D10EffectSamplerVariable *iface)
6489 {
6490     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6491 }
6492
6493 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6494         ID3D10EffectSamplerVariable *iface)
6495 {
6496     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6497 }
6498
6499 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6500         ID3D10EffectSamplerVariable *iface)
6501 {
6502     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6503 }
6504
6505 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6506         ID3D10EffectSamplerVariable *iface)
6507 {
6508     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6509 }
6510
6511 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6512         ID3D10EffectSamplerVariable *iface)
6513 {
6514     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6515 }
6516
6517 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6518         ID3D10EffectSamplerVariable *iface)
6519 {
6520     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6521 }
6522
6523 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6524         ID3D10EffectSamplerVariable *iface)
6525 {
6526     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6527 }
6528
6529 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6530         ID3D10EffectSamplerVariable *iface)
6531 {
6532     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6533 }
6534
6535 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6536         ID3D10EffectSamplerVariable *iface)
6537 {
6538     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6539 }
6540
6541 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6542         ID3D10EffectSamplerVariable *iface)
6543 {
6544     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6545 }
6546
6547 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6548         void *data, UINT offset, UINT count)
6549 {
6550     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6551 }
6552
6553 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6554         void *data, UINT offset, UINT count)
6555 {
6556     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6557 }
6558
6559 /* ID3D10EffectSamplerVariable methods */
6560
6561 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6562         UINT index, ID3D10SamplerState **sampler)
6563 {
6564     FIXME("iface %p, index %u, sampler %p stub!\n", iface, index, sampler);
6565
6566     return E_NOTIMPL;
6567 }
6568
6569 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6570         UINT index, D3D10_SAMPLER_DESC *desc)
6571 {
6572     struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6573
6574     TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6575
6576     if (index >= max(v->type->element_count, 1))
6577     {
6578         WARN("Invalid index %u.\n", index);
6579         return E_FAIL;
6580     }
6581
6582     *desc = ((D3D10_SAMPLER_DESC *)v->data)[index];
6583
6584     return S_OK;
6585 }
6586
6587
6588 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6589 {
6590     /* ID3D10EffectVariable methods */
6591     d3d10_effect_sampler_variable_IsValid,
6592     d3d10_effect_sampler_variable_GetType,
6593     d3d10_effect_sampler_variable_GetDesc,
6594     d3d10_effect_sampler_variable_GetAnnotationByIndex,
6595     d3d10_effect_sampler_variable_GetAnnotationByName,
6596     d3d10_effect_sampler_variable_GetMemberByIndex,
6597     d3d10_effect_sampler_variable_GetMemberByName,
6598     d3d10_effect_sampler_variable_GetMemberBySemantic,
6599     d3d10_effect_sampler_variable_GetElement,
6600     d3d10_effect_sampler_variable_GetParentConstantBuffer,
6601     d3d10_effect_sampler_variable_AsScalar,
6602     d3d10_effect_sampler_variable_AsVector,
6603     d3d10_effect_sampler_variable_AsMatrix,
6604     d3d10_effect_sampler_variable_AsString,
6605     d3d10_effect_sampler_variable_AsShaderResource,
6606     d3d10_effect_sampler_variable_AsRenderTargetView,
6607     d3d10_effect_sampler_variable_AsDepthStencilView,
6608     d3d10_effect_sampler_variable_AsConstantBuffer,
6609     d3d10_effect_sampler_variable_AsShader,
6610     d3d10_effect_sampler_variable_AsBlend,
6611     d3d10_effect_sampler_variable_AsDepthStencil,
6612     d3d10_effect_sampler_variable_AsRasterizer,
6613     d3d10_effect_sampler_variable_AsSampler,
6614     d3d10_effect_sampler_variable_SetRawValue,
6615     d3d10_effect_sampler_variable_GetRawValue,
6616     /* ID3D10EffectSamplerVariable methods */
6617     d3d10_effect_sampler_variable_GetSampler,
6618     d3d10_effect_sampler_variable_GetBackingStore,
6619 };
6620
6621 /* ID3D10EffectType methods */
6622
6623 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6624 {
6625     return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6626 }
6627
6628 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6629 {
6630     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6631
6632     TRACE("iface %p\n", iface);
6633
6634     return This != &null_type;
6635 }
6636
6637 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6638 {
6639     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6640
6641     TRACE("iface %p, desc %p\n", iface, desc);
6642
6643     if (This == &null_type)
6644     {
6645         WARN("Null type specified\n");
6646         return E_FAIL;
6647     }
6648
6649     if (!desc)
6650     {
6651         WARN("Invalid argument specified\n");
6652         return E_INVALIDARG;
6653     }
6654
6655     desc->TypeName = This->name;
6656     desc->Class = This->type_class;
6657     desc->Type = This->basetype;
6658     desc->Elements = This->element_count;
6659     desc->Members = This->member_count;
6660     desc->Rows = This->row_count;
6661     desc->Columns = This->column_count;
6662     desc->PackedSize = This->size_packed;
6663     desc->UnpackedSize = This->size_unpacked;
6664     desc->Stride = This->stride;
6665
6666     return S_OK;
6667 }
6668
6669 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6670         UINT index)
6671 {
6672     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6673     struct d3d10_effect_type *t;
6674
6675     TRACE("iface %p, index %u\n", iface, index);
6676
6677     if (index >= This->member_count)
6678     {
6679         WARN("Invalid index specified\n");
6680         return &null_type.ID3D10EffectType_iface;
6681     }
6682
6683     t = (&This->members[index])->type;
6684
6685     TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6686
6687     return &t->ID3D10EffectType_iface;
6688 }
6689
6690 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6691         LPCSTR name)
6692 {
6693     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6694     unsigned int i;
6695
6696     TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6697
6698     if (!name)
6699     {
6700         WARN("Invalid name specified\n");
6701         return &null_type.ID3D10EffectType_iface;
6702     }
6703
6704     for (i = 0; i < This->member_count; ++i)
6705     {
6706         struct d3d10_effect_type_member *typem = &This->members[i];
6707
6708         if (typem->name)
6709         {
6710             if (!strcmp(typem->name, name))
6711             {
6712                 TRACE("Returning type %p.\n", typem->type);
6713                 return &typem->type->ID3D10EffectType_iface;
6714             }
6715         }
6716     }
6717
6718     WARN("Invalid name specified\n");
6719
6720     return &null_type.ID3D10EffectType_iface;
6721 }
6722
6723 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6724         LPCSTR semantic)
6725 {
6726     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6727     unsigned int i;
6728
6729     TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6730
6731     if (!semantic)
6732     {
6733         WARN("Invalid semantic specified\n");
6734         return &null_type.ID3D10EffectType_iface;
6735     }
6736
6737     for (i = 0; i < This->member_count; ++i)
6738     {
6739         struct d3d10_effect_type_member *typem = &This->members[i];
6740
6741         if (typem->semantic)
6742         {
6743             if (!strcmp(typem->semantic, semantic))
6744             {
6745                 TRACE("Returning type %p.\n", typem->type);
6746                 return &typem->type->ID3D10EffectType_iface;
6747             }
6748         }
6749     }
6750
6751     WARN("Invalid semantic specified\n");
6752
6753     return &null_type.ID3D10EffectType_iface;
6754 }
6755
6756 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
6757 {
6758     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6759     struct d3d10_effect_type_member *typem;
6760
6761     TRACE("iface %p, index %u\n", iface, index);
6762
6763     if (index >= This->member_count)
6764     {
6765         WARN("Invalid index specified\n");
6766         return NULL;
6767     }
6768
6769     typem = &This->members[index];
6770
6771     TRACE("Returning name %s\n", debugstr_a(typem->name));
6772
6773     return typem->name;
6774 }
6775
6776 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
6777 {
6778     struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6779     struct d3d10_effect_type_member *typem;
6780
6781     TRACE("iface %p, index %u\n", iface, index);
6782
6783     if (index >= This->member_count)
6784     {
6785         WARN("Invalid index specified\n");
6786         return NULL;
6787     }
6788
6789     typem = &This->members[index];
6790
6791     TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
6792
6793     return typem->semantic;
6794 }
6795
6796 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
6797 {
6798     /* ID3D10EffectType */
6799     d3d10_effect_type_IsValid,
6800     d3d10_effect_type_GetDesc,
6801     d3d10_effect_type_GetMemberTypeByIndex,
6802     d3d10_effect_type_GetMemberTypeByName,
6803     d3d10_effect_type_GetMemberTypeBySemantic,
6804     d3d10_effect_type_GetMemberName,
6805     d3d10_effect_type_GetMemberSemantic,
6806 };