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