d3d10: Properly cleanup shader variables.
[wine.git] / dlls / d3d10 / effect.c
blobdf284e937db539b57754cb4bbdba55188defccb7
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2009 Rico Schüller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include "d3d10_private.h"
26 #include <float.h>
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
30 #define D3D10_FX10_TYPE_COLUMN_SHIFT 11
31 #define D3D10_FX10_TYPE_COLUMN_MASK (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
33 #define D3D10_FX10_TYPE_ROW_SHIFT 8
34 #define D3D10_FX10_TYPE_ROW_MASK (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
36 #define D3D10_FX10_TYPE_BASETYPE_SHIFT 3
37 #define D3D10_FX10_TYPE_BASETYPE_MASK (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
39 #define D3D10_FX10_TYPE_CLASS_SHIFT 0
40 #define D3D10_FX10_TYPE_CLASS_MASK (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
42 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
44 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
45 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
46 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
47 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
48 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
49 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
50 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
51 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl;
52 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl;
53 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl;
54 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl;
55 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl;
56 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
57 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl;
58 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl;
59 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl;
60 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
62 /* null objects - needed for invalid calls */
63 static struct d3d10_effect_technique null_technique = {{&d3d10_effect_technique_vtbl}};
64 static struct d3d10_effect_pass null_pass = {{&d3d10_effect_pass_vtbl}};
65 static struct d3d10_effect_type null_type = {{&d3d10_effect_type_vtbl}};
66 static struct d3d10_effect_variable null_local_buffer = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl},
67 &null_local_buffer, &null_type};
68 static struct d3d10_effect_variable null_variable = {{&d3d10_effect_variable_vtbl},
69 &null_local_buffer, &null_type};
70 static struct d3d10_effect_variable null_scalar_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl},
71 &null_local_buffer, &null_type};
72 static struct d3d10_effect_variable null_vector_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl},
73 &null_local_buffer, &null_type};
74 static struct d3d10_effect_variable null_matrix_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl},
75 &null_local_buffer, &null_type};
76 static struct d3d10_effect_variable null_string_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl},
77 &null_local_buffer, &null_type};
78 static struct d3d10_effect_variable null_shader_resource_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl},
79 &null_local_buffer, &null_type};
80 static struct d3d10_effect_variable null_render_target_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl},
81 &null_local_buffer, &null_type};
82 static struct d3d10_effect_variable null_depth_stencil_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl},
83 &null_local_buffer, &null_type};
84 static struct d3d10_effect_variable null_shader_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
85 &null_local_buffer, &null_type};
86 static struct d3d10_effect_variable null_blend_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl},
87 &null_local_buffer, &null_type};
88 static struct d3d10_effect_variable null_depth_stencil_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl},
89 &null_local_buffer, &null_type};
90 static struct d3d10_effect_variable null_rasterizer_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl},
91 &null_local_buffer, &null_type};
92 static struct d3d10_effect_variable null_sampler_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl},
93 &null_local_buffer, &null_type};
95 /* anonymous_shader_type and anonymous_shader */
96 static char anonymous_name[] = "$Anonymous";
97 static char anonymous_vertexshader_name[] = "vertexshader";
98 static char anonymous_pixelshader_name[] = "pixelshader";
99 static char anonymous_geometryshader_name[] = "geometryshader";
100 static struct d3d10_effect_type anonymous_vs_type = {{&d3d10_effect_type_vtbl},
101 anonymous_vertexshader_name, D3D10_SVT_VERTEXSHADER, D3D10_SVC_OBJECT};
102 static struct d3d10_effect_type anonymous_ps_type = {{&d3d10_effect_type_vtbl},
103 anonymous_pixelshader_name, D3D10_SVT_PIXELSHADER, D3D10_SVC_OBJECT};
104 static struct d3d10_effect_type anonymous_gs_type = {{&d3d10_effect_type_vtbl},
105 anonymous_geometryshader_name, D3D10_SVT_GEOMETRYSHADER, D3D10_SVC_OBJECT};
106 static struct d3d10_effect_variable anonymous_vs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
107 &null_local_buffer, &anonymous_vs_type, &null_shader_variable, anonymous_name};
108 static struct d3d10_effect_variable anonymous_ps = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
109 &null_local_buffer, &anonymous_ps_type, &null_shader_variable, anonymous_name};
110 static struct d3d10_effect_variable anonymous_gs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
111 &null_local_buffer, &anonymous_gs_type, &null_shader_variable, anonymous_name};
113 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
115 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
117 return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
120 struct d3d10_effect_state_property_info
122 UINT id;
123 const char *name;
124 D3D_SHADER_VARIABLE_TYPE type;
125 UINT size;
126 UINT count;
127 D3D_SHADER_VARIABLE_TYPE container_type;
128 LONG offset;
131 static const struct d3d10_effect_state_property_info property_info[] =
133 {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
134 {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
135 {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
136 {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
137 {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
138 {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
139 {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
140 {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
141 {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
142 {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
143 {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
144 {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
145 {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
146 {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
147 {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
148 {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
149 {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
150 {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
151 {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
152 {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
153 {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
154 {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
155 {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
156 {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
157 {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
158 {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
159 {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
160 {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
161 {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
162 {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
163 {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
164 {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
165 {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
166 {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
167 {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
168 {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
169 {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
170 {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
171 {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
172 {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
173 {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
174 {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
175 {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
178 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
180 D3D10_FILL_SOLID,
181 D3D10_CULL_BACK,
182 FALSE,
184 0.0f,
185 0.0f,
186 TRUE,
187 FALSE,
188 FALSE,
189 FALSE,
192 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
194 TRUE,
195 D3D10_DEPTH_WRITE_MASK_ALL,
196 D3D10_COMPARISON_LESS,
197 FALSE,
198 D3D10_DEFAULT_STENCIL_READ_MASK,
199 D3D10_DEFAULT_STENCIL_WRITE_MASK,
200 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
201 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
204 static const D3D10_BLEND_DESC default_blend_desc =
206 FALSE,
207 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
208 D3D10_BLEND_SRC_ALPHA,
209 D3D10_BLEND_INV_SRC_ALPHA,
210 D3D10_BLEND_OP_ADD,
211 D3D10_BLEND_SRC_ALPHA,
212 D3D10_BLEND_INV_SRC_ALPHA,
213 D3D10_BLEND_OP_ADD,
214 {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
217 static const D3D10_SAMPLER_DESC default_sampler_desc =
219 D3D10_FILTER_MIN_MAG_MIP_POINT,
220 D3D10_TEXTURE_ADDRESS_WRAP,
221 D3D10_TEXTURE_ADDRESS_WRAP,
222 D3D10_TEXTURE_ADDRESS_WRAP,
223 0.0f,
225 D3D10_COMPARISON_NEVER,
226 {0.0f, 0.0f, 0.0f, 0.0f},
227 0.0f,
228 FLT_MAX,
231 struct d3d10_effect_state_storage_info
233 D3D_SHADER_VARIABLE_TYPE id;
234 size_t size;
235 const void *default_state;
238 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
240 {D3D10_SVT_RASTERIZER, sizeof(default_rasterizer_desc), &default_rasterizer_desc },
241 {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
242 {D3D10_SVT_BLEND, sizeof(default_blend_desc), &default_blend_desc },
243 {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc },
246 static BOOL copy_name(const char *ptr, char **name)
248 size_t name_len;
250 if (!ptr) return TRUE;
252 name_len = strlen(ptr) + 1;
253 if (name_len == 1)
255 return TRUE;
258 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
259 if (!*name)
261 ERR("Failed to allocate name memory.\n");
262 return FALSE;
265 memcpy(*name, ptr, name_len);
267 return TRUE;
270 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
272 D3D10_SIGNATURE_PARAMETER_DESC *e;
273 const char *ptr = data;
274 unsigned int i;
275 DWORD count;
277 read_dword(&ptr, &count);
278 TRACE("%u elements\n", count);
280 skip_dword_unknown("shader signature", &ptr, 1);
282 e = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*e));
283 if (!e)
285 ERR("Failed to allocate signature memory.\n");
286 return E_OUTOFMEMORY;
289 for (i = 0; i < count; ++i)
291 UINT name_offset;
292 UINT mask;
294 read_dword(&ptr, &name_offset);
295 e[i].SemanticName = data + name_offset;
296 read_dword(&ptr, &e[i].SemanticIndex);
297 read_dword(&ptr, &e[i].SystemValueType);
298 read_dword(&ptr, &e[i].ComponentType);
299 read_dword(&ptr, &e[i].Register);
300 read_dword(&ptr, &mask);
302 e[i].ReadWriteMask = mask >> 8;
303 e[i].Mask = mask & 0xff;
305 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
306 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
307 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
308 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
311 s->elements = e;
312 s->element_count = count;
314 return S_OK;
317 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
319 HeapFree(GetProcessHeap(), 0, s->signature);
320 HeapFree(GetProcessHeap(), 0, s->elements);
323 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
325 struct d3d10_effect_shader_variable *s = ctx;
326 HRESULT hr;
328 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
330 TRACE("chunk size: %#x\n", data_size);
332 switch(tag)
334 case TAG_ISGN:
335 case TAG_OSGN:
337 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
338 UINT size = 44 + data_size;
339 struct d3d10_effect_shader_signature *sig;
340 char *ptr;
342 if (tag == TAG_ISGN) sig = &s->input_signature;
343 else sig = &s->output_signature;
345 sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
346 if (!sig->signature)
348 ERR("Failed to allocate input signature data\n");
349 return E_OUTOFMEMORY;
351 sig->signature_size = size;
353 ptr = sig->signature;
355 write_dword(&ptr, TAG_DXBC);
357 /* signature(?) */
358 write_dword_unknown(&ptr, 0);
359 write_dword_unknown(&ptr, 0);
360 write_dword_unknown(&ptr, 0);
361 write_dword_unknown(&ptr, 0);
363 /* seems to be always 1 */
364 write_dword_unknown(&ptr, 1);
366 /* DXBC size */
367 write_dword(&ptr, size);
369 /* chunk count */
370 write_dword(&ptr, 1);
372 /* chunk index */
373 write_dword(&ptr, (ptr - sig->signature) + 4);
375 /* chunk */
376 write_dword(&ptr, tag);
377 write_dword(&ptr, data_size);
378 memcpy(ptr, data, data_size);
380 hr = shader_parse_signature(ptr, data_size, sig);
381 if (FAILED(hr))
383 ERR("Failed to parse shader, hr %#x\n", hr);
384 shader_free_signature(sig);
387 break;
390 default:
391 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
392 break;
395 return S_OK;
398 static HRESULT parse_shader(struct d3d10_effect_variable *v, const char *data)
400 ID3D10Device *device = v->effect->device;
401 struct d3d10_effect_shader_variable *s;
402 const char *ptr = data;
403 DWORD dxbc_size;
404 HRESULT hr;
406 s = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*s));
407 if (!s)
409 ERR("Failed to allocate shader variable memory\n");
410 return E_OUTOFMEMORY;
413 v->data = s;
415 if (v->effect->used_shader_current >= v->effect->used_shader_count)
417 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
418 return E_FAIL;
421 v->effect->used_shaders[v->effect->used_shader_current] = v;
422 ++v->effect->used_shader_current;
424 if (!ptr) return S_OK;
426 read_dword(&ptr, &dxbc_size);
427 TRACE("dxbc size: %#x\n", dxbc_size);
429 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
430 if (!dxbc_size) return S_OK;
432 switch (v->type->basetype)
434 case D3D10_SVT_VERTEXSHADER:
435 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &s->shader.vs);
436 if (FAILED(hr)) return hr;
437 break;
439 case D3D10_SVT_PIXELSHADER:
440 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &s->shader.ps);
441 if (FAILED(hr)) return hr;
442 break;
444 case D3D10_SVT_GEOMETRYSHADER:
445 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &s->shader.gs);
446 if (FAILED(hr)) return hr;
447 break;
449 default:
450 ERR("This should not happen!\n");
451 return E_FAIL;
454 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, s);
457 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
459 switch (c)
461 case 1: return D3D10_SVC_SCALAR;
462 case 2: return D3D10_SVC_VECTOR;
463 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
464 else return D3D10_SVC_MATRIX_ROWS;
465 default:
466 FIXME("Unknown variable class %#x.\n", c);
467 return 0;
471 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
473 if(is_object)
475 switch (t)
477 case 1: return D3D10_SVT_STRING;
478 case 2: return D3D10_SVT_BLEND;
479 case 3: return D3D10_SVT_DEPTHSTENCIL;
480 case 4: return D3D10_SVT_RASTERIZER;
481 case 5: return D3D10_SVT_PIXELSHADER;
482 case 6: return D3D10_SVT_VERTEXSHADER;
483 case 7: return D3D10_SVT_GEOMETRYSHADER;
485 case 10: return D3D10_SVT_TEXTURE1D;
486 case 11: return D3D10_SVT_TEXTURE1DARRAY;
487 case 12: return D3D10_SVT_TEXTURE2D;
488 case 13: return D3D10_SVT_TEXTURE2DARRAY;
489 case 14: return D3D10_SVT_TEXTURE2DMS;
490 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
491 case 16: return D3D10_SVT_TEXTURE3D;
492 case 17: return D3D10_SVT_TEXTURECUBE;
494 case 19: return D3D10_SVT_RENDERTARGETVIEW;
495 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
496 case 21: return D3D10_SVT_SAMPLER;
497 case 22: return D3D10_SVT_BUFFER;
498 default:
499 FIXME("Unknown variable type %#x.\n", t);
500 return D3D10_SVT_VOID;
503 else
505 switch (t)
507 case 1: return D3D10_SVT_FLOAT;
508 case 2: return D3D10_SVT_INT;
509 case 3: return D3D10_SVT_UINT;
510 case 4: return D3D10_SVT_BOOL;
511 default:
512 FIXME("Unknown variable type %#x.\n", t);
513 return D3D10_SVT_VOID;
518 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
520 DWORD unknown0;
521 DWORD offset;
522 DWORD typeinfo;
523 unsigned int i;
525 read_dword(&ptr, &offset);
526 TRACE("Type name at offset %#x.\n", offset);
528 if (!copy_name(data + offset, &t->name))
530 ERR("Failed to copy name.\n");
531 return E_OUTOFMEMORY;
533 TRACE("Type name: %s.\n", debugstr_a(t->name));
535 read_dword(&ptr, &unknown0);
536 TRACE("Unknown 0: %u.\n", unknown0);
538 read_dword(&ptr, &t->element_count);
539 TRACE("Element count: %u.\n", t->element_count);
541 read_dword(&ptr, &t->size_unpacked);
542 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
544 read_dword(&ptr, &t->stride);
545 TRACE("Stride: %#x.\n", t->stride);
547 read_dword(&ptr, &t->size_packed);
548 TRACE("Packed size %#x.\n", t->size_packed);
550 switch (unknown0)
552 case 1:
553 t->member_count = 0;
555 read_dword(&ptr, &typeinfo);
556 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
557 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
558 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
559 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);
561 TRACE("Type description: %#x.\n", typeinfo);
562 TRACE("\tcolumns: %u.\n", t->column_count);
563 TRACE("\trows: %u.\n", t->row_count);
564 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
565 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
566 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
567 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
568 break;
570 case 2:
571 TRACE("Type is an object.\n");
573 t->member_count = 0;
574 t->column_count = 0;
575 t->row_count = 0;
576 t->type_class = D3D10_SVC_OBJECT;
578 read_dword(&ptr, &typeinfo);
579 t->basetype = d3d10_variable_type(typeinfo, TRUE);
581 TRACE("Type description: %#x.\n", typeinfo);
582 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
583 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
584 break;
586 case 3:
587 TRACE("Type is a structure.\n");
589 read_dword(&ptr, &t->member_count);
590 TRACE("Member count: %u.\n", t->member_count);
592 t->column_count = 0;
593 t->row_count = 0;
594 t->basetype = 0;
595 t->type_class = D3D10_SVC_STRUCT;
597 t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
598 if (!t->members)
600 ERR("Failed to allocate members memory.\n");
601 return E_OUTOFMEMORY;
604 for (i = 0; i < t->member_count; ++i)
606 struct d3d10_effect_type_member *typem = &t->members[i];
608 read_dword(&ptr, &offset);
609 TRACE("Member name at offset %#x.\n", offset);
611 if (!copy_name(data + offset, &typem->name))
613 ERR("Failed to copy name.\n");
614 return E_OUTOFMEMORY;
616 TRACE("Member name: %s.\n", debugstr_a(typem->name));
618 read_dword(&ptr, &offset);
619 TRACE("Member semantic at offset %#x.\n", offset);
621 if (!copy_name(data + offset, &typem->semantic))
623 ERR("Failed to copy semantic.\n");
624 return E_OUTOFMEMORY;
626 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
628 read_dword(&ptr, &typem->buffer_offset);
629 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
631 read_dword(&ptr, &offset);
632 TRACE("Member type info at offset %#x.\n", offset);
634 typem->type = get_fx10_type(t->effect, data, offset);
635 if (!typem->type)
637 ERR("Failed to get variable type.\n");
638 return E_FAIL;
641 break;
643 default:
644 FIXME("Unhandled case %#x.\n", unknown0);
645 return E_FAIL;
648 if (t->element_count)
650 TRACE("Elementtype for type at offset: %#x\n", t->id);
652 /* allocate elementtype - we need only one, because all elements have the same type */
653 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
654 if (!t->elementtype)
656 ERR("Failed to allocate members memory.\n");
657 return E_OUTOFMEMORY;
660 /* create a copy of the original type with some minor changes */
661 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
662 t->elementtype->effect = t->effect;
664 if (!copy_name(t->name, &t->elementtype->name))
666 ERR("Failed to copy name.\n");
667 return E_OUTOFMEMORY;
669 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
671 t->elementtype->element_count = 0;
672 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
675 * Not sure if this calculation is 100% correct, but a test
676 * shows that these values work.
678 t->elementtype->size_unpacked = t->size_packed / t->element_count;
679 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
681 t->elementtype->stride = t->stride;
682 TRACE("\tStride: %#x.\n", t->elementtype->stride);
684 t->elementtype->size_packed = t->size_packed / t->element_count;
685 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
687 t->elementtype->member_count = t->member_count;
688 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
690 t->elementtype->column_count = t->column_count;
691 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
693 t->elementtype->row_count = t->row_count;
694 TRACE("\tRows: %u.\n", t->elementtype->row_count);
696 t->elementtype->basetype = t->basetype;
697 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
699 t->elementtype->type_class = t->type_class;
700 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
702 t->elementtype->members = t->members;
705 return S_OK;
708 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
710 struct d3d10_effect_type *type;
711 struct wine_rb_entry *entry;
712 HRESULT hr;
714 entry = wine_rb_get(&effect->types, &offset);
715 if (entry)
717 TRACE("Returning existing type.\n");
718 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
721 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
722 if (!type)
724 ERR("Failed to allocate type memory.\n");
725 return NULL;
728 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
729 type->id = offset;
730 type->effect = effect;
731 hr = parse_fx10_type(type, data + offset, data);
732 if (FAILED(hr))
734 ERR("Failed to parse type info, hr %#x.\n", hr);
735 HeapFree(GetProcessHeap(), 0, type);
736 return NULL;
739 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
741 ERR("Failed to insert type entry.\n");
742 HeapFree(GetProcessHeap(), 0, type);
743 return NULL;
746 return type;
749 static void set_variable_vtbl(struct d3d10_effect_variable *v)
751 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
753 switch (v->type->type_class)
755 case D3D10_SVC_SCALAR:
756 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
757 break;
759 case D3D10_SVC_VECTOR:
760 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
761 break;
763 case D3D10_SVC_MATRIX_ROWS:
764 case D3D10_SVC_MATRIX_COLUMNS:
765 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
766 break;
768 case D3D10_SVC_STRUCT:
769 *vtbl = &d3d10_effect_variable_vtbl;
770 break;
772 case D3D10_SVC_OBJECT:
773 switch(v->type->basetype)
775 case D3D10_SVT_STRING:
776 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
777 break;
779 case D3D10_SVT_TEXTURE1D:
780 case D3D10_SVT_TEXTURE1DARRAY:
781 case D3D10_SVT_TEXTURE2D:
782 case D3D10_SVT_TEXTURE2DARRAY:
783 case D3D10_SVT_TEXTURE2DMS:
784 case D3D10_SVT_TEXTURE2DMSARRAY:
785 case D3D10_SVT_TEXTURE3D:
786 case D3D10_SVT_TEXTURECUBE:
787 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
788 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
789 break;
791 case D3D10_SVT_RENDERTARGETVIEW:
792 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
793 break;
795 case D3D10_SVT_DEPTHSTENCILVIEW:
796 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
797 break;
799 case D3D10_SVT_DEPTHSTENCIL:
800 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
801 break;
803 case D3D10_SVT_VERTEXSHADER:
804 case D3D10_SVT_GEOMETRYSHADER:
805 case D3D10_SVT_PIXELSHADER:
806 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
807 break;
809 case D3D10_SVT_BLEND:
810 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
811 break;
813 case D3D10_SVT_RASTERIZER:
814 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
815 break;
817 case D3D10_SVT_SAMPLER:
818 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
819 break;
821 default:
822 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
823 *vtbl = &d3d10_effect_variable_vtbl;
824 break;
826 break;
828 default:
829 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
830 *vtbl = &d3d10_effect_variable_vtbl;
831 break;
835 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
837 unsigned int i;
838 HRESULT hr;
840 if (v->type->member_count)
842 v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
843 if (!v->members)
845 ERR("Failed to allocate members memory.\n");
846 return E_OUTOFMEMORY;
849 for (i = 0; i < v->type->member_count; ++i)
851 struct d3d10_effect_variable *var = &v->members[i];
852 struct d3d10_effect_type_member *typem = &v->type->members[i];
854 var->buffer = v->buffer;
855 var->effect = v->effect;
856 var->type = typem->type;
857 set_variable_vtbl(var);
859 if (!copy_name(typem->name, &var->name))
861 ERR("Failed to copy name.\n");
862 return E_OUTOFMEMORY;
864 TRACE("Variable name: %s.\n", debugstr_a(var->name));
866 if (!copy_name(typem->semantic, &var->semantic))
868 ERR("Failed to copy name.\n");
869 return E_OUTOFMEMORY;
871 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
873 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
874 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
876 hr = copy_variableinfo_from_type(var);
877 if (FAILED(hr)) return hr;
881 if (v->type->element_count)
883 unsigned int bufferoffset = v->buffer_offset;
885 v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
886 if (!v->elements)
888 ERR("Failed to allocate elements memory.\n");
889 return E_OUTOFMEMORY;
892 for (i = 0; i < v->type->element_count; ++i)
894 struct d3d10_effect_variable *var = &v->elements[i];
896 var->buffer = v->buffer;
897 var->effect = v->effect;
898 var->type = v->type->elementtype;
899 set_variable_vtbl(var);
901 if (!copy_name(v->name, &var->name))
903 ERR("Failed to copy name.\n");
904 return E_OUTOFMEMORY;
906 TRACE("Variable name: %s.\n", debugstr_a(var->name));
908 if (!copy_name(v->semantic, &var->semantic))
910 ERR("Failed to copy name.\n");
911 return E_OUTOFMEMORY;
913 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
915 if (i != 0)
917 bufferoffset += v->type->stride;
919 var->buffer_offset = bufferoffset;
920 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
922 hr = copy_variableinfo_from_type(var);
923 if (FAILED(hr)) return hr;
927 return S_OK;
930 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
932 DWORD offset;
934 read_dword(ptr, &offset);
935 TRACE("Variable name at offset %#x.\n", offset);
937 if (!copy_name(data + offset, &v->name))
939 ERR("Failed to copy name.\n");
940 return E_OUTOFMEMORY;
942 TRACE("Variable name: %s.\n", debugstr_a(v->name));
944 read_dword(ptr, &offset);
945 TRACE("Variable type info at offset %#x.\n", offset);
947 v->type = get_fx10_type(v->effect, data, offset);
948 if (!v->type)
950 ERR("Failed to get variable type.\n");
951 return E_FAIL;
953 set_variable_vtbl(v);
955 return copy_variableinfo_from_type(v);
958 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
960 HRESULT hr;
962 hr = parse_fx10_variable_head(a, ptr, data);
963 if (FAILED(hr)) return hr;
965 skip_dword_unknown("annotation", ptr, 1);
967 /* mark the variable as annotation */
968 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
970 return S_OK;
973 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
974 enum d3d10_effect_object_type otype)
976 struct d3d10_effect_variable *v = &s->shader;
977 struct d3d10_effect_type *t = &s->type;
978 const char *shader = NULL;
980 switch (otype)
982 case D3D10_EOT_VERTEXSHADER:
983 shader = "vertexshader";
984 t->basetype = D3D10_SVT_VERTEXSHADER;
985 break;
987 case D3D10_EOT_PIXELSHADER:
988 shader = "pixelshader";
989 t->basetype = D3D10_SVT_PIXELSHADER;
990 break;
992 case D3D10_EOT_GEOMETRYSHADER:
993 shader = "geometryshader";
994 t->basetype = D3D10_SVT_GEOMETRYSHADER;
995 break;
997 default:
998 FIXME("Unhandled object type %#x.\n", otype);
999 return E_FAIL;
1002 if (!copy_name(shader, &t->name))
1004 ERR("Failed to copy name.\n");
1005 return E_OUTOFMEMORY;
1007 TRACE("Type name: %s.\n", debugstr_a(t->name));
1009 t->type_class = D3D10_SVC_OBJECT;
1011 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1013 v->type = t;
1014 v->effect = e;
1015 set_variable_vtbl(v);
1017 if (!copy_name("$Anonymous", &v->name))
1019 ERR("Failed to copy semantic.\n");
1020 return E_OUTOFMEMORY;
1022 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1024 if (!copy_name(NULL, &v->semantic))
1026 ERR("Failed to copy semantic.\n");
1027 return E_OUTOFMEMORY;
1029 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1031 return S_OK;
1034 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1036 unsigned int i;
1038 for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1040 if (property_info[i].id == id)
1041 return &property_info[i];
1044 return NULL;
1047 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1049 unsigned int i;
1051 for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1053 if (d3d10_effect_state_storage_info[i].id == id)
1054 return &d3d10_effect_state_storage_info[i];
1057 return NULL;
1060 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1062 switch (in_type)
1064 case D3D10_SVT_FLOAT:
1065 out_data[idx] = *(float *)&value;
1066 return TRUE;
1068 case D3D10_SVT_INT:
1069 out_data[idx] = (INT)value;
1070 return TRUE;
1072 default:
1073 FIXME("Unhandled in_type %#x.\n", in_type);
1074 return FALSE;
1078 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1080 switch (in_type)
1082 case D3D10_SVT_FLOAT:
1083 out_data[idx] = *(float *)&value;
1084 return TRUE;
1086 case D3D10_SVT_INT:
1087 case D3D10_SVT_UINT:
1088 case D3D10_SVT_BOOL:
1089 out_data[idx] = value;
1090 return TRUE;
1092 default:
1093 FIXME("Unhandled in_type %#x.\n", in_type);
1094 return FALSE;
1098 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1100 switch (in_type)
1102 case D3D10_SVT_INT:
1103 case D3D10_SVT_UINT:
1104 out_data[idx] = value;
1105 return TRUE;
1107 default:
1108 FIXME("Unhandled in_type %#x.\n", in_type);
1109 return FALSE;
1113 static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
1114 UINT out_base, UINT out_size, void *out_data)
1116 D3D_SHADER_VARIABLE_TYPE in_type;
1117 DWORD t, value;
1118 DWORD count, i;
1120 read_dword(&ptr, &count);
1121 if (count != out_size)
1122 return FALSE;
1124 TRACE("%u values:\n", count);
1125 for (i = 0; i < count; ++i)
1127 UINT out_idx = out_base * out_size + i;
1129 read_dword(&ptr, &t);
1130 read_dword(&ptr, &value);
1132 in_type = d3d10_variable_type(t, FALSE);
1133 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1135 switch (out_type)
1137 case D3D10_SVT_FLOAT:
1138 if (!read_float_value(value, in_type, out_data, out_idx))
1139 return FALSE;
1140 break;
1142 case D3D10_SVT_INT:
1143 case D3D10_SVT_UINT:
1144 case D3D10_SVT_BOOL:
1145 if (!read_int32_value(value, in_type, out_data, out_idx))
1146 return FALSE;
1147 break;
1149 case D3D10_SVT_UINT8:
1150 if (!read_int8_value(value, in_type, out_data, out_idx))
1151 return FALSE;
1152 break;
1154 default:
1155 FIXME("Unhandled out_type %#x.\n", out_type);
1156 return FALSE;
1160 return TRUE;
1163 static BOOL parse_fx10_state_group(const char **ptr, const char *data,
1164 D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1166 const struct d3d10_effect_state_property_info *property_info;
1167 UINT value_offset;
1168 unsigned int i;
1169 DWORD count;
1170 UINT idx;
1171 UINT id;
1173 read_dword(ptr, &count);
1174 TRACE("Property count: %#x.\n", count);
1176 for (i = 0; i < count; ++i)
1178 read_dword(ptr, &id);
1179 read_dword(ptr, &idx);
1180 skip_dword_unknown("read property", ptr, 1);
1181 read_dword(ptr, &value_offset);
1183 if (!(property_info = get_property_info(id)))
1185 FIXME("Failed to find property info for property %#x.\n", id);
1186 return FALSE;
1189 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1190 property_info->name, idx, value_offset);
1192 if (property_info->container_type != container_type)
1194 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1195 return FALSE;
1198 if (idx >= property_info->count)
1200 ERR("Invalid index %#x for property %#x.\n", idx, id);
1201 return FALSE;
1204 if (!read_value_list(data + value_offset, property_info->type, idx,
1205 property_info->size, (char *)container + property_info->offset))
1207 ERR("Failed to read values for property %#x.\n", id);
1208 return FALSE;
1212 return TRUE;
1215 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
1217 const char *data_ptr = NULL;
1218 DWORD offset;
1219 enum d3d10_effect_object_operation operation;
1220 HRESULT hr;
1221 struct d3d10_effect *effect = o->pass->technique->effect;
1222 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1224 read_dword(ptr, &o->type);
1225 TRACE("Effect object is of type %#x.\n", o->type);
1227 read_dword(ptr, &o->index);
1228 TRACE("Effect object index %#x.\n", o->index);
1230 read_dword(ptr, &operation);
1231 TRACE("Effect object operation %#x.\n", operation);
1233 read_dword(ptr, &offset);
1234 TRACE("Effect object idx is at offset %#x.\n", offset);
1236 switch(operation)
1238 case D3D10_EOO_VALUE:
1239 TRACE("Copy variable values\n");
1241 switch (o->type)
1243 case D3D10_EOT_VERTEXSHADER:
1244 TRACE("Vertex shader\n");
1245 o->data = &anonymous_vs;
1246 hr = S_OK;
1247 break;
1249 case D3D10_EOT_PIXELSHADER:
1250 TRACE("Pixel shader\n");
1251 o->data = &anonymous_ps;
1252 hr = S_OK;
1253 break;
1255 case D3D10_EOT_GEOMETRYSHADER:
1256 TRACE("Geometry shader\n");
1257 o->data = &anonymous_gs;
1258 hr = S_OK;
1259 break;
1261 case D3D10_EOT_STENCIL_REF:
1262 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1264 ERR("Failed to read stencil ref.\n");
1265 return E_FAIL;
1268 hr = S_OK;
1269 break;
1271 case D3D10_EOT_SAMPLE_MASK:
1272 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1274 FIXME("Failed to read sample mask.\n");
1275 return E_FAIL;
1278 hr = S_OK;
1279 break;
1281 case D3D10_EOT_BLEND_FACTOR:
1282 if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1284 FIXME("Failed to read blend factor.\n");
1285 return E_FAIL;
1288 hr = S_OK;
1289 break;
1291 default:
1292 FIXME("Unhandled object type %#x\n", o->type);
1293 hr = E_FAIL;
1294 break;
1296 break;
1298 case D3D10_EOO_PARSED_OBJECT:
1299 /* This is a local object, we've parsed in parse_fx10_local_object. */
1300 TRACE("Variable name %s.\n", debugstr_a(data + offset));
1302 o->data = e->lpVtbl->GetVariableByName(e, data + offset);
1303 hr = S_OK;
1304 break;
1306 case D3D10_EOO_PARSED_OBJECT_INDEX:
1307 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1308 data_ptr = data + offset;
1309 read_dword(&data_ptr, &offset);
1310 read_dword(&data_ptr, &o->index);
1311 TRACE("Variable name %s[%u].\n", debugstr_a(data + offset), o->index);
1313 o->data = e->lpVtbl->GetVariableByName(e, data + offset);
1314 hr = S_OK;
1315 break;
1317 case D3D10_EOO_ANONYMOUS_SHADER:
1318 TRACE("Anonymous shader\n");
1320 /* check anonymous_shader_current for validity */
1321 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1323 ERR("Anonymous shader count is wrong!\n");
1324 return E_FAIL;
1327 data_ptr = data + offset;
1328 read_dword(&data_ptr, &offset);
1329 TRACE("Effect object starts at offset %#x.\n", offset);
1331 data_ptr = data + offset;
1333 hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type);
1334 if (FAILED(hr)) return hr;
1336 o->data = &effect->anonymous_shaders[effect->anonymous_shader_current].shader;
1337 ++effect->anonymous_shader_current;
1339 switch (o->type)
1341 case D3D10_EOT_VERTEXSHADER:
1342 TRACE("Vertex shader\n");
1343 hr = parse_shader(o->data, data_ptr);
1344 break;
1346 case D3D10_EOT_PIXELSHADER:
1347 TRACE("Pixel shader\n");
1348 hr = parse_shader(o->data, data_ptr);
1349 break;
1351 case D3D10_EOT_GEOMETRYSHADER:
1352 TRACE("Geometry shader\n");
1353 hr = parse_shader(o->data, data_ptr);
1354 break;
1356 default:
1357 FIXME("Unhandled object type %#x\n", o->type);
1358 hr = E_FAIL;
1359 break;
1361 break;
1363 default:
1364 hr = E_FAIL;
1365 FIXME("Unhandled operation %#x.\n", operation);
1366 break;
1369 return hr;
1372 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
1374 HRESULT hr = S_OK;
1375 unsigned int i;
1376 DWORD offset;
1378 read_dword(ptr, &offset);
1379 TRACE("Pass name at offset %#x.\n", offset);
1381 if (!copy_name(data + offset, &p->name))
1383 ERR("Failed to copy name.\n");
1384 return E_OUTOFMEMORY;
1386 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1388 read_dword(ptr, &p->object_count);
1389 TRACE("Pass has %u effect objects.\n", p->object_count);
1391 read_dword(ptr, &p->annotation_count);
1392 TRACE("Pass has %u annotations.\n", p->annotation_count);
1394 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
1395 if (!p->annotations)
1397 ERR("Failed to allocate pass annotations memory.\n");
1398 return E_OUTOFMEMORY;
1401 for (i = 0; i < p->annotation_count; ++i)
1403 struct d3d10_effect_variable *a = &p->annotations[i];
1405 a->effect = p->technique->effect;
1406 a->buffer = &null_local_buffer;
1408 hr = parse_fx10_annotation(a, ptr, data);
1409 if (FAILED(hr)) return hr;
1412 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
1413 if (!p->objects)
1415 ERR("Failed to allocate effect objects memory.\n");
1416 return E_OUTOFMEMORY;
1419 for (i = 0; i < p->object_count; ++i)
1421 struct d3d10_effect_object *o = &p->objects[i];
1423 o->pass = p;
1425 hr = parse_fx10_object(o, ptr, data);
1426 if (FAILED(hr)) return hr;
1429 return hr;
1432 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
1434 unsigned int i;
1435 DWORD offset;
1436 HRESULT hr;
1438 read_dword(ptr, &offset);
1439 TRACE("Technique name at offset %#x.\n", offset);
1441 if (!copy_name(data + offset, &t->name))
1443 ERR("Failed to copy name.\n");
1444 return E_OUTOFMEMORY;
1446 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1448 read_dword(ptr, &t->pass_count);
1449 TRACE("Technique has %u passes\n", t->pass_count);
1451 read_dword(ptr, &t->annotation_count);
1452 TRACE("Technique has %u annotations.\n", t->annotation_count);
1454 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
1455 if (!t->annotations)
1457 ERR("Failed to allocate technique annotations memory.\n");
1458 return E_OUTOFMEMORY;
1461 for (i = 0; i < t->annotation_count; ++i)
1463 struct d3d10_effect_variable *a = &t->annotations[i];
1465 a->effect = t->effect;
1466 a->buffer = &null_local_buffer;
1468 hr = parse_fx10_annotation(a, ptr, data);
1469 if (FAILED(hr)) return hr;
1472 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
1473 if (!t->passes)
1475 ERR("Failed to allocate passes memory\n");
1476 return E_OUTOFMEMORY;
1479 for (i = 0; i < t->pass_count; ++i)
1481 struct d3d10_effect_pass *p = &t->passes[i];
1483 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1484 p->technique = t;
1486 hr = parse_fx10_pass(p, ptr, data);
1487 if (FAILED(hr)) return hr;
1490 return S_OK;
1493 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1495 DWORD offset;
1496 unsigned int i;
1497 HRESULT hr;
1499 hr = parse_fx10_variable_head(v, ptr, data);
1500 if (FAILED(hr)) return hr;
1502 read_dword(ptr, &offset);
1503 TRACE("Variable semantic at offset %#x.\n", offset);
1505 if (!copy_name(data + offset, &v->semantic))
1507 ERR("Failed to copy semantic.\n");
1508 return E_OUTOFMEMORY;
1510 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1512 read_dword(ptr, &v->buffer_offset);
1513 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1515 skip_dword_unknown("variable", ptr, 1);
1517 read_dword(ptr, &v->flag);
1518 TRACE("Variable flag: %#x.\n", v->flag);
1520 read_dword(ptr, &v->annotation_count);
1521 TRACE("Variable has %u annotations.\n", v->annotation_count);
1523 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1524 if (!v->annotations)
1526 ERR("Failed to allocate variable annotations memory.\n");
1527 return E_OUTOFMEMORY;
1530 for (i = 0; i < v->annotation_count; ++i)
1532 struct d3d10_effect_variable *a = &v->annotations[i];
1534 a->effect = v->effect;
1535 a->buffer = &null_local_buffer;
1537 hr = parse_fx10_annotation(a, ptr, data);
1538 if (FAILED(hr)) return hr;
1541 return S_OK;
1544 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1546 unsigned int i;
1547 HRESULT hr;
1548 DWORD offset;
1550 hr = parse_fx10_variable_head(v, ptr, data);
1551 if (FAILED(hr)) return hr;
1553 read_dword(ptr, &offset);
1554 TRACE("Variable semantic at offset %#x.\n", offset);
1556 if (!copy_name(data + offset, &v->semantic))
1558 ERR("Failed to copy semantic.\n");
1559 return E_OUTOFMEMORY;
1561 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1563 skip_dword_unknown("local variable", ptr, 1);
1565 switch (v->type->basetype)
1567 case D3D10_SVT_TEXTURE1D:
1568 case D3D10_SVT_TEXTURE1DARRAY:
1569 case D3D10_SVT_TEXTURE2D:
1570 case D3D10_SVT_TEXTURE2DARRAY:
1571 case D3D10_SVT_TEXTURE2DMS:
1572 case D3D10_SVT_TEXTURE2DMSARRAY:
1573 case D3D10_SVT_TEXTURE3D:
1574 case D3D10_SVT_TEXTURECUBE:
1575 case D3D10_SVT_RENDERTARGETVIEW:
1576 case D3D10_SVT_DEPTHSTENCILVIEW:
1577 case D3D10_SVT_BUFFER:
1578 TRACE("SVT could not have elements.\n");
1579 break;
1581 case D3D10_SVT_VERTEXSHADER:
1582 case D3D10_SVT_PIXELSHADER:
1583 case D3D10_SVT_GEOMETRYSHADER:
1584 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1585 for (i = 0; i < max(v->type->element_count, 1); ++i)
1587 DWORD shader_offset;
1588 struct d3d10_effect_variable *var;
1590 if (!v->type->element_count)
1592 var = v;
1594 else
1596 var = &v->elements[i];
1599 read_dword(ptr, &shader_offset);
1600 TRACE("Shader offset: %#x.\n", shader_offset);
1602 hr = parse_shader(var, data + shader_offset);
1603 if (FAILED(hr)) return hr;
1605 break;
1607 case D3D10_SVT_DEPTHSTENCIL:
1608 case D3D10_SVT_BLEND:
1609 case D3D10_SVT_RASTERIZER:
1610 case D3D10_SVT_SAMPLER:
1612 const struct d3d10_effect_state_storage_info *storage_info;
1613 unsigned int count = max(v->type->element_count, 1);
1614 unsigned char *desc;
1616 if (!(storage_info = get_storage_info(v->type->basetype)))
1618 FIXME("Failed to get backing store info for type %s.\n",
1619 debug_d3d10_shader_variable_type(v->type->basetype));
1620 return E_FAIL;
1623 if (!(desc = HeapAlloc(GetProcessHeap(), 0, count * storage_info->size)))
1625 ERR("Failed to allocate backing store memory.\n");
1626 return E_OUTOFMEMORY;
1629 for (i = 0; i < count; ++i)
1631 memcpy(&desc[i * storage_info->size], storage_info->default_state, storage_info->size);
1633 if (!parse_fx10_state_group(ptr, data, v->type->basetype, &desc[i * storage_info->size]))
1635 ERR("Failed to read property list.\n");
1636 HeapFree(GetProcessHeap(), 0, desc);
1637 return E_FAIL;
1641 v->data = desc;
1643 break;
1645 default:
1646 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1647 return E_FAIL;
1650 read_dword(ptr, &v->annotation_count);
1651 TRACE("Variable has %u annotations.\n", v->annotation_count);
1653 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1654 if (!v->annotations)
1656 ERR("Failed to allocate variable annotations memory.\n");
1657 return E_OUTOFMEMORY;
1660 for (i = 0; i < v->annotation_count; ++i)
1662 struct d3d10_effect_variable *a = &v->annotations[i];
1664 a->effect = v->effect;
1665 a->buffer = &null_local_buffer;
1667 hr = parse_fx10_annotation(a, ptr, data);
1668 if (FAILED(hr)) return hr;
1671 return S_OK;
1674 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1676 unsigned int i;
1677 DWORD offset;
1678 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1679 HRESULT hr;
1680 unsigned int stride = 0;
1682 /* Generate our own type, it isn't in the fx blob. */
1683 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1684 if (!l->type)
1686 ERR("Failed to allocate local buffer type memory.\n");
1687 return E_OUTOFMEMORY;
1689 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1690 l->type->type_class = D3D10_SVC_OBJECT;
1691 l->type->effect = l->effect;
1693 read_dword(ptr, &offset);
1694 TRACE("Local buffer name at offset %#x.\n", offset);
1696 if (!copy_name(data + offset, &l->name))
1698 ERR("Failed to copy name.\n");
1699 return E_OUTOFMEMORY;
1701 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1703 read_dword(ptr, &l->data_size);
1704 TRACE("Local buffer data size: %#x.\n", l->data_size);
1706 read_dword(ptr, &d3d10_cbuffer_type);
1707 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1709 switch(d3d10_cbuffer_type)
1711 case D3D10_CT_CBUFFER:
1712 l->type->basetype = D3D10_SVT_CBUFFER;
1713 if (!copy_name("cbuffer", &l->type->name))
1715 ERR("Failed to copy name.\n");
1716 return E_OUTOFMEMORY;
1718 break;
1720 case D3D10_CT_TBUFFER:
1721 l->type->basetype = D3D10_SVT_TBUFFER;
1722 if (!copy_name("tbuffer", &l->type->name))
1724 ERR("Failed to copy name.\n");
1725 return E_OUTOFMEMORY;
1727 break;
1729 default:
1730 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1731 return E_FAIL;
1734 read_dword(ptr, &l->type->member_count);
1735 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1737 skip_dword_unknown("local buffer", ptr, 1);
1739 read_dword(ptr, &l->annotation_count);
1740 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1742 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1743 if (!l->annotations)
1745 ERR("Failed to allocate local buffer annotations memory.\n");
1746 return E_OUTOFMEMORY;
1749 for (i = 0; i < l->annotation_count; ++i)
1751 struct d3d10_effect_variable *a = &l->annotations[i];
1753 a->effect = l->effect;
1754 a->buffer = &null_local_buffer;
1756 hr = parse_fx10_annotation(a, ptr, data);
1757 if (FAILED(hr)) return hr;
1760 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1761 if (!l->members)
1763 ERR("Failed to allocate members memory.\n");
1764 return E_OUTOFMEMORY;
1767 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1768 if (!l->type->members)
1770 ERR("Failed to allocate type members memory.\n");
1771 return E_OUTOFMEMORY;
1774 for (i = 0; i < l->type->member_count; ++i)
1776 struct d3d10_effect_variable *v = &l->members[i];
1777 struct d3d10_effect_type_member *typem = &l->type->members[i];
1779 v->buffer = l;
1780 v->effect = l->effect;
1782 hr = parse_fx10_variable(v, ptr, data);
1783 if (FAILED(hr)) return hr;
1786 * Copy the values from the variable type to the constant buffers type
1787 * members structure, because it is our own generated type.
1789 typem->type = v->type;
1791 if (!copy_name(v->name, &typem->name))
1793 ERR("Failed to copy name.\n");
1794 return E_OUTOFMEMORY;
1796 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1798 if (!copy_name(v->semantic, &typem->semantic))
1800 ERR("Failed to copy name.\n");
1801 return E_OUTOFMEMORY;
1803 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1805 typem->buffer_offset = v->buffer_offset;
1806 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1808 l->type->size_packed += v->type->size_packed;
1811 * For the complete constantbuffer the size_unpacked = stride,
1812 * the stride is calculated like this:
1814 * 1) if the constant buffer variables are packed with packoffset
1815 * - stride = the highest used constant
1816 * - the complete stride has to be a multiple of 0x10
1818 * 2) if the constant buffer variables are NOT packed with packoffset
1819 * - sum of unpacked size for all variables which fit in a 0x10 part
1820 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
1821 * and a new part is started
1822 * - if the variable is a struct it is always used a new part
1823 * - the complete stride has to be a multiple of 0x10
1825 * e.g.:
1826 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1827 * part 0x10 0x10 0x20 -> 0x40
1829 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1831 if ((v->type->size_unpacked + v->buffer_offset) > stride)
1833 stride = v->type->size_unpacked + v->buffer_offset;
1836 else
1838 if (v->type->type_class == D3D10_SVC_STRUCT)
1840 stride = (stride + 0xf) & ~0xf;
1843 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1845 stride = (stride + 0xf) & ~0xf;
1848 stride += v->type->size_unpacked;
1851 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1853 TRACE("Constant buffer:\n");
1854 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1855 TRACE("\tElement count: %u.\n", l->type->element_count);
1856 TRACE("\tMember count: %u.\n", l->type->member_count);
1857 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1858 TRACE("\tStride: %#x.\n", l->type->stride);
1859 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1860 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1861 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1863 return S_OK;
1866 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1868 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1869 const DWORD *id = key;
1871 return *id - t->id;
1874 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1876 TRACE("effect type member %p.\n", typem);
1878 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1879 HeapFree(GetProcessHeap(), 0, typem->semantic);
1880 HeapFree(GetProcessHeap(), 0, typem->name);
1883 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1885 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1887 TRACE("effect type %p.\n", t);
1889 if (t->elementtype)
1891 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1892 HeapFree(GetProcessHeap(), 0, t->elementtype);
1895 if (t->members)
1897 unsigned int i;
1899 for (i = 0; i < t->member_count; ++i)
1901 d3d10_effect_type_member_destroy(&t->members[i]);
1903 HeapFree(GetProcessHeap(), 0, t->members);
1906 HeapFree(GetProcessHeap(), 0, t->name);
1907 HeapFree(GetProcessHeap(), 0, t);
1910 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1912 d3d10_rb_alloc,
1913 d3d10_rb_realloc,
1914 d3d10_rb_free,
1915 d3d10_effect_type_compare,
1918 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1920 const char *ptr = data + e->index_offset;
1921 unsigned int i;
1922 HRESULT hr;
1924 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1926 ERR("Failed to initialize type rbtree.\n");
1927 return E_FAIL;
1930 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1931 if (!e->local_buffers)
1933 ERR("Failed to allocate local buffer memory.\n");
1934 return E_OUTOFMEMORY;
1937 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1938 if (!e->local_variables)
1940 ERR("Failed to allocate local variable memory.\n");
1941 return E_OUTOFMEMORY;
1944 e->anonymous_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->anonymous_shader_count * sizeof(*e->anonymous_shaders));
1945 if (!e->anonymous_shaders)
1947 ERR("Failed to allocate anonymous shaders memory\n");
1948 return E_OUTOFMEMORY;
1951 e->used_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->used_shader_count * sizeof(*e->used_shaders));
1952 if (!e->used_shaders)
1954 ERR("Failed to allocate used shaders memory\n");
1955 return E_OUTOFMEMORY;
1958 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
1959 if (!e->techniques)
1961 ERR("Failed to allocate techniques memory\n");
1962 return E_OUTOFMEMORY;
1965 for (i = 0; i < e->local_buffer_count; ++i)
1967 struct d3d10_effect_variable *l = &e->local_buffers[i];
1968 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
1969 l->effect = e;
1970 l->buffer = &null_local_buffer;
1972 hr = parse_fx10_local_buffer(l, &ptr, data);
1973 if (FAILED(hr)) return hr;
1976 for (i = 0; i < e->local_variable_count; ++i)
1978 struct d3d10_effect_variable *v = &e->local_variables[i];
1980 v->effect = e;
1981 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
1982 v->buffer = &null_local_buffer;
1984 hr = parse_fx10_local_variable(v, &ptr, data);
1985 if (FAILED(hr)) return hr;
1988 for (i = 0; i < e->technique_count; ++i)
1990 struct d3d10_effect_technique *t = &e->techniques[i];
1992 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
1993 t->effect = e;
1995 hr = parse_fx10_technique(t, &ptr, data);
1996 if (FAILED(hr)) return hr;
1999 return S_OK;
2002 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2004 const char *ptr = data;
2005 DWORD unknown;
2007 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2008 read_dword(&ptr, &e->version);
2009 TRACE("Target: %#x\n", e->version);
2011 read_dword(&ptr, &e->local_buffer_count);
2012 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2014 read_dword(&ptr, &e->variable_count);
2015 TRACE("Variable count: %u\n", e->variable_count);
2017 read_dword(&ptr, &e->local_variable_count);
2018 TRACE("Object count: %u\n", e->local_variable_count);
2020 read_dword(&ptr, &e->sharedbuffers_count);
2021 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2023 /* Number of variables in shared buffers? */
2024 read_dword(&ptr, &unknown);
2025 FIXME("Unknown 0: %u\n", unknown);
2027 read_dword(&ptr, &e->sharedobjects_count);
2028 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2030 read_dword(&ptr, &e->technique_count);
2031 TRACE("Technique count: %u\n", e->technique_count);
2033 read_dword(&ptr, &e->index_offset);
2034 TRACE("Index offset: %#x\n", e->index_offset);
2036 read_dword(&ptr, &unknown);
2037 FIXME("Unknown 1: %u\n", unknown);
2039 read_dword(&ptr, &e->texture_count);
2040 TRACE("Texture count: %u\n", e->texture_count);
2042 read_dword(&ptr, &e->dephstencilstate_count);
2043 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2045 read_dword(&ptr, &e->blendstate_count);
2046 TRACE("Blendstate count: %u\n", e->blendstate_count);
2048 read_dword(&ptr, &e->rasterizerstate_count);
2049 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2051 read_dword(&ptr, &e->samplerstate_count);
2052 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2054 read_dword(&ptr, &e->rendertargetview_count);
2055 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2057 read_dword(&ptr, &e->depthstencilview_count);
2058 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2060 read_dword(&ptr, &e->used_shader_count);
2061 TRACE("Used shader count: %u\n", e->used_shader_count);
2063 read_dword(&ptr, &e->anonymous_shader_count);
2064 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2066 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2069 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2071 struct d3d10_effect *e = ctx;
2073 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2075 TRACE("chunk size: %#x\n", data_size);
2077 switch(tag)
2079 case TAG_FX10:
2080 return parse_fx10(e, data, data_size);
2082 default:
2083 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2084 return S_OK;
2088 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2090 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2093 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2095 ID3D10Device *device = o->pass->technique->effect->device;
2096 struct d3d10_effect_variable *v = (struct d3d10_effect_variable*) o->data;
2098 TRACE("effect object %p, type %#x.\n", o, o->type);
2100 switch(o->type)
2102 case D3D10_EOT_VERTEXSHADER:
2103 ID3D10Device_VSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.vs);
2104 return S_OK;
2106 case D3D10_EOT_PIXELSHADER:
2107 ID3D10Device_PSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.ps);
2108 return S_OK;
2110 case D3D10_EOT_GEOMETRYSHADER:
2111 ID3D10Device_GSSetShader(device, ((struct d3d10_effect_shader_variable *)v->data)->shader.gs);
2112 return S_OK;
2114 default:
2115 FIXME("Unhandled effect object type %#x.\n", o->type);
2116 return E_FAIL;
2120 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2121 D3D10_SHADER_VARIABLE_TYPE type)
2123 shader_free_signature(&s->input_signature);
2124 shader_free_signature(&s->output_signature);
2126 switch (type)
2128 case D3D10_SVT_VERTEXSHADER:
2129 if (s->shader.vs)
2130 ID3D10VertexShader_Release(s->shader.vs);
2131 break;
2133 case D3D10_SVT_PIXELSHADER:
2134 if (s->shader.ps)
2135 ID3D10PixelShader_Release(s->shader.ps);
2136 break;
2138 case D3D10_SVT_GEOMETRYSHADER:
2139 if (s->shader.gs)
2140 ID3D10GeometryShader_Release(s->shader.gs);
2141 break;
2143 default:
2144 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2145 break;
2149 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2151 unsigned int i;
2153 TRACE("variable %p.\n", v);
2155 HeapFree(GetProcessHeap(), 0, v->name);
2156 HeapFree(GetProcessHeap(), 0, v->semantic);
2157 if (v->annotations)
2159 for (i = 0; i < v->annotation_count; ++i)
2161 d3d10_effect_variable_destroy(&v->annotations[i]);
2163 HeapFree(GetProcessHeap(), 0, v->annotations);
2166 if (v->members)
2168 for (i = 0; i < v->type->member_count; ++i)
2170 d3d10_effect_variable_destroy(&v->members[i]);
2172 HeapFree(GetProcessHeap(), 0, v->members);
2175 if (v->elements)
2177 for (i = 0; i < v->type->element_count; ++i)
2179 d3d10_effect_variable_destroy(&v->elements[i]);
2181 HeapFree(GetProcessHeap(), 0, v->elements);
2184 if (v->data)
2186 switch(v->type->basetype)
2188 case D3D10_SVT_VERTEXSHADER:
2189 case D3D10_SVT_PIXELSHADER:
2190 case D3D10_SVT_GEOMETRYSHADER:
2191 d3d10_effect_shader_variable_destroy(v->data, v->type->basetype);
2192 break;
2194 default:
2195 break;
2197 HeapFree(GetProcessHeap(), 0, v->data);
2201 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2203 unsigned int i;
2205 TRACE("pass %p\n", p);
2207 HeapFree(GetProcessHeap(), 0, p->name);
2208 HeapFree(GetProcessHeap(), 0, p->objects);
2210 if (p->annotations)
2212 for (i = 0; i < p->annotation_count; ++i)
2214 d3d10_effect_variable_destroy(&p->annotations[i]);
2216 HeapFree(GetProcessHeap(), 0, p->annotations);
2220 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2222 unsigned int i;
2224 TRACE("technique %p\n", t);
2226 HeapFree(GetProcessHeap(), 0, t->name);
2227 if (t->passes)
2229 for (i = 0; i < t->pass_count; ++i)
2231 d3d10_effect_pass_destroy(&t->passes[i]);
2233 HeapFree(GetProcessHeap(), 0, t->passes);
2236 if (t->annotations)
2238 for (i = 0; i < t->annotation_count; ++i)
2240 d3d10_effect_variable_destroy(&t->annotations[i]);
2242 HeapFree(GetProcessHeap(), 0, t->annotations);
2246 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2248 unsigned int i;
2250 TRACE("local buffer %p.\n", l);
2252 HeapFree(GetProcessHeap(), 0, l->name);
2253 if (l->members)
2255 for (i = 0; i < l->type->member_count; ++i)
2257 d3d10_effect_variable_destroy(&l->members[i]);
2259 HeapFree(GetProcessHeap(), 0, l->members);
2262 if (l->type->members)
2264 for (i = 0; i < l->type->member_count; ++i)
2266 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2267 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2268 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2270 HeapFree(GetProcessHeap(), 0, l->type->members);
2272 HeapFree(GetProcessHeap(), 0, l->type->name);
2273 HeapFree(GetProcessHeap(), 0, l->type);
2275 if (l->annotations)
2277 for (i = 0; i < l->annotation_count; ++i)
2279 d3d10_effect_variable_destroy(&l->annotations[i]);
2281 HeapFree(GetProcessHeap(), 0, l->annotations);
2285 /* IUnknown methods */
2287 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2289 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2292 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2294 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2296 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2297 || IsEqualGUID(riid, &IID_IUnknown))
2299 IUnknown_AddRef(iface);
2300 *object = iface;
2301 return S_OK;
2304 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2306 *object = NULL;
2307 return E_NOINTERFACE;
2310 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2312 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2313 ULONG refcount = InterlockedIncrement(&This->refcount);
2315 TRACE("%p increasing refcount to %u\n", This, refcount);
2317 return refcount;
2320 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2322 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2323 ULONG refcount = InterlockedDecrement(&This->refcount);
2325 TRACE("%p decreasing refcount to %u\n", This, refcount);
2327 if (!refcount)
2329 unsigned int i;
2331 if (This->techniques)
2333 for (i = 0; i < This->technique_count; ++i)
2335 d3d10_effect_technique_destroy(&This->techniques[i]);
2337 HeapFree(GetProcessHeap(), 0, This->techniques);
2340 if (This->local_variables)
2342 for (i = 0; i < This->local_variable_count; ++i)
2344 d3d10_effect_variable_destroy(&This->local_variables[i]);
2346 HeapFree(GetProcessHeap(), 0, This->local_variables);
2349 if (This->local_buffers)
2351 for (i = 0; i < This->local_buffer_count; ++i)
2353 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2355 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2358 if (This->anonymous_shaders)
2360 for (i = 0; i < This->anonymous_shader_count; ++i)
2362 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2363 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2365 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2368 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2370 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2372 ID3D10Device_Release(This->device);
2373 HeapFree(GetProcessHeap(), 0, This);
2376 return refcount;
2379 /* ID3D10Effect methods */
2381 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2383 FIXME("iface %p stub!\n", iface);
2385 return FALSE;
2388 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2390 FIXME("iface %p stub!\n", iface);
2392 return FALSE;
2395 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2397 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2399 TRACE("iface %p, device %p\n", iface, device);
2401 ID3D10Device_AddRef(This->device);
2402 *device = This->device;
2404 return S_OK;
2407 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2409 FIXME("iface %p, desc %p stub!\n", iface, desc);
2411 return E_NOTIMPL;
2414 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2415 UINT index)
2417 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2418 struct d3d10_effect_variable *l;
2420 TRACE("iface %p, index %u\n", iface, index);
2422 if (index >= This->local_buffer_count)
2424 WARN("Invalid index specified\n");
2425 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2428 l = &This->local_buffers[index];
2430 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2432 return (ID3D10EffectConstantBuffer *)l;
2435 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2436 LPCSTR name)
2438 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2439 unsigned int i;
2441 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2443 for (i = 0; i < This->local_buffer_count; ++i)
2445 struct d3d10_effect_variable *l = &This->local_buffers[i];
2447 if (!strcmp(l->name, name))
2449 TRACE("Returning buffer %p.\n", l);
2450 return (ID3D10EffectConstantBuffer *)l;
2454 WARN("Invalid name specified\n");
2456 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2459 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2461 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2462 unsigned int i;
2464 TRACE("iface %p, index %u\n", iface, index);
2466 for (i = 0; i < This->local_buffer_count; ++i)
2468 struct d3d10_effect_variable *l = &This->local_buffers[i];
2470 if (index < l->type->member_count)
2472 struct d3d10_effect_variable *v = &l->members[index];
2474 TRACE("Returning variable %p.\n", v);
2475 return &v->ID3D10EffectVariable_iface;
2477 index -= l->type->member_count;
2480 if (index < This->local_variable_count)
2482 struct d3d10_effect_variable *v = &This->local_variables[index];
2484 TRACE("Returning variable %p.\n", v);
2485 return &v->ID3D10EffectVariable_iface;
2488 WARN("Invalid index specified\n");
2490 return &null_variable.ID3D10EffectVariable_iface;
2493 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
2495 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2496 unsigned int i;
2498 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2500 if (!name)
2502 WARN("Invalid name specified\n");
2503 return &null_variable.ID3D10EffectVariable_iface;
2506 for (i = 0; i < This->local_buffer_count; ++i)
2508 struct d3d10_effect_variable *l = &This->local_buffers[i];
2509 unsigned int j;
2511 for (j = 0; j < l->type->member_count; ++j)
2513 struct d3d10_effect_variable *v = &l->members[j];
2515 if (!strcmp(v->name, name))
2517 TRACE("Returning variable %p.\n", v);
2518 return &v->ID3D10EffectVariable_iface;
2523 for (i = 0; i < This->local_variable_count; ++i)
2525 struct d3d10_effect_variable *v = &This->local_variables[i];
2527 if (!strcmp(v->name, name))
2529 TRACE("Returning variable %p.\n", v);
2530 return &v->ID3D10EffectVariable_iface;
2534 WARN("Invalid name specified\n");
2536 return &null_variable.ID3D10EffectVariable_iface;
2539 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2540 LPCSTR semantic)
2542 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2543 unsigned int i;
2545 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2547 if (!semantic)
2549 WARN("Invalid semantic specified\n");
2550 return &null_variable.ID3D10EffectVariable_iface;
2553 for (i = 0; i < This->local_buffer_count; ++i)
2555 struct d3d10_effect_variable *l = &This->local_buffers[i];
2556 unsigned int j;
2558 for (j = 0; j < l->type->member_count; ++j)
2560 struct d3d10_effect_variable *v = &l->members[j];
2562 if (!strcmp(v->semantic, semantic))
2564 TRACE("Returning variable %p.\n", v);
2565 return &v->ID3D10EffectVariable_iface;
2570 for (i = 0; i < This->local_variable_count; ++i)
2572 struct d3d10_effect_variable *v = &This->local_variables[i];
2574 if (!strcmp(v->semantic, semantic))
2576 TRACE("Returning variable %p.\n", v);
2577 return &v->ID3D10EffectVariable_iface;
2581 WARN("Invalid semantic specified\n");
2583 return &null_variable.ID3D10EffectVariable_iface;
2586 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2587 UINT index)
2589 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2590 struct d3d10_effect_technique *t;
2592 TRACE("iface %p, index %u\n", iface, index);
2594 if (index >= This->technique_count)
2596 WARN("Invalid index specified\n");
2597 return &null_technique.ID3D10EffectTechnique_iface;
2600 t = &This->techniques[index];
2602 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2604 return &t->ID3D10EffectTechnique_iface;
2607 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2608 LPCSTR name)
2610 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2611 unsigned int i;
2613 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2615 if (!name)
2617 WARN("Invalid name specified\n");
2618 return &null_technique.ID3D10EffectTechnique_iface;
2621 for (i = 0; i < This->technique_count; ++i)
2623 struct d3d10_effect_technique *t = &This->techniques[i];
2624 if (!strcmp(t->name, name))
2626 TRACE("Returning technique %p\n", t);
2627 return &t->ID3D10EffectTechnique_iface;
2631 WARN("Invalid name specified\n");
2633 return &null_technique.ID3D10EffectTechnique_iface;
2636 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2638 FIXME("iface %p stub!\n", iface);
2640 return E_NOTIMPL;
2643 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2645 FIXME("iface %p stub!\n", iface);
2647 return FALSE;
2650 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2652 /* IUnknown methods */
2653 d3d10_effect_QueryInterface,
2654 d3d10_effect_AddRef,
2655 d3d10_effect_Release,
2656 /* ID3D10Effect methods */
2657 d3d10_effect_IsValid,
2658 d3d10_effect_IsPool,
2659 d3d10_effect_GetDevice,
2660 d3d10_effect_GetDesc,
2661 d3d10_effect_GetConstantBufferByIndex,
2662 d3d10_effect_GetConstantBufferByName,
2663 d3d10_effect_GetVariableByIndex,
2664 d3d10_effect_GetVariableByName,
2665 d3d10_effect_GetVariableBySemantic,
2666 d3d10_effect_GetTechniqueByIndex,
2667 d3d10_effect_GetTechniqueByName,
2668 d3d10_effect_Optimize,
2669 d3d10_effect_IsOptimized,
2672 /* ID3D10EffectTechnique methods */
2674 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2676 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2679 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2681 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2683 TRACE("iface %p\n", iface);
2685 return This != &null_technique;
2688 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2689 D3D10_TECHNIQUE_DESC *desc)
2691 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2693 TRACE("iface %p, desc %p\n", iface, desc);
2695 if(This == &null_technique)
2697 WARN("Null technique specified\n");
2698 return E_FAIL;
2701 if(!desc)
2703 WARN("Invalid argument specified\n");
2704 return E_INVALIDARG;
2707 desc->Name = This->name;
2708 desc->Passes = This->pass_count;
2709 desc->Annotations = This->annotation_count;
2711 return S_OK;
2714 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2715 ID3D10EffectTechnique *iface, UINT index)
2717 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2718 struct d3d10_effect_variable *a;
2720 TRACE("iface %p, index %u\n", iface, index);
2722 if (index >= This->annotation_count)
2724 WARN("Invalid index specified\n");
2725 return &null_variable.ID3D10EffectVariable_iface;
2728 a = &This->annotations[index];
2730 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2732 return &a->ID3D10EffectVariable_iface;
2735 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2736 ID3D10EffectTechnique *iface, LPCSTR name)
2738 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2739 unsigned int i;
2741 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2743 for (i = 0; i < This->annotation_count; ++i)
2745 struct d3d10_effect_variable *a = &This->annotations[i];
2746 if (!strcmp(a->name, name))
2748 TRACE("Returning annotation %p\n", a);
2749 return &a->ID3D10EffectVariable_iface;
2753 WARN("Invalid name specified\n");
2755 return &null_variable.ID3D10EffectVariable_iface;
2758 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2759 UINT index)
2761 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2762 struct d3d10_effect_pass *p;
2764 TRACE("iface %p, index %u\n", iface, index);
2766 if (index >= This->pass_count)
2768 WARN("Invalid index specified\n");
2769 return &null_pass.ID3D10EffectPass_iface;
2772 p = &This->passes[index];
2774 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2776 return &p->ID3D10EffectPass_iface;
2779 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2780 LPCSTR name)
2782 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2783 unsigned int i;
2785 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2787 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2789 for (i = 0; i < This->pass_count; ++i)
2791 struct d3d10_effect_pass *p = &This->passes[i];
2792 if (!strcmp(p->name, name))
2794 TRACE("Returning pass %p\n", p);
2795 return &p->ID3D10EffectPass_iface;
2799 WARN("Invalid name specified\n");
2801 return &null_pass.ID3D10EffectPass_iface;
2804 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2805 D3D10_STATE_BLOCK_MASK *mask)
2807 FIXME("iface %p,mask %p stub!\n", iface, mask);
2809 return E_NOTIMPL;
2812 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2814 /* ID3D10EffectTechnique methods */
2815 d3d10_effect_technique_IsValid,
2816 d3d10_effect_technique_GetDesc,
2817 d3d10_effect_technique_GetAnnotationByIndex,
2818 d3d10_effect_technique_GetAnnotationByName,
2819 d3d10_effect_technique_GetPassByIndex,
2820 d3d10_effect_technique_GetPassByName,
2821 d3d10_effect_technique_ComputeStateBlockMask,
2824 /* ID3D10EffectPass methods */
2826 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2828 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2831 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2833 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2835 TRACE("iface %p\n", iface);
2837 return This != &null_pass;
2840 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
2841 D3D10_PASS_DESC *desc)
2843 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2844 unsigned int i;
2846 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2848 if(This == &null_pass)
2850 WARN("Null pass specified\n");
2851 return E_FAIL;
2854 if(!desc)
2856 WARN("Invalid argument specified\n");
2857 return E_INVALIDARG;
2860 memset(desc, 0, sizeof(*desc));
2861 desc->Name = This->name;
2862 for (i = 0; i < This->object_count; ++i)
2864 struct d3d10_effect_object *o = &This->objects[i];
2865 if (o->type == D3D10_EOT_VERTEXSHADER)
2867 struct d3d10_effect_variable *v = o->data;
2868 struct d3d10_effect_shader_variable *s = v->data;
2869 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
2870 desc->IAInputSignatureSize = s->input_signature.signature_size;
2871 break;
2875 desc->StencilRef = This->stencil_ref;
2876 desc->SampleMask = This->sample_mask;
2877 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
2879 return S_OK;
2882 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2883 D3D10_PASS_SHADER_DESC *desc)
2885 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2886 unsigned int i;
2888 TRACE("iface %p, desc %p\n", iface, desc);
2890 if (This == &null_pass)
2892 WARN("Null pass specified\n");
2893 return E_FAIL;
2896 if (!desc)
2898 WARN("Invalid argument specified\n");
2899 return E_INVALIDARG;
2902 for (i = 0; i < This->object_count; ++i)
2904 struct d3d10_effect_object *o = &This->objects[i];
2906 if (o->type == D3D10_EOT_VERTEXSHADER)
2908 desc->pShaderVariable = o->data;
2909 desc->ShaderIndex = o->index;
2910 return S_OK;
2914 TRACE("Returning null_shader_variable\n");
2915 desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2916 desc->ShaderIndex = 0;
2918 return S_OK;
2921 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2922 D3D10_PASS_SHADER_DESC *desc)
2924 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2925 unsigned int i;
2927 TRACE("iface %p, desc %p\n", iface, desc);
2929 if (This == &null_pass)
2931 WARN("Null pass specified\n");
2932 return E_FAIL;
2935 if (!desc)
2937 WARN("Invalid argument specified\n");
2938 return E_INVALIDARG;
2941 for (i = 0; i < This->object_count; ++i)
2943 struct d3d10_effect_object *o = &This->objects[i];
2945 if (o->type == D3D10_EOT_GEOMETRYSHADER)
2947 desc->pShaderVariable = o->data;
2948 desc->ShaderIndex = o->index;
2949 return S_OK;
2953 TRACE("Returning null_shader_variable\n");
2954 desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2955 desc->ShaderIndex = 0;
2957 return S_OK;
2960 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
2961 D3D10_PASS_SHADER_DESC *desc)
2963 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2964 unsigned int i;
2966 TRACE("iface %p, desc %p\n", iface, desc);
2968 if (This == &null_pass)
2970 WARN("Null pass specified\n");
2971 return E_FAIL;
2974 if (!desc)
2976 WARN("Invalid argument specified\n");
2977 return E_INVALIDARG;
2980 for (i = 0; i < This->object_count; ++i)
2982 struct d3d10_effect_object *o = &This->objects[i];
2984 if (o->type == D3D10_EOT_PIXELSHADER)
2986 desc->pShaderVariable = o->data;
2987 desc->ShaderIndex = o->index;
2988 return S_OK;
2992 TRACE("Returning null_shader_variable\n");
2993 desc->pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable;
2994 desc->ShaderIndex = 0;
2996 return S_OK;
2999 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3000 UINT index)
3002 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3003 struct d3d10_effect_variable *a;
3005 TRACE("iface %p, index %u\n", iface, index);
3007 if (index >= This->annotation_count)
3009 WARN("Invalid index specified\n");
3010 return &null_variable.ID3D10EffectVariable_iface;
3013 a = &This->annotations[index];
3015 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3017 return &a->ID3D10EffectVariable_iface;
3020 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3021 LPCSTR name)
3023 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3024 unsigned int i;
3026 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3028 for (i = 0; i < This->annotation_count; ++i)
3030 struct d3d10_effect_variable *a = &This->annotations[i];
3031 if (!strcmp(a->name, name))
3033 TRACE("Returning annotation %p\n", a);
3034 return &a->ID3D10EffectVariable_iface;
3038 WARN("Invalid name specified\n");
3040 return &null_variable.ID3D10EffectVariable_iface;
3043 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3045 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3046 HRESULT hr = S_OK;
3047 unsigned int i;
3049 TRACE("iface %p, flags %#x\n", iface, flags);
3051 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3053 for (i = 0; i < This->object_count; ++i)
3055 hr = d3d10_effect_object_apply(&This->objects[i]);
3056 if (FAILED(hr)) break;
3059 return hr;
3062 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3063 D3D10_STATE_BLOCK_MASK *mask)
3065 FIXME("iface %p, mask %p stub!\n", iface, mask);
3067 return E_NOTIMPL;
3070 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3072 /* ID3D10EffectPass methods */
3073 d3d10_effect_pass_IsValid,
3074 d3d10_effect_pass_GetDesc,
3075 d3d10_effect_pass_GetVertexShaderDesc,
3076 d3d10_effect_pass_GetGeometryShaderDesc,
3077 d3d10_effect_pass_GetPixelShaderDesc,
3078 d3d10_effect_pass_GetAnnotationByIndex,
3079 d3d10_effect_pass_GetAnnotationByName,
3080 d3d10_effect_pass_Apply,
3081 d3d10_effect_pass_ComputeStateBlockMask,
3084 /* ID3D10EffectVariable methods */
3086 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3088 TRACE("iface %p\n", iface);
3090 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3093 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3095 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3097 TRACE("iface %p\n", iface);
3099 return &This->type->ID3D10EffectType_iface;
3102 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3103 D3D10_EFFECT_VARIABLE_DESC *desc)
3105 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3107 TRACE("iface %p, desc %p\n", iface, desc);
3109 if (!iface->lpVtbl->IsValid(iface))
3111 WARN("Null variable specified\n");
3112 return E_FAIL;
3115 if (!desc)
3117 WARN("Invalid argument specified\n");
3118 return E_INVALIDARG;
3121 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3122 memset(desc, 0, sizeof(*desc));
3123 desc->Name = This->name;
3124 desc->Semantic = This->semantic;
3125 desc->Flags = This->flag;
3126 desc->Annotations = This->annotation_count;
3127 desc->BufferOffset = This->buffer_offset;
3129 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3131 desc->ExplicitBindPoint = This->buffer_offset;
3134 return S_OK;
3137 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3138 ID3D10EffectVariable *iface, UINT index)
3140 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3141 struct d3d10_effect_variable *a;
3143 TRACE("iface %p, index %u\n", iface, index);
3145 if (index >= This->annotation_count)
3147 WARN("Invalid index specified\n");
3148 return &null_variable.ID3D10EffectVariable_iface;
3151 a = &This->annotations[index];
3153 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3155 return &a->ID3D10EffectVariable_iface;
3158 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3159 ID3D10EffectVariable *iface, LPCSTR name)
3161 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3162 unsigned int i;
3164 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3166 for (i = 0; i < This->annotation_count; ++i)
3168 struct d3d10_effect_variable *a = &This->annotations[i];
3169 if (!strcmp(a->name, name))
3171 TRACE("Returning annotation %p\n", a);
3172 return &a->ID3D10EffectVariable_iface;
3176 WARN("Invalid name specified\n");
3178 return &null_variable.ID3D10EffectVariable_iface;
3181 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3182 ID3D10EffectVariable *iface, UINT index)
3184 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3185 struct d3d10_effect_variable *m;
3187 TRACE("iface %p, index %u\n", iface, index);
3189 if (index >= This->type->member_count)
3191 WARN("Invalid index specified\n");
3192 return &null_variable.ID3D10EffectVariable_iface;
3195 m = &This->members[index];
3197 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3199 return &m->ID3D10EffectVariable_iface;
3202 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3203 ID3D10EffectVariable *iface, LPCSTR name)
3205 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3206 unsigned int i;
3208 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3210 if (!name)
3212 WARN("Invalid name specified\n");
3213 return &null_variable.ID3D10EffectVariable_iface;
3216 for (i = 0; i < This->type->member_count; ++i)
3218 struct d3d10_effect_variable *m = &This->members[i];
3220 if (m->name)
3222 if (!strcmp(m->name, name))
3224 TRACE("Returning member %p\n", m);
3225 return &m->ID3D10EffectVariable_iface;
3230 WARN("Invalid name specified\n");
3232 return &null_variable.ID3D10EffectVariable_iface;
3235 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3236 ID3D10EffectVariable *iface, LPCSTR semantic)
3238 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3239 unsigned int i;
3241 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3243 if (!semantic)
3245 WARN("Invalid semantic specified\n");
3246 return &null_variable.ID3D10EffectVariable_iface;
3249 for (i = 0; i < This->type->member_count; ++i)
3251 struct d3d10_effect_variable *m = &This->members[i];
3253 if (m->semantic)
3255 if (!strcmp(m->semantic, semantic))
3257 TRACE("Returning member %p\n", m);
3258 return &m->ID3D10EffectVariable_iface;
3263 WARN("Invalid semantic specified\n");
3265 return &null_variable.ID3D10EffectVariable_iface;
3268 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3269 ID3D10EffectVariable *iface, UINT index)
3271 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3272 struct d3d10_effect_variable *v;
3274 TRACE("iface %p, index %u\n", iface, index);
3276 if (index >= This->type->element_count)
3278 WARN("Invalid index specified\n");
3279 return &null_variable.ID3D10EffectVariable_iface;
3282 v = &This->elements[index];
3284 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3286 return &v->ID3D10EffectVariable_iface;
3289 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3290 ID3D10EffectVariable *iface)
3292 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3294 TRACE("iface %p\n", iface);
3296 return (ID3D10EffectConstantBuffer *)This->buffer;
3299 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3300 ID3D10EffectVariable *iface)
3302 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3304 TRACE("iface %p\n", iface);
3306 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3307 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3309 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3312 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3313 ID3D10EffectVariable *iface)
3315 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3317 TRACE("iface %p\n", iface);
3319 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3320 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3322 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3325 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3326 ID3D10EffectVariable *iface)
3328 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3330 TRACE("iface %p\n", iface);
3332 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3333 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3335 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3338 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3339 ID3D10EffectVariable *iface)
3341 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3343 TRACE("iface %p\n", iface);
3345 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3346 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3348 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3351 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3352 ID3D10EffectVariable *iface)
3354 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3356 TRACE("iface %p\n", iface);
3358 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3359 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3361 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3364 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3365 ID3D10EffectVariable *iface)
3367 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3369 TRACE("iface %p\n", iface);
3371 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3372 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3374 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3377 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3378 ID3D10EffectVariable *iface)
3380 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3382 TRACE("iface %p\n", iface);
3384 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3385 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3387 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3390 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3391 ID3D10EffectVariable *iface)
3393 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3395 TRACE("iface %p\n", iface);
3397 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3398 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3400 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3403 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3404 ID3D10EffectVariable *iface)
3406 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3408 TRACE("iface %p\n", iface);
3410 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3411 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3413 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3416 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3418 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3420 TRACE("iface %p\n", iface);
3422 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3423 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3425 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3428 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3429 ID3D10EffectVariable *iface)
3431 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3433 TRACE("iface %p\n", iface);
3435 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3436 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3438 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3441 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3442 ID3D10EffectVariable *iface)
3444 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3446 TRACE("iface %p\n", iface);
3448 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3449 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3451 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3454 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3455 ID3D10EffectVariable *iface)
3457 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3459 TRACE("iface %p\n", iface);
3461 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3462 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3464 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3467 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3468 void *data, UINT offset, UINT count)
3470 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3472 return E_NOTIMPL;
3475 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3476 void *data, UINT offset, UINT count)
3478 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3480 return E_NOTIMPL;
3483 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3485 /* ID3D10EffectVariable methods */
3486 d3d10_effect_variable_IsValid,
3487 d3d10_effect_variable_GetType,
3488 d3d10_effect_variable_GetDesc,
3489 d3d10_effect_variable_GetAnnotationByIndex,
3490 d3d10_effect_variable_GetAnnotationByName,
3491 d3d10_effect_variable_GetMemberByIndex,
3492 d3d10_effect_variable_GetMemberByName,
3493 d3d10_effect_variable_GetMemberBySemantic,
3494 d3d10_effect_variable_GetElement,
3495 d3d10_effect_variable_GetParentConstantBuffer,
3496 d3d10_effect_variable_AsScalar,
3497 d3d10_effect_variable_AsVector,
3498 d3d10_effect_variable_AsMatrix,
3499 d3d10_effect_variable_AsString,
3500 d3d10_effect_variable_AsShaderResource,
3501 d3d10_effect_variable_AsRenderTargetView,
3502 d3d10_effect_variable_AsDepthStencilView,
3503 d3d10_effect_variable_AsConstantBuffer,
3504 d3d10_effect_variable_AsShader,
3505 d3d10_effect_variable_AsBlend,
3506 d3d10_effect_variable_AsDepthStencil,
3507 d3d10_effect_variable_AsRasterizer,
3508 d3d10_effect_variable_AsSampler,
3509 d3d10_effect_variable_SetRawValue,
3510 d3d10_effect_variable_GetRawValue,
3513 /* ID3D10EffectVariable methods */
3514 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3516 TRACE("iface %p\n", iface);
3518 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3521 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3523 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3526 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3527 D3D10_EFFECT_VARIABLE_DESC *desc)
3529 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3532 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3533 ID3D10EffectConstantBuffer *iface, UINT index)
3535 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3538 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3539 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3541 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3544 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3545 ID3D10EffectConstantBuffer *iface, UINT index)
3547 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3550 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3551 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3553 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3556 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3557 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
3559 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3562 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3563 ID3D10EffectConstantBuffer *iface, UINT index)
3565 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3568 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3569 ID3D10EffectConstantBuffer *iface)
3571 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3574 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3575 ID3D10EffectConstantBuffer *iface)
3577 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3580 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3581 ID3D10EffectConstantBuffer *iface)
3583 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3586 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3587 ID3D10EffectConstantBuffer *iface)
3589 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3592 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3593 ID3D10EffectConstantBuffer *iface)
3595 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3598 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3599 ID3D10EffectConstantBuffer *iface)
3601 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3604 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3605 ID3D10EffectConstantBuffer *iface)
3607 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3610 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3611 ID3D10EffectConstantBuffer *iface)
3613 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3616 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3617 ID3D10EffectConstantBuffer *iface)
3619 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3622 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3623 ID3D10EffectConstantBuffer *iface)
3625 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3628 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3630 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3633 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3634 ID3D10EffectConstantBuffer *iface)
3636 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3639 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3640 ID3D10EffectConstantBuffer *iface)
3642 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3645 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3646 ID3D10EffectConstantBuffer *iface)
3648 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3651 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3652 void *data, UINT offset, UINT count)
3654 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3657 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3658 void *data, UINT offset, UINT count)
3660 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3663 /* ID3D10EffectConstantBuffer methods */
3664 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3665 ID3D10Buffer *buffer)
3667 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3669 return E_NOTIMPL;
3672 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3673 ID3D10Buffer **buffer)
3675 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3677 return E_NOTIMPL;
3680 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3681 ID3D10ShaderResourceView *view)
3683 FIXME("iface %p, view %p stub!\n", iface, view);
3685 return E_NOTIMPL;
3688 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3689 ID3D10ShaderResourceView **view)
3691 FIXME("iface %p, view %p stub!\n", iface, view);
3693 return E_NOTIMPL;
3696 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3698 /* ID3D10EffectVariable methods */
3699 d3d10_effect_constant_buffer_IsValid,
3700 d3d10_effect_constant_buffer_GetType,
3701 d3d10_effect_constant_buffer_GetDesc,
3702 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3703 d3d10_effect_constant_buffer_GetAnnotationByName,
3704 d3d10_effect_constant_buffer_GetMemberByIndex,
3705 d3d10_effect_constant_buffer_GetMemberByName,
3706 d3d10_effect_constant_buffer_GetMemberBySemantic,
3707 d3d10_effect_constant_buffer_GetElement,
3708 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3709 d3d10_effect_constant_buffer_AsScalar,
3710 d3d10_effect_constant_buffer_AsVector,
3711 d3d10_effect_constant_buffer_AsMatrix,
3712 d3d10_effect_constant_buffer_AsString,
3713 d3d10_effect_constant_buffer_AsShaderResource,
3714 d3d10_effect_constant_buffer_AsRenderTargetView,
3715 d3d10_effect_constant_buffer_AsDepthStencilView,
3716 d3d10_effect_constant_buffer_AsConstantBuffer,
3717 d3d10_effect_constant_buffer_AsShader,
3718 d3d10_effect_constant_buffer_AsBlend,
3719 d3d10_effect_constant_buffer_AsDepthStencil,
3720 d3d10_effect_constant_buffer_AsRasterizer,
3721 d3d10_effect_constant_buffer_AsSampler,
3722 d3d10_effect_constant_buffer_SetRawValue,
3723 d3d10_effect_constant_buffer_GetRawValue,
3724 /* ID3D10EffectConstantBuffer methods */
3725 d3d10_effect_constant_buffer_SetConstantBuffer,
3726 d3d10_effect_constant_buffer_GetConstantBuffer,
3727 d3d10_effect_constant_buffer_SetTextureBuffer,
3728 d3d10_effect_constant_buffer_GetTextureBuffer,
3731 /* ID3D10EffectVariable methods */
3733 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3735 TRACE("iface %p\n", iface);
3737 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3740 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3741 ID3D10EffectScalarVariable *iface)
3743 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3746 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3747 D3D10_EFFECT_VARIABLE_DESC *desc)
3749 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3752 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3753 ID3D10EffectScalarVariable *iface, UINT index)
3755 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3758 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3759 ID3D10EffectScalarVariable *iface, LPCSTR name)
3761 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3764 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3765 ID3D10EffectScalarVariable *iface, UINT index)
3767 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3770 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3771 ID3D10EffectScalarVariable *iface, LPCSTR name)
3773 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3776 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3777 ID3D10EffectScalarVariable *iface, LPCSTR semantic)
3779 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3782 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3783 ID3D10EffectScalarVariable *iface, UINT index)
3785 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3788 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3789 ID3D10EffectScalarVariable *iface)
3791 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3794 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3795 ID3D10EffectScalarVariable *iface)
3797 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3800 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3801 ID3D10EffectScalarVariable *iface)
3803 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3806 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3807 ID3D10EffectScalarVariable *iface)
3809 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3812 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3813 ID3D10EffectScalarVariable *iface)
3815 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3818 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3819 ID3D10EffectScalarVariable *iface)
3821 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3824 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3825 ID3D10EffectScalarVariable *iface)
3827 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3830 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3831 ID3D10EffectScalarVariable *iface)
3833 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3836 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3837 ID3D10EffectScalarVariable *iface)
3839 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3842 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3843 ID3D10EffectScalarVariable *iface)
3845 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3848 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3849 ID3D10EffectScalarVariable *iface)
3851 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3854 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3855 ID3D10EffectScalarVariable *iface)
3857 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3860 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3861 ID3D10EffectScalarVariable *iface)
3863 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3866 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3867 ID3D10EffectScalarVariable *iface)
3869 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3872 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3873 void *data, UINT offset, UINT count)
3875 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3878 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3879 void *data, UINT offset, UINT count)
3881 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3884 /* ID3D10EffectScalarVariable methods */
3886 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3887 float value)
3889 FIXME("iface %p, value %.8e stub!\n", iface, value);
3891 return E_NOTIMPL;
3894 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3895 float *value)
3897 FIXME("iface %p, value %p stub!\n", iface, value);
3899 return E_NOTIMPL;
3902 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3903 float *values, UINT offset, UINT count)
3905 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3907 return E_NOTIMPL;
3910 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
3911 float *values, UINT offset, UINT count)
3913 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3915 return E_NOTIMPL;
3918 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
3919 int value)
3921 FIXME("iface %p, value %d stub!\n", iface, value);
3923 return E_NOTIMPL;
3926 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3927 int *value)
3929 FIXME("iface %p, value %p stub!\n", iface, value);
3931 return E_NOTIMPL;
3934 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3935 int *values, UINT offset, UINT count)
3937 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3939 return E_NOTIMPL;
3942 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3943 int *values, UINT offset, UINT count)
3945 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3947 return E_NOTIMPL;
3950 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3951 BOOL value)
3953 FIXME("iface %p, value %d stub!\n", iface, value);
3955 return E_NOTIMPL;
3958 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3959 BOOL *value)
3961 FIXME("iface %p, value %p stub!\n", iface, value);
3963 return E_NOTIMPL;
3966 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
3967 BOOL *values, UINT offset, UINT count)
3969 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3971 return E_NOTIMPL;
3974 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
3975 BOOL *values, UINT offset, UINT count)
3977 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3979 return E_NOTIMPL;
3982 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
3984 /* ID3D10EffectVariable methods */
3985 d3d10_effect_scalar_variable_IsValid,
3986 d3d10_effect_scalar_variable_GetType,
3987 d3d10_effect_scalar_variable_GetDesc,
3988 d3d10_effect_scalar_variable_GetAnnotationByIndex,
3989 d3d10_effect_scalar_variable_GetAnnotationByName,
3990 d3d10_effect_scalar_variable_GetMemberByIndex,
3991 d3d10_effect_scalar_variable_GetMemberByName,
3992 d3d10_effect_scalar_variable_GetMemberBySemantic,
3993 d3d10_effect_scalar_variable_GetElement,
3994 d3d10_effect_scalar_variable_GetParentConstantBuffer,
3995 d3d10_effect_scalar_variable_AsScalar,
3996 d3d10_effect_scalar_variable_AsVector,
3997 d3d10_effect_scalar_variable_AsMatrix,
3998 d3d10_effect_scalar_variable_AsString,
3999 d3d10_effect_scalar_variable_AsShaderResource,
4000 d3d10_effect_scalar_variable_AsRenderTargetView,
4001 d3d10_effect_scalar_variable_AsDepthStencilView,
4002 d3d10_effect_scalar_variable_AsConstantBuffer,
4003 d3d10_effect_scalar_variable_AsShader,
4004 d3d10_effect_scalar_variable_AsBlend,
4005 d3d10_effect_scalar_variable_AsDepthStencil,
4006 d3d10_effect_scalar_variable_AsRasterizer,
4007 d3d10_effect_scalar_variable_AsSampler,
4008 d3d10_effect_scalar_variable_SetRawValue,
4009 d3d10_effect_scalar_variable_GetRawValue,
4010 /* ID3D10EffectScalarVariable methods */
4011 d3d10_effect_scalar_variable_SetFloat,
4012 d3d10_effect_scalar_variable_GetFloat,
4013 d3d10_effect_scalar_variable_SetFloatArray,
4014 d3d10_effect_scalar_variable_GetFloatArray,
4015 d3d10_effect_scalar_variable_SetInt,
4016 d3d10_effect_scalar_variable_GetInt,
4017 d3d10_effect_scalar_variable_SetIntArray,
4018 d3d10_effect_scalar_variable_GetIntArray,
4019 d3d10_effect_scalar_variable_SetBool,
4020 d3d10_effect_scalar_variable_GetBool,
4021 d3d10_effect_scalar_variable_SetBoolArray,
4022 d3d10_effect_scalar_variable_GetBoolArray,
4025 /* ID3D10EffectVariable methods */
4027 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4029 TRACE("iface %p\n", iface);
4031 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4034 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4035 ID3D10EffectVectorVariable *iface)
4037 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4040 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4041 D3D10_EFFECT_VARIABLE_DESC *desc)
4043 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4046 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4047 ID3D10EffectVectorVariable *iface, UINT index)
4049 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4052 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4053 ID3D10EffectVectorVariable *iface, LPCSTR name)
4055 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4058 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4059 ID3D10EffectVectorVariable *iface, UINT index)
4061 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4064 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4065 ID3D10EffectVectorVariable *iface, LPCSTR name)
4067 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4070 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4071 ID3D10EffectVectorVariable *iface, LPCSTR semantic)
4073 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4076 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4077 ID3D10EffectVectorVariable *iface, UINT index)
4079 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4082 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4083 ID3D10EffectVectorVariable *iface)
4085 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4088 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4089 ID3D10EffectVectorVariable *iface)
4091 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4094 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4095 ID3D10EffectVectorVariable *iface)
4097 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4100 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4101 ID3D10EffectVectorVariable *iface)
4103 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4106 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4107 ID3D10EffectVectorVariable *iface)
4109 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4112 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4113 ID3D10EffectVectorVariable *iface)
4115 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4118 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4119 ID3D10EffectVectorVariable *iface)
4121 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4124 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4125 ID3D10EffectVectorVariable *iface)
4127 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4130 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4131 ID3D10EffectVectorVariable *iface)
4133 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4136 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4137 ID3D10EffectVectorVariable *iface)
4139 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4142 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4143 ID3D10EffectVectorVariable *iface)
4145 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4148 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4149 ID3D10EffectVectorVariable *iface)
4151 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4154 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4155 ID3D10EffectVectorVariable *iface)
4157 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4160 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4161 ID3D10EffectVectorVariable *iface)
4163 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4166 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4167 void *data, UINT offset, UINT count)
4169 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4172 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4173 void *data, UINT offset, UINT count)
4175 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4178 /* ID3D10EffectVectorVariable methods */
4180 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4181 BOOL *value)
4183 FIXME("iface %p, value %p stub!\n", iface, value);
4185 return E_NOTIMPL;
4188 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4189 int *value)
4191 FIXME("iface %p, value %p stub!\n", iface, value);
4193 return E_NOTIMPL;
4196 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4197 float *value)
4199 FIXME("iface %p, value %p stub!\n", iface, value);
4201 return E_NOTIMPL;
4204 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4205 BOOL *value)
4207 FIXME("iface %p, value %p stub!\n", iface, value);
4209 return E_NOTIMPL;
4212 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4213 int *value)
4215 FIXME("iface %p, value %p stub!\n", iface, value);
4217 return E_NOTIMPL;
4220 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4221 float *value)
4223 FIXME("iface %p, value %p stub!\n", iface, value);
4225 return E_NOTIMPL;
4228 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4229 BOOL *values, UINT offset, UINT count)
4231 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4233 return E_NOTIMPL;
4236 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4237 int *values, UINT offset, UINT count)
4239 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4241 return E_NOTIMPL;
4244 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4245 float *values, UINT offset, UINT count)
4247 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4249 return E_NOTIMPL;
4252 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4253 BOOL *values, UINT offset, UINT count)
4255 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4257 return E_NOTIMPL;
4260 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4261 int *values, UINT offset, UINT count)
4263 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4265 return E_NOTIMPL;
4268 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4269 float *values, UINT offset, UINT count)
4271 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4273 return E_NOTIMPL;
4276 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4278 /* ID3D10EffectVariable methods */
4279 d3d10_effect_vector_variable_IsValid,
4280 d3d10_effect_vector_variable_GetType,
4281 d3d10_effect_vector_variable_GetDesc,
4282 d3d10_effect_vector_variable_GetAnnotationByIndex,
4283 d3d10_effect_vector_variable_GetAnnotationByName,
4284 d3d10_effect_vector_variable_GetMemberByIndex,
4285 d3d10_effect_vector_variable_GetMemberByName,
4286 d3d10_effect_vector_variable_GetMemberBySemantic,
4287 d3d10_effect_vector_variable_GetElement,
4288 d3d10_effect_vector_variable_GetParentConstantBuffer,
4289 d3d10_effect_vector_variable_AsScalar,
4290 d3d10_effect_vector_variable_AsVector,
4291 d3d10_effect_vector_variable_AsMatrix,
4292 d3d10_effect_vector_variable_AsString,
4293 d3d10_effect_vector_variable_AsShaderResource,
4294 d3d10_effect_vector_variable_AsRenderTargetView,
4295 d3d10_effect_vector_variable_AsDepthStencilView,
4296 d3d10_effect_vector_variable_AsConstantBuffer,
4297 d3d10_effect_vector_variable_AsShader,
4298 d3d10_effect_vector_variable_AsBlend,
4299 d3d10_effect_vector_variable_AsDepthStencil,
4300 d3d10_effect_vector_variable_AsRasterizer,
4301 d3d10_effect_vector_variable_AsSampler,
4302 d3d10_effect_vector_variable_SetRawValue,
4303 d3d10_effect_vector_variable_GetRawValue,
4304 /* ID3D10EffectVectorVariable methods */
4305 d3d10_effect_vector_variable_SetBoolVector,
4306 d3d10_effect_vector_variable_SetIntVector,
4307 d3d10_effect_vector_variable_SetFloatVector,
4308 d3d10_effect_vector_variable_GetBoolVector,
4309 d3d10_effect_vector_variable_GetIntVector,
4310 d3d10_effect_vector_variable_GetFloatVector,
4311 d3d10_effect_vector_variable_SetBoolVectorArray,
4312 d3d10_effect_vector_variable_SetIntVectorArray,
4313 d3d10_effect_vector_variable_SetFloatVectorArray,
4314 d3d10_effect_vector_variable_GetBoolVectorArray,
4315 d3d10_effect_vector_variable_GetIntVectorArray,
4316 d3d10_effect_vector_variable_GetFloatVectorArray,
4319 /* ID3D10EffectVariable methods */
4321 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4323 TRACE("iface %p\n", iface);
4325 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4328 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4329 ID3D10EffectMatrixVariable *iface)
4331 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4334 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4335 D3D10_EFFECT_VARIABLE_DESC *desc)
4337 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4340 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4341 ID3D10EffectMatrixVariable *iface, UINT index)
4343 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4346 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4347 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4349 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4352 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4353 ID3D10EffectMatrixVariable *iface, UINT index)
4355 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4358 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4359 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4361 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4364 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4365 ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
4367 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4370 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4371 ID3D10EffectMatrixVariable *iface, UINT index)
4373 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4376 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4377 ID3D10EffectMatrixVariable *iface)
4379 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4382 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4383 ID3D10EffectMatrixVariable *iface)
4385 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4388 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4389 ID3D10EffectMatrixVariable *iface)
4391 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4394 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4395 ID3D10EffectMatrixVariable *iface)
4397 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4400 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4401 ID3D10EffectMatrixVariable *iface)
4403 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4406 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4407 ID3D10EffectMatrixVariable *iface)
4409 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4412 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4413 ID3D10EffectMatrixVariable *iface)
4415 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4418 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4419 ID3D10EffectMatrixVariable *iface)
4421 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4424 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4425 ID3D10EffectMatrixVariable *iface)
4427 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4430 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4431 ID3D10EffectMatrixVariable *iface)
4433 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4436 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4437 ID3D10EffectMatrixVariable *iface)
4439 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4442 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4443 ID3D10EffectMatrixVariable *iface)
4445 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4448 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4449 ID3D10EffectMatrixVariable *iface)
4451 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4454 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4455 ID3D10EffectMatrixVariable *iface)
4457 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4460 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4461 void *data, UINT offset, UINT count)
4463 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4466 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4467 void *data, UINT offset, UINT count)
4469 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4472 /* ID3D10EffectMatrixVariable methods */
4474 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4475 float *data)
4477 FIXME("iface %p, data %p stub!\n", iface, data);
4479 return E_NOTIMPL;
4482 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4483 float *data)
4485 FIXME("iface %p, data %p stub!\n", iface, data);
4487 return E_NOTIMPL;
4490 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4491 float *data, UINT offset, UINT count)
4493 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4495 return E_NOTIMPL;
4498 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4499 float *data, UINT offset, UINT count)
4501 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4503 return E_NOTIMPL;
4506 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4507 float *data)
4509 FIXME("iface %p, data %p stub!\n", iface, data);
4511 return E_NOTIMPL;
4514 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4515 float *data)
4517 FIXME("iface %p, data %p stub!\n", iface, data);
4519 return E_NOTIMPL;
4522 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4523 float *data, UINT offset, UINT count)
4525 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4527 return E_NOTIMPL;
4530 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4531 float *data, UINT offset, UINT count)
4533 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4535 return E_NOTIMPL;
4539 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4541 /* ID3D10EffectVariable methods */
4542 d3d10_effect_matrix_variable_IsValid,
4543 d3d10_effect_matrix_variable_GetType,
4544 d3d10_effect_matrix_variable_GetDesc,
4545 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4546 d3d10_effect_matrix_variable_GetAnnotationByName,
4547 d3d10_effect_matrix_variable_GetMemberByIndex,
4548 d3d10_effect_matrix_variable_GetMemberByName,
4549 d3d10_effect_matrix_variable_GetMemberBySemantic,
4550 d3d10_effect_matrix_variable_GetElement,
4551 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4552 d3d10_effect_matrix_variable_AsScalar,
4553 d3d10_effect_matrix_variable_AsVector,
4554 d3d10_effect_matrix_variable_AsMatrix,
4555 d3d10_effect_matrix_variable_AsString,
4556 d3d10_effect_matrix_variable_AsShaderResource,
4557 d3d10_effect_matrix_variable_AsRenderTargetView,
4558 d3d10_effect_matrix_variable_AsDepthStencilView,
4559 d3d10_effect_matrix_variable_AsConstantBuffer,
4560 d3d10_effect_matrix_variable_AsShader,
4561 d3d10_effect_matrix_variable_AsBlend,
4562 d3d10_effect_matrix_variable_AsDepthStencil,
4563 d3d10_effect_matrix_variable_AsRasterizer,
4564 d3d10_effect_matrix_variable_AsSampler,
4565 d3d10_effect_matrix_variable_SetRawValue,
4566 d3d10_effect_matrix_variable_GetRawValue,
4567 /* ID3D10EffectMatrixVariable methods */
4568 d3d10_effect_matrix_variable_SetMatrix,
4569 d3d10_effect_matrix_variable_GetMatrix,
4570 d3d10_effect_matrix_variable_SetMatrixArray,
4571 d3d10_effect_matrix_variable_GetMatrixArray,
4572 d3d10_effect_matrix_variable_SetMatrixTranspose,
4573 d3d10_effect_matrix_variable_GetMatrixTranspose,
4574 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4575 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4578 /* ID3D10EffectVariable methods */
4580 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4582 TRACE("iface %p\n", iface);
4584 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4587 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4588 ID3D10EffectStringVariable *iface)
4590 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4593 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4594 D3D10_EFFECT_VARIABLE_DESC *desc)
4596 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4599 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4600 ID3D10EffectStringVariable *iface, UINT index)
4602 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4605 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4606 ID3D10EffectStringVariable *iface, LPCSTR name)
4608 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4611 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4612 ID3D10EffectStringVariable *iface, UINT index)
4614 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4617 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4618 ID3D10EffectStringVariable *iface, LPCSTR name)
4620 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4623 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4624 ID3D10EffectStringVariable *iface, LPCSTR semantic)
4626 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4629 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4630 ID3D10EffectStringVariable *iface, UINT index)
4632 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4635 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4636 ID3D10EffectStringVariable *iface)
4638 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4641 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4642 ID3D10EffectStringVariable *iface)
4644 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4647 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4648 ID3D10EffectStringVariable *iface)
4650 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4653 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4654 ID3D10EffectStringVariable *iface)
4656 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4659 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4660 ID3D10EffectStringVariable *iface)
4662 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4665 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4666 ID3D10EffectStringVariable *iface)
4668 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4671 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4672 ID3D10EffectStringVariable *iface)
4674 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4677 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4678 ID3D10EffectStringVariable *iface)
4680 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4683 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4684 ID3D10EffectStringVariable *iface)
4686 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4689 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4690 ID3D10EffectStringVariable *iface)
4692 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4695 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4696 ID3D10EffectStringVariable *iface)
4698 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4701 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4702 ID3D10EffectStringVariable *iface)
4704 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4707 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4708 ID3D10EffectStringVariable *iface)
4710 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4713 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4714 ID3D10EffectStringVariable *iface)
4716 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4719 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4720 void *data, UINT offset, UINT count)
4722 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4725 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4726 void *data, UINT offset, UINT count)
4728 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4731 /* ID3D10EffectStringVariable methods */
4733 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4734 LPCSTR *str)
4736 FIXME("iface %p, str %p stub!\n", iface, str);
4738 return E_NOTIMPL;
4741 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4742 LPCSTR *strs, UINT offset, UINT count)
4744 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4746 return E_NOTIMPL;
4750 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4752 /* ID3D10EffectVariable methods */
4753 d3d10_effect_string_variable_IsValid,
4754 d3d10_effect_string_variable_GetType,
4755 d3d10_effect_string_variable_GetDesc,
4756 d3d10_effect_string_variable_GetAnnotationByIndex,
4757 d3d10_effect_string_variable_GetAnnotationByName,
4758 d3d10_effect_string_variable_GetMemberByIndex,
4759 d3d10_effect_string_variable_GetMemberByName,
4760 d3d10_effect_string_variable_GetMemberBySemantic,
4761 d3d10_effect_string_variable_GetElement,
4762 d3d10_effect_string_variable_GetParentConstantBuffer,
4763 d3d10_effect_string_variable_AsScalar,
4764 d3d10_effect_string_variable_AsVector,
4765 d3d10_effect_string_variable_AsMatrix,
4766 d3d10_effect_string_variable_AsString,
4767 d3d10_effect_string_variable_AsShaderResource,
4768 d3d10_effect_string_variable_AsRenderTargetView,
4769 d3d10_effect_string_variable_AsDepthStencilView,
4770 d3d10_effect_string_variable_AsConstantBuffer,
4771 d3d10_effect_string_variable_AsShader,
4772 d3d10_effect_string_variable_AsBlend,
4773 d3d10_effect_string_variable_AsDepthStencil,
4774 d3d10_effect_string_variable_AsRasterizer,
4775 d3d10_effect_string_variable_AsSampler,
4776 d3d10_effect_string_variable_SetRawValue,
4777 d3d10_effect_string_variable_GetRawValue,
4778 /* ID3D10EffectStringVariable methods */
4779 d3d10_effect_string_variable_GetString,
4780 d3d10_effect_string_variable_GetStringArray,
4783 /* ID3D10EffectVariable methods */
4785 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4787 TRACE("iface %p\n", iface);
4789 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4792 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4793 ID3D10EffectShaderResourceVariable *iface)
4795 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4798 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4799 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4801 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4804 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4805 ID3D10EffectShaderResourceVariable *iface, UINT index)
4807 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4810 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4811 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4813 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4816 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4817 ID3D10EffectShaderResourceVariable *iface, UINT index)
4819 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4822 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4823 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4825 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4828 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4829 ID3D10EffectShaderResourceVariable *iface, LPCSTR semantic)
4831 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4834 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4835 ID3D10EffectShaderResourceVariable *iface, UINT index)
4837 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4840 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4841 ID3D10EffectShaderResourceVariable *iface)
4843 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4846 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4847 ID3D10EffectShaderResourceVariable *iface)
4849 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4852 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4853 ID3D10EffectShaderResourceVariable *iface)
4855 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4858 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4859 ID3D10EffectShaderResourceVariable *iface)
4861 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4864 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4865 ID3D10EffectShaderResourceVariable *iface)
4867 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4870 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4871 ID3D10EffectShaderResourceVariable *iface)
4873 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4876 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4877 ID3D10EffectShaderResourceVariable *iface)
4879 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4882 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4883 ID3D10EffectShaderResourceVariable *iface)
4885 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4888 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
4889 ID3D10EffectShaderResourceVariable *iface)
4891 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4894 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
4895 ID3D10EffectShaderResourceVariable *iface)
4897 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4900 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
4901 ID3D10EffectShaderResourceVariable *iface)
4903 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4906 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
4907 ID3D10EffectShaderResourceVariable *iface)
4909 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4912 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
4913 ID3D10EffectShaderResourceVariable *iface)
4915 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4918 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
4919 ID3D10EffectShaderResourceVariable *iface)
4921 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4924 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
4925 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4927 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4930 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
4931 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4933 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4936 /* ID3D10EffectShaderResourceVariable methods */
4938 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
4939 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
4941 FIXME("iface %p, resource %p stub!\n", iface, resource);
4943 return E_NOTIMPL;
4946 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
4947 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
4949 FIXME("iface %p, resource %p stub!\n", iface, resource);
4951 return E_NOTIMPL;
4954 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
4955 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
4957 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
4959 return E_NOTIMPL;
4962 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
4963 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
4965 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
4967 return E_NOTIMPL;
4971 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
4973 /* ID3D10EffectVariable methods */
4974 d3d10_effect_shader_resource_variable_IsValid,
4975 d3d10_effect_shader_resource_variable_GetType,
4976 d3d10_effect_shader_resource_variable_GetDesc,
4977 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
4978 d3d10_effect_shader_resource_variable_GetAnnotationByName,
4979 d3d10_effect_shader_resource_variable_GetMemberByIndex,
4980 d3d10_effect_shader_resource_variable_GetMemberByName,
4981 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
4982 d3d10_effect_shader_resource_variable_GetElement,
4983 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
4984 d3d10_effect_shader_resource_variable_AsScalar,
4985 d3d10_effect_shader_resource_variable_AsVector,
4986 d3d10_effect_shader_resource_variable_AsMatrix,
4987 d3d10_effect_shader_resource_variable_AsString,
4988 d3d10_effect_shader_resource_variable_AsShaderResource,
4989 d3d10_effect_shader_resource_variable_AsRenderTargetView,
4990 d3d10_effect_shader_resource_variable_AsDepthStencilView,
4991 d3d10_effect_shader_resource_variable_AsConstantBuffer,
4992 d3d10_effect_shader_resource_variable_AsShader,
4993 d3d10_effect_shader_resource_variable_AsBlend,
4994 d3d10_effect_shader_resource_variable_AsDepthStencil,
4995 d3d10_effect_shader_resource_variable_AsRasterizer,
4996 d3d10_effect_shader_resource_variable_AsSampler,
4997 d3d10_effect_shader_resource_variable_SetRawValue,
4998 d3d10_effect_shader_resource_variable_GetRawValue,
4999 /* ID3D10EffectShaderResourceVariable methods */
5000 d3d10_effect_shader_resource_variable_SetResource,
5001 d3d10_effect_shader_resource_variable_GetResource,
5002 d3d10_effect_shader_resource_variable_SetResourceArray,
5003 d3d10_effect_shader_resource_variable_GetResourceArray,
5006 /* ID3D10EffectVariable methods */
5008 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5009 ID3D10EffectRenderTargetViewVariable *iface)
5011 TRACE("iface %p\n", iface);
5013 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5016 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5017 ID3D10EffectRenderTargetViewVariable *iface)
5019 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5022 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5023 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5025 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5028 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5029 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5031 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5034 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5035 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5037 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5040 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5041 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5043 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5046 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5047 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5049 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5052 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5053 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR semantic)
5055 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5058 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5059 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5061 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5064 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5065 ID3D10EffectRenderTargetViewVariable *iface)
5067 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5070 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5071 ID3D10EffectRenderTargetViewVariable *iface)
5073 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5076 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5077 ID3D10EffectRenderTargetViewVariable *iface)
5079 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5082 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5083 ID3D10EffectRenderTargetViewVariable *iface)
5085 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5088 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5089 ID3D10EffectRenderTargetViewVariable *iface)
5091 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5094 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5095 ID3D10EffectRenderTargetViewVariable *iface)
5097 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5100 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5101 ID3D10EffectRenderTargetViewVariable *iface)
5103 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5106 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5107 ID3D10EffectRenderTargetViewVariable *iface)
5109 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5112 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5113 ID3D10EffectRenderTargetViewVariable *iface)
5115 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5118 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5119 ID3D10EffectRenderTargetViewVariable *iface)
5121 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5124 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5125 ID3D10EffectRenderTargetViewVariable *iface)
5127 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5130 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5131 ID3D10EffectRenderTargetViewVariable *iface)
5133 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5136 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5137 ID3D10EffectRenderTargetViewVariable *iface)
5139 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5142 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5143 ID3D10EffectRenderTargetViewVariable *iface)
5145 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5148 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5149 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5151 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5154 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5155 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5157 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5160 /* ID3D10EffectRenderTargetViewVariable methods */
5162 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5163 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5165 FIXME("iface %p, view %p stub!\n", iface, view);
5167 return E_NOTIMPL;
5170 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5171 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5173 FIXME("iface %p, view %p stub!\n", iface, view);
5175 return E_NOTIMPL;
5178 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5179 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5181 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5183 return E_NOTIMPL;
5186 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5187 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5189 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5191 return E_NOTIMPL;
5195 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5197 /* ID3D10EffectVariable methods */
5198 d3d10_effect_render_target_view_variable_IsValid,
5199 d3d10_effect_render_target_view_variable_GetType,
5200 d3d10_effect_render_target_view_variable_GetDesc,
5201 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5202 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5203 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5204 d3d10_effect_render_target_view_variable_GetMemberByName,
5205 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5206 d3d10_effect_render_target_view_variable_GetElement,
5207 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5208 d3d10_effect_render_target_view_variable_AsScalar,
5209 d3d10_effect_render_target_view_variable_AsVector,
5210 d3d10_effect_render_target_view_variable_AsMatrix,
5211 d3d10_effect_render_target_view_variable_AsString,
5212 d3d10_effect_render_target_view_variable_AsShaderResource,
5213 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5214 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5215 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5216 d3d10_effect_render_target_view_variable_AsShader,
5217 d3d10_effect_render_target_view_variable_AsBlend,
5218 d3d10_effect_render_target_view_variable_AsDepthStencil,
5219 d3d10_effect_render_target_view_variable_AsRasterizer,
5220 d3d10_effect_render_target_view_variable_AsSampler,
5221 d3d10_effect_render_target_view_variable_SetRawValue,
5222 d3d10_effect_render_target_view_variable_GetRawValue,
5223 /* ID3D10EffectRenderTargetViewVariable methods */
5224 d3d10_effect_render_target_view_variable_SetRenderTarget,
5225 d3d10_effect_render_target_view_variable_GetRenderTarget,
5226 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5227 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5230 /* ID3D10EffectVariable methods */
5232 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5233 ID3D10EffectDepthStencilViewVariable *iface)
5235 TRACE("iface %p\n", iface);
5237 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5240 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5241 ID3D10EffectDepthStencilViewVariable *iface)
5243 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5246 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5247 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5249 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5252 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5253 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5255 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5258 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5259 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5261 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5264 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5265 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5267 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5270 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5271 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5273 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5276 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5277 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR semantic)
5279 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5282 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5283 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5285 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5288 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5289 ID3D10EffectDepthStencilViewVariable *iface)
5291 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5294 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5295 ID3D10EffectDepthStencilViewVariable *iface)
5297 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5300 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5301 ID3D10EffectDepthStencilViewVariable *iface)
5303 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5306 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5307 ID3D10EffectDepthStencilViewVariable *iface)
5309 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5312 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5313 ID3D10EffectDepthStencilViewVariable *iface)
5315 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5318 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5319 ID3D10EffectDepthStencilViewVariable *iface)
5321 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5324 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5325 ID3D10EffectDepthStencilViewVariable *iface)
5327 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5330 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5331 ID3D10EffectDepthStencilViewVariable *iface)
5333 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5336 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5337 ID3D10EffectDepthStencilViewVariable *iface)
5339 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5342 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5343 ID3D10EffectDepthStencilViewVariable *iface)
5345 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5348 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5349 ID3D10EffectDepthStencilViewVariable *iface)
5351 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5354 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5355 ID3D10EffectDepthStencilViewVariable *iface)
5357 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5360 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5361 ID3D10EffectDepthStencilViewVariable *iface)
5363 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5366 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5367 ID3D10EffectDepthStencilViewVariable *iface)
5369 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5372 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5373 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5375 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5378 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5379 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5381 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5384 /* ID3D10EffectDepthStencilViewVariable methods */
5386 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5387 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5389 FIXME("iface %p, view %p stub!\n", iface, view);
5391 return E_NOTIMPL;
5394 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5395 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5397 FIXME("iface %p, view %p stub!\n", iface, view);
5399 return E_NOTIMPL;
5402 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5403 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5405 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5407 return E_NOTIMPL;
5410 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5411 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5413 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5415 return E_NOTIMPL;
5419 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5421 /* ID3D10EffectVariable methods */
5422 d3d10_effect_depth_stencil_view_variable_IsValid,
5423 d3d10_effect_depth_stencil_view_variable_GetType,
5424 d3d10_effect_depth_stencil_view_variable_GetDesc,
5425 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5426 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5427 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5428 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5429 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5430 d3d10_effect_depth_stencil_view_variable_GetElement,
5431 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5432 d3d10_effect_depth_stencil_view_variable_AsScalar,
5433 d3d10_effect_depth_stencil_view_variable_AsVector,
5434 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5435 d3d10_effect_depth_stencil_view_variable_AsString,
5436 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5437 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5438 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5439 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5440 d3d10_effect_depth_stencil_view_variable_AsShader,
5441 d3d10_effect_depth_stencil_view_variable_AsBlend,
5442 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5443 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5444 d3d10_effect_depth_stencil_view_variable_AsSampler,
5445 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5446 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5447 /* ID3D10EffectDepthStencilViewVariable methods */
5448 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5449 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5450 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5451 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5454 /* ID3D10EffectVariable methods */
5456 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5458 TRACE("iface %p\n", iface);
5460 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5463 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5464 ID3D10EffectShaderVariable *iface)
5466 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5469 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5470 D3D10_EFFECT_VARIABLE_DESC *desc)
5472 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5475 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5476 ID3D10EffectShaderVariable *iface, UINT index)
5478 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5481 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5482 ID3D10EffectShaderVariable *iface, LPCSTR name)
5484 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5487 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5488 ID3D10EffectShaderVariable *iface, UINT index)
5490 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5493 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5494 ID3D10EffectShaderVariable *iface, LPCSTR name)
5496 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5499 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5500 ID3D10EffectShaderVariable *iface, LPCSTR semantic)
5502 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5505 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5506 ID3D10EffectShaderVariable *iface, UINT index)
5508 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5511 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5512 ID3D10EffectShaderVariable *iface)
5514 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5517 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5518 ID3D10EffectShaderVariable *iface)
5520 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5523 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5524 ID3D10EffectShaderVariable *iface)
5526 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5529 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5530 ID3D10EffectShaderVariable *iface)
5532 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5535 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5536 ID3D10EffectShaderVariable *iface)
5538 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5541 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5542 ID3D10EffectShaderVariable *iface)
5544 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5547 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5548 ID3D10EffectShaderVariable *iface)
5550 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5553 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5554 ID3D10EffectShaderVariable *iface)
5556 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5559 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5560 ID3D10EffectShaderVariable *iface)
5562 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5565 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5566 ID3D10EffectShaderVariable *iface)
5568 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5571 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5572 ID3D10EffectShaderVariable *iface)
5574 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5577 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5578 ID3D10EffectShaderVariable *iface)
5580 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5583 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5584 ID3D10EffectShaderVariable *iface)
5586 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5589 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5590 ID3D10EffectShaderVariable *iface)
5592 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5595 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5596 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5598 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5601 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5602 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5604 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5607 /* ID3D10EffectShaderVariable methods */
5609 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5610 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5612 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5614 return E_NOTIMPL;
5617 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5618 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5620 FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5622 return E_NOTIMPL;
5625 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5626 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5628 FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5630 return E_NOTIMPL;
5633 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5634 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5636 FIXME("iface %p, index %u, shader %p stub!\n", iface, index, shader);
5638 return E_NOTIMPL;
5641 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5642 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5643 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5645 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5646 struct d3d10_effect_shader_variable *s;
5647 D3D10_SIGNATURE_PARAMETER_DESC *d;
5649 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5650 iface, shader_index, element_index, desc);
5652 if (!iface->lpVtbl->IsValid(iface))
5654 WARN("Null variable specified\n");
5655 return E_FAIL;
5658 /* Check shader_index, this crashes on W7/DX10 */
5659 if (shader_index >= This->effect->used_shader_count)
5661 WARN("This should crash on W7/DX10!\n");
5662 return E_FAIL;
5665 s = This->effect->used_shaders[shader_index]->data;
5666 if (!s->input_signature.signature)
5668 WARN("No shader signature\n");
5669 return D3DERR_INVALIDCALL;
5672 /* Check desc for NULL, this crashes on W7/DX10 */
5673 if (!desc)
5675 WARN("This should crash on W7/DX10!\n");
5676 return E_FAIL;
5679 if (element_index >= s->input_signature.element_count)
5681 WARN("Invalid element index specified\n");
5682 return E_INVALIDARG;
5685 d = &s->input_signature.elements[element_index];
5686 desc->SemanticName = d->SemanticName;
5687 desc->SemanticIndex = d->SemanticIndex;
5688 desc->SystemValueType = d->SystemValueType;
5689 desc->ComponentType = d->ComponentType;
5690 desc->Register = d->Register;
5691 desc->ReadWriteMask = d->ReadWriteMask;
5692 desc->Mask = d->Mask;
5694 return S_OK;
5697 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5698 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5699 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5701 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5702 struct d3d10_effect_shader_variable *s;
5703 D3D10_SIGNATURE_PARAMETER_DESC *d;
5705 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5706 iface, shader_index, element_index, desc);
5708 if (!iface->lpVtbl->IsValid(iface))
5710 WARN("Null variable specified\n");
5711 return E_FAIL;
5714 /* Check shader_index, this crashes on W7/DX10 */
5715 if (shader_index >= This->effect->used_shader_count)
5717 WARN("This should crash on W7/DX10!\n");
5718 return E_FAIL;
5721 s = This->effect->used_shaders[shader_index]->data;
5722 if (!s->output_signature.signature)
5724 WARN("No shader signature\n");
5725 return D3DERR_INVALIDCALL;
5728 /* Check desc for NULL, this crashes on W7/DX10 */
5729 if (!desc)
5731 WARN("This should crash on W7/DX10!\n");
5732 return E_FAIL;
5735 if (element_index >= s->output_signature.element_count)
5737 WARN("Invalid element index specified\n");
5738 return E_INVALIDARG;
5741 d = &s->output_signature.elements[element_index];
5742 desc->SemanticName = d->SemanticName;
5743 desc->SemanticIndex = d->SemanticIndex;
5744 desc->SystemValueType = d->SystemValueType;
5745 desc->ComponentType = d->ComponentType;
5746 desc->Register = d->Register;
5747 desc->ReadWriteMask = d->ReadWriteMask;
5748 desc->Mask = d->Mask;
5750 return S_OK;
5754 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5756 /* ID3D10EffectVariable methods */
5757 d3d10_effect_shader_variable_IsValid,
5758 d3d10_effect_shader_variable_GetType,
5759 d3d10_effect_shader_variable_GetDesc,
5760 d3d10_effect_shader_variable_GetAnnotationByIndex,
5761 d3d10_effect_shader_variable_GetAnnotationByName,
5762 d3d10_effect_shader_variable_GetMemberByIndex,
5763 d3d10_effect_shader_variable_GetMemberByName,
5764 d3d10_effect_shader_variable_GetMemberBySemantic,
5765 d3d10_effect_shader_variable_GetElement,
5766 d3d10_effect_shader_variable_GetParentConstantBuffer,
5767 d3d10_effect_shader_variable_AsScalar,
5768 d3d10_effect_shader_variable_AsVector,
5769 d3d10_effect_shader_variable_AsMatrix,
5770 d3d10_effect_shader_variable_AsString,
5771 d3d10_effect_shader_variable_AsShaderResource,
5772 d3d10_effect_shader_variable_AsRenderTargetView,
5773 d3d10_effect_shader_variable_AsDepthStencilView,
5774 d3d10_effect_shader_variable_AsConstantBuffer,
5775 d3d10_effect_shader_variable_AsShader,
5776 d3d10_effect_shader_variable_AsBlend,
5777 d3d10_effect_shader_variable_AsDepthStencil,
5778 d3d10_effect_shader_variable_AsRasterizer,
5779 d3d10_effect_shader_variable_AsSampler,
5780 d3d10_effect_shader_variable_SetRawValue,
5781 d3d10_effect_shader_variable_GetRawValue,
5782 /* ID3D10EffectShaderVariable methods */
5783 d3d10_effect_shader_variable_GetShaderDesc,
5784 d3d10_effect_shader_variable_GetVertexShader,
5785 d3d10_effect_shader_variable_GetGeometryShader,
5786 d3d10_effect_shader_variable_GetPixelShader,
5787 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5788 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5791 /* ID3D10EffectVariable methods */
5793 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5795 TRACE("iface %p\n", iface);
5797 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5800 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5801 ID3D10EffectBlendVariable *iface)
5803 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5806 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5807 D3D10_EFFECT_VARIABLE_DESC *desc)
5809 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5812 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5813 ID3D10EffectBlendVariable *iface, UINT index)
5815 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5818 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5819 ID3D10EffectBlendVariable *iface, LPCSTR name)
5821 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5824 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5825 ID3D10EffectBlendVariable *iface, UINT index)
5827 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5830 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5831 ID3D10EffectBlendVariable *iface, LPCSTR name)
5833 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5836 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5837 ID3D10EffectBlendVariable *iface, LPCSTR semantic)
5839 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5842 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5843 ID3D10EffectBlendVariable *iface, UINT index)
5845 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5848 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
5849 ID3D10EffectBlendVariable *iface)
5851 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5854 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
5855 ID3D10EffectBlendVariable *iface)
5857 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5860 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
5861 ID3D10EffectBlendVariable *iface)
5863 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5866 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
5867 ID3D10EffectBlendVariable *iface)
5869 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5872 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
5873 ID3D10EffectBlendVariable *iface)
5875 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5878 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
5879 ID3D10EffectBlendVariable *iface)
5881 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5884 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
5885 ID3D10EffectBlendVariable *iface)
5887 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5890 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
5891 ID3D10EffectBlendVariable *iface)
5893 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5896 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
5897 ID3D10EffectBlendVariable *iface)
5899 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5902 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
5903 ID3D10EffectBlendVariable *iface)
5905 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5908 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
5909 ID3D10EffectBlendVariable *iface)
5911 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5914 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
5915 ID3D10EffectBlendVariable *iface)
5917 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5920 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
5921 ID3D10EffectBlendVariable *iface)
5923 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5926 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
5927 ID3D10EffectBlendVariable *iface)
5929 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5932 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
5933 void *data, UINT offset, UINT count)
5935 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5938 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
5939 void *data, UINT offset, UINT count)
5941 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5944 /* ID3D10EffectBlendVariable methods */
5946 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
5947 UINT index, ID3D10BlendState **blend_state)
5949 FIXME("iface %p, index %u, blend_state %p stub!\n", iface, index, blend_state);
5951 return E_NOTIMPL;
5954 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
5955 UINT index, D3D10_BLEND_DESC *desc)
5957 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5959 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
5961 if (index >= max(v->type->element_count, 1))
5963 WARN("Invalid index %u.\n", index);
5964 return E_FAIL;
5967 *desc = ((D3D10_BLEND_DESC *)v->data)[index];
5969 return S_OK;
5973 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
5975 /* ID3D10EffectVariable methods */
5976 d3d10_effect_blend_variable_IsValid,
5977 d3d10_effect_blend_variable_GetType,
5978 d3d10_effect_blend_variable_GetDesc,
5979 d3d10_effect_blend_variable_GetAnnotationByIndex,
5980 d3d10_effect_blend_variable_GetAnnotationByName,
5981 d3d10_effect_blend_variable_GetMemberByIndex,
5982 d3d10_effect_blend_variable_GetMemberByName,
5983 d3d10_effect_blend_variable_GetMemberBySemantic,
5984 d3d10_effect_blend_variable_GetElement,
5985 d3d10_effect_blend_variable_GetParentConstantBuffer,
5986 d3d10_effect_blend_variable_AsScalar,
5987 d3d10_effect_blend_variable_AsVector,
5988 d3d10_effect_blend_variable_AsMatrix,
5989 d3d10_effect_blend_variable_AsString,
5990 d3d10_effect_blend_variable_AsShaderResource,
5991 d3d10_effect_blend_variable_AsRenderTargetView,
5992 d3d10_effect_blend_variable_AsDepthStencilView,
5993 d3d10_effect_blend_variable_AsConstantBuffer,
5994 d3d10_effect_blend_variable_AsShader,
5995 d3d10_effect_blend_variable_AsBlend,
5996 d3d10_effect_blend_variable_AsDepthStencil,
5997 d3d10_effect_blend_variable_AsRasterizer,
5998 d3d10_effect_blend_variable_AsSampler,
5999 d3d10_effect_blend_variable_SetRawValue,
6000 d3d10_effect_blend_variable_GetRawValue,
6001 /* ID3D10EffectBlendVariable methods */
6002 d3d10_effect_blend_variable_GetBlendState,
6003 d3d10_effect_blend_variable_GetBackingStore,
6006 /* ID3D10EffectVariable methods */
6008 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6010 TRACE("iface %p\n", iface);
6012 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6015 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6016 ID3D10EffectDepthStencilVariable *iface)
6018 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6021 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6022 D3D10_EFFECT_VARIABLE_DESC *desc)
6024 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6027 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6028 ID3D10EffectDepthStencilVariable *iface, UINT index)
6030 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6033 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6034 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6036 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6039 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6040 ID3D10EffectDepthStencilVariable *iface, UINT index)
6042 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6045 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6046 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6048 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6051 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6052 ID3D10EffectDepthStencilVariable *iface, LPCSTR semantic)
6054 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6057 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6058 ID3D10EffectDepthStencilVariable *iface, UINT index)
6060 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6063 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6064 ID3D10EffectDepthStencilVariable *iface)
6066 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6069 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6070 ID3D10EffectDepthStencilVariable *iface)
6072 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6075 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6076 ID3D10EffectDepthStencilVariable *iface)
6078 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6081 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6082 ID3D10EffectDepthStencilVariable *iface)
6084 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6087 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6088 ID3D10EffectDepthStencilVariable *iface)
6090 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6093 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6094 ID3D10EffectDepthStencilVariable *iface)
6096 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6099 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6100 ID3D10EffectDepthStencilVariable *iface)
6102 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6105 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6106 ID3D10EffectDepthStencilVariable *iface)
6108 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6111 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6112 ID3D10EffectDepthStencilVariable *iface)
6114 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6117 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6118 ID3D10EffectDepthStencilVariable *iface)
6120 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6123 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6124 ID3D10EffectDepthStencilVariable *iface)
6126 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6129 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6130 ID3D10EffectDepthStencilVariable *iface)
6132 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6135 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6136 ID3D10EffectDepthStencilVariable *iface)
6138 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6141 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6142 ID3D10EffectDepthStencilVariable *iface)
6144 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6147 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6148 void *data, UINT offset, UINT count)
6150 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6153 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6154 void *data, UINT offset, UINT count)
6156 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6159 /* ID3D10EffectDepthStencilVariable methods */
6161 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6162 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6164 FIXME("iface %p, index %u, depth_stencil_state %p stub!\n", iface, index, depth_stencil_state);
6166 return E_NOTIMPL;
6169 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6170 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6172 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6174 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6176 if (index >= max(v->type->element_count, 1))
6178 WARN("Invalid index %u.\n", index);
6179 return E_FAIL;
6182 *desc = ((D3D10_DEPTH_STENCIL_DESC *)v->data)[index];
6184 return S_OK;
6188 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6190 /* ID3D10EffectVariable methods */
6191 d3d10_effect_depth_stencil_variable_IsValid,
6192 d3d10_effect_depth_stencil_variable_GetType,
6193 d3d10_effect_depth_stencil_variable_GetDesc,
6194 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6195 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6196 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6197 d3d10_effect_depth_stencil_variable_GetMemberByName,
6198 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6199 d3d10_effect_depth_stencil_variable_GetElement,
6200 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6201 d3d10_effect_depth_stencil_variable_AsScalar,
6202 d3d10_effect_depth_stencil_variable_AsVector,
6203 d3d10_effect_depth_stencil_variable_AsMatrix,
6204 d3d10_effect_depth_stencil_variable_AsString,
6205 d3d10_effect_depth_stencil_variable_AsShaderResource,
6206 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6207 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6208 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6209 d3d10_effect_depth_stencil_variable_AsShader,
6210 d3d10_effect_depth_stencil_variable_AsBlend,
6211 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6212 d3d10_effect_depth_stencil_variable_AsRasterizer,
6213 d3d10_effect_depth_stencil_variable_AsSampler,
6214 d3d10_effect_depth_stencil_variable_SetRawValue,
6215 d3d10_effect_depth_stencil_variable_GetRawValue,
6216 /* ID3D10EffectDepthStencilVariable methods */
6217 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6218 d3d10_effect_depth_stencil_variable_GetBackingStore,
6221 /* ID3D10EffectVariable methods */
6223 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6225 TRACE("iface %p\n", iface);
6227 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6230 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6231 ID3D10EffectRasterizerVariable *iface)
6233 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6236 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6237 D3D10_EFFECT_VARIABLE_DESC *desc)
6239 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6242 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6243 ID3D10EffectRasterizerVariable *iface, UINT index)
6245 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6248 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6249 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6251 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6254 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6255 ID3D10EffectRasterizerVariable *iface, UINT index)
6257 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6260 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6261 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6263 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6266 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6267 ID3D10EffectRasterizerVariable *iface, LPCSTR semantic)
6269 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6272 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6273 ID3D10EffectRasterizerVariable *iface, UINT index)
6275 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6278 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6279 ID3D10EffectRasterizerVariable *iface)
6281 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6284 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6285 ID3D10EffectRasterizerVariable *iface)
6287 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6290 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6291 ID3D10EffectRasterizerVariable *iface)
6293 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6296 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6297 ID3D10EffectRasterizerVariable *iface)
6299 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6302 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6303 ID3D10EffectRasterizerVariable *iface)
6305 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6308 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6309 ID3D10EffectRasterizerVariable *iface)
6311 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6314 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6315 ID3D10EffectRasterizerVariable *iface)
6317 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6320 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6321 ID3D10EffectRasterizerVariable *iface)
6323 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6326 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6327 ID3D10EffectRasterizerVariable *iface)
6329 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6332 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6333 ID3D10EffectRasterizerVariable *iface)
6335 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6338 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6339 ID3D10EffectRasterizerVariable *iface)
6341 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6344 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6345 ID3D10EffectRasterizerVariable *iface)
6347 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6350 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6351 ID3D10EffectRasterizerVariable *iface)
6353 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6356 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6357 ID3D10EffectRasterizerVariable *iface)
6359 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6362 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6363 void *data, UINT offset, UINT count)
6365 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6368 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6369 void *data, UINT offset, UINT count)
6371 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6374 /* ID3D10EffectRasterizerVariable methods */
6376 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6377 UINT index, ID3D10RasterizerState **rasterizer_state)
6379 FIXME("iface %p, index %u, rasterizer_state %p stub!\n", iface, index, rasterizer_state);
6381 return E_NOTIMPL;
6384 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6385 UINT index, D3D10_RASTERIZER_DESC *desc)
6387 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6389 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6391 if (index >= max(v->type->element_count, 1))
6393 WARN("Invalid index %u.\n", index);
6394 return E_FAIL;
6397 *desc = ((D3D10_RASTERIZER_DESC *)v->data)[index];
6399 return S_OK;
6403 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6405 /* ID3D10EffectVariable methods */
6406 d3d10_effect_rasterizer_variable_IsValid,
6407 d3d10_effect_rasterizer_variable_GetType,
6408 d3d10_effect_rasterizer_variable_GetDesc,
6409 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6410 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6411 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6412 d3d10_effect_rasterizer_variable_GetMemberByName,
6413 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6414 d3d10_effect_rasterizer_variable_GetElement,
6415 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6416 d3d10_effect_rasterizer_variable_AsScalar,
6417 d3d10_effect_rasterizer_variable_AsVector,
6418 d3d10_effect_rasterizer_variable_AsMatrix,
6419 d3d10_effect_rasterizer_variable_AsString,
6420 d3d10_effect_rasterizer_variable_AsShaderResource,
6421 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6422 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6423 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6424 d3d10_effect_rasterizer_variable_AsShader,
6425 d3d10_effect_rasterizer_variable_AsBlend,
6426 d3d10_effect_rasterizer_variable_AsDepthStencil,
6427 d3d10_effect_rasterizer_variable_AsRasterizer,
6428 d3d10_effect_rasterizer_variable_AsSampler,
6429 d3d10_effect_rasterizer_variable_SetRawValue,
6430 d3d10_effect_rasterizer_variable_GetRawValue,
6431 /* ID3D10EffectRasterizerVariable methods */
6432 d3d10_effect_rasterizer_variable_GetRasterizerState,
6433 d3d10_effect_rasterizer_variable_GetBackingStore,
6436 /* ID3D10EffectVariable methods */
6438 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6440 TRACE("iface %p\n", iface);
6442 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6445 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6446 ID3D10EffectSamplerVariable *iface)
6448 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6451 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6452 D3D10_EFFECT_VARIABLE_DESC *desc)
6454 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6457 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6458 ID3D10EffectSamplerVariable *iface, UINT index)
6460 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6463 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6464 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6466 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6469 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6470 ID3D10EffectSamplerVariable *iface, UINT index)
6472 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6475 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6476 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6478 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6481 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6482 ID3D10EffectSamplerVariable *iface, LPCSTR semantic)
6484 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6487 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6488 ID3D10EffectSamplerVariable *iface, UINT index)
6490 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6493 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6494 ID3D10EffectSamplerVariable *iface)
6496 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6499 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6500 ID3D10EffectSamplerVariable *iface)
6502 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6505 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6506 ID3D10EffectSamplerVariable *iface)
6508 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6511 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6512 ID3D10EffectSamplerVariable *iface)
6514 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6517 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6518 ID3D10EffectSamplerVariable *iface)
6520 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6523 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6524 ID3D10EffectSamplerVariable *iface)
6526 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6529 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6530 ID3D10EffectSamplerVariable *iface)
6532 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6535 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6536 ID3D10EffectSamplerVariable *iface)
6538 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6541 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6542 ID3D10EffectSamplerVariable *iface)
6544 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6547 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6548 ID3D10EffectSamplerVariable *iface)
6550 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6553 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6554 ID3D10EffectSamplerVariable *iface)
6556 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6559 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6560 ID3D10EffectSamplerVariable *iface)
6562 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6565 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6566 ID3D10EffectSamplerVariable *iface)
6568 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6571 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6572 ID3D10EffectSamplerVariable *iface)
6574 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6577 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6578 void *data, UINT offset, UINT count)
6580 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6583 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6584 void *data, UINT offset, UINT count)
6586 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6589 /* ID3D10EffectSamplerVariable methods */
6591 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6592 UINT index, ID3D10SamplerState **sampler)
6594 FIXME("iface %p, index %u, sampler %p stub!\n", iface, index, sampler);
6596 return E_NOTIMPL;
6599 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6600 UINT index, D3D10_SAMPLER_DESC *desc)
6602 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6604 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6606 if (index >= max(v->type->element_count, 1))
6608 WARN("Invalid index %u.\n", index);
6609 return E_FAIL;
6612 *desc = ((D3D10_SAMPLER_DESC *)v->data)[index];
6614 return S_OK;
6618 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6620 /* ID3D10EffectVariable methods */
6621 d3d10_effect_sampler_variable_IsValid,
6622 d3d10_effect_sampler_variable_GetType,
6623 d3d10_effect_sampler_variable_GetDesc,
6624 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6625 d3d10_effect_sampler_variable_GetAnnotationByName,
6626 d3d10_effect_sampler_variable_GetMemberByIndex,
6627 d3d10_effect_sampler_variable_GetMemberByName,
6628 d3d10_effect_sampler_variable_GetMemberBySemantic,
6629 d3d10_effect_sampler_variable_GetElement,
6630 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6631 d3d10_effect_sampler_variable_AsScalar,
6632 d3d10_effect_sampler_variable_AsVector,
6633 d3d10_effect_sampler_variable_AsMatrix,
6634 d3d10_effect_sampler_variable_AsString,
6635 d3d10_effect_sampler_variable_AsShaderResource,
6636 d3d10_effect_sampler_variable_AsRenderTargetView,
6637 d3d10_effect_sampler_variable_AsDepthStencilView,
6638 d3d10_effect_sampler_variable_AsConstantBuffer,
6639 d3d10_effect_sampler_variable_AsShader,
6640 d3d10_effect_sampler_variable_AsBlend,
6641 d3d10_effect_sampler_variable_AsDepthStencil,
6642 d3d10_effect_sampler_variable_AsRasterizer,
6643 d3d10_effect_sampler_variable_AsSampler,
6644 d3d10_effect_sampler_variable_SetRawValue,
6645 d3d10_effect_sampler_variable_GetRawValue,
6646 /* ID3D10EffectSamplerVariable methods */
6647 d3d10_effect_sampler_variable_GetSampler,
6648 d3d10_effect_sampler_variable_GetBackingStore,
6651 /* ID3D10EffectType methods */
6653 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6655 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6658 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6660 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6662 TRACE("iface %p\n", iface);
6664 return This != &null_type;
6667 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6669 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6671 TRACE("iface %p, desc %p\n", iface, desc);
6673 if (This == &null_type)
6675 WARN("Null type specified\n");
6676 return E_FAIL;
6679 if (!desc)
6681 WARN("Invalid argument specified\n");
6682 return E_INVALIDARG;
6685 desc->TypeName = This->name;
6686 desc->Class = This->type_class;
6687 desc->Type = This->basetype;
6688 desc->Elements = This->element_count;
6689 desc->Members = This->member_count;
6690 desc->Rows = This->row_count;
6691 desc->Columns = This->column_count;
6692 desc->PackedSize = This->size_packed;
6693 desc->UnpackedSize = This->size_unpacked;
6694 desc->Stride = This->stride;
6696 return S_OK;
6699 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6700 UINT index)
6702 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6703 struct d3d10_effect_type *t;
6705 TRACE("iface %p, index %u\n", iface, index);
6707 if (index >= This->member_count)
6709 WARN("Invalid index specified\n");
6710 return &null_type.ID3D10EffectType_iface;
6713 t = (&This->members[index])->type;
6715 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6717 return &t->ID3D10EffectType_iface;
6720 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6721 LPCSTR name)
6723 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6724 unsigned int i;
6726 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6728 if (!name)
6730 WARN("Invalid name specified\n");
6731 return &null_type.ID3D10EffectType_iface;
6734 for (i = 0; i < This->member_count; ++i)
6736 struct d3d10_effect_type_member *typem = &This->members[i];
6738 if (typem->name)
6740 if (!strcmp(typem->name, name))
6742 TRACE("Returning type %p.\n", typem->type);
6743 return &typem->type->ID3D10EffectType_iface;
6748 WARN("Invalid name specified\n");
6750 return &null_type.ID3D10EffectType_iface;
6753 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6754 LPCSTR semantic)
6756 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6757 unsigned int i;
6759 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6761 if (!semantic)
6763 WARN("Invalid semantic specified\n");
6764 return &null_type.ID3D10EffectType_iface;
6767 for (i = 0; i < This->member_count; ++i)
6769 struct d3d10_effect_type_member *typem = &This->members[i];
6771 if (typem->semantic)
6773 if (!strcmp(typem->semantic, semantic))
6775 TRACE("Returning type %p.\n", typem->type);
6776 return &typem->type->ID3D10EffectType_iface;
6781 WARN("Invalid semantic specified\n");
6783 return &null_type.ID3D10EffectType_iface;
6786 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
6788 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6789 struct d3d10_effect_type_member *typem;
6791 TRACE("iface %p, index %u\n", iface, index);
6793 if (index >= This->member_count)
6795 WARN("Invalid index specified\n");
6796 return NULL;
6799 typem = &This->members[index];
6801 TRACE("Returning name %s\n", debugstr_a(typem->name));
6803 return typem->name;
6806 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
6808 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6809 struct d3d10_effect_type_member *typem;
6811 TRACE("iface %p, index %u\n", iface, index);
6813 if (index >= This->member_count)
6815 WARN("Invalid index specified\n");
6816 return NULL;
6819 typem = &This->members[index];
6821 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
6823 return typem->semantic;
6826 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
6828 /* ID3D10EffectType */
6829 d3d10_effect_type_IsValid,
6830 d3d10_effect_type_GetDesc,
6831 d3d10_effect_type_GetMemberTypeByIndex,
6832 d3d10_effect_type_GetMemberTypeByName,
6833 d3d10_effect_type_GetMemberTypeBySemantic,
6834 d3d10_effect_type_GetMemberName,
6835 d3d10_effect_type_GetMemberSemantic,