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