2 * Copyright 2009 Henri Verbeet for CodeWeavers
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.
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.
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
21 #include "wine/port.h"
23 #include "d3d10_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
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', '0')
32 #define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
34 #define D3D10_FX10_TYPE_COLUMN_SHIFT 11
35 #define D3D10_FX10_TYPE_COLUMN_MASK (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
37 #define D3D10_FX10_TYPE_ROW_SHIFT 8
38 #define D3D10_FX10_TYPE_ROW_MASK (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
40 #define D3D10_FX10_TYPE_BASETYPE_SHIFT 3
41 #define D3D10_FX10_TYPE_BASETYPE_MASK (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
43 #define D3D10_FX10_TYPE_CLASS_SHIFT 0
44 #define D3D10_FX10_TYPE_CLASS_MASK (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
46 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
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 ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
56 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
58 /* null objects - needed for invalid calls */
59 static struct d3d10_effect_technique null_technique =
60 {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL, NULL};
61 static struct d3d10_effect_pass null_pass =
62 {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL, NULL};
63 static struct d3d10_effect_type null_type =
64 {&d3d10_effect_type_vtbl, 0, {NULL, NULL, 0}, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL};
65 static struct d3d10_effect_variable null_local_buffer =
66 {(ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl, &null_local_buffer,
67 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
68 static struct d3d10_effect_variable null_variable =
69 {&d3d10_effect_variable_vtbl, &null_local_buffer,
70 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
71 static struct d3d10_effect_variable null_scalar_variable =
72 {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, &null_local_buffer,
73 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
74 static struct d3d10_effect_variable null_vector_variable =
75 {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, &null_local_buffer,
76 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
77 static struct d3d10_effect_variable null_matrix_variable =
78 {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, &null_local_buffer,
79 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
80 static struct d3d10_effect_variable null_blend_variable =
81 {(ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl, &null_local_buffer,
82 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
84 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
86 static inline void read_dword(const char **ptr, DWORD *d)
88 memcpy(d, *ptr, sizeof(*d));
92 static inline void skip_dword_unknown(const char **ptr, unsigned int count)
97 FIXME("Skipping %u unknown DWORDs:\n", count);
98 for (i = 0; i < count; ++i)
101 FIXME("\t0x%08x\n", d);
105 static inline void write_dword(char **ptr, DWORD d)
107 memcpy(*ptr, &d, sizeof(d));
111 static inline void write_dword_unknown(char **ptr, DWORD d)
113 FIXME("Writing unknown DWORD 0x%08x\n", d);
117 static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
118 HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx)
120 const char *ptr = data;
127 read_dword(&ptr, &tag);
128 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
132 WARN("Wrong tag.\n");
137 skip_dword_unknown(&ptr, 4);
139 skip_dword_unknown(&ptr, 1);
141 read_dword(&ptr, &total_size);
142 TRACE("total size: %#x\n", total_size);
144 read_dword(&ptr, &chunk_count);
145 TRACE("chunk count: %#x\n", chunk_count);
147 for (i = 0; i < chunk_count; ++i)
149 DWORD chunk_tag, chunk_size;
150 const char *chunk_ptr;
153 read_dword(&ptr, &chunk_offset);
154 TRACE("chunk %u at offset %#x\n", i, chunk_offset);
156 chunk_ptr = data + chunk_offset;
158 read_dword(&chunk_ptr, &chunk_tag);
159 read_dword(&chunk_ptr, &chunk_size);
161 hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx);
162 if (FAILED(hr)) break;
168 static BOOL copy_name(const char *ptr, char **name)
172 if (!ptr) return TRUE;
174 name_len = strlen(ptr) + 1;
180 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
183 ERR("Failed to allocate name memory.\n");
187 memcpy(*name, ptr, name_len);
192 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
194 struct d3d10_effect_shader_variable *s = ctx;
196 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
198 TRACE("chunk size: %#x\n", data_size);
204 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
205 UINT size = 44 + data_size;
208 s->input_signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
209 if (!s->input_signature)
211 ERR("Failed to allocate input signature data\n");
212 return E_OUTOFMEMORY;
214 s->input_signature_size = size;
216 ptr = s->input_signature;
218 write_dword(&ptr, TAG_DXBC);
221 write_dword_unknown(&ptr, 0);
222 write_dword_unknown(&ptr, 0);
223 write_dword_unknown(&ptr, 0);
224 write_dword_unknown(&ptr, 0);
226 /* seems to be always 1 */
227 write_dword_unknown(&ptr, 1);
230 write_dword(&ptr, size);
233 write_dword(&ptr, 1);
236 write_dword(&ptr, (ptr - s->input_signature) + 4);
239 write_dword(&ptr, TAG_ISGN);
240 write_dword(&ptr, data_size);
241 memcpy(ptr, data, data_size);
246 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
253 static HRESULT parse_shader(struct d3d10_effect_object *o, const char *data)
255 ID3D10Device *device = o->pass->technique->effect->device;
256 struct d3d10_effect_shader_variable *s;
257 const char *ptr = data;
261 o->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3d10_effect_shader_variable));
264 ERR("Failed to allocate shader variable memory\n");
265 return E_OUTOFMEMORY;
268 if (!ptr) return S_OK;
272 read_dword(&ptr, &dxbc_size);
273 TRACE("dxbc size: %#x\n", dxbc_size);
277 case D3D10_EOT_VERTEXSHADER:
278 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
279 if (FAILED(hr)) return hr;
282 case D3D10_EOT_PIXELSHADER:
283 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
284 if (FAILED(hr)) return hr;
286 case D3D10_EOT_GEOMETRYSHADER:
287 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
288 if (FAILED(hr)) return hr;
292 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
295 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
299 case 1: return D3D10_SVC_SCALAR;
300 case 2: return D3D10_SVC_VECTOR;
301 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
302 else return D3D10_SVC_MATRIX_ROWS;
304 FIXME("Unknown variable class %#x.\n", c);
309 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
315 case 1: return D3D10_SVT_STRING;
316 case 2: return D3D10_SVT_BLEND;
317 case 3: return D3D10_SVT_DEPTHSTENCIL;
318 case 4: return D3D10_SVT_RASTERIZER;
319 case 5: return D3D10_SVT_PIXELSHADER;
320 case 6: return D3D10_SVT_VERTEXSHADER;
321 case 7: return D3D10_SVT_GEOMETRYSHADER;
323 case 10: return D3D10_SVT_TEXTURE1D;
324 case 11: return D3D10_SVT_TEXTURE1DARRAY;
325 case 12: return D3D10_SVT_TEXTURE2D;
326 case 13: return D3D10_SVT_TEXTURE2DARRAY;
327 case 14: return D3D10_SVT_TEXTURE2DMS;
328 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
329 case 16: return D3D10_SVT_TEXTURE3D;
330 case 17: return D3D10_SVT_TEXTURECUBE;
332 case 19: return D3D10_SVT_RENDERTARGETVIEW;
333 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
334 case 21: return D3D10_SVT_SAMPLER;
336 FIXME("Unknown variable type %#x.\n", t);
344 case 1: return D3D10_SVT_FLOAT;
345 case 2: return D3D10_SVT_INT;
346 case 3: return D3D10_SVT_UINT;
347 case 4: return D3D10_SVT_BOOL;
349 FIXME("Unknown variable type %#x.\n", t);
355 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
362 read_dword(&ptr, &offset);
363 TRACE("Type name at offset %#x.\n", offset);
365 if (!copy_name(data + offset, &t->name))
367 ERR("Failed to copy name.\n");
368 return E_OUTOFMEMORY;
370 TRACE("Type name: %s.\n", debugstr_a(t->name));
372 read_dword(&ptr, &unknown0);
373 TRACE("Unknown 0: %u.\n", unknown0);
375 read_dword(&ptr, &t->element_count);
376 TRACE("Element count: %u.\n", t->element_count);
378 read_dword(&ptr, &t->size_unpacked);
379 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
381 read_dword(&ptr, &t->stride);
382 TRACE("Stride: %#x.\n", t->stride);
384 read_dword(&ptr, &t->size_packed);
385 TRACE("Packed size %#x.\n", t->size_packed);
392 read_dword(&ptr, &typeinfo);
393 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
394 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
395 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
396 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);
398 TRACE("Type description: %#x.\n", typeinfo);
399 TRACE("\tcolumns: %u.\n", t->column_count);
400 TRACE("\trows: %u.\n", t->row_count);
401 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
402 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
403 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
404 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
408 TRACE("Type is an object.\n");
413 t->type_class = D3D10_SVC_OBJECT;
415 read_dword(&ptr, &typeinfo);
416 t->basetype = d3d10_variable_type(typeinfo, TRUE);
418 TRACE("Type description: %#x.\n", typeinfo);
419 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
420 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
424 TRACE("Type is a structure.\n");
426 read_dword(&ptr, &t->member_count);
427 TRACE("Member count: %u.\n", t->member_count);
432 t->type_class = D3D10_SVC_STRUCT;
434 t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
437 ERR("Failed to allocate members memory.\n");
438 return E_OUTOFMEMORY;
441 for (i = 0; i < t->member_count; ++i)
443 struct d3d10_effect_type_member *typem = &t->members[i];
445 read_dword(&ptr, &offset);
446 TRACE("Member name at offset %#x.\n", offset);
448 if (!copy_name(data + offset, &typem->name))
450 ERR("Failed to copy name.\n");
451 return E_OUTOFMEMORY;
453 TRACE("Member name: %s.\n", debugstr_a(typem->name));
455 read_dword(&ptr, &offset);
456 TRACE("Member semantic at offset %#x.\n", offset);
458 if (!copy_name(data + offset, &typem->semantic))
460 ERR("Failed to copy semantic.\n");
461 return E_OUTOFMEMORY;
463 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
465 read_dword(&ptr, &typem->buffer_offset);
466 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
468 read_dword(&ptr, &offset);
469 TRACE("Member type info at offset %#x.\n", offset);
471 typem->type = get_fx10_type(t->effect, data, offset);
474 ERR("Failed to get variable type.\n");
481 FIXME("Unhandled case %#x.\n", unknown0);
485 if (t->element_count)
487 TRACE("Elementtype for type at offset: %#x\n", t->id);
489 /* allocate elementtype - we need only one, because all elements have the same type */
490 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
493 ERR("Failed to allocate members memory.\n");
494 return E_OUTOFMEMORY;
497 /* create a copy of the original type with some minor changes */
498 t->elementtype->vtbl = &d3d10_effect_type_vtbl;
499 t->elementtype->effect = t->effect;
501 if (!copy_name(t->name, &t->elementtype->name))
503 ERR("Failed to copy name.\n");
504 return E_OUTOFMEMORY;
506 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
508 t->elementtype->element_count = 0;
509 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
512 * Not sure if this calculation is 100% correct, but a test
513 * show's that these values work.
515 t->elementtype->size_unpacked = t->size_packed / t->element_count;
516 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
518 t->elementtype->stride = t->stride;
519 TRACE("\tStride: %#x.\n", t->elementtype->stride);
521 t->elementtype->size_packed = t->size_packed / t->element_count;
522 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
524 t->elementtype->member_count = t->member_count;
525 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
527 t->elementtype->column_count = t->column_count;
528 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
530 t->elementtype->row_count = t->row_count;
531 TRACE("\tRows: %u.\n", t->elementtype->row_count);
533 t->elementtype->basetype = t->basetype;
534 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
536 t->elementtype->type_class = t->type_class;
537 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
539 t->elementtype->members = t->members;
545 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
547 struct d3d10_effect_type *type;
548 struct wine_rb_entry *entry;
551 entry = wine_rb_get(&effect->types, &offset);
554 TRACE("Returning existing type.\n");
555 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
558 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
561 ERR("Failed to allocate type memory.\n");
565 type->vtbl = &d3d10_effect_type_vtbl;
567 type->effect = effect;
568 hr = parse_fx10_type(type, data + offset, data);
571 ERR("Failed to parse type info, hr %#x.\n", hr);
572 HeapFree(GetProcessHeap(), 0, type);
576 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
578 ERR("Failed to insert type entry.\n");
579 HeapFree(GetProcessHeap(), 0, type);
586 static void set_variable_vtbl(struct d3d10_effect_variable *v)
588 switch (v->type->type_class)
590 case D3D10_SVC_SCALAR:
591 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
594 case D3D10_SVC_VECTOR:
595 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
598 case D3D10_SVC_MATRIX_ROWS:
599 case D3D10_SVC_MATRIX_COLUMNS:
600 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
603 case D3D10_SVC_STRUCT:
604 v->vtbl = &d3d10_effect_variable_vtbl;
608 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
609 v->vtbl = &d3d10_effect_variable_vtbl;
614 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
619 if (v->type->member_count)
621 v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
624 ERR("Failed to allocate members memory.\n");
625 return E_OUTOFMEMORY;
628 for (i = 0; i < v->type->member_count; ++i)
630 struct d3d10_effect_variable *var = &v->members[i];
631 struct d3d10_effect_type_member *typem = &v->type->members[i];
633 var->buffer = v->buffer;
634 var->effect = v->effect;
635 var->type = typem->type;
636 set_variable_vtbl(var);
638 if (!copy_name(typem->name, &var->name))
640 ERR("Failed to copy name.\n");
641 return E_OUTOFMEMORY;
643 TRACE("Variable name: %s.\n", debugstr_a(var->name));
645 if (!copy_name(typem->semantic, &var->semantic))
647 ERR("Failed to copy name.\n");
648 return E_OUTOFMEMORY;
650 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
652 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
653 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
655 hr = copy_variableinfo_from_type(var);
656 if (FAILED(hr)) return hr;
660 if (v->type->element_count)
662 unsigned int bufferoffset = v->buffer_offset;
664 v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
667 ERR("Failed to allocate elements memory.\n");
668 return E_OUTOFMEMORY;
671 for (i = 0; i < v->type->element_count; ++i)
673 struct d3d10_effect_variable *var = &v->elements[i];
675 var->buffer = v->buffer;
676 var->effect = v->effect;
677 var->type = v->type->elementtype;
678 set_variable_vtbl(var);
680 if (!copy_name(v->name, &var->name))
682 ERR("Failed to copy name.\n");
683 return E_OUTOFMEMORY;
685 TRACE("Variable name: %s.\n", debugstr_a(var->name));
687 if (!copy_name(v->semantic, &var->semantic))
689 ERR("Failed to copy name.\n");
690 return E_OUTOFMEMORY;
692 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
696 bufferoffset += v->type->stride;
698 var->buffer_offset = bufferoffset;
699 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
701 hr = copy_variableinfo_from_type(var);
702 if (FAILED(hr)) return hr;
709 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
713 read_dword(ptr, &offset);
714 TRACE("Variable name at offset %#x.\n", offset);
716 if (!copy_name(data + offset, &v->name))
718 ERR("Failed to copy name.\n");
719 return E_OUTOFMEMORY;
721 TRACE("Variable name: %s.\n", debugstr_a(v->name));
723 read_dword(ptr, &offset);
724 TRACE("Variable type info at offset %#x.\n", offset);
726 v->type = get_fx10_type(v->effect, data, offset);
729 ERR("Failed to get variable type.\n");
732 set_variable_vtbl(v);
734 return copy_variableinfo_from_type(v);
737 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
741 hr = parse_fx10_variable_head(a, ptr, data);
742 if (FAILED(hr)) return hr;
744 skip_dword_unknown(ptr, 1);
749 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
751 const char *data_ptr;
755 read_dword(ptr, &o->type);
756 TRACE("Effect object is of type %#x.\n", o->type);
758 skip_dword_unknown(ptr, 2);
760 read_dword(ptr, &offset);
761 TRACE("Effect object idx is at offset %#x.\n", offset);
763 data_ptr = data + offset;
764 read_dword(&data_ptr, &offset);
766 TRACE("Effect object starts at offset %#x.\n", offset);
768 /* FIXME: This probably isn't completely correct. */
771 WARN("Skipping effect object.\n");
776 data_ptr = data + offset;
781 case D3D10_EOT_VERTEXSHADER:
782 TRACE("Vertex shader\n");
783 hr = parse_shader(o, data_ptr);
786 case D3D10_EOT_PIXELSHADER:
787 TRACE("Pixel shader\n");
788 hr = parse_shader(o, data_ptr);
791 case D3D10_EOT_GEOMETRYSHADER:
792 TRACE("Geometry shader\n");
793 hr = parse_shader(o, data_ptr);
797 FIXME("Unhandled object type %#x\n", o->type);
805 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
811 read_dword(ptr, &offset);
812 TRACE("Pass name at offset %#x.\n", offset);
814 if (!copy_name(data + offset, &p->name))
816 ERR("Failed to copy name.\n");
817 return E_OUTOFMEMORY;
819 TRACE("Pass name: %s.\n", debugstr_a(p->name));
821 read_dword(ptr, &p->object_count);
822 TRACE("Pass has %u effect objects.\n", p->object_count);
824 read_dword(ptr, &p->annotation_count);
825 TRACE("Pass has %u annotations.\n", p->annotation_count);
827 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
830 ERR("Failed to allocate pass annotations memory.\n");
831 return E_OUTOFMEMORY;
834 for(i = 0; i < p->annotation_count; ++i)
836 struct d3d10_effect_variable *a = &p->annotations[i];
838 a->effect = p->technique->effect;
840 hr = parse_fx10_annotation(a, ptr, data);
841 if (FAILED(hr)) return hr;
844 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
847 ERR("Failed to allocate effect objects memory.\n");
848 return E_OUTOFMEMORY;
851 for (i = 0; i < p->object_count; ++i)
853 struct d3d10_effect_object *o = &p->objects[i];
857 hr = parse_fx10_object(o, ptr, data);
858 if (FAILED(hr)) return hr;
864 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
870 read_dword(ptr, &offset);
871 TRACE("Technique name at offset %#x.\n", offset);
873 if (!copy_name(data + offset, &t->name))
875 ERR("Failed to copy name.\n");
876 return E_OUTOFMEMORY;
878 TRACE("Technique name: %s.\n", debugstr_a(t->name));
880 read_dword(ptr, &t->pass_count);
881 TRACE("Technique has %u passes\n", t->pass_count);
883 read_dword(ptr, &t->annotation_count);
884 TRACE("Technique has %u annotations.\n", t->annotation_count);
886 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
889 ERR("Failed to allocate technique annotations memory.\n");
890 return E_OUTOFMEMORY;
893 for(i = 0; i < t->annotation_count; ++i)
895 struct d3d10_effect_variable *a = &t->annotations[i];
897 a->effect = t->effect;
899 hr = parse_fx10_annotation(a, ptr, data);
900 if (FAILED(hr)) return hr;
903 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
906 ERR("Failed to allocate passes memory\n");
907 return E_OUTOFMEMORY;
910 for (i = 0; i < t->pass_count; ++i)
912 struct d3d10_effect_pass *p = &t->passes[i];
914 p->vtbl = &d3d10_effect_pass_vtbl;
917 hr = parse_fx10_pass(p, ptr, data);
918 if (FAILED(hr)) return hr;
924 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
930 hr = parse_fx10_variable_head(v, ptr, data);
931 if (FAILED(hr)) return hr;
933 read_dword(ptr, &offset);
934 TRACE("Variable semantic at offset %#x.\n", offset);
936 if (!copy_name(data + offset, &v->semantic))
938 ERR("Failed to copy semantic.\n");
939 return E_OUTOFMEMORY;
941 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
943 read_dword(ptr, &v->buffer_offset);
944 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
946 skip_dword_unknown(ptr, 1);
948 read_dword(ptr, &v->flag);
949 TRACE("Variable flag: %#x.\n", v->flag);
951 read_dword(ptr, &v->annotation_count);
952 TRACE("Variable has %u annotations.\n", v->annotation_count);
954 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
957 ERR("Failed to allocate variable annotations memory.\n");
958 return E_OUTOFMEMORY;
961 for (i = 0; i < v->annotation_count; ++i)
963 struct d3d10_effect_variable *a = &v->annotations[i];
965 a->effect = v->effect;
967 hr = parse_fx10_annotation(a, ptr, data);
968 if (FAILED(hr)) return hr;
974 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
979 hr = parse_fx10_variable_head(v, ptr, data);
980 if (FAILED(hr)) return hr;
982 skip_dword_unknown(ptr, 2);
984 switch (v->type->basetype)
986 case D3D10_SVT_TEXTURE1D:
987 case D3D10_SVT_TEXTURE1DARRAY:
988 case D3D10_SVT_TEXTURE2D:
989 case D3D10_SVT_TEXTURE2DARRAY:
990 case D3D10_SVT_TEXTURE2DMS:
991 case D3D10_SVT_TEXTURE2DMSARRAY:
992 case D3D10_SVT_TEXTURE3D:
993 case D3D10_SVT_TEXTURECUBE:
994 case D3D10_SVT_RENDERTARGETVIEW:
995 case D3D10_SVT_DEPTHSTENCILVIEW:
996 TRACE("SVT could not have elements.\n");
999 case D3D10_SVT_VERTEXSHADER:
1000 case D3D10_SVT_PIXELSHADER:
1001 case D3D10_SVT_GEOMETRYSHADER:
1002 TRACE("SVT is a shader.\n");
1003 for (i = 0; i < max(v->type->element_count, 1); ++i)
1005 DWORD shader_offset;
1008 * TODO: Parse the shader
1010 read_dword(ptr, &shader_offset);
1011 FIXME("Shader offset: %#x.\n", shader_offset);
1015 case D3D10_SVT_DEPTHSTENCIL:
1016 case D3D10_SVT_BLEND:
1017 case D3D10_SVT_RASTERIZER:
1018 case D3D10_SVT_SAMPLER:
1019 TRACE("SVT is a state.\n");
1020 for (i = 0; i < max(v->type->element_count, 1); ++i)
1025 read_dword(ptr, &object_count);
1026 TRACE("Object count: %#x.\n", object_count);
1028 for (j = 0; j < object_count; ++j)
1030 skip_dword_unknown(ptr, 4);
1036 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1040 read_dword(ptr, &v->annotation_count);
1041 TRACE("Variable has %u annotations.\n", v->annotation_count);
1043 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1044 if (!v->annotations)
1046 ERR("Failed to allocate variable annotations memory.\n");
1047 return E_OUTOFMEMORY;
1050 for (i = 0; i < v->annotation_count; ++i)
1052 struct d3d10_effect_variable *a = &v->annotations[i];
1054 a->effect = v->effect;
1056 hr = parse_fx10_annotation(a, ptr, data);
1057 if (FAILED(hr)) return hr;
1063 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1067 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1070 /* Generate our own type, it isn't in the fx blob. */
1071 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1074 ERR("Failed to allocate local buffer type memory.\n");
1075 return E_OUTOFMEMORY;
1077 l->type->vtbl = &d3d10_effect_type_vtbl;
1078 l->type->type_class = D3D10_SVC_OBJECT;
1079 l->type->effect = l->effect;
1081 read_dword(ptr, &offset);
1082 TRACE("Local buffer name at offset %#x.\n", offset);
1084 if (!copy_name(data + offset, &l->name))
1086 ERR("Failed to copy name.\n");
1087 return E_OUTOFMEMORY;
1089 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1091 read_dword(ptr, &l->data_size);
1092 TRACE("Local buffer data size: %#x.\n", l->data_size);
1094 read_dword(ptr, &d3d10_cbuffer_type);
1095 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1097 switch(d3d10_cbuffer_type)
1099 case D3D10_CT_CBUFFER:
1100 l->type->basetype = D3D10_SVT_CBUFFER;
1101 if (!copy_name("cbuffer", &l->type->name))
1103 ERR("Failed to copy name.\n");
1104 return E_OUTOFMEMORY;
1108 case D3D10_CT_TBUFFER:
1109 l->type->basetype = D3D10_SVT_TBUFFER;
1110 if (!copy_name("tbuffer", &l->type->name))
1112 ERR("Failed to copy name.\n");
1113 return E_OUTOFMEMORY;
1118 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1122 read_dword(ptr, &l->type->member_count);
1123 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1125 skip_dword_unknown(ptr, 1);
1127 read_dword(ptr, &l->annotation_count);
1128 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1130 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1131 if (!l->annotations)
1133 ERR("Failed to allocate local buffer annotations memory.\n");
1134 return E_OUTOFMEMORY;
1137 for(i = 0; i < l->annotation_count; ++i)
1139 struct d3d10_effect_variable *a = &l->annotations[i];
1141 a->effect = l->effect;
1143 hr = parse_fx10_annotation(a, ptr, data);
1144 if (FAILED(hr)) return hr;
1147 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1150 ERR("Failed to allocate members memory.\n");
1151 return E_OUTOFMEMORY;
1154 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1155 if (!l->type->members)
1157 ERR("Failed to allocate type members memory.\n");
1158 return E_OUTOFMEMORY;
1161 for (i = 0; i < l->type->member_count; ++i)
1163 struct d3d10_effect_variable *v = &l->members[i];
1164 struct d3d10_effect_type_member *typem = &l->type->members[i];
1167 v->effect = l->effect;
1169 hr = parse_fx10_variable(v, ptr, data);
1170 if (FAILED(hr)) return hr;
1173 * Copy the values from the variable type to the constant buffers type
1174 * members structure, because it is our own generated type.
1176 typem->type = v->type;
1178 if (!copy_name(v->name, &typem->name))
1180 ERR("Failed to copy name.\n");
1181 return E_OUTOFMEMORY;
1183 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1185 if (!copy_name(v->semantic, &typem->semantic))
1187 ERR("Failed to copy name.\n");
1188 return E_OUTOFMEMORY;
1190 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1192 typem->buffer_offset = v->buffer_offset;
1193 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1195 l->type->size_packed += v->type->size_packed;
1196 l->type->size_unpacked += v->type->size_unpacked;
1198 l->type->stride = l->type->size_unpacked = (l->type->size_unpacked + 0xf) & ~0xf;
1200 TRACE("Constant buffer:\n");
1201 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1202 TRACE("\tElement count: %u.\n", l->type->element_count);
1203 TRACE("\tMember count: %u.\n", l->type->member_count);
1204 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1205 TRACE("\tStride: %#x.\n", l->type->stride);
1206 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1207 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1208 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1213 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1215 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1216 const DWORD *id = key;
1221 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1223 TRACE("effect type member %p.\n", typem);
1225 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1226 HeapFree(GetProcessHeap(), 0, typem->semantic);
1227 HeapFree(GetProcessHeap(), 0, typem->name);
1230 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1232 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1234 TRACE("effect type %p.\n", t);
1238 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1239 HeapFree(GetProcessHeap(), 0, t->elementtype);
1246 for (i = 0; i < t->member_count; ++i)
1248 d3d10_effect_type_member_destroy(&t->members[i]);
1250 HeapFree(GetProcessHeap(), 0, t->members);
1253 HeapFree(GetProcessHeap(), 0, t->name);
1254 HeapFree(GetProcessHeap(), 0, t);
1257 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1262 d3d10_effect_type_compare,
1265 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1267 const char *ptr = data + e->index_offset;
1271 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1273 ERR("Failed to initialize type rbtree.\n");
1277 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1278 if (!e->local_buffers)
1280 ERR("Failed to allocate local buffer memory.\n");
1281 return E_OUTOFMEMORY;
1284 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1285 if (!e->local_variables)
1287 ERR("Failed to allocate local variable memory.\n");
1288 return E_OUTOFMEMORY;
1291 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
1294 ERR("Failed to allocate techniques memory\n");
1295 return E_OUTOFMEMORY;
1298 for (i = 0; i < e->local_buffer_count; ++i)
1300 struct d3d10_effect_variable *l = &e->local_buffers[i];
1301 l->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
1303 l->buffer = &null_local_buffer;
1305 hr = parse_fx10_local_buffer(l, &ptr, data);
1306 if (FAILED(hr)) return hr;
1309 for (i = 0; i < e->local_variable_count; ++i)
1311 struct d3d10_effect_variable *v = &e->local_variables[i];
1314 v->vtbl = &d3d10_effect_variable_vtbl;
1316 hr = parse_fx10_local_variable(v, &ptr, data);
1317 if (FAILED(hr)) return hr;
1320 for (i = 0; i < e->technique_count; ++i)
1322 struct d3d10_effect_technique *t = &e->techniques[i];
1324 t->vtbl = &d3d10_effect_technique_vtbl;
1327 hr = parse_fx10_technique(t, &ptr, data);
1328 if (FAILED(hr)) return hr;
1334 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
1336 const char *ptr = data;
1339 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
1340 read_dword(&ptr, &e->version);
1341 TRACE("Target: %#x\n", e->version);
1343 read_dword(&ptr, &e->local_buffer_count);
1344 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
1346 read_dword(&ptr, &e->variable_count);
1347 TRACE("Variable count: %u\n", e->variable_count);
1349 read_dword(&ptr, &e->local_variable_count);
1350 TRACE("Object count: %u\n", e->local_variable_count);
1352 read_dword(&ptr, &e->sharedbuffers_count);
1353 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
1355 /* Number of variables in shared buffers? */
1356 read_dword(&ptr, &unknown);
1357 FIXME("Unknown 0: %u\n", unknown);
1359 read_dword(&ptr, &e->sharedobjects_count);
1360 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
1362 read_dword(&ptr, &e->technique_count);
1363 TRACE("Technique count: %u\n", e->technique_count);
1365 read_dword(&ptr, &e->index_offset);
1366 TRACE("Index offset: %#x\n", e->index_offset);
1368 read_dword(&ptr, &unknown);
1369 FIXME("Unknown 1: %u\n", unknown);
1371 read_dword(&ptr, &e->texture_count);
1372 TRACE("Texture count: %u\n", e->texture_count);
1374 read_dword(&ptr, &e->dephstencilstate_count);
1375 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
1377 read_dword(&ptr, &e->blendstate_count);
1378 TRACE("Blendstate count: %u\n", e->blendstate_count);
1380 read_dword(&ptr, &e->rasterizerstate_count);
1381 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
1383 read_dword(&ptr, &e->samplerstate_count);
1384 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
1386 read_dword(&ptr, &e->rendertargetview_count);
1387 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
1389 read_dword(&ptr, &e->depthstencilview_count);
1390 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
1392 read_dword(&ptr, &e->shader_call_count);
1393 TRACE("Shader call count: %u\n", e->shader_call_count);
1395 read_dword(&ptr, &e->shader_compile_count);
1396 TRACE("Shader compile count: %u\n", e->shader_compile_count);
1398 return parse_fx10_body(e, ptr, data_size - (ptr - data));
1401 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
1403 struct d3d10_effect *e = ctx;
1405 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
1407 TRACE("chunk size: %#x\n", data_size);
1412 return parse_fx10(e, data, data_size);
1415 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
1420 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
1422 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
1425 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
1427 TRACE("effect object %p.\n", o);
1431 case D3D10_EOT_VERTEXSHADER:
1432 case D3D10_EOT_PIXELSHADER:
1433 case D3D10_EOT_GEOMETRYSHADER:
1434 HeapFree(GetProcessHeap(), 0, ((struct d3d10_effect_shader_variable *)o->data)->input_signature);
1440 HeapFree(GetProcessHeap(), 0, o->data);
1443 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
1445 ID3D10Device *device = o->pass->technique->effect->device;
1447 TRACE("effect object %p, type %#x.\n", o, o->type);
1451 case D3D10_EOT_VERTEXSHADER:
1452 ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.vs);
1455 case D3D10_EOT_PIXELSHADER:
1456 ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.ps);
1459 case D3D10_EOT_GEOMETRYSHADER:
1460 ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.gs);
1464 FIXME("Unhandled effect object type %#x.\n", o->type);
1469 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
1473 TRACE("variable %p.\n", v);
1475 HeapFree(GetProcessHeap(), 0, v->name);
1476 HeapFree(GetProcessHeap(), 0, v->semantic);
1479 for (i = 0; i < v->annotation_count; ++i)
1481 d3d10_effect_variable_destroy(&v->annotations[i]);
1483 HeapFree(GetProcessHeap(), 0, v->annotations);
1488 for (i = 0; i < v->type->member_count; ++i)
1490 d3d10_effect_variable_destroy(&v->members[i]);
1492 HeapFree(GetProcessHeap(), 0, v->members);
1497 for (i = 0; i < v->type->element_count; ++i)
1499 d3d10_effect_variable_destroy(&v->elements[i]);
1501 HeapFree(GetProcessHeap(), 0, v->elements);
1505 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
1509 TRACE("pass %p\n", p);
1511 HeapFree(GetProcessHeap(), 0, p->name);
1514 for (i = 0; i < p->object_count; ++i)
1516 d3d10_effect_object_destroy(&p->objects[i]);
1518 HeapFree(GetProcessHeap(), 0, p->objects);
1523 for (i = 0; i < p->annotation_count; ++i)
1525 d3d10_effect_variable_destroy(&p->annotations[i]);
1527 HeapFree(GetProcessHeap(), 0, p->annotations);
1532 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
1536 TRACE("technique %p\n", t);
1538 HeapFree(GetProcessHeap(), 0, t->name);
1541 for (i = 0; i < t->pass_count; ++i)
1543 d3d10_effect_pass_destroy(&t->passes[i]);
1545 HeapFree(GetProcessHeap(), 0, t->passes);
1550 for (i = 0; i < t->annotation_count; ++i)
1552 d3d10_effect_variable_destroy(&t->annotations[i]);
1554 HeapFree(GetProcessHeap(), 0, t->annotations);
1558 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
1562 TRACE("local buffer %p.\n", l);
1564 HeapFree(GetProcessHeap(), 0, l->name);
1567 for (i = 0; i < l->type->member_count; ++i)
1569 d3d10_effect_variable_destroy(&l->members[i]);
1571 HeapFree(GetProcessHeap(), 0, l->members);
1574 if (l->type->members)
1576 for (i = 0; i < l->type->member_count; ++i)
1578 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
1579 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
1580 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
1582 HeapFree(GetProcessHeap(), 0, l->type->members);
1584 HeapFree(GetProcessHeap(), 0, l->type->name);
1585 HeapFree(GetProcessHeap(), 0, l->type);
1589 for (i = 0; i < l->annotation_count; ++i)
1591 d3d10_effect_variable_destroy(&l->annotations[i]);
1593 HeapFree(GetProcessHeap(), 0, l->annotations);
1597 /* IUnknown methods */
1599 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
1601 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
1603 if (IsEqualGUID(riid, &IID_ID3D10Effect)
1604 || IsEqualGUID(riid, &IID_IUnknown))
1606 IUnknown_AddRef(iface);
1611 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
1614 return E_NOINTERFACE;
1617 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
1619 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1620 ULONG refcount = InterlockedIncrement(&This->refcount);
1622 TRACE("%p increasing refcount to %u\n", This, refcount);
1627 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
1629 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1630 ULONG refcount = InterlockedDecrement(&This->refcount);
1632 TRACE("%p decreasing refcount to %u\n", This, refcount);
1638 if (This->techniques)
1640 for (i = 0; i < This->technique_count; ++i)
1642 d3d10_effect_technique_destroy(&This->techniques[i]);
1644 HeapFree(GetProcessHeap(), 0, This->techniques);
1647 if (This->local_variables)
1649 for (i = 0; i < This->local_variable_count; ++i)
1651 d3d10_effect_variable_destroy(&This->local_variables[i]);
1653 HeapFree(GetProcessHeap(), 0, &This->local_variables);
1656 if (This->local_buffers)
1658 for (i = 0; i < This->local_buffer_count; ++i)
1660 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
1662 HeapFree(GetProcessHeap(), 0, This->local_buffers);
1665 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
1667 ID3D10Device_Release(This->device);
1668 HeapFree(GetProcessHeap(), 0, This);
1674 /* ID3D10Effect methods */
1676 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
1678 FIXME("iface %p stub!\n", iface);
1683 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
1685 FIXME("iface %p stub!\n", iface);
1690 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
1692 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1694 TRACE("iface %p, device %p\n", iface, device);
1696 ID3D10Device_AddRef(This->device);
1697 *device = This->device;
1702 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
1704 FIXME("iface %p, desc %p stub!\n", iface, desc);
1709 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
1712 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1713 struct d3d10_effect_variable *l;
1715 TRACE("iface %p, index %u\n", iface, index);
1717 if (index >= This->local_buffer_count)
1719 WARN("Invalid index specified\n");
1720 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1723 l = &This->local_buffers[index];
1725 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
1727 return (ID3D10EffectConstantBuffer *)l;
1730 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
1733 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1736 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1738 for (i = 0; i < This->local_buffer_count; ++i)
1740 struct d3d10_effect_variable *l = &This->local_buffers[i];
1742 if (!strcmp(l->name, name))
1744 TRACE("Returning buffer %p.\n", l);
1745 return (ID3D10EffectConstantBuffer *)l;
1749 WARN("Invalid name specified\n");
1751 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1754 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
1756 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1759 TRACE("iface %p, index %u\n", iface, index);
1761 for (i = 0; i < This->local_buffer_count; ++i)
1763 struct d3d10_effect_variable *l = &This->local_buffers[i];
1765 if (index < l->type->member_count)
1767 struct d3d10_effect_variable *v = &l->members[index];
1769 TRACE("Returning variable %p.\n", v);
1770 return (ID3D10EffectVariable *)v;
1772 index -= l->type->member_count;
1775 if (index < This->local_variable_count)
1777 struct d3d10_effect_variable *v = &This->local_variables[index];
1779 TRACE("Returning variable %p.\n", v);
1780 return (ID3D10EffectVariable *)v;
1783 WARN("Invalid index specified\n");
1785 return (ID3D10EffectVariable *)&null_variable;
1788 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
1790 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1793 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1795 for (i = 0; i < This->local_buffer_count; ++i)
1797 struct d3d10_effect_variable *l = &This->local_buffers[i];
1800 for (j = 0; j < l->type->member_count; ++j)
1802 struct d3d10_effect_variable *v = &l->members[j];
1804 if (!strcmp(v->name, name))
1806 TRACE("Returning variable %p.\n", v);
1807 return (ID3D10EffectVariable *)v;
1812 for (i = 0; i < This->local_variable_count; ++i)
1814 struct d3d10_effect_variable *v = &This->local_variables[i];
1816 if (!strcmp(v->name, name))
1818 TRACE("Returning variable %p.\n", v);
1819 return (ID3D10EffectVariable *)v;
1823 WARN("Invalid name specified\n");
1825 return (ID3D10EffectVariable *)&null_variable;
1828 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
1831 FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic));
1836 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
1839 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1840 struct d3d10_effect_technique *t;
1842 TRACE("iface %p, index %u\n", iface, index);
1844 if (index >= This->technique_count)
1846 WARN("Invalid index specified\n");
1847 return (ID3D10EffectTechnique *)&null_technique;
1850 t = &This->techniques[index];
1852 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
1854 return (ID3D10EffectTechnique *)t;
1857 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
1860 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1863 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1865 for (i = 0; i < This->technique_count; ++i)
1867 struct d3d10_effect_technique *t = &This->techniques[i];
1868 if (!strcmp(t->name, name))
1870 TRACE("Returning technique %p\n", t);
1871 return (ID3D10EffectTechnique *)t;
1875 WARN("Invalid name specified\n");
1877 return (ID3D10EffectTechnique *)&null_technique;
1880 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
1882 FIXME("iface %p stub!\n", iface);
1887 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
1889 FIXME("iface %p stub!\n", iface);
1894 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
1896 /* IUnknown methods */
1897 d3d10_effect_QueryInterface,
1898 d3d10_effect_AddRef,
1899 d3d10_effect_Release,
1900 /* ID3D10Effect methods */
1901 d3d10_effect_IsValid,
1902 d3d10_effect_IsPool,
1903 d3d10_effect_GetDevice,
1904 d3d10_effect_GetDesc,
1905 d3d10_effect_GetConstantBufferByIndex,
1906 d3d10_effect_GetConstantBufferByName,
1907 d3d10_effect_GetVariableByIndex,
1908 d3d10_effect_GetVariableByName,
1909 d3d10_effect_GetVariableBySemantic,
1910 d3d10_effect_GetTechniqueByIndex,
1911 d3d10_effect_GetTechniqueByName,
1912 d3d10_effect_Optimize,
1913 d3d10_effect_IsOptimized,
1916 /* ID3D10EffectTechnique methods */
1918 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
1920 TRACE("iface %p\n", iface);
1922 return (struct d3d10_effect_technique *)iface != &null_technique;
1925 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
1926 D3D10_TECHNIQUE_DESC *desc)
1928 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1930 TRACE("iface %p, desc %p\n", iface, desc);
1932 if(This == &null_technique)
1934 WARN("Null technique specified\n");
1940 WARN("Invalid argument specified\n");
1941 return E_INVALIDARG;
1944 desc->Name = This->name;
1945 desc->Passes = This->pass_count;
1946 desc->Annotations = This->annotation_count;
1951 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
1952 ID3D10EffectTechnique *iface, UINT index)
1954 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1955 struct d3d10_effect_variable *a;
1957 TRACE("iface %p, index %u\n", iface, index);
1959 if (index >= This->annotation_count)
1961 WARN("Invalid index specified\n");
1962 return (ID3D10EffectVariable *)&null_variable;
1965 a = &This->annotations[index];
1967 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
1969 return (ID3D10EffectVariable *)a;
1972 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
1973 ID3D10EffectTechnique *iface, LPCSTR name)
1975 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1978 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1980 for (i = 0; i < This->annotation_count; ++i)
1982 struct d3d10_effect_variable *a = &This->annotations[i];
1983 if (!strcmp(a->name, name))
1985 TRACE("Returning annotation %p\n", a);
1986 return (ID3D10EffectVariable *)a;
1990 WARN("Invalid name specified\n");
1992 return (ID3D10EffectVariable *)&null_variable;
1995 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
1998 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1999 struct d3d10_effect_pass *p;
2001 TRACE("iface %p, index %u\n", iface, index);
2003 if (index >= This->pass_count)
2005 WARN("Invalid index specified\n");
2006 return (ID3D10EffectPass *)&null_pass;
2009 p = &This->passes[index];
2011 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2013 return (ID3D10EffectPass *)p;
2016 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2019 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2022 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2024 for (i = 0; i < This->pass_count; ++i)
2026 struct d3d10_effect_pass *p = &This->passes[i];
2027 if (!strcmp(p->name, name))
2029 TRACE("Returning pass %p\n", p);
2030 return (ID3D10EffectPass *)p;
2034 WARN("Invalid name specified\n");
2036 return (ID3D10EffectPass *)&null_pass;
2039 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2040 D3D10_STATE_BLOCK_MASK *mask)
2042 FIXME("iface %p,mask %p stub!\n", iface, mask);
2047 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2049 /* ID3D10EffectTechnique methods */
2050 d3d10_effect_technique_IsValid,
2051 d3d10_effect_technique_GetDesc,
2052 d3d10_effect_technique_GetAnnotationByIndex,
2053 d3d10_effect_technique_GetAnnotationByName,
2054 d3d10_effect_technique_GetPassByIndex,
2055 d3d10_effect_technique_GetPassByName,
2056 d3d10_effect_technique_ComputeStateBlockMask,
2059 /* ID3D10EffectPass methods */
2061 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2063 TRACE("iface %p\n", iface);
2065 return (struct d3d10_effect_pass *)iface != &null_pass;
2068 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface, D3D10_PASS_DESC *desc)
2070 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2073 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2075 if(This == &null_pass)
2077 WARN("Null pass specified\n");
2083 WARN("Invalid argument specified\n");
2084 return E_INVALIDARG;
2087 memset(desc, 0, sizeof(*desc));
2088 desc->Name = This->name;
2089 for (i = 0; i < This->object_count; ++i)
2091 struct d3d10_effect_object *o = &This->objects[i];
2092 if (o->type == D3D10_EOT_VERTEXSHADER)
2094 struct d3d10_effect_shader_variable *s = o->data;
2095 desc->pIAInputSignature = (BYTE *)s->input_signature;
2096 desc->IAInputSignatureSize = s->input_signature_size;
2104 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2105 D3D10_PASS_SHADER_DESC *desc)
2107 FIXME("iface %p, desc %p stub!\n", iface, desc);
2112 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2113 D3D10_PASS_SHADER_DESC *desc)
2115 FIXME("iface %p, desc %p stub!\n", iface, desc);
2120 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
2121 D3D10_PASS_SHADER_DESC *desc)
2123 FIXME("iface %p, desc %p stub!\n", iface, desc);
2128 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
2131 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2132 struct d3d10_effect_variable *a;
2134 TRACE("iface %p, index %u\n", iface, index);
2136 if (index >= This->annotation_count)
2138 WARN("Invalid index specified\n");
2139 return (ID3D10EffectVariable *)&null_variable;
2142 a = &This->annotations[index];
2144 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2146 return (ID3D10EffectVariable *)a;
2149 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
2152 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2155 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2157 for (i = 0; i < This->annotation_count; ++i)
2159 struct d3d10_effect_variable *a = &This->annotations[i];
2160 if (!strcmp(a->name, name))
2162 TRACE("Returning annotation %p\n", a);
2163 return (ID3D10EffectVariable *)a;
2167 WARN("Invalid name specified\n");
2169 return (ID3D10EffectVariable *)&null_variable;
2172 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
2174 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2178 TRACE("iface %p, flags %#x\n", iface, flags);
2180 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
2182 for (i = 0; i < This->object_count; ++i)
2184 hr = d3d10_effect_object_apply(&This->objects[i]);
2185 if (FAILED(hr)) break;
2191 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
2192 D3D10_STATE_BLOCK_MASK *mask)
2194 FIXME("iface %p, mask %p stub!\n", iface, mask);
2199 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
2201 /* ID3D10EffectPass methods */
2202 d3d10_effect_pass_IsValid,
2203 d3d10_effect_pass_GetDesc,
2204 d3d10_effect_pass_GetVertexShaderDesc,
2205 d3d10_effect_pass_GetGeometryShaderDesc,
2206 d3d10_effect_pass_GetPixelShaderDesc,
2207 d3d10_effect_pass_GetAnnotationByIndex,
2208 d3d10_effect_pass_GetAnnotationByName,
2209 d3d10_effect_pass_Apply,
2210 d3d10_effect_pass_ComputeStateBlockMask,
2213 /* ID3D10EffectVariable methods */
2215 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
2217 TRACE("iface %p\n", iface);
2219 return (struct d3d10_effect_variable *)iface != &null_variable;
2222 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
2224 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2226 TRACE("iface %p\n", iface);
2228 return (ID3D10EffectType *)This->type;
2231 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
2232 D3D10_EFFECT_VARIABLE_DESC *desc)
2234 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2236 TRACE("iface %p, desc %p\n", iface, desc);
2238 if(This == &null_variable)
2240 WARN("Null variable specified\n");
2246 WARN("Invalid argument specified\n");
2247 return E_INVALIDARG;
2250 memset(desc, 0, sizeof(*desc));
2251 desc->Name = This->name;
2252 desc->Semantic = This->semantic;
2253 desc->Flags = This->flag;
2254 desc->Annotations = This->annotation_count;
2255 desc->BufferOffset = This->buffer_offset;
2257 if( This->flag == D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2259 desc->ExplicitBindPoint = This->buffer_offset;
2263 FIXME("Unhandled flag %#x!\n", This->flag);
2269 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
2270 ID3D10EffectVariable *iface, UINT index)
2272 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2273 struct d3d10_effect_variable *a;
2275 TRACE("iface %p, index %u\n", iface, index);
2277 if (index >= This->annotation_count)
2279 WARN("Invalid index specified\n");
2280 return (ID3D10EffectVariable *)&null_variable;
2283 a = &This->annotations[index];
2285 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2287 return (ID3D10EffectVariable *)a;
2290 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
2291 ID3D10EffectVariable *iface, LPCSTR name)
2293 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2296 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2298 for (i = 0; i < This->annotation_count; ++i)
2300 struct d3d10_effect_variable *a = &This->annotations[i];
2301 if (!strcmp(a->name, name))
2303 TRACE("Returning annotation %p\n", a);
2304 return (ID3D10EffectVariable *)a;
2308 WARN("Invalid name specified\n");
2310 return (ID3D10EffectVariable *)&null_variable;
2313 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
2314 ID3D10EffectVariable *iface, UINT index)
2316 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2317 struct d3d10_effect_variable *m;
2319 TRACE("iface %p, index %u\n", iface, index);
2321 if (index >= This->type->member_count)
2323 WARN("Invalid index specified\n");
2324 return (ID3D10EffectVariable *)&null_variable;
2327 m = &This->members[index];
2329 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
2331 return (ID3D10EffectVariable *)m;
2334 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
2335 ID3D10EffectVariable *iface, LPCSTR name)
2337 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2340 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2344 WARN("Invalid name specified\n");
2345 return (ID3D10EffectVariable *)&null_variable;
2348 for (i = 0; i < This->type->member_count; ++i)
2350 struct d3d10_effect_variable *m = &This->members[i];
2354 if (!strcmp(m->name, name))
2356 TRACE("Returning member %p\n", m);
2357 return (ID3D10EffectVariable *)m;
2362 WARN("Invalid name specified\n");
2364 return (ID3D10EffectVariable *)&null_variable;
2367 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
2368 ID3D10EffectVariable *iface, LPCSTR semantic)
2370 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2373 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
2377 WARN("Invalid semantic specified\n");
2378 return (ID3D10EffectVariable *)&null_variable;
2381 for (i = 0; i < This->type->member_count; ++i)
2383 struct d3d10_effect_variable *m = &This->members[i];
2387 if (!strcmp(m->semantic, semantic))
2389 TRACE("Returning member %p\n", m);
2390 return (ID3D10EffectVariable *)m;
2395 WARN("Invalid semantic specified\n");
2397 return (ID3D10EffectVariable *)&null_variable;
2400 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
2401 ID3D10EffectVariable *iface, UINT index)
2403 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2404 struct d3d10_effect_variable *v;
2406 TRACE("iface %p, index %u\n", iface, index);
2408 if (index >= This->type->element_count)
2410 WARN("Invalid index specified\n");
2411 return (ID3D10EffectVariable *)&null_variable;
2414 v = &This->elements[index];
2416 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
2418 return (ID3D10EffectVariable *)v;
2421 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
2422 ID3D10EffectVariable *iface)
2424 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2426 TRACE("iface %p\n", iface);
2428 return (ID3D10EffectConstantBuffer *)This->buffer;
2431 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
2432 ID3D10EffectVariable *iface)
2434 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2436 TRACE("iface %p\n", iface);
2438 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
2439 return (ID3D10EffectScalarVariable *)This;
2441 return (ID3D10EffectScalarVariable *)&null_scalar_variable;
2444 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
2445 ID3D10EffectVariable *iface)
2447 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2449 TRACE("iface %p\n", iface);
2451 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
2452 return (ID3D10EffectVectorVariable *)This;
2454 return (ID3D10EffectVectorVariable *)&null_vector_variable;
2457 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
2458 ID3D10EffectVariable *iface)
2460 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2462 TRACE("iface %p\n", iface);
2464 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
2465 return (ID3D10EffectMatrixVariable *)This;
2467 return (ID3D10EffectMatrixVariable *)&null_matrix_variable;
2470 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
2471 ID3D10EffectVariable *iface)
2473 FIXME("iface %p stub!\n", iface);
2478 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
2479 ID3D10EffectVariable *iface)
2481 FIXME("iface %p stub!\n", iface);
2486 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
2487 ID3D10EffectVariable *iface)
2489 FIXME("iface %p stub!\n", iface);
2494 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
2495 ID3D10EffectVariable *iface)
2497 FIXME("iface %p stub!\n", iface);
2502 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
2503 ID3D10EffectVariable *iface)
2505 FIXME("iface %p stub!\n", iface);
2510 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
2511 ID3D10EffectVariable *iface)
2513 FIXME("iface %p stub!\n", iface);
2518 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
2520 FIXME("iface %p stub!\n", iface);
2525 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
2526 ID3D10EffectVariable *iface)
2528 FIXME("iface %p stub!\n", iface);
2533 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
2534 ID3D10EffectVariable *iface)
2536 FIXME("iface %p stub!\n", iface);
2541 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
2542 ID3D10EffectVariable *iface)
2544 FIXME("iface %p stub!\n", iface);
2549 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
2550 void *data, UINT offset, UINT count)
2552 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2557 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
2558 void *data, UINT offset, UINT count)
2560 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2565 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
2567 /* ID3D10EffectVariable methods */
2568 d3d10_effect_variable_IsValid,
2569 d3d10_effect_variable_GetType,
2570 d3d10_effect_variable_GetDesc,
2571 d3d10_effect_variable_GetAnnotationByIndex,
2572 d3d10_effect_variable_GetAnnotationByName,
2573 d3d10_effect_variable_GetMemberByIndex,
2574 d3d10_effect_variable_GetMemberByName,
2575 d3d10_effect_variable_GetMemberBySemantic,
2576 d3d10_effect_variable_GetElement,
2577 d3d10_effect_variable_GetParentConstantBuffer,
2578 d3d10_effect_variable_AsScalar,
2579 d3d10_effect_variable_AsVector,
2580 d3d10_effect_variable_AsMatrix,
2581 d3d10_effect_variable_AsString,
2582 d3d10_effect_variable_AsShaderResource,
2583 d3d10_effect_variable_AsRenderTargetView,
2584 d3d10_effect_variable_AsDepthStencilView,
2585 d3d10_effect_variable_AsConstantBuffer,
2586 d3d10_effect_variable_AsShader,
2587 d3d10_effect_variable_AsBlend,
2588 d3d10_effect_variable_AsDepthStencil,
2589 d3d10_effect_variable_AsRasterizer,
2590 d3d10_effect_variable_AsSampler,
2591 d3d10_effect_variable_SetRawValue,
2592 d3d10_effect_variable_GetRawValue,
2595 /* ID3D10EffectVariable methods */
2596 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
2598 TRACE("iface %p\n", iface);
2600 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
2603 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
2605 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
2608 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
2609 D3D10_EFFECT_VARIABLE_DESC *desc)
2611 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
2614 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
2615 ID3D10EffectConstantBuffer *iface, UINT index)
2617 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
2620 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
2621 ID3D10EffectConstantBuffer *iface, LPCSTR name)
2623 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
2626 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
2627 ID3D10EffectConstantBuffer *iface, UINT index)
2629 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
2632 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
2633 ID3D10EffectConstantBuffer *iface, LPCSTR name)
2635 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
2638 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
2639 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
2641 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
2644 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
2645 ID3D10EffectConstantBuffer *iface, UINT index)
2647 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
2650 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
2651 ID3D10EffectConstantBuffer *iface)
2653 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
2656 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
2657 ID3D10EffectConstantBuffer *iface)
2659 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
2662 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
2663 ID3D10EffectConstantBuffer *iface)
2665 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
2668 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
2669 ID3D10EffectConstantBuffer *iface)
2671 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
2674 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
2675 ID3D10EffectConstantBuffer *iface)
2677 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
2680 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
2681 ID3D10EffectConstantBuffer *iface)
2683 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
2686 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
2687 ID3D10EffectConstantBuffer *iface)
2689 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
2692 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
2693 ID3D10EffectConstantBuffer *iface)
2695 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
2698 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
2699 ID3D10EffectConstantBuffer *iface)
2701 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
2704 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
2705 ID3D10EffectConstantBuffer *iface)
2707 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
2710 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
2712 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
2715 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
2716 ID3D10EffectConstantBuffer *iface)
2718 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
2721 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
2722 ID3D10EffectConstantBuffer *iface)
2724 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
2727 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
2728 ID3D10EffectConstantBuffer *iface)
2730 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
2733 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
2734 void *data, UINT offset, UINT count)
2736 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2739 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
2740 void *data, UINT offset, UINT count)
2742 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2745 /* ID3D10EffectConstantBuffer methods */
2746 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2747 ID3D10Buffer *buffer)
2749 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2754 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2755 ID3D10Buffer **buffer)
2757 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2762 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2763 ID3D10ShaderResourceView *view)
2765 FIXME("iface %p, view %p stub!\n", iface, view);
2770 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2771 ID3D10ShaderResourceView **view)
2773 FIXME("iface %p, view %p stub!\n", iface, view);
2778 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
2780 /* ID3D10EffectVariable methods */
2781 d3d10_effect_constant_buffer_IsValid,
2782 d3d10_effect_constant_buffer_GetType,
2783 d3d10_effect_constant_buffer_GetDesc,
2784 d3d10_effect_constant_buffer_GetAnnotationByIndex,
2785 d3d10_effect_constant_buffer_GetAnnotationByName,
2786 d3d10_effect_constant_buffer_GetMemberByIndex,
2787 d3d10_effect_constant_buffer_GetMemberByName,
2788 d3d10_effect_constant_buffer_GetMemberBySemantic,
2789 d3d10_effect_constant_buffer_GetElement,
2790 d3d10_effect_constant_buffer_GetParentConstantBuffer,
2791 d3d10_effect_constant_buffer_AsScalar,
2792 d3d10_effect_constant_buffer_AsVector,
2793 d3d10_effect_constant_buffer_AsMatrix,
2794 d3d10_effect_constant_buffer_AsString,
2795 d3d10_effect_constant_buffer_AsShaderResource,
2796 d3d10_effect_constant_buffer_AsRenderTargetView,
2797 d3d10_effect_constant_buffer_AsDepthStencilView,
2798 d3d10_effect_constant_buffer_AsConstantBuffer,
2799 d3d10_effect_constant_buffer_AsShader,
2800 d3d10_effect_constant_buffer_AsBlend,
2801 d3d10_effect_constant_buffer_AsDepthStencil,
2802 d3d10_effect_constant_buffer_AsRasterizer,
2803 d3d10_effect_constant_buffer_AsSampler,
2804 d3d10_effect_constant_buffer_SetRawValue,
2805 d3d10_effect_constant_buffer_GetRawValue,
2806 /* ID3D10EffectConstantBuffer methods */
2807 d3d10_effect_constant_buffer_SetConstantBuffer,
2808 d3d10_effect_constant_buffer_GetConstantBuffer,
2809 d3d10_effect_constant_buffer_SetTextureBuffer,
2810 d3d10_effect_constant_buffer_GetTextureBuffer,
2813 /* ID3D10EffectVariable methods */
2815 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
2817 TRACE("iface %p\n", iface);
2819 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
2822 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
2823 ID3D10EffectScalarVariable *iface)
2825 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
2828 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
2829 D3D10_EFFECT_VARIABLE_DESC *desc)
2831 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
2834 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
2835 ID3D10EffectScalarVariable *iface, UINT index)
2837 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
2840 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
2841 ID3D10EffectScalarVariable *iface, LPCSTR name)
2843 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
2846 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
2847 ID3D10EffectScalarVariable *iface, UINT index)
2849 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
2852 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
2853 ID3D10EffectScalarVariable *iface, LPCSTR name)
2855 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
2858 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
2859 ID3D10EffectScalarVariable *iface, LPCSTR semantic)
2861 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
2864 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
2865 ID3D10EffectScalarVariable *iface, UINT index)
2867 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
2870 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
2871 ID3D10EffectScalarVariable *iface)
2873 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
2876 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
2877 ID3D10EffectScalarVariable *iface)
2879 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
2882 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
2883 ID3D10EffectScalarVariable *iface)
2885 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
2888 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
2889 ID3D10EffectScalarVariable *iface)
2891 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
2894 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
2895 ID3D10EffectScalarVariable *iface)
2897 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
2900 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
2901 ID3D10EffectScalarVariable *iface)
2903 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
2906 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
2907 ID3D10EffectScalarVariable *iface)
2909 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
2912 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
2913 ID3D10EffectScalarVariable *iface)
2915 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
2918 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
2919 ID3D10EffectScalarVariable *iface)
2921 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
2924 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
2925 ID3D10EffectScalarVariable *iface)
2927 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
2930 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
2931 ID3D10EffectScalarVariable *iface)
2933 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
2936 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
2937 ID3D10EffectScalarVariable *iface)
2939 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
2942 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
2943 ID3D10EffectScalarVariable *iface)
2945 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
2948 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
2949 ID3D10EffectScalarVariable *iface)
2951 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
2954 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
2955 void *data, UINT offset, UINT count)
2957 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2960 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
2961 void *data, UINT offset, UINT count)
2963 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2966 /* ID3D10EffectScalarVariable methods */
2968 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
2971 FIXME("iface %p, value %.8e stub!\n", iface, value);
2976 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
2979 FIXME("iface %p, value %p stub!\n", iface, value);
2984 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
2985 float *values, UINT offset, UINT count)
2987 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
2992 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
2993 float *values, UINT offset, UINT count)
2995 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3000 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
3003 FIXME("iface %p, value %d stub!\n", iface, value);
3008 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3011 FIXME("iface %p, value %p stub!\n", iface, value);
3016 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3017 int *values, UINT offset, UINT count)
3019 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3024 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3025 int *values, UINT offset, UINT count)
3027 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3032 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3035 FIXME("iface %p, value %d stub!\n", iface, value);
3040 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3043 FIXME("iface %p, value %p stub!\n", iface, value);
3048 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
3049 BOOL *values, UINT offset, UINT count)
3051 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3056 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
3057 BOOL *values, UINT offset, UINT count)
3059 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3064 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
3066 /* ID3D10EffectVariable methods */
3067 d3d10_effect_scalar_variable_IsValid,
3068 d3d10_effect_scalar_variable_GetType,
3069 d3d10_effect_scalar_variable_GetDesc,
3070 d3d10_effect_scalar_variable_GetAnnotationByIndex,
3071 d3d10_effect_scalar_variable_GetAnnotationByName,
3072 d3d10_effect_scalar_variable_GetMemberByIndex,
3073 d3d10_effect_scalar_variable_GetMemberByName,
3074 d3d10_effect_scalar_variable_GetMemberBySemantic,
3075 d3d10_effect_scalar_variable_GetElement,
3076 d3d10_effect_scalar_variable_GetParentConstantBuffer,
3077 d3d10_effect_scalar_variable_AsScalar,
3078 d3d10_effect_scalar_variable_AsVector,
3079 d3d10_effect_scalar_variable_AsMatrix,
3080 d3d10_effect_scalar_variable_AsString,
3081 d3d10_effect_scalar_variable_AsShaderResource,
3082 d3d10_effect_scalar_variable_AsRenderTargetView,
3083 d3d10_effect_scalar_variable_AsDepthStencilView,
3084 d3d10_effect_scalar_variable_AsConstantBuffer,
3085 d3d10_effect_scalar_variable_AsShader,
3086 d3d10_effect_scalar_variable_AsBlend,
3087 d3d10_effect_scalar_variable_AsDepthStencil,
3088 d3d10_effect_scalar_variable_AsRasterizer,
3089 d3d10_effect_scalar_variable_AsSampler,
3090 d3d10_effect_scalar_variable_SetRawValue,
3091 d3d10_effect_scalar_variable_GetRawValue,
3092 /* ID3D10EffectScalarVariable methods */
3093 d3d10_effect_scalar_variable_SetFloat,
3094 d3d10_effect_scalar_variable_GetFloat,
3095 d3d10_effect_scalar_variable_SetFloatArray,
3096 d3d10_effect_scalar_variable_GetFloatArray,
3097 d3d10_effect_scalar_variable_SetInt,
3098 d3d10_effect_scalar_variable_GetInt,
3099 d3d10_effect_scalar_variable_SetIntArray,
3100 d3d10_effect_scalar_variable_GetIntArray,
3101 d3d10_effect_scalar_variable_SetBool,
3102 d3d10_effect_scalar_variable_GetBool,
3103 d3d10_effect_scalar_variable_SetBoolArray,
3104 d3d10_effect_scalar_variable_GetBoolArray,
3107 /* ID3D10EffectVariable methods */
3109 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
3111 TRACE("iface %p\n", iface);
3113 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
3116 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
3117 ID3D10EffectVectorVariable *iface)
3119 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3122 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
3123 D3D10_EFFECT_VARIABLE_DESC *desc)
3125 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3128 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
3129 ID3D10EffectVectorVariable *iface, UINT index)
3131 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3134 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
3135 ID3D10EffectVectorVariable *iface, LPCSTR name)
3137 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3140 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
3141 ID3D10EffectVectorVariable *iface, UINT index)
3143 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3146 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
3147 ID3D10EffectVectorVariable *iface, LPCSTR name)
3149 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3152 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
3153 ID3D10EffectVectorVariable *iface, LPCSTR semantic)
3155 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3158 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
3159 ID3D10EffectVectorVariable *iface, UINT index)
3161 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3164 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
3165 ID3D10EffectVectorVariable *iface)
3167 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3170 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
3171 ID3D10EffectVectorVariable *iface)
3173 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3176 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
3177 ID3D10EffectVectorVariable *iface)
3179 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3182 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
3183 ID3D10EffectVectorVariable *iface)
3185 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3188 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
3189 ID3D10EffectVectorVariable *iface)
3191 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3194 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
3195 ID3D10EffectVectorVariable *iface)
3197 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3200 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
3201 ID3D10EffectVectorVariable *iface)
3203 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3206 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
3207 ID3D10EffectVectorVariable *iface)
3209 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3212 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
3213 ID3D10EffectVectorVariable *iface)
3215 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3218 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
3219 ID3D10EffectVectorVariable *iface)
3221 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3224 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
3225 ID3D10EffectVectorVariable *iface)
3227 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3230 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
3231 ID3D10EffectVectorVariable *iface)
3233 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3236 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
3237 ID3D10EffectVectorVariable *iface)
3239 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3242 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
3243 ID3D10EffectVectorVariable *iface)
3245 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3248 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
3249 void *data, UINT offset, UINT count)
3251 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3254 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
3255 void *data, UINT offset, UINT count)
3257 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3260 /* ID3D10EffectVectorVariable methods */
3262 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
3265 FIXME("iface %p, value %p stub!\n", iface, value);
3270 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
3273 FIXME("iface %p, value %p stub!\n", iface, value);
3278 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
3281 FIXME("iface %p, value %p stub!\n", iface, value);
3286 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
3289 FIXME("iface %p, value %p stub!\n", iface, value);
3294 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
3297 FIXME("iface %p, value %p stub!\n", iface, value);
3302 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
3305 FIXME("iface %p, value %p stub!\n", iface, value);
3310 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3311 BOOL *values, UINT offset, UINT count)
3313 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3318 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
3319 int *values, UINT offset, UINT count)
3321 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3326 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3327 float *values, UINT offset, UINT count)
3329 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3334 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3335 BOOL *values, UINT offset, UINT count)
3337 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3342 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
3343 int *values, UINT offset, UINT count)
3345 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3350 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3351 float *values, UINT offset, UINT count)
3353 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3358 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
3360 /* ID3D10EffectVariable methods */
3361 d3d10_effect_vector_variable_IsValid,
3362 d3d10_effect_vector_variable_GetType,
3363 d3d10_effect_vector_variable_GetDesc,
3364 d3d10_effect_vector_variable_GetAnnotationByIndex,
3365 d3d10_effect_vector_variable_GetAnnotationByName,
3366 d3d10_effect_vector_variable_GetMemberByIndex,
3367 d3d10_effect_vector_variable_GetMemberByName,
3368 d3d10_effect_vector_variable_GetMemberBySemantic,
3369 d3d10_effect_vector_variable_GetElement,
3370 d3d10_effect_vector_variable_GetParentConstantBuffer,
3371 d3d10_effect_vector_variable_AsScalar,
3372 d3d10_effect_vector_variable_AsVector,
3373 d3d10_effect_vector_variable_AsMatrix,
3374 d3d10_effect_vector_variable_AsString,
3375 d3d10_effect_vector_variable_AsShaderResource,
3376 d3d10_effect_vector_variable_AsRenderTargetView,
3377 d3d10_effect_vector_variable_AsDepthStencilView,
3378 d3d10_effect_vector_variable_AsConstantBuffer,
3379 d3d10_effect_vector_variable_AsShader,
3380 d3d10_effect_vector_variable_AsBlend,
3381 d3d10_effect_vector_variable_AsDepthStencil,
3382 d3d10_effect_vector_variable_AsRasterizer,
3383 d3d10_effect_vector_variable_AsSampler,
3384 d3d10_effect_vector_variable_SetRawValue,
3385 d3d10_effect_vector_variable_GetRawValue,
3386 /* ID3D10EffectVectorVariable methods */
3387 d3d10_effect_vector_variable_SetBoolVector,
3388 d3d10_effect_vector_variable_SetIntVector,
3389 d3d10_effect_vector_variable_SetFloatVector,
3390 d3d10_effect_vector_variable_GetBoolVector,
3391 d3d10_effect_vector_variable_GetIntVector,
3392 d3d10_effect_vector_variable_GetFloatVector,
3393 d3d10_effect_vector_variable_SetBoolVectorArray,
3394 d3d10_effect_vector_variable_SetIntVectorArray,
3395 d3d10_effect_vector_variable_SetFloatVectorArray,
3396 d3d10_effect_vector_variable_GetBoolVectorArray,
3397 d3d10_effect_vector_variable_GetIntVectorArray,
3398 d3d10_effect_vector_variable_GetFloatVectorArray,
3401 /* ID3D10EffectVariable methods */
3403 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
3405 TRACE("iface %p\n", iface);
3407 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
3410 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
3411 ID3D10EffectMatrixVariable *iface)
3413 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3416 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
3417 D3D10_EFFECT_VARIABLE_DESC *desc)
3419 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3422 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
3423 ID3D10EffectMatrixVariable *iface, UINT index)
3425 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3428 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
3429 ID3D10EffectMatrixVariable *iface, LPCSTR name)
3431 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3434 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
3435 ID3D10EffectMatrixVariable *iface, UINT index)
3437 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3440 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
3441 ID3D10EffectMatrixVariable *iface, LPCSTR name)
3443 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3446 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
3447 ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
3449 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3452 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
3453 ID3D10EffectMatrixVariable *iface, UINT index)
3455 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3458 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
3459 ID3D10EffectMatrixVariable *iface)
3461 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3464 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
3465 ID3D10EffectMatrixVariable *iface)
3467 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3470 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
3471 ID3D10EffectMatrixVariable *iface)
3473 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3476 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
3477 ID3D10EffectMatrixVariable *iface)
3479 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3482 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
3483 ID3D10EffectMatrixVariable *iface)
3485 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3488 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
3489 ID3D10EffectMatrixVariable *iface)
3491 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3494 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
3495 ID3D10EffectMatrixVariable *iface)
3497 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3500 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
3501 ID3D10EffectMatrixVariable *iface)
3503 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3506 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
3507 ID3D10EffectMatrixVariable *iface)
3509 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3512 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
3513 ID3D10EffectMatrixVariable *iface)
3515 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3518 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
3519 ID3D10EffectMatrixVariable *iface)
3521 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3524 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
3525 ID3D10EffectMatrixVariable *iface)
3527 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3530 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
3531 ID3D10EffectMatrixVariable *iface)
3533 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3536 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
3537 ID3D10EffectMatrixVariable *iface)
3539 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3542 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
3543 void *data, UINT offset, UINT count)
3545 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3548 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
3549 void *data, UINT offset, UINT count)
3551 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3554 /* ID3D10EffectMatrixVariable methods */
3556 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
3559 FIXME("iface %p, data %p stub!\n", iface, data);
3564 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
3567 FIXME("iface %p, data %p stub!\n", iface, data);
3572 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
3573 float *data, UINT offset, UINT count)
3575 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3580 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
3581 float *data, UINT offset, UINT count)
3583 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3588 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3591 FIXME("iface %p, data %p stub!\n", iface, data);
3596 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3599 FIXME("iface %p, data %p stub!\n", iface, data);
3604 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3605 float *data, UINT offset, UINT count)
3607 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3612 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3613 float *data, UINT offset, UINT count)
3615 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3621 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
3623 /* ID3D10EffectVariable methods */
3624 d3d10_effect_matrix_variable_IsValid,
3625 d3d10_effect_matrix_variable_GetType,
3626 d3d10_effect_matrix_variable_GetDesc,
3627 d3d10_effect_matrix_variable_GetAnnotationByIndex,
3628 d3d10_effect_matrix_variable_GetAnnotationByName,
3629 d3d10_effect_matrix_variable_GetMemberByIndex,
3630 d3d10_effect_matrix_variable_GetMemberByName,
3631 d3d10_effect_matrix_variable_GetMemberBySemantic,
3632 d3d10_effect_matrix_variable_GetElement,
3633 d3d10_effect_matrix_variable_GetParentConstantBuffer,
3634 d3d10_effect_matrix_variable_AsScalar,
3635 d3d10_effect_matrix_variable_AsVector,
3636 d3d10_effect_matrix_variable_AsMatrix,
3637 d3d10_effect_matrix_variable_AsString,
3638 d3d10_effect_matrix_variable_AsShaderResource,
3639 d3d10_effect_matrix_variable_AsRenderTargetView,
3640 d3d10_effect_matrix_variable_AsDepthStencilView,
3641 d3d10_effect_matrix_variable_AsConstantBuffer,
3642 d3d10_effect_matrix_variable_AsShader,
3643 d3d10_effect_matrix_variable_AsBlend,
3644 d3d10_effect_matrix_variable_AsDepthStencil,
3645 d3d10_effect_matrix_variable_AsRasterizer,
3646 d3d10_effect_matrix_variable_AsSampler,
3647 d3d10_effect_matrix_variable_SetRawValue,
3648 d3d10_effect_matrix_variable_GetRawValue,
3649 /* ID3D10EffectMatrixVariable methods */
3650 d3d10_effect_matrix_variable_SetMatrix,
3651 d3d10_effect_matrix_variable_GetMatrix,
3652 d3d10_effect_matrix_variable_SetMatrixArray,
3653 d3d10_effect_matrix_variable_GetMatrixArray,
3654 d3d10_effect_matrix_variable_SetMatrixTranspose,
3655 d3d10_effect_matrix_variable_GetMatrixTranspose,
3656 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
3657 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
3660 /* ID3D10EffectVariable methods */
3662 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
3664 TRACE("iface %p\n", iface);
3666 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
3669 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
3670 ID3D10EffectBlendVariable *iface)
3672 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3675 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
3676 D3D10_EFFECT_VARIABLE_DESC *desc)
3678 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3681 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
3682 ID3D10EffectBlendVariable *iface, UINT index)
3684 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3687 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
3688 ID3D10EffectBlendVariable *iface, LPCSTR name)
3690 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3693 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
3694 ID3D10EffectBlendVariable *iface, UINT index)
3696 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3699 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
3700 ID3D10EffectBlendVariable *iface, LPCSTR name)
3702 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3705 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
3706 ID3D10EffectBlendVariable *iface, LPCSTR semantic)
3708 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3711 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
3712 ID3D10EffectBlendVariable *iface, UINT index)
3714 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3717 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
3718 ID3D10EffectBlendVariable *iface)
3720 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3723 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
3724 ID3D10EffectBlendVariable *iface)
3726 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3729 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
3730 ID3D10EffectBlendVariable *iface)
3732 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3735 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
3736 ID3D10EffectBlendVariable *iface)
3738 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3741 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
3742 ID3D10EffectBlendVariable *iface)
3744 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3747 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
3748 ID3D10EffectBlendVariable *iface)
3750 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3753 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
3754 ID3D10EffectBlendVariable *iface)
3756 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3759 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
3760 ID3D10EffectBlendVariable *iface)
3762 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3765 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
3766 ID3D10EffectBlendVariable *iface)
3768 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3771 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
3772 ID3D10EffectBlendVariable *iface)
3774 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3777 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
3778 ID3D10EffectBlendVariable *iface)
3780 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3783 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
3784 ID3D10EffectBlendVariable *iface)
3786 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3789 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
3790 ID3D10EffectBlendVariable *iface)
3792 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3795 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
3796 ID3D10EffectBlendVariable *iface)
3798 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3801 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
3802 void *data, UINT offset, UINT count)
3804 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3807 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
3808 void *data, UINT offset, UINT count)
3810 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3813 /* ID3D10EffectBlendVariable methods */
3815 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
3816 UINT index, ID3D10BlendState **blend_state)
3818 FIXME("iface %p, index %u, blend_state %p stub!\n", iface, index, blend_state);
3823 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
3824 UINT index, D3D10_BLEND_DESC *desc)
3826 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
3832 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
3834 /* ID3D10EffectVariable methods */
3835 d3d10_effect_blend_variable_IsValid,
3836 d3d10_effect_blend_variable_GetType,
3837 d3d10_effect_blend_variable_GetDesc,
3838 d3d10_effect_blend_variable_GetAnnotationByIndex,
3839 d3d10_effect_blend_variable_GetAnnotationByName,
3840 d3d10_effect_blend_variable_GetMemberByIndex,
3841 d3d10_effect_blend_variable_GetMemberByName,
3842 d3d10_effect_blend_variable_GetMemberBySemantic,
3843 d3d10_effect_blend_variable_GetElement,
3844 d3d10_effect_blend_variable_GetParentConstantBuffer,
3845 d3d10_effect_blend_variable_AsScalar,
3846 d3d10_effect_blend_variable_AsVector,
3847 d3d10_effect_blend_variable_AsMatrix,
3848 d3d10_effect_blend_variable_AsString,
3849 d3d10_effect_blend_variable_AsShaderResource,
3850 d3d10_effect_blend_variable_AsRenderTargetView,
3851 d3d10_effect_blend_variable_AsDepthStencilView,
3852 d3d10_effect_blend_variable_AsConstantBuffer,
3853 d3d10_effect_blend_variable_AsShader,
3854 d3d10_effect_blend_variable_AsBlend,
3855 d3d10_effect_blend_variable_AsDepthStencil,
3856 d3d10_effect_blend_variable_AsRasterizer,
3857 d3d10_effect_blend_variable_AsSampler,
3858 d3d10_effect_blend_variable_SetRawValue,
3859 d3d10_effect_blend_variable_GetRawValue,
3860 /* ID3D10EffectBlendVariable methods */
3861 d3d10_effect_blend_variable_GetBlendState,
3862 d3d10_effect_blend_variable_GetBackingStore,
3865 /* ID3D10EffectType methods */
3867 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
3869 FIXME("iface %p stub!\n", iface);
3874 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
3876 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3878 TRACE("iface %p, desc %p\n", iface, desc);
3880 if (This == &null_type)
3882 WARN("Null type specified\n");
3888 WARN("Invalid argument specified\n");
3889 return E_INVALIDARG;
3892 desc->TypeName = This->name;
3893 desc->Class = This->type_class;
3894 desc->Type = This->basetype;
3895 desc->Elements = This->element_count;
3896 desc->Members = This->member_count;
3897 desc->Rows = This->row_count;
3898 desc->Columns = This->column_count;
3899 desc->PackedSize = This->size_packed;
3900 desc->UnpackedSize = This->size_unpacked;
3901 desc->Stride = This->stride;
3906 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
3909 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3910 struct d3d10_effect_type *t;
3912 TRACE("iface %p, index %u\n", iface, index);
3914 if (index >= This->member_count)
3916 WARN("Invalid index specified\n");
3917 return (ID3D10EffectType *)&null_type;
3920 t = (&This->members[index])->type;
3922 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
3924 return (ID3D10EffectType *)t;
3927 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
3930 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3933 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
3937 WARN("Invalid name specified\n");
3938 return (ID3D10EffectType *)&null_type;
3941 for (i = 0; i < This->member_count; ++i)
3943 struct d3d10_effect_type_member *typem = &This->members[i];
3947 if (!strcmp(typem->name, name))
3949 TRACE("Returning type %p.\n", typem->type);
3950 return (ID3D10EffectType *)typem->type;
3955 WARN("Invalid name specified\n");
3957 return (ID3D10EffectType *)&null_type;
3960 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
3963 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3966 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
3970 WARN("Invalid semantic specified\n");
3971 return (ID3D10EffectType *)&null_type;
3974 for (i = 0; i < This->member_count; ++i)
3976 struct d3d10_effect_type_member *typem = &This->members[i];
3978 if (typem->semantic)
3980 if (!strcmp(typem->semantic, semantic))
3982 TRACE("Returning type %p.\n", typem->type);
3983 return (ID3D10EffectType *)typem->type;
3988 WARN("Invalid semantic specified\n");
3990 return (ID3D10EffectType *)&null_type;
3993 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
3995 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3996 struct d3d10_effect_type_member *typem;
3998 TRACE("iface %p, index %u\n", iface, index);
4000 if (index >= This->member_count)
4002 WARN("Invalid index specified\n");
4006 typem = &This->members[index];
4008 TRACE("Returning name %s\n", debugstr_a(typem->name));
4013 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
4015 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
4016 struct d3d10_effect_type_member *typem;
4018 TRACE("iface %p, index %u\n", iface, index);
4020 if (index >= This->member_count)
4022 WARN("Invalid index specified\n");
4026 typem = &This->members[index];
4028 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
4030 return typem->semantic;
4033 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
4035 /* ID3D10EffectType */
4036 d3d10_effect_type_IsValid,
4037 d3d10_effect_type_GetDesc,
4038 d3d10_effect_type_GetMemberTypeByIndex,
4039 d3d10_effect_type_GetMemberTypeByName,
4040 d3d10_effect_type_GetMemberTypeBySemantic,
4041 d3d10_effect_type_GetMemberName,
4042 d3d10_effect_type_GetMemberSemantic,