dplayx: Code to forward player creation
[wine/gsoc_dplay.git] / dlls / d3d10 / effect.c
blob61fbfeee71a8b5494553595a1625dcc221a09276
1 /*
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
20 #include "config.h"
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 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
35 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
36 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
37 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
39 /* null objects - needed for invalid calls */
40 static struct d3d10_effect_technique null_technique = {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL};
41 static struct d3d10_effect_pass null_pass = {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL};
42 static struct d3d10_effect_local_buffer null_local_buffer = {&d3d10_effect_constant_buffer_vtbl, NULL, 0, 0, 0, NULL};
43 static struct d3d10_effect_variable null_variable = {&d3d10_effect_variable_vtbl, NULL, 0, 0};
45 static inline void read_dword(const char **ptr, DWORD *d)
47 memcpy(d, *ptr, sizeof(*d));
48 *ptr += sizeof(*d);
51 static inline void skip_dword_unknown(const char **ptr, unsigned int count)
53 unsigned int i;
54 DWORD d;
56 FIXME("Skipping %u unknown DWORDs:\n", count);
57 for (i = 0; i < count; ++i)
59 read_dword(ptr, &d);
60 FIXME("\t0x%08x\n", d);
64 static inline void write_dword(char **ptr, DWORD d)
66 memcpy(*ptr, &d, sizeof(d));
67 *ptr += sizeof(d);
70 static inline void write_dword_unknown(char **ptr, DWORD d)
72 FIXME("Writing unknown DWORD 0x%08x\n", d);
73 write_dword(ptr, d);
76 static inline void read_tag(const char **ptr, DWORD *t, char t_str[5])
78 read_dword(ptr, t);
79 memcpy(t_str, t, 4);
80 t_str[4] = '\0';
83 static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
84 HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx)
86 const char *ptr = data;
87 HRESULT hr = S_OK;
88 DWORD chunk_count;
89 DWORD total_size;
90 char tag_str[5];
91 unsigned int i;
92 DWORD tag;
94 read_tag(&ptr, &tag, tag_str);
95 TRACE("tag: %s\n", tag_str);
97 if (tag != TAG_DXBC)
99 WARN("Wrong tag.\n");
100 return E_FAIL;
103 /* checksum? */
104 skip_dword_unknown(&ptr, 4);
106 skip_dword_unknown(&ptr, 1);
108 read_dword(&ptr, &total_size);
109 TRACE("total size: %#x\n", total_size);
111 read_dword(&ptr, &chunk_count);
112 TRACE("chunk count: %#x\n", chunk_count);
114 for (i = 0; i < chunk_count; ++i)
116 DWORD chunk_tag, chunk_size;
117 const char *chunk_ptr;
118 DWORD chunk_offset;
120 read_dword(&ptr, &chunk_offset);
121 TRACE("chunk %u at offset %#x\n", i, chunk_offset);
123 chunk_ptr = data + chunk_offset;
125 read_dword(&chunk_ptr, &chunk_tag);
126 read_dword(&chunk_ptr, &chunk_size);
128 hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx);
129 if (FAILED(hr)) break;
132 return hr;
135 static char *copy_name(const char *ptr)
137 size_t name_len;
138 char *name;
140 name_len = strlen(ptr) + 1;
141 name = HeapAlloc(GetProcessHeap(), 0, name_len);
142 if (!name)
144 ERR("Failed to allocate name memory.\n");
145 return NULL;
148 memcpy(name, ptr, name_len);
150 return name;
153 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
155 struct d3d10_effect_shader_variable *s = ctx;
156 char tag_str[5];
158 memcpy(tag_str, &tag, 4);
159 tag_str[4] = '\0';
160 TRACE("tag: %s\n", tag_str);
162 TRACE("chunk size: %#x\n", data_size);
164 switch(tag)
166 case TAG_ISGN:
168 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
169 UINT size = 44 + data_size;
170 char *ptr;
172 s->input_signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
173 if (!s->input_signature)
175 ERR("Failed to allocate input signature data\n");
176 return E_OUTOFMEMORY;
178 s->input_signature_size = size;
180 ptr = s->input_signature;
182 write_dword(&ptr, TAG_DXBC);
184 /* signature(?) */
185 write_dword_unknown(&ptr, 0);
186 write_dword_unknown(&ptr, 0);
187 write_dword_unknown(&ptr, 0);
188 write_dword_unknown(&ptr, 0);
190 /* seems to be always 1 */
191 write_dword_unknown(&ptr, 1);
193 /* DXBC size */
194 write_dword(&ptr, size);
196 /* chunk count */
197 write_dword(&ptr, 1);
199 /* chunk index */
200 write_dword(&ptr, (ptr - s->input_signature) + 4);
202 /* chunk */
203 write_dword(&ptr, TAG_ISGN);
204 write_dword(&ptr, data_size);
205 memcpy(ptr, data, data_size);
206 break;
209 default:
210 FIXME("Unhandled chunk %s\n", tag_str);
211 break;
214 return S_OK;
217 static HRESULT parse_shader(struct d3d10_effect_object *o, const char *data)
219 ID3D10Device *device = o->pass->technique->effect->device;
220 struct d3d10_effect_shader_variable *s;
221 const char *ptr = data;
222 DWORD dxbc_size;
223 HRESULT hr;
225 o->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3d10_effect_shader_variable));
226 if (!o->data)
228 ERR("Failed to allocate shader variable memory\n");
229 return E_OUTOFMEMORY;
232 if (!ptr) return S_OK;
234 s = o->data;
236 read_dword(&ptr, &dxbc_size);
237 TRACE("dxbc size: %#x\n", dxbc_size);
239 switch (o->type)
241 case D3D10_EOT_VERTEXSHADER:
242 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
243 if (FAILED(hr)) return hr;
244 break;
246 case D3D10_EOT_PIXELSHADER:
247 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
248 if (FAILED(hr)) return hr;
249 break;
250 case D3D10_EOT_GEOMETRYSHADER:
251 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
252 if (FAILED(hr)) return hr;
253 break;
256 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
259 static void parse_fx10_annotation(const char **ptr)
261 skip_dword_unknown(ptr, 3);
264 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
266 const char *data_ptr;
267 DWORD offset;
268 HRESULT hr;
270 read_dword(ptr, &o->type);
271 TRACE("Effect object is of type %#x.\n", o->type);
273 skip_dword_unknown(ptr, 2);
275 read_dword(ptr, &offset);
276 TRACE("Effect object idx is at offset %#x.\n", offset);
278 data_ptr = data + offset;
279 read_dword(&data_ptr, &offset);
281 TRACE("Effect object starts at offset %#x.\n", offset);
283 /* FIXME: This probably isn't completely correct. */
284 if (offset == 1)
286 WARN("Skipping effect object.\n");
287 data_ptr = NULL;
289 else
291 data_ptr = data + offset;
294 switch (o->type)
296 case D3D10_EOT_VERTEXSHADER:
297 TRACE("Vertex shader\n");
298 hr = parse_shader(o, data_ptr);
299 break;
301 case D3D10_EOT_PIXELSHADER:
302 TRACE("Pixel shader\n");
303 hr = parse_shader(o, data_ptr);
304 break;
306 case D3D10_EOT_GEOMETRYSHADER:
307 TRACE("Geometry shader\n");
308 hr = parse_shader(o, data_ptr);
309 break;
311 default:
312 FIXME("Unhandled object type %#x\n", o->type);
313 hr = E_FAIL;
314 break;
317 return hr;
320 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
322 HRESULT hr = S_OK;
323 unsigned int i;
324 DWORD offset;
326 read_dword(ptr, &offset);
327 TRACE("Pass name at offset %#x.\n", offset);
329 p->name = copy_name(data + offset);
330 if (!p->name)
332 ERR("Failed to copy name.\n");
333 return E_OUTOFMEMORY;
335 TRACE("Pass name: %s.\n", p->name);
337 read_dword(ptr, &p->object_count);
338 TRACE("Pass has %u effect objects.\n", p->object_count);
340 read_dword(ptr, &p->annotation_count);
341 for(i = 0; i < p->annotation_count; ++i)
343 parse_fx10_annotation(ptr);
346 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
347 if (!p->objects)
349 ERR("Failed to allocate effect objects memory.\n");
350 return E_OUTOFMEMORY;
353 for (i = 0; i < p->object_count; ++i)
355 struct d3d10_effect_object *o = &p->objects[i];
357 o->pass = p;
359 hr = parse_fx10_object(o, ptr, data);
360 if (FAILED(hr)) return hr;
363 return hr;
366 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
368 unsigned int i;
369 DWORD offset;
371 read_dword(ptr, &offset);
372 TRACE("Technique name at offset %#x.\n", offset);
374 t->name = copy_name(data + offset);
375 if (!t->name)
377 ERR("Failed to copy name.\n");
378 return E_OUTOFMEMORY;
380 TRACE("Technique name: %s.\n", t->name);
382 read_dword(ptr, &t->pass_count);
383 TRACE("Technique has %u passes\n", t->pass_count);
385 read_dword(ptr, &t->annotation_count);
386 for(i = 0; i < t->annotation_count; ++i)
388 parse_fx10_annotation(ptr);
391 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
392 if (!t->passes)
394 ERR("Failed to allocate passes memory\n");
395 return E_OUTOFMEMORY;
398 for (i = 0; i < t->pass_count; ++i)
400 struct d3d10_effect_pass *p = &t->passes[i];
401 HRESULT hr;
403 p->vtbl = &d3d10_effect_pass_vtbl;
404 p->technique = t;
406 hr = parse_fx10_pass(p, ptr, data);
407 if (FAILED(hr)) return hr;
410 return S_OK;
413 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
415 DWORD offset;
416 unsigned int i;
418 read_dword(ptr, &offset);
419 TRACE("Variable name at offset %#x.\n", offset);
421 v->name = copy_name(data + offset);
422 if (!v->name)
424 ERR("Failed to copy name.\n");
425 return E_OUTOFMEMORY;
427 TRACE("Variable name: %s.\n", v->name);
429 read_dword(ptr, &offset);
430 TRACE("Variable type info at offset %#x.\n", offset);
432 skip_dword_unknown(ptr, 1);
434 read_dword(ptr, &v->buffer_offset);
435 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
437 skip_dword_unknown(ptr, 1);
439 read_dword(ptr, &v->flag);
440 TRACE("Variable flag: %#x.\n", v->flag);
442 read_dword(ptr, &v->annotation_count);
443 for(i = 0; i < v->annotation_count; ++i)
445 parse_fx10_annotation(ptr);
448 return S_OK;
451 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_local_buffer *l, const char **ptr, const char *data)
453 unsigned int i;
454 DWORD offset;
456 read_dword(ptr, &offset);
457 TRACE("Local buffer name at offset %#x.\n", offset);
459 l->name = copy_name(data + offset);
460 if (!l->name)
462 ERR("Failed to copy name.\n");
463 return E_OUTOFMEMORY;
465 TRACE("Local buffer name: %s.\n", l->name);
467 read_dword(ptr, &l->data_size);
468 TRACE("Local buffer data size: %#x.\n", l->data_size);
470 skip_dword_unknown(ptr, 1);
472 read_dword(ptr, &l->variable_count);
473 TRACE("Local buffer variable count: %#x.\n", l->variable_count);
475 skip_dword_unknown(ptr, 1);
477 read_dword(ptr, &l->annotation_count);
478 for(i = 0; i < l->annotation_count; ++i)
480 parse_fx10_annotation(ptr);
483 l->variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->variable_count * sizeof(*l->variables));
484 if (!l->variables)
486 ERR("Failed to allocate variables memory.\n");
487 return E_OUTOFMEMORY;
490 for (i = 0; i < l->variable_count; ++i)
492 struct d3d10_effect_variable *v = &l->variables[i];
493 HRESULT hr;
495 v->vtbl = &d3d10_effect_variable_vtbl;
497 hr = parse_fx10_variable(v, ptr, data);
498 if (FAILED(hr)) return hr;
501 return S_OK;
504 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
506 const char *ptr = data + e->index_offset;
507 unsigned int i;
508 HRESULT hr;
510 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
511 if (!e->local_buffers)
513 ERR("Failed to allocate local buffer memory.\n");
514 return E_OUTOFMEMORY;
517 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
518 if (!e->techniques)
520 ERR("Failed to allocate techniques memory\n");
521 return E_OUTOFMEMORY;
524 for (i = 0; i < e->local_buffer_count; ++i)
526 struct d3d10_effect_local_buffer *l = &e->local_buffers[i];
527 l->vtbl = &d3d10_effect_constant_buffer_vtbl;
529 hr = parse_fx10_local_buffer(l, &ptr, data);
530 if (FAILED(hr)) return hr;
533 for (i = 0; i < e->technique_count; ++i)
535 struct d3d10_effect_technique *t = &e->techniques[i];
537 t->vtbl = &d3d10_effect_technique_vtbl;
538 t->effect = e;
540 hr = parse_fx10_technique(t, &ptr, data);
541 if (FAILED(hr)) return hr;
544 return S_OK;
547 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
549 const char *ptr = data;
550 DWORD unknown;
552 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
553 read_dword(&ptr, &e->version);
554 TRACE("Target: %#x\n", e->version);
556 read_dword(&ptr, &e->local_buffer_count);
557 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
559 read_dword(&ptr, &e->variable_count);
560 TRACE("Variable count: %u\n", e->variable_count);
562 read_dword(&ptr, &e->object_count);
563 TRACE("Object count: %u\n", e->object_count);
565 read_dword(&ptr, &e->sharedbuffers_count);
566 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
568 /* Number of variables in shared buffers? */
569 read_dword(&ptr, &unknown);
570 FIXME("Unknown 0: %u\n", unknown);
572 read_dword(&ptr, &e->sharedobjects_count);
573 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
575 read_dword(&ptr, &e->technique_count);
576 TRACE("Technique count: %u\n", e->technique_count);
578 read_dword(&ptr, &e->index_offset);
579 TRACE("Index offset: %#x\n", e->index_offset);
581 read_dword(&ptr, &unknown);
582 FIXME("Unknown 1: %u\n", unknown);
584 read_dword(&ptr, &e->texture_count);
585 TRACE("Texture count: %u\n", e->texture_count);
587 read_dword(&ptr, &e->dephstencilstate_count);
588 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
590 read_dword(&ptr, &e->blendstate_count);
591 TRACE("Blendstate count: %u\n", e->blendstate_count);
593 read_dword(&ptr, &e->rasterizerstate_count);
594 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
596 read_dword(&ptr, &e->samplerstate_count);
597 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
599 read_dword(&ptr, &e->rendertargetview_count);
600 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
602 read_dword(&ptr, &e->depthstencilview_count);
603 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
605 read_dword(&ptr, &e->shader_call_count);
606 TRACE("Shader call count: %u\n", e->shader_call_count);
608 read_dword(&ptr, &e->shader_compile_count);
609 TRACE("Shader compile count: %u\n", e->shader_compile_count);
611 return parse_fx10_body(e, ptr, data_size - (ptr - data));
614 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
616 struct d3d10_effect *e = ctx;
617 char tag_str[5];
619 memcpy(tag_str, &tag, 4);
620 tag_str[4] = '\0';
621 TRACE("tag: %s\n", tag_str);
623 TRACE("chunk size: %#x\n", data_size);
625 switch(tag)
627 case TAG_FX10:
628 return parse_fx10(e, data, data_size);
630 default:
631 FIXME("Unhandled chunk %s\n", tag_str);
632 return S_OK;
636 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
638 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
641 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
643 TRACE("effect object %p.\n", o);
645 switch(o->type)
647 case D3D10_EOT_VERTEXSHADER:
648 case D3D10_EOT_PIXELSHADER:
649 case D3D10_EOT_GEOMETRYSHADER:
650 HeapFree(GetProcessHeap(), 0, ((struct d3d10_effect_shader_variable *)o->data)->input_signature);
651 break;
653 default:
654 break;
656 HeapFree(GetProcessHeap(), 0, o->data);
659 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
661 ID3D10Device *device = o->pass->technique->effect->device;
663 TRACE("effect object %p, type %#x.\n", o, o->type);
665 switch(o->type)
667 case D3D10_EOT_VERTEXSHADER:
668 ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.vs);
669 return S_OK;
671 case D3D10_EOT_PIXELSHADER:
672 ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.ps);
673 return S_OK;
675 case D3D10_EOT_GEOMETRYSHADER:
676 ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)o->data)->shader.gs);
677 return S_OK;
679 default:
680 FIXME("Unhandled effect object type %#x.\n", o->type);
681 return E_FAIL;
685 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
687 TRACE("pass %p\n", p);
689 HeapFree(GetProcessHeap(), 0, p->name);
690 if (p->objects)
692 unsigned int i;
693 for (i = 0; i < p->object_count; ++i)
695 d3d10_effect_object_destroy(&p->objects[i]);
697 HeapFree(GetProcessHeap(), 0, p->objects);
701 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
703 TRACE("technique %p\n", t);
705 HeapFree(GetProcessHeap(), 0, t->name);
706 if (t->passes)
708 unsigned int i;
709 for (i = 0; i < t->pass_count; ++i)
711 d3d10_effect_pass_destroy(&t->passes[i]);
713 HeapFree(GetProcessHeap(), 0, t->passes);
717 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
719 TRACE("variable %p.\n", v);
721 HeapFree(GetProcessHeap(), 0, v->name);
724 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_local_buffer *l)
726 TRACE("local buffer %p.\n", l);
728 HeapFree(GetProcessHeap(), 0, l->name);
729 if (l->variables)
731 unsigned int i;
732 for (i = 0; i < l->variable_count; ++i)
734 d3d10_effect_variable_destroy(&l->variables[i]);
736 HeapFree(GetProcessHeap(), 0, l->variables);
740 /* IUnknown methods */
742 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
744 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
746 if (IsEqualGUID(riid, &IID_ID3D10Effect)
747 || IsEqualGUID(riid, &IID_IUnknown))
749 IUnknown_AddRef(iface);
750 *object = iface;
751 return S_OK;
754 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
756 *object = NULL;
757 return E_NOINTERFACE;
760 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
762 struct d3d10_effect *This = (struct d3d10_effect *)iface;
763 ULONG refcount = InterlockedIncrement(&This->refcount);
765 TRACE("%p increasing refcount to %u\n", This, refcount);
767 return refcount;
770 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
772 struct d3d10_effect *This = (struct d3d10_effect *)iface;
773 ULONG refcount = InterlockedDecrement(&This->refcount);
775 TRACE("%p decreasing refcount to %u\n", This, refcount);
777 if (!refcount)
779 unsigned int i;
781 if (This->techniques)
783 for (i = 0; i < This->technique_count; ++i)
785 d3d10_effect_technique_destroy(&This->techniques[i]);
787 HeapFree(GetProcessHeap(), 0, This->techniques);
790 if (This->local_buffers)
792 for (i = 0; i < This->local_buffer_count; ++i)
794 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
796 HeapFree(GetProcessHeap(), 0, This->local_buffers);
799 ID3D10Device_Release(This->device);
800 HeapFree(GetProcessHeap(), 0, This);
803 return refcount;
806 /* ID3D10Effect methods */
808 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
810 FIXME("iface %p stub!\n", iface);
812 return FALSE;
815 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
817 FIXME("iface %p stub!\n", iface);
819 return FALSE;
822 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
824 struct d3d10_effect *This = (struct d3d10_effect *)iface;
826 TRACE("iface %p, device %p\n", iface, device);
828 ID3D10Device_AddRef(This->device);
829 *device = This->device;
831 return S_OK;
834 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
836 FIXME("iface %p, desc %p stub!\n", iface, desc);
838 return E_NOTIMPL;
841 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
842 UINT index)
844 struct d3d10_effect *This = (struct d3d10_effect *)iface;
845 struct d3d10_effect_local_buffer *l;
847 TRACE("iface %p, index %u\n", iface, index);
849 if (index >= This->local_buffer_count)
851 WARN("Invalid index specified\n");
852 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
855 l = &This->local_buffers[index];
857 TRACE("Returning buffer %p, \"%s\"\n", l, l->name);
859 return (ID3D10EffectConstantBuffer *)l;
862 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
863 LPCSTR name)
865 struct d3d10_effect *This = (struct d3d10_effect *)iface;
866 unsigned int i;
868 TRACE("iface %p, name \"%s\"\n", iface, name);
870 for (i = 0; i < This->local_buffer_count; ++i)
872 struct d3d10_effect_local_buffer *l = &This->local_buffers[i];
874 if (!strcmp(l->name, name))
876 TRACE("Returning buffer %p.\n", l);
877 return (ID3D10EffectConstantBuffer *)l;
881 WARN("Invalid name specified\n");
883 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
886 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
888 FIXME("iface %p, index %u stub!\n", iface, index);
890 return NULL;
893 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
895 struct d3d10_effect *This = (struct d3d10_effect *)iface;
896 unsigned int i;
898 TRACE("iface %p, name \"%s\"\n", iface, name);
900 for (i = 0; i < This->local_buffer_count; ++i)
902 struct d3d10_effect_local_buffer *l = &This->local_buffers[i];
903 unsigned int j;
905 for (j = 0; j < l->variable_count; ++j)
907 struct d3d10_effect_variable *v = &l->variables[j];
909 if (!strcmp(v->name, name))
911 TRACE("Returning variable %p.\n", v);
912 return (ID3D10EffectVariable *)v;
917 WARN("Invalid name specified\n");
919 return (ID3D10EffectVariable *)&null_variable;
922 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
923 LPCSTR semantic)
925 FIXME("iface %p, semantic \"%s\" stub!\n", iface, semantic);
927 return NULL;
930 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
931 UINT index)
933 struct d3d10_effect *This = (struct d3d10_effect *)iface;
934 struct d3d10_effect_technique *t;
936 TRACE("iface %p, index %u\n", iface, index);
938 if (index >= This->technique_count)
940 WARN("Invalid index specified\n");
941 return (ID3D10EffectTechnique *)&null_technique;
944 t = &This->techniques[index];
946 TRACE("Returning technique %p, \"%s\"\n", t, t->name);
948 return (ID3D10EffectTechnique *)t;
951 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
952 LPCSTR name)
954 struct d3d10_effect *This = (struct d3d10_effect *)iface;
955 unsigned int i;
957 TRACE("iface %p, name \"%s\"\n", iface, name);
959 for (i = 0; i < This->technique_count; ++i)
961 struct d3d10_effect_technique *t = &This->techniques[i];
962 if (!strcmp(t->name, name))
964 TRACE("Returning technique %p\n", t);
965 return (ID3D10EffectTechnique *)t;
969 WARN("Invalid name specified\n");
971 return (ID3D10EffectTechnique *)&null_technique;
974 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
976 FIXME("iface %p stub!\n", iface);
978 return E_NOTIMPL;
981 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
983 FIXME("iface %p stub!\n", iface);
985 return FALSE;
988 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
990 /* IUnknown methods */
991 d3d10_effect_QueryInterface,
992 d3d10_effect_AddRef,
993 d3d10_effect_Release,
994 /* ID3D10Effect methods */
995 d3d10_effect_IsValid,
996 d3d10_effect_IsPool,
997 d3d10_effect_GetDevice,
998 d3d10_effect_GetDesc,
999 d3d10_effect_GetConstantBufferByIndex,
1000 d3d10_effect_GetConstantBufferByName,
1001 d3d10_effect_GetVariableByIndex,
1002 d3d10_effect_GetVariableByName,
1003 d3d10_effect_GetVariableBySemantic,
1004 d3d10_effect_GetTechniqueByIndex,
1005 d3d10_effect_GetTechniqueByName,
1006 d3d10_effect_Optimize,
1007 d3d10_effect_IsOptimized,
1010 /* ID3D10EffectTechnique methods */
1012 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
1014 FIXME("iface %p stub!\n", iface);
1016 return FALSE;
1019 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
1020 D3D10_TECHNIQUE_DESC *desc)
1022 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1024 TRACE("iface %p, desc %p\n", iface, desc);
1026 if(This == &null_technique)
1028 WARN("Null technique specified\n");
1029 return E_FAIL;
1032 if(!desc)
1034 WARN("Invalid argument specified\n");
1035 return E_INVALIDARG;
1038 desc->Name = This->name;
1039 desc->Passes = This->pass_count;
1040 WARN("Annotations not implemented\n");
1041 desc->Annotations = 0;
1043 return S_OK;
1046 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
1047 ID3D10EffectTechnique *iface, UINT index)
1049 FIXME("iface %p, index %u stub!\n", iface, index);
1051 return NULL;
1054 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
1055 ID3D10EffectTechnique *iface, LPCSTR name)
1057 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1059 return NULL;
1062 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
1063 UINT index)
1065 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1066 struct d3d10_effect_pass *p;
1068 TRACE("iface %p, index %u\n", iface, index);
1070 if (index >= This->pass_count)
1072 WARN("Invalid index specified\n");
1073 return (ID3D10EffectPass *)&null_pass;
1076 p = &This->passes[index];
1078 TRACE("Returning pass %p, \"%s\"\n", p, p->name);
1080 return (ID3D10EffectPass *)p;
1083 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
1084 LPCSTR name)
1086 struct d3d10_effect_technique *This = (struct d3d10_effect_technique *)iface;
1087 unsigned int i;
1089 TRACE("iface %p, name \"%s\"\n", iface, name);
1091 for (i = 0; i < This->pass_count; ++i)
1093 struct d3d10_effect_pass *p = &This->passes[i];
1094 if (!strcmp(p->name, name))
1096 TRACE("Returning pass %p\n", p);
1097 return (ID3D10EffectPass *)p;
1101 WARN("Invalid name specified\n");
1103 return (ID3D10EffectPass *)&null_pass;
1106 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
1107 D3D10_STATE_BLOCK_MASK *mask)
1109 FIXME("iface %p,mask %p stub!\n", iface, mask);
1111 return E_NOTIMPL;
1114 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
1116 /* ID3D10EffectTechnique methods */
1117 d3d10_effect_technique_IsValid,
1118 d3d10_effect_technique_GetDesc,
1119 d3d10_effect_technique_GetAnnotationByIndex,
1120 d3d10_effect_technique_GetAnnotationByName,
1121 d3d10_effect_technique_GetPassByIndex,
1122 d3d10_effect_technique_GetPassByName,
1123 d3d10_effect_technique_ComputeStateBlockMask,
1126 /* ID3D10EffectPass methods */
1128 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
1130 FIXME("iface %p stub!\n", iface);
1132 return FALSE;
1135 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface, D3D10_PASS_DESC *desc)
1137 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
1138 unsigned int i;
1140 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
1142 if(This == &null_pass)
1144 WARN("Null pass specified\n");
1145 return E_FAIL;
1148 if(!desc)
1150 WARN("Invalid argument specified\n");
1151 return E_INVALIDARG;
1154 memset(desc, 0, sizeof(*desc));
1155 desc->Name = This->name;
1156 for (i = 0; i < This->object_count; ++i)
1158 struct d3d10_effect_object *o = &This->objects[i];
1159 if (o->type == D3D10_EOT_VERTEXSHADER)
1161 struct d3d10_effect_shader_variable *s = o->data;
1162 desc->pIAInputSignature = (BYTE *)s->input_signature;
1163 desc->IAInputSignatureSize = s->input_signature_size;
1164 break;
1168 return S_OK;
1171 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
1172 D3D10_PASS_SHADER_DESC *desc)
1174 FIXME("iface %p, desc %p stub!\n", iface, desc);
1176 return E_NOTIMPL;
1179 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
1180 D3D10_PASS_SHADER_DESC *desc)
1182 FIXME("iface %p, desc %p stub!\n", iface, desc);
1184 return E_NOTIMPL;
1187 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
1188 D3D10_PASS_SHADER_DESC *desc)
1190 FIXME("iface %p, desc %p stub!\n", iface, desc);
1192 return E_NOTIMPL;
1195 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
1196 UINT index)
1198 FIXME("iface %p, index %u stub!\n", iface, index);
1200 return NULL;
1203 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
1204 LPCSTR name)
1206 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1208 return NULL;
1211 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
1213 struct d3d10_effect_pass *This = (struct d3d10_effect_pass *)iface;
1214 HRESULT hr = S_OK;
1215 unsigned int i;
1217 TRACE("iface %p, flags %#x\n", iface, flags);
1219 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
1221 for (i = 0; i < This->object_count; ++i)
1223 hr = d3d10_effect_object_apply(&This->objects[i]);
1224 if (FAILED(hr)) break;
1227 return hr;
1230 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
1231 D3D10_STATE_BLOCK_MASK *mask)
1233 FIXME("iface %p, mask %p stub!\n", iface, mask);
1235 return E_NOTIMPL;
1238 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
1240 /* ID3D10EffectPass methods */
1241 d3d10_effect_pass_IsValid,
1242 d3d10_effect_pass_GetDesc,
1243 d3d10_effect_pass_GetVertexShaderDesc,
1244 d3d10_effect_pass_GetGeometryShaderDesc,
1245 d3d10_effect_pass_GetPixelShaderDesc,
1246 d3d10_effect_pass_GetAnnotationByIndex,
1247 d3d10_effect_pass_GetAnnotationByName,
1248 d3d10_effect_pass_Apply,
1249 d3d10_effect_pass_ComputeStateBlockMask,
1252 /* ID3D10EffectVariable methods */
1254 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
1256 FIXME("iface %p stub!\n", iface);
1258 return FALSE;
1261 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
1263 FIXME("iface %p stub!\n", iface);
1265 return NULL;
1268 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
1269 D3D10_EFFECT_VARIABLE_DESC *desc)
1271 FIXME("iface %p, desc %p stub!\n", iface, desc);
1273 return E_NOTIMPL;
1276 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
1277 ID3D10EffectVariable *iface, UINT index)
1279 FIXME("iface %p, index %u stub!\n", iface, index);
1281 return NULL;
1284 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
1285 ID3D10EffectVariable *iface, LPCSTR name)
1287 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1289 return NULL;
1292 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
1293 ID3D10EffectVariable *iface, UINT index)
1295 FIXME("iface %p, index %u stub!\n", iface, index);
1297 return NULL;
1300 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
1301 ID3D10EffectVariable *iface, LPCSTR name)
1303 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1305 return NULL;
1308 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
1309 ID3D10EffectVariable *iface, LPCSTR semantic)
1311 FIXME("iface %p, semantic \"%s\" stub!\n", iface, semantic);
1313 return NULL;
1316 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
1317 ID3D10EffectVariable *iface, UINT index)
1319 FIXME("iface %p, index %u stub!\n", iface, index);
1321 return NULL;
1324 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
1325 ID3D10EffectVariable *iface)
1327 FIXME("iface %p stub!\n", iface);
1329 return NULL;
1332 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
1333 ID3D10EffectVariable *iface)
1335 FIXME("iface %p stub!\n", iface);
1337 return NULL;
1340 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
1341 ID3D10EffectVariable *iface)
1343 FIXME("iface %p stub!\n", iface);
1345 return NULL;
1348 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
1349 ID3D10EffectVariable *iface)
1351 FIXME("iface %p stub!\n", iface);
1353 return NULL;
1356 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
1357 ID3D10EffectVariable *iface)
1359 FIXME("iface %p stub!\n", iface);
1361 return NULL;
1364 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
1365 ID3D10EffectVariable *iface)
1367 FIXME("iface %p stub!\n", iface);
1369 return NULL;
1372 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
1373 ID3D10EffectVariable *iface)
1375 FIXME("iface %p stub!\n", iface);
1377 return NULL;
1380 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
1381 ID3D10EffectVariable *iface)
1383 FIXME("iface %p stub!\n", iface);
1385 return NULL;
1388 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
1389 ID3D10EffectVariable *iface)
1391 FIXME("iface %p stub!\n", iface);
1393 return NULL;
1396 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
1397 ID3D10EffectVariable *iface)
1399 FIXME("iface %p stub!\n", iface);
1401 return NULL;
1404 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
1406 FIXME("iface %p stub!\n", iface);
1408 return NULL;
1411 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
1412 ID3D10EffectVariable *iface)
1414 FIXME("iface %p stub!\n", iface);
1416 return NULL;
1419 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
1420 ID3D10EffectVariable *iface)
1422 FIXME("iface %p stub!\n", iface);
1424 return NULL;
1427 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
1428 ID3D10EffectVariable *iface)
1430 FIXME("iface %p stub!\n", iface);
1432 return NULL;
1435 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
1436 void *data, UINT offset, UINT count)
1438 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
1440 return E_NOTIMPL;
1443 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
1444 void *data, UINT offset, UINT count)
1446 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
1448 return E_NOTIMPL;
1451 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
1453 /* ID3D10EffectVariable methods */
1454 d3d10_effect_variable_IsValid,
1455 d3d10_effect_variable_GetType,
1456 d3d10_effect_variable_GetDesc,
1457 d3d10_effect_variable_GetAnnotationByIndex,
1458 d3d10_effect_variable_GetAnnotationByName,
1459 d3d10_effect_variable_GetMemberByIndex,
1460 d3d10_effect_variable_GetMemberByName,
1461 d3d10_effect_variable_GetMemberBySemantic,
1462 d3d10_effect_variable_GetElement,
1463 d3d10_effect_variable_GetParentConstantBuffer,
1464 d3d10_effect_variable_AsScalar,
1465 d3d10_effect_variable_AsVector,
1466 d3d10_effect_variable_AsMatrix,
1467 d3d10_effect_variable_AsString,
1468 d3d10_effect_variable_AsShaderResource,
1469 d3d10_effect_variable_AsRenderTargetView,
1470 d3d10_effect_variable_AsDepthStencilView,
1471 d3d10_effect_variable_AsConstantBuffer,
1472 d3d10_effect_variable_AsShader,
1473 d3d10_effect_variable_AsBlend,
1474 d3d10_effect_variable_AsDepthStencil,
1475 d3d10_effect_variable_AsRasterizer,
1476 d3d10_effect_variable_AsSampler,
1477 d3d10_effect_variable_SetRawValue,
1478 d3d10_effect_variable_GetRawValue,
1481 /* ID3D10EffectVariable methods */
1482 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
1484 FIXME("iface %p stub!\n", iface);
1486 return FALSE;
1489 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
1491 FIXME("iface %p stub!\n", iface);
1493 return NULL;
1496 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
1497 D3D10_EFFECT_VARIABLE_DESC *desc)
1499 FIXME("iface %p, desc %p stub!\n", iface, desc);
1501 return E_NOTIMPL;
1504 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
1505 ID3D10EffectConstantBuffer *iface, UINT index)
1507 FIXME("iface %p, index %u stub!\n", iface, index);
1509 return NULL;
1512 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
1513 ID3D10EffectConstantBuffer *iface, LPCSTR name)
1515 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1517 return NULL;
1520 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
1521 ID3D10EffectConstantBuffer *iface, UINT index)
1523 FIXME("iface %p, index %u stub!\n", iface, index);
1525 return NULL;
1528 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
1529 ID3D10EffectConstantBuffer *iface, LPCSTR name)
1531 FIXME("iface %p, name \"%s\" stub!\n", iface, name);
1533 return NULL;
1536 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
1537 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
1539 FIXME("iface %p, semantic \"%s\" stub!\n", iface, semantic);
1541 return NULL;
1544 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
1545 ID3D10EffectConstantBuffer *iface, UINT index)
1547 FIXME("iface %p, index %u stub!\n", iface, index);
1549 return NULL;
1552 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
1553 ID3D10EffectConstantBuffer *iface)
1555 FIXME("iface %p stub!\n", iface);
1557 return NULL;
1560 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
1561 ID3D10EffectConstantBuffer *iface)
1563 FIXME("iface %p stub!\n", iface);
1565 return NULL;
1568 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
1569 ID3D10EffectConstantBuffer *iface)
1571 FIXME("iface %p stub!\n", iface);
1573 return NULL;
1576 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
1577 ID3D10EffectConstantBuffer *iface)
1579 FIXME("iface %p stub!\n", iface);
1581 return NULL;
1584 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
1585 ID3D10EffectConstantBuffer *iface)
1587 FIXME("iface %p stub!\n", iface);
1589 return NULL;
1592 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
1593 ID3D10EffectConstantBuffer *iface)
1595 FIXME("iface %p stub!\n", iface);
1597 return NULL;
1600 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
1601 ID3D10EffectConstantBuffer *iface)
1603 FIXME("iface %p stub!\n", iface);
1605 return NULL;
1608 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
1609 ID3D10EffectConstantBuffer *iface)
1611 FIXME("iface %p stub!\n", iface);
1613 return NULL;
1616 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
1617 ID3D10EffectConstantBuffer *iface)
1619 FIXME("iface %p stub!\n", iface);
1621 return NULL;
1624 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
1625 ID3D10EffectConstantBuffer *iface)
1627 FIXME("iface %p stub!\n", iface);
1629 return NULL;
1632 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
1634 FIXME("iface %p stub!\n", iface);
1636 return NULL;
1639 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
1640 ID3D10EffectConstantBuffer *iface)
1642 FIXME("iface %p stub!\n", iface);
1644 return NULL;
1647 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
1648 ID3D10EffectConstantBuffer *iface)
1650 FIXME("iface %p stub!\n", iface);
1652 return NULL;
1655 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
1656 ID3D10EffectConstantBuffer *iface)
1658 FIXME("iface %p stub!\n", iface);
1660 return NULL;
1663 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
1664 void *data, UINT offset, UINT count)
1666 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
1668 return E_NOTIMPL;
1671 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
1672 void *data, UINT offset, UINT count)
1674 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
1676 return E_NOTIMPL;
1679 /* ID3D10EffectConstantBuffer methods */
1680 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
1681 ID3D10Buffer *buffer)
1683 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
1685 return E_NOTIMPL;
1688 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
1689 ID3D10Buffer **buffer)
1691 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
1693 return E_NOTIMPL;
1696 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
1697 ID3D10ShaderResourceView *view)
1699 FIXME("iface %p, view %p stub!\n", iface, view);
1701 return E_NOTIMPL;
1704 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
1705 ID3D10ShaderResourceView **view)
1707 FIXME("iface %p, view %p stub!\n", iface, view);
1709 return E_NOTIMPL;
1712 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
1714 /* ID3D10EffectVariable methods */
1715 d3d10_effect_constant_buffer_IsValid,
1716 d3d10_effect_constant_buffer_GetType,
1717 d3d10_effect_constant_buffer_GetDesc,
1718 d3d10_effect_constant_buffer_GetAnnotationByIndex,
1719 d3d10_effect_constant_buffer_GetAnnotationByName,
1720 d3d10_effect_constant_buffer_GetMemberByIndex,
1721 d3d10_effect_constant_buffer_GetMemberByName,
1722 d3d10_effect_constant_buffer_GetMemberBySemantic,
1723 d3d10_effect_constant_buffer_GetElement,
1724 d3d10_effect_constant_buffer_GetParentConstantBuffer,
1725 d3d10_effect_constant_buffer_AsScalar,
1726 d3d10_effect_constant_buffer_AsVector,
1727 d3d10_effect_constant_buffer_AsMatrix,
1728 d3d10_effect_constant_buffer_AsString,
1729 d3d10_effect_constant_buffer_AsShaderResource,
1730 d3d10_effect_constant_buffer_AsRenderTargetView,
1731 d3d10_effect_constant_buffer_AsDepthStencilView,
1732 d3d10_effect_constant_buffer_AsConstantBuffer,
1733 d3d10_effect_constant_buffer_AsShader,
1734 d3d10_effect_constant_buffer_AsBlend,
1735 d3d10_effect_constant_buffer_AsDepthStencil,
1736 d3d10_effect_constant_buffer_AsRasterizer,
1737 d3d10_effect_constant_buffer_AsSampler,
1738 d3d10_effect_constant_buffer_SetRawValue,
1739 d3d10_effect_constant_buffer_GetRawValue,
1740 /* ID3D10EffectConstantBuffer methods */
1741 d3d10_effect_constant_buffer_SetConstantBuffer,
1742 d3d10_effect_constant_buffer_GetConstantBuffer,
1743 d3d10_effect_constant_buffer_SetTextureBuffer,
1744 d3d10_effect_constant_buffer_GetTextureBuffer,