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 ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
57 /* null objects - needed for invalid calls */
58 static struct d3d10_effect_technique null_technique =
59 {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL, NULL};
60 static struct d3d10_effect_pass null_pass =
61 {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL, NULL};
62 static struct d3d10_effect_type null_type =
63 {&d3d10_effect_type_vtbl, 0, {NULL, NULL, 0}, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL};
64 static struct d3d10_effect_variable null_local_buffer =
65 {(ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl, &null_local_buffer,
66 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
67 static struct d3d10_effect_variable null_variable =
68 {&d3d10_effect_variable_vtbl, &null_local_buffer,
69 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
70 static struct d3d10_effect_variable null_scalar_variable =
71 {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, &null_local_buffer,
72 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
73 static struct d3d10_effect_variable null_vector_variable =
74 {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, &null_local_buffer,
75 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
76 static struct d3d10_effect_variable null_matrix_variable =
77 {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, &null_local_buffer,
78 NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL, NULL};
80 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
82 static inline void read_dword(const char **ptr, DWORD *d)
84 memcpy(d, *ptr, sizeof(*d));
88 static inline void skip_dword_unknown(const char **ptr, unsigned int count)
93 FIXME("Skipping %u unknown DWORDs:\n", count);
94 for (i = 0; i < count; ++i)
97 FIXME("\t0x%08x\n", d);
101 static inline void write_dword(char **ptr, DWORD d)
103 memcpy(*ptr, &d, sizeof(d));
107 static inline void write_dword_unknown(char **ptr, DWORD d)
109 FIXME("Writing unknown DWORD 0x%08x\n", d);
113 static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
114 HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx)
116 const char *ptr = data;
123 read_dword(&ptr, &tag);
124 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
128 WARN("Wrong tag.\n");
133 skip_dword_unknown(&ptr, 4);
135 skip_dword_unknown(&ptr, 1);
137 read_dword(&ptr, &total_size);
138 TRACE("total size: %#x\n", total_size);
140 read_dword(&ptr, &chunk_count);
141 TRACE("chunk count: %#x\n", chunk_count);
143 for (i = 0; i < chunk_count; ++i)
145 DWORD chunk_tag, chunk_size;
146 const char *chunk_ptr;
149 read_dword(&ptr, &chunk_offset);
150 TRACE("chunk %u at offset %#x\n", i, chunk_offset);
152 chunk_ptr = data + chunk_offset;
154 read_dword(&chunk_ptr, &chunk_tag);
155 read_dword(&chunk_ptr, &chunk_size);
157 hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx);
158 if (FAILED(hr)) break;
164 static BOOL copy_name(const char *ptr, char **name)
168 if (!ptr) return TRUE;
170 name_len = strlen(ptr) + 1;
176 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
179 ERR("Failed to allocate name memory.\n");
183 memcpy(*name, ptr, name_len);
188 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
190 struct d3d10_effect_shader_variable *s = ctx;
192 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
194 TRACE("chunk size: %#x\n", data_size);
200 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
201 UINT size = 44 + data_size;
204 s->input_signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
205 if (!s->input_signature)
207 ERR("Failed to allocate input signature data\n");
208 return E_OUTOFMEMORY;
210 s->input_signature_size = size;
212 ptr = s->input_signature;
214 write_dword(&ptr, TAG_DXBC);
217 write_dword_unknown(&ptr, 0);
218 write_dword_unknown(&ptr, 0);
219 write_dword_unknown(&ptr, 0);
220 write_dword_unknown(&ptr, 0);
222 /* seems to be always 1 */
223 write_dword_unknown(&ptr, 1);
226 write_dword(&ptr, size);
229 write_dword(&ptr, 1);
232 write_dword(&ptr, (ptr - s->input_signature) + 4);
235 write_dword(&ptr, TAG_ISGN);
236 write_dword(&ptr, data_size);
237 memcpy(ptr, data, data_size);
242 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
249 static HRESULT parse_shader(struct d3d10_effect_object *o, const char *data)
251 ID3D10Device *device = o->pass->technique->effect->device;
252 struct d3d10_effect_shader_variable *s;
253 const char *ptr = data;
257 o->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3d10_effect_shader_variable));
260 ERR("Failed to allocate shader variable memory\n");
261 return E_OUTOFMEMORY;
264 if (!ptr) return S_OK;
268 read_dword(&ptr, &dxbc_size);
269 TRACE("dxbc size: %#x\n", dxbc_size);
273 case D3D10_EOT_VERTEXSHADER:
274 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
275 if (FAILED(hr)) return hr;
278 case D3D10_EOT_PIXELSHADER:
279 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
280 if (FAILED(hr)) return hr;
282 case D3D10_EOT_GEOMETRYSHADER:
283 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
284 if (FAILED(hr)) return hr;
288 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
291 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
295 case 1: return D3D10_SVC_SCALAR;
296 case 2: return D3D10_SVC_VECTOR;
297 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
298 else return D3D10_SVC_MATRIX_ROWS;
300 FIXME("Unknown variable class %#x.\n", c);
305 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
311 case 1: return D3D10_SVT_STRING;
312 case 2: return D3D10_SVT_BLEND;
313 case 3: return D3D10_SVT_DEPTHSTENCIL;
314 case 4: return D3D10_SVT_RASTERIZER;
315 case 5: return D3D10_SVT_PIXELSHADER;
316 case 6: return D3D10_SVT_VERTEXSHADER;
317 case 7: return D3D10_SVT_GEOMETRYSHADER;
319 case 10: return D3D10_SVT_TEXTURE1D;
320 case 11: return D3D10_SVT_TEXTURE1DARRAY;
321 case 12: return D3D10_SVT_TEXTURE2D;
322 case 13: return D3D10_SVT_TEXTURE2DARRAY;
323 case 14: return D3D10_SVT_TEXTURE2DMS;
324 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
325 case 16: return D3D10_SVT_TEXTURE3D;
326 case 17: return D3D10_SVT_TEXTURECUBE;
328 case 19: return D3D10_SVT_RENDERTARGETVIEW;
329 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
330 case 21: return D3D10_SVT_SAMPLER;
332 FIXME("Unknown variable type %#x.\n", t);
340 case 1: return D3D10_SVT_FLOAT;
341 case 2: return D3D10_SVT_INT;
342 case 3: return D3D10_SVT_UINT;
343 case 4: return D3D10_SVT_BOOL;
345 FIXME("Unknown variable type %#x.\n", t);
351 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
358 read_dword(&ptr, &offset);
359 TRACE("Type name at offset %#x.\n", offset);
361 if (!copy_name(data + offset, &t->name))
363 ERR("Failed to copy name.\n");
364 return E_OUTOFMEMORY;
366 TRACE("Type name: %s.\n", debugstr_a(t->name));
368 read_dword(&ptr, &unknown0);
369 TRACE("Unknown 0: %u.\n", unknown0);
371 read_dword(&ptr, &t->element_count);
372 TRACE("Element count: %u.\n", t->element_count);
374 read_dword(&ptr, &t->size_unpacked);
375 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
377 read_dword(&ptr, &t->stride);
378 TRACE("Stride: %#x.\n", t->stride);
380 read_dword(&ptr, &t->size_packed);
381 TRACE("Packed size %#x.\n", t->size_packed);
388 read_dword(&ptr, &typeinfo);
389 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
390 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
391 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
392 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);
394 TRACE("Type description: %#x.\n", typeinfo);
395 TRACE("\tcolumns: %u.\n", t->column_count);
396 TRACE("\trows: %u.\n", t->row_count);
397 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
398 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
399 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
400 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
404 TRACE("Type is an object.\n");
409 t->type_class = D3D10_SVC_OBJECT;
411 read_dword(&ptr, &typeinfo);
412 t->basetype = d3d10_variable_type(typeinfo, TRUE);
414 TRACE("Type description: %#x.\n", typeinfo);
415 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
416 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
420 TRACE("Type is a structure.\n");
422 read_dword(&ptr, &t->member_count);
423 TRACE("Member count: %u.\n", t->member_count);
428 t->type_class = D3D10_SVC_STRUCT;
430 t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
433 ERR("Failed to allocate members memory.\n");
434 return E_OUTOFMEMORY;
437 for (i = 0; i < t->member_count; ++i)
439 struct d3d10_effect_type_member *typem = &t->members[i];
441 read_dword(&ptr, &offset);
442 TRACE("Member name at offset %#x.\n", offset);
444 if (!copy_name(data + offset, &typem->name))
446 ERR("Failed to copy name.\n");
447 return E_OUTOFMEMORY;
449 TRACE("Member name: %s.\n", debugstr_a(typem->name));
451 read_dword(&ptr, &offset);
452 TRACE("Member semantic at offset %#x.\n", offset);
454 if (!copy_name(data + offset, &typem->semantic))
456 ERR("Failed to copy semantic.\n");
457 return E_OUTOFMEMORY;
459 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
461 read_dword(&ptr, &typem->buffer_offset);
462 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
464 read_dword(&ptr, &offset);
465 TRACE("Member type info at offset %#x.\n", offset);
467 typem->type = get_fx10_type(t->effect, data, offset);
470 ERR("Failed to get variable type.\n");
477 FIXME("Unhandled case %#x.\n", unknown0);
481 if (t->element_count)
483 TRACE("Elementtype for type at offset: %#x\n", t->id);
485 /* allocate elementtype - we need only one, because all elements have the same type */
486 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
489 ERR("Failed to allocate members memory.\n");
490 return E_OUTOFMEMORY;
493 /* create a copy of the original type with some minor changes */
494 t->elementtype->vtbl = &d3d10_effect_type_vtbl;
495 t->elementtype->effect = t->effect;
497 if (!copy_name(t->name, &t->elementtype->name))
499 ERR("Failed to copy name.\n");
500 return E_OUTOFMEMORY;
502 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
504 t->elementtype->element_count = 0;
505 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
508 * Not sure if this calculation is 100% correct, but a test
509 * show's that these values work.
511 t->elementtype->size_unpacked = t->size_packed / t->element_count;
512 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
514 t->elementtype->stride = t->stride;
515 TRACE("\tStride: %#x.\n", t->elementtype->stride);
517 t->elementtype->size_packed = t->size_packed / t->element_count;
518 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
520 t->elementtype->member_count = t->member_count;
521 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
523 t->elementtype->column_count = t->column_count;
524 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
526 t->elementtype->row_count = t->row_count;
527 TRACE("\tRows: %u.\n", t->elementtype->row_count);
529 t->elementtype->basetype = t->basetype;
530 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
532 t->elementtype->type_class = t->type_class;
533 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
535 t->elementtype->members = t->members;
541 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
543 struct d3d10_effect_type *type;
544 struct wine_rb_entry *entry;
547 entry = wine_rb_get(&effect->types, &offset);
550 TRACE("Returning existing type.\n");
551 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
554 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
557 ERR("Failed to allocate type memory.\n");
561 type->vtbl = &d3d10_effect_type_vtbl;
563 type->effect = effect;
564 hr = parse_fx10_type(type, data + offset, data);
567 ERR("Failed to parse type info, hr %#x.\n", hr);
568 HeapFree(GetProcessHeap(), 0, type);
572 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
574 ERR("Failed to insert type entry.\n");
575 HeapFree(GetProcessHeap(), 0, type);
582 static void set_variable_vtbl(struct d3d10_effect_variable *v)
584 switch (v->type->type_class)
586 case D3D10_SVC_SCALAR:
587 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
590 case D3D10_SVC_VECTOR:
591 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
594 case D3D10_SVC_MATRIX_ROWS:
595 case D3D10_SVC_MATRIX_COLUMNS:
596 v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
599 case D3D10_SVC_STRUCT:
600 v->vtbl = &d3d10_effect_variable_vtbl;
604 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
605 v->vtbl = &d3d10_effect_variable_vtbl;
610 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
615 if (v->type->member_count)
617 v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
620 ERR("Failed to allocate members memory.\n");
621 return E_OUTOFMEMORY;
624 for (i = 0; i < v->type->member_count; ++i)
626 struct d3d10_effect_variable *var = &v->members[i];
627 struct d3d10_effect_type_member *typem = &v->type->members[i];
629 var->buffer = v->buffer;
630 var->effect = v->effect;
631 var->type = typem->type;
632 set_variable_vtbl(var);
634 if (!copy_name(typem->name, &var->name))
636 ERR("Failed to copy name.\n");
637 return E_OUTOFMEMORY;
639 TRACE("Variable name: %s.\n", debugstr_a(var->name));
641 if (!copy_name(typem->semantic, &var->semantic))
643 ERR("Failed to copy name.\n");
644 return E_OUTOFMEMORY;
646 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
648 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
649 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
651 hr = copy_variableinfo_from_type(var);
652 if (FAILED(hr)) return hr;
656 if (v->type->element_count)
658 unsigned int bufferoffset = v->buffer_offset;
660 v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
663 ERR("Failed to allocate elements memory.\n");
664 return E_OUTOFMEMORY;
667 for (i = 0; i < v->type->element_count; ++i)
669 struct d3d10_effect_variable *var = &v->elements[i];
671 var->buffer = v->buffer;
672 var->effect = v->effect;
673 var->type = v->type->elementtype;
674 set_variable_vtbl(var);
676 if (!copy_name(v->name, &var->name))
678 ERR("Failed to copy name.\n");
679 return E_OUTOFMEMORY;
681 TRACE("Variable name: %s.\n", debugstr_a(var->name));
683 if (!copy_name(v->semantic, &var->semantic))
685 ERR("Failed to copy name.\n");
686 return E_OUTOFMEMORY;
688 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
692 bufferoffset += v->type->stride;
694 var->buffer_offset = bufferoffset;
695 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
697 hr = copy_variableinfo_from_type(var);
698 if (FAILED(hr)) return hr;
705 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
709 read_dword(ptr, &offset);
710 TRACE("Variable name at offset %#x.\n", offset);
712 if (!copy_name(data + offset, &v->name))
714 ERR("Failed to copy name.\n");
715 return E_OUTOFMEMORY;
717 TRACE("Variable name: %s.\n", debugstr_a(v->name));
719 read_dword(ptr, &offset);
720 TRACE("Variable type info at offset %#x.\n", offset);
722 v->type = get_fx10_type(v->effect, data, offset);
725 ERR("Failed to get variable type.\n");
728 set_variable_vtbl(v);
730 return copy_variableinfo_from_type(v);
733 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
737 hr = parse_fx10_variable_head(a, ptr, data);
738 if (FAILED(hr)) return hr;
740 skip_dword_unknown(ptr, 1);
745 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
747 const char *data_ptr;
751 read_dword(ptr, &o->type);
752 TRACE("Effect object is of type %#x.\n", o->type);
754 skip_dword_unknown(ptr, 2);
756 read_dword(ptr, &offset);
757 TRACE("Effect object idx is at offset %#x.\n", offset);
759 data_ptr = data + offset;
760 read_dword(&data_ptr, &offset);
762 TRACE("Effect object starts at offset %#x.\n", offset);
764 /* FIXME: This probably isn't completely correct. */
767 WARN("Skipping effect object.\n");
772 data_ptr = data + offset;
777 case D3D10_EOT_VERTEXSHADER:
778 TRACE("Vertex shader\n");
779 hr = parse_shader(o, data_ptr);
782 case D3D10_EOT_PIXELSHADER:
783 TRACE("Pixel shader\n");
784 hr = parse_shader(o, data_ptr);
787 case D3D10_EOT_GEOMETRYSHADER:
788 TRACE("Geometry shader\n");
789 hr = parse_shader(o, data_ptr);
793 FIXME("Unhandled object type %#x\n", o->type);
801 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
807 read_dword(ptr, &offset);
808 TRACE("Pass name at offset %#x.\n", offset);
810 if (!copy_name(data + offset, &p->name))
812 ERR("Failed to copy name.\n");
813 return E_OUTOFMEMORY;
815 TRACE("Pass name: %s.\n", debugstr_a(p->name));
817 read_dword(ptr, &p->object_count);
818 TRACE("Pass has %u effect objects.\n", p->object_count);
820 read_dword(ptr, &p->annotation_count);
821 TRACE("Pass has %u annotations.\n", p->annotation_count);
823 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
826 ERR("Failed to allocate pass annotations memory.\n");
827 return E_OUTOFMEMORY;
830 for(i = 0; i < p->annotation_count; ++i)
832 struct d3d10_effect_variable *a = &p->annotations[i];
834 a->effect = p->technique->effect;
836 hr = parse_fx10_annotation(a, ptr, data);
837 if (FAILED(hr)) return hr;
840 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
843 ERR("Failed to allocate effect objects memory.\n");
844 return E_OUTOFMEMORY;
847 for (i = 0; i < p->object_count; ++i)
849 struct d3d10_effect_object *o = &p->objects[i];
853 hr = parse_fx10_object(o, ptr, data);
854 if (FAILED(hr)) return hr;
860 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
866 read_dword(ptr, &offset);
867 TRACE("Technique name at offset %#x.\n", offset);
869 if (!copy_name(data + offset, &t->name))
871 ERR("Failed to copy name.\n");
872 return E_OUTOFMEMORY;
874 TRACE("Technique name: %s.\n", debugstr_a(t->name));
876 read_dword(ptr, &t->pass_count);
877 TRACE("Technique has %u passes\n", t->pass_count);
879 read_dword(ptr, &t->annotation_count);
880 TRACE("Technique has %u annotations.\n", t->annotation_count);
882 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
885 ERR("Failed to allocate technique annotations memory.\n");
886 return E_OUTOFMEMORY;
889 for(i = 0; i < t->annotation_count; ++i)
891 struct d3d10_effect_variable *a = &t->annotations[i];
893 a->effect = t->effect;
895 hr = parse_fx10_annotation(a, ptr, data);
896 if (FAILED(hr)) return hr;
899 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
902 ERR("Failed to allocate passes memory\n");
903 return E_OUTOFMEMORY;
906 for (i = 0; i < t->pass_count; ++i)
908 struct d3d10_effect_pass *p = &t->passes[i];
910 p->vtbl = &d3d10_effect_pass_vtbl;
913 hr = parse_fx10_pass(p, ptr, data);
914 if (FAILED(hr)) return hr;
920 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
926 hr = parse_fx10_variable_head(v, ptr, data);
927 if (FAILED(hr)) return hr;
929 read_dword(ptr, &offset);
930 TRACE("Variable semantic at offset %#x.\n", offset);
932 if (!copy_name(data + offset, &v->semantic))
934 ERR("Failed to copy semantic.\n");
935 return E_OUTOFMEMORY;
937 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
939 read_dword(ptr, &v->buffer_offset);
940 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
942 skip_dword_unknown(ptr, 1);
944 read_dword(ptr, &v->flag);
945 TRACE("Variable flag: %#x.\n", v->flag);
947 read_dword(ptr, &v->annotation_count);
948 TRACE("Variable has %u annotations.\n", v->annotation_count);
950 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
953 ERR("Failed to allocate variable annotations memory.\n");
954 return E_OUTOFMEMORY;
957 for (i = 0; i < v->annotation_count; ++i)
959 struct d3d10_effect_variable *a = &v->annotations[i];
961 a->effect = v->effect;
963 hr = parse_fx10_annotation(a, ptr, data);
964 if (FAILED(hr)) return hr;
970 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
975 hr = parse_fx10_variable_head(v, ptr, data);
976 if (FAILED(hr)) return hr;
978 skip_dword_unknown(ptr, 2);
980 switch (v->type->basetype)
982 case D3D10_SVT_TEXTURE1D:
983 case D3D10_SVT_TEXTURE1DARRAY:
984 case D3D10_SVT_TEXTURE2D:
985 case D3D10_SVT_TEXTURE2DARRAY:
986 case D3D10_SVT_TEXTURE2DMS:
987 case D3D10_SVT_TEXTURE2DMSARRAY:
988 case D3D10_SVT_TEXTURE3D:
989 case D3D10_SVT_TEXTURECUBE:
990 case D3D10_SVT_RENDERTARGETVIEW:
991 case D3D10_SVT_DEPTHSTENCILVIEW:
992 TRACE("SVT could not have elements.\n");
995 case D3D10_SVT_VERTEXSHADER:
996 case D3D10_SVT_PIXELSHADER:
997 case D3D10_SVT_GEOMETRYSHADER:
998 TRACE("SVT is a shader.\n");
999 for (i = 0; i < max(v->type->element_count, 1); ++i)
1001 DWORD shader_offset;
1004 * TODO: Parse the shader
1006 read_dword(ptr, &shader_offset);
1007 FIXME("Shader offset: %#x.\n", shader_offset);
1011 case D3D10_SVT_DEPTHSTENCIL:
1012 case D3D10_SVT_BLEND:
1013 case D3D10_SVT_RASTERIZER:
1014 case D3D10_SVT_SAMPLER:
1015 TRACE("SVT is a state.\n");
1016 for (i = 0; i < max(v->type->element_count, 1); ++i)
1021 read_dword(ptr, &object_count);
1022 TRACE("Object count: %#x.\n", object_count);
1024 for (j = 0; j < object_count; ++j)
1026 skip_dword_unknown(ptr, 4);
1032 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1036 read_dword(ptr, &v->annotation_count);
1037 TRACE("Variable has %u annotations.\n", v->annotation_count);
1039 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1040 if (!v->annotations)
1042 ERR("Failed to allocate variable annotations memory.\n");
1043 return E_OUTOFMEMORY;
1046 for (i = 0; i < v->annotation_count; ++i)
1048 struct d3d10_effect_variable *a = &v->annotations[i];
1050 a->effect = v->effect;
1052 hr = parse_fx10_annotation(a, ptr, data);
1053 if (FAILED(hr)) return hr;
1059 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1063 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1066 /* Generate our own type, it isn't in the fx blob. */
1067 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1070 ERR("Failed to allocate local buffer type memory.\n");
1071 return E_OUTOFMEMORY;
1073 l->type->vtbl = &d3d10_effect_type_vtbl;
1074 l->type->type_class = D3D10_SVC_OBJECT;
1075 l->type->effect = l->effect;
1077 read_dword(ptr, &offset);
1078 TRACE("Local buffer name at offset %#x.\n", offset);
1080 if (!copy_name(data + offset, &l->name))
1082 ERR("Failed to copy name.\n");
1083 return E_OUTOFMEMORY;
1085 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1087 read_dword(ptr, &l->data_size);
1088 TRACE("Local buffer data size: %#x.\n", l->data_size);
1090 read_dword(ptr, &d3d10_cbuffer_type);
1091 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1093 switch(d3d10_cbuffer_type)
1095 case D3D10_CT_CBUFFER:
1096 l->type->basetype = D3D10_SVT_CBUFFER;
1097 if (!copy_name("cbuffer", &l->type->name))
1099 ERR("Failed to copy name.\n");
1100 return E_OUTOFMEMORY;
1104 case D3D10_CT_TBUFFER:
1105 l->type->basetype = D3D10_SVT_TBUFFER;
1106 if (!copy_name("tbuffer", &l->type->name))
1108 ERR("Failed to copy name.\n");
1109 return E_OUTOFMEMORY;
1114 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1118 read_dword(ptr, &l->type->member_count);
1119 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1121 skip_dword_unknown(ptr, 1);
1123 read_dword(ptr, &l->annotation_count);
1124 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1126 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1127 if (!l->annotations)
1129 ERR("Failed to allocate local buffer annotations memory.\n");
1130 return E_OUTOFMEMORY;
1133 for(i = 0; i < l->annotation_count; ++i)
1135 struct d3d10_effect_variable *a = &l->annotations[i];
1137 a->effect = l->effect;
1139 hr = parse_fx10_annotation(a, ptr, data);
1140 if (FAILED(hr)) return hr;
1143 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1146 ERR("Failed to allocate members memory.\n");
1147 return E_OUTOFMEMORY;
1150 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1151 if (!l->type->members)
1153 ERR("Failed to allocate type members memory.\n");
1154 return E_OUTOFMEMORY;
1157 for (i = 0; i < l->type->member_count; ++i)
1159 struct d3d10_effect_variable *v = &l->members[i];
1160 struct d3d10_effect_type_member *typem = &l->type->members[i];
1163 v->effect = l->effect;
1165 hr = parse_fx10_variable(v, ptr, data);
1166 if (FAILED(hr)) return hr;
1169 * Copy the values from the variable type to the constant buffers type
1170 * members structure, because it is our own generated type.
1172 typem->type = v->type;
1174 if (!copy_name(v->name, &typem->name))
1176 ERR("Failed to copy name.\n");
1177 return E_OUTOFMEMORY;
1179 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1181 if (!copy_name(v->semantic, &typem->semantic))
1183 ERR("Failed to copy name.\n");
1184 return E_OUTOFMEMORY;
1186 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1188 typem->buffer_offset = v->buffer_offset;
1189 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1191 l->type->size_packed += v->type->size_packed;
1192 l->type->size_unpacked += v->type->size_unpacked;
1194 l->type->stride = l->type->size_unpacked = (l->type->size_unpacked + 0xf) & ~0xf;
1196 TRACE("Constant buffer:\n");
1197 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1198 TRACE("\tElement count: %u.\n", l->type->element_count);
1199 TRACE("\tMember count: %u.\n", l->type->member_count);
1200 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1201 TRACE("\tStride: %#x.\n", l->type->stride);
1202 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1203 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1204 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1209 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1211 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1212 const DWORD *id = key;
1217 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1219 TRACE("effect type member %p.\n", typem);
1221 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1222 HeapFree(GetProcessHeap(), 0, typem->semantic);
1223 HeapFree(GetProcessHeap(), 0, typem->name);
1226 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1228 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1230 TRACE("effect type %p.\n", t);
1234 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1235 HeapFree(GetProcessHeap(), 0, t->elementtype);
1242 for (i = 0; i < t->member_count; ++i)
1244 d3d10_effect_type_member_destroy(&t->members[i]);
1246 HeapFree(GetProcessHeap(), 0, t->members);
1249 HeapFree(GetProcessHeap(), 0, t->name);
1250 HeapFree(GetProcessHeap(), 0, t);
1253 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1258 d3d10_effect_type_compare,
1261 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1263 const char *ptr = data + e->index_offset;
1267 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1269 ERR("Failed to initialize type rbtree.\n");
1273 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1274 if (!e->local_buffers)
1276 ERR("Failed to allocate local buffer memory.\n");
1277 return E_OUTOFMEMORY;
1280 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1281 if (!e->local_variables)
1283 ERR("Failed to allocate local variable memory.\n");
1284 return E_OUTOFMEMORY;
1287 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
1290 ERR("Failed to allocate techniques memory\n");
1291 return E_OUTOFMEMORY;
1294 for (i = 0; i < e->local_buffer_count; ++i)
1296 struct d3d10_effect_variable *l = &e->local_buffers[i];
1297 l->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
1299 l->buffer = &null_local_buffer;
1301 hr = parse_fx10_local_buffer(l, &ptr, data);
1302 if (FAILED(hr)) return hr;
1305 for (i = 0; i < e->local_variable_count; ++i)
1307 struct d3d10_effect_variable *v = &e->local_variables[i];
1310 v->vtbl = &d3d10_effect_variable_vtbl;
1312 hr = parse_fx10_local_variable(v, &ptr, data);
1313 if (FAILED(hr)) return hr;
1316 for (i = 0; i < e->technique_count; ++i)
1318 struct d3d10_effect_technique *t = &e->techniques[i];
1320 t->vtbl = &d3d10_effect_technique_vtbl;
1323 hr = parse_fx10_technique(t, &ptr, data);
1324 if (FAILED(hr)) return hr;
1330 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
1332 const char *ptr = data;
1335 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
1336 read_dword(&ptr, &e->version);
1337 TRACE("Target: %#x\n", e->version);
1339 read_dword(&ptr, &e->local_buffer_count);
1340 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
1342 read_dword(&ptr, &e->variable_count);
1343 TRACE("Variable count: %u\n", e->variable_count);
1345 read_dword(&ptr, &e->local_variable_count);
1346 TRACE("Object count: %u\n", e->local_variable_count);
1348 read_dword(&ptr, &e->sharedbuffers_count);
1349 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
1351 /* Number of variables in shared buffers? */
1352 read_dword(&ptr, &unknown);
1353 FIXME("Unknown 0: %u\n", unknown);
1355 read_dword(&ptr, &e->sharedobjects_count);
1356 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
1358 read_dword(&ptr, &e->technique_count);
1359 TRACE("Technique count: %u\n", e->technique_count);
1361 read_dword(&ptr, &e->index_offset);
1362 TRACE("Index offset: %#x\n", e->index_offset);
1364 read_dword(&ptr, &unknown);
1365 FIXME("Unknown 1: %u\n", unknown);
1367 read_dword(&ptr, &e->texture_count);
1368 TRACE("Texture count: %u\n", e->texture_count);
1370 read_dword(&ptr, &e->dephstencilstate_count);
1371 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
1373 read_dword(&ptr, &e->blendstate_count);
1374 TRACE("Blendstate count: %u\n", e->blendstate_count);
1376 read_dword(&ptr, &e->rasterizerstate_count);
1377 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
1379 read_dword(&ptr, &e->samplerstate_count);
1380 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
1382 read_dword(&ptr, &e->rendertargetview_count);
1383 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
1385 read_dword(&ptr, &e->depthstencilview_count);
1386 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
1388 read_dword(&ptr, &e->shader_call_count);
1389 TRACE("Shader call count: %u\n", e->shader_call_count);
1391 read_dword(&ptr, &e->shader_compile_count);
1392 TRACE("Shader compile count: %u\n", e->shader_compile_count);
1394 return parse_fx10_body(e, ptr, data_size - (ptr - data));
1397 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
1399 struct d3d10_effect *e = ctx;
1401 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
1403 TRACE("chunk size: %#x\n", data_size);
1408 return parse_fx10(e, data, data_size);
1411 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
1416 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
1418 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
1421 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
1423 TRACE("effect object %p.\n", o);
1427 case D3D10_EOT_VERTEXSHADER:
1428 case D3D10_EOT_PIXELSHADER:
1429 case D3D10_EOT_GEOMETRYSHADER:
1430 HeapFree(GetProcessHeap(), 0, ((struct d3d10_effect_shader_variable *)o->data)->input_signature);
1436 HeapFree(GetProcessHeap(), 0, o->data);
1439 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
1441 ID3D10Device *device = o->pass->technique->effect->device;
1443 TRACE("effect object %p, type %#x.\n", o, o->type);
1447 case D3D10_EOT_VERTEXSHADER:
1448 ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.vs);
1451 case D3D10_EOT_PIXELSHADER:
1452 ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.ps);
1455 case D3D10_EOT_GEOMETRYSHADER:
1456 ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.gs);
1460 FIXME("Unhandled effect object type %#x.\n", o->type);
1465 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
1469 TRACE("variable %p.\n", v);
1471 HeapFree(GetProcessHeap(), 0, v->name);
1472 HeapFree(GetProcessHeap(), 0, v->semantic);
1475 for (i = 0; i < v->annotation_count; ++i)
1477 d3d10_effect_variable_destroy(&v->annotations[i]);
1479 HeapFree(GetProcessHeap(), 0, v->annotations);
1484 for (i = 0; i < v->type->member_count; ++i)
1486 d3d10_effect_variable_destroy(&v->members[i]);
1488 HeapFree(GetProcessHeap(), 0, v->members);
1493 for (i = 0; i < v->type->element_count; ++i)
1495 d3d10_effect_variable_destroy(&v->elements[i]);
1497 HeapFree(GetProcessHeap(), 0, v->elements);
1501 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
1505 TRACE("pass %p\n", p);
1507 HeapFree(GetProcessHeap(), 0, p->name);
1510 for (i = 0; i < p->object_count; ++i)
1512 d3d10_effect_object_destroy(&p->objects[i]);
1514 HeapFree(GetProcessHeap(), 0, p->objects);
1519 for (i = 0; i < p->annotation_count; ++i)
1521 d3d10_effect_variable_destroy(&p->annotations[i]);
1523 HeapFree(GetProcessHeap(), 0, p->annotations);
1528 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
1532 TRACE("technique %p\n", t);
1534 HeapFree(GetProcessHeap(), 0, t->name);
1537 for (i = 0; i < t->pass_count; ++i)
1539 d3d10_effect_pass_destroy(&t->passes[i]);
1541 HeapFree(GetProcessHeap(), 0, t->passes);
1546 for (i = 0; i < t->annotation_count; ++i)
1548 d3d10_effect_variable_destroy(&t->annotations[i]);
1550 HeapFree(GetProcessHeap(), 0, t->annotations);
1554 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
1558 TRACE("local buffer %p.\n", l);
1560 HeapFree(GetProcessHeap(), 0, l->name);
1563 for (i = 0; i < l->type->member_count; ++i)
1565 d3d10_effect_variable_destroy(&l->members[i]);
1567 HeapFree(GetProcessHeap(), 0, l->members);
1570 if (l->type->members)
1572 for (i = 0; i < l->type->member_count; ++i)
1574 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
1575 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
1576 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
1578 HeapFree(GetProcessHeap(), 0, l->type->members);
1580 HeapFree(GetProcessHeap(), 0, l->type->name);
1581 HeapFree(GetProcessHeap(), 0, l->type);
1585 for (i = 0; i < l->annotation_count; ++i)
1587 d3d10_effect_variable_destroy(&l->annotations[i]);
1589 HeapFree(GetProcessHeap(), 0, l->annotations);
1593 /* IUnknown methods */
1595 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
1597 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
1599 if (IsEqualGUID(riid, &IID_ID3D10Effect)
1600 || IsEqualGUID(riid, &IID_IUnknown))
1602 IUnknown_AddRef(iface);
1607 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
1610 return E_NOINTERFACE;
1613 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
1615 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1616 ULONG refcount = InterlockedIncrement(&This->refcount);
1618 TRACE("%p increasing refcount to %u\n", This, refcount);
1623 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
1625 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1626 ULONG refcount = InterlockedDecrement(&This->refcount);
1628 TRACE("%p decreasing refcount to %u\n", This, refcount);
1634 if (This->techniques)
1636 for (i = 0; i < This->technique_count; ++i)
1638 d3d10_effect_technique_destroy(&This->techniques[i]);
1640 HeapFree(GetProcessHeap(), 0, This->techniques);
1643 if (This->local_variables)
1645 for (i = 0; i < This->local_variable_count; ++i)
1647 d3d10_effect_variable_destroy(&This->local_variables[i]);
1649 HeapFree(GetProcessHeap(), 0, &This->local_variables);
1652 if (This->local_buffers)
1654 for (i = 0; i < This->local_buffer_count; ++i)
1656 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
1658 HeapFree(GetProcessHeap(), 0, This->local_buffers);
1661 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
1663 ID3D10Device_Release(This->device);
1664 HeapFree(GetProcessHeap(), 0, This);
1670 /* ID3D10Effect methods */
1672 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
1674 FIXME("iface %p stub!\n", iface);
1679 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
1681 FIXME("iface %p stub!\n", iface);
1686 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
1688 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1690 TRACE("iface %p, device %p\n", iface, device);
1692 ID3D10Device_AddRef(This->device);
1693 *device = This->device;
1698 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
1700 FIXME("iface %p, desc %p stub!\n", iface, desc);
1705 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
1708 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1709 struct d3d10_effect_variable *l;
1711 TRACE("iface %p, index %u\n", iface, index);
1713 if (index >= This->local_buffer_count)
1715 WARN("Invalid index specified\n");
1716 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1719 l = &This->local_buffers[index];
1721 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
1723 return (ID3D10EffectConstantBuffer *)l;
1726 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
1729 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1732 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1734 for (i = 0; i < This->local_buffer_count; ++i)
1736 struct d3d10_effect_variable *l = &This->local_buffers[i];
1738 if (!strcmp(l->name, name))
1740 TRACE("Returning buffer %p.\n", l);
1741 return (ID3D10EffectConstantBuffer *)l;
1745 WARN("Invalid name specified\n");
1747 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
1750 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
1752 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1755 TRACE("iface %p, index %u\n", iface, index);
1757 for (i = 0; i < This->local_buffer_count; ++i)
1759 struct d3d10_effect_variable *l = &This->local_buffers[i];
1761 if (index < l->type->member_count)
1763 struct d3d10_effect_variable *v = &l->members[index];
1765 TRACE("Returning variable %p.\n", v);
1766 return (ID3D10EffectVariable *)v;
1768 index -= l->type->member_count;
1771 if (index < This->local_variable_count)
1773 struct d3d10_effect_variable *v = &This->local_variables[index];
1775 TRACE("Returning variable %p.\n", v);
1776 return (ID3D10EffectVariable *)v;
1779 WARN("Invalid index specified\n");
1781 return (ID3D10EffectVariable *)&null_variable;
1784 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
1786 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1789 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1791 for (i = 0; i < This->local_buffer_count; ++i)
1793 struct d3d10_effect_variable *l = &This->local_buffers[i];
1796 for (j = 0; j < l->type->member_count; ++j)
1798 struct d3d10_effect_variable *v = &l->members[j];
1800 if (!strcmp(v->name, name))
1802 TRACE("Returning variable %p.\n", v);
1803 return (ID3D10EffectVariable *)v;
1808 for (i = 0; i < This->local_variable_count; ++i)
1810 struct d3d10_effect_variable *v = &This->local_variables[i];
1812 if (!strcmp(v->name, name))
1814 TRACE("Returning variable %p.\n", v);
1815 return (ID3D10EffectVariable *)v;
1819 WARN("Invalid name specified\n");
1821 return (ID3D10EffectVariable *)&null_variable;
1824 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
1827 FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic));
1832 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
1835 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1836 struct d3d10_effect_technique *t;
1838 TRACE("iface %p, index %u\n", iface, index);
1840 if (index >= This->technique_count)
1842 WARN("Invalid index specified\n");
1843 return (ID3D10EffectTechnique *)&null_technique;
1846 t = &This->techniques[index];
1848 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
1850 return (ID3D10EffectTechnique *)t;
1853 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
1856 struct d3d10_effect *This = (struct d3d10_effect *)iface;
1859 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1861 for (i = 0; i < This->technique_count; ++i)
1863 struct d3d10_effect_technique *t = &This->techniques[i];
1864 if (!strcmp(t->name, name))
1866 TRACE("Returning technique %p\n", t);
1867 return (ID3D10EffectTechnique *)t;
1871 WARN("Invalid name specified\n");
1873 return (ID3D10EffectTechnique *)&null_technique;
1876 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
1878 FIXME("iface %p stub!\n", iface);
1883 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
1885 FIXME("iface %p stub!\n", iface);
1890 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
1892 /* IUnknown methods */
1893 d3d10_effect_QueryInterface,
1894 d3d10_effect_AddRef,
1895 d3d10_effect_Release,
1896 /* ID3D10Effect methods */
1897 d3d10_effect_IsValid,
1898 d3d10_effect_IsPool,
1899 d3d10_effect_GetDevice,
1900 d3d10_effect_GetDesc,
1901 d3d10_effect_GetConstantBufferByIndex,
1902 d3d10_effect_GetConstantBufferByName,
1903 d3d10_effect_GetVariableByIndex,
1904 d3d10_effect_GetVariableByName,
1905 d3d10_effect_GetVariableBySemantic,
1906 d3d10_effect_GetTechniqueByIndex,
1907 d3d10_effect_GetTechniqueByName,
1908 d3d10_effect_Optimize,
1909 d3d10_effect_IsOptimized,
1912 /* ID3D10EffectTechnique methods */
1914 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
1916 TRACE("iface %p\n", iface);
1918 return (struct d3d10_effect_technique *)iface != &null_technique;
1921 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
1922 D3D10_TECHNIQUE_DESC *desc)
1924 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1926 TRACE("iface %p, desc %p\n", iface, desc);
1928 if(This == &null_technique)
1930 WARN("Null technique specified\n");
1936 WARN("Invalid argument specified\n");
1937 return E_INVALIDARG;
1940 desc->Name = This->name;
1941 desc->Passes = This->pass_count;
1942 desc->Annotations = This->annotation_count;
1947 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
1948 ID3D10EffectTechnique *iface, UINT index)
1950 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1951 struct d3d10_effect_variable *a;
1953 TRACE("iface %p, index %u\n", iface, index);
1955 if (index >= This->annotation_count)
1957 WARN("Invalid index specified\n");
1958 return (ID3D10EffectVariable *)&null_variable;
1961 a = &This->annotations[index];
1963 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
1965 return (ID3D10EffectVariable *)a;
1968 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
1969 ID3D10EffectTechnique *iface, LPCSTR name)
1971 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1974 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
1976 for (i = 0; i < This->annotation_count; ++i)
1978 struct d3d10_effect_variable *a = &This->annotations[i];
1979 if (!strcmp(a->name, name))
1981 TRACE("Returning annotation %p\n", a);
1982 return (ID3D10EffectVariable *)a;
1986 WARN("Invalid name specified\n");
1988 return (ID3D10EffectVariable *)&null_variable;
1991 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
1994 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1995 struct d3d10_effect_pass *p;
1997 TRACE("iface %p, index %u\n", iface, index);
1999 if (index >= This->pass_count)
2001 WARN("Invalid index specified\n");
2002 return (ID3D10EffectPass *)&null_pass;
2005 p = &This->passes[index];
2007 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2009 return (ID3D10EffectPass *)p;
2012 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2015 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
2018 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2020 for (i = 0; i < This->pass_count; ++i)
2022 struct d3d10_effect_pass *p = &This->passes[i];
2023 if (!strcmp(p->name, name))
2025 TRACE("Returning pass %p\n", p);
2026 return (ID3D10EffectPass *)p;
2030 WARN("Invalid name specified\n");
2032 return (ID3D10EffectPass *)&null_pass;
2035 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2036 D3D10_STATE_BLOCK_MASK *mask)
2038 FIXME("iface %p,mask %p stub!\n", iface, mask);
2043 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2045 /* ID3D10EffectTechnique methods */
2046 d3d10_effect_technique_IsValid,
2047 d3d10_effect_technique_GetDesc,
2048 d3d10_effect_technique_GetAnnotationByIndex,
2049 d3d10_effect_technique_GetAnnotationByName,
2050 d3d10_effect_technique_GetPassByIndex,
2051 d3d10_effect_technique_GetPassByName,
2052 d3d10_effect_technique_ComputeStateBlockMask,
2055 /* ID3D10EffectPass methods */
2057 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2059 TRACE("iface %p\n", iface);
2061 return (struct d3d10_effect_pass *)iface != &null_pass;
2064 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface, D3D10_PASS_DESC *desc)
2066 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2069 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2071 if(This == &null_pass)
2073 WARN("Null pass specified\n");
2079 WARN("Invalid argument specified\n");
2080 return E_INVALIDARG;
2083 memset(desc, 0, sizeof(*desc));
2084 desc->Name = This->name;
2085 for (i = 0; i < This->object_count; ++i)
2087 struct d3d10_effect_object *o = &This->objects[i];
2088 if (o->type == D3D10_EOT_VERTEXSHADER)
2090 struct d3d10_effect_shader_variable *s = o->data;
2091 desc->pIAInputSignature = (BYTE *)s->input_signature;
2092 desc->IAInputSignatureSize = s->input_signature_size;
2100 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2101 D3D10_PASS_SHADER_DESC *desc)
2103 FIXME("iface %p, desc %p stub!\n", iface, desc);
2108 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2109 D3D10_PASS_SHADER_DESC *desc)
2111 FIXME("iface %p, desc %p stub!\n", iface, desc);
2116 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
2117 D3D10_PASS_SHADER_DESC *desc)
2119 FIXME("iface %p, desc %p stub!\n", iface, desc);
2124 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
2127 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2128 struct d3d10_effect_variable *a;
2130 TRACE("iface %p, index %u\n", iface, index);
2132 if (index >= This->annotation_count)
2134 WARN("Invalid index specified\n");
2135 return (ID3D10EffectVariable *)&null_variable;
2138 a = &This->annotations[index];
2140 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2142 return (ID3D10EffectVariable *)a;
2145 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
2148 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2151 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2153 for (i = 0; i < This->annotation_count; ++i)
2155 struct d3d10_effect_variable *a = &This->annotations[i];
2156 if (!strcmp(a->name, name))
2158 TRACE("Returning annotation %p\n", a);
2159 return (ID3D10EffectVariable *)a;
2163 WARN("Invalid name specified\n");
2165 return (ID3D10EffectVariable *)&null_variable;
2168 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
2170 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
2174 TRACE("iface %p, flags %#x\n", iface, flags);
2176 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
2178 for (i = 0; i < This->object_count; ++i)
2180 hr = d3d10_effect_object_apply(&This->objects[i]);
2181 if (FAILED(hr)) break;
2187 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
2188 D3D10_STATE_BLOCK_MASK *mask)
2190 FIXME("iface %p, mask %p stub!\n", iface, mask);
2195 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
2197 /* ID3D10EffectPass methods */
2198 d3d10_effect_pass_IsValid,
2199 d3d10_effect_pass_GetDesc,
2200 d3d10_effect_pass_GetVertexShaderDesc,
2201 d3d10_effect_pass_GetGeometryShaderDesc,
2202 d3d10_effect_pass_GetPixelShaderDesc,
2203 d3d10_effect_pass_GetAnnotationByIndex,
2204 d3d10_effect_pass_GetAnnotationByName,
2205 d3d10_effect_pass_Apply,
2206 d3d10_effect_pass_ComputeStateBlockMask,
2209 /* ID3D10EffectVariable methods */
2211 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
2213 TRACE("iface %p\n", iface);
2215 return (struct d3d10_effect_variable *)iface != &null_variable;
2218 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
2220 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2222 TRACE("iface %p\n", iface);
2224 return (ID3D10EffectType *)This->type;
2227 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
2228 D3D10_EFFECT_VARIABLE_DESC *desc)
2230 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2232 TRACE("iface %p, desc %p\n", iface, desc);
2234 if(This == &null_variable)
2236 WARN("Null variable specified\n");
2242 WARN("Invalid argument specified\n");
2243 return E_INVALIDARG;
2246 memset(desc, 0, sizeof(*desc));
2247 desc->Name = This->name;
2248 desc->Semantic = This->semantic;
2249 desc->Flags = This->flag;
2250 desc->Annotations = This->annotation_count;
2251 desc->BufferOffset = This->buffer_offset;
2253 if( This->flag == D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2255 desc->ExplicitBindPoint = This->buffer_offset;
2259 FIXME("Unhandled flag %#x!\n", This->flag);
2265 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
2266 ID3D10EffectVariable *iface, UINT index)
2268 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2269 struct d3d10_effect_variable *a;
2271 TRACE("iface %p, index %u\n", iface, index);
2273 if (index >= This->annotation_count)
2275 WARN("Invalid index specified\n");
2276 return (ID3D10EffectVariable *)&null_variable;
2279 a = &This->annotations[index];
2281 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2283 return (ID3D10EffectVariable *)a;
2286 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
2287 ID3D10EffectVariable *iface, LPCSTR name)
2289 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2292 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2294 for (i = 0; i < This->annotation_count; ++i)
2296 struct d3d10_effect_variable *a = &This->annotations[i];
2297 if (!strcmp(a->name, name))
2299 TRACE("Returning annotation %p\n", a);
2300 return (ID3D10EffectVariable *)a;
2304 WARN("Invalid name specified\n");
2306 return (ID3D10EffectVariable *)&null_variable;
2309 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
2310 ID3D10EffectVariable *iface, UINT index)
2312 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2313 struct d3d10_effect_variable *m;
2315 TRACE("iface %p, index %u\n", iface, index);
2317 if (index >= This->type->member_count)
2319 WARN("Invalid index specified\n");
2320 return (ID3D10EffectVariable *)&null_variable;
2323 m = &This->members[index];
2325 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
2327 return (ID3D10EffectVariable *)m;
2330 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
2331 ID3D10EffectVariable *iface, LPCSTR name)
2333 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2336 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2340 WARN("Invalid name specified\n");
2341 return (ID3D10EffectVariable *)&null_variable;
2344 for (i = 0; i < This->type->member_count; ++i)
2346 struct d3d10_effect_variable *m = &This->members[i];
2350 if (!strcmp(m->name, name))
2352 TRACE("Returning member %p\n", m);
2353 return (ID3D10EffectVariable *)m;
2358 WARN("Invalid name specified\n");
2360 return (ID3D10EffectVariable *)&null_variable;
2363 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
2364 ID3D10EffectVariable *iface, LPCSTR semantic)
2366 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2369 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
2373 WARN("Invalid semantic specified\n");
2374 return (ID3D10EffectVariable *)&null_variable;
2377 for (i = 0; i < This->type->member_count; ++i)
2379 struct d3d10_effect_variable *m = &This->members[i];
2383 if (!strcmp(m->semantic, semantic))
2385 TRACE("Returning member %p\n", m);
2386 return (ID3D10EffectVariable *)m;
2391 WARN("Invalid semantic specified\n");
2393 return (ID3D10EffectVariable *)&null_variable;
2396 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
2397 ID3D10EffectVariable *iface, UINT index)
2399 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2400 struct d3d10_effect_variable *v;
2402 TRACE("iface %p, index %u\n", iface, index);
2404 if (index >= This->type->element_count)
2406 WARN("Invalid index specified\n");
2407 return (ID3D10EffectVariable *)&null_variable;
2410 v = &This->elements[index];
2412 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
2414 return (ID3D10EffectVariable *)v;
2417 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
2418 ID3D10EffectVariable *iface)
2420 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2422 TRACE("iface %p\n", iface);
2424 return (ID3D10EffectConstantBuffer *)This->buffer;
2427 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
2428 ID3D10EffectVariable *iface)
2430 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2432 TRACE("iface %p\n", iface);
2434 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
2435 return (ID3D10EffectScalarVariable *)This;
2437 return (ID3D10EffectScalarVariable *)&null_scalar_variable;
2440 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
2441 ID3D10EffectVariable *iface)
2443 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2445 TRACE("iface %p\n", iface);
2447 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
2448 return (ID3D10EffectVectorVariable *)This;
2450 return (ID3D10EffectVectorVariable *)&null_vector_variable;
2453 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
2454 ID3D10EffectVariable *iface)
2456 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
2458 TRACE("iface %p\n", iface);
2460 if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
2461 return (ID3D10EffectMatrixVariable *)This;
2463 return (ID3D10EffectMatrixVariable *)&null_matrix_variable;
2466 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
2467 ID3D10EffectVariable *iface)
2469 FIXME("iface %p stub!\n", iface);
2474 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
2475 ID3D10EffectVariable *iface)
2477 FIXME("iface %p stub!\n", iface);
2482 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
2483 ID3D10EffectVariable *iface)
2485 FIXME("iface %p stub!\n", iface);
2490 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
2491 ID3D10EffectVariable *iface)
2493 FIXME("iface %p stub!\n", iface);
2498 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
2499 ID3D10EffectVariable *iface)
2501 FIXME("iface %p stub!\n", iface);
2506 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
2507 ID3D10EffectVariable *iface)
2509 FIXME("iface %p stub!\n", iface);
2514 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
2516 FIXME("iface %p stub!\n", iface);
2521 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
2522 ID3D10EffectVariable *iface)
2524 FIXME("iface %p stub!\n", iface);
2529 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
2530 ID3D10EffectVariable *iface)
2532 FIXME("iface %p stub!\n", iface);
2537 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
2538 ID3D10EffectVariable *iface)
2540 FIXME("iface %p stub!\n", iface);
2545 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
2546 void *data, UINT offset, UINT count)
2548 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2553 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
2554 void *data, UINT offset, UINT count)
2556 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
2561 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
2563 /* ID3D10EffectVariable methods */
2564 d3d10_effect_variable_IsValid,
2565 d3d10_effect_variable_GetType,
2566 d3d10_effect_variable_GetDesc,
2567 d3d10_effect_variable_GetAnnotationByIndex,
2568 d3d10_effect_variable_GetAnnotationByName,
2569 d3d10_effect_variable_GetMemberByIndex,
2570 d3d10_effect_variable_GetMemberByName,
2571 d3d10_effect_variable_GetMemberBySemantic,
2572 d3d10_effect_variable_GetElement,
2573 d3d10_effect_variable_GetParentConstantBuffer,
2574 d3d10_effect_variable_AsScalar,
2575 d3d10_effect_variable_AsVector,
2576 d3d10_effect_variable_AsMatrix,
2577 d3d10_effect_variable_AsString,
2578 d3d10_effect_variable_AsShaderResource,
2579 d3d10_effect_variable_AsRenderTargetView,
2580 d3d10_effect_variable_AsDepthStencilView,
2581 d3d10_effect_variable_AsConstantBuffer,
2582 d3d10_effect_variable_AsShader,
2583 d3d10_effect_variable_AsBlend,
2584 d3d10_effect_variable_AsDepthStencil,
2585 d3d10_effect_variable_AsRasterizer,
2586 d3d10_effect_variable_AsSampler,
2587 d3d10_effect_variable_SetRawValue,
2588 d3d10_effect_variable_GetRawValue,
2591 /* ID3D10EffectVariable methods */
2592 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
2594 TRACE("iface %p\n", iface);
2596 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
2599 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
2601 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
2604 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
2605 D3D10_EFFECT_VARIABLE_DESC *desc)
2607 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
2610 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
2611 ID3D10EffectConstantBuffer *iface, UINT index)
2613 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
2616 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
2617 ID3D10EffectConstantBuffer *iface, LPCSTR name)
2619 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
2622 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
2623 ID3D10EffectConstantBuffer *iface, UINT index)
2625 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
2628 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
2629 ID3D10EffectConstantBuffer *iface, LPCSTR name)
2631 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
2634 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
2635 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
2637 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
2640 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
2641 ID3D10EffectConstantBuffer *iface, UINT index)
2643 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
2646 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
2647 ID3D10EffectConstantBuffer *iface)
2649 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
2652 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
2653 ID3D10EffectConstantBuffer *iface)
2655 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
2658 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
2659 ID3D10EffectConstantBuffer *iface)
2661 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
2664 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
2665 ID3D10EffectConstantBuffer *iface)
2667 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
2670 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
2671 ID3D10EffectConstantBuffer *iface)
2673 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
2676 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
2677 ID3D10EffectConstantBuffer *iface)
2679 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
2682 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
2683 ID3D10EffectConstantBuffer *iface)
2685 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
2688 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
2689 ID3D10EffectConstantBuffer *iface)
2691 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
2694 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
2695 ID3D10EffectConstantBuffer *iface)
2697 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
2700 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
2701 ID3D10EffectConstantBuffer *iface)
2703 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
2706 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
2708 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
2711 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
2712 ID3D10EffectConstantBuffer *iface)
2714 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
2717 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
2718 ID3D10EffectConstantBuffer *iface)
2720 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
2723 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
2724 ID3D10EffectConstantBuffer *iface)
2726 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
2729 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
2730 void *data, UINT offset, UINT count)
2732 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2735 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
2736 void *data, UINT offset, UINT count)
2738 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2741 /* ID3D10EffectConstantBuffer methods */
2742 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2743 ID3D10Buffer *buffer)
2745 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2750 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
2751 ID3D10Buffer **buffer)
2753 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
2758 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2759 ID3D10ShaderResourceView *view)
2761 FIXME("iface %p, view %p stub!\n", iface, view);
2766 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
2767 ID3D10ShaderResourceView **view)
2769 FIXME("iface %p, view %p stub!\n", iface, view);
2774 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
2776 /* ID3D10EffectVariable methods */
2777 d3d10_effect_constant_buffer_IsValid,
2778 d3d10_effect_constant_buffer_GetType,
2779 d3d10_effect_constant_buffer_GetDesc,
2780 d3d10_effect_constant_buffer_GetAnnotationByIndex,
2781 d3d10_effect_constant_buffer_GetAnnotationByName,
2782 d3d10_effect_constant_buffer_GetMemberByIndex,
2783 d3d10_effect_constant_buffer_GetMemberByName,
2784 d3d10_effect_constant_buffer_GetMemberBySemantic,
2785 d3d10_effect_constant_buffer_GetElement,
2786 d3d10_effect_constant_buffer_GetParentConstantBuffer,
2787 d3d10_effect_constant_buffer_AsScalar,
2788 d3d10_effect_constant_buffer_AsVector,
2789 d3d10_effect_constant_buffer_AsMatrix,
2790 d3d10_effect_constant_buffer_AsString,
2791 d3d10_effect_constant_buffer_AsShaderResource,
2792 d3d10_effect_constant_buffer_AsRenderTargetView,
2793 d3d10_effect_constant_buffer_AsDepthStencilView,
2794 d3d10_effect_constant_buffer_AsConstantBuffer,
2795 d3d10_effect_constant_buffer_AsShader,
2796 d3d10_effect_constant_buffer_AsBlend,
2797 d3d10_effect_constant_buffer_AsDepthStencil,
2798 d3d10_effect_constant_buffer_AsRasterizer,
2799 d3d10_effect_constant_buffer_AsSampler,
2800 d3d10_effect_constant_buffer_SetRawValue,
2801 d3d10_effect_constant_buffer_GetRawValue,
2802 /* ID3D10EffectConstantBuffer methods */
2803 d3d10_effect_constant_buffer_SetConstantBuffer,
2804 d3d10_effect_constant_buffer_GetConstantBuffer,
2805 d3d10_effect_constant_buffer_SetTextureBuffer,
2806 d3d10_effect_constant_buffer_GetTextureBuffer,
2809 /* ID3D10EffectVariable methods */
2811 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
2813 TRACE("iface %p\n", iface);
2815 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
2818 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
2819 ID3D10EffectScalarVariable *iface)
2821 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
2824 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
2825 D3D10_EFFECT_VARIABLE_DESC *desc)
2827 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
2830 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
2831 ID3D10EffectScalarVariable *iface, UINT index)
2833 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
2836 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
2837 ID3D10EffectScalarVariable *iface, LPCSTR name)
2839 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
2842 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
2843 ID3D10EffectScalarVariable *iface, UINT index)
2845 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
2848 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
2849 ID3D10EffectScalarVariable *iface, LPCSTR name)
2851 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
2854 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
2855 ID3D10EffectScalarVariable *iface, LPCSTR semantic)
2857 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
2860 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
2861 ID3D10EffectScalarVariable *iface, UINT index)
2863 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
2866 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
2867 ID3D10EffectScalarVariable *iface)
2869 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
2872 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
2873 ID3D10EffectScalarVariable *iface)
2875 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
2878 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
2879 ID3D10EffectScalarVariable *iface)
2881 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
2884 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
2885 ID3D10EffectScalarVariable *iface)
2887 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
2890 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
2891 ID3D10EffectScalarVariable *iface)
2893 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
2896 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
2897 ID3D10EffectScalarVariable *iface)
2899 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
2902 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
2903 ID3D10EffectScalarVariable *iface)
2905 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
2908 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
2909 ID3D10EffectScalarVariable *iface)
2911 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
2914 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
2915 ID3D10EffectScalarVariable *iface)
2917 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
2920 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
2921 ID3D10EffectScalarVariable *iface)
2923 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
2926 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
2927 ID3D10EffectScalarVariable *iface)
2929 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
2932 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
2933 ID3D10EffectScalarVariable *iface)
2935 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
2938 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
2939 ID3D10EffectScalarVariable *iface)
2941 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
2944 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
2945 ID3D10EffectScalarVariable *iface)
2947 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
2950 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
2951 void *data, UINT offset, UINT count)
2953 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2956 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
2957 void *data, UINT offset, UINT count)
2959 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
2962 /* ID3D10EffectScalarVariable methods */
2964 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
2967 FIXME("iface %p, value %.8e stub!\n", iface, value);
2972 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
2975 FIXME("iface %p, value %p stub!\n", iface, value);
2980 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
2981 float *values, UINT offset, UINT count)
2983 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
2988 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
2989 float *values, UINT offset, UINT count)
2991 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
2996 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
2999 FIXME("iface %p, value %d stub!\n", iface, value);
3004 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3007 FIXME("iface %p, value %p stub!\n", iface, value);
3012 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3013 int *values, UINT offset, UINT count)
3015 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3020 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3021 int *values, UINT offset, UINT count)
3023 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3028 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3031 FIXME("iface %p, value %d stub!\n", iface, value);
3036 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3039 FIXME("iface %p, value %p stub!\n", iface, value);
3044 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
3045 BOOL *values, UINT offset, UINT count)
3047 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3052 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
3053 BOOL *values, UINT offset, UINT count)
3055 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3060 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
3062 /* ID3D10EffectVariable methods */
3063 d3d10_effect_scalar_variable_IsValid,
3064 d3d10_effect_scalar_variable_GetType,
3065 d3d10_effect_scalar_variable_GetDesc,
3066 d3d10_effect_scalar_variable_GetAnnotationByIndex,
3067 d3d10_effect_scalar_variable_GetAnnotationByName,
3068 d3d10_effect_scalar_variable_GetMemberByIndex,
3069 d3d10_effect_scalar_variable_GetMemberByName,
3070 d3d10_effect_scalar_variable_GetMemberBySemantic,
3071 d3d10_effect_scalar_variable_GetElement,
3072 d3d10_effect_scalar_variable_GetParentConstantBuffer,
3073 d3d10_effect_scalar_variable_AsScalar,
3074 d3d10_effect_scalar_variable_AsVector,
3075 d3d10_effect_scalar_variable_AsMatrix,
3076 d3d10_effect_scalar_variable_AsString,
3077 d3d10_effect_scalar_variable_AsShaderResource,
3078 d3d10_effect_scalar_variable_AsRenderTargetView,
3079 d3d10_effect_scalar_variable_AsDepthStencilView,
3080 d3d10_effect_scalar_variable_AsConstantBuffer,
3081 d3d10_effect_scalar_variable_AsShader,
3082 d3d10_effect_scalar_variable_AsBlend,
3083 d3d10_effect_scalar_variable_AsDepthStencil,
3084 d3d10_effect_scalar_variable_AsRasterizer,
3085 d3d10_effect_scalar_variable_AsSampler,
3086 d3d10_effect_scalar_variable_SetRawValue,
3087 d3d10_effect_scalar_variable_GetRawValue,
3088 /* ID3D10EffectScalarVariable methods */
3089 d3d10_effect_scalar_variable_SetFloat,
3090 d3d10_effect_scalar_variable_GetFloat,
3091 d3d10_effect_scalar_variable_SetFloatArray,
3092 d3d10_effect_scalar_variable_GetFloatArray,
3093 d3d10_effect_scalar_variable_SetInt,
3094 d3d10_effect_scalar_variable_GetInt,
3095 d3d10_effect_scalar_variable_SetIntArray,
3096 d3d10_effect_scalar_variable_GetIntArray,
3097 d3d10_effect_scalar_variable_SetBool,
3098 d3d10_effect_scalar_variable_GetBool,
3099 d3d10_effect_scalar_variable_SetBoolArray,
3100 d3d10_effect_scalar_variable_GetBoolArray,
3103 /* ID3D10EffectVariable methods */
3105 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
3107 TRACE("iface %p\n", iface);
3109 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
3112 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
3113 ID3D10EffectVectorVariable *iface)
3115 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3118 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
3119 D3D10_EFFECT_VARIABLE_DESC *desc)
3121 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3124 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
3125 ID3D10EffectVectorVariable *iface, UINT index)
3127 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3130 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
3131 ID3D10EffectVectorVariable *iface, LPCSTR name)
3133 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3136 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
3137 ID3D10EffectVectorVariable *iface, UINT index)
3139 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3142 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
3143 ID3D10EffectVectorVariable *iface, LPCSTR name)
3145 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3148 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
3149 ID3D10EffectVectorVariable *iface, LPCSTR semantic)
3151 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3154 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
3155 ID3D10EffectVectorVariable *iface, UINT index)
3157 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3160 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
3161 ID3D10EffectVectorVariable *iface)
3163 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3166 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
3167 ID3D10EffectVectorVariable *iface)
3169 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3172 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
3173 ID3D10EffectVectorVariable *iface)
3175 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3178 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
3179 ID3D10EffectVectorVariable *iface)
3181 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3184 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
3185 ID3D10EffectVectorVariable *iface)
3187 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3190 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
3191 ID3D10EffectVectorVariable *iface)
3193 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3196 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
3197 ID3D10EffectVectorVariable *iface)
3199 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3202 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
3203 ID3D10EffectVectorVariable *iface)
3205 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3208 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
3209 ID3D10EffectVectorVariable *iface)
3211 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3214 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
3215 ID3D10EffectVectorVariable *iface)
3217 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3220 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
3221 ID3D10EffectVectorVariable *iface)
3223 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3226 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
3227 ID3D10EffectVectorVariable *iface)
3229 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3232 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
3233 ID3D10EffectVectorVariable *iface)
3235 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3238 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
3239 ID3D10EffectVectorVariable *iface)
3241 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3244 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
3245 void *data, UINT offset, UINT count)
3247 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3250 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
3251 void *data, UINT offset, UINT count)
3253 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3256 /* ID3D10EffectVectorVariable methods */
3258 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
3261 FIXME("iface %p, value %p stub!\n", iface, value);
3266 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
3269 FIXME("iface %p, value %p stub!\n", iface, value);
3274 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
3277 FIXME("iface %p, value %p stub!\n", iface, value);
3282 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
3285 FIXME("iface %p, value %p stub!\n", iface, value);
3290 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
3293 FIXME("iface %p, value %p stub!\n", iface, value);
3298 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
3301 FIXME("iface %p, value %p stub!\n", iface, value);
3306 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3307 BOOL *values, UINT offset, UINT count)
3309 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3314 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
3315 int *values, UINT offset, UINT count)
3317 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3322 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3323 float *values, UINT offset, UINT count)
3325 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3330 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
3331 BOOL *values, UINT offset, UINT count)
3333 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3338 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
3339 int *values, UINT offset, UINT count)
3341 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3346 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
3347 float *values, UINT offset, UINT count)
3349 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3354 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
3356 /* ID3D10EffectVariable methods */
3357 d3d10_effect_vector_variable_IsValid,
3358 d3d10_effect_vector_variable_GetType,
3359 d3d10_effect_vector_variable_GetDesc,
3360 d3d10_effect_vector_variable_GetAnnotationByIndex,
3361 d3d10_effect_vector_variable_GetAnnotationByName,
3362 d3d10_effect_vector_variable_GetMemberByIndex,
3363 d3d10_effect_vector_variable_GetMemberByName,
3364 d3d10_effect_vector_variable_GetMemberBySemantic,
3365 d3d10_effect_vector_variable_GetElement,
3366 d3d10_effect_vector_variable_GetParentConstantBuffer,
3367 d3d10_effect_vector_variable_AsScalar,
3368 d3d10_effect_vector_variable_AsVector,
3369 d3d10_effect_vector_variable_AsMatrix,
3370 d3d10_effect_vector_variable_AsString,
3371 d3d10_effect_vector_variable_AsShaderResource,
3372 d3d10_effect_vector_variable_AsRenderTargetView,
3373 d3d10_effect_vector_variable_AsDepthStencilView,
3374 d3d10_effect_vector_variable_AsConstantBuffer,
3375 d3d10_effect_vector_variable_AsShader,
3376 d3d10_effect_vector_variable_AsBlend,
3377 d3d10_effect_vector_variable_AsDepthStencil,
3378 d3d10_effect_vector_variable_AsRasterizer,
3379 d3d10_effect_vector_variable_AsSampler,
3380 d3d10_effect_vector_variable_SetRawValue,
3381 d3d10_effect_vector_variable_GetRawValue,
3382 /* ID3D10EffectVectorVariable methods */
3383 d3d10_effect_vector_variable_SetBoolVector,
3384 d3d10_effect_vector_variable_SetIntVector,
3385 d3d10_effect_vector_variable_SetFloatVector,
3386 d3d10_effect_vector_variable_GetBoolVector,
3387 d3d10_effect_vector_variable_GetIntVector,
3388 d3d10_effect_vector_variable_GetFloatVector,
3389 d3d10_effect_vector_variable_SetBoolVectorArray,
3390 d3d10_effect_vector_variable_SetIntVectorArray,
3391 d3d10_effect_vector_variable_SetFloatVectorArray,
3392 d3d10_effect_vector_variable_GetBoolVectorArray,
3393 d3d10_effect_vector_variable_GetIntVectorArray,
3394 d3d10_effect_vector_variable_GetFloatVectorArray,
3397 /* ID3D10EffectVariable methods */
3399 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
3401 TRACE("iface %p\n", iface);
3403 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
3406 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
3407 ID3D10EffectMatrixVariable *iface)
3409 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3412 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
3413 D3D10_EFFECT_VARIABLE_DESC *desc)
3415 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3418 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
3419 ID3D10EffectMatrixVariable *iface, UINT index)
3421 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3424 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
3425 ID3D10EffectMatrixVariable *iface, LPCSTR name)
3427 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3430 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
3431 ID3D10EffectMatrixVariable *iface, UINT index)
3433 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3436 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
3437 ID3D10EffectMatrixVariable *iface, LPCSTR name)
3439 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3442 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
3443 ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
3445 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3448 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
3449 ID3D10EffectMatrixVariable *iface, UINT index)
3451 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3454 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
3455 ID3D10EffectMatrixVariable *iface)
3457 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3460 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
3461 ID3D10EffectMatrixVariable *iface)
3463 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3466 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
3467 ID3D10EffectMatrixVariable *iface)
3469 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3472 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
3473 ID3D10EffectMatrixVariable *iface)
3475 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3478 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
3479 ID3D10EffectMatrixVariable *iface)
3481 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3484 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
3485 ID3D10EffectMatrixVariable *iface)
3487 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3490 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
3491 ID3D10EffectMatrixVariable *iface)
3493 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3496 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
3497 ID3D10EffectMatrixVariable *iface)
3499 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3502 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
3503 ID3D10EffectMatrixVariable *iface)
3505 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3508 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
3509 ID3D10EffectMatrixVariable *iface)
3511 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3514 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
3515 ID3D10EffectMatrixVariable *iface)
3517 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3520 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
3521 ID3D10EffectMatrixVariable *iface)
3523 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3526 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
3527 ID3D10EffectMatrixVariable *iface)
3529 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3532 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
3533 ID3D10EffectMatrixVariable *iface)
3535 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3538 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
3539 void *data, UINT offset, UINT count)
3541 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3544 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
3545 void *data, UINT offset, UINT count)
3547 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3550 /* ID3D10EffectMatrixVariable methods */
3552 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
3555 FIXME("iface %p, data %p stub!\n", iface, data);
3560 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
3563 FIXME("iface %p, data %p stub!\n", iface, data);
3568 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
3569 float *data, UINT offset, UINT count)
3571 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3576 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
3577 float *data, UINT offset, UINT count)
3579 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3584 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3587 FIXME("iface %p, data %p stub!\n", iface, data);
3592 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
3595 FIXME("iface %p, data %p stub!\n", iface, data);
3600 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3601 float *data, UINT offset, UINT count)
3603 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3608 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
3609 float *data, UINT offset, UINT count)
3611 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3617 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
3619 /* ID3D10EffectVariable methods */
3620 d3d10_effect_matrix_variable_IsValid,
3621 d3d10_effect_matrix_variable_GetType,
3622 d3d10_effect_matrix_variable_GetDesc,
3623 d3d10_effect_matrix_variable_GetAnnotationByIndex,
3624 d3d10_effect_matrix_variable_GetAnnotationByName,
3625 d3d10_effect_matrix_variable_GetMemberByIndex,
3626 d3d10_effect_matrix_variable_GetMemberByName,
3627 d3d10_effect_matrix_variable_GetMemberBySemantic,
3628 d3d10_effect_matrix_variable_GetElement,
3629 d3d10_effect_matrix_variable_GetParentConstantBuffer,
3630 d3d10_effect_matrix_variable_AsScalar,
3631 d3d10_effect_matrix_variable_AsVector,
3632 d3d10_effect_matrix_variable_AsMatrix,
3633 d3d10_effect_matrix_variable_AsString,
3634 d3d10_effect_matrix_variable_AsShaderResource,
3635 d3d10_effect_matrix_variable_AsRenderTargetView,
3636 d3d10_effect_matrix_variable_AsDepthStencilView,
3637 d3d10_effect_matrix_variable_AsConstantBuffer,
3638 d3d10_effect_matrix_variable_AsShader,
3639 d3d10_effect_matrix_variable_AsBlend,
3640 d3d10_effect_matrix_variable_AsDepthStencil,
3641 d3d10_effect_matrix_variable_AsRasterizer,
3642 d3d10_effect_matrix_variable_AsSampler,
3643 d3d10_effect_matrix_variable_SetRawValue,
3644 d3d10_effect_matrix_variable_GetRawValue,
3645 /* ID3D10EffectMatrixVariable methods */
3646 d3d10_effect_matrix_variable_SetMatrix,
3647 d3d10_effect_matrix_variable_GetMatrix,
3648 d3d10_effect_matrix_variable_SetMatrixArray,
3649 d3d10_effect_matrix_variable_GetMatrixArray,
3650 d3d10_effect_matrix_variable_SetMatrixTranspose,
3651 d3d10_effect_matrix_variable_GetMatrixTranspose,
3652 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
3653 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
3656 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
3658 FIXME("iface %p stub!\n", iface);
3663 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
3665 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3667 TRACE("iface %p, desc %p\n", iface, desc);
3669 if (This == &null_type)
3671 WARN("Null type specified\n");
3677 WARN("Invalid argument specified\n");
3678 return E_INVALIDARG;
3681 desc->TypeName = This->name;
3682 desc->Class = This->type_class;
3683 desc->Type = This->basetype;
3684 desc->Elements = This->element_count;
3685 desc->Members = This->member_count;
3686 desc->Rows = This->row_count;
3687 desc->Columns = This->column_count;
3688 desc->PackedSize = This->size_packed;
3689 desc->UnpackedSize = This->size_unpacked;
3690 desc->Stride = This->stride;
3695 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
3698 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3699 struct d3d10_effect_type *t;
3701 TRACE("iface %p, index %u\n", iface, index);
3703 if (index >= This->member_count)
3705 WARN("Invalid index specified\n");
3706 return (ID3D10EffectType *)&null_type;
3709 t = (&This->members[index])->type;
3711 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
3713 return (ID3D10EffectType *)t;
3716 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
3719 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3722 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
3726 WARN("Invalid name specified\n");
3727 return (ID3D10EffectType *)&null_type;
3730 for (i = 0; i < This->member_count; ++i)
3732 struct d3d10_effect_type_member *typem = &This->members[i];
3736 if (!strcmp(typem->name, name))
3738 TRACE("Returning type %p.\n", typem->type);
3739 return (ID3D10EffectType *)typem->type;
3744 WARN("Invalid name specified\n");
3746 return (ID3D10EffectType *)&null_type;
3749 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
3752 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3755 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
3759 WARN("Invalid semantic specified\n");
3760 return (ID3D10EffectType *)&null_type;
3763 for (i = 0; i < This->member_count; ++i)
3765 struct d3d10_effect_type_member *typem = &This->members[i];
3767 if (typem->semantic)
3769 if (!strcmp(typem->semantic, semantic))
3771 TRACE("Returning type %p.\n", typem->type);
3772 return (ID3D10EffectType *)typem->type;
3777 WARN("Invalid semantic specified\n");
3779 return (ID3D10EffectType *)&null_type;
3782 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
3784 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3785 struct d3d10_effect_type_member *typem;
3787 TRACE("iface %p, index %u\n", iface, index);
3789 if (index >= This->member_count)
3791 WARN("Invalid index specified\n");
3795 typem = &This->members[index];
3797 TRACE("Returning name %s\n", debugstr_a(typem->name));
3802 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
3804 struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface;
3805 struct d3d10_effect_type_member *typem;
3807 TRACE("iface %p, index %u\n", iface, index);
3809 if (index >= This->member_count)
3811 WARN("Invalid index specified\n");
3815 typem = &This->members[index];
3817 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
3819 return typem->semantic;
3822 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
3824 /* ID3D10EffectType */
3825 d3d10_effect_type_IsValid,
3826 d3d10_effect_type_GetDesc,
3827 d3d10_effect_type_GetMemberTypeByIndex,
3828 d3d10_effect_type_GetMemberTypeByName,
3829 d3d10_effect_type_GetMemberTypeBySemantic,
3830 d3d10_effect_type_GetMemberName,
3831 d3d10_effect_type_GetMemberSemantic,