d3d10: Validate the data size in parse_fx10() (AFL).
[wine.git] / dlls / d3d10 / effect.c
blob2eb0680e55d4569b1abb677027fe6cd8483d1bff
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, anonymous_name};
108 static struct d3d10_effect_variable anonymous_ps = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
109 &null_local_buffer, &anonymous_ps_type, anonymous_name};
110 static struct d3d10_effect_variable anonymous_gs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
111 &null_local_buffer, &anonymous_gs_type, anonymous_name};
113 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
114 const char *data, size_t data_size, DWORD offset);
116 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
118 return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
121 struct d3d10_effect_state_property_info
123 UINT id;
124 const char *name;
125 D3D_SHADER_VARIABLE_TYPE type;
126 UINT size;
127 UINT count;
128 D3D_SHADER_VARIABLE_TYPE container_type;
129 LONG offset;
132 static const struct d3d10_effect_state_property_info property_info[] =
134 {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
135 {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
136 {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
137 {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
138 {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
139 {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
140 {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
141 {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
142 {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
143 {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
144 {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
145 {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
146 {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
147 {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
148 {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
149 {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
150 {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
151 {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
152 {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
153 {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
154 {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
155 {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
156 {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
157 {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
158 {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
159 {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
160 {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
161 {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
162 {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
163 {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
164 {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
165 {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
166 {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
167 {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
168 {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
169 {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
170 {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
171 {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
172 {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
173 {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
174 {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
175 {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
176 {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
179 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
181 D3D10_FILL_SOLID,
182 D3D10_CULL_BACK,
183 FALSE,
185 0.0f,
186 0.0f,
187 TRUE,
188 FALSE,
189 FALSE,
190 FALSE,
193 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
195 TRUE,
196 D3D10_DEPTH_WRITE_MASK_ALL,
197 D3D10_COMPARISON_LESS,
198 FALSE,
199 D3D10_DEFAULT_STENCIL_READ_MASK,
200 D3D10_DEFAULT_STENCIL_WRITE_MASK,
201 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
202 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
205 static const D3D10_BLEND_DESC default_blend_desc =
207 FALSE,
208 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
209 D3D10_BLEND_SRC_ALPHA,
210 D3D10_BLEND_INV_SRC_ALPHA,
211 D3D10_BLEND_OP_ADD,
212 D3D10_BLEND_SRC_ALPHA,
213 D3D10_BLEND_INV_SRC_ALPHA,
214 D3D10_BLEND_OP_ADD,
215 {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
218 static const D3D10_SAMPLER_DESC default_sampler_desc =
220 D3D10_FILTER_MIN_MAG_MIP_POINT,
221 D3D10_TEXTURE_ADDRESS_WRAP,
222 D3D10_TEXTURE_ADDRESS_WRAP,
223 D3D10_TEXTURE_ADDRESS_WRAP,
224 0.0f,
226 D3D10_COMPARISON_NEVER,
227 {0.0f, 0.0f, 0.0f, 0.0f},
228 0.0f,
229 FLT_MAX,
232 struct d3d10_effect_state_storage_info
234 D3D_SHADER_VARIABLE_TYPE id;
235 SIZE_T size;
236 const void *default_state;
239 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
241 {D3D10_SVT_RASTERIZER, sizeof(default_rasterizer_desc), &default_rasterizer_desc },
242 {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
243 {D3D10_SVT_BLEND, sizeof(default_blend_desc), &default_blend_desc },
244 {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc },
247 static BOOL fx10_get_string(const char *data, size_t data_size, DWORD offset, const char **s, size_t *l)
249 size_t len, max_len;
251 if (offset >= data_size)
253 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
254 return FALSE;
257 max_len = data_size - offset;
258 if (!(len = strnlen(data + offset, max_len)))
260 *s = NULL;
261 *l = 0;
262 return TRUE;
265 if (len == max_len)
266 return FALSE;
268 *s = data + offset;
269 *l = ++len;
271 return TRUE;
274 static BOOL fx10_copy_string(const char *data, size_t data_size, DWORD offset, char **s)
276 const char *p;
277 size_t len;
279 if (!fx10_get_string(data, data_size, offset, &p, &len))
280 return FALSE;
282 if (!p)
284 *s = NULL;
285 return TRUE;
288 if (!(*s = HeapAlloc(GetProcessHeap(), 0, len)))
290 ERR("Failed to allocate string memory.\n");
291 return FALSE;
294 memcpy(*s, p, len);
296 return TRUE;
299 static BOOL copy_name(const char *ptr, char **name)
301 size_t name_len;
303 if (!ptr) return TRUE;
305 name_len = strlen(ptr) + 1;
306 if (name_len == 1)
308 return TRUE;
311 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
312 if (!*name)
314 ERR("Failed to allocate name memory.\n");
315 return FALSE;
318 memcpy(*name, ptr, name_len);
320 return TRUE;
323 static const char *shader_get_string(const char *data, size_t data_size, DWORD offset)
325 const char *s;
326 size_t l;
328 if (!fx10_get_string(data, data_size, offset, &s, &l))
329 return NULL;
331 return l ? s : "";
334 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
336 D3D10_SIGNATURE_PARAMETER_DESC *e;
337 const char *ptr = data;
338 unsigned int i;
339 DWORD count;
341 if (!require_space(0, 2, sizeof(DWORD), data_size))
343 WARN("Invalid data size %#x.\n", data_size);
344 return E_INVALIDARG;
347 read_dword(&ptr, &count);
348 TRACE("%u elements\n", count);
350 skip_dword_unknown("shader signature", &ptr, 1);
352 if (!require_space(ptr - data, count, 6 * sizeof(DWORD), data_size))
354 WARN("Invalid count %#x (data size %#x).\n", count, data_size);
355 return E_INVALIDARG;
358 if (!(e = d3d10_calloc(count, sizeof(*e))))
360 ERR("Failed to allocate signature memory.\n");
361 return E_OUTOFMEMORY;
364 for (i = 0; i < count; ++i)
366 UINT name_offset;
367 UINT mask;
369 read_dword(&ptr, &name_offset);
370 if (!(e[i].SemanticName = shader_get_string(data, data_size, name_offset)))
372 WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
373 HeapFree(GetProcessHeap(), 0, e);
374 return E_INVALIDARG;
376 read_dword(&ptr, &e[i].SemanticIndex);
377 read_dword(&ptr, &e[i].SystemValueType);
378 read_dword(&ptr, &e[i].ComponentType);
379 read_dword(&ptr, &e[i].Register);
380 read_dword(&ptr, &mask);
382 e[i].ReadWriteMask = mask >> 8;
383 e[i].Mask = mask & 0xff;
385 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
386 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
387 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
388 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
391 s->elements = e;
392 s->element_count = count;
394 return S_OK;
397 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
399 HeapFree(GetProcessHeap(), 0, s->signature);
400 HeapFree(GetProcessHeap(), 0, s->elements);
403 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
405 struct d3d10_effect_shader_variable *s = ctx;
406 HRESULT hr;
408 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
410 TRACE("chunk size: %#x\n", data_size);
412 switch(tag)
414 case TAG_ISGN:
415 case TAG_OSGN:
417 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
418 UINT size = 44 + data_size;
419 struct d3d10_effect_shader_signature *sig;
420 char *ptr;
422 if (tag == TAG_ISGN) sig = &s->input_signature;
423 else sig = &s->output_signature;
425 sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
426 if (!sig->signature)
428 ERR("Failed to allocate input signature data\n");
429 return E_OUTOFMEMORY;
431 sig->signature_size = size;
433 ptr = sig->signature;
435 write_dword(&ptr, TAG_DXBC);
437 /* signature(?) */
438 write_dword_unknown(&ptr, 0);
439 write_dword_unknown(&ptr, 0);
440 write_dword_unknown(&ptr, 0);
441 write_dword_unknown(&ptr, 0);
443 /* seems to be always 1 */
444 write_dword_unknown(&ptr, 1);
446 /* DXBC size */
447 write_dword(&ptr, size);
449 /* chunk count */
450 write_dword(&ptr, 1);
452 /* chunk index */
453 write_dword(&ptr, (ptr - sig->signature) + 4);
455 /* chunk */
456 write_dword(&ptr, tag);
457 write_dword(&ptr, data_size);
458 memcpy(ptr, data, data_size);
460 hr = shader_parse_signature(ptr, data_size, sig);
461 if (FAILED(hr))
463 ERR("Failed to parse shader, hr %#x\n", hr);
464 shader_free_signature(sig);
467 break;
470 default:
471 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
472 break;
475 return S_OK;
478 static HRESULT parse_shader(ID3D10EffectVariable *variable, const char *data)
480 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(variable);
481 ID3D10Device *device = v->effect->device;
482 const char *ptr = data;
483 DWORD dxbc_size;
484 HRESULT hr;
486 if (v->effect->used_shader_current >= v->effect->used_shader_count)
488 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
489 return E_FAIL;
492 v->effect->used_shaders[v->effect->used_shader_current] = v;
493 ++v->effect->used_shader_current;
495 if (!ptr) return S_OK;
497 read_dword(&ptr, &dxbc_size);
498 TRACE("dxbc size: %#x\n", dxbc_size);
500 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
501 if (!dxbc_size) return S_OK;
503 switch (v->type->basetype)
505 case D3D10_SVT_VERTEXSHADER:
506 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &v->u.shader.shader.vs);
507 if (FAILED(hr)) return hr;
508 break;
510 case D3D10_SVT_PIXELSHADER:
511 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &v->u.shader.shader.ps);
512 if (FAILED(hr)) return hr;
513 break;
515 case D3D10_SVT_GEOMETRYSHADER:
516 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &v->u.shader.shader.gs);
517 if (FAILED(hr)) return hr;
518 break;
520 default:
521 ERR("This should not happen!\n");
522 return E_FAIL;
525 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, &v->u.shader);
528 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
530 switch (c)
532 case 1: return D3D10_SVC_SCALAR;
533 case 2: return D3D10_SVC_VECTOR;
534 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
535 else return D3D10_SVC_MATRIX_ROWS;
536 default:
537 FIXME("Unknown variable class %#x.\n", c);
538 return 0;
542 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
544 if(is_object)
546 switch (t)
548 case 1: return D3D10_SVT_STRING;
549 case 2: return D3D10_SVT_BLEND;
550 case 3: return D3D10_SVT_DEPTHSTENCIL;
551 case 4: return D3D10_SVT_RASTERIZER;
552 case 5: return D3D10_SVT_PIXELSHADER;
553 case 6: return D3D10_SVT_VERTEXSHADER;
554 case 7: return D3D10_SVT_GEOMETRYSHADER;
556 case 10: return D3D10_SVT_TEXTURE1D;
557 case 11: return D3D10_SVT_TEXTURE1DARRAY;
558 case 12: return D3D10_SVT_TEXTURE2D;
559 case 13: return D3D10_SVT_TEXTURE2DARRAY;
560 case 14: return D3D10_SVT_TEXTURE2DMS;
561 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
562 case 16: return D3D10_SVT_TEXTURE3D;
563 case 17: return D3D10_SVT_TEXTURECUBE;
565 case 19: return D3D10_SVT_RENDERTARGETVIEW;
566 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
567 case 21: return D3D10_SVT_SAMPLER;
568 case 22: return D3D10_SVT_BUFFER;
569 default:
570 FIXME("Unknown variable type %#x.\n", t);
571 return D3D10_SVT_VOID;
574 else
576 switch (t)
578 case 1: return D3D10_SVT_FLOAT;
579 case 2: return D3D10_SVT_INT;
580 case 3: return D3D10_SVT_UINT;
581 case 4: return D3D10_SVT_BOOL;
582 default:
583 FIXME("Unknown variable type %#x.\n", t);
584 return D3D10_SVT_VOID;
589 static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset, struct d3d10_effect_type *t)
591 const char *ptr = data + offset;
592 DWORD unknown0;
593 DWORD typeinfo;
594 unsigned int i;
596 read_dword(&ptr, &offset);
597 TRACE("Type name at offset %#x.\n", offset);
599 if (!fx10_copy_string(data, data_size, offset, &t->name))
601 ERR("Failed to copy name.\n");
602 return E_OUTOFMEMORY;
604 TRACE("Type name: %s.\n", debugstr_a(t->name));
606 read_dword(&ptr, &unknown0);
607 TRACE("Unknown 0: %u.\n", unknown0);
609 read_dword(&ptr, &t->element_count);
610 TRACE("Element count: %u.\n", t->element_count);
612 read_dword(&ptr, &t->size_unpacked);
613 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
615 read_dword(&ptr, &t->stride);
616 TRACE("Stride: %#x.\n", t->stride);
618 read_dword(&ptr, &t->size_packed);
619 TRACE("Packed size %#x.\n", t->size_packed);
621 switch (unknown0)
623 case 1:
624 t->member_count = 0;
626 read_dword(&ptr, &typeinfo);
627 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
628 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
629 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
630 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);
632 TRACE("Type description: %#x.\n", typeinfo);
633 TRACE("\tcolumns: %u.\n", t->column_count);
634 TRACE("\trows: %u.\n", t->row_count);
635 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
636 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
637 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
638 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
639 break;
641 case 2:
642 TRACE("Type is an object.\n");
644 t->member_count = 0;
645 t->column_count = 0;
646 t->row_count = 0;
647 t->type_class = D3D10_SVC_OBJECT;
649 read_dword(&ptr, &typeinfo);
650 t->basetype = d3d10_variable_type(typeinfo, TRUE);
652 TRACE("Type description: %#x.\n", typeinfo);
653 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
654 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
655 break;
657 case 3:
658 TRACE("Type is a structure.\n");
660 read_dword(&ptr, &t->member_count);
661 TRACE("Member count: %u.\n", t->member_count);
663 t->column_count = 0;
664 t->row_count = 0;
665 t->basetype = 0;
666 t->type_class = D3D10_SVC_STRUCT;
668 if (!(t->members = d3d10_calloc(t->member_count, sizeof(*t->members))))
670 ERR("Failed to allocate members memory.\n");
671 return E_OUTOFMEMORY;
674 for (i = 0; i < t->member_count; ++i)
676 struct d3d10_effect_type_member *typem = &t->members[i];
678 read_dword(&ptr, &offset);
679 TRACE("Member name at offset %#x.\n", offset);
681 if (!fx10_copy_string(data, data_size, offset, &typem->name))
683 ERR("Failed to copy name.\n");
684 return E_OUTOFMEMORY;
686 TRACE("Member name: %s.\n", debugstr_a(typem->name));
688 read_dword(&ptr, &offset);
689 TRACE("Member semantic at offset %#x.\n", offset);
691 if (!fx10_copy_string(data, data_size, offset, &typem->semantic))
693 ERR("Failed to copy semantic.\n");
694 return E_OUTOFMEMORY;
696 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
698 read_dword(&ptr, &typem->buffer_offset);
699 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
701 read_dword(&ptr, &offset);
702 TRACE("Member type info at offset %#x.\n", offset);
704 if (!(typem->type = get_fx10_type(t->effect, data, data_size, offset)))
706 ERR("Failed to get variable type.\n");
707 return E_FAIL;
710 break;
712 default:
713 FIXME("Unhandled case %#x.\n", unknown0);
714 return E_FAIL;
717 if (t->element_count)
719 TRACE("Elementtype for type at offset: %#x\n", t->id);
721 /* allocate elementtype - we need only one, because all elements have the same type */
722 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
723 if (!t->elementtype)
725 ERR("Failed to allocate members memory.\n");
726 return E_OUTOFMEMORY;
729 /* create a copy of the original type with some minor changes */
730 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
731 t->elementtype->effect = t->effect;
733 if (!copy_name(t->name, &t->elementtype->name))
735 ERR("Failed to copy name.\n");
736 return E_OUTOFMEMORY;
738 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
740 t->elementtype->element_count = 0;
741 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
744 * Not sure if this calculation is 100% correct, but a test
745 * shows that these values work.
747 t->elementtype->size_unpacked = t->size_packed / t->element_count;
748 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
750 t->elementtype->stride = t->stride;
751 TRACE("\tStride: %#x.\n", t->elementtype->stride);
753 t->elementtype->size_packed = t->size_packed / t->element_count;
754 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
756 t->elementtype->member_count = t->member_count;
757 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
759 t->elementtype->column_count = t->column_count;
760 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
762 t->elementtype->row_count = t->row_count;
763 TRACE("\tRows: %u.\n", t->elementtype->row_count);
765 t->elementtype->basetype = t->basetype;
766 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
768 t->elementtype->type_class = t->type_class;
769 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
771 t->elementtype->members = t->members;
774 return S_OK;
777 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
778 const char *data, size_t data_size, DWORD offset)
780 struct d3d10_effect_type *type;
781 struct wine_rb_entry *entry;
782 HRESULT hr;
784 entry = wine_rb_get(&effect->types, &offset);
785 if (entry)
787 TRACE("Returning existing type.\n");
788 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
791 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
792 if (!type)
794 ERR("Failed to allocate type memory.\n");
795 return NULL;
798 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
799 type->id = offset;
800 type->effect = effect;
801 if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
803 ERR("Failed to parse type info, hr %#x.\n", hr);
804 HeapFree(GetProcessHeap(), 0, type);
805 return NULL;
808 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
810 ERR("Failed to insert type entry.\n");
811 HeapFree(GetProcessHeap(), 0, type);
812 return NULL;
815 return type;
818 static void set_variable_vtbl(struct d3d10_effect_variable *v)
820 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
822 switch (v->type->type_class)
824 case D3D10_SVC_SCALAR:
825 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
826 break;
828 case D3D10_SVC_VECTOR:
829 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
830 break;
832 case D3D10_SVC_MATRIX_ROWS:
833 case D3D10_SVC_MATRIX_COLUMNS:
834 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
835 break;
837 case D3D10_SVC_STRUCT:
838 *vtbl = &d3d10_effect_variable_vtbl;
839 break;
841 case D3D10_SVC_OBJECT:
842 switch(v->type->basetype)
844 case D3D10_SVT_STRING:
845 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
846 break;
848 case D3D10_SVT_TEXTURE1D:
849 case D3D10_SVT_TEXTURE1DARRAY:
850 case D3D10_SVT_TEXTURE2D:
851 case D3D10_SVT_TEXTURE2DARRAY:
852 case D3D10_SVT_TEXTURE2DMS:
853 case D3D10_SVT_TEXTURE2DMSARRAY:
854 case D3D10_SVT_TEXTURE3D:
855 case D3D10_SVT_TEXTURECUBE:
856 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
857 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
858 break;
860 case D3D10_SVT_RENDERTARGETVIEW:
861 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
862 break;
864 case D3D10_SVT_DEPTHSTENCILVIEW:
865 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
866 break;
868 case D3D10_SVT_DEPTHSTENCIL:
869 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
870 break;
872 case D3D10_SVT_VERTEXSHADER:
873 case D3D10_SVT_GEOMETRYSHADER:
874 case D3D10_SVT_PIXELSHADER:
875 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
876 break;
878 case D3D10_SVT_BLEND:
879 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
880 break;
882 case D3D10_SVT_RASTERIZER:
883 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
884 break;
886 case D3D10_SVT_SAMPLER:
887 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
888 break;
890 default:
891 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
892 *vtbl = &d3d10_effect_variable_vtbl;
893 break;
895 break;
897 default:
898 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
899 *vtbl = &d3d10_effect_variable_vtbl;
900 break;
904 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
906 unsigned int i;
907 HRESULT hr;
909 if (v->type->member_count)
911 if (!(v->members = d3d10_calloc(v->type->member_count, sizeof(*v->members))))
913 ERR("Failed to allocate members memory.\n");
914 return E_OUTOFMEMORY;
917 for (i = 0; i < v->type->member_count; ++i)
919 struct d3d10_effect_variable *var = &v->members[i];
920 struct d3d10_effect_type_member *typem = &v->type->members[i];
922 var->buffer = v->buffer;
923 var->effect = v->effect;
924 var->type = typem->type;
925 set_variable_vtbl(var);
927 if (!copy_name(typem->name, &var->name))
929 ERR("Failed to copy name.\n");
930 return E_OUTOFMEMORY;
932 TRACE("Variable name: %s.\n", debugstr_a(var->name));
934 if (!copy_name(typem->semantic, &var->semantic))
936 ERR("Failed to copy name.\n");
937 return E_OUTOFMEMORY;
939 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
941 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
942 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
944 hr = copy_variableinfo_from_type(var);
945 if (FAILED(hr)) return hr;
949 if (v->type->element_count)
951 unsigned int bufferoffset = v->buffer_offset;
953 if (!(v->elements = d3d10_calloc(v->type->element_count, sizeof(*v->elements))))
955 ERR("Failed to allocate elements memory.\n");
956 return E_OUTOFMEMORY;
959 for (i = 0; i < v->type->element_count; ++i)
961 struct d3d10_effect_variable *var = &v->elements[i];
963 var->buffer = v->buffer;
964 var->effect = v->effect;
965 var->type = v->type->elementtype;
966 set_variable_vtbl(var);
968 if (!copy_name(v->name, &var->name))
970 ERR("Failed to copy name.\n");
971 return E_OUTOFMEMORY;
973 TRACE("Variable name: %s.\n", debugstr_a(var->name));
975 if (!copy_name(v->semantic, &var->semantic))
977 ERR("Failed to copy name.\n");
978 return E_OUTOFMEMORY;
980 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
982 if (i != 0)
984 bufferoffset += v->type->stride;
986 var->buffer_offset = bufferoffset;
987 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
989 hr = copy_variableinfo_from_type(var);
990 if (FAILED(hr)) return hr;
994 return S_OK;
997 static HRESULT parse_fx10_variable_head(const char *data, size_t data_size,
998 const char **ptr, struct d3d10_effect_variable *v)
1000 DWORD offset;
1002 read_dword(ptr, &offset);
1003 TRACE("Variable name at offset %#x.\n", offset);
1005 if (!fx10_copy_string(data, data_size, offset, &v->name))
1007 ERR("Failed to copy name.\n");
1008 return E_OUTOFMEMORY;
1010 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1012 read_dword(ptr, &offset);
1013 TRACE("Variable type info at offset %#x.\n", offset);
1015 if (!(v->type = get_fx10_type(v->effect, data, data_size, offset)))
1017 ERR("Failed to get variable type.\n");
1018 return E_FAIL;
1020 set_variable_vtbl(v);
1022 return copy_variableinfo_from_type(v);
1025 static HRESULT parse_fx10_annotation(const char *data, size_t data_size,
1026 const char **ptr, struct d3d10_effect_variable *a)
1028 HRESULT hr;
1030 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, a)))
1031 return hr;
1033 skip_dword_unknown("annotation", ptr, 1);
1035 /* mark the variable as annotation */
1036 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
1038 return S_OK;
1041 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
1042 enum d3d10_effect_object_type otype)
1044 struct d3d10_effect_variable *v = &s->shader;
1045 struct d3d10_effect_type *t = &s->type;
1046 const char *shader = NULL;
1048 switch (otype)
1050 case D3D10_EOT_VERTEXSHADER:
1051 shader = "vertexshader";
1052 t->basetype = D3D10_SVT_VERTEXSHADER;
1053 break;
1055 case D3D10_EOT_PIXELSHADER:
1056 shader = "pixelshader";
1057 t->basetype = D3D10_SVT_PIXELSHADER;
1058 break;
1060 case D3D10_EOT_GEOMETRYSHADER:
1061 shader = "geometryshader";
1062 t->basetype = D3D10_SVT_GEOMETRYSHADER;
1063 break;
1065 default:
1066 FIXME("Unhandled object type %#x.\n", otype);
1067 return E_FAIL;
1070 if (!copy_name(shader, &t->name))
1072 ERR("Failed to copy name.\n");
1073 return E_OUTOFMEMORY;
1075 TRACE("Type name: %s.\n", debugstr_a(t->name));
1077 t->type_class = D3D10_SVC_OBJECT;
1079 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1081 v->type = t;
1082 v->effect = e;
1083 set_variable_vtbl(v);
1085 if (!copy_name("$Anonymous", &v->name))
1087 ERR("Failed to copy semantic.\n");
1088 return E_OUTOFMEMORY;
1090 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1092 if (!copy_name(NULL, &v->semantic))
1094 ERR("Failed to copy semantic.\n");
1095 return E_OUTOFMEMORY;
1097 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1099 return S_OK;
1102 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1104 unsigned int i;
1106 for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1108 if (property_info[i].id == id)
1109 return &property_info[i];
1112 return NULL;
1115 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1117 unsigned int i;
1119 for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1121 if (d3d10_effect_state_storage_info[i].id == id)
1122 return &d3d10_effect_state_storage_info[i];
1125 return NULL;
1128 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1130 switch (in_type)
1132 case D3D10_SVT_FLOAT:
1133 out_data[idx] = *(float *)&value;
1134 return TRUE;
1136 case D3D10_SVT_INT:
1137 out_data[idx] = (INT)value;
1138 return TRUE;
1140 default:
1141 FIXME("Unhandled in_type %#x.\n", in_type);
1142 return FALSE;
1146 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1148 switch (in_type)
1150 case D3D10_SVT_FLOAT:
1151 out_data[idx] = *(float *)&value;
1152 return TRUE;
1154 case D3D10_SVT_INT:
1155 case D3D10_SVT_UINT:
1156 case D3D10_SVT_BOOL:
1157 out_data[idx] = value;
1158 return TRUE;
1160 default:
1161 FIXME("Unhandled in_type %#x.\n", in_type);
1162 return FALSE;
1166 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1168 switch (in_type)
1170 case D3D10_SVT_INT:
1171 case D3D10_SVT_UINT:
1172 out_data[idx] = value;
1173 return TRUE;
1175 default:
1176 FIXME("Unhandled in_type %#x.\n", in_type);
1177 return FALSE;
1181 static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
1182 D3D_SHADER_VARIABLE_TYPE out_type, UINT out_base, UINT out_size, void *out_data)
1184 D3D_SHADER_VARIABLE_TYPE in_type;
1185 const char *ptr;
1186 DWORD t, value;
1187 DWORD count, i;
1189 if (offset >= data_size || !require_space(offset, 1, sizeof(count), data_size))
1191 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1192 return FALSE;
1195 ptr = data + offset;
1196 read_dword(&ptr, &count);
1197 if (count != out_size)
1198 return FALSE;
1200 if (!require_space(ptr - data, count, 2 * sizeof(DWORD), data_size))
1202 WARN("Invalid value count %#x (offset %#x, data size %#lx).\n", count, offset, (long)data_size);
1203 return FALSE;
1206 TRACE("%u values:\n", count);
1207 for (i = 0; i < count; ++i)
1209 UINT out_idx = out_base * out_size + i;
1211 read_dword(&ptr, &t);
1212 read_dword(&ptr, &value);
1214 in_type = d3d10_variable_type(t, FALSE);
1215 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1217 switch (out_type)
1219 case D3D10_SVT_FLOAT:
1220 if (!read_float_value(value, in_type, out_data, out_idx))
1221 return FALSE;
1222 break;
1224 case D3D10_SVT_INT:
1225 case D3D10_SVT_UINT:
1226 case D3D10_SVT_BOOL:
1227 if (!read_int32_value(value, in_type, out_data, out_idx))
1228 return FALSE;
1229 break;
1231 case D3D10_SVT_UINT8:
1232 if (!read_int8_value(value, in_type, out_data, out_idx))
1233 return FALSE;
1234 break;
1236 default:
1237 FIXME("Unhandled out_type %#x.\n", out_type);
1238 return FALSE;
1242 return TRUE;
1245 static BOOL parse_fx10_state_group(const char *data, size_t data_size,
1246 const char **ptr, D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1248 const struct d3d10_effect_state_property_info *property_info;
1249 UINT value_offset;
1250 unsigned int i;
1251 DWORD count;
1252 UINT idx;
1253 UINT id;
1255 read_dword(ptr, &count);
1256 TRACE("Property count: %#x.\n", count);
1258 for (i = 0; i < count; ++i)
1260 read_dword(ptr, &id);
1261 read_dword(ptr, &idx);
1262 skip_dword_unknown("read property", ptr, 1);
1263 read_dword(ptr, &value_offset);
1265 if (!(property_info = get_property_info(id)))
1267 FIXME("Failed to find property info for property %#x.\n", id);
1268 return FALSE;
1271 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1272 property_info->name, idx, value_offset);
1274 if (property_info->container_type != container_type)
1276 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1277 return FALSE;
1280 if (idx >= property_info->count)
1282 ERR("Invalid index %#x for property %#x.\n", idx, id);
1283 return FALSE;
1286 if (!read_value_list(data, data_size, value_offset, property_info->type, idx,
1287 property_info->size, (char *)container + property_info->offset))
1289 ERR("Failed to read values for property %#x.\n", id);
1290 return FALSE;
1294 return TRUE;
1297 static HRESULT parse_fx10_object(const char *data, size_t data_size,
1298 const char **ptr, struct d3d10_effect_object *o)
1300 ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface;
1301 const char *data_ptr = NULL;
1302 DWORD offset;
1303 enum d3d10_effect_object_operation operation;
1304 HRESULT hr;
1305 struct d3d10_effect *effect = o->pass->technique->effect;
1306 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1307 DWORD tmp, variable_idx = 0;
1308 const char *name;
1309 size_t name_len;
1311 if (!require_space(*ptr - data, 4, sizeof(DWORD), data_size))
1313 WARN("Invalid offset %#lx (data size %#lx).\n", (long)(*ptr - data), (long)data_size);
1314 return E_FAIL;
1317 read_dword(ptr, &o->type);
1318 TRACE("Effect object is of type %#x.\n", o->type);
1320 read_dword(ptr, &tmp);
1321 TRACE("Effect object index %#x.\n", tmp);
1323 read_dword(ptr, &operation);
1324 TRACE("Effect object operation %#x.\n", operation);
1326 read_dword(ptr, &offset);
1327 TRACE("Effect object idx is at offset %#x.\n", offset);
1329 switch(operation)
1331 case D3D10_EOO_VALUE:
1332 TRACE("Copy variable values\n");
1334 switch (o->type)
1336 case D3D10_EOT_VERTEXSHADER:
1337 TRACE("Vertex shader\n");
1338 variable = &anonymous_vs.ID3D10EffectVariable_iface;
1339 break;
1341 case D3D10_EOT_PIXELSHADER:
1342 TRACE("Pixel shader\n");
1343 variable = &anonymous_ps.ID3D10EffectVariable_iface;
1344 break;
1346 case D3D10_EOT_GEOMETRYSHADER:
1347 TRACE("Geometry shader\n");
1348 variable = &anonymous_gs.ID3D10EffectVariable_iface;
1349 break;
1351 case D3D10_EOT_STENCIL_REF:
1352 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1354 ERR("Failed to read stencil ref.\n");
1355 return E_FAIL;
1357 break;
1359 case D3D10_EOT_SAMPLE_MASK:
1360 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1362 FIXME("Failed to read sample mask.\n");
1363 return E_FAIL;
1365 break;
1367 case D3D10_EOT_BLEND_FACTOR:
1368 if (!read_value_list(data, data_size, offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1370 FIXME("Failed to read blend factor.\n");
1371 return E_FAIL;
1373 break;
1375 default:
1376 FIXME("Unhandled object type %#x\n", o->type);
1377 return E_FAIL;
1379 break;
1381 case D3D10_EOO_PARSED_OBJECT:
1382 /* This is a local object, we've parsed in parse_fx10_local_object. */
1383 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1385 WARN("Failed to get variable name.\n");
1386 return E_FAIL;
1388 TRACE("Variable name %s.\n", debugstr_a(name));
1390 variable = e->lpVtbl->GetVariableByName(e, name);
1391 break;
1393 case D3D10_EOO_PARSED_OBJECT_INDEX:
1394 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1395 if (offset >= data_size || !require_space(offset, 2, sizeof(DWORD), data_size))
1397 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1398 return E_FAIL;
1400 data_ptr = data + offset;
1401 read_dword(&data_ptr, &offset);
1402 read_dword(&data_ptr, &variable_idx);
1404 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1406 WARN("Failed to get variable name.\n");
1407 return E_FAIL;
1410 TRACE("Variable name %s[%u].\n", debugstr_a(name), variable_idx);
1412 variable = e->lpVtbl->GetVariableByName(e, name);
1413 break;
1415 case D3D10_EOO_ANONYMOUS_SHADER:
1416 TRACE("Anonymous shader\n");
1418 /* check anonymous_shader_current for validity */
1419 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1421 ERR("Anonymous shader count is wrong!\n");
1422 return E_FAIL;
1425 if (offset >= data_size || !require_space(offset, 1, sizeof(DWORD), data_size))
1427 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1428 return E_FAIL;
1430 data_ptr = data + offset;
1431 read_dword(&data_ptr, &offset);
1432 TRACE("Effect object starts at offset %#x.\n", offset);
1434 data_ptr = data + offset;
1436 hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type);
1437 if (FAILED(hr)) return hr;
1439 variable = &effect->anonymous_shaders[effect->anonymous_shader_current].shader.ID3D10EffectVariable_iface;
1440 ++effect->anonymous_shader_current;
1442 switch (o->type)
1444 case D3D10_EOT_VERTEXSHADER:
1445 case D3D10_EOT_PIXELSHADER:
1446 case D3D10_EOT_GEOMETRYSHADER:
1447 if (FAILED(hr = parse_shader(variable, data_ptr)))
1448 return hr;
1449 break;
1451 default:
1452 FIXME("Unhandled object type %#x\n", o->type);
1453 return E_FAIL;
1455 break;
1457 default:
1458 FIXME("Unhandled operation %#x.\n", operation);
1459 return E_FAIL;
1462 switch (o->type)
1464 case D3D10_EOT_RASTERIZER_STATE:
1466 ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
1467 if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
1468 return hr;
1469 break;
1472 case D3D10_EOT_DEPTH_STENCIL_STATE:
1474 ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable);
1475 if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds)))
1476 return hr;
1477 break;
1480 case D3D10_EOT_BLEND_STATE:
1482 ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
1483 if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
1484 return hr;
1485 break;
1488 case D3D10_EOT_VERTEXSHADER:
1490 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1491 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1492 return hr;
1493 o->pass->vs.pShaderVariable = sv;
1494 o->pass->vs.ShaderIndex = variable_idx;
1495 break;
1498 case D3D10_EOT_PIXELSHADER:
1500 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1501 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1502 return hr;
1503 o->pass->ps.pShaderVariable = sv;
1504 o->pass->ps.ShaderIndex = variable_idx;
1505 break;
1508 case D3D10_EOT_GEOMETRYSHADER:
1510 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1511 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1512 return hr;
1513 o->pass->gs.pShaderVariable = sv;
1514 o->pass->gs.ShaderIndex = variable_idx;
1515 break;
1518 case D3D10_EOT_STENCIL_REF:
1519 case D3D10_EOT_BLEND_FACTOR:
1520 case D3D10_EOT_SAMPLE_MASK:
1521 break;
1523 default:
1524 FIXME("Unhandled object type %#x.\n", o->type);
1525 return E_FAIL;
1528 return S_OK;
1531 static HRESULT parse_fx10_pass(const char *data, size_t data_size,
1532 const char **ptr, struct d3d10_effect_pass *p)
1534 HRESULT hr = S_OK;
1535 unsigned int i;
1536 DWORD offset;
1538 read_dword(ptr, &offset);
1539 TRACE("Pass name at offset %#x.\n", offset);
1541 if (!fx10_copy_string(data, data_size, offset, &p->name))
1543 ERR("Failed to copy name.\n");
1544 return E_OUTOFMEMORY;
1546 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1548 read_dword(ptr, &p->object_count);
1549 TRACE("Pass has %u effect objects.\n", p->object_count);
1551 read_dword(ptr, &p->annotation_count);
1552 TRACE("Pass has %u annotations.\n", p->annotation_count);
1554 if (!(p->annotations = d3d10_calloc(p->annotation_count, sizeof(*p->annotations))))
1556 ERR("Failed to allocate pass annotations memory.\n");
1557 return E_OUTOFMEMORY;
1560 for (i = 0; i < p->annotation_count; ++i)
1562 struct d3d10_effect_variable *a = &p->annotations[i];
1564 a->effect = p->technique->effect;
1565 a->buffer = &null_local_buffer;
1567 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1568 return hr;
1571 if (!(p->objects = d3d10_calloc(p->object_count, sizeof(*p->objects))))
1573 ERR("Failed to allocate effect objects memory.\n");
1574 return E_OUTOFMEMORY;
1577 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1578 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1579 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1581 for (i = 0; i < p->object_count; ++i)
1583 struct d3d10_effect_object *o = &p->objects[i];
1585 o->pass = p;
1587 if (FAILED(hr = parse_fx10_object(data, data_size, ptr, o)))
1588 return hr;
1591 return hr;
1594 static HRESULT parse_fx10_technique(const char *data, size_t data_size,
1595 const char **ptr, struct d3d10_effect_technique *t)
1597 unsigned int i;
1598 DWORD offset;
1599 HRESULT hr;
1601 read_dword(ptr, &offset);
1602 TRACE("Technique name at offset %#x.\n", offset);
1604 if (!fx10_copy_string(data, data_size, offset, &t->name))
1606 ERR("Failed to copy name.\n");
1607 return E_OUTOFMEMORY;
1609 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1611 read_dword(ptr, &t->pass_count);
1612 TRACE("Technique has %u passes\n", t->pass_count);
1614 read_dword(ptr, &t->annotation_count);
1615 TRACE("Technique has %u annotations.\n", t->annotation_count);
1617 if (!(t->annotations = d3d10_calloc(t->annotation_count, sizeof(*t->annotations))))
1619 ERR("Failed to allocate technique annotations memory.\n");
1620 return E_OUTOFMEMORY;
1623 for (i = 0; i < t->annotation_count; ++i)
1625 struct d3d10_effect_variable *a = &t->annotations[i];
1627 a->effect = t->effect;
1628 a->buffer = &null_local_buffer;
1630 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1631 return hr;
1634 if (!(t->passes = d3d10_calloc(t->pass_count, sizeof(*t->passes))))
1636 ERR("Failed to allocate passes memory\n");
1637 return E_OUTOFMEMORY;
1640 for (i = 0; i < t->pass_count; ++i)
1642 struct d3d10_effect_pass *p = &t->passes[i];
1644 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1645 p->technique = t;
1647 if (FAILED(hr = parse_fx10_pass(data, data_size, ptr, p)))
1648 return hr;
1651 return S_OK;
1654 static HRESULT parse_fx10_variable(const char *data, size_t data_size,
1655 const char **ptr, struct d3d10_effect_variable *v)
1657 DWORD offset;
1658 unsigned int i;
1659 HRESULT hr;
1661 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1662 return hr;
1664 read_dword(ptr, &offset);
1665 TRACE("Variable semantic at offset %#x.\n", offset);
1667 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1669 ERR("Failed to copy semantic.\n");
1670 return E_OUTOFMEMORY;
1672 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1674 read_dword(ptr, &v->buffer_offset);
1675 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1677 skip_dword_unknown("variable", ptr, 1);
1679 read_dword(ptr, &v->flag);
1680 TRACE("Variable flag: %#x.\n", v->flag);
1682 read_dword(ptr, &v->annotation_count);
1683 TRACE("Variable has %u annotations.\n", v->annotation_count);
1685 if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
1687 ERR("Failed to allocate variable annotations memory.\n");
1688 return E_OUTOFMEMORY;
1691 for (i = 0; i < v->annotation_count; ++i)
1693 struct d3d10_effect_variable *a = &v->annotations[i];
1695 a->effect = v->effect;
1696 a->buffer = &null_local_buffer;
1698 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1699 return hr;
1702 return S_OK;
1705 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1707 ID3D10Device *device = v->effect->device;
1708 HRESULT hr;
1710 switch (v->type->basetype)
1712 case D3D10_SVT_DEPTHSTENCIL:
1713 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1714 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1715 return hr;
1716 break;
1718 case D3D10_SVT_BLEND:
1719 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1720 &v->u.state.desc.blend, &v->u.state.object.blend)))
1721 return hr;
1722 break;
1724 case D3D10_SVT_RASTERIZER:
1725 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1726 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1727 return hr;
1728 break;
1730 case D3D10_SVT_SAMPLER:
1731 if (FAILED(hr = ID3D10Device_CreateSamplerState(device,
1732 &v->u.state.desc.sampler, &v->u.state.object.sampler)))
1733 return hr;
1734 break;
1736 default:
1737 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1738 return E_FAIL;
1741 return S_OK;
1744 static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
1745 const char **ptr, struct d3d10_effect_variable *v)
1747 unsigned int i;
1748 HRESULT hr;
1749 DWORD offset;
1751 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1752 return hr;
1754 read_dword(ptr, &offset);
1755 TRACE("Variable semantic at offset %#x.\n", offset);
1757 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1759 ERR("Failed to copy semantic.\n");
1760 return E_OUTOFMEMORY;
1762 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1764 skip_dword_unknown("local variable", ptr, 1);
1766 switch (v->type->basetype)
1768 case D3D10_SVT_TEXTURE1D:
1769 case D3D10_SVT_TEXTURE1DARRAY:
1770 case D3D10_SVT_TEXTURE2D:
1771 case D3D10_SVT_TEXTURE2DARRAY:
1772 case D3D10_SVT_TEXTURE2DMS:
1773 case D3D10_SVT_TEXTURE2DMSARRAY:
1774 case D3D10_SVT_TEXTURE3D:
1775 case D3D10_SVT_TEXTURECUBE:
1776 case D3D10_SVT_RENDERTARGETVIEW:
1777 case D3D10_SVT_DEPTHSTENCILVIEW:
1778 case D3D10_SVT_BUFFER:
1779 TRACE("SVT could not have elements.\n");
1780 break;
1782 case D3D10_SVT_VERTEXSHADER:
1783 case D3D10_SVT_PIXELSHADER:
1784 case D3D10_SVT_GEOMETRYSHADER:
1785 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1786 for (i = 0; i < max(v->type->element_count, 1); ++i)
1788 DWORD shader_offset;
1789 struct d3d10_effect_variable *var;
1791 if (!v->type->element_count)
1793 var = v;
1795 else
1797 var = &v->elements[i];
1800 read_dword(ptr, &shader_offset);
1801 TRACE("Shader offset: %#x.\n", shader_offset);
1803 hr = parse_shader(&var->ID3D10EffectVariable_iface, data + shader_offset);
1804 if (FAILED(hr)) return hr;
1806 break;
1808 case D3D10_SVT_DEPTHSTENCIL:
1809 case D3D10_SVT_BLEND:
1810 case D3D10_SVT_RASTERIZER:
1811 case D3D10_SVT_SAMPLER:
1813 const struct d3d10_effect_state_storage_info *storage_info;
1814 unsigned int count = max(v->type->element_count, 1);
1816 if (!(storage_info = get_storage_info(v->type->basetype)))
1818 FIXME("Failed to get backing store info for type %s.\n",
1819 debug_d3d10_shader_variable_type(v->type->basetype));
1820 return E_FAIL;
1823 if (storage_info->size > sizeof(v->u.state.desc))
1825 ERR("Invalid storage size %#lx.\n", storage_info->size);
1826 return E_FAIL;
1829 for (i = 0; i < count; ++i)
1831 struct d3d10_effect_variable *var;
1833 if (v->type->element_count)
1834 var = &v->elements[i];
1835 else
1836 var = v;
1838 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1839 if (!parse_fx10_state_group(data, data_size, ptr, var->type->basetype, &var->u.state.desc))
1841 ERR("Failed to read property list.\n");
1842 return E_FAIL;
1845 if (FAILED(hr = create_state_object(v)))
1846 return hr;
1849 break;
1851 default:
1852 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1853 return E_FAIL;
1856 read_dword(ptr, &v->annotation_count);
1857 TRACE("Variable has %u annotations.\n", v->annotation_count);
1859 if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
1861 ERR("Failed to allocate variable annotations memory.\n");
1862 return E_OUTOFMEMORY;
1865 for (i = 0; i < v->annotation_count; ++i)
1867 struct d3d10_effect_variable *a = &v->annotations[i];
1869 a->effect = v->effect;
1870 a->buffer = &null_local_buffer;
1872 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1873 return hr;
1876 return S_OK;
1879 static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
1880 const char **ptr, struct d3d10_effect_variable *l)
1882 unsigned int i;
1883 DWORD offset;
1884 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1885 HRESULT hr;
1886 unsigned int stride = 0;
1888 /* Generate our own type, it isn't in the fx blob. */
1889 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1890 if (!l->type)
1892 ERR("Failed to allocate local buffer type memory.\n");
1893 return E_OUTOFMEMORY;
1895 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1896 l->type->type_class = D3D10_SVC_OBJECT;
1897 l->type->effect = l->effect;
1899 read_dword(ptr, &offset);
1900 TRACE("Local buffer name at offset %#x.\n", offset);
1902 if (!fx10_copy_string(data, data_size, offset, &l->name))
1904 ERR("Failed to copy name.\n");
1905 return E_OUTOFMEMORY;
1907 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1909 read_dword(ptr, &l->data_size);
1910 TRACE("Local buffer data size: %#x.\n", l->data_size);
1912 read_dword(ptr, &d3d10_cbuffer_type);
1913 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1915 switch(d3d10_cbuffer_type)
1917 case D3D10_CT_CBUFFER:
1918 l->type->basetype = D3D10_SVT_CBUFFER;
1919 if (!copy_name("cbuffer", &l->type->name))
1921 ERR("Failed to copy name.\n");
1922 return E_OUTOFMEMORY;
1924 break;
1926 case D3D10_CT_TBUFFER:
1927 l->type->basetype = D3D10_SVT_TBUFFER;
1928 if (!copy_name("tbuffer", &l->type->name))
1930 ERR("Failed to copy name.\n");
1931 return E_OUTOFMEMORY;
1933 break;
1935 default:
1936 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1937 return E_FAIL;
1940 read_dword(ptr, &l->type->member_count);
1941 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1943 skip_dword_unknown("local buffer", ptr, 1);
1945 read_dword(ptr, &l->annotation_count);
1946 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1948 if (!(l->annotations = d3d10_calloc(l->annotation_count, sizeof(*l->annotations))))
1950 ERR("Failed to allocate local buffer annotations memory.\n");
1951 return E_OUTOFMEMORY;
1954 for (i = 0; i < l->annotation_count; ++i)
1956 struct d3d10_effect_variable *a = &l->annotations[i];
1958 a->effect = l->effect;
1959 a->buffer = &null_local_buffer;
1961 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1962 return hr;
1965 if (!(l->members = d3d10_calloc(l->type->member_count, sizeof(*l->members))))
1967 ERR("Failed to allocate members memory.\n");
1968 return E_OUTOFMEMORY;
1971 if (!(l->type->members = d3d10_calloc(l->type->member_count, sizeof(*l->type->members))))
1973 ERR("Failed to allocate type members memory.\n");
1974 return E_OUTOFMEMORY;
1977 for (i = 0; i < l->type->member_count; ++i)
1979 struct d3d10_effect_variable *v = &l->members[i];
1980 struct d3d10_effect_type_member *typem = &l->type->members[i];
1982 v->buffer = l;
1983 v->effect = l->effect;
1985 if (FAILED(hr = parse_fx10_variable(data, data_size, ptr, v)))
1986 return hr;
1989 * Copy the values from the variable type to the constant buffers type
1990 * members structure, because it is our own generated type.
1992 typem->type = v->type;
1994 if (!copy_name(v->name, &typem->name))
1996 ERR("Failed to copy name.\n");
1997 return E_OUTOFMEMORY;
1999 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
2001 if (!copy_name(v->semantic, &typem->semantic))
2003 ERR("Failed to copy name.\n");
2004 return E_OUTOFMEMORY;
2006 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
2008 typem->buffer_offset = v->buffer_offset;
2009 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
2011 l->type->size_packed += v->type->size_packed;
2014 * For the complete constantbuffer the size_unpacked = stride,
2015 * the stride is calculated like this:
2017 * 1) if the constant buffer variables are packed with packoffset
2018 * - stride = the highest used constant
2019 * - the complete stride has to be a multiple of 0x10
2021 * 2) if the constant buffer variables are NOT packed with packoffset
2022 * - sum of unpacked size for all variables which fit in a 0x10 part
2023 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
2024 * and a new part is started
2025 * - if the variable is a struct it is always used a new part
2026 * - the complete stride has to be a multiple of 0x10
2028 * e.g.:
2029 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
2030 * part 0x10 0x10 0x20 -> 0x40
2032 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2034 if ((v->type->size_unpacked + v->buffer_offset) > stride)
2036 stride = v->type->size_unpacked + v->buffer_offset;
2039 else
2041 if (v->type->type_class == D3D10_SVC_STRUCT)
2043 stride = (stride + 0xf) & ~0xf;
2046 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
2048 stride = (stride + 0xf) & ~0xf;
2051 stride += v->type->size_unpacked;
2054 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
2056 TRACE("Constant buffer:\n");
2057 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
2058 TRACE("\tElement count: %u.\n", l->type->element_count);
2059 TRACE("\tMember count: %u.\n", l->type->member_count);
2060 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
2061 TRACE("\tStride: %#x.\n", l->type->stride);
2062 TRACE("\tPacked size %#x.\n", l->type->size_packed);
2063 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
2064 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
2066 return S_OK;
2069 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
2071 TRACE("effect type member %p.\n", typem);
2073 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
2074 HeapFree(GetProcessHeap(), 0, typem->semantic);
2075 HeapFree(GetProcessHeap(), 0, typem->name);
2078 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
2080 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
2082 TRACE("effect type %p.\n", t);
2084 if (t->elementtype)
2086 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
2087 HeapFree(GetProcessHeap(), 0, t->elementtype);
2090 if (t->members)
2092 unsigned int i;
2094 for (i = 0; i < t->member_count; ++i)
2096 d3d10_effect_type_member_destroy(&t->members[i]);
2098 HeapFree(GetProcessHeap(), 0, t->members);
2101 HeapFree(GetProcessHeap(), 0, t->name);
2102 HeapFree(GetProcessHeap(), 0, t);
2105 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
2107 const char *ptr = data + e->index_offset;
2108 unsigned int i;
2109 HRESULT hr;
2111 if (!(e->local_buffers = d3d10_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
2113 ERR("Failed to allocate local buffer memory.\n");
2114 return E_OUTOFMEMORY;
2117 if (!(e->local_variables = d3d10_calloc(e->local_variable_count, sizeof(*e->local_variables))))
2119 ERR("Failed to allocate local variable memory.\n");
2120 return E_OUTOFMEMORY;
2123 if (!(e->anonymous_shaders = d3d10_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
2125 ERR("Failed to allocate anonymous shaders memory\n");
2126 return E_OUTOFMEMORY;
2129 if (!(e->used_shaders = d3d10_calloc(e->used_shader_count, sizeof(*e->used_shaders))))
2131 ERR("Failed to allocate used shaders memory\n");
2132 return E_OUTOFMEMORY;
2135 if (!(e->techniques = d3d10_calloc(e->technique_count, sizeof(*e->techniques))))
2137 ERR("Failed to allocate techniques memory\n");
2138 return E_OUTOFMEMORY;
2141 for (i = 0; i < e->local_buffer_count; ++i)
2143 struct d3d10_effect_variable *l = &e->local_buffers[i];
2144 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2145 l->effect = e;
2146 l->buffer = &null_local_buffer;
2148 if (FAILED(hr = parse_fx10_local_buffer(data, data_size, &ptr, l)))
2149 return hr;
2152 for (i = 0; i < e->local_variable_count; ++i)
2154 struct d3d10_effect_variable *v = &e->local_variables[i];
2156 v->effect = e;
2157 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2158 v->buffer = &null_local_buffer;
2160 if (FAILED(hr = parse_fx10_local_variable(data, data_size, &ptr, v)))
2161 return hr;
2164 for (i = 0; i < e->technique_count; ++i)
2166 struct d3d10_effect_technique *t = &e->techniques[i];
2168 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2169 t->effect = e;
2171 if (FAILED(hr = parse_fx10_technique(data, data_size, &ptr, t)))
2172 return hr;
2175 return S_OK;
2178 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2180 const char *ptr = data;
2181 DWORD unknown;
2183 if (!require_space(0, 19, sizeof(DWORD), data_size))
2185 WARN("Invalid data size %#x.\n", data_size);
2186 return E_INVALIDARG;
2189 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2190 read_dword(&ptr, &e->version);
2191 TRACE("Target: %#x\n", e->version);
2193 read_dword(&ptr, &e->local_buffer_count);
2194 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2196 read_dword(&ptr, &e->variable_count);
2197 TRACE("Variable count: %u\n", e->variable_count);
2199 read_dword(&ptr, &e->local_variable_count);
2200 TRACE("Object count: %u\n", e->local_variable_count);
2202 read_dword(&ptr, &e->sharedbuffers_count);
2203 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2205 /* Number of variables in shared buffers? */
2206 read_dword(&ptr, &unknown);
2207 FIXME("Unknown 0: %u\n", unknown);
2209 read_dword(&ptr, &e->sharedobjects_count);
2210 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2212 read_dword(&ptr, &e->technique_count);
2213 TRACE("Technique count: %u\n", e->technique_count);
2215 read_dword(&ptr, &e->index_offset);
2216 TRACE("Index offset: %#x\n", e->index_offset);
2218 read_dword(&ptr, &unknown);
2219 FIXME("Unknown 1: %u\n", unknown);
2221 read_dword(&ptr, &e->texture_count);
2222 TRACE("Texture count: %u\n", e->texture_count);
2224 read_dword(&ptr, &e->dephstencilstate_count);
2225 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2227 read_dword(&ptr, &e->blendstate_count);
2228 TRACE("Blendstate count: %u\n", e->blendstate_count);
2230 read_dword(&ptr, &e->rasterizerstate_count);
2231 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2233 read_dword(&ptr, &e->samplerstate_count);
2234 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2236 read_dword(&ptr, &e->rendertargetview_count);
2237 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2239 read_dword(&ptr, &e->depthstencilview_count);
2240 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2242 read_dword(&ptr, &e->used_shader_count);
2243 TRACE("Used shader count: %u\n", e->used_shader_count);
2245 read_dword(&ptr, &e->anonymous_shader_count);
2246 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2248 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2251 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2253 struct d3d10_effect *e = ctx;
2255 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2257 TRACE("chunk size: %#x\n", data_size);
2259 switch(tag)
2261 case TAG_FX10:
2262 return parse_fx10(e, data, data_size);
2264 default:
2265 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2266 return S_OK;
2270 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2272 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2275 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2277 ID3D10Device *device = o->pass->technique->effect->device;
2279 TRACE("effect object %p, type %#x.\n", o, o->type);
2281 switch(o->type)
2283 case D3D10_EOT_RASTERIZER_STATE:
2284 ID3D10Device_RSSetState(device, o->object.rs);
2285 return S_OK;
2287 case D3D10_EOT_DEPTH_STENCIL_STATE:
2288 ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
2289 return S_OK;
2291 case D3D10_EOT_BLEND_STATE:
2292 ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
2293 return S_OK;
2295 case D3D10_EOT_VERTEXSHADER:
2296 ID3D10Device_VSSetShader(device, o->object.vs);
2297 return S_OK;
2299 case D3D10_EOT_PIXELSHADER:
2300 ID3D10Device_PSSetShader(device, o->object.ps);
2301 return S_OK;
2303 case D3D10_EOT_GEOMETRYSHADER:
2304 ID3D10Device_GSSetShader(device, o->object.gs);
2305 return S_OK;
2307 case D3D10_EOT_STENCIL_REF:
2308 case D3D10_EOT_BLEND_FACTOR:
2309 case D3D10_EOT_SAMPLE_MASK:
2310 return S_OK;
2312 default:
2313 FIXME("Unhandled effect object type %#x.\n", o->type);
2314 return E_FAIL;
2318 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2319 D3D10_SHADER_VARIABLE_TYPE type)
2321 shader_free_signature(&s->input_signature);
2322 shader_free_signature(&s->output_signature);
2324 switch (type)
2326 case D3D10_SVT_VERTEXSHADER:
2327 if (s->shader.vs)
2328 ID3D10VertexShader_Release(s->shader.vs);
2329 break;
2331 case D3D10_SVT_PIXELSHADER:
2332 if (s->shader.ps)
2333 ID3D10PixelShader_Release(s->shader.ps);
2334 break;
2336 case D3D10_SVT_GEOMETRYSHADER:
2337 if (s->shader.gs)
2338 ID3D10GeometryShader_Release(s->shader.gs);
2339 break;
2341 default:
2342 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2343 break;
2347 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2349 unsigned int i;
2351 TRACE("variable %p.\n", v);
2353 HeapFree(GetProcessHeap(), 0, v->name);
2354 HeapFree(GetProcessHeap(), 0, v->semantic);
2355 if (v->annotations)
2357 for (i = 0; i < v->annotation_count; ++i)
2359 d3d10_effect_variable_destroy(&v->annotations[i]);
2361 HeapFree(GetProcessHeap(), 0, v->annotations);
2364 if (v->members)
2366 for (i = 0; i < v->type->member_count; ++i)
2368 d3d10_effect_variable_destroy(&v->members[i]);
2370 HeapFree(GetProcessHeap(), 0, v->members);
2373 if (v->elements)
2375 for (i = 0; i < v->type->element_count; ++i)
2377 d3d10_effect_variable_destroy(&v->elements[i]);
2379 HeapFree(GetProcessHeap(), 0, v->elements);
2382 if (v->type)
2384 switch (v->type->basetype)
2386 case D3D10_SVT_VERTEXSHADER:
2387 case D3D10_SVT_PIXELSHADER:
2388 case D3D10_SVT_GEOMETRYSHADER:
2389 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2390 break;
2392 case D3D10_SVT_DEPTHSTENCIL:
2393 if (v->u.state.object.depth_stencil)
2394 ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
2395 break;
2397 case D3D10_SVT_BLEND:
2398 if (v->u.state.object.blend)
2399 ID3D10BlendState_Release(v->u.state.object.blend);
2400 break;
2402 case D3D10_SVT_RASTERIZER:
2403 if (v->u.state.object.rasterizer)
2404 ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
2405 break;
2407 case D3D10_SVT_SAMPLER:
2408 if (v->u.state.object.sampler)
2409 ID3D10SamplerState_Release(v->u.state.object.sampler);
2410 break;
2412 default:
2413 break;
2418 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2420 switch (o->type)
2422 case D3D10_EOT_RASTERIZER_STATE:
2423 if (o->object.rs)
2424 ID3D10RasterizerState_Release(o->object.rs);
2425 break;
2427 case D3D10_EOT_DEPTH_STENCIL_STATE:
2428 if (o->object.ds)
2429 ID3D10DepthStencilState_Release(o->object.ds);
2430 break;
2432 case D3D10_EOT_BLEND_STATE:
2433 if (o->object.bs)
2434 ID3D10BlendState_Release(o->object.bs);
2435 break;
2437 case D3D10_EOT_VERTEXSHADER:
2438 if (o->object.vs)
2439 ID3D10VertexShader_Release(o->object.vs);
2440 break;
2442 case D3D10_EOT_PIXELSHADER:
2443 if (o->object.ps)
2444 ID3D10PixelShader_Release(o->object.ps);
2445 break;
2447 case D3D10_EOT_GEOMETRYSHADER:
2448 if (o->object.gs)
2449 ID3D10GeometryShader_Release(o->object.gs);
2450 break;
2452 default:
2453 break;
2457 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2459 unsigned int i;
2461 TRACE("pass %p\n", p);
2463 HeapFree(GetProcessHeap(), 0, p->name);
2465 if (p->objects)
2467 for (i = 0; i < p->object_count; ++i)
2469 d3d10_effect_object_destroy(&p->objects[i]);
2471 HeapFree(GetProcessHeap(), 0, p->objects);
2474 if (p->annotations)
2476 for (i = 0; i < p->annotation_count; ++i)
2478 d3d10_effect_variable_destroy(&p->annotations[i]);
2480 HeapFree(GetProcessHeap(), 0, p->annotations);
2484 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2486 unsigned int i;
2488 TRACE("technique %p\n", t);
2490 HeapFree(GetProcessHeap(), 0, t->name);
2491 if (t->passes)
2493 for (i = 0; i < t->pass_count; ++i)
2495 d3d10_effect_pass_destroy(&t->passes[i]);
2497 HeapFree(GetProcessHeap(), 0, t->passes);
2500 if (t->annotations)
2502 for (i = 0; i < t->annotation_count; ++i)
2504 d3d10_effect_variable_destroy(&t->annotations[i]);
2506 HeapFree(GetProcessHeap(), 0, t->annotations);
2510 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2512 unsigned int i;
2514 TRACE("local buffer %p.\n", l);
2516 HeapFree(GetProcessHeap(), 0, l->name);
2517 if (l->members)
2519 for (i = 0; i < l->type->member_count; ++i)
2521 d3d10_effect_variable_destroy(&l->members[i]);
2523 HeapFree(GetProcessHeap(), 0, l->members);
2526 if (l->type)
2527 d3d10_effect_type_destroy(&l->type->entry, NULL);
2529 if (l->annotations)
2531 for (i = 0; i < l->annotation_count; ++i)
2533 d3d10_effect_variable_destroy(&l->annotations[i]);
2535 HeapFree(GetProcessHeap(), 0, l->annotations);
2539 /* IUnknown methods */
2541 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2543 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2546 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2548 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2550 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2551 || IsEqualGUID(riid, &IID_IUnknown))
2553 IUnknown_AddRef(iface);
2554 *object = iface;
2555 return S_OK;
2558 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2560 *object = NULL;
2561 return E_NOINTERFACE;
2564 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2566 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2567 ULONG refcount = InterlockedIncrement(&This->refcount);
2569 TRACE("%p increasing refcount to %u\n", This, refcount);
2571 return refcount;
2574 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2576 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2577 ULONG refcount = InterlockedDecrement(&This->refcount);
2579 TRACE("%p decreasing refcount to %u\n", This, refcount);
2581 if (!refcount)
2583 unsigned int i;
2585 if (This->techniques)
2587 for (i = 0; i < This->technique_count; ++i)
2589 d3d10_effect_technique_destroy(&This->techniques[i]);
2591 HeapFree(GetProcessHeap(), 0, This->techniques);
2594 if (This->local_variables)
2596 for (i = 0; i < This->local_variable_count; ++i)
2598 d3d10_effect_variable_destroy(&This->local_variables[i]);
2600 HeapFree(GetProcessHeap(), 0, This->local_variables);
2603 if (This->local_buffers)
2605 for (i = 0; i < This->local_buffer_count; ++i)
2607 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2609 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2612 if (This->anonymous_shaders)
2614 for (i = 0; i < This->anonymous_shader_count; ++i)
2616 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2617 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2619 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2622 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2624 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2626 ID3D10Device_Release(This->device);
2627 HeapFree(GetProcessHeap(), 0, This);
2630 return refcount;
2633 /* ID3D10Effect methods */
2635 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2637 FIXME("iface %p stub!\n", iface);
2639 return FALSE;
2642 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2644 FIXME("iface %p stub!\n", iface);
2646 return FALSE;
2649 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2651 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2653 TRACE("iface %p, device %p\n", iface, device);
2655 ID3D10Device_AddRef(This->device);
2656 *device = This->device;
2658 return S_OK;
2661 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2663 FIXME("iface %p, desc %p stub!\n", iface, desc);
2665 return E_NOTIMPL;
2668 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2669 UINT index)
2671 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2672 struct d3d10_effect_variable *l;
2674 TRACE("iface %p, index %u\n", iface, index);
2676 if (index >= This->local_buffer_count)
2678 WARN("Invalid index specified\n");
2679 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2682 l = &This->local_buffers[index];
2684 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2686 return (ID3D10EffectConstantBuffer *)l;
2689 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2690 const char *name)
2692 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2693 unsigned int i;
2695 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2697 for (i = 0; i < This->local_buffer_count; ++i)
2699 struct d3d10_effect_variable *l = &This->local_buffers[i];
2701 if (l->name && !strcmp(l->name, name))
2703 TRACE("Returning buffer %p.\n", l);
2704 return (ID3D10EffectConstantBuffer *)l;
2708 WARN("Invalid name specified\n");
2710 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2713 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2715 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2716 unsigned int i;
2718 TRACE("iface %p, index %u\n", iface, index);
2720 for (i = 0; i < This->local_buffer_count; ++i)
2722 struct d3d10_effect_variable *l = &This->local_buffers[i];
2724 if (index < l->type->member_count)
2726 struct d3d10_effect_variable *v = &l->members[index];
2728 TRACE("Returning variable %p.\n", v);
2729 return &v->ID3D10EffectVariable_iface;
2731 index -= l->type->member_count;
2734 if (index < This->local_variable_count)
2736 struct d3d10_effect_variable *v = &This->local_variables[index];
2738 TRACE("Returning variable %p.\n", v);
2739 return &v->ID3D10EffectVariable_iface;
2742 WARN("Invalid index specified\n");
2744 return &null_variable.ID3D10EffectVariable_iface;
2747 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface,
2748 const char *name)
2750 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2751 unsigned int i;
2753 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2755 if (!name)
2757 WARN("Invalid name specified\n");
2758 return &null_variable.ID3D10EffectVariable_iface;
2761 for (i = 0; i < This->local_buffer_count; ++i)
2763 struct d3d10_effect_variable *l = &This->local_buffers[i];
2764 unsigned int j;
2766 for (j = 0; j < l->type->member_count; ++j)
2768 struct d3d10_effect_variable *v = &l->members[j];
2770 if (v->name && !strcmp(v->name, name))
2772 TRACE("Returning variable %p.\n", v);
2773 return &v->ID3D10EffectVariable_iface;
2778 for (i = 0; i < This->local_variable_count; ++i)
2780 struct d3d10_effect_variable *v = &This->local_variables[i];
2782 if (v->name && !strcmp(v->name, name))
2784 TRACE("Returning variable %p.\n", v);
2785 return &v->ID3D10EffectVariable_iface;
2789 WARN("Invalid name specified\n");
2791 return &null_variable.ID3D10EffectVariable_iface;
2794 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2795 const char *semantic)
2797 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2798 unsigned int i;
2800 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2802 if (!semantic)
2804 WARN("Invalid semantic specified\n");
2805 return &null_variable.ID3D10EffectVariable_iface;
2808 for (i = 0; i < This->local_buffer_count; ++i)
2810 struct d3d10_effect_variable *l = &This->local_buffers[i];
2811 unsigned int j;
2813 for (j = 0; j < l->type->member_count; ++j)
2815 struct d3d10_effect_variable *v = &l->members[j];
2817 if (v->semantic && !strcmp(v->semantic, semantic))
2819 TRACE("Returning variable %p.\n", v);
2820 return &v->ID3D10EffectVariable_iface;
2825 for (i = 0; i < This->local_variable_count; ++i)
2827 struct d3d10_effect_variable *v = &This->local_variables[i];
2829 if (v->semantic && !strcmp(v->semantic, semantic))
2831 TRACE("Returning variable %p.\n", v);
2832 return &v->ID3D10EffectVariable_iface;
2836 WARN("Invalid semantic specified\n");
2838 return &null_variable.ID3D10EffectVariable_iface;
2841 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2842 UINT index)
2844 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2845 struct d3d10_effect_technique *t;
2847 TRACE("iface %p, index %u\n", iface, index);
2849 if (index >= This->technique_count)
2851 WARN("Invalid index specified\n");
2852 return &null_technique.ID3D10EffectTechnique_iface;
2855 t = &This->techniques[index];
2857 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2859 return &t->ID3D10EffectTechnique_iface;
2862 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2863 const char *name)
2865 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2866 unsigned int i;
2868 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2870 if (!name)
2872 WARN("Invalid name specified\n");
2873 return &null_technique.ID3D10EffectTechnique_iface;
2876 for (i = 0; i < This->technique_count; ++i)
2878 struct d3d10_effect_technique *t = &This->techniques[i];
2879 if (t->name && !strcmp(t->name, name))
2881 TRACE("Returning technique %p\n", t);
2882 return &t->ID3D10EffectTechnique_iface;
2886 WARN("Invalid name specified\n");
2888 return &null_technique.ID3D10EffectTechnique_iface;
2891 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2893 FIXME("iface %p stub!\n", iface);
2895 return E_NOTIMPL;
2898 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2900 FIXME("iface %p stub!\n", iface);
2902 return FALSE;
2905 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2907 /* IUnknown methods */
2908 d3d10_effect_QueryInterface,
2909 d3d10_effect_AddRef,
2910 d3d10_effect_Release,
2911 /* ID3D10Effect methods */
2912 d3d10_effect_IsValid,
2913 d3d10_effect_IsPool,
2914 d3d10_effect_GetDevice,
2915 d3d10_effect_GetDesc,
2916 d3d10_effect_GetConstantBufferByIndex,
2917 d3d10_effect_GetConstantBufferByName,
2918 d3d10_effect_GetVariableByIndex,
2919 d3d10_effect_GetVariableByName,
2920 d3d10_effect_GetVariableBySemantic,
2921 d3d10_effect_GetTechniqueByIndex,
2922 d3d10_effect_GetTechniqueByName,
2923 d3d10_effect_Optimize,
2924 d3d10_effect_IsOptimized,
2927 /* ID3D10EffectTechnique methods */
2929 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2931 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2934 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2936 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2938 TRACE("iface %p\n", iface);
2940 return This != &null_technique;
2943 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2944 D3D10_TECHNIQUE_DESC *desc)
2946 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2948 TRACE("iface %p, desc %p\n", iface, desc);
2950 if(This == &null_technique)
2952 WARN("Null technique specified\n");
2953 return E_FAIL;
2956 if(!desc)
2958 WARN("Invalid argument specified\n");
2959 return E_INVALIDARG;
2962 desc->Name = This->name;
2963 desc->Passes = This->pass_count;
2964 desc->Annotations = This->annotation_count;
2966 return S_OK;
2969 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2970 ID3D10EffectTechnique *iface, UINT index)
2972 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2973 struct d3d10_effect_variable *a;
2975 TRACE("iface %p, index %u\n", iface, index);
2977 if (index >= This->annotation_count)
2979 WARN("Invalid index specified\n");
2980 return &null_variable.ID3D10EffectVariable_iface;
2983 a = &This->annotations[index];
2985 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2987 return &a->ID3D10EffectVariable_iface;
2990 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2991 ID3D10EffectTechnique *iface, const char *name)
2993 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2994 unsigned int i;
2996 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2998 for (i = 0; i < This->annotation_count; ++i)
3000 struct d3d10_effect_variable *a = &This->annotations[i];
3001 if (a->name && !strcmp(a->name, name))
3003 TRACE("Returning annotation %p\n", a);
3004 return &a->ID3D10EffectVariable_iface;
3008 WARN("Invalid name specified\n");
3010 return &null_variable.ID3D10EffectVariable_iface;
3013 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
3014 UINT index)
3016 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3017 struct d3d10_effect_pass *p;
3019 TRACE("iface %p, index %u\n", iface, index);
3021 if (index >= This->pass_count)
3023 WARN("Invalid index specified\n");
3024 return &null_pass.ID3D10EffectPass_iface;
3027 p = &This->passes[index];
3029 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
3031 return &p->ID3D10EffectPass_iface;
3034 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
3035 const char *name)
3037 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3038 unsigned int i;
3040 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3042 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
3044 for (i = 0; i < This->pass_count; ++i)
3046 struct d3d10_effect_pass *p = &This->passes[i];
3047 if (p->name && !strcmp(p->name, name))
3049 TRACE("Returning pass %p\n", p);
3050 return &p->ID3D10EffectPass_iface;
3054 WARN("Invalid name specified\n");
3056 return &null_pass.ID3D10EffectPass_iface;
3059 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
3060 D3D10_STATE_BLOCK_MASK *mask)
3062 FIXME("iface %p,mask %p stub!\n", iface, mask);
3064 return E_NOTIMPL;
3067 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
3069 /* ID3D10EffectTechnique methods */
3070 d3d10_effect_technique_IsValid,
3071 d3d10_effect_technique_GetDesc,
3072 d3d10_effect_technique_GetAnnotationByIndex,
3073 d3d10_effect_technique_GetAnnotationByName,
3074 d3d10_effect_technique_GetPassByIndex,
3075 d3d10_effect_technique_GetPassByName,
3076 d3d10_effect_technique_ComputeStateBlockMask,
3079 /* ID3D10EffectPass methods */
3081 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
3083 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
3086 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
3088 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3090 TRACE("iface %p\n", iface);
3092 return This != &null_pass;
3095 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
3096 D3D10_PASS_DESC *desc)
3098 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3099 struct d3d10_effect_shader_variable *s;
3101 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
3103 if(This == &null_pass)
3105 WARN("Null pass specified\n");
3106 return E_FAIL;
3109 if(!desc)
3111 WARN("Invalid argument specified\n");
3112 return E_INVALIDARG;
3115 memset(desc, 0, sizeof(*desc));
3116 desc->Name = This->name;
3118 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3119 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3120 desc->IAInputSignatureSize = s->input_signature.signature_size;
3122 desc->StencilRef = This->stencil_ref;
3123 desc->SampleMask = This->sample_mask;
3124 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3126 return S_OK;
3129 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3130 D3D10_PASS_SHADER_DESC *desc)
3132 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3134 TRACE("iface %p, desc %p\n", iface, desc);
3136 if (This == &null_pass)
3138 WARN("Null pass specified\n");
3139 return E_FAIL;
3142 if (!desc)
3144 WARN("Invalid argument specified\n");
3145 return E_INVALIDARG;
3148 *desc = This->vs;
3150 return S_OK;
3153 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3154 D3D10_PASS_SHADER_DESC *desc)
3156 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3158 TRACE("iface %p, desc %p\n", iface, desc);
3160 if (This == &null_pass)
3162 WARN("Null pass specified\n");
3163 return E_FAIL;
3166 if (!desc)
3168 WARN("Invalid argument specified\n");
3169 return E_INVALIDARG;
3172 *desc = This->gs;
3174 return S_OK;
3177 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3178 D3D10_PASS_SHADER_DESC *desc)
3180 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3182 TRACE("iface %p, desc %p\n", iface, desc);
3184 if (This == &null_pass)
3186 WARN("Null pass specified\n");
3187 return E_FAIL;
3190 if (!desc)
3192 WARN("Invalid argument specified\n");
3193 return E_INVALIDARG;
3196 *desc = This->ps;
3198 return S_OK;
3201 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3202 UINT index)
3204 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3205 struct d3d10_effect_variable *a;
3207 TRACE("iface %p, index %u\n", iface, index);
3209 if (index >= This->annotation_count)
3211 WARN("Invalid index specified\n");
3212 return &null_variable.ID3D10EffectVariable_iface;
3215 a = &This->annotations[index];
3217 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3219 return &a->ID3D10EffectVariable_iface;
3222 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3223 const char *name)
3225 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3226 unsigned int i;
3228 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3230 for (i = 0; i < This->annotation_count; ++i)
3232 struct d3d10_effect_variable *a = &This->annotations[i];
3233 if (a->name && !strcmp(a->name, name))
3235 TRACE("Returning annotation %p\n", a);
3236 return &a->ID3D10EffectVariable_iface;
3240 WARN("Invalid name specified\n");
3242 return &null_variable.ID3D10EffectVariable_iface;
3245 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3247 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3248 HRESULT hr = S_OK;
3249 unsigned int i;
3251 TRACE("iface %p, flags %#x\n", iface, flags);
3253 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3255 for (i = 0; i < This->object_count; ++i)
3257 hr = d3d10_effect_object_apply(&This->objects[i]);
3258 if (FAILED(hr)) break;
3261 return hr;
3264 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3265 D3D10_STATE_BLOCK_MASK *mask)
3267 FIXME("iface %p, mask %p stub!\n", iface, mask);
3269 return E_NOTIMPL;
3272 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3274 /* ID3D10EffectPass methods */
3275 d3d10_effect_pass_IsValid,
3276 d3d10_effect_pass_GetDesc,
3277 d3d10_effect_pass_GetVertexShaderDesc,
3278 d3d10_effect_pass_GetGeometryShaderDesc,
3279 d3d10_effect_pass_GetPixelShaderDesc,
3280 d3d10_effect_pass_GetAnnotationByIndex,
3281 d3d10_effect_pass_GetAnnotationByName,
3282 d3d10_effect_pass_Apply,
3283 d3d10_effect_pass_ComputeStateBlockMask,
3286 /* ID3D10EffectVariable methods */
3288 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3290 TRACE("iface %p\n", iface);
3292 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3295 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3297 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3299 TRACE("iface %p\n", iface);
3301 return &This->type->ID3D10EffectType_iface;
3304 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3305 D3D10_EFFECT_VARIABLE_DESC *desc)
3307 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3309 TRACE("iface %p, desc %p\n", iface, desc);
3311 if (!iface->lpVtbl->IsValid(iface))
3313 WARN("Null variable specified\n");
3314 return E_FAIL;
3317 if (!desc)
3319 WARN("Invalid argument specified\n");
3320 return E_INVALIDARG;
3323 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3324 memset(desc, 0, sizeof(*desc));
3325 desc->Name = This->name;
3326 desc->Semantic = This->semantic;
3327 desc->Flags = This->flag;
3328 desc->Annotations = This->annotation_count;
3329 desc->BufferOffset = This->buffer_offset;
3331 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3333 desc->ExplicitBindPoint = This->buffer_offset;
3336 return S_OK;
3339 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3340 ID3D10EffectVariable *iface, UINT index)
3342 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3343 struct d3d10_effect_variable *a;
3345 TRACE("iface %p, index %u\n", iface, index);
3347 if (index >= This->annotation_count)
3349 WARN("Invalid index specified\n");
3350 return &null_variable.ID3D10EffectVariable_iface;
3353 a = &This->annotations[index];
3355 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3357 return &a->ID3D10EffectVariable_iface;
3360 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3361 ID3D10EffectVariable *iface, const char *name)
3363 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3364 unsigned int i;
3366 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3368 for (i = 0; i < This->annotation_count; ++i)
3370 struct d3d10_effect_variable *a = &This->annotations[i];
3371 if (a->name && !strcmp(a->name, name))
3373 TRACE("Returning annotation %p\n", a);
3374 return &a->ID3D10EffectVariable_iface;
3378 WARN("Invalid name specified\n");
3380 return &null_variable.ID3D10EffectVariable_iface;
3383 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3384 ID3D10EffectVariable *iface, UINT index)
3386 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3387 struct d3d10_effect_variable *m;
3389 TRACE("iface %p, index %u\n", iface, index);
3391 if (index >= This->type->member_count)
3393 WARN("Invalid index specified\n");
3394 return &null_variable.ID3D10EffectVariable_iface;
3397 m = &This->members[index];
3399 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3401 return &m->ID3D10EffectVariable_iface;
3404 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3405 ID3D10EffectVariable *iface, const char *name)
3407 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3408 unsigned int i;
3410 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3412 if (!name)
3414 WARN("Invalid name specified\n");
3415 return &null_variable.ID3D10EffectVariable_iface;
3418 for (i = 0; i < This->type->member_count; ++i)
3420 struct d3d10_effect_variable *m = &This->members[i];
3422 if (m->name && !strcmp(m->name, name))
3424 TRACE("Returning member %p\n", m);
3425 return &m->ID3D10EffectVariable_iface;
3429 WARN("Invalid name specified\n");
3431 return &null_variable.ID3D10EffectVariable_iface;
3434 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3435 ID3D10EffectVariable *iface, const char *semantic)
3437 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3438 unsigned int i;
3440 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3442 if (!semantic)
3444 WARN("Invalid semantic specified\n");
3445 return &null_variable.ID3D10EffectVariable_iface;
3448 for (i = 0; i < This->type->member_count; ++i)
3450 struct d3d10_effect_variable *m = &This->members[i];
3452 if (m->semantic && !strcmp(m->semantic, semantic))
3454 TRACE("Returning member %p\n", m);
3455 return &m->ID3D10EffectVariable_iface;
3459 WARN("Invalid semantic specified\n");
3461 return &null_variable.ID3D10EffectVariable_iface;
3464 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3465 ID3D10EffectVariable *iface, UINT index)
3467 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3468 struct d3d10_effect_variable *v;
3470 TRACE("iface %p, index %u\n", iface, index);
3472 if (index >= This->type->element_count)
3474 WARN("Invalid index specified\n");
3475 return &null_variable.ID3D10EffectVariable_iface;
3478 v = &This->elements[index];
3480 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3482 return &v->ID3D10EffectVariable_iface;
3485 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3486 ID3D10EffectVariable *iface)
3488 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3490 TRACE("iface %p\n", iface);
3492 return (ID3D10EffectConstantBuffer *)This->buffer;
3495 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3496 ID3D10EffectVariable *iface)
3498 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3500 TRACE("iface %p\n", iface);
3502 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3503 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3505 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3508 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3509 ID3D10EffectVariable *iface)
3511 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3513 TRACE("iface %p\n", iface);
3515 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3516 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3518 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3521 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3522 ID3D10EffectVariable *iface)
3524 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3526 TRACE("iface %p\n", iface);
3528 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3529 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3531 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3534 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3535 ID3D10EffectVariable *iface)
3537 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3539 TRACE("iface %p\n", iface);
3541 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3542 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3544 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3547 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3548 ID3D10EffectVariable *iface)
3550 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3552 TRACE("iface %p\n", iface);
3554 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3555 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3557 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3560 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3561 ID3D10EffectVariable *iface)
3563 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3565 TRACE("iface %p\n", iface);
3567 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3568 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3570 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3573 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3574 ID3D10EffectVariable *iface)
3576 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3578 TRACE("iface %p\n", iface);
3580 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3581 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3583 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3586 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3587 ID3D10EffectVariable *iface)
3589 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3591 TRACE("iface %p\n", iface);
3593 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3594 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3596 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3599 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3600 ID3D10EffectVariable *iface)
3602 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3604 TRACE("iface %p\n", iface);
3606 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3607 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3609 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3612 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3614 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3616 TRACE("iface %p\n", iface);
3618 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3619 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3621 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3624 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3625 ID3D10EffectVariable *iface)
3627 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3629 TRACE("iface %p\n", iface);
3631 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3632 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3634 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3637 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3638 ID3D10EffectVariable *iface)
3640 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3642 TRACE("iface %p\n", iface);
3644 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3645 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3647 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3650 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3651 ID3D10EffectVariable *iface)
3653 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3655 TRACE("iface %p\n", iface);
3657 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3658 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3660 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3663 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3664 void *data, UINT offset, UINT count)
3666 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3668 return E_NOTIMPL;
3671 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3672 void *data, UINT offset, UINT count)
3674 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3676 return E_NOTIMPL;
3679 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3681 /* ID3D10EffectVariable methods */
3682 d3d10_effect_variable_IsValid,
3683 d3d10_effect_variable_GetType,
3684 d3d10_effect_variable_GetDesc,
3685 d3d10_effect_variable_GetAnnotationByIndex,
3686 d3d10_effect_variable_GetAnnotationByName,
3687 d3d10_effect_variable_GetMemberByIndex,
3688 d3d10_effect_variable_GetMemberByName,
3689 d3d10_effect_variable_GetMemberBySemantic,
3690 d3d10_effect_variable_GetElement,
3691 d3d10_effect_variable_GetParentConstantBuffer,
3692 d3d10_effect_variable_AsScalar,
3693 d3d10_effect_variable_AsVector,
3694 d3d10_effect_variable_AsMatrix,
3695 d3d10_effect_variable_AsString,
3696 d3d10_effect_variable_AsShaderResource,
3697 d3d10_effect_variable_AsRenderTargetView,
3698 d3d10_effect_variable_AsDepthStencilView,
3699 d3d10_effect_variable_AsConstantBuffer,
3700 d3d10_effect_variable_AsShader,
3701 d3d10_effect_variable_AsBlend,
3702 d3d10_effect_variable_AsDepthStencil,
3703 d3d10_effect_variable_AsRasterizer,
3704 d3d10_effect_variable_AsSampler,
3705 d3d10_effect_variable_SetRawValue,
3706 d3d10_effect_variable_GetRawValue,
3709 /* ID3D10EffectVariable methods */
3710 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3712 TRACE("iface %p\n", iface);
3714 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3717 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3719 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3722 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3723 D3D10_EFFECT_VARIABLE_DESC *desc)
3725 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3728 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3729 ID3D10EffectConstantBuffer *iface, UINT index)
3731 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3734 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3735 ID3D10EffectConstantBuffer *iface, const char *name)
3737 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3740 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3741 ID3D10EffectConstantBuffer *iface, UINT index)
3743 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3746 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3747 ID3D10EffectConstantBuffer *iface, const char *name)
3749 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3752 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3753 ID3D10EffectConstantBuffer *iface, const char *semantic)
3755 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3758 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3759 ID3D10EffectConstantBuffer *iface, UINT index)
3761 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3764 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3765 ID3D10EffectConstantBuffer *iface)
3767 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3770 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3771 ID3D10EffectConstantBuffer *iface)
3773 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3776 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3777 ID3D10EffectConstantBuffer *iface)
3779 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3782 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3783 ID3D10EffectConstantBuffer *iface)
3785 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3788 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3789 ID3D10EffectConstantBuffer *iface)
3791 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3794 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3795 ID3D10EffectConstantBuffer *iface)
3797 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3800 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3801 ID3D10EffectConstantBuffer *iface)
3803 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3806 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3807 ID3D10EffectConstantBuffer *iface)
3809 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3812 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3813 ID3D10EffectConstantBuffer *iface)
3815 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3818 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3819 ID3D10EffectConstantBuffer *iface)
3821 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3824 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3826 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3829 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3830 ID3D10EffectConstantBuffer *iface)
3832 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3835 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3836 ID3D10EffectConstantBuffer *iface)
3838 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3841 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3842 ID3D10EffectConstantBuffer *iface)
3844 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3847 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3848 void *data, UINT offset, UINT count)
3850 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3853 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3854 void *data, UINT offset, UINT count)
3856 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3859 /* ID3D10EffectConstantBuffer methods */
3860 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3861 ID3D10Buffer *buffer)
3863 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3865 return E_NOTIMPL;
3868 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3869 ID3D10Buffer **buffer)
3871 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3873 return E_NOTIMPL;
3876 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3877 ID3D10ShaderResourceView *view)
3879 FIXME("iface %p, view %p stub!\n", iface, view);
3881 return E_NOTIMPL;
3884 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3885 ID3D10ShaderResourceView **view)
3887 FIXME("iface %p, view %p stub!\n", iface, view);
3889 return E_NOTIMPL;
3892 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3894 /* ID3D10EffectVariable methods */
3895 d3d10_effect_constant_buffer_IsValid,
3896 d3d10_effect_constant_buffer_GetType,
3897 d3d10_effect_constant_buffer_GetDesc,
3898 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3899 d3d10_effect_constant_buffer_GetAnnotationByName,
3900 d3d10_effect_constant_buffer_GetMemberByIndex,
3901 d3d10_effect_constant_buffer_GetMemberByName,
3902 d3d10_effect_constant_buffer_GetMemberBySemantic,
3903 d3d10_effect_constant_buffer_GetElement,
3904 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3905 d3d10_effect_constant_buffer_AsScalar,
3906 d3d10_effect_constant_buffer_AsVector,
3907 d3d10_effect_constant_buffer_AsMatrix,
3908 d3d10_effect_constant_buffer_AsString,
3909 d3d10_effect_constant_buffer_AsShaderResource,
3910 d3d10_effect_constant_buffer_AsRenderTargetView,
3911 d3d10_effect_constant_buffer_AsDepthStencilView,
3912 d3d10_effect_constant_buffer_AsConstantBuffer,
3913 d3d10_effect_constant_buffer_AsShader,
3914 d3d10_effect_constant_buffer_AsBlend,
3915 d3d10_effect_constant_buffer_AsDepthStencil,
3916 d3d10_effect_constant_buffer_AsRasterizer,
3917 d3d10_effect_constant_buffer_AsSampler,
3918 d3d10_effect_constant_buffer_SetRawValue,
3919 d3d10_effect_constant_buffer_GetRawValue,
3920 /* ID3D10EffectConstantBuffer methods */
3921 d3d10_effect_constant_buffer_SetConstantBuffer,
3922 d3d10_effect_constant_buffer_GetConstantBuffer,
3923 d3d10_effect_constant_buffer_SetTextureBuffer,
3924 d3d10_effect_constant_buffer_GetTextureBuffer,
3927 /* ID3D10EffectVariable methods */
3929 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3931 TRACE("iface %p\n", iface);
3933 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3936 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3937 ID3D10EffectScalarVariable *iface)
3939 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3942 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3943 D3D10_EFFECT_VARIABLE_DESC *desc)
3945 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3948 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3949 ID3D10EffectScalarVariable *iface, UINT index)
3951 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3954 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3955 ID3D10EffectScalarVariable *iface, const char *name)
3957 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3960 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3961 ID3D10EffectScalarVariable *iface, UINT index)
3963 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3966 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3967 ID3D10EffectScalarVariable *iface, const char *name)
3969 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3972 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3973 ID3D10EffectScalarVariable *iface, const char *semantic)
3975 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3978 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3979 ID3D10EffectScalarVariable *iface, UINT index)
3981 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3984 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3985 ID3D10EffectScalarVariable *iface)
3987 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3990 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3991 ID3D10EffectScalarVariable *iface)
3993 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3996 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3997 ID3D10EffectScalarVariable *iface)
3999 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4002 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
4003 ID3D10EffectScalarVariable *iface)
4005 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4008 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
4009 ID3D10EffectScalarVariable *iface)
4011 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4014 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
4015 ID3D10EffectScalarVariable *iface)
4017 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4020 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
4021 ID3D10EffectScalarVariable *iface)
4023 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4026 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
4027 ID3D10EffectScalarVariable *iface)
4029 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4032 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
4033 ID3D10EffectScalarVariable *iface)
4035 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4038 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
4039 ID3D10EffectScalarVariable *iface)
4041 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4044 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
4045 ID3D10EffectScalarVariable *iface)
4047 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4050 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
4051 ID3D10EffectScalarVariable *iface)
4053 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4056 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
4057 ID3D10EffectScalarVariable *iface)
4059 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4062 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
4063 ID3D10EffectScalarVariable *iface)
4065 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4068 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
4069 void *data, UINT offset, UINT count)
4071 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4074 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
4075 void *data, UINT offset, UINT count)
4077 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4080 /* ID3D10EffectScalarVariable methods */
4082 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
4083 float value)
4085 FIXME("iface %p, value %.8e stub!\n", iface, value);
4087 return E_NOTIMPL;
4090 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
4091 float *value)
4093 FIXME("iface %p, value %p stub!\n", iface, value);
4095 return E_NOTIMPL;
4098 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
4099 float *values, UINT offset, UINT count)
4101 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4103 return E_NOTIMPL;
4106 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4107 float *values, UINT offset, UINT count)
4109 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4111 return E_NOTIMPL;
4114 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
4115 int value)
4117 FIXME("iface %p, value %d stub!\n", iface, value);
4119 return E_NOTIMPL;
4122 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4123 int *value)
4125 FIXME("iface %p, value %p stub!\n", iface, value);
4127 return E_NOTIMPL;
4130 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4131 int *values, UINT offset, UINT count)
4133 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4135 return E_NOTIMPL;
4138 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4139 int *values, UINT offset, UINT count)
4141 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4143 return E_NOTIMPL;
4146 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4147 BOOL value)
4149 FIXME("iface %p, value %d stub!\n", iface, value);
4151 return E_NOTIMPL;
4154 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4155 BOOL *value)
4157 FIXME("iface %p, value %p stub!\n", iface, value);
4159 return E_NOTIMPL;
4162 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4163 BOOL *values, UINT offset, UINT count)
4165 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4167 return E_NOTIMPL;
4170 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4171 BOOL *values, UINT offset, UINT count)
4173 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4175 return E_NOTIMPL;
4178 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4180 /* ID3D10EffectVariable methods */
4181 d3d10_effect_scalar_variable_IsValid,
4182 d3d10_effect_scalar_variable_GetType,
4183 d3d10_effect_scalar_variable_GetDesc,
4184 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4185 d3d10_effect_scalar_variable_GetAnnotationByName,
4186 d3d10_effect_scalar_variable_GetMemberByIndex,
4187 d3d10_effect_scalar_variable_GetMemberByName,
4188 d3d10_effect_scalar_variable_GetMemberBySemantic,
4189 d3d10_effect_scalar_variable_GetElement,
4190 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4191 d3d10_effect_scalar_variable_AsScalar,
4192 d3d10_effect_scalar_variable_AsVector,
4193 d3d10_effect_scalar_variable_AsMatrix,
4194 d3d10_effect_scalar_variable_AsString,
4195 d3d10_effect_scalar_variable_AsShaderResource,
4196 d3d10_effect_scalar_variable_AsRenderTargetView,
4197 d3d10_effect_scalar_variable_AsDepthStencilView,
4198 d3d10_effect_scalar_variable_AsConstantBuffer,
4199 d3d10_effect_scalar_variable_AsShader,
4200 d3d10_effect_scalar_variable_AsBlend,
4201 d3d10_effect_scalar_variable_AsDepthStencil,
4202 d3d10_effect_scalar_variable_AsRasterizer,
4203 d3d10_effect_scalar_variable_AsSampler,
4204 d3d10_effect_scalar_variable_SetRawValue,
4205 d3d10_effect_scalar_variable_GetRawValue,
4206 /* ID3D10EffectScalarVariable methods */
4207 d3d10_effect_scalar_variable_SetFloat,
4208 d3d10_effect_scalar_variable_GetFloat,
4209 d3d10_effect_scalar_variable_SetFloatArray,
4210 d3d10_effect_scalar_variable_GetFloatArray,
4211 d3d10_effect_scalar_variable_SetInt,
4212 d3d10_effect_scalar_variable_GetInt,
4213 d3d10_effect_scalar_variable_SetIntArray,
4214 d3d10_effect_scalar_variable_GetIntArray,
4215 d3d10_effect_scalar_variable_SetBool,
4216 d3d10_effect_scalar_variable_GetBool,
4217 d3d10_effect_scalar_variable_SetBoolArray,
4218 d3d10_effect_scalar_variable_GetBoolArray,
4221 /* ID3D10EffectVariable methods */
4223 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4225 TRACE("iface %p\n", iface);
4227 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4230 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4231 ID3D10EffectVectorVariable *iface)
4233 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4236 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4237 D3D10_EFFECT_VARIABLE_DESC *desc)
4239 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4242 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4243 ID3D10EffectVectorVariable *iface, UINT index)
4245 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4248 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4249 ID3D10EffectVectorVariable *iface, const char *name)
4251 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4254 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4255 ID3D10EffectVectorVariable *iface, UINT index)
4257 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4260 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4261 ID3D10EffectVectorVariable *iface, const char *name)
4263 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4266 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4267 ID3D10EffectVectorVariable *iface, const char *semantic)
4269 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4272 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4273 ID3D10EffectVectorVariable *iface, UINT index)
4275 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4278 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4279 ID3D10EffectVectorVariable *iface)
4281 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4284 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4285 ID3D10EffectVectorVariable *iface)
4287 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4290 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4291 ID3D10EffectVectorVariable *iface)
4293 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4296 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4297 ID3D10EffectVectorVariable *iface)
4299 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4302 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4303 ID3D10EffectVectorVariable *iface)
4305 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4308 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4309 ID3D10EffectVectorVariable *iface)
4311 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4314 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4315 ID3D10EffectVectorVariable *iface)
4317 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4320 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4321 ID3D10EffectVectorVariable *iface)
4323 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4326 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4327 ID3D10EffectVectorVariable *iface)
4329 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4332 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4333 ID3D10EffectVectorVariable *iface)
4335 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4338 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4339 ID3D10EffectVectorVariable *iface)
4341 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4344 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4345 ID3D10EffectVectorVariable *iface)
4347 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4350 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4351 ID3D10EffectVectorVariable *iface)
4353 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4356 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4357 ID3D10EffectVectorVariable *iface)
4359 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4362 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4363 void *data, UINT offset, UINT count)
4365 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4368 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4369 void *data, UINT offset, UINT count)
4371 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4374 /* ID3D10EffectVectorVariable methods */
4376 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4377 BOOL *value)
4379 FIXME("iface %p, value %p stub!\n", iface, value);
4381 return E_NOTIMPL;
4384 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4385 int *value)
4387 FIXME("iface %p, value %p stub!\n", iface, value);
4389 return E_NOTIMPL;
4392 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4393 float *value)
4395 FIXME("iface %p, value %p stub!\n", iface, value);
4397 return E_NOTIMPL;
4400 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4401 BOOL *value)
4403 FIXME("iface %p, value %p stub!\n", iface, value);
4405 return E_NOTIMPL;
4408 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4409 int *value)
4411 FIXME("iface %p, value %p stub!\n", iface, value);
4413 return E_NOTIMPL;
4416 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4417 float *value)
4419 FIXME("iface %p, value %p stub!\n", iface, value);
4421 return E_NOTIMPL;
4424 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4425 BOOL *values, UINT offset, UINT count)
4427 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4429 return E_NOTIMPL;
4432 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4433 int *values, UINT offset, UINT count)
4435 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4437 return E_NOTIMPL;
4440 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4441 float *values, UINT offset, UINT count)
4443 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4445 return E_NOTIMPL;
4448 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4449 BOOL *values, UINT offset, UINT count)
4451 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4453 return E_NOTIMPL;
4456 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4457 int *values, UINT offset, UINT count)
4459 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4461 return E_NOTIMPL;
4464 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4465 float *values, UINT offset, UINT count)
4467 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4469 return E_NOTIMPL;
4472 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4474 /* ID3D10EffectVariable methods */
4475 d3d10_effect_vector_variable_IsValid,
4476 d3d10_effect_vector_variable_GetType,
4477 d3d10_effect_vector_variable_GetDesc,
4478 d3d10_effect_vector_variable_GetAnnotationByIndex,
4479 d3d10_effect_vector_variable_GetAnnotationByName,
4480 d3d10_effect_vector_variable_GetMemberByIndex,
4481 d3d10_effect_vector_variable_GetMemberByName,
4482 d3d10_effect_vector_variable_GetMemberBySemantic,
4483 d3d10_effect_vector_variable_GetElement,
4484 d3d10_effect_vector_variable_GetParentConstantBuffer,
4485 d3d10_effect_vector_variable_AsScalar,
4486 d3d10_effect_vector_variable_AsVector,
4487 d3d10_effect_vector_variable_AsMatrix,
4488 d3d10_effect_vector_variable_AsString,
4489 d3d10_effect_vector_variable_AsShaderResource,
4490 d3d10_effect_vector_variable_AsRenderTargetView,
4491 d3d10_effect_vector_variable_AsDepthStencilView,
4492 d3d10_effect_vector_variable_AsConstantBuffer,
4493 d3d10_effect_vector_variable_AsShader,
4494 d3d10_effect_vector_variable_AsBlend,
4495 d3d10_effect_vector_variable_AsDepthStencil,
4496 d3d10_effect_vector_variable_AsRasterizer,
4497 d3d10_effect_vector_variable_AsSampler,
4498 d3d10_effect_vector_variable_SetRawValue,
4499 d3d10_effect_vector_variable_GetRawValue,
4500 /* ID3D10EffectVectorVariable methods */
4501 d3d10_effect_vector_variable_SetBoolVector,
4502 d3d10_effect_vector_variable_SetIntVector,
4503 d3d10_effect_vector_variable_SetFloatVector,
4504 d3d10_effect_vector_variable_GetBoolVector,
4505 d3d10_effect_vector_variable_GetIntVector,
4506 d3d10_effect_vector_variable_GetFloatVector,
4507 d3d10_effect_vector_variable_SetBoolVectorArray,
4508 d3d10_effect_vector_variable_SetIntVectorArray,
4509 d3d10_effect_vector_variable_SetFloatVectorArray,
4510 d3d10_effect_vector_variable_GetBoolVectorArray,
4511 d3d10_effect_vector_variable_GetIntVectorArray,
4512 d3d10_effect_vector_variable_GetFloatVectorArray,
4515 /* ID3D10EffectVariable methods */
4517 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4519 TRACE("iface %p\n", iface);
4521 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4524 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4525 ID3D10EffectMatrixVariable *iface)
4527 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4530 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4531 D3D10_EFFECT_VARIABLE_DESC *desc)
4533 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4536 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4537 ID3D10EffectMatrixVariable *iface, UINT index)
4539 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4542 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4543 ID3D10EffectMatrixVariable *iface, const char *name)
4545 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4548 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4549 ID3D10EffectMatrixVariable *iface, UINT index)
4551 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4554 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4555 ID3D10EffectMatrixVariable *iface, const char *name)
4557 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4560 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4561 ID3D10EffectMatrixVariable *iface, const char *semantic)
4563 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4566 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4567 ID3D10EffectMatrixVariable *iface, UINT index)
4569 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4572 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4573 ID3D10EffectMatrixVariable *iface)
4575 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4578 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4579 ID3D10EffectMatrixVariable *iface)
4581 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4584 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4585 ID3D10EffectMatrixVariable *iface)
4587 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4590 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4591 ID3D10EffectMatrixVariable *iface)
4593 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4596 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4597 ID3D10EffectMatrixVariable *iface)
4599 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4602 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4603 ID3D10EffectMatrixVariable *iface)
4605 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4608 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4609 ID3D10EffectMatrixVariable *iface)
4611 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4614 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4615 ID3D10EffectMatrixVariable *iface)
4617 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4620 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4621 ID3D10EffectMatrixVariable *iface)
4623 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4626 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4627 ID3D10EffectMatrixVariable *iface)
4629 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4632 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4633 ID3D10EffectMatrixVariable *iface)
4635 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4638 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4639 ID3D10EffectMatrixVariable *iface)
4641 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4644 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4645 ID3D10EffectMatrixVariable *iface)
4647 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4650 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4651 ID3D10EffectMatrixVariable *iface)
4653 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4656 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4657 void *data, UINT offset, UINT count)
4659 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4662 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4663 void *data, UINT offset, UINT count)
4665 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4668 /* ID3D10EffectMatrixVariable methods */
4670 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4671 float *data)
4673 FIXME("iface %p, data %p stub!\n", iface, data);
4675 return E_NOTIMPL;
4678 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4679 float *data)
4681 FIXME("iface %p, data %p stub!\n", iface, data);
4683 return E_NOTIMPL;
4686 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4687 float *data, UINT offset, UINT count)
4689 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4691 return E_NOTIMPL;
4694 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4695 float *data, UINT offset, UINT count)
4697 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4699 return E_NOTIMPL;
4702 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4703 float *data)
4705 FIXME("iface %p, data %p stub!\n", iface, data);
4707 return E_NOTIMPL;
4710 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4711 float *data)
4713 FIXME("iface %p, data %p stub!\n", iface, data);
4715 return E_NOTIMPL;
4718 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4719 float *data, UINT offset, UINT count)
4721 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4723 return E_NOTIMPL;
4726 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4727 float *data, UINT offset, UINT count)
4729 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4731 return E_NOTIMPL;
4735 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4737 /* ID3D10EffectVariable methods */
4738 d3d10_effect_matrix_variable_IsValid,
4739 d3d10_effect_matrix_variable_GetType,
4740 d3d10_effect_matrix_variable_GetDesc,
4741 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4742 d3d10_effect_matrix_variable_GetAnnotationByName,
4743 d3d10_effect_matrix_variable_GetMemberByIndex,
4744 d3d10_effect_matrix_variable_GetMemberByName,
4745 d3d10_effect_matrix_variable_GetMemberBySemantic,
4746 d3d10_effect_matrix_variable_GetElement,
4747 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4748 d3d10_effect_matrix_variable_AsScalar,
4749 d3d10_effect_matrix_variable_AsVector,
4750 d3d10_effect_matrix_variable_AsMatrix,
4751 d3d10_effect_matrix_variable_AsString,
4752 d3d10_effect_matrix_variable_AsShaderResource,
4753 d3d10_effect_matrix_variable_AsRenderTargetView,
4754 d3d10_effect_matrix_variable_AsDepthStencilView,
4755 d3d10_effect_matrix_variable_AsConstantBuffer,
4756 d3d10_effect_matrix_variable_AsShader,
4757 d3d10_effect_matrix_variable_AsBlend,
4758 d3d10_effect_matrix_variable_AsDepthStencil,
4759 d3d10_effect_matrix_variable_AsRasterizer,
4760 d3d10_effect_matrix_variable_AsSampler,
4761 d3d10_effect_matrix_variable_SetRawValue,
4762 d3d10_effect_matrix_variable_GetRawValue,
4763 /* ID3D10EffectMatrixVariable methods */
4764 d3d10_effect_matrix_variable_SetMatrix,
4765 d3d10_effect_matrix_variable_GetMatrix,
4766 d3d10_effect_matrix_variable_SetMatrixArray,
4767 d3d10_effect_matrix_variable_GetMatrixArray,
4768 d3d10_effect_matrix_variable_SetMatrixTranspose,
4769 d3d10_effect_matrix_variable_GetMatrixTranspose,
4770 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4771 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4774 /* ID3D10EffectVariable methods */
4776 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4778 TRACE("iface %p\n", iface);
4780 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4783 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4784 ID3D10EffectStringVariable *iface)
4786 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4789 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4790 D3D10_EFFECT_VARIABLE_DESC *desc)
4792 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4795 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4796 ID3D10EffectStringVariable *iface, UINT index)
4798 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4801 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4802 ID3D10EffectStringVariable *iface, const char *name)
4804 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4807 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4808 ID3D10EffectStringVariable *iface, UINT index)
4810 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4813 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4814 ID3D10EffectStringVariable *iface, const char *name)
4816 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4819 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4820 ID3D10EffectStringVariable *iface, const char *semantic)
4822 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4825 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4826 ID3D10EffectStringVariable *iface, UINT index)
4828 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4831 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4832 ID3D10EffectStringVariable *iface)
4834 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4837 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4838 ID3D10EffectStringVariable *iface)
4840 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4843 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4844 ID3D10EffectStringVariable *iface)
4846 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4849 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4850 ID3D10EffectStringVariable *iface)
4852 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4855 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4856 ID3D10EffectStringVariable *iface)
4858 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4861 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4862 ID3D10EffectStringVariable *iface)
4864 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4867 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4868 ID3D10EffectStringVariable *iface)
4870 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4873 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4874 ID3D10EffectStringVariable *iface)
4876 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4879 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4880 ID3D10EffectStringVariable *iface)
4882 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4885 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4886 ID3D10EffectStringVariable *iface)
4888 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4891 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4892 ID3D10EffectStringVariable *iface)
4894 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4897 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4898 ID3D10EffectStringVariable *iface)
4900 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4903 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4904 ID3D10EffectStringVariable *iface)
4906 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4909 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4910 ID3D10EffectStringVariable *iface)
4912 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4915 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4916 void *data, UINT offset, UINT count)
4918 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4921 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4922 void *data, UINT offset, UINT count)
4924 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4927 /* ID3D10EffectStringVariable methods */
4929 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4930 const char **str)
4932 FIXME("iface %p, str %p stub!\n", iface, str);
4934 return E_NOTIMPL;
4937 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4938 const char **strs, UINT offset, UINT count)
4940 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4942 return E_NOTIMPL;
4946 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4948 /* ID3D10EffectVariable methods */
4949 d3d10_effect_string_variable_IsValid,
4950 d3d10_effect_string_variable_GetType,
4951 d3d10_effect_string_variable_GetDesc,
4952 d3d10_effect_string_variable_GetAnnotationByIndex,
4953 d3d10_effect_string_variable_GetAnnotationByName,
4954 d3d10_effect_string_variable_GetMemberByIndex,
4955 d3d10_effect_string_variable_GetMemberByName,
4956 d3d10_effect_string_variable_GetMemberBySemantic,
4957 d3d10_effect_string_variable_GetElement,
4958 d3d10_effect_string_variable_GetParentConstantBuffer,
4959 d3d10_effect_string_variable_AsScalar,
4960 d3d10_effect_string_variable_AsVector,
4961 d3d10_effect_string_variable_AsMatrix,
4962 d3d10_effect_string_variable_AsString,
4963 d3d10_effect_string_variable_AsShaderResource,
4964 d3d10_effect_string_variable_AsRenderTargetView,
4965 d3d10_effect_string_variable_AsDepthStencilView,
4966 d3d10_effect_string_variable_AsConstantBuffer,
4967 d3d10_effect_string_variable_AsShader,
4968 d3d10_effect_string_variable_AsBlend,
4969 d3d10_effect_string_variable_AsDepthStencil,
4970 d3d10_effect_string_variable_AsRasterizer,
4971 d3d10_effect_string_variable_AsSampler,
4972 d3d10_effect_string_variable_SetRawValue,
4973 d3d10_effect_string_variable_GetRawValue,
4974 /* ID3D10EffectStringVariable methods */
4975 d3d10_effect_string_variable_GetString,
4976 d3d10_effect_string_variable_GetStringArray,
4979 /* ID3D10EffectVariable methods */
4981 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4983 TRACE("iface %p\n", iface);
4985 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4988 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4989 ID3D10EffectShaderResourceVariable *iface)
4991 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4994 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4995 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4997 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5000 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
5001 ID3D10EffectShaderResourceVariable *iface, UINT index)
5003 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5006 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
5007 ID3D10EffectShaderResourceVariable *iface, const char *name)
5009 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5012 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
5013 ID3D10EffectShaderResourceVariable *iface, UINT index)
5015 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5018 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
5019 ID3D10EffectShaderResourceVariable *iface, const char *name)
5021 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5024 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
5025 ID3D10EffectShaderResourceVariable *iface, const char *semantic)
5027 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5030 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
5031 ID3D10EffectShaderResourceVariable *iface, UINT index)
5033 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5036 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
5037 ID3D10EffectShaderResourceVariable *iface)
5039 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5042 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
5043 ID3D10EffectShaderResourceVariable *iface)
5045 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5048 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
5049 ID3D10EffectShaderResourceVariable *iface)
5051 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5054 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
5055 ID3D10EffectShaderResourceVariable *iface)
5057 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5060 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
5061 ID3D10EffectShaderResourceVariable *iface)
5063 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5066 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
5067 ID3D10EffectShaderResourceVariable *iface)
5069 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5072 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
5073 ID3D10EffectShaderResourceVariable *iface)
5075 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5078 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
5079 ID3D10EffectShaderResourceVariable *iface)
5081 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5084 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
5085 ID3D10EffectShaderResourceVariable *iface)
5087 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5090 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
5091 ID3D10EffectShaderResourceVariable *iface)
5093 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5096 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
5097 ID3D10EffectShaderResourceVariable *iface)
5099 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5102 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
5103 ID3D10EffectShaderResourceVariable *iface)
5105 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5108 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5109 ID3D10EffectShaderResourceVariable *iface)
5111 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5114 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5115 ID3D10EffectShaderResourceVariable *iface)
5117 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5120 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5121 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5123 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5126 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5127 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5129 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5132 /* ID3D10EffectShaderResourceVariable methods */
5134 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5135 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5137 FIXME("iface %p, resource %p stub!\n", iface, resource);
5139 return E_NOTIMPL;
5142 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5143 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5145 FIXME("iface %p, resource %p stub!\n", iface, resource);
5147 return E_NOTIMPL;
5150 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5151 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5153 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5155 return E_NOTIMPL;
5158 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5159 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5161 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5163 return E_NOTIMPL;
5167 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5169 /* ID3D10EffectVariable methods */
5170 d3d10_effect_shader_resource_variable_IsValid,
5171 d3d10_effect_shader_resource_variable_GetType,
5172 d3d10_effect_shader_resource_variable_GetDesc,
5173 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5174 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5175 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5176 d3d10_effect_shader_resource_variable_GetMemberByName,
5177 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5178 d3d10_effect_shader_resource_variable_GetElement,
5179 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5180 d3d10_effect_shader_resource_variable_AsScalar,
5181 d3d10_effect_shader_resource_variable_AsVector,
5182 d3d10_effect_shader_resource_variable_AsMatrix,
5183 d3d10_effect_shader_resource_variable_AsString,
5184 d3d10_effect_shader_resource_variable_AsShaderResource,
5185 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5186 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5187 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5188 d3d10_effect_shader_resource_variable_AsShader,
5189 d3d10_effect_shader_resource_variable_AsBlend,
5190 d3d10_effect_shader_resource_variable_AsDepthStencil,
5191 d3d10_effect_shader_resource_variable_AsRasterizer,
5192 d3d10_effect_shader_resource_variable_AsSampler,
5193 d3d10_effect_shader_resource_variable_SetRawValue,
5194 d3d10_effect_shader_resource_variable_GetRawValue,
5195 /* ID3D10EffectShaderResourceVariable methods */
5196 d3d10_effect_shader_resource_variable_SetResource,
5197 d3d10_effect_shader_resource_variable_GetResource,
5198 d3d10_effect_shader_resource_variable_SetResourceArray,
5199 d3d10_effect_shader_resource_variable_GetResourceArray,
5202 /* ID3D10EffectVariable methods */
5204 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5205 ID3D10EffectRenderTargetViewVariable *iface)
5207 TRACE("iface %p\n", iface);
5209 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5212 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5213 ID3D10EffectRenderTargetViewVariable *iface)
5215 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5218 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5219 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5221 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5224 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5225 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5227 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5230 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5231 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5233 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5236 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5237 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5239 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5242 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5243 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5245 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5248 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5249 ID3D10EffectRenderTargetViewVariable *iface, const char *semantic)
5251 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5254 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5255 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5257 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5260 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5261 ID3D10EffectRenderTargetViewVariable *iface)
5263 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5266 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5267 ID3D10EffectRenderTargetViewVariable *iface)
5269 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5272 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5273 ID3D10EffectRenderTargetViewVariable *iface)
5275 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5278 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5279 ID3D10EffectRenderTargetViewVariable *iface)
5281 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5284 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5285 ID3D10EffectRenderTargetViewVariable *iface)
5287 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5290 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5291 ID3D10EffectRenderTargetViewVariable *iface)
5293 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5296 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5297 ID3D10EffectRenderTargetViewVariable *iface)
5299 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5302 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5303 ID3D10EffectRenderTargetViewVariable *iface)
5305 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5308 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5309 ID3D10EffectRenderTargetViewVariable *iface)
5311 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5314 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5315 ID3D10EffectRenderTargetViewVariable *iface)
5317 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5320 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5321 ID3D10EffectRenderTargetViewVariable *iface)
5323 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5326 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5327 ID3D10EffectRenderTargetViewVariable *iface)
5329 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5332 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5333 ID3D10EffectRenderTargetViewVariable *iface)
5335 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5338 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5339 ID3D10EffectRenderTargetViewVariable *iface)
5341 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5344 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5345 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5347 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5350 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5351 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5353 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5356 /* ID3D10EffectRenderTargetViewVariable methods */
5358 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5359 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5361 FIXME("iface %p, view %p stub!\n", iface, view);
5363 return E_NOTIMPL;
5366 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5367 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5369 FIXME("iface %p, view %p stub!\n", iface, view);
5371 return E_NOTIMPL;
5374 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5375 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5377 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5379 return E_NOTIMPL;
5382 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5383 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5385 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5387 return E_NOTIMPL;
5391 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5393 /* ID3D10EffectVariable methods */
5394 d3d10_effect_render_target_view_variable_IsValid,
5395 d3d10_effect_render_target_view_variable_GetType,
5396 d3d10_effect_render_target_view_variable_GetDesc,
5397 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5398 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5399 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5400 d3d10_effect_render_target_view_variable_GetMemberByName,
5401 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5402 d3d10_effect_render_target_view_variable_GetElement,
5403 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5404 d3d10_effect_render_target_view_variable_AsScalar,
5405 d3d10_effect_render_target_view_variable_AsVector,
5406 d3d10_effect_render_target_view_variable_AsMatrix,
5407 d3d10_effect_render_target_view_variable_AsString,
5408 d3d10_effect_render_target_view_variable_AsShaderResource,
5409 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5410 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5411 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5412 d3d10_effect_render_target_view_variable_AsShader,
5413 d3d10_effect_render_target_view_variable_AsBlend,
5414 d3d10_effect_render_target_view_variable_AsDepthStencil,
5415 d3d10_effect_render_target_view_variable_AsRasterizer,
5416 d3d10_effect_render_target_view_variable_AsSampler,
5417 d3d10_effect_render_target_view_variable_SetRawValue,
5418 d3d10_effect_render_target_view_variable_GetRawValue,
5419 /* ID3D10EffectRenderTargetViewVariable methods */
5420 d3d10_effect_render_target_view_variable_SetRenderTarget,
5421 d3d10_effect_render_target_view_variable_GetRenderTarget,
5422 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5423 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5426 /* ID3D10EffectVariable methods */
5428 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5429 ID3D10EffectDepthStencilViewVariable *iface)
5431 TRACE("iface %p\n", iface);
5433 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5436 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5437 ID3D10EffectDepthStencilViewVariable *iface)
5439 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5442 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5443 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5445 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5448 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5449 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5451 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5454 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5455 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5457 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5460 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5461 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5463 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5466 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5467 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5469 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5472 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5473 ID3D10EffectDepthStencilViewVariable *iface, const char *semantic)
5475 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5478 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5479 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5481 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5484 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5485 ID3D10EffectDepthStencilViewVariable *iface)
5487 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5490 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5491 ID3D10EffectDepthStencilViewVariable *iface)
5493 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5496 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5497 ID3D10EffectDepthStencilViewVariable *iface)
5499 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5502 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5503 ID3D10EffectDepthStencilViewVariable *iface)
5505 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5508 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5509 ID3D10EffectDepthStencilViewVariable *iface)
5511 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5514 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5515 ID3D10EffectDepthStencilViewVariable *iface)
5517 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5520 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5521 ID3D10EffectDepthStencilViewVariable *iface)
5523 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5526 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5527 ID3D10EffectDepthStencilViewVariable *iface)
5529 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5532 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5533 ID3D10EffectDepthStencilViewVariable *iface)
5535 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5538 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5539 ID3D10EffectDepthStencilViewVariable *iface)
5541 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5544 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5545 ID3D10EffectDepthStencilViewVariable *iface)
5547 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5550 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5551 ID3D10EffectDepthStencilViewVariable *iface)
5553 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5556 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5557 ID3D10EffectDepthStencilViewVariable *iface)
5559 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5562 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5563 ID3D10EffectDepthStencilViewVariable *iface)
5565 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5568 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5569 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5571 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5574 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5575 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5577 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5580 /* ID3D10EffectDepthStencilViewVariable methods */
5582 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5583 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5585 FIXME("iface %p, view %p stub!\n", iface, view);
5587 return E_NOTIMPL;
5590 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5591 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5593 FIXME("iface %p, view %p stub!\n", iface, view);
5595 return E_NOTIMPL;
5598 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5599 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5601 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5603 return E_NOTIMPL;
5606 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5607 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5609 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5611 return E_NOTIMPL;
5615 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5617 /* ID3D10EffectVariable methods */
5618 d3d10_effect_depth_stencil_view_variable_IsValid,
5619 d3d10_effect_depth_stencil_view_variable_GetType,
5620 d3d10_effect_depth_stencil_view_variable_GetDesc,
5621 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5622 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5623 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5624 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5625 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5626 d3d10_effect_depth_stencil_view_variable_GetElement,
5627 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5628 d3d10_effect_depth_stencil_view_variable_AsScalar,
5629 d3d10_effect_depth_stencil_view_variable_AsVector,
5630 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5631 d3d10_effect_depth_stencil_view_variable_AsString,
5632 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5633 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5634 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5635 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5636 d3d10_effect_depth_stencil_view_variable_AsShader,
5637 d3d10_effect_depth_stencil_view_variable_AsBlend,
5638 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5639 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5640 d3d10_effect_depth_stencil_view_variable_AsSampler,
5641 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5642 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5643 /* ID3D10EffectDepthStencilViewVariable methods */
5644 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5645 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5646 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5647 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5650 /* ID3D10EffectVariable methods */
5652 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5654 TRACE("iface %p\n", iface);
5656 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5659 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5660 ID3D10EffectShaderVariable *iface)
5662 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5665 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5666 D3D10_EFFECT_VARIABLE_DESC *desc)
5668 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5671 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5672 ID3D10EffectShaderVariable *iface, UINT index)
5674 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5677 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5678 ID3D10EffectShaderVariable *iface, const char *name)
5680 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5683 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5684 ID3D10EffectShaderVariable *iface, UINT index)
5686 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5689 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5690 ID3D10EffectShaderVariable *iface, const char *name)
5692 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5695 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5696 ID3D10EffectShaderVariable *iface, const char *semantic)
5698 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5701 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5702 ID3D10EffectShaderVariable *iface, UINT index)
5704 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5707 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5708 ID3D10EffectShaderVariable *iface)
5710 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5713 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5714 ID3D10EffectShaderVariable *iface)
5716 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5719 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5720 ID3D10EffectShaderVariable *iface)
5722 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5725 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5726 ID3D10EffectShaderVariable *iface)
5728 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5731 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5732 ID3D10EffectShaderVariable *iface)
5734 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5737 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5738 ID3D10EffectShaderVariable *iface)
5740 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5743 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5744 ID3D10EffectShaderVariable *iface)
5746 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5749 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5750 ID3D10EffectShaderVariable *iface)
5752 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5755 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5756 ID3D10EffectShaderVariable *iface)
5758 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5761 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5762 ID3D10EffectShaderVariable *iface)
5764 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5767 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5768 ID3D10EffectShaderVariable *iface)
5770 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5773 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5774 ID3D10EffectShaderVariable *iface)
5776 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5779 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5780 ID3D10EffectShaderVariable *iface)
5782 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5785 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5786 ID3D10EffectShaderVariable *iface)
5788 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5791 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5792 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5794 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5797 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5798 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5800 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5803 /* ID3D10EffectShaderVariable methods */
5805 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5806 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5808 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5810 return E_NOTIMPL;
5813 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5814 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5816 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5818 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5820 if (v->type->element_count)
5821 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5823 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5825 WARN("Shader is not a vertex shader.\n");
5826 return E_FAIL;
5829 if ((*shader = v->u.shader.shader.vs))
5830 ID3D10VertexShader_AddRef(*shader);
5832 return S_OK;
5835 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5836 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5838 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5840 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5842 if (v->type->element_count)
5843 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5845 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5847 WARN("Shader is not a geometry shader.\n");
5848 return E_FAIL;
5851 if ((*shader = v->u.shader.shader.gs))
5852 ID3D10GeometryShader_AddRef(*shader);
5854 return S_OK;
5857 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5858 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5860 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5862 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5864 if (v->type->element_count)
5865 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5867 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5869 WARN("Shader is not a pixel shader.\n");
5870 return E_FAIL;
5873 if ((*shader = v->u.shader.shader.ps))
5874 ID3D10PixelShader_AddRef(*shader);
5876 return S_OK;
5879 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5880 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5881 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5883 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5884 struct d3d10_effect_shader_variable *s;
5885 D3D10_SIGNATURE_PARAMETER_DESC *d;
5887 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5888 iface, shader_index, element_index, desc);
5890 if (!iface->lpVtbl->IsValid(iface))
5892 WARN("Null variable specified\n");
5893 return E_FAIL;
5896 /* Check shader_index, this crashes on W7/DX10 */
5897 if (shader_index >= This->effect->used_shader_count)
5899 WARN("This should crash on W7/DX10!\n");
5900 return E_FAIL;
5903 s = &This->effect->used_shaders[shader_index]->u.shader;
5904 if (!s->input_signature.signature)
5906 WARN("No shader signature\n");
5907 return D3DERR_INVALIDCALL;
5910 /* Check desc for NULL, this crashes on W7/DX10 */
5911 if (!desc)
5913 WARN("This should crash on W7/DX10!\n");
5914 return E_FAIL;
5917 if (element_index >= s->input_signature.element_count)
5919 WARN("Invalid element index specified\n");
5920 return E_INVALIDARG;
5923 d = &s->input_signature.elements[element_index];
5924 desc->SemanticName = d->SemanticName;
5925 desc->SemanticIndex = d->SemanticIndex;
5926 desc->SystemValueType = d->SystemValueType;
5927 desc->ComponentType = d->ComponentType;
5928 desc->Register = d->Register;
5929 desc->ReadWriteMask = d->ReadWriteMask;
5930 desc->Mask = d->Mask;
5932 return S_OK;
5935 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5936 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5937 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5939 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5940 struct d3d10_effect_shader_variable *s;
5941 D3D10_SIGNATURE_PARAMETER_DESC *d;
5943 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5944 iface, shader_index, element_index, desc);
5946 if (!iface->lpVtbl->IsValid(iface))
5948 WARN("Null variable specified\n");
5949 return E_FAIL;
5952 /* Check shader_index, this crashes on W7/DX10 */
5953 if (shader_index >= This->effect->used_shader_count)
5955 WARN("This should crash on W7/DX10!\n");
5956 return E_FAIL;
5959 s = &This->effect->used_shaders[shader_index]->u.shader;
5960 if (!s->output_signature.signature)
5962 WARN("No shader signature\n");
5963 return D3DERR_INVALIDCALL;
5966 /* Check desc for NULL, this crashes on W7/DX10 */
5967 if (!desc)
5969 WARN("This should crash on W7/DX10!\n");
5970 return E_FAIL;
5973 if (element_index >= s->output_signature.element_count)
5975 WARN("Invalid element index specified\n");
5976 return E_INVALIDARG;
5979 d = &s->output_signature.elements[element_index];
5980 desc->SemanticName = d->SemanticName;
5981 desc->SemanticIndex = d->SemanticIndex;
5982 desc->SystemValueType = d->SystemValueType;
5983 desc->ComponentType = d->ComponentType;
5984 desc->Register = d->Register;
5985 desc->ReadWriteMask = d->ReadWriteMask;
5986 desc->Mask = d->Mask;
5988 return S_OK;
5992 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5994 /* ID3D10EffectVariable methods */
5995 d3d10_effect_shader_variable_IsValid,
5996 d3d10_effect_shader_variable_GetType,
5997 d3d10_effect_shader_variable_GetDesc,
5998 d3d10_effect_shader_variable_GetAnnotationByIndex,
5999 d3d10_effect_shader_variable_GetAnnotationByName,
6000 d3d10_effect_shader_variable_GetMemberByIndex,
6001 d3d10_effect_shader_variable_GetMemberByName,
6002 d3d10_effect_shader_variable_GetMemberBySemantic,
6003 d3d10_effect_shader_variable_GetElement,
6004 d3d10_effect_shader_variable_GetParentConstantBuffer,
6005 d3d10_effect_shader_variable_AsScalar,
6006 d3d10_effect_shader_variable_AsVector,
6007 d3d10_effect_shader_variable_AsMatrix,
6008 d3d10_effect_shader_variable_AsString,
6009 d3d10_effect_shader_variable_AsShaderResource,
6010 d3d10_effect_shader_variable_AsRenderTargetView,
6011 d3d10_effect_shader_variable_AsDepthStencilView,
6012 d3d10_effect_shader_variable_AsConstantBuffer,
6013 d3d10_effect_shader_variable_AsShader,
6014 d3d10_effect_shader_variable_AsBlend,
6015 d3d10_effect_shader_variable_AsDepthStencil,
6016 d3d10_effect_shader_variable_AsRasterizer,
6017 d3d10_effect_shader_variable_AsSampler,
6018 d3d10_effect_shader_variable_SetRawValue,
6019 d3d10_effect_shader_variable_GetRawValue,
6020 /* ID3D10EffectShaderVariable methods */
6021 d3d10_effect_shader_variable_GetShaderDesc,
6022 d3d10_effect_shader_variable_GetVertexShader,
6023 d3d10_effect_shader_variable_GetGeometryShader,
6024 d3d10_effect_shader_variable_GetPixelShader,
6025 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
6026 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
6029 /* ID3D10EffectVariable methods */
6031 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
6033 TRACE("iface %p\n", iface);
6035 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
6038 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
6039 ID3D10EffectBlendVariable *iface)
6041 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6044 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
6045 D3D10_EFFECT_VARIABLE_DESC *desc)
6047 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6050 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
6051 ID3D10EffectBlendVariable *iface, UINT index)
6053 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6056 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
6057 ID3D10EffectBlendVariable *iface, const char *name)
6059 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6062 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
6063 ID3D10EffectBlendVariable *iface, UINT index)
6065 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6068 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
6069 ID3D10EffectBlendVariable *iface, const char *name)
6071 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6074 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
6075 ID3D10EffectBlendVariable *iface, const char *semantic)
6077 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6080 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
6081 ID3D10EffectBlendVariable *iface, UINT index)
6083 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6086 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
6087 ID3D10EffectBlendVariable *iface)
6089 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6092 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
6093 ID3D10EffectBlendVariable *iface)
6095 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6098 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
6099 ID3D10EffectBlendVariable *iface)
6101 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6104 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6105 ID3D10EffectBlendVariable *iface)
6107 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6110 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6111 ID3D10EffectBlendVariable *iface)
6113 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6116 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6117 ID3D10EffectBlendVariable *iface)
6119 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6122 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6123 ID3D10EffectBlendVariable *iface)
6125 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6128 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6129 ID3D10EffectBlendVariable *iface)
6131 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6134 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6135 ID3D10EffectBlendVariable *iface)
6137 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6140 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6141 ID3D10EffectBlendVariable *iface)
6143 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6146 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6147 ID3D10EffectBlendVariable *iface)
6149 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6152 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6153 ID3D10EffectBlendVariable *iface)
6155 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6158 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6159 ID3D10EffectBlendVariable *iface)
6161 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6164 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6165 ID3D10EffectBlendVariable *iface)
6167 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6170 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6171 void *data, UINT offset, UINT count)
6173 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6176 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6177 void *data, UINT offset, UINT count)
6179 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6182 /* ID3D10EffectBlendVariable methods */
6184 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6185 UINT index, ID3D10BlendState **blend_state)
6187 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6189 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6191 if (v->type->element_count)
6192 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6193 else if (index)
6194 return E_FAIL;
6196 if (v->type->basetype != D3D10_SVT_BLEND)
6198 WARN("Variable is not a blend state.\n");
6199 return E_FAIL;
6202 if ((*blend_state = v->u.state.object.blend))
6203 ID3D10BlendState_AddRef(*blend_state);
6205 return S_OK;
6208 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6209 UINT index, D3D10_BLEND_DESC *desc)
6211 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6213 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6215 if (v->type->element_count)
6216 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6218 if (v->type->basetype != D3D10_SVT_BLEND)
6220 WARN("Variable is not a blend state.\n");
6221 return E_FAIL;
6224 *desc = v->u.state.desc.blend;
6226 return S_OK;
6230 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6232 /* ID3D10EffectVariable methods */
6233 d3d10_effect_blend_variable_IsValid,
6234 d3d10_effect_blend_variable_GetType,
6235 d3d10_effect_blend_variable_GetDesc,
6236 d3d10_effect_blend_variable_GetAnnotationByIndex,
6237 d3d10_effect_blend_variable_GetAnnotationByName,
6238 d3d10_effect_blend_variable_GetMemberByIndex,
6239 d3d10_effect_blend_variable_GetMemberByName,
6240 d3d10_effect_blend_variable_GetMemberBySemantic,
6241 d3d10_effect_blend_variable_GetElement,
6242 d3d10_effect_blend_variable_GetParentConstantBuffer,
6243 d3d10_effect_blend_variable_AsScalar,
6244 d3d10_effect_blend_variable_AsVector,
6245 d3d10_effect_blend_variable_AsMatrix,
6246 d3d10_effect_blend_variable_AsString,
6247 d3d10_effect_blend_variable_AsShaderResource,
6248 d3d10_effect_blend_variable_AsRenderTargetView,
6249 d3d10_effect_blend_variable_AsDepthStencilView,
6250 d3d10_effect_blend_variable_AsConstantBuffer,
6251 d3d10_effect_blend_variable_AsShader,
6252 d3d10_effect_blend_variable_AsBlend,
6253 d3d10_effect_blend_variable_AsDepthStencil,
6254 d3d10_effect_blend_variable_AsRasterizer,
6255 d3d10_effect_blend_variable_AsSampler,
6256 d3d10_effect_blend_variable_SetRawValue,
6257 d3d10_effect_blend_variable_GetRawValue,
6258 /* ID3D10EffectBlendVariable methods */
6259 d3d10_effect_blend_variable_GetBlendState,
6260 d3d10_effect_blend_variable_GetBackingStore,
6263 /* ID3D10EffectVariable methods */
6265 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6267 TRACE("iface %p\n", iface);
6269 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6272 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6273 ID3D10EffectDepthStencilVariable *iface)
6275 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6278 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6279 D3D10_EFFECT_VARIABLE_DESC *desc)
6281 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6284 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6285 ID3D10EffectDepthStencilVariable *iface, UINT index)
6287 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6290 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6291 ID3D10EffectDepthStencilVariable *iface, const char *name)
6293 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6296 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6297 ID3D10EffectDepthStencilVariable *iface, UINT index)
6299 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6302 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6303 ID3D10EffectDepthStencilVariable *iface, const char *name)
6305 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6308 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6309 ID3D10EffectDepthStencilVariable *iface, const char *semantic)
6311 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6314 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6315 ID3D10EffectDepthStencilVariable *iface, UINT index)
6317 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6320 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6321 ID3D10EffectDepthStencilVariable *iface)
6323 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6326 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6327 ID3D10EffectDepthStencilVariable *iface)
6329 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6332 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6333 ID3D10EffectDepthStencilVariable *iface)
6335 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6338 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6339 ID3D10EffectDepthStencilVariable *iface)
6341 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6344 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6345 ID3D10EffectDepthStencilVariable *iface)
6347 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6350 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6351 ID3D10EffectDepthStencilVariable *iface)
6353 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6356 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6357 ID3D10EffectDepthStencilVariable *iface)
6359 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6362 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6363 ID3D10EffectDepthStencilVariable *iface)
6365 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6368 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6369 ID3D10EffectDepthStencilVariable *iface)
6371 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6374 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6375 ID3D10EffectDepthStencilVariable *iface)
6377 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6380 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6381 ID3D10EffectDepthStencilVariable *iface)
6383 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6386 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6387 ID3D10EffectDepthStencilVariable *iface)
6389 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6392 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6393 ID3D10EffectDepthStencilVariable *iface)
6395 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6398 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6399 ID3D10EffectDepthStencilVariable *iface)
6401 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6404 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6405 void *data, UINT offset, UINT count)
6407 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6410 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6411 void *data, UINT offset, UINT count)
6413 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6416 /* ID3D10EffectDepthStencilVariable methods */
6418 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6419 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6421 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6423 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6425 if (v->type->element_count)
6426 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6427 else if (index)
6428 return E_FAIL;
6430 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6432 WARN("Variable is not a depth stencil state.\n");
6433 return E_FAIL;
6436 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6437 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6439 return S_OK;
6442 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6443 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6445 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6447 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6449 if (v->type->element_count)
6450 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6452 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6454 WARN("Variable is not a depth stencil state.\n");
6455 return E_FAIL;
6458 *desc = v->u.state.desc.depth_stencil;
6460 return S_OK;
6464 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6466 /* ID3D10EffectVariable methods */
6467 d3d10_effect_depth_stencil_variable_IsValid,
6468 d3d10_effect_depth_stencil_variable_GetType,
6469 d3d10_effect_depth_stencil_variable_GetDesc,
6470 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6471 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6472 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6473 d3d10_effect_depth_stencil_variable_GetMemberByName,
6474 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6475 d3d10_effect_depth_stencil_variable_GetElement,
6476 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6477 d3d10_effect_depth_stencil_variable_AsScalar,
6478 d3d10_effect_depth_stencil_variable_AsVector,
6479 d3d10_effect_depth_stencil_variable_AsMatrix,
6480 d3d10_effect_depth_stencil_variable_AsString,
6481 d3d10_effect_depth_stencil_variable_AsShaderResource,
6482 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6483 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6484 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6485 d3d10_effect_depth_stencil_variable_AsShader,
6486 d3d10_effect_depth_stencil_variable_AsBlend,
6487 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6488 d3d10_effect_depth_stencil_variable_AsRasterizer,
6489 d3d10_effect_depth_stencil_variable_AsSampler,
6490 d3d10_effect_depth_stencil_variable_SetRawValue,
6491 d3d10_effect_depth_stencil_variable_GetRawValue,
6492 /* ID3D10EffectDepthStencilVariable methods */
6493 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6494 d3d10_effect_depth_stencil_variable_GetBackingStore,
6497 /* ID3D10EffectVariable methods */
6499 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6501 TRACE("iface %p\n", iface);
6503 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6506 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6507 ID3D10EffectRasterizerVariable *iface)
6509 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6512 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6513 D3D10_EFFECT_VARIABLE_DESC *desc)
6515 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6518 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6519 ID3D10EffectRasterizerVariable *iface, UINT index)
6521 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6524 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6525 ID3D10EffectRasterizerVariable *iface, const char *name)
6527 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6530 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6531 ID3D10EffectRasterizerVariable *iface, UINT index)
6533 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6536 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6537 ID3D10EffectRasterizerVariable *iface, const char *name)
6539 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6542 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6543 ID3D10EffectRasterizerVariable *iface, const char *semantic)
6545 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6548 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6549 ID3D10EffectRasterizerVariable *iface, UINT index)
6551 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6554 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6555 ID3D10EffectRasterizerVariable *iface)
6557 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6560 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6561 ID3D10EffectRasterizerVariable *iface)
6563 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6566 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6567 ID3D10EffectRasterizerVariable *iface)
6569 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6572 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6573 ID3D10EffectRasterizerVariable *iface)
6575 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6578 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6579 ID3D10EffectRasterizerVariable *iface)
6581 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6584 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6585 ID3D10EffectRasterizerVariable *iface)
6587 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6590 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6591 ID3D10EffectRasterizerVariable *iface)
6593 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6596 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6597 ID3D10EffectRasterizerVariable *iface)
6599 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6602 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6603 ID3D10EffectRasterizerVariable *iface)
6605 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6608 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6609 ID3D10EffectRasterizerVariable *iface)
6611 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6614 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6615 ID3D10EffectRasterizerVariable *iface)
6617 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6620 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6621 ID3D10EffectRasterizerVariable *iface)
6623 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6626 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6627 ID3D10EffectRasterizerVariable *iface)
6629 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6632 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6633 ID3D10EffectRasterizerVariable *iface)
6635 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6638 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6639 void *data, UINT offset, UINT count)
6641 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6644 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6645 void *data, UINT offset, UINT count)
6647 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6650 /* ID3D10EffectRasterizerVariable methods */
6652 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6653 UINT index, ID3D10RasterizerState **rasterizer_state)
6655 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6657 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6659 if (v->type->element_count)
6660 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6661 else if (index)
6662 return E_FAIL;
6664 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6666 WARN("Variable is not a rasterizer state.\n");
6667 return E_FAIL;
6670 if ((*rasterizer_state = v->u.state.object.rasterizer))
6671 ID3D10RasterizerState_AddRef(*rasterizer_state);
6673 return S_OK;
6676 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6677 UINT index, D3D10_RASTERIZER_DESC *desc)
6679 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6681 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6683 if (v->type->element_count)
6684 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6686 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6688 WARN("Variable is not a rasterizer state.\n");
6689 return E_FAIL;
6692 *desc = v->u.state.desc.rasterizer;
6694 return S_OK;
6698 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6700 /* ID3D10EffectVariable methods */
6701 d3d10_effect_rasterizer_variable_IsValid,
6702 d3d10_effect_rasterizer_variable_GetType,
6703 d3d10_effect_rasterizer_variable_GetDesc,
6704 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6705 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6706 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6707 d3d10_effect_rasterizer_variable_GetMemberByName,
6708 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6709 d3d10_effect_rasterizer_variable_GetElement,
6710 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6711 d3d10_effect_rasterizer_variable_AsScalar,
6712 d3d10_effect_rasterizer_variable_AsVector,
6713 d3d10_effect_rasterizer_variable_AsMatrix,
6714 d3d10_effect_rasterizer_variable_AsString,
6715 d3d10_effect_rasterizer_variable_AsShaderResource,
6716 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6717 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6718 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6719 d3d10_effect_rasterizer_variable_AsShader,
6720 d3d10_effect_rasterizer_variable_AsBlend,
6721 d3d10_effect_rasterizer_variable_AsDepthStencil,
6722 d3d10_effect_rasterizer_variable_AsRasterizer,
6723 d3d10_effect_rasterizer_variable_AsSampler,
6724 d3d10_effect_rasterizer_variable_SetRawValue,
6725 d3d10_effect_rasterizer_variable_GetRawValue,
6726 /* ID3D10EffectRasterizerVariable methods */
6727 d3d10_effect_rasterizer_variable_GetRasterizerState,
6728 d3d10_effect_rasterizer_variable_GetBackingStore,
6731 /* ID3D10EffectVariable methods */
6733 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6735 TRACE("iface %p\n", iface);
6737 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6740 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6741 ID3D10EffectSamplerVariable *iface)
6743 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6746 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6747 D3D10_EFFECT_VARIABLE_DESC *desc)
6749 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6752 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6753 ID3D10EffectSamplerVariable *iface, UINT index)
6755 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6758 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6759 ID3D10EffectSamplerVariable *iface, const char *name)
6761 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6764 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6765 ID3D10EffectSamplerVariable *iface, UINT index)
6767 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6770 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6771 ID3D10EffectSamplerVariable *iface, const char *name)
6773 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6776 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6777 ID3D10EffectSamplerVariable *iface, const char *semantic)
6779 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6782 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6783 ID3D10EffectSamplerVariable *iface, UINT index)
6785 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6788 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6789 ID3D10EffectSamplerVariable *iface)
6791 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6794 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6795 ID3D10EffectSamplerVariable *iface)
6797 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6800 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6801 ID3D10EffectSamplerVariable *iface)
6803 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6806 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6807 ID3D10EffectSamplerVariable *iface)
6809 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6812 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6813 ID3D10EffectSamplerVariable *iface)
6815 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6818 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6819 ID3D10EffectSamplerVariable *iface)
6821 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6824 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6825 ID3D10EffectSamplerVariable *iface)
6827 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6830 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6831 ID3D10EffectSamplerVariable *iface)
6833 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6836 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6837 ID3D10EffectSamplerVariable *iface)
6839 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6842 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6843 ID3D10EffectSamplerVariable *iface)
6845 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6848 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6849 ID3D10EffectSamplerVariable *iface)
6851 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6854 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6855 ID3D10EffectSamplerVariable *iface)
6857 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6860 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6861 ID3D10EffectSamplerVariable *iface)
6863 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6866 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6867 ID3D10EffectSamplerVariable *iface)
6869 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6872 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6873 void *data, UINT offset, UINT count)
6875 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6878 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6879 void *data, UINT offset, UINT count)
6881 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6884 /* ID3D10EffectSamplerVariable methods */
6886 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6887 UINT index, ID3D10SamplerState **sampler)
6889 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6891 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6893 if (v->type->element_count)
6894 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6895 else if (index)
6896 return E_FAIL;
6898 if (v->type->basetype != D3D10_SVT_SAMPLER)
6900 WARN("Variable is not a sampler state.\n");
6901 return E_FAIL;
6904 if ((*sampler = v->u.state.object.sampler))
6905 ID3D10SamplerState_AddRef(*sampler);
6907 return S_OK;
6910 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6911 UINT index, D3D10_SAMPLER_DESC *desc)
6913 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6915 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6917 if (v->type->element_count)
6918 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6920 if (v->type->basetype != D3D10_SVT_SAMPLER)
6922 WARN("Variable is not a sampler state.\n");
6923 return E_FAIL;
6926 *desc = v->u.state.desc.sampler;
6928 return S_OK;
6932 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6934 /* ID3D10EffectVariable methods */
6935 d3d10_effect_sampler_variable_IsValid,
6936 d3d10_effect_sampler_variable_GetType,
6937 d3d10_effect_sampler_variable_GetDesc,
6938 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6939 d3d10_effect_sampler_variable_GetAnnotationByName,
6940 d3d10_effect_sampler_variable_GetMemberByIndex,
6941 d3d10_effect_sampler_variable_GetMemberByName,
6942 d3d10_effect_sampler_variable_GetMemberBySemantic,
6943 d3d10_effect_sampler_variable_GetElement,
6944 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6945 d3d10_effect_sampler_variable_AsScalar,
6946 d3d10_effect_sampler_variable_AsVector,
6947 d3d10_effect_sampler_variable_AsMatrix,
6948 d3d10_effect_sampler_variable_AsString,
6949 d3d10_effect_sampler_variable_AsShaderResource,
6950 d3d10_effect_sampler_variable_AsRenderTargetView,
6951 d3d10_effect_sampler_variable_AsDepthStencilView,
6952 d3d10_effect_sampler_variable_AsConstantBuffer,
6953 d3d10_effect_sampler_variable_AsShader,
6954 d3d10_effect_sampler_variable_AsBlend,
6955 d3d10_effect_sampler_variable_AsDepthStencil,
6956 d3d10_effect_sampler_variable_AsRasterizer,
6957 d3d10_effect_sampler_variable_AsSampler,
6958 d3d10_effect_sampler_variable_SetRawValue,
6959 d3d10_effect_sampler_variable_GetRawValue,
6960 /* ID3D10EffectSamplerVariable methods */
6961 d3d10_effect_sampler_variable_GetSampler,
6962 d3d10_effect_sampler_variable_GetBackingStore,
6965 /* ID3D10EffectType methods */
6967 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6969 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6972 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6974 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6976 TRACE("iface %p\n", iface);
6978 return This != &null_type;
6981 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6983 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6985 TRACE("iface %p, desc %p\n", iface, desc);
6987 if (This == &null_type)
6989 WARN("Null type specified\n");
6990 return E_FAIL;
6993 if (!desc)
6995 WARN("Invalid argument specified\n");
6996 return E_INVALIDARG;
6999 desc->TypeName = This->name;
7000 desc->Class = This->type_class;
7001 desc->Type = This->basetype;
7002 desc->Elements = This->element_count;
7003 desc->Members = This->member_count;
7004 desc->Rows = This->row_count;
7005 desc->Columns = This->column_count;
7006 desc->PackedSize = This->size_packed;
7007 desc->UnpackedSize = This->size_unpacked;
7008 desc->Stride = This->stride;
7010 return S_OK;
7013 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
7014 UINT index)
7016 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7017 struct d3d10_effect_type *t;
7019 TRACE("iface %p, index %u\n", iface, index);
7021 if (index >= This->member_count)
7023 WARN("Invalid index specified\n");
7024 return &null_type.ID3D10EffectType_iface;
7027 t = (&This->members[index])->type;
7029 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
7031 return &t->ID3D10EffectType_iface;
7034 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
7035 const char *name)
7037 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7038 unsigned int i;
7040 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
7042 if (!name)
7044 WARN("Invalid name specified\n");
7045 return &null_type.ID3D10EffectType_iface;
7048 for (i = 0; i < This->member_count; ++i)
7050 struct d3d10_effect_type_member *typem = &This->members[i];
7052 if (typem->name && !strcmp(typem->name, name))
7054 TRACE("Returning type %p.\n", typem->type);
7055 return &typem->type->ID3D10EffectType_iface;
7059 WARN("Invalid name specified\n");
7061 return &null_type.ID3D10EffectType_iface;
7064 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
7065 const char *semantic)
7067 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7068 unsigned int i;
7070 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
7072 if (!semantic)
7074 WARN("Invalid semantic specified\n");
7075 return &null_type.ID3D10EffectType_iface;
7078 for (i = 0; i < This->member_count; ++i)
7080 struct d3d10_effect_type_member *typem = &This->members[i];
7082 if (typem->semantic && !strcmp(typem->semantic, semantic))
7084 TRACE("Returning type %p.\n", typem->type);
7085 return &typem->type->ID3D10EffectType_iface;
7089 WARN("Invalid semantic specified\n");
7091 return &null_type.ID3D10EffectType_iface;
7094 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
7096 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7097 struct d3d10_effect_type_member *typem;
7099 TRACE("iface %p, index %u\n", iface, index);
7101 if (index >= This->member_count)
7103 WARN("Invalid index specified\n");
7104 return NULL;
7107 typem = &This->members[index];
7109 TRACE("Returning name %s\n", debugstr_a(typem->name));
7111 return typem->name;
7114 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7116 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7117 struct d3d10_effect_type_member *typem;
7119 TRACE("iface %p, index %u\n", iface, index);
7121 if (index >= This->member_count)
7123 WARN("Invalid index specified\n");
7124 return NULL;
7127 typem = &This->members[index];
7129 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7131 return typem->semantic;
7134 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7136 /* ID3D10EffectType */
7137 d3d10_effect_type_IsValid,
7138 d3d10_effect_type_GetDesc,
7139 d3d10_effect_type_GetMemberTypeByIndex,
7140 d3d10_effect_type_GetMemberTypeByName,
7141 d3d10_effect_type_GetMemberTypeBySemantic,
7142 d3d10_effect_type_GetMemberName,
7143 d3d10_effect_type_GetMemberSemantic,