~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/d3d10/effect.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2009 Henri Verbeet for CodeWeavers
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2.1 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with this library; if not, write to the Free Software
 16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 17  *
 18  */
 19 
 20 #include "config.h"
 21 #include "wine/port.h"
 22 
 23 #include "d3d10_private.h"
 24 
 25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
 26 
 27 #define MAKE_TAG(ch0, ch1, ch2, ch3) \
 28     ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
 29     ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
 30 #define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
 31 #define TAG_FX10 MAKE_TAG('F', 'X', '1', '')
 32 #define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
 33 
 34 #define D3D10_FX10_TYPE_COLUMN_SHIFT    11
 35 #define D3D10_FX10_TYPE_COLUMN_MASK     (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
 36 
 37 #define D3D10_FX10_TYPE_ROW_SHIFT       8
 38 #define D3D10_FX10_TYPE_ROW_MASK        (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
 39 
 40 #define D3D10_FX10_TYPE_BASETYPE_SHIFT  3
 41 #define D3D10_FX10_TYPE_BASETYPE_MASK   (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
 42 
 43 #define D3D10_FX10_TYPE_CLASS_SHIFT     0
 44 #define D3D10_FX10_TYPE_CLASS_MASK      (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
 45 
 46 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
 47 
 48 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
 49 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
 50 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
 51 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
 52 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
 53 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
 54 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
 55 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl;
 56 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl;
 57 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl;
 58 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl;
 59 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl;
 60 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
 61 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl;
 62 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl;
 63 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl;
 64 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
 65 
 66 /* null objects - needed for invalid calls */
 67 static struct d3d10_effect_technique null_technique =
 68         {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL, NULL};
 69 static struct d3d10_effect_pass null_pass =
 70         {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL, NULL};
 71 static struct d3d10_effect_type null_type =
 72         {&d3d10_effect_type_vtbl, 0, {NULL, NULL, 0}, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL};
 73 static struct d3d10_effect_variable null_local_buffer =
 74         {(ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl, &null_local_buffer,
 75         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 76 static struct d3d10_effect_variable null_variable =
 77         {&d3d10_effect_variable_vtbl, &null_local_buffer,
 78         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 79 static struct d3d10_effect_variable null_scalar_variable =
 80         {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, &null_local_buffer,
 81         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 82 static struct d3d10_effect_variable null_vector_variable =
 83         {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, &null_local_buffer,
 84         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 85 static struct d3d10_effect_variable null_matrix_variable =
 86         {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, &null_local_buffer,
 87         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 88 static struct d3d10_effect_variable null_string_variable =
 89         {(ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl, &null_local_buffer,
 90         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 91 static struct d3d10_effect_variable null_shader_resource_variable =
 92         {(ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl, &null_local_buffer,
 93         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 94 static struct d3d10_effect_variable null_render_target_view_variable =
 95         {(ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl, &null_local_buffer,
 96         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
 97 static struct d3d10_effect_variable null_depth_stencil_view_variable =
 98         {(ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl, &null_local_buffer,
 99         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
100 static struct d3d10_effect_variable null_shader_variable =
101         {(ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl, &null_local_buffer,
102         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
103 static struct d3d10_effect_variable null_blend_variable =
104         {(ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl, &null_local_buffer,
105         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
106 static struct d3d10_effect_variable null_depth_stencil_variable =
107         {(ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl, &null_local_buffer,
108         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
109 static struct d3d10_effect_variable null_rasterizer_variable =
110         {(ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl, &null_local_buffer,
111         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
112 static struct d3d10_effect_variable null_sampler_variable =
113         {(ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl, &null_local_buffer,
114         NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
115 
116 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
117 
118 static inline void read_dword(const char **ptr, DWORD *d)
119 {
120     memcpy(d, *ptr, sizeof(*d));
121     *ptr += sizeof(*d);
122 }
123 
124 static inline void skip_dword_unknown(const char **ptr, unsigned int count)
125 {
126     unsigned int i;
127     DWORD d;
128 
129     FIXME("Skipping %u unknown DWORDs:\n", count);
130     for (i = 0; i < count; ++i)
131     {
132         read_dword(ptr, &d);
133         FIXME("\t0x%08x\n", d);
134     }
135 }
136 
137 static inline void write_dword(char **ptr, DWORD d)
138 {
139     memcpy(*ptr, &d, sizeof(d));
140     *ptr += sizeof(d);
141 }
142 
143 static inline void write_dword_unknown(char **ptr, DWORD d)
144 {
145     FIXME("Writing unknown DWORD 0x%08x\n", d);
146     write_dword(ptr, d);
147 }
148 
149 static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
150         HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx)
151 {
152     const char *ptr = data;
153     HRESULT hr = S_OK;
154     DWORD chunk_count;
155     DWORD total_size;
156     unsigned int i;
157     DWORD tag;
158 
159     read_dword(&ptr, &tag);
160     TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
161 
162     if (tag != TAG_DXBC)
163     {
164         WARN("Wrong tag.\n");
165         return E_FAIL;
166     }
167 
168     /* checksum? */
169     skip_dword_unknown(&ptr, 4);
170 
171     skip_dword_unknown(&ptr, 1);
172 
173     read_dword(&ptr, &total_size);
174     TRACE("total size: %#x\n", total_size);
175 
176     read_dword(&ptr, &chunk_count);
177     TRACE("chunk count: %#x\n", chunk_count);
178 
179     for (i = 0; i < chunk_count; ++i)
180     {
181         DWORD chunk_tag, chunk_size;
182         const char *chunk_ptr;
183         DWORD chunk_offset;
184 
185         read_dword(&ptr, &chunk_offset);
186         TRACE("chunk %u at offset %#x\n", i, chunk_offset);
187 
188         chunk_ptr = data + chunk_offset;
189 
190         read_dword(&chunk_ptr, &chunk_tag);
191         read_dword(&chunk_ptr, &chunk_size);
192 
193         hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx);
194         if (FAILED(hr)) break;
195     }
196 
197     return hr;
198 }
199 
200 static BOOL copy_name(const char *ptr, char **name)
201 {
202     size_t name_len;
203 
204     if (!ptr) return TRUE;
205 
206     name_len = strlen(ptr) + 1;
207     if (name_len == 1)
208     {
209         return TRUE;
210     }
211 
212     *name = HeapAlloc(GetProcessHeap(), 0, name_len);
213     if (!*name)
214     {
215         ERR("Failed to allocate name memory.\n");
216         return FALSE;
217     }
218 
219     memcpy(*name, ptr, name_len);
220 
221     return TRUE;
222 }
223 
224 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
225 {
226     struct d3d10_effect_shader_variable *s = ctx;
227 
228     TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
229 
230     TRACE("chunk size: %#x\n", data_size);
231 
232     switch(tag)
233     {
234         case TAG_ISGN:
235         {
236             /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
237             UINT size = 44 + data_size;
238             char *ptr;
239 
240             s->input_signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
241             if (!s->input_signature)
242             {
243                 ERR("Failed to allocate input signature data\n");
244                 return E_OUTOFMEMORY;
245             }
246             s->input_signature_size = size;
247 
248             ptr = s->input_signature;
249 
250             write_dword(&ptr, TAG_DXBC);
251 
252             /* signature(?) */
253             write_dword_unknown(&ptr, 0);
254             write_dword_unknown(&ptr, 0);
255             write_dword_unknown(&ptr, 0);
256             write_dword_unknown(&ptr, 0);
257 
258             /* seems to be always 1 */
259             write_dword_unknown(&ptr, 1);
260 
261             /* DXBC size */
262             write_dword(&ptr, size);
263 
264             /* chunk count */
265             write_dword(&ptr, 1);
266 
267             /* chunk index */
268             write_dword(&ptr, (ptr - s->input_signature) + 4);
269 
270             /* chunk */
271             write_dword(&ptr, TAG_ISGN);
272             write_dword(&ptr, data_size);
273             memcpy(ptr, data, data_size);
274             break;
275         }
276 
277         default:
278             FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
279             break;
280     }
281 
282     return S_OK;
283 }
284 
285 static HRESULT parse_shader(struct d3d10_effect_object *o, const char *data)
286 {
287     ID3D10Device *device = o->pass->technique->effect->device;
288     struct d3d10_effect_shader_variable *s;
289     const char *ptr = data;
290     DWORD dxbc_size;
291     HRESULT hr;
292 
293     o->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3d10_effect_shader_variable));
294     if (!o->data)
295     {
296         ERR("Failed to allocate shader variable memory\n");
297         return E_OUTOFMEMORY;
298     }
299 
300     if (!ptr) return S_OK;
301 
302     s = o->data;
303 
304     read_dword(&ptr, &dxbc_size);
305     TRACE("dxbc size: %#x\n", dxbc_size);
306 
307     switch (o->type)
308     {
309         case D3D10_EOT_VERTEXSHADER:
310             hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
311             if (FAILED(hr)) return hr;
312             break;
313 
314         case D3D10_EOT_PIXELSHADER:
315             hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
316             if (FAILED(hr)) return hr;
317             break;
318         case D3D10_EOT_GEOMETRYSHADER:
319             hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
320             if (FAILED(hr)) return hr;
321             break;
322     }
323 
324     return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
325 }
326 
327 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
328 {
329     switch (c)
330     {
331         case 1: return D3D10_SVC_SCALAR;
332         case 2: return D3D10_SVC_VECTOR;
333         case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
334                 else return D3D10_SVC_MATRIX_ROWS;
335         default:
336             FIXME("Unknown variable class %#x.\n", c);
337             return 0;
338     }
339 }
340 
341 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
342 {
343     if(is_object)
344     {
345         switch (t)
346         {
347             case 1: return D3D10_SVT_STRING;
348             case 2: return D3D10_SVT_BLEND;
349             case 3: return D3D10_SVT_DEPTHSTENCIL;
350             case 4: return D3D10_SVT_RASTERIZER;
351             case 5: return D3D10_SVT_PIXELSHADER;
352             case 6: return D3D10_SVT_VERTEXSHADER;
353             case 7: return D3D10_SVT_GEOMETRYSHADER;
354 
355             case 10: return D3D10_SVT_TEXTURE1D;
356             case 11: return D3D10_SVT_TEXTURE1DARRAY;
357             case 12: return D3D10_SVT_TEXTURE2D;
358             case 13: return D3D10_SVT_TEXTURE2DARRAY;
359             case 14: return D3D10_SVT_TEXTURE2DMS;
360             case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
361             case 16: return D3D10_SVT_TEXTURE3D;
362             case 17: return D3D10_SVT_TEXTURECUBE;
363 
364             case 19: return D3D10_SVT_RENDERTARGETVIEW;
365             case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
366             case 21: return D3D10_SVT_SAMPLER;
367             default:
368                 FIXME("Unknown variable type %#x.\n", t);
369                 return 0;
370         }
371     }
372     else
373     {
374         switch (t)
375         {
376             case 1: return D3D10_SVT_FLOAT;
377             case 2: return D3D10_SVT_INT;
378             case 3: return D3D10_SVT_UINT;
379             case 4: return D3D10_SVT_BOOL;
380             default:
381                 FIXME("Unknown variable type %#x.\n", t);
382                 return 0;
383         }
384     }
385 }
386 
387 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
388 {
389     DWORD unknown0;
390     DWORD offset;
391     DWORD typeinfo;
392     unsigned int i;
393 
394     read_dword(&ptr, &offset);
395     TRACE("Type name at offset %#x.\n", offset);
396 
397     if (!copy_name(data + offset, &t->name))
398     {
399         ERR("Failed to copy name.\n");
400         return E_OUTOFMEMORY;
401     }
402     TRACE("Type name: %s.\n", debugstr_a(t->name));
403 
404     read_dword(&ptr, &unknown0);
405     TRACE("Unknown 0: %u.\n", unknown0);
406 
407     read_dword(&ptr, &t->element_count);
408     TRACE("Element count: %u.\n", t->element_count);
409 
410     read_dword(&ptr, &t->size_unpacked);
411     TRACE("Unpacked size: %#x.\n", t->size_unpacked);
412 
413     read_dword(&ptr, &t->stride);
414     TRACE("Stride: %#x.\n", t->stride);
415 
416     read_dword(&ptr, &t->size_packed);
417     TRACE("Packed size %#x.\n", t->size_packed);
418 
419     switch (unknown0)
420     {
421         case 1:
422             t->member_count = 0;
423 
424             read_dword(&ptr, &typeinfo);
425             t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
426             t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
427             t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
428             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);
429 
430             TRACE("Type description: %#x.\n", typeinfo);
431             TRACE("\tcolumns: %u.\n", t->column_count);
432             TRACE("\trows: %u.\n", t->row_count);
433             TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
434             TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
435             TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
436                     | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
437             break;
438 
439         case 2:
440             TRACE("Type is an object.\n");
441 
442             t->member_count = 0;
443             t->column_count = 0;
444             t->row_count = 0;
445             t->type_class = D3D10_SVC_OBJECT;
446 
447             read_dword(&ptr, &typeinfo);
448             t->basetype = d3d10_variable_type(typeinfo, TRUE);
449 
450             TRACE("Type description: %#x.\n", typeinfo);
451             TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
452             TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
453             break;
454 
455          case 3:
456             TRACE("Type is a structure.\n");
457 
458             read_dword(&ptr, &t->member_count);
459             TRACE("Member count: %u.\n", t->member_count);
460 
461             t->column_count = 0;
462             t->row_count = 0;
463             t->basetype = 0;
464             t->type_class = D3D10_SVC_STRUCT;
465 
466             t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
467             if (!t->members)
468             {
469                 ERR("Failed to allocate members memory.\n");
470                 return E_OUTOFMEMORY;
471             }
472 
473             for (i = 0; i < t->member_count; ++i)
474             {
475                 struct d3d10_effect_type_member *typem = &t->members[i];
476 
477                 read_dword(&ptr, &offset);
478                 TRACE("Member name at offset %#x.\n", offset);
479 
480                 if (!copy_name(data + offset, &typem->name))
481                 {
482                     ERR("Failed to copy name.\n");
483                     return E_OUTOFMEMORY;
484                 }
485                 TRACE("Member name: %s.\n", debugstr_a(typem->name));
486 
487                 read_dword(&ptr, &offset);
488                 TRACE("Member semantic at offset %#x.\n", offset);
489 
490                 if (!copy_name(data + offset, &typem->semantic))
491                 {
492                     ERR("Failed to copy semantic.\n");
493                     return E_OUTOFMEMORY;
494                 }
495                 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
496 
497                 read_dword(&ptr, &typem->buffer_offset);
498                 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
499 
500                 read_dword(&ptr, &offset);
501                 TRACE("Member type info at offset %#x.\n", offset);
502 
503                 typem->type = get_fx10_type(t->effect, data, offset);
504                 if (!typem->type)
505                 {
506                     ERR("Failed to get variable type.\n");
507                     return E_FAIL;
508                 }
509             }
510             break;
511 
512         default:
513             FIXME("Unhandled case %#x.\n", unknown0);
514             return E_FAIL;
515     }
516 
517     if (t->element_count)
518     {
519         TRACE("Elementtype for type at offset: %#x\n", t->id);
520 
521         /* allocate elementtype - we need only one, because all elements have the same type */
522         t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
523         if (!t->elementtype)
524         {
525             ERR("Failed to allocate members memory.\n");
526             return E_OUTOFMEMORY;
527         }
528 
529         /* create a copy of the original type with some minor changes */
530         t->elementtype->vtbl = &d3d10_effect_type_vtbl;
531         t->elementtype->effect = t->effect;
532 
533         if (!copy_name(t->name, &t->elementtype->name))
534         {
535              ERR("Failed to copy name.\n");
536              return E_OUTOFMEMORY;
537         }
538         TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
539 
540         t->elementtype->element_count = 0;
541         TRACE("\tElement count: %u.\n", t->elementtype->element_count);
542 
543         /*
544          * Not sure if this calculation is 100% correct, but a test
545          * show's that these values work.
546          */
547         t->elementtype->size_unpacked = t->size_packed / t->element_count;
548         TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
549 
550         t->elementtype->stride = t->stride;
551         TRACE("\tStride: %#x.\n", t->elementtype->stride);
552 
553         t->elementtype->size_packed = t->size_packed / t->element_count;
554         TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
555 
556         t->elementtype->member_count = t->member_count;
557         TRACE("\tMember count: %u.\n", t->elementtype->member_count);
558 
559         t->elementtype->column_count = t->column_count;
560         TRACE("\tColumns: %u.\n", t->elementtype->column_count);
561 
562         t->elementtype->row_count = t->row_count;
563         TRACE("\tRows: %u.\n", t->elementtype->row_count);
564 
565         t->elementtype->basetype = t->basetype;
566         TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
567 
568         t->elementtype->type_class = t->type_class;
569         TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
570 
571         t->elementtype->members = t->members;
572     }
573 
574     return S_OK;
575 }
576 
577 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
578 {
579     struct d3d10_effect_type *type;
580     struct wine_rb_entry *entry;
581     HRESULT hr;
582 
583     entry = wine_rb_get(&effect->types, &offset);
584     if (entry)
585     {
586         TRACE("Returning existing type.\n");
587         return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
588     }
589 
590     type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
591     if (!type)
592     {
593         ERR("Failed to allocate type memory.\n");
594         return NULL;
595     }
596 
597     type->vtbl = &d3d10_effect_type_vtbl;
598     type->id = offset;
599     type->effect = effect;
600     hr = parse_fx10_type(type, data + offset, data);
601     if (FAILED(hr))
602     {
603         ERR("Failed to parse type info, hr %#x.\n", hr);
604         HeapFree(GetProcessHeap(), 0, type);
605         return NULL;
606     }
607 
608     if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
609     {
610         ERR("Failed to insert type entry.\n");
611         HeapFree(GetProcessHeap(), 0, type);
612         return NULL;
613     }
614 
615     return type;
616 }
617 
618 static void set_variable_vtbl(struct d3d10_effect_variable *v)
619 {
620     switch (v->type->type_class)
621     {
622         case D3D10_SVC_SCALAR:
623             v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
624             break;
625 
626         case D3D10_SVC_VECTOR:
627             v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
628             break;
629 
630         case D3D10_SVC_MATRIX_ROWS:
631         case D3D10_SVC_MATRIX_COLUMNS:
632             v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
633             break;
634 
635         case D3D10_SVC_STRUCT:
636             v->vtbl = &d3d10_effect_variable_vtbl;
637             break;
638 
639         case D3D10_SVC_OBJECT:
640             switch(v->type->basetype)
641             {
642                 case D3D10_SVT_STRING:
643                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
644                     break;
645 
646                 case D3D10_SVT_TEXTURE1D:
647                 case D3D10_SVT_TEXTURE1DARRAY:
648                 case D3D10_SVT_TEXTURE2D:
649                 case D3D10_SVT_TEXTURE2DARRAY:
650                 case D3D10_SVT_TEXTURE2DMS:
651                 case D3D10_SVT_TEXTURE2DMSARRAY:
652                 case D3D10_SVT_TEXTURE3D:
653                 case D3D10_SVT_TEXTURECUBE:
654                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
655                     break;
656 
657                 case D3D10_SVT_RENDERTARGETVIEW:
658                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
659                     break;
660 
661                 case D3D10_SVT_DEPTHSTENCILVIEW:
662                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
663                     break;
664 
665                 case D3D10_SVT_DEPTHSTENCIL:
666                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
667                     break;
668 
669                 case D3D10_SVT_VERTEXSHADER:
670                 case D3D10_SVT_GEOMETRYSHADER:
671                 case D3D10_SVT_PIXELSHADER:
672                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
673                     break;
674 
675                 case D3D10_SVT_BLEND:
676                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
677                     break;
678 
679                 case D3D10_SVT_RASTERIZER:
680                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
681                     break;
682 
683                 case D3D10_SVT_SAMPLER:
684                     v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
685                     break;
686 
687                 default:
688                     FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
689                     v->vtbl = &d3d10_effect_variable_vtbl;
690                     break;
691             }
692             break;
693 
694         default:
695             FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
696             v->vtbl = &d3d10_effect_variable_vtbl;
697             break;
698     }
699 }
700 
701 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
702 {
703     unsigned int i;
704     HRESULT hr;
705 
706     if (v->type->member_count)
707     {
708         v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
709         if (!v->members)
710         {
711             ERR("Failed to allocate members memory.\n");
712             return E_OUTOFMEMORY;
713         }
714 
715         for (i = 0; i < v->type->member_count; ++i)
716         {
717             struct d3d10_effect_variable *var = &v->members[i];
718             struct d3d10_effect_type_member *typem = &v->type->members[i];
719 
720             var->buffer = v->buffer;
721             var->effect = v->effect;
722             var->type = typem->type;
723             set_variable_vtbl(var);
724 
725             if (!copy_name(typem->name, &var->name))
726             {
727                 ERR("Failed to copy name.\n");
728                 return E_OUTOFMEMORY;
729             }
730             TRACE("Variable name: %s.\n", debugstr_a(var->name));
731 
732             if (!copy_name(typem->semantic, &var->semantic))
733             {
734                 ERR("Failed to copy name.\n");
735                 return E_OUTOFMEMORY;
736             }
737             TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
738 
739             var->buffer_offset = v->buffer_offset + typem->buffer_offset;
740             TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
741 
742             hr = copy_variableinfo_from_type(var);
743             if (FAILED(hr)) return hr;
744         }
745     }
746 
747     if (v->type->element_count)
748     {
749         unsigned int bufferoffset = v->buffer_offset;
750 
751         v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
752         if (!v->elements)
753         {
754             ERR("Failed to allocate elements memory.\n");
755             return E_OUTOFMEMORY;
756         }
757 
758         for (i = 0; i < v->type->element_count; ++i)
759         {
760             struct d3d10_effect_variable *var = &v->elements[i];
761 
762             var->buffer = v->buffer;
763             var->effect = v->effect;
764             var->type = v->type->elementtype;
765             set_variable_vtbl(var);
766 
767             if (!copy_name(v->name, &var->name))
768             {
769                 ERR("Failed to copy name.\n");
770                 return E_OUTOFMEMORY;
771             }
772             TRACE("Variable name: %s.\n", debugstr_a(var->name));
773 
774             if (!copy_name(v->semantic, &var->semantic))
775             {
776                 ERR("Failed to copy name.\n");
777                 return E_OUTOFMEMORY;
778             }
779             TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
780 
781             if (i != 0)
782             {
783                 bufferoffset += v->type->stride;
784             }
785             var->buffer_offset = bufferoffset;
786             TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
787 
788             hr = copy_variableinfo_from_type(var);
789             if (FAILED(hr)) return hr;
790         }
791     }
792 
793     return S_OK;
794 }
795 
796 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
797 {
798     DWORD offset;
799 
800     read_dword(ptr, &offset);
801     TRACE("Variable name at offset %#x.\n", offset);
802 
803     if (!copy_name(data + offset, &v->name))
804     {
805         ERR("Failed to copy name.\n");
806         return E_OUTOFMEMORY;
807     }
808     TRACE("Variable name: %s.\n", debugstr_a(v->name));
809 
810     read_dword(ptr, &offset);
811     TRACE("Variable type info at offset %#x.\n", offset);
812 
813     v->type = get_fx10_type(v->effect, data, offset);
814     if (!v->type)
815     {
816         ERR("Failed to get variable type.\n");
817         return E_FAIL;
818     }
819     set_variable_vtbl(v);
820 
821     return copy_variableinfo_from_type(v);
822 }
823 
824 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
825 {
826     HRESULT hr;
827 
828     hr = parse_fx10_variable_head(a, ptr, data);
829     if (FAILED(hr)) return hr;
830 
831     skip_dword_unknown(ptr, 1);
832 
833     /* mark the variable as annotation */
834     a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
835 
836     return S_OK;
837 }
838 
839 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
840 {
841     const char *data_ptr;
842     DWORD offset;
843     HRESULT hr;
844 
845     read_dword(ptr, &o->type);
846     TRACE("Effect object is of type %#x.\n", o->type);
847 
848     skip_dword_unknown(ptr, 2);
849 
850     read_dword(ptr, &offset);
851     TRACE("Effect object idx is at offset %#x.\n", offset);
852 
853     data_ptr = data + offset;
854     read_dword(&data_ptr, &offset);
855 
856     TRACE("Effect object starts at offset %#x.\n", offset);
857 
858     /* FIXME: This probably isn't completely correct. */
859     if (offset == 1)
860     {
861         WARN("Skipping effect object.\n");
862         data_ptr = NULL;
863     }
864     else
865     {
866         data_ptr = data + offset;
867     }
868 
869     switch (o->type)
870     {
871         case D3D10_EOT_VERTEXSHADER:
872             TRACE("Vertex shader\n");
873             hr = parse_shader(o, data_ptr);
874             break;
875 
876         case D3D10_EOT_PIXELSHADER:
877             TRACE("Pixel shader\n");
878             hr = parse_shader(o, data_ptr);
879             break;
880 
881         case D3D10_EOT_GEOMETRYSHADER:
882             TRACE("Geometry shader\n");
883             hr = parse_shader(o, data_ptr);
884             break;
885 
886         default:
887             FIXME("Unhandled object type %#x\n", o->type);
888             hr = E_FAIL;
889             break;
890     }
891 
892     return hr;
893 }
894 
895 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
896 {
897     HRESULT hr = S_OK;
898     unsigned int i;
899     DWORD offset;
900 
901     read_dword(ptr, &offset);
902     TRACE("Pass name at offset %#x.\n", offset);
903 
904     if (!copy_name(data + offset, &p->name))
905     {
906         ERR("Failed to copy name.\n");
907         return E_OUTOFMEMORY;
908     }
909     TRACE("Pass name: %s.\n", debugstr_a(p->name));
910 
911     read_dword(ptr, &p->object_count);
912     TRACE("Pass has %u effect objects.\n", p->object_count);
913 
914     read_dword(ptr, &p->annotation_count);
915     TRACE("Pass has %u annotations.\n", p->annotation_count);
916 
917     p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
918     if (!p->annotations)
919     {
920         ERR("Failed to allocate pass annotations memory.\n");
921         return E_OUTOFMEMORY;
922     }
923 
924     for (i = 0; i < p->annotation_count; ++i)
925     {
926         struct d3d10_effect_variable *a = &p->annotations[i];
927 
928         a->effect = p->technique->effect;
929         a->buffer = &null_local_buffer;
930 
931         hr = parse_fx10_annotation(a, ptr, data);
932         if (FAILED(hr)) return hr;
933     }
934 
935     p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
936     if (!p->objects)
937     {
938         ERR("Failed to allocate effect objects memory.\n");
939         return E_OUTOFMEMORY;
940     }
941 
942     for (i = 0; i < p->object_count; ++i)
943     {
944         struct d3d10_effect_object *o = &p->objects[i];
945 
946         o->pass = p;
947 
948         hr = parse_fx10_object(o, ptr, data);
949         if (FAILED(hr)) return hr;
950     }
951 
952     return hr;
953 }
954 
955 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
956 {
957     unsigned int i;
958     DWORD offset;
959     HRESULT hr;
960 
961     read_dword(ptr, &offset);
962     TRACE("Technique name at offset %#x.\n", offset);
963 
964     if (!copy_name(data + offset, &t->name))
965     {
966         ERR("Failed to copy name.\n");
967         return E_OUTOFMEMORY;
968     }
969     TRACE("Technique name: %s.\n", debugstr_a(t->name));
970 
971     read_dword(ptr, &t->pass_count);
972     TRACE("Technique has %u passes\n", t->pass_count);
973 
974     read_dword(ptr, &t->annotation_count);
975     TRACE("Technique has %u annotations.\n", t->annotation_count);
976 
977     t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
978     if (!t->annotations)
979     {
980         ERR("Failed to allocate technique annotations memory.\n");
981         return E_OUTOFMEMORY;
982     }
983 
984     for (i = 0; i < t->annotation_count; ++i)
985     {
986         struct d3d10_effect_variable *a = &t->annotations[i];
987 
988         a->effect = t->effect;
989         a->buffer = &null_local_buffer;
990 
991         hr = parse_fx10_annotation(a, ptr, data);
992         if (FAILED(hr)) return hr;
993     }
994 
995     t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
996     if (!t->passes)
997     {
998         ERR("Failed to allocate passes memory\n");
999         return E_OUTOFMEMORY;
1000     }
1001 
1002     for (i = 0; i < t->pass_count; ++i)
1003     {
1004         struct d3d10_effect_pass *p = &t->passes[i];
1005 
1006         p->vtbl = &d3d10_effect_pass_vtbl;
1007         p->technique = t;
1008 
1009         hr = parse_fx10_pass(p, ptr, data);
1010         if (FAILED(hr)) return hr;
1011     }
1012 
1013     return S_OK;
1014 }
1015 
1016 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1017 {
1018     DWORD offset;
1019     unsigned int i;
1020     HRESULT hr;
1021 
1022     hr = parse_fx10_variable_head(v, ptr, data);
1023     if (FAILED(hr)) return hr;
1024 
1025     read_dword(ptr, &offset);
1026     TRACE("Variable semantic at offset %#x.\n", offset);
1027 
1028     if (!copy_name(data + offset, &v->semantic))
1029     {
1030         ERR("Failed to copy semantic.\n");
1031         return E_OUTOFMEMORY;
1032     }
1033     TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1034 
1035     read_dword(ptr, &v->buffer_offset);
1036     TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1037 
1038     skip_dword_unknown(ptr, 1);
1039 
1040     read_dword(ptr, &v->flag);
1041     TRACE("Variable flag: %#x.\n", v->flag);
1042 
1043     read_dword(ptr, &v->annotation_count);
1044     TRACE("Variable has %u annotations.\n", v->annotation_count);
1045 
1046     v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1047     if (!v->annotations)
1048     {
1049         ERR("Failed to allocate variable annotations memory.\n");
1050         return E_OUTOFMEMORY;
1051     }
1052 
1053     for (i = 0; i < v->annotation_count; ++i)
1054     {
1055         struct d3d10_effect_variable *a = &v->annotations[i];
1056 
1057         a->effect = v->effect;
1058         a->buffer = &null_local_buffer;
1059 
1060         hr = parse_fx10_annotation(a, ptr, data);
1061         if (FAILED(hr)) return hr;
1062     }
1063 
1064     return S_OK;
1065 }
1066 
1067 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1068 {
1069     unsigned int i;
1070     HRESULT hr;
1071 
1072     hr = parse_fx10_variable_head(v, ptr, data);
1073     if (FAILED(hr)) return hr;
1074 
1075     skip_dword_unknown(ptr, 2);
1076 
1077     switch (v->type->basetype)
1078     {
1079         case D3D10_SVT_TEXTURE1D:
1080         case D3D10_SVT_TEXTURE1DARRAY:
1081         case D3D10_SVT_TEXTURE2D:
1082         case D3D10_SVT_TEXTURE2DARRAY:
1083         case D3D10_SVT_TEXTURE2DMS:
1084         case D3D10_SVT_TEXTURE2DMSARRAY:
1085         case D3D10_SVT_TEXTURE3D:
1086         case D3D10_SVT_TEXTURECUBE:
1087         case D3D10_SVT_RENDERTARGETVIEW:
1088         case D3D10_SVT_DEPTHSTENCILVIEW:
1089             TRACE("SVT could not have elements.\n");
1090             break;
1091 
1092         case D3D10_SVT_VERTEXSHADER:
1093         case D3D10_SVT_PIXELSHADER:
1094         case D3D10_SVT_GEOMETRYSHADER:
1095             TRACE("SVT is a shader.\n");
1096             for (i = 0; i < max(v->type->element_count, 1); ++i)
1097             {
1098                 DWORD shader_offset;
1099 
1100                 /*
1101                  * TODO: Parse the shader
1102                  */
1103                 read_dword(ptr, &shader_offset);
1104                 FIXME("Shader offset: %#x.\n", shader_offset);
1105             }
1106             break;
1107 
1108         case D3D10_SVT_DEPTHSTENCIL:
1109         case D3D10_SVT_BLEND:
1110         case D3D10_SVT_RASTERIZER:
1111         case D3D10_SVT_SAMPLER:
1112             TRACE("SVT is a state.\n");
1113             for (i = 0; i < max(v->type->element_count, 1); ++i)
1114             {
1115                 unsigned int j;
1116                 DWORD object_count;
1117 
1118                 read_dword(ptr, &object_count);
1119                 TRACE("Object count: %#x.\n", object_count);
1120 
1121                 for (j = 0; j < object_count; ++j)
1122                 {
1123                     skip_dword_unknown(ptr, 4);
1124                 }
1125             }
1126             break;
1127 
1128         default:
1129             FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1130             return E_FAIL;
1131     }
1132 
1133     read_dword(ptr, &v->annotation_count);
1134     TRACE("Variable has %u annotations.\n", v->annotation_count);
1135 
1136     v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1137     if (!v->annotations)
1138     {
1139         ERR("Failed to allocate variable annotations memory.\n");
1140         return E_OUTOFMEMORY;
1141     }
1142 
1143     for (i = 0; i < v->annotation_count; ++i)
1144     {
1145         struct d3d10_effect_variable *a = &v->annotations[i];
1146 
1147         a->effect = v->effect;
1148         a->buffer = &null_local_buffer;
1149 
1150         hr = parse_fx10_annotation(a, ptr, data);
1151         if (FAILED(hr)) return hr;
1152     }
1153 
1154     return S_OK;
1155 }
1156 
1157 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1158 {
1159     unsigned int i;
1160     DWORD offset;
1161     D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1162     HRESULT hr;
1163     unsigned int stride = 0;
1164 
1165     /* Generate our own type, it isn't in the fx blob. */
1166     l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1167     if (!l->type)
1168     {
1169         ERR("Failed to allocate local buffer type memory.\n");
1170         return E_OUTOFMEMORY;
1171     }
1172     l->type->vtbl = &d3d10_effect_type_vtbl;
1173     l->type->type_class = D3D10_SVC_OBJECT;
1174     l->type->effect = l->effect;
1175 
1176     read_dword(ptr, &offset);
1177     TRACE("Local buffer name at offset %#x.\n", offset);
1178 
1179     if (!copy_name(data + offset, &l->name))
1180     {
1181         ERR("Failed to copy name.\n");
1182         return E_OUTOFMEMORY;
1183     }
1184     TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1185 
1186     read_dword(ptr, &l->data_size);
1187     TRACE("Local buffer data size: %#x.\n", l->data_size);
1188 
1189     read_dword(ptr, &d3d10_cbuffer_type);
1190     TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1191 
1192     switch(d3d10_cbuffer_type)
1193     {
1194         case D3D10_CT_CBUFFER:
1195             l->type->basetype = D3D10_SVT_CBUFFER;
1196             if (!copy_name("cbuffer", &l->type->name))
1197             {
1198                 ERR("Failed to copy name.\n");
1199                 return E_OUTOFMEMORY;
1200             }
1201             break;
1202 
1203         case D3D10_CT_TBUFFER:
1204             l->type->basetype = D3D10_SVT_TBUFFER;
1205             if (!copy_name("tbuffer", &l->type->name))
1206             {
1207                 ERR("Failed to copy name.\n");
1208                 return E_OUTOFMEMORY;
1209             }
1210             break;
1211 
1212         default:
1213             ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1214             return E_FAIL;
1215     }
1216 
1217     read_dword(ptr, &l->type->member_count);
1218     TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1219 
1220     skip_dword_unknown(ptr, 1);
1221 
1222     read_dword(ptr, &l->annotation_count);
1223     TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1224 
1225     l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1226     if (!l->annotations)
1227     {
1228         ERR("Failed to allocate local buffer annotations memory.\n");
1229         return E_OUTOFMEMORY;
1230     }
1231 
1232     for (i = 0; i < l->annotation_count; ++i)
1233     {
1234         struct d3d10_effect_variable *a = &l->annotations[i];
1235 
1236         a->effect = l->effect;
1237         a->buffer = &null_local_buffer;
1238 
1239         hr = parse_fx10_annotation(a, ptr, data);
1240         if (FAILED(hr)) return hr;
1241     }
1242 
1243     l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1244     if (!l->members)
1245     {
1246         ERR("Failed to allocate members memory.\n");
1247         return E_OUTOFMEMORY;
1248     }
1249 
1250     l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1251     if (!l->type->members)
1252     {
1253         ERR("Failed to allocate type members memory.\n");
1254         return E_OUTOFMEMORY;
1255     }
1256 
1257     for (i = 0; i < l->type->member_count; ++i)
1258     {
1259         struct d3d10_effect_variable *v = &l->members[i];
1260         struct d3d10_effect_type_member *typem = &l->type->members[i];
1261 
1262         v->buffer = l;
1263         v->effect = l->effect;
1264 
1265         hr = parse_fx10_variable(v, ptr, data);
1266         if (FAILED(hr)) return hr;
1267 
1268         /*
1269          * Copy the values from the variable type to the constant buffers type
1270          * members structure, because it is our own generated type.
1271          */
1272         typem->type = v->type;
1273 
1274         if (!copy_name(v->name, &typem->name))
1275         {
1276             ERR("Failed to copy name.\n");
1277             return E_OUTOFMEMORY;
1278         }
1279         TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1280 
1281         if (!copy_name(v->semantic, &typem->semantic))
1282         {
1283             ERR("Failed to copy name.\n");
1284             return E_OUTOFMEMORY;
1285         }
1286         TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1287 
1288         typem->buffer_offset = v->buffer_offset;
1289         TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1290 
1291         l->type->size_packed += v->type->size_packed;
1292 
1293         /*
1294          * For the complete constantbuffer the size_unpacked = stride,
1295          * the stride is calculated like this:
1296          *
1297          * 1) if the constant buffer variables are packed with packoffset
1298          *    - stride = the highest used constant
1299          *    - the complete stride has to be a multiple of 0x10
1300          *
1301          * 2) if the constant buffer variables are NOT packed with packoffset
1302          *    - sum of unpacked size for all variables which fit in a 0x10 part
1303          *    - if the size exceeds a 0x10 part, the rest of the old part is skipped
1304          *      and a new part is started
1305          *    - if the variable is a struct it is always used a new part
1306          *    - the complete stride has to be a multiple of 0x10
1307          *
1308          *    e.g.:
1309          *             0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1310          *        part 0x10           0x10      0x20     -> 0x40
1311          */
1312         if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1313         {
1314             if ((v->type->size_unpacked + v->buffer_offset) > stride)
1315             {
1316                 stride = v->type->size_unpacked + v->buffer_offset;
1317             }
1318         }
1319         else
1320         {
1321             if (v->type->type_class == D3D10_SVC_STRUCT)
1322             {
1323                 stride = (stride + 0xf) & ~0xf;
1324             }
1325 
1326             if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1327             {
1328                 stride = (stride + 0xf) & ~0xf;
1329             }
1330 
1331             stride += v->type->size_unpacked;
1332         }
1333     }
1334     l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1335 
1336     TRACE("Constant buffer:\n");
1337     TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1338     TRACE("\tElement count: %u.\n", l->type->element_count);
1339     TRACE("\tMember count: %u.\n", l->type->member_count);
1340     TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1341     TRACE("\tStride: %#x.\n", l->type->stride);
1342     TRACE("\tPacked size %#x.\n", l->type->size_packed);
1343     TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1344     TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1345 
1346     return S_OK;
1347 }
1348 
1349 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1350 {
1351     const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1352     const DWORD *id = key;
1353 
1354     return *id - t->id;
1355 }
1356 
1357 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1358 {
1359     TRACE("effect type member %p.\n", typem);
1360 
1361     /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1362     HeapFree(GetProcessHeap(), 0, typem->semantic);
1363     HeapFree(GetProcessHeap(), 0, typem->name);
1364 }
1365 
1366 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1367 {
1368     struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1369 
1370     TRACE("effect type %p.\n", t);
1371 
1372     if (t->elementtype)
1373     {
1374         HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1375         HeapFree(GetProcessHeap(), 0, t->elementtype);
1376     }
1377 
1378     if (t->members)
1379     {
1380         unsigned int i;
1381 
1382         for (i = 0; i < t->member_count; ++i)
1383         {
1384             d3d10_effect_type_member_destroy(&t->members[i]);
1385         }
1386         HeapFree(GetProcessHeap(), 0, t->members);
1387     }
1388 
1389     HeapFree(GetProcessHeap(), 0, t->name);
1390     HeapFree(GetProcessHeap(), 0, t);
1391 }
1392 
1393 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1394 {
1395     d3d10_rb_alloc,
1396     d3d10_rb_realloc,
1397     d3d10_rb_free,
1398     d3d10_effect_type_compare,
1399 };
1400 
1401 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1402 {
1403     const char *ptr = data + e->index_offset;
1404     unsigned int i;
1405     HRESULT hr;
1406 
1407     if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1408     {
1409         ERR("Failed to initialize type rbtree.\n");
1410         return E_FAIL;
1411     }
1412 
1413     e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1414     if (!e->local_buffers)
1415     {
1416         ERR("Failed to allocate local buffer memory.\n");
1417         return E_OUTOFMEMORY;
1418     }
1419 
1420     e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1421     if (!e->local_variables)
1422     {
1423         ERR("Failed to allocate local variable memory.\n");
1424         return E_OUTOFMEMORY;
1425     }
1426 
1427     e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
1428     if (!e->techniques)
1429     {
1430         ERR("Failed to allocate techniques memory\n");
1431         return E_OUTOFMEMORY;
1432     }
1433 
1434     for (i = 0; i < e->local_buffer_count; ++i)
1435     {
1436         struct d3d10_effect_variable *l = &e->local_buffers[i];
1437         l->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
1438         l->effect = e;
1439         l->buffer = &null_local_buffer;
1440 
1441         hr = parse_fx10_local_buffer(l, &ptr, data);
1442         if (FAILED(hr)) return hr;
1443     }
1444 
1445     for (i = 0; i < e->local_variable_count; ++i)
1446     {
1447         struct d3d10_effect_variable *v = &e->local_variables[i];
1448 
1449         v->effect = e;
1450         v->vtbl = &d3d10_effect_variable_vtbl;
1451         v->buffer = &null_local_buffer;
1452 
1453         hr = parse_fx10_local_variable(v, &ptr, data);
1454         if (FAILED(hr)) return hr;
1455     }
1456 
1457     for (i = 0; i < e->technique_count; ++i)
1458     {
1459         struct d3d10_effect_technique *t = &e->techniques[i];
1460 
1461         t->vtbl = &d3d10_effect_technique_vtbl;
1462         t->effect = e;
1463 
1464         hr = parse_fx10_technique(t, &ptr, data);
1465         if (FAILED(hr)) return hr;
1466     }
1467 
1468     return S_OK;
1469 }
1470 
1471 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
1472 {
1473     const char *ptr = data;
1474     DWORD unknown;
1475 
1476     /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
1477     read_dword(&ptr, &e->version);
1478     TRACE("Target: %#x\n", e->version);
1479 
1480     read_dword(&ptr, &e->local_buffer_count);
1481     TRACE("Local buffer count: %u.\n", e->local_buffer_count);
1482 
1483     read_dword(&ptr, &e->variable_count);
1484     TRACE("Variable count: %u\n", e->variable_count);
1485 
1486     read_dword(&ptr, &e->local_variable_count);
1487     TRACE("Object count: %u\n", e->local_variable_count);
1488 
1489     read_dword(&ptr, &e->sharedbuffers_count);
1490     TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
1491 
1492     /* Number of variables in shared buffers? */
1493     read_dword(&ptr, &unknown);
1494     FIXME("Unknown 0: %u\n", unknown);
1495 
1496     read_dword(&ptr, &e->sharedobjects_count);
1497     TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
1498 
1499     read_dword(&ptr, &e->technique_count);
1500     TRACE("Technique count: %u\n", e->technique_count);
1501 
1502     read_dword(&ptr, &e->index_offset);
1503     TRACE("Index offset: %#x\n", e->index_offset);
1504 
1505     read_dword(&ptr, &unknown);
1506     FIXME("Unknown 1: %u\n", unknown);
1507 
1508     read_dword(&ptr, &e->texture_count);
1509     TRACE("Texture count: %u\n", e->texture_count);
1510 
1511     read_dword(&ptr, &e->dephstencilstate_count);
1512     TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
1513 
1514     read_dword(&ptr, &e->blendstate_count);
1515     TRACE("Blendstate count: %u\n", e->blendstate_count);
1516 
1517     read_dword(&ptr, &e->rasterizerstate_count);
1518     TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
1519 
1520     read_dword(&ptr, &e->samplerstate_count);
1521     TRACE("Samplerstate count: %u\n", e->samplerstate_count);
1522 
1523     read_dword(&ptr, &e->rendertargetview_count);
1524     TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
1525 
1526     read_dword(&ptr, &e->depthstencilview_count);
1527     TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
1528 
1529     read_dword(&ptr, &e->shader_call_count);
1530     TRACE("Shader call count: %u\n", e->shader_call_count);
1531 
1532     read_dword(&ptr, &e->shader_compile_count);
1533     TRACE("Shader compile count: %u\n", e->shader_compile_count);
1534 
1535     return parse_fx10_body(e, ptr, data_size - (ptr - data));
1536 }
1537 
1538 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
1539 {
1540     struct d3d10_effect *e = ctx;
1541 
1542     TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
1543 
1544     TRACE("chunk size: %#x\n", data_size);
1545 
1546     switch(tag)
1547     {
1548         case TAG_FX10:
1549             return parse_fx10(e, data, data_size);
1550 
1551         default:
1552             FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
1553             return S_OK;
1554     }
1555 }
1556 
1557 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
1558 {
1559     return parse_dxbc(data, data_size, fx10_chunk_handler, This);
1560 }
1561 
1562 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
1563 {
1564     TRACE("effect object %p.\n", o);
1565 
1566     switch(o->type)
1567     {
1568         case D3D10_EOT_VERTEXSHADER:
1569         case D3D10_EOT_PIXELSHADER:
1570         case D3D10_EOT_GEOMETRYSHADER:
1571             HeapFree(GetProcessHeap(), 0, ((struct d3d10_effect_shader_variable *)o->data)->input_signature);
1572             break;
1573 
1574         default:
1575             break;
1576     }
1577     HeapFree(GetProcessHeap(), 0, o->data);
1578 }
1579 
1580 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
1581 {
1582     ID3D10Device *device = o->pass->technique->effect->device;
1583 
1584     TRACE("effect object %p, type %#x.\n", o, o->type);
1585 
1586     switch(o->type)
1587     {
1588         case D3D10_EOT_VERTEXSHADER:
1589             ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.vs);
1590             return S_OK;
1591 
1592         case D3D10_EOT_PIXELSHADER:
1593             ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.ps);
1594             return S_OK;
1595 
1596         case D3D10_EOT_GEOMETRYSHADER:
1597             ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.gs);
1598             return S_OK;
1599 
1600         default:
1601             FIXME("Unhandled effect object type %#x.\n", o->type);
1602             return E_FAIL;
1603     }
1604 }
1605 
1606 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
1607 {
1608     unsigned int i;
1609 
1610     TRACE("variable %p.\n", v);
1611 
1612     HeapFree(GetProcessHeap(), 0, v->name);
1613     HeapFree(GetProcessHeap(), 0, v->semantic);
1614     if (v->annotations)
1615     {
1616         for (i = 0; i < v->annotation_count; ++i)
1617         {
1618             d3d10_effect_variable_destroy(&v->annotations[i]);
1619         }
1620         HeapFree(GetProcessHeap(), 0, v->annotations);
1621     }
1622 
1623     if (v->members)
1624     {
1625         for (i = 0; i < v->type->member_count; ++i)
1626         {
1627             d3d10_effect_variable_destroy(&v->members[i]);
1628         }
1629         HeapFree(GetProcessHeap(), 0, v->members);
1630     }
1631 
1632     if (v->elements)
1633     {
1634         for (i = 0; i < v->type->element_count; ++i)
1635         {
1636             d3d10_effect_variable_destroy(&v->elements[i]);
1637         }
1638         HeapFree(GetProcessHeap(), 0, v->elements);
1639     }
1640 }
1641 
1642 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
1643 {
1644     unsigned int i;
1645 
1646     TRACE("pass %p\n", p);
1647 
1648     HeapFree(GetProcessHeap(), 0, p->name);
1649     if (p->objects)
1650     {
1651         for (i = 0; i < p->object_count; ++i)
1652         {
1653             d3d10_effect_object_destroy(&p->objects[i]);
1654         }
1655         HeapFree(GetProcessHeap(), 0, p->objects);
1656     }
1657 
1658     if (p->annotations)
1659     {
1660         for (i = 0; i < p->annotation_count; ++i)
1661         {
1662             d3d10_effect_variable_destroy(&p->annotations[i]);
1663         }
1664         HeapFree(GetProcessHeap(), 0, p->annotations);
1665     }
1666 
1667 }
1668 
1669 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
1670 {
1671     unsigned int i;
1672 
1673     TRACE("technique %p\n", t);
1674 
1675     HeapFree(GetProcessHeap(), 0, t->name);
1676     if (t->passes)
1677     {
1678         for (i = 0; i < t->pass_count; ++i)
1679         {
1680             d3d10_effect_pass_destroy(&t->passes[i]);
1681         }
1682         HeapFree(GetProcessHeap(), 0, t->passes);
1683     }
1684 
1685     if (t->annotations)
1686     {
1687         for (i = 0; i < t->annotation_count; ++i)
1688         {
1689             d3d10_effect_variable_destroy(&t->annotations[i]);
1690         }
1691         HeapFree(GetProcessHeap(), 0, t->annotations);
1692     }
1693 }
1694 
1695 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
1696 {
1697     unsigned int i;
1698 
1699     TRACE("local buffer %p.\n", l);
1700 
1701     HeapFree(GetProcessHeap(), 0, l->name);
1702     if (l->members)
1703     {
1704         for (i = 0; i < l->type->member_count; ++i)
1705         {
1706             d3d10_effect_variable_destroy(&l->members[i]);
1707         }
1708         HeapFree(GetProcessHeap(), 0, l->members);
1709     }
1710 
1711     if (l->type->members)
1712     {
1713         for (i = 0; i < l->type->member_count; ++i)
1714         {
1715             /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
1716             HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
1717             HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
1718         }
1719         HeapFree(GetProcessHeap(), 0, l->type->members);
1720     }
1721     HeapFree(GetProcessHeap(), 0, l->type->name);
1722     HeapFree(GetProcessHeap(), 0, l->type);
1723 
1724     if (l->annotations)
1725     {
1726         for (i = 0; i < l->annotation_count; ++i)
1727         {
1728             d3d10_effect_variable_destroy(&l->annotations[i]);
1729         }
1730         HeapFree(GetProcessHeap(), 0, l->annotations);
1731     }
1732 }
1733 
1734 /* IUnknown methods */
1735 
1736 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
1737 {
1738     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
1739 
1740     if (IsEqualGUID(riid, &IID_ID3D10Effect)
1741             || IsEqualGUID(riid, &IID_IUnknown))
1742     {
1743         IUnknown_AddRef(iface);
1744         *object = iface;
1745         return S_OK;
1746     }
1747 
1748     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
1749 
1750     *object = NULL;
1751     return E_NOINTERFACE;
1752 }
1753 
1754 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
1755 {
1756     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1757     ULONG refcount = InterlockedIncrement(&This->refcount);
1758 
1759     TRACE("%p increasing refcount to %u\n", This, refcount);
1760 
1761     return refcount;
1762 }
1763 
1764 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
1765 {
1766     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1767     ULONG refcount = InterlockedDecrement(&This->refcount);
1768 
1769     TRACE("%p decreasing refcount to %u\n", This, refcount);
1770 
1771     if (!refcount)
1772     {
1773         unsigned int i;
1774 
1775         if (This->techniques)
1776         {
1777             for (i = 0; i < This->technique_count; ++i)
1778             {
1779                 d3d10_effect_technique_destroy(&This->techniques[i]);
1780             }
1781             HeapFree(GetProcessHeap(), 0, This->techniques);
1782         }
1783 
1784         if (This->local_variables)
1785         {
1786             for (i = 0; i < This->local_variable_count; ++i)
1787             {
1788                 d3d10_effect_variable_destroy(&This->local_variables[i]);
1789             }
1790             HeapFree(GetProcessHeap(), 0, This->local_variables);
1791         }
1792 
1793         if (This->local_buffers)
1794         {
1795             for (i = 0; i < This->local_buffer_count; ++i)
1796             {
1797                 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
1798             }
1799             HeapFree(GetProcessHeap(), 0, This->local_buffers);
1800         }
1801 
1802         wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
1803 
1804         ID3D10Device_Release(This->device);
1805         HeapFree(GetProcessHeap(), 0, This);
1806     }
1807 
1808     return refcount;
1809 }
1810 
1811 /* ID3D10Effect methods */
1812 
1813 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
1814 {
1815     FIXME("iface %p stub!\n", iface);
1816 
1817     return FALSE;
1818 }
1819 
1820 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
1821 {
1822     FIXME("iface %p stub!\n", iface);
1823 
1824     return FALSE;
1825 }
1826 
1827 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
1828 {
1829     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1830 
1831     TRACE("iface %p, device %p\n", iface, device);
1832 
1833     ID3D10Device_AddRef(This->device);
1834     *device = This->device;
1835 
1836     return S_OK;
1837 }
1838 
1839 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
1840 {
1841     FIXME("iface %p, desc %p stub!\n", iface, desc);
1842 
1843     return E_NOTIMPL;
1844 }
1845 
1846 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
1847         UINT index)
1848 {
1849     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1850     struct d3d10_effect_variable *l;
1851 
1852     TRACE("iface %p, index %u\n", iface, index);
1853 
1854     if (index >= This->local_buffer_count)
1855     {
1856         WARN("Invalid index specified\n");
1857         return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1858     }
1859 
1860     l = &This->local_buffers[index];
1861 
1862     TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
1863 
1864     return (ID3D10EffectConstantBuffer *)l;
1865 }
1866 
1867 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
1868         LPCSTR name)
1869 {
1870     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1871     unsigned int i;
1872 
1873     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1874 
1875     for (i = 0; i < This->local_buffer_count; ++i)
1876     {
1877         struct d3d10_effect_variable *l = &This->local_buffers[i];
1878 
1879         if (!strcmp(l->name, name))
1880         {
1881             TRACE("Returning buffer %p.\n", l);
1882             return (ID3D10EffectConstantBuffer *)l;
1883         }
1884     }
1885 
1886     WARN("Invalid name specified\n");
1887 
1888     return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1889 }
1890 
1891 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
1892 {
1893     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1894     unsigned int i;
1895 
1896     TRACE("iface %p, index %u\n", iface, index);
1897 
1898     for (i = 0; i < This->local_buffer_count; ++i)
1899     {
1900         struct d3d10_effect_variable *l = &This->local_buffers[i];
1901 
1902         if (index < l->type->member_count)
1903         {
1904             struct d3d10_effect_variable *v = &l->members[index];
1905 
1906             TRACE("Returning variable %p.\n", v);
1907             return (ID3D10EffectVariable *)v;
1908         }
1909         index -= l->type->member_count;
1910     }
1911 
1912     if (index < This->local_variable_count)
1913     {
1914         struct d3d10_effect_variable *v = &This->local_variables[index];
1915 
1916         TRACE("Returning variable %p.\n", v);
1917         return (ID3D10EffectVariable *)v;
1918     }
1919 
1920     WARN("Invalid index specified\n");
1921 
1922     return (ID3D10EffectVariable *)&null_variable;
1923 }
1924 
1925 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
1926 {
1927     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1928     unsigned int i;
1929 
1930     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1931 
1932     for (i = 0; i < This->local_buffer_count; ++i)
1933     {
1934         struct d3d10_effect_variable *l = &This->local_buffers[i];
1935         unsigned int j;
1936 
1937         for (j = 0; j < l->type->member_count; ++j)
1938         {
1939             struct d3d10_effect_variable *v = &l->members[j];
1940 
1941             if (!strcmp(v->name, name))
1942             {
1943                 TRACE("Returning variable %p.\n", v);
1944                 return (ID3D10EffectVariable *)v;
1945             }
1946         }
1947     }
1948 
1949     for (i = 0; i < This->local_variable_count; ++i)
1950     {
1951         struct d3d10_effect_variable *v = &This->local_variables[i];
1952 
1953         if (!strcmp(v->name, name))
1954         {
1955             TRACE("Returning variable %p.\n", v);
1956             return (ID3D10EffectVariable *)v;
1957         }
1958     }
1959 
1960     WARN("Invalid name specified\n");
1961 
1962     return (ID3D10EffectVariable *)&null_variable;
1963 }
1964 
1965 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
1966         LPCSTR semantic)
1967 {
1968     FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic));
1969 
1970     return NULL;
1971 }
1972 
1973 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
1974         UINT index)
1975 {
1976     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1977     struct d3d10_effect_technique *t;
1978 
1979     TRACE("iface %p, index %u\n", iface, index);
1980 
1981     if (index >= This->technique_count)
1982     {
1983         WARN("Invalid index specified\n");
1984         return (ID3D10EffectTechnique *)&null_technique;
1985     }
1986 
1987     t = &This->techniques[index];
1988 
1989     TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
1990 
1991     return (ID3D10EffectTechnique *)t;
1992 }
1993 
1994 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
1995         LPCSTR name)
1996 {
1997     struct d3d10_effect *This = (struct d3d10_effect *)iface;
1998     unsigned int i;
1999 
2000     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2001 
2002     for (i = 0; i < This->technique_count; ++i)
2003     {
2004         struct d3d10_effect_technique *t = &This->techniques[i];
2005         if (!strcmp(t->name, name))
2006         {
2007             TRACE("Returning technique %p\n", t);
2008             return (ID3D10EffectTechnique *)t;
2009         }
2010     }
2011 
2012     WARN("Invalid name specified\n");
2013 
2014     return (ID3D10EffectTechnique *)&null_technique;
2015 }
2016 
2017 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2018 {
2019     FIXME("iface %p stub!\n", iface);
2020 
2021     return E_NOTIMPL;
2022 }
2023 
2024 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2025 {
2026     FIXME("iface %p stub!\n", iface);
2027 
2028     return FALSE;
2029 }
2030 
2031 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2032 {
2033     /* IUnknown methods */
2034     d3d10_effect_QueryInterface,
2035     d3d10_effect_AddRef,
2036     d3d10_effect_Release,
2037     /* ID3D10Effect methods */
2038     d3d10_effect_IsValid,
2039     d3d10_effect_IsPool,
2040     d3d10_effect_GetDevice,
2041     d3d10_effect_GetDesc,
2042     d3d10_effect_GetConstantBufferByIndex,
2043     d3d10_effect_GetConstantBufferByName,
2044     d3d10_effect_GetVariableByIndex,
2045     d3d10_effect_GetVariableByName,
2046     d3d10_effect_GetVariableBySemantic,
2047     d3d10_effect_GetTechniqueByIndex,
2048     d3d10_effect_GetTechniqueByName,
2049     d3d10_effect_Optimize,
2050     d3d10_effect_IsOptimized,
2051 };
2052 
2053 /* ID3D10EffectTechnique methods */
2054 
2055 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2056 {
2057     TRACE("iface %p\n", iface);
2058 
2059     return (struct d3d10_effect_technique *)iface != &null_technique;
2060 }
2061 
2062 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2063         D3D10_TECHNIQUE_DESC *desc)
2064 {
2065     struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2066 
2067     TRACE("iface %p, desc %p\n", iface, desc);
2068 
2069     if(This == &null_technique)
2070     {
2071         WARN("Null technique specified\n");
2072         return E_FAIL;
2073     }
2074 
2075     if(!desc)
2076     {
2077         WARN("Invalid argument specified\n");
2078         return E_INVALIDARG;
2079     }
2080 
2081     desc->Name = This->name;
2082     desc->Passes = This->pass_count;
2083     desc->Annotations = This->annotation_count;
2084 
2085     return S_OK;
2086 }
2087 
2088 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2089         ID3D10EffectTechnique *iface, UINT index)
2090 {
2091     struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2092     struct d3d10_effect_variable *a;
2093 
2094     TRACE("iface %p, index %u\n", iface, index);
2095 
2096     if (index >= This->annotation_count)
2097     {
2098         WARN("Invalid index specified\n");
2099         return (ID3D10EffectVariable *)&null_variable;
2100     }
2101 
2102     a = &This->annotations[index];
2103 
2104     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2105 
2106     return (ID3D10EffectVariable *)a;
2107 }
2108 
2109 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2110         ID3D10EffectTechnique *iface, LPCSTR name)
2111 {
2112     struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2113     unsigned int i;
2114 
2115     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2116 
2117     for (i = 0; i < This->annotation_count; ++i)
2118     {
2119         struct d3d10_effect_variable *a = &This->annotations[i];
2120         if (!strcmp(a->name, name))
2121         {
2122             TRACE("Returning annotation %p\n", a);
2123             return (ID3D10EffectVariable *)a;
2124         }
2125     }
2126 
2127     WARN("Invalid name specified\n");
2128 
2129     return (ID3D10EffectVariable *)&null_variable;
2130 }
2131 
2132 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2133         UINT index)
2134 {
2135     struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2136     struct d3d10_effect_pass *p;
2137 
2138     TRACE("iface %p, index %u\n", iface, index);
2139 
2140     if (index >= This->pass_count)
2141     {
2142         WARN("Invalid index specified\n");
2143         return (ID3D10EffectPass *)&null_pass;
2144     }
2145 
2146     p = &This->passes[index];
2147 
2148     TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2149 
2150     return (ID3D10EffectPass *)p;
2151 }
2152 
2153 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2154         LPCSTR name)
2155 {
2156     struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2157     unsigned int i;
2158 
2159     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2160 
2161     for (i = 0; i < This->pass_count; ++i)
2162     {
2163         struct d3d10_effect_pass *p = &This->passes[i];
2164         if (!strcmp(p->name, name))
2165         {
2166             TRACE("Returning pass %p\n", p);
2167             return (ID3D10EffectPass *)p;
2168         }
2169     }
2170 
2171     WARN("Invalid name specified\n");
2172 
2173     return (ID3D10EffectPass *)&null_pass;
2174 }
2175 
2176 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2177         D3D10_STATE_BLOCK_MASK *mask)
2178 {
2179     FIXME("iface %p,mask %p stub!\n", iface, mask);
2180 
2181     return E_NOTIMPL;
2182 }
2183 
2184 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2185 {
2186     /* ID3D10EffectTechnique methods */
2187     d3d10_effect_technique_IsValid,
2188     d3d10_effect_technique_GetDesc,
2189     d3d10_effect_technique_GetAnnotationByIndex,
2190     d3d10_effect_technique_GetAnnotationByName,
2191     d3d10_effect_technique_GetPassByIndex,
2192     d3d10_effect_technique_GetPassByName,
2193     d3d10_effect_technique_ComputeStateBlockMask,
2194 };
2195 
2196 /* ID3D10EffectPass methods */
2197 
2198 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2199 {
2200     TRACE("iface %p\n", iface);
2201 
2202     return (struct d3d10_effect_pass *)iface != &null_pass;
2203 }
2204 
2205 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface, D3D10_PASS_DESC *desc)
2206 {
2207     struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2208     unsigned int i;
2209 
2210     FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2211 
2212     if(This == &null_pass)
2213     {
2214         WARN("Null pass specified\n");
2215         return E_FAIL;
2216     }
2217 
2218     if(!desc)
2219     {
2220         WARN("Invalid argument specified\n");
2221         return E_INVALIDARG;
2222     }
2223 
2224     memset(desc, 0, sizeof(*desc));
2225     desc->Name = This->name;
2226     for (i = 0; i < This->object_count; ++i)
2227     {
2228         struct d3d10_effect_object *o = &This->objects[i];
2229         if (o->type == D3D10_EOT_VERTEXSHADER)
2230         {
2231             struct d3d10_effect_shader_variable *s = o->data;
2232             desc->pIAInputSignature = (BYTE *)s->input_signature;
2233             desc->IAInputSignatureSize = s->input_signature_size;
2234             break;
2235         }
2236     }
2237 
2238     return S_OK;
2239 }
2240 
2241 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2242         D3D10_PASS_SHADER_DESC *desc)
2243 {
2244     FIXME("iface %p, desc %p stub!\n", iface, desc);
2245 
2246     return E_NOTIMPL;
2247 }
2248 
2249 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2250         D3D10_PASS_SHADER_DESC *desc)
2251 {
2252     FIXME("iface %p, desc %p stub!\n", iface, desc);
2253 
2254     return E_NOTIMPL;
2255 }
2256 
2257 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
2258         D3D10_PASS_SHADER_DESC *desc)
2259 {
2260     FIXME("iface %p, desc %p stub!\n", iface, desc);
2261 
2262     return E_NOTIMPL;
2263 }
2264 
2265 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
2266         UINT index)
2267 {
2268     struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2269     struct d3d10_effect_variable *a;
2270 
2271     TRACE("iface %p, index %u\n", iface, index);
2272 
2273     if (index >= This->annotation_count)
2274     {
2275         WARN("Invalid index specified\n");
2276         return (ID3D10EffectVariable *)&null_variable;
2277     }
2278 
2279     a = &This->annotations[index];
2280 
2281     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2282 
2283     return (ID3D10EffectVariable *)a;
2284 }
2285 
2286 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
2287         LPCSTR name)
2288 {
2289     struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2290     unsigned int i;
2291 
2292     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2293 
2294     for (i = 0; i < This->annotation_count; ++i)
2295     {
2296         struct d3d10_effect_variable *a = &This->annotations[i];
2297         if (!strcmp(a->name, name))
2298         {
2299             TRACE("Returning annotation %p\n", a);
2300             return (ID3D10EffectVariable *)a;
2301         }
2302     }
2303 
2304     WARN("Invalid name specified\n");
2305 
2306     return (ID3D10EffectVariable *)&null_variable;
2307 }
2308 
2309 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
2310 {
2311     struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2312     HRESULT hr = S_OK;
2313     unsigned int i;
2314 
2315     TRACE("iface %p, flags %#x\n", iface, flags);
2316 
2317     if (flags) FIXME("Ignoring flags (%#x)\n", flags);
2318 
2319     for (i = 0; i < This->object_count; ++i)
2320     {
2321         hr = d3d10_effect_object_apply(&This->objects[i]);
2322         if (FAILED(hr)) break;
2323     }
2324 
2325     return hr;
2326 }
2327 
2328 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
2329         D3D10_STATE_BLOCK_MASK *mask)
2330 {
2331     FIXME("iface %p, mask %p stub!\n", iface, mask);
2332 
2333     return E_NOTIMPL;
2334 }
2335 
2336 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
2337 {
2338     /* ID3D10EffectPass methods */
2339     d3d10_effect_pass_IsValid,
2340     d3d10_effect_pass_GetDesc,
2341     d3d10_effect_pass_GetVertexShaderDesc,
2342     d3d10_effect_pass_GetGeometryShaderDesc,
2343     d3d10_effect_pass_GetPixelShaderDesc,
2344     d3d10_effect_pass_GetAnnotationByIndex,
2345     d3d10_effect_pass_GetAnnotationByName,
2346     d3d10_effect_pass_Apply,
2347     d3d10_effect_pass_ComputeStateBlockMask,
2348 };
2349 
2350 /* ID3D10EffectVariable methods */
2351 
2352 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
2353 {
2354     TRACE("iface %p\n", iface);
2355 
2356     return (struct d3d10_effect_variable *)iface != &null_variable;
2357 }
2358 
2359 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
2360 {
2361     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2362 
2363     TRACE("iface %p\n", iface);
2364 
2365     return (ID3D10EffectType *)This->type;
2366 }
2367 
2368 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
2369         D3D10_EFFECT_VARIABLE_DESC *desc)
2370 {
2371     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2372 
2373     TRACE("iface %p, desc %p\n", iface, desc);
2374 
2375     if(This == &null_variable)
2376     {
2377         WARN("Null variable specified\n");
2378         return E_FAIL;
2379     }
2380 
2381     if(!desc)
2382     {
2383         WARN("Invalid argument specified\n");
2384         return E_INVALIDARG;
2385     }
2386 
2387     memset(desc, 0, sizeof(*desc));
2388     desc->Name = This->name;
2389     desc->Semantic = This->semantic;
2390     desc->Flags = This->flag;
2391     desc->Annotations = This->annotation_count;
2392     desc->BufferOffset = This->buffer_offset;
2393 
2394     if( This->flag == D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2395     {
2396         desc->ExplicitBindPoint = This->buffer_offset;
2397     }
2398 
2399     return S_OK;
2400 }
2401 
2402 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
2403         ID3D10EffectVariable *iface, UINT index)
2404 {
2405     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2406     struct d3d10_effect_variable *a;
2407 
2408     TRACE("iface %p, index %u\n", iface, index);
2409 
2410     if (index >= This->annotation_count)
2411     {
2412         WARN("Invalid index specified\n");
2413         return (ID3D10EffectVariable *)&null_variable;
2414     }
2415 
2416     a = &This->annotations[index];
2417 
2418     TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2419 
2420     return (ID3D10EffectVariable *)a;
2421 }
2422 
2423 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
2424         ID3D10EffectVariable *iface, LPCSTR name)
2425 {
2426     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2427     unsigned int i;
2428 
2429     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2430 
2431     for (i = 0; i < This->annotation_count; ++i)
2432     {
2433         struct d3d10_effect_variable *a = &This->annotations[i];
2434         if (!strcmp(a->name, name))
2435         {
2436             TRACE("Returning annotation %p\n", a);
2437             return (ID3D10EffectVariable *)a;
2438         }
2439     }
2440 
2441     WARN("Invalid name specified\n");
2442 
2443     return (ID3D10EffectVariable *)&null_variable;
2444 }
2445 
2446 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
2447         ID3D10EffectVariable *iface, UINT index)
2448 {
2449     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2450     struct d3d10_effect_variable *m;
2451 
2452     TRACE("iface %p, index %u\n", iface, index);
2453 
2454     if (index >= This->type->member_count)
2455     {
2456         WARN("Invalid index specified\n");
2457         return (ID3D10EffectVariable *)&null_variable;
2458     }
2459 
2460     m = &This->members[index];
2461 
2462     TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
2463 
2464     return (ID3D10EffectVariable *)m;
2465 }
2466 
2467 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
2468         ID3D10EffectVariable *iface, LPCSTR name)
2469 {
2470     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2471     unsigned int i;
2472 
2473     TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2474 
2475     if (!name)
2476     {
2477         WARN("Invalid name specified\n");
2478         return (ID3D10EffectVariable *)&null_variable;
2479     }
2480 
2481     for (i = 0; i < This->type->member_count; ++i)
2482     {
2483         struct d3d10_effect_variable *m = &This->members[i];
2484 
2485         if (m->name)
2486         {
2487             if (!strcmp(m->name, name))
2488             {
2489                 TRACE("Returning member %p\n", m);
2490                 return (ID3D10EffectVariable *)m;
2491             }
2492         }
2493     }
2494 
2495     WARN("Invalid name specified\n");
2496 
2497     return (ID3D10EffectVariable *)&null_variable;
2498 }
2499 
2500 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
2501         ID3D10EffectVariable *iface, LPCSTR semantic)
2502 {
2503     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2504     unsigned int i;
2505 
2506     TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
2507 
2508     if (!semantic)
2509     {
2510         WARN("Invalid semantic specified\n");
2511         return (ID3D10EffectVariable *)&null_variable;
2512     }
2513 
2514     for (i = 0; i < This->type->member_count; ++i)
2515     {
2516         struct d3d10_effect_variable *m = &This->members[i];
2517 
2518         if (m->semantic)
2519         {
2520             if (!strcmp(m->semantic, semantic))
2521             {
2522                 TRACE("Returning member %p\n", m);
2523                 return (ID3D10EffectVariable *)m;
2524             }
2525         }
2526     }
2527 
2528     WARN("Invalid semantic specified\n");
2529 
2530     return (ID3D10EffectVariable *)&null_variable;
2531 }
2532 
2533 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
2534         ID3D10EffectVariable *iface, UINT index)
2535 {
2536     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2537     struct d3d10_effect_variable *v;
2538 
2539     TRACE("iface %p, index %u\n", iface, index);
2540 
2541     if (index >= This->type->element_count)
2542     {
2543         WARN("Invalid index specified\n");
2544         return (ID3D10EffectVariable *)&null_variable;
2545     }
2546 
2547     v = &This->elements[index];
2548 
2549     TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
2550 
2551     return (ID3D10EffectVariable *)v;
2552 }
2553 
2554 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
2555         ID3D10EffectVariable *iface)
2556 {
2557     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2558 
2559     TRACE("iface %p\n", iface);
2560 
2561     return (ID3D10EffectConstantBuffer *)This->buffer;
2562 }
2563 
2564 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
2565         ID3D10EffectVariable *iface)
2566 {
2567     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2568 
2569     TRACE("iface %p\n", iface);
2570 
2571     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
2572         return (ID3D10EffectScalarVariable *)This;
2573 
2574     return (ID3D10EffectScalarVariable *)&null_scalar_variable;
2575 }
2576 
2577 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
2578         ID3D10EffectVariable *iface)
2579 {
2580     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2581 
2582     TRACE("iface %p\n", iface);
2583 
2584     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
2585         return (ID3D10EffectVectorVariable *)This;
2586 
2587     return (ID3D10EffectVectorVariable *)&null_vector_variable;
2588 }
2589 
2590 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
2591         ID3D10EffectVariable *iface)
2592 {
2593     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2594 
2595     TRACE("iface %p\n", iface);
2596 
2597     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
2598         return (ID3D10EffectMatrixVariable *)This;
2599 
2600     return (ID3D10EffectMatrixVariable *)&null_matrix_variable;
2601 }
2602 
2603 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
2604         ID3D10EffectVariable *iface)
2605 {
2606     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2607 
2608     TRACE("iface %p\n", iface);
2609 
2610     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
2611         return (ID3D10EffectStringVariable *)This;
2612 
2613     return (ID3D10EffectStringVariable *)&null_string_variable;
2614 }
2615 
2616 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
2617         ID3D10EffectVariable *iface)
2618 {
2619     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2620 
2621     TRACE("iface %p\n", iface);
2622 
2623     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
2624         return (ID3D10EffectShaderResourceVariable *)This;
2625 
2626     return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable;
2627 }
2628 
2629 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
2630         ID3D10EffectVariable *iface)
2631 {
2632     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2633 
2634     TRACE("iface %p\n", iface);
2635 
2636     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
2637         return (ID3D10EffectRenderTargetViewVariable *)This;
2638 
2639     return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable;
2640 }
2641 
2642 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
2643         ID3D10EffectVariable *iface)
2644 {
2645     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2646 
2647     TRACE("iface %p\n", iface);
2648 
2649     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
2650         return (ID3D10EffectDepthStencilViewVariable *)This;
2651 
2652     return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable;
2653 }
2654 
2655 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
2656         ID3D10EffectVariable *iface)
2657 {
2658     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2659 
2660     TRACE("iface %p\n", iface);
2661 
2662     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
2663         return (ID3D10EffectConstantBuffer *)This;
2664 
2665     return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2666 }
2667 
2668 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
2669         ID3D10EffectVariable *iface)
2670 {
2671     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2672 
2673     TRACE("iface %p\n", iface);
2674 
2675     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
2676         return (ID3D10EffectShaderVariable *)This;
2677 
2678     return (ID3D10EffectShaderVariable *)&null_shader_variable;
2679 }
2680 
2681 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
2682 {
2683     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2684 
2685     TRACE("iface %p\n", iface);
2686 
2687     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
2688         return (ID3D10EffectBlendVariable *)This;
2689 
2690     return (ID3D10EffectBlendVariable *)&null_blend_variable;
2691 }
2692 
2693 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
2694         ID3D10EffectVariable *iface)
2695 {
2696     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2697 
2698     TRACE("iface %p\n", iface);
2699 
2700     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
2701         return (ID3D10EffectDepthStencilVariable *)This;
2702 
2703     return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable;
2704 }
2705 
2706 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
2707         ID3D10EffectVariable *iface)
2708 {
2709     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2710 
2711     TRACE("iface %p\n", iface);
2712 
2713     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
2714         return (ID3D10EffectRasterizerVariable *)This;
2715 
2716     return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable;
2717 }
2718 
2719 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
2720         ID3D10EffectVariable *iface)
2721 {
2722     struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2723 
2724     TRACE("iface %p\n", iface);
2725 
2726     if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
2727         return (ID3D10EffectSamplerVariable *)This;
2728 
2729     return (ID3D10EffectSamplerVariable *)&null_sampler_variable;
2730 }
2731 
2732 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
2733         void *data, UINT offset, UINT count)
2734 {
2735     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2736 
2737     return E_NOTIMPL;
2738 }
2739 
2740 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
2741         void *data, UINT offset, UINT count)
2742 {
2743     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2744 
2745     return E_NOTIMPL;
2746 }
2747 
2748 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
2749 {
2750     /* ID3D10EffectVariable methods */
2751     d3d10_effect_variable_IsValid,
2752     d3d10_effect_variable_GetType,
2753     d3d10_effect_variable_GetDesc,
2754     d3d10_effect_variable_GetAnnotationByIndex,
2755     d3d10_effect_variable_GetAnnotationByName,
2756     d3d10_effect_variable_GetMemberByIndex,
2757     d3d10_effect_variable_GetMemberByName,
2758     d3d10_effect_variable_GetMemberBySemantic,
2759     d3d10_effect_variable_GetElement,
2760     d3d10_effect_variable_GetParentConstantBuffer,
2761     d3d10_effect_variable_AsScalar,
2762     d3d10_effect_variable_AsVector,
2763     d3d10_effect_variable_AsMatrix,
2764     d3d10_effect_variable_AsString,
2765     d3d10_effect_variable_AsShaderResource,
2766     d3d10_effect_variable_AsRenderTargetView,
2767     d3d10_effect_variable_AsDepthStencilView,
2768     d3d10_effect_variable_AsConstantBuffer,
2769     d3d10_effect_variable_AsShader,
2770     d3d10_effect_variable_AsBlend,
2771     d3d10_effect_variable_AsDepthStencil,
2772     d3d10_effect_variable_AsRasterizer,
2773     d3d10_effect_variable_AsSampler,
2774     d3d10_effect_variable_SetRawValue,
2775     d3d10_effect_variable_GetRawValue,
2776 };
2777 
2778 /* ID3D10EffectVariable methods */
2779 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
2780 {
2781     TRACE("iface %p\n", iface);
2782 
2783     return (struct d3d10_effect_variable *)iface != &null_local_buffer;
2784 }
2785 
2786 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
2787 {
2788     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
2789 }
2790 
2791 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
2792         D3D10_EFFECT_VARIABLE_DESC *desc)
2793 {
2794     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
2795 }
2796 
2797 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
2798         ID3D10EffectConstantBuffer *iface, UINT index)
2799 {
2800     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
2801 }
2802 
2803 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
2804         ID3D10EffectConstantBuffer *iface, LPCSTR name)
2805 {
2806     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
2807 }
2808 
2809 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
2810         ID3D10EffectConstantBuffer *iface, UINT index)
2811 {
2812     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
2813 }
2814 
2815 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
2816         ID3D10EffectConstantBuffer *iface, LPCSTR name)
2817 {
2818     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
2819 }
2820 
2821 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
2822         ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
2823 {
2824     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
2825 }
2826 
2827 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
2828         ID3D10EffectConstantBuffer *iface, UINT index)
2829 {
2830     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
2831 }
2832 
2833 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
2834         ID3D10EffectConstantBuffer *iface)
2835 {
2836     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
2837 }
2838 
2839 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
2840         ID3D10EffectConstantBuffer *iface)
2841 {
2842     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
2843 }
2844 
2845 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
2846         ID3D10EffectConstantBuffer *iface)
2847 {
2848     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
2849 }
2850 
2851 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
2852         ID3D10EffectConstantBuffer *iface)
2853 {
2854     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
2855 }
2856 
2857 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
2858         ID3D10EffectConstantBuffer *iface)
2859 {
2860     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
2861 }
2862 
2863 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
2864         ID3D10EffectConstantBuffer *iface)
2865 {
2866     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
2867 }
2868 
2869 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
2870         ID3D10EffectConstantBuffer *iface)
2871 {
2872     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
2873 }
2874 
2875 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
2876         ID3D10EffectConstantBuffer *iface)
2877 {
2878     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
2879 }
2880 
2881 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
2882         ID3D10EffectConstantBuffer *iface)
2883 {
2884     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
2885 }
2886 
2887 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
2888         ID3D10EffectConstantBuffer *iface)
2889 {
2890     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
2891 }
2892 
2893 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
2894 {
2895     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
2896 }
2897 
2898 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
2899         ID3D10EffectConstantBuffer *iface)
2900 {
2901     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
2902 }
2903 
2904 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
2905         ID3D10EffectConstantBuffer *iface)
2906 {
2907     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
2908 }
2909 
2910 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
2911         ID3D10EffectConstantBuffer *iface)
2912 {
2913     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
2914 }
2915 
2916 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
2917         void *data, UINT offset, UINT count)
2918 {
2919     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2920 }
2921 
2922 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
2923         void *data, UINT offset, UINT count)
2924 {
2925     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2926 }
2927 
2928 /* ID3D10EffectConstantBuffer methods */
2929 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2930         ID3D10Buffer *buffer)
2931 {
2932     FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2933 
2934     return E_NOTIMPL;
2935 }
2936 
2937 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2938         ID3D10Buffer **buffer)
2939 {
2940     FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2941 
2942     return E_NOTIMPL;
2943 }
2944 
2945 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2946         ID3D10ShaderResourceView *view)
2947 {
2948     FIXME("iface %p, view %p stub!\n", iface, view);
2949 
2950     return E_NOTIMPL;
2951 }
2952 
2953 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2954         ID3D10ShaderResourceView **view)
2955 {
2956     FIXME("iface %p, view %p stub!\n", iface, view);
2957 
2958     return E_NOTIMPL;
2959 }
2960 
2961 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
2962 {
2963     /* ID3D10EffectVariable methods */
2964     d3d10_effect_constant_buffer_IsValid,
2965     d3d10_effect_constant_buffer_GetType,
2966     d3d10_effect_constant_buffer_GetDesc,
2967     d3d10_effect_constant_buffer_GetAnnotationByIndex,
2968     d3d10_effect_constant_buffer_GetAnnotationByName,
2969     d3d10_effect_constant_buffer_GetMemberByIndex,
2970     d3d10_effect_constant_buffer_GetMemberByName,
2971     d3d10_effect_constant_buffer_GetMemberBySemantic,
2972     d3d10_effect_constant_buffer_GetElement,
2973     d3d10_effect_constant_buffer_GetParentConstantBuffer,
2974     d3d10_effect_constant_buffer_AsScalar,
2975     d3d10_effect_constant_buffer_AsVector,
2976     d3d10_effect_constant_buffer_AsMatrix,
2977     d3d10_effect_constant_buffer_AsString,
2978     d3d10_effect_constant_buffer_AsShaderResource,
2979     d3d10_effect_constant_buffer_AsRenderTargetView,
2980     d3d10_effect_constant_buffer_AsDepthStencilView,
2981     d3d10_effect_constant_buffer_AsConstantBuffer,
2982     d3d10_effect_constant_buffer_AsShader,
2983     d3d10_effect_constant_buffer_AsBlend,
2984     d3d10_effect_constant_buffer_AsDepthStencil,
2985     d3d10_effect_constant_buffer_AsRasterizer,
2986     d3d10_effect_constant_buffer_AsSampler,
2987     d3d10_effect_constant_buffer_SetRawValue,
2988     d3d10_effect_constant_buffer_GetRawValue,
2989     /* ID3D10EffectConstantBuffer methods */
2990     d3d10_effect_constant_buffer_SetConstantBuffer,
2991     d3d10_effect_constant_buffer_GetConstantBuffer,
2992     d3d10_effect_constant_buffer_SetTextureBuffer,
2993     d3d10_effect_constant_buffer_GetTextureBuffer,
2994 };
2995 
2996 /* ID3D10EffectVariable methods */
2997 
2998 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
2999 {
3000     TRACE("iface %p\n", iface);
3001 
3002     return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3003 }
3004 
3005 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3006         ID3D10EffectScalarVariable *iface)
3007 {
3008     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3009 }
3010 
3011 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3012         D3D10_EFFECT_VARIABLE_DESC *desc)
3013 {
3014     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3015 }
3016 
3017 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3018         ID3D10EffectScalarVariable *iface, UINT index)
3019 {
3020     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3021 }
3022 
3023 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3024         ID3D10EffectScalarVariable *iface, LPCSTR name)
3025 {
3026     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3027 }
3028 
3029 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3030         ID3D10EffectScalarVariable *iface, UINT index)
3031 {
3032     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3033 }
3034 
3035 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3036         ID3D10EffectScalarVariable *iface, LPCSTR name)
3037 {
3038     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3039 }
3040 
3041 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3042         ID3D10EffectScalarVariable *iface, LPCSTR semantic)
3043 {
3044     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3045 }
3046 
3047 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3048         ID3D10EffectScalarVariable *iface, UINT index)
3049 {
3050     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3051 }
3052 
3053 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3054         ID3D10EffectScalarVariable *iface)
3055 {
3056     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3057 }
3058 
3059 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3060         ID3D10EffectScalarVariable *iface)
3061 {
3062     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3063 }
3064 
3065 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3066         ID3D10EffectScalarVariable *iface)
3067 {
3068     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3069 }
3070 
3071 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3072         ID3D10EffectScalarVariable *iface)
3073 {
3074     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3075 }
3076 
3077 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3078         ID3D10EffectScalarVariable *iface)
3079 {
3080     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3081 }
3082 
3083 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3084         ID3D10EffectScalarVariable *iface)
3085 {
3086     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3087 }
3088 
3089 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3090         ID3D10EffectScalarVariable *iface)
3091 {
3092     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3093 }
3094 
3095 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3096         ID3D10EffectScalarVariable *iface)
3097 {
3098     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3099 }
3100 
3101 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3102         ID3D10EffectScalarVariable *iface)
3103 {
3104     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3105 }
3106 
3107 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3108         ID3D10EffectScalarVariable *iface)
3109 {
3110     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3111 }
3112 
3113 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3114         ID3D10EffectScalarVariable *iface)
3115 {
3116     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3117 }
3118 
3119 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3120         ID3D10EffectScalarVariable *iface)
3121 {
3122     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3123 }
3124 
3125 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3126         ID3D10EffectScalarVariable *iface)
3127 {
3128     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3129 }
3130 
3131 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3132         ID3D10EffectScalarVariable *iface)
3133 {
3134     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3135 }
3136 
3137 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3138         void *data, UINT offset, UINT count)
3139 {
3140     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3141 }
3142 
3143 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3144         void *data, UINT offset, UINT count)
3145 {
3146     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3147 }
3148 
3149 /* ID3D10EffectScalarVariable methods */
3150 
3151 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3152         float value)
3153 {
3154     FIXME("iface %p, value %.8e stub!\n", iface, value);
3155 
3156     return E_NOTIMPL;
3157 }
3158 
3159 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3160         float *value)
3161 {
3162     FIXME("iface %p, value %p stub!\n", iface, value);
3163 
3164     return E_NOTIMPL;
3165 }
3166 
3167 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3168         float *values, UINT offset, UINT count)
3169 {
3170     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3171 
3172     return E_NOTIMPL;
3173 }
3174 
3175 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
3176         float *values, UINT offset, UINT count)
3177 {
3178     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3179 
3180     return E_NOTIMPL;
3181 }
3182 
3183 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
3184         int value)
3185 {
3186     FIXME("iface %p, value %d stub!\n", iface, value);
3187 
3188     return E_NOTIMPL;
3189 }
3190 
3191 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3192         int *value)
3193 {
3194     FIXME("iface %p, value %p stub!\n", iface, value);
3195 
3196     return E_NOTIMPL;
3197 }
3198 
3199 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3200         int *values, UINT offset, UINT count)
3201 {
3202     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3203 
3204     return E_NOTIMPL;
3205 }
3206 
3207 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3208         int *values, UINT offset, UINT count)
3209 {
3210     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3211 
3212     return E_NOTIMPL;
3213 }
3214 
3215 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3216         BOOL value)
3217 {
3218     FIXME("iface %p, value %d stub!\n", iface, value);
3219 
3220     return E_NOTIMPL;
3221 }
3222 
3223 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3224         BOOL *value)
3225 {
3226     FIXME("iface %p, value %p stub!\n", iface, value);
3227 
3228     return E_NOTIMPL;
3229 }
3230 
3231 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
3232         BOOL *values, UINT offset, UINT count)
3233 {
3234     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3235 
3236     return E_NOTIMPL;
3237 }
3238 
3239 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
3240         BOOL *values, UINT offset, UINT count)
3241 {
3242     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3243 
3244     return E_NOTIMPL;
3245 }
3246 
3247 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
3248 {
3249     /* ID3D10EffectVariable methods */
3250     d3d10_effect_scalar_variable_IsValid,
3251     d3d10_effect_scalar_variable_GetType,
3252     d3d10_effect_scalar_variable_GetDesc,
3253     d3d10_effect_scalar_variable_GetAnnotationByIndex,
3254     d3d10_effect_scalar_variable_GetAnnotationByName,
3255     d3d10_effect_scalar_variable_GetMemberByIndex,
3256     d3d10_effect_scalar_variable_GetMemberByName,
3257     d3d10_effect_scalar_variable_GetMemberBySemantic,
3258     d3d10_effect_scalar_variable_GetElement,
3259     d3d10_effect_scalar_variable_GetParentConstantBuffer,
3260     d3d10_effect_scalar_variable_AsScalar,
3261     d3d10_effect_scalar_variable_AsVector,
3262     d3d10_effect_scalar_variable_AsMatrix,
3263     d3d10_effect_scalar_variable_AsString,
3264     d3d10_effect_scalar_variable_AsShaderResource,
3265     d3d10_effect_scalar_variable_AsRenderTargetView,
3266     d3d10_effect_scalar_variable_AsDepthStencilView,
3267     d3d10_effect_scalar_variable_AsConstantBuffer,
3268     d3d10_effect_scalar_variable_AsShader,
3269     d3d10_effect_scalar_variable_AsBlend,
3270     d3d10_effect_scalar_variable_AsDepthStencil,
3271     d3d10_effect_scalar_variable_AsRasterizer,
3272     d3d10_effect_scalar_variable_AsSampler,
3273     d3d10_effect_scalar_variable_SetRawValue,
3274     d3d10_effect_scalar_variable_GetRawValue,
3275     /* ID3D10EffectScalarVariable methods */
3276     d3d10_effect_scalar_variable_SetFloat,
3277     d3d10_effect_scalar_variable_GetFloat,
3278     d3d10_effect_scalar_variable_SetFloatArray,
3279     d3d10_effect_scalar_variable_GetFloatArray,
3280     d3d10_effect_scalar_variable_SetInt,
3281     d3d10_effect_scalar_variable_GetInt,
3282     d3d10_effect_scalar_variable_SetIntArray,
3283     d3d10_effect_scalar_variable_GetIntArray,
3284     d3d10_effect_scalar_variable_SetBool,
3285     d3d10_effect_scalar_variable_GetBool,
3286     d3d10_effect_scalar_variable_SetBoolArray,
3287     d3d10_effect_scalar_variable_GetBoolArray,
3288 };
3289 
3290 /* ID3D10EffectVariable methods */
3291 
3292 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
3293 {
3294     TRACE("iface %p\n", iface);
3295 
3296     return (struct d3d10_effect_variable *)iface != &null_vector_variable;
3297 }
3298 
3299 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
3300         ID3D10EffectVectorVariable *iface)
3301 {
3302     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3303 }
3304 
3305 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
3306         D3D10_EFFECT_VARIABLE_DESC *desc)
3307 {
3308     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3309 }
3310 
3311 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
3312         ID3D10EffectVectorVariable *iface, UINT index)
3313 {
3314     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3315 }
3316 
3317 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
3318         ID3D10EffectVectorVariable *iface, LPCSTR name)
3319 {
3320     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3321 }
3322 
3323 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
3324         ID3D10EffectVectorVariable *iface, UINT index)
3325 {
3326     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3327 }
3328 
3329 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
3330         ID3D10EffectVectorVariable *iface, LPCSTR name)
3331 {
3332     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3333 }
3334 
3335 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
3336         ID3D10EffectVectorVariable *iface, LPCSTR semantic)
3337 {
3338     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3339 }
3340 
3341 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
3342         ID3D10EffectVectorVariable *iface, UINT index)
3343 {
3344     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3345 }
3346 
3347 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
3348         ID3D10EffectVectorVariable *iface)
3349 {
3350     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3351 }
3352 
3353 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
3354         ID3D10EffectVectorVariable *iface)
3355 {
3356     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3357 }
3358 
3359 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
3360         ID3D10EffectVectorVariable *iface)
3361 {
3362     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3363 }
3364 
3365 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
3366         ID3D10EffectVectorVariable *iface)
3367 {
3368     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3369 }
3370 
3371 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
3372         ID3D10EffectVectorVariable *iface)
3373 {
3374     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3375 }
3376 
3377 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
3378         ID3D10EffectVectorVariable *iface)
3379 {
3380     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3381 }
3382 
3383 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
3384         ID3D10EffectVectorVariable *iface)
3385 {
3386     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3387 }
3388 
3389 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
3390         ID3D10EffectVectorVariable *iface)
3391 {
3392     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3393 }
3394 
3395 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
3396         ID3D10EffectVectorVariable *iface)
3397 {
3398     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3399 }
3400 
3401 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
3402         ID3D10EffectVectorVariable *iface)
3403 {
3404     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3405 }
3406 
3407 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
3408         ID3D10EffectVectorVariable *iface)
3409 {
3410     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3411 }
3412 
3413 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
3414         ID3D10EffectVectorVariable *iface)
3415 {
3416     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3417 }
3418 
3419 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
3420         ID3D10EffectVectorVariable *iface)
3421 {
3422     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3423 }
3424 
3425 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
3426         ID3D10EffectVectorVariable *iface)
3427 {
3428     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3429 }
3430 
3431 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
3432         void *data, UINT offset, UINT count)
3433 {
3434     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3435 }
3436 
3437 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
3438         void *data, UINT offset, UINT count)
3439 {
3440     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3441 }
3442 
3443 /* ID3D10EffectVectorVariable methods */
3444 
3445 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
3446         BOOL *value)
3447 {
3448     FIXME("iface %p, value %p stub!\n", iface, value);
3449 
3450     return E_NOTIMPL;
3451 }
3452 
3453 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
3454         int *value)
3455 {
3456     FIXME("iface %p, value %p stub!\n", iface, value);
3457 
3458     return E_NOTIMPL;
3459 }
3460 
3461 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
3462         float *value)
3463 {
3464     FIXME("iface %p, value %p stub!\n", iface, value);
3465 
3466     return E_NOTIMPL;
3467 }
3468 
3469 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
3470         BOOL *value)
3471 {
3472     FIXME("iface %p, value %p stub!\n", iface, value);
3473 
3474     return E_NOTIMPL;
3475 }
3476 
3477 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
3478         int *value)
3479 {
3480     FIXME("iface %p, value %p stub!\n", iface, value);
3481 
3482     return E_NOTIMPL;
3483 }
3484 
3485 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
3486         float *value)
3487 {
3488     FIXME("iface %p, value %p stub!\n", iface, value);
3489 
3490     return E_NOTIMPL;
3491 }
3492 
3493 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3494         BOOL *values, UINT offset, UINT count)
3495 {
3496     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3497 
3498     return E_NOTIMPL;
3499 }
3500 
3501 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
3502         int *values, UINT offset, UINT count)
3503 {
3504     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3505 
3506     return E_NOTIMPL;
3507 }
3508 
3509 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3510         float *values, UINT offset, UINT count)
3511 {
3512     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3513 
3514     return E_NOTIMPL;
3515 }
3516 
3517 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3518         BOOL *values, UINT offset, UINT count)
3519 {
3520     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3521 
3522     return E_NOTIMPL;
3523 }
3524 
3525 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
3526         int *values, UINT offset, UINT count)
3527 {
3528     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3529 
3530     return E_NOTIMPL;
3531 }
3532 
3533 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3534         float *values, UINT offset, UINT count)
3535 {
3536     FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3537 
3538     return E_NOTIMPL;
3539 }
3540 
3541 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
3542 {
3543     /* ID3D10EffectVariable methods */
3544     d3d10_effect_vector_variable_IsValid,
3545     d3d10_effect_vector_variable_GetType,
3546     d3d10_effect_vector_variable_GetDesc,
3547     d3d10_effect_vector_variable_GetAnnotationByIndex,
3548     d3d10_effect_vector_variable_GetAnnotationByName,
3549     d3d10_effect_vector_variable_GetMemberByIndex,
3550     d3d10_effect_vector_variable_GetMemberByName,
3551     d3d10_effect_vector_variable_GetMemberBySemantic,
3552     d3d10_effect_vector_variable_GetElement,
3553     d3d10_effect_vector_variable_GetParentConstantBuffer,
3554     d3d10_effect_vector_variable_AsScalar,
3555     d3d10_effect_vector_variable_AsVector,
3556     d3d10_effect_vector_variable_AsMatrix,
3557     d3d10_effect_vector_variable_AsString,
3558     d3d10_effect_vector_variable_AsShaderResource,
3559     d3d10_effect_vector_variable_AsRenderTargetView,
3560     d3d10_effect_vector_variable_AsDepthStencilView,
3561     d3d10_effect_vector_variable_AsConstantBuffer,
3562     d3d10_effect_vector_variable_AsShader,
3563     d3d10_effect_vector_variable_AsBlend,
3564     d3d10_effect_vector_variable_AsDepthStencil,
3565     d3d10_effect_vector_variable_AsRasterizer,
3566     d3d10_effect_vector_variable_AsSampler,
3567     d3d10_effect_vector_variable_SetRawValue,
3568     d3d10_effect_vector_variable_GetRawValue,
3569     /* ID3D10EffectVectorVariable methods */
3570     d3d10_effect_vector_variable_SetBoolVector,
3571     d3d10_effect_vector_variable_SetIntVector,
3572     d3d10_effect_vector_variable_SetFloatVector,
3573     d3d10_effect_vector_variable_GetBoolVector,
3574     d3d10_effect_vector_variable_GetIntVector,
3575     d3d10_effect_vector_variable_GetFloatVector,
3576     d3d10_effect_vector_variable_SetBoolVectorArray,
3577     d3d10_effect_vector_variable_SetIntVectorArray,
3578     d3d10_effect_vector_variable_SetFloatVectorArray,
3579     d3d10_effect_vector_variable_GetBoolVectorArray,
3580     d3d10_effect_vector_variable_GetIntVectorArray,
3581     d3d10_effect_vector_variable_GetFloatVectorArray,
3582 };
3583 
3584 /* ID3D10EffectVariable methods */
3585 
3586 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
3587 {
3588     TRACE("iface %p\n", iface);
3589 
3590     return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
3591 }
3592 
3593 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
3594         ID3D10EffectMatrixVariable *iface)
3595 {
3596     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3597 }
3598 
3599 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
3600         D3D10_EFFECT_VARIABLE_DESC *desc)
3601 {
3602     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3603 }
3604 
3605 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
3606         ID3D10EffectMatrixVariable *iface, UINT index)
3607 {
3608     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3609 }
3610 
3611 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
3612         ID3D10EffectMatrixVariable *iface, LPCSTR name)
3613 {
3614     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3615 }
3616 
3617 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
3618         ID3D10EffectMatrixVariable *iface, UINT index)
3619 {
3620     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3621 }
3622 
3623 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
3624         ID3D10EffectMatrixVariable *iface, LPCSTR name)
3625 {
3626     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3627 }
3628 
3629 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
3630         ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
3631 {
3632     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3633 }
3634 
3635 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
3636         ID3D10EffectMatrixVariable *iface, UINT index)
3637 {
3638     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3639 }
3640 
3641 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
3642         ID3D10EffectMatrixVariable *iface)
3643 {
3644     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3645 }
3646 
3647 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
3648         ID3D10EffectMatrixVariable *iface)
3649 {
3650     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3651 }
3652 
3653 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
3654         ID3D10EffectMatrixVariable *iface)
3655 {
3656     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3657 }
3658 
3659 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
3660         ID3D10EffectMatrixVariable *iface)
3661 {
3662     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3663 }
3664 
3665 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
3666         ID3D10EffectMatrixVariable *iface)
3667 {
3668     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3669 }
3670 
3671 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
3672         ID3D10EffectMatrixVariable *iface)
3673 {
3674     return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3675 }
3676 
3677 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
3678         ID3D10EffectMatrixVariable *iface)
3679 {
3680     return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3681 }
3682 
3683 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
3684         ID3D10EffectMatrixVariable *iface)
3685 {
3686     return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3687 }
3688 
3689 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
3690         ID3D10EffectMatrixVariable *iface)
3691 {
3692     return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3693 }
3694 
3695 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
3696         ID3D10EffectMatrixVariable *iface)
3697 {
3698     return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3699 }
3700 
3701 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
3702         ID3D10EffectMatrixVariable *iface)
3703 {
3704     return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3705 }
3706 
3707 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
3708         ID3D10EffectMatrixVariable *iface)
3709 {
3710     return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3711 }
3712 
3713 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
3714         ID3D10EffectMatrixVariable *iface)
3715 {
3716     return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3717 }
3718 
3719 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
3720         ID3D10EffectMatrixVariable *iface)
3721 {
3722     return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3723 }
3724 
3725 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
3726         void *data, UINT offset, UINT count)
3727 {
3728     return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3729 }
3730 
3731 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
3732         void *data, UINT offset, UINT count)
3733 {
3734     return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3735 }
3736 
3737 /* ID3D10EffectMatrixVariable methods */
3738 
3739 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
3740         float *data)
3741 {
3742     FIXME("iface %p, data %p stub!\n", iface, data);
3743 
3744     return E_NOTIMPL;
3745 }
3746 
3747 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
3748         float *data)
3749 {
3750     FIXME("iface %p, data %p stub!\n", iface, data);
3751 
3752     return E_NOTIMPL;
3753 }
3754 
3755 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
3756         float *data, UINT offset, UINT count)
3757 {
3758     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3759 
3760     return E_NOTIMPL;
3761 }
3762 
3763 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
3764         float *data, UINT offset, UINT count)
3765 {
3766     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3767 
3768     return E_NOTIMPL;
3769 }
3770 
3771 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3772         float *data)
3773 {
3774     FIXME("iface %p, data %p stub!\n", iface, data);
3775 
3776     return E_NOTIMPL;
3777 }
3778 
3779 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3780         float *data)
3781 {
3782     FIXME("iface %p, data %p stub!\n", iface, data);
3783 
3784     return E_NOTIMPL;
3785 }
3786 
3787 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3788         float *data, UINT offset, UINT count)
3789 {
3790     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3791 
3792     return E_NOTIMPL;
3793 }
3794 
3795 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3796         float *data, UINT offset, UINT count)
3797 {
3798     FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3799 
3800     return E_NOTIMPL;
3801 }
3802 
3803 
3804 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
3805 {
3806     /* ID3D10EffectVariable methods */
3807     d3d10_effect_matrix_variable_IsValid,
3808     d3d10_effect_matrix_variable_GetType,
3809     d3d10_effect_matrix_variable_GetDesc,
3810     d3d10_effect_matrix_variable_GetAnnotationByIndex,
3811     d3d10_effect_matrix_variable_GetAnnotationByName,
3812     d3d10_effect_matrix_variable_GetMemberByIndex,
3813     d3d10_effect_matrix_variable_GetMemberByName,
3814     d3d10_effect_matrix_variable_GetMemberBySemantic,
3815     d3d10_effect_matrix_variable_GetElement,
3816     d3d10_effect_matrix_variable_GetParentConstantBuffer,
3817     d3d10_effect_matrix_variable_AsScalar,
3818     d3d10_effect_matrix_variable_AsVector,
3819     d3d10_effect_matrix_variable_AsMatrix,
3820     d3d10_effect_matrix_variable_AsString,
3821     d3d10_effect_matrix_variable_AsShaderResource,
3822     d3d10_effect_matrix_variable_AsRenderTargetView,
3823     d3d10_effect_matrix_variable_AsDepthStencilView,
3824     d3d10_effect_matrix_variable_AsConstantBuffer,
3825     d3d10_effect_matrix_variable_AsShader,
3826     d3d10_effect_matrix_variable_AsBlend,
3827     d3d10_effect_matrix_variable_AsDepthStencil,
3828     d3d10_effect_matrix_variable_AsRasterizer,
3829     d3d10_effect_matrix_variable_AsSampler,
3830     d3d10_effect_matrix_variable_SetRawValue,
3831     d3d10_effect_matrix_variable_GetRawValue,
3832     /* ID3D10EffectMatrixVariable methods */
3833     d3d10_effect_matrix_variable_SetMatrix,
3834     d3d10_effect_matrix_variable_GetMatrix,
3835     d3d10_effect_matrix_variable_SetMatrixArray,
3836     d3d10_effect_matrix_variable_GetMatrixArray,
3837     d3d10_effect_matrix_variable_SetMatrixTranspose,
3838     d3d10_effect_matrix_variable_GetMatrixTranspose,
3839     d3d10_effect_matrix_variable_SetMatrixTransposeArray,
3840     d3d10_effect_matrix_variable_GetMatrixTransposeArray,
3841 };
3842 
3843 /* ID3D10EffectVariable methods */
3844 
3845 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
3846 {
3847     TRACE("iface %p\n", iface);
3848 
3849     return (struct d3d10_effect_variable *)iface != &null_string_variable;
3850 }
3851 
3852 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
3853         ID3D10EffectStringVariable *iface)
3854 {
3855     return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3856 }
3857 
3858 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
3859         D3D10_EFFECT_VARIABLE_DESC *desc)
3860 {
3861     return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3862 }
3863 
3864 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
3865         ID3D10EffectStringVariable *iface, UINT index)
3866 {
3867     return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3868 }
3869 
3870 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
3871         ID3D10EffectStringVariable *iface, LPCSTR name)
3872 {
3873     return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3874 }
3875 
3876 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
3877         ID3D10EffectStringVariable *iface, UINT index)
3878 {
3879     return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3880 }
3881 
3882 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
3883         ID3D10EffectStringVariable *iface, LPCSTR name)
3884 {
3885     return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3886 }
3887 
3888 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
3889         ID3D10EffectStringVariable *iface, LPCSTR semantic)
3890 {
3891     return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3892 }
3893 
3894 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
3895         ID3D10EffectStringVariable *iface, UINT index)
3896 {
3897     return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3898 }
3899 
3900 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
3901         ID3D10EffectStringVariable *iface)
3902 {
3903     return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3904 }
3905 
3906 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
3907         ID3D10EffectStringVariable *iface)
3908 {
3909     return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3910 }
3911 
3912 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
3913         ID3D10EffectStringVariable *iface)
3914 {
3915     return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3916 }
3917 
3918 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
3919         ID3D10EffectStringVariable *iface)
3920 {
3921     return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3922 }
3923 
3924 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
3925         ID3D10EffectStringVariable *iface)
3926 {
3927     return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
<