kernel32/tests: Add a test to check some fields in fake dlls.
[wine.git] / dlls / d3d10 / effect.c
blobcd6f4a3e1d158edcacdd0a309135584e5d7bd834
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 = heap_alloc(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 if (!(*name = heap_alloc(name_len)))
313 ERR("Failed to allocate name memory.\n");
314 return FALSE;
317 memcpy(*name, ptr, name_len);
319 return TRUE;
322 static const char *shader_get_string(const char *data, size_t data_size, DWORD offset)
324 const char *s;
325 size_t l;
327 if (!fx10_get_string(data, data_size, offset, &s, &l))
328 return NULL;
330 return l ? s : "";
333 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
335 D3D10_SIGNATURE_PARAMETER_DESC *e;
336 const char *ptr = data;
337 unsigned int i;
338 DWORD count;
340 if (!require_space(0, 2, sizeof(DWORD), data_size))
342 WARN("Invalid data size %#x.\n", data_size);
343 return E_INVALIDARG;
346 read_dword(&ptr, &count);
347 TRACE("%u elements\n", count);
349 skip_dword_unknown("shader signature", &ptr, 1);
351 if (!require_space(ptr - data, count, 6 * sizeof(DWORD), data_size))
353 WARN("Invalid count %#x (data size %#x).\n", count, data_size);
354 return E_INVALIDARG;
357 if (!(e = heap_calloc(count, sizeof(*e))))
359 ERR("Failed to allocate signature memory.\n");
360 return E_OUTOFMEMORY;
363 for (i = 0; i < count; ++i)
365 UINT name_offset;
366 UINT mask;
368 read_dword(&ptr, &name_offset);
369 if (!(e[i].SemanticName = shader_get_string(data, data_size, name_offset)))
371 WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
372 heap_free(e);
373 return E_INVALIDARG;
375 read_dword(&ptr, &e[i].SemanticIndex);
376 read_dword(&ptr, &e[i].SystemValueType);
377 read_dword(&ptr, &e[i].ComponentType);
378 read_dword(&ptr, &e[i].Register);
379 read_dword(&ptr, &mask);
381 e[i].ReadWriteMask = mask >> 8;
382 e[i].Mask = mask & 0xff;
384 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
385 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
386 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
387 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
390 s->elements = e;
391 s->element_count = count;
393 return S_OK;
396 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
398 heap_free(s->signature);
399 heap_free(s->elements);
402 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
404 struct d3d10_effect_shader_variable *s = ctx;
405 HRESULT hr;
407 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
409 TRACE("chunk size: %#x\n", data_size);
411 switch(tag)
413 case TAG_ISGN:
414 case TAG_OSGN:
416 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
417 UINT size = 44 + data_size;
418 struct d3d10_effect_shader_signature *sig;
419 char *ptr;
421 if (tag == TAG_ISGN) sig = &s->input_signature;
422 else sig = &s->output_signature;
424 if (!(sig->signature = heap_alloc_zero(size)))
426 ERR("Failed to allocate input signature data\n");
427 return E_OUTOFMEMORY;
429 sig->signature_size = size;
431 ptr = sig->signature;
433 write_dword(&ptr, TAG_DXBC);
435 /* signature(?) */
436 write_dword_unknown(&ptr, 0);
437 write_dword_unknown(&ptr, 0);
438 write_dword_unknown(&ptr, 0);
439 write_dword_unknown(&ptr, 0);
441 /* seems to be always 1 */
442 write_dword_unknown(&ptr, 1);
444 /* DXBC size */
445 write_dword(&ptr, size);
447 /* chunk count */
448 write_dword(&ptr, 1);
450 /* chunk index */
451 write_dword(&ptr, (ptr - sig->signature) + 4);
453 /* chunk */
454 write_dword(&ptr, tag);
455 write_dword(&ptr, data_size);
456 memcpy(ptr, data, data_size);
458 hr = shader_parse_signature(ptr, data_size, sig);
459 if (FAILED(hr))
461 ERR("Failed to parse shader, hr %#x\n", hr);
462 shader_free_signature(sig);
465 break;
468 default:
469 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
470 break;
473 return S_OK;
476 static HRESULT parse_fx10_shader(const char *data, size_t data_size, DWORD offset, struct d3d10_effect_variable *v)
478 ID3D10Device *device = v->effect->device;
479 DWORD dxbc_size;
480 const char *ptr;
481 HRESULT hr;
483 if (v->effect->used_shader_current >= v->effect->used_shader_count)
485 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
486 return E_FAIL;
489 v->effect->used_shaders[v->effect->used_shader_current] = v;
490 ++v->effect->used_shader_current;
492 if (offset >= data_size || !require_space(offset, 1, sizeof(dxbc_size), data_size))
494 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
495 return E_FAIL;
498 ptr = data + offset;
499 read_dword(&ptr, &dxbc_size);
500 TRACE("dxbc size: %#x\n", dxbc_size);
502 if (!require_space(ptr - data, 1, dxbc_size, data_size))
504 WARN("Invalid dxbc size %#x (data size %#lx, offset %#x).\n", offset, (long)data_size, offset);
505 return E_FAIL;
508 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
509 if (!dxbc_size) return S_OK;
511 switch (v->type->basetype)
513 case D3D10_SVT_VERTEXSHADER:
514 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &v->u.shader.shader.vs);
515 if (FAILED(hr)) return hr;
516 break;
518 case D3D10_SVT_PIXELSHADER:
519 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &v->u.shader.shader.ps);
520 if (FAILED(hr)) return hr;
521 break;
523 case D3D10_SVT_GEOMETRYSHADER:
524 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &v->u.shader.shader.gs);
525 if (FAILED(hr)) return hr;
526 break;
528 default:
529 ERR("This should not happen!\n");
530 return E_FAIL;
533 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, &v->u.shader);
536 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
538 switch (c)
540 case 1: return D3D10_SVC_SCALAR;
541 case 2: return D3D10_SVC_VECTOR;
542 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
543 else return D3D10_SVC_MATRIX_ROWS;
544 default:
545 FIXME("Unknown variable class %#x.\n", c);
546 return 0;
550 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
552 if(is_object)
554 switch (t)
556 case 1: return D3D10_SVT_STRING;
557 case 2: return D3D10_SVT_BLEND;
558 case 3: return D3D10_SVT_DEPTHSTENCIL;
559 case 4: return D3D10_SVT_RASTERIZER;
560 case 5: return D3D10_SVT_PIXELSHADER;
561 case 6: return D3D10_SVT_VERTEXSHADER;
562 case 7: return D3D10_SVT_GEOMETRYSHADER;
564 case 10: return D3D10_SVT_TEXTURE1D;
565 case 11: return D3D10_SVT_TEXTURE1DARRAY;
566 case 12: return D3D10_SVT_TEXTURE2D;
567 case 13: return D3D10_SVT_TEXTURE2DARRAY;
568 case 14: return D3D10_SVT_TEXTURE2DMS;
569 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
570 case 16: return D3D10_SVT_TEXTURE3D;
571 case 17: return D3D10_SVT_TEXTURECUBE;
573 case 19: return D3D10_SVT_RENDERTARGETVIEW;
574 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
575 case 21: return D3D10_SVT_SAMPLER;
576 case 22: return D3D10_SVT_BUFFER;
577 default:
578 FIXME("Unknown variable type %#x.\n", t);
579 return D3D10_SVT_VOID;
582 else
584 switch (t)
586 case 1: return D3D10_SVT_FLOAT;
587 case 2: return D3D10_SVT_INT;
588 case 3: return D3D10_SVT_UINT;
589 case 4: return D3D10_SVT_BOOL;
590 default:
591 FIXME("Unknown variable type %#x.\n", t);
592 return D3D10_SVT_VOID;
597 static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset, struct d3d10_effect_type *t)
599 const char *ptr;
600 DWORD unknown0;
601 DWORD typeinfo;
602 unsigned int i;
604 if (offset >= data_size || !require_space(offset, 6, sizeof(DWORD), data_size))
606 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
607 return E_FAIL;
610 ptr = data + offset;
611 read_dword(&ptr, &offset);
612 TRACE("Type name at offset %#x.\n", offset);
614 if (!fx10_copy_string(data, data_size, offset, &t->name))
616 ERR("Failed to copy name.\n");
617 return E_OUTOFMEMORY;
619 TRACE("Type name: %s.\n", debugstr_a(t->name));
621 read_dword(&ptr, &unknown0);
622 TRACE("Unknown 0: %u.\n", unknown0);
624 read_dword(&ptr, &t->element_count);
625 TRACE("Element count: %u.\n", t->element_count);
627 read_dword(&ptr, &t->size_unpacked);
628 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
630 read_dword(&ptr, &t->stride);
631 TRACE("Stride: %#x.\n", t->stride);
633 read_dword(&ptr, &t->size_packed);
634 TRACE("Packed size %#x.\n", t->size_packed);
636 switch (unknown0)
638 case 1:
639 if (!require_space(ptr - data, 1, sizeof(typeinfo), data_size))
641 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
642 return E_FAIL;
645 read_dword(&ptr, &typeinfo);
646 t->member_count = 0;
647 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
648 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
649 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
650 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);
652 TRACE("Type description: %#x.\n", typeinfo);
653 TRACE("\tcolumns: %u.\n", t->column_count);
654 TRACE("\trows: %u.\n", t->row_count);
655 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
656 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
657 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
658 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
659 break;
661 case 2:
662 TRACE("Type is an object.\n");
664 if (!require_space(ptr - data, 1, sizeof(typeinfo), data_size))
666 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
667 return E_FAIL;
670 read_dword(&ptr, &typeinfo);
671 t->member_count = 0;
672 t->column_count = 0;
673 t->row_count = 0;
674 t->basetype = d3d10_variable_type(typeinfo, TRUE);
675 t->type_class = D3D10_SVC_OBJECT;
677 TRACE("Type description: %#x.\n", typeinfo);
678 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
679 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
680 break;
682 case 3:
683 TRACE("Type is a structure.\n");
685 if (!require_space(ptr - data, 1, sizeof(t->member_count), data_size))
687 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
688 return E_FAIL;
691 read_dword(&ptr, &t->member_count);
692 TRACE("Member count: %u.\n", t->member_count);
694 t->column_count = 0;
695 t->row_count = 0;
696 t->basetype = 0;
697 t->type_class = D3D10_SVC_STRUCT;
699 if (!(t->members = heap_calloc(t->member_count, sizeof(*t->members))))
701 ERR("Failed to allocate members memory.\n");
702 return E_OUTOFMEMORY;
705 if (!require_space(ptr - data, t->member_count, 4 * sizeof(DWORD), data_size))
707 WARN("Invalid member count %#x (data size %#lx, offset %#x).\n",
708 t->member_count, (long)data_size, offset);
709 return E_FAIL;
712 for (i = 0; i < t->member_count; ++i)
714 struct d3d10_effect_type_member *typem = &t->members[i];
716 read_dword(&ptr, &offset);
717 TRACE("Member name at offset %#x.\n", offset);
719 if (!fx10_copy_string(data, data_size, offset, &typem->name))
721 ERR("Failed to copy name.\n");
722 return E_OUTOFMEMORY;
724 TRACE("Member name: %s.\n", debugstr_a(typem->name));
726 read_dword(&ptr, &offset);
727 TRACE("Member semantic at offset %#x.\n", offset);
729 if (!fx10_copy_string(data, data_size, offset, &typem->semantic))
731 ERR("Failed to copy semantic.\n");
732 return E_OUTOFMEMORY;
734 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
736 read_dword(&ptr, &typem->buffer_offset);
737 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
739 read_dword(&ptr, &offset);
740 TRACE("Member type info at offset %#x.\n", offset);
742 if (!(typem->type = get_fx10_type(t->effect, data, data_size, offset)))
744 ERR("Failed to get variable type.\n");
745 return E_FAIL;
748 break;
750 default:
751 FIXME("Unhandled case %#x.\n", unknown0);
752 return E_FAIL;
755 if (t->element_count)
757 TRACE("Elementtype for type at offset: %#x\n", t->id);
759 /* allocate elementtype - we need only one, because all elements have the same type */
760 if (!(t->elementtype = heap_alloc_zero(sizeof(*t->elementtype))))
762 ERR("Failed to allocate members memory.\n");
763 return E_OUTOFMEMORY;
766 /* create a copy of the original type with some minor changes */
767 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
768 t->elementtype->effect = t->effect;
770 if (!copy_name(t->name, &t->elementtype->name))
772 ERR("Failed to copy name.\n");
773 return E_OUTOFMEMORY;
775 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
777 t->elementtype->element_count = 0;
778 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
781 * Not sure if this calculation is 100% correct, but a test
782 * shows that these values work.
784 t->elementtype->size_unpacked = t->size_packed / t->element_count;
785 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
787 t->elementtype->stride = t->stride;
788 TRACE("\tStride: %#x.\n", t->elementtype->stride);
790 t->elementtype->size_packed = t->size_packed / t->element_count;
791 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
793 t->elementtype->member_count = t->member_count;
794 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
796 t->elementtype->column_count = t->column_count;
797 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
799 t->elementtype->row_count = t->row_count;
800 TRACE("\tRows: %u.\n", t->elementtype->row_count);
802 t->elementtype->basetype = t->basetype;
803 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
805 t->elementtype->type_class = t->type_class;
806 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
808 t->elementtype->members = t->members;
811 return S_OK;
814 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
815 const char *data, size_t data_size, DWORD offset)
817 struct d3d10_effect_type *type;
818 struct wine_rb_entry *entry;
819 HRESULT hr;
821 entry = wine_rb_get(&effect->types, &offset);
822 if (entry)
824 TRACE("Returning existing type.\n");
825 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
828 if (!(type = heap_alloc_zero(sizeof(*type))))
830 ERR("Failed to allocate type memory.\n");
831 return NULL;
834 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
835 type->id = offset;
836 type->effect = effect;
837 if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
839 ERR("Failed to parse type info, hr %#x.\n", hr);
840 heap_free(type);
841 return NULL;
844 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
846 ERR("Failed to insert type entry.\n");
847 heap_free(type);
848 return NULL;
851 return type;
854 static void set_variable_vtbl(struct d3d10_effect_variable *v)
856 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
858 switch (v->type->type_class)
860 case D3D10_SVC_SCALAR:
861 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
862 break;
864 case D3D10_SVC_VECTOR:
865 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
866 break;
868 case D3D10_SVC_MATRIX_ROWS:
869 case D3D10_SVC_MATRIX_COLUMNS:
870 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
871 break;
873 case D3D10_SVC_STRUCT:
874 *vtbl = &d3d10_effect_variable_vtbl;
875 break;
877 case D3D10_SVC_OBJECT:
878 switch(v->type->basetype)
880 case D3D10_SVT_STRING:
881 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
882 break;
884 case D3D10_SVT_TEXTURE1D:
885 case D3D10_SVT_TEXTURE1DARRAY:
886 case D3D10_SVT_TEXTURE2D:
887 case D3D10_SVT_TEXTURE2DARRAY:
888 case D3D10_SVT_TEXTURE2DMS:
889 case D3D10_SVT_TEXTURE2DMSARRAY:
890 case D3D10_SVT_TEXTURE3D:
891 case D3D10_SVT_TEXTURECUBE:
892 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
893 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
894 break;
896 case D3D10_SVT_RENDERTARGETVIEW:
897 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
898 break;
900 case D3D10_SVT_DEPTHSTENCILVIEW:
901 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
902 break;
904 case D3D10_SVT_DEPTHSTENCIL:
905 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
906 break;
908 case D3D10_SVT_VERTEXSHADER:
909 case D3D10_SVT_GEOMETRYSHADER:
910 case D3D10_SVT_PIXELSHADER:
911 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
912 break;
914 case D3D10_SVT_BLEND:
915 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
916 break;
918 case D3D10_SVT_RASTERIZER:
919 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
920 break;
922 case D3D10_SVT_SAMPLER:
923 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
924 break;
926 default:
927 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
928 *vtbl = &d3d10_effect_variable_vtbl;
929 break;
931 break;
933 default:
934 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
935 *vtbl = &d3d10_effect_variable_vtbl;
936 break;
940 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
942 unsigned int i;
943 HRESULT hr;
945 if (v->type->member_count)
947 if (!(v->members = heap_calloc(v->type->member_count, sizeof(*v->members))))
949 ERR("Failed to allocate members memory.\n");
950 return E_OUTOFMEMORY;
953 for (i = 0; i < v->type->member_count; ++i)
955 struct d3d10_effect_variable *var = &v->members[i];
956 struct d3d10_effect_type_member *typem = &v->type->members[i];
958 var->buffer = v->buffer;
959 var->effect = v->effect;
960 var->type = typem->type;
961 set_variable_vtbl(var);
963 if (!copy_name(typem->name, &var->name))
965 ERR("Failed to copy name.\n");
966 return E_OUTOFMEMORY;
968 TRACE("Variable name: %s.\n", debugstr_a(var->name));
970 if (!copy_name(typem->semantic, &var->semantic))
972 ERR("Failed to copy name.\n");
973 return E_OUTOFMEMORY;
975 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
977 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
978 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
980 hr = copy_variableinfo_from_type(var);
981 if (FAILED(hr)) return hr;
985 if (v->type->element_count)
987 unsigned int bufferoffset = v->buffer_offset;
989 if (!(v->elements = heap_calloc(v->type->element_count, sizeof(*v->elements))))
991 ERR("Failed to allocate elements memory.\n");
992 return E_OUTOFMEMORY;
995 for (i = 0; i < v->type->element_count; ++i)
997 struct d3d10_effect_variable *var = &v->elements[i];
999 var->buffer = v->buffer;
1000 var->effect = v->effect;
1001 var->type = v->type->elementtype;
1002 set_variable_vtbl(var);
1004 if (!copy_name(v->name, &var->name))
1006 ERR("Failed to copy name.\n");
1007 return E_OUTOFMEMORY;
1009 TRACE("Variable name: %s.\n", debugstr_a(var->name));
1011 if (!copy_name(v->semantic, &var->semantic))
1013 ERR("Failed to copy name.\n");
1014 return E_OUTOFMEMORY;
1016 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
1018 if (i != 0)
1020 bufferoffset += v->type->stride;
1022 var->buffer_offset = bufferoffset;
1023 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
1025 hr = copy_variableinfo_from_type(var);
1026 if (FAILED(hr)) return hr;
1030 return S_OK;
1033 static HRESULT parse_fx10_variable_head(const char *data, size_t data_size,
1034 const char **ptr, struct d3d10_effect_variable *v)
1036 DWORD offset;
1038 read_dword(ptr, &offset);
1039 TRACE("Variable name at offset %#x.\n", offset);
1041 if (!fx10_copy_string(data, data_size, offset, &v->name))
1043 ERR("Failed to copy name.\n");
1044 return E_OUTOFMEMORY;
1046 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1048 read_dword(ptr, &offset);
1049 TRACE("Variable type info at offset %#x.\n", offset);
1051 if (!(v->type = get_fx10_type(v->effect, data, data_size, offset)))
1053 ERR("Failed to get variable type.\n");
1054 return E_FAIL;
1056 set_variable_vtbl(v);
1058 return copy_variableinfo_from_type(v);
1061 static HRESULT parse_fx10_annotation(const char *data, size_t data_size,
1062 const char **ptr, struct d3d10_effect_variable *a)
1064 HRESULT hr;
1066 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, a)))
1067 return hr;
1069 skip_dword_unknown("annotation", ptr, 1);
1071 /* mark the variable as annotation */
1072 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
1074 return S_OK;
1077 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
1078 enum d3d10_effect_object_type otype)
1080 struct d3d10_effect_variable *v = &s->shader;
1081 struct d3d10_effect_type *t = &s->type;
1082 const char *shader = NULL;
1084 switch (otype)
1086 case D3D10_EOT_VERTEXSHADER:
1087 shader = "vertexshader";
1088 t->basetype = D3D10_SVT_VERTEXSHADER;
1089 break;
1091 case D3D10_EOT_PIXELSHADER:
1092 shader = "pixelshader";
1093 t->basetype = D3D10_SVT_PIXELSHADER;
1094 break;
1096 case D3D10_EOT_GEOMETRYSHADER:
1097 shader = "geometryshader";
1098 t->basetype = D3D10_SVT_GEOMETRYSHADER;
1099 break;
1101 default:
1102 FIXME("Unhandled object type %#x.\n", otype);
1103 return E_FAIL;
1106 if (!copy_name(shader, &t->name))
1108 ERR("Failed to copy name.\n");
1109 return E_OUTOFMEMORY;
1111 TRACE("Type name: %s.\n", debugstr_a(t->name));
1113 t->type_class = D3D10_SVC_OBJECT;
1115 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1117 v->type = t;
1118 v->effect = e;
1119 set_variable_vtbl(v);
1121 if (!copy_name("$Anonymous", &v->name))
1123 ERR("Failed to copy semantic.\n");
1124 return E_OUTOFMEMORY;
1126 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1128 if (!copy_name(NULL, &v->semantic))
1130 ERR("Failed to copy semantic.\n");
1131 return E_OUTOFMEMORY;
1133 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1135 return S_OK;
1138 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1140 unsigned int i;
1142 for (i = 0; i < ARRAY_SIZE(property_info); ++i)
1144 if (property_info[i].id == id)
1145 return &property_info[i];
1148 return NULL;
1151 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1153 unsigned int i;
1155 for (i = 0; i < ARRAY_SIZE(d3d10_effect_state_storage_info); ++i)
1157 if (d3d10_effect_state_storage_info[i].id == id)
1158 return &d3d10_effect_state_storage_info[i];
1161 return NULL;
1164 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1166 switch (in_type)
1168 case D3D10_SVT_FLOAT:
1169 out_data[idx] = *(float *)&value;
1170 return TRUE;
1172 case D3D10_SVT_INT:
1173 out_data[idx] = (INT)value;
1174 return TRUE;
1176 default:
1177 FIXME("Unhandled in_type %#x.\n", in_type);
1178 return FALSE;
1182 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1184 switch (in_type)
1186 case D3D10_SVT_FLOAT:
1187 out_data[idx] = *(float *)&value;
1188 return TRUE;
1190 case D3D10_SVT_INT:
1191 case D3D10_SVT_UINT:
1192 case D3D10_SVT_BOOL:
1193 out_data[idx] = value;
1194 return TRUE;
1196 default:
1197 FIXME("Unhandled in_type %#x.\n", in_type);
1198 return FALSE;
1202 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1204 switch (in_type)
1206 case D3D10_SVT_INT:
1207 case D3D10_SVT_UINT:
1208 out_data[idx] = value;
1209 return TRUE;
1211 default:
1212 FIXME("Unhandled in_type %#x.\n", in_type);
1213 return FALSE;
1217 static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
1218 D3D_SHADER_VARIABLE_TYPE out_type, UINT out_base, UINT out_size, void *out_data)
1220 D3D_SHADER_VARIABLE_TYPE in_type;
1221 const char *ptr;
1222 DWORD t, value;
1223 DWORD count, i;
1225 if (offset >= data_size || !require_space(offset, 1, sizeof(count), data_size))
1227 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1228 return FALSE;
1231 ptr = data + offset;
1232 read_dword(&ptr, &count);
1233 if (count != out_size)
1234 return FALSE;
1236 if (!require_space(ptr - data, count, 2 * sizeof(DWORD), data_size))
1238 WARN("Invalid value count %#x (offset %#x, data size %#lx).\n", count, offset, (long)data_size);
1239 return FALSE;
1242 TRACE("%u values:\n", count);
1243 for (i = 0; i < count; ++i)
1245 UINT out_idx = out_base * out_size + i;
1247 read_dword(&ptr, &t);
1248 read_dword(&ptr, &value);
1250 in_type = d3d10_variable_type(t, FALSE);
1251 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1253 switch (out_type)
1255 case D3D10_SVT_FLOAT:
1256 if (!read_float_value(value, in_type, out_data, out_idx))
1257 return FALSE;
1258 break;
1260 case D3D10_SVT_INT:
1261 case D3D10_SVT_UINT:
1262 case D3D10_SVT_BOOL:
1263 if (!read_int32_value(value, in_type, out_data, out_idx))
1264 return FALSE;
1265 break;
1267 case D3D10_SVT_UINT8:
1268 if (!read_int8_value(value, in_type, out_data, out_idx))
1269 return FALSE;
1270 break;
1272 default:
1273 FIXME("Unhandled out_type %#x.\n", out_type);
1274 return FALSE;
1278 return TRUE;
1281 static BOOL parse_fx10_state_group(const char *data, size_t data_size,
1282 const char **ptr, D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1284 const struct d3d10_effect_state_property_info *property_info;
1285 UINT value_offset;
1286 unsigned int i;
1287 DWORD count;
1288 UINT idx;
1289 UINT id;
1291 read_dword(ptr, &count);
1292 TRACE("Property count: %#x.\n", count);
1294 for (i = 0; i < count; ++i)
1296 read_dword(ptr, &id);
1297 read_dword(ptr, &idx);
1298 skip_dword_unknown("read property", ptr, 1);
1299 read_dword(ptr, &value_offset);
1301 if (!(property_info = get_property_info(id)))
1303 FIXME("Failed to find property info for property %#x.\n", id);
1304 return FALSE;
1307 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1308 property_info->name, idx, value_offset);
1310 if (property_info->container_type != container_type)
1312 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1313 return FALSE;
1316 if (idx >= property_info->count)
1318 ERR("Invalid index %#x for property %#x.\n", idx, id);
1319 return FALSE;
1322 if (!read_value_list(data, data_size, value_offset, property_info->type, idx,
1323 property_info->size, (char *)container + property_info->offset))
1325 ERR("Failed to read values for property %#x.\n", id);
1326 return FALSE;
1330 return TRUE;
1333 static HRESULT parse_fx10_object(const char *data, size_t data_size,
1334 const char **ptr, struct d3d10_effect_object *o)
1336 ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface;
1337 const char *data_ptr = NULL;
1338 DWORD offset;
1339 enum d3d10_effect_object_operation operation;
1340 HRESULT hr;
1341 struct d3d10_effect *effect = o->pass->technique->effect;
1342 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1343 struct d3d10_effect_variable *v;
1344 DWORD tmp, variable_idx = 0;
1345 const char *name;
1346 size_t name_len;
1348 if (!require_space(*ptr - data, 4, sizeof(DWORD), data_size))
1350 WARN("Invalid offset %#lx (data size %#lx).\n", (long)(*ptr - data), (long)data_size);
1351 return E_FAIL;
1354 read_dword(ptr, &o->type);
1355 TRACE("Effect object is of type %#x.\n", o->type);
1357 read_dword(ptr, &tmp);
1358 TRACE("Effect object index %#x.\n", tmp);
1360 read_dword(ptr, &operation);
1361 TRACE("Effect object operation %#x.\n", operation);
1363 read_dword(ptr, &offset);
1364 TRACE("Effect object idx is at offset %#x.\n", offset);
1366 switch(operation)
1368 case D3D10_EOO_VALUE:
1369 TRACE("Copy variable values\n");
1371 switch (o->type)
1373 case D3D10_EOT_VERTEXSHADER:
1374 TRACE("Vertex shader\n");
1375 variable = &anonymous_vs.ID3D10EffectVariable_iface;
1376 break;
1378 case D3D10_EOT_PIXELSHADER:
1379 TRACE("Pixel shader\n");
1380 variable = &anonymous_ps.ID3D10EffectVariable_iface;
1381 break;
1383 case D3D10_EOT_GEOMETRYSHADER:
1384 TRACE("Geometry shader\n");
1385 variable = &anonymous_gs.ID3D10EffectVariable_iface;
1386 break;
1388 case D3D10_EOT_STENCIL_REF:
1389 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1391 ERR("Failed to read stencil ref.\n");
1392 return E_FAIL;
1394 break;
1396 case D3D10_EOT_SAMPLE_MASK:
1397 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1399 FIXME("Failed to read sample mask.\n");
1400 return E_FAIL;
1402 break;
1404 case D3D10_EOT_BLEND_FACTOR:
1405 if (!read_value_list(data, data_size, offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1407 FIXME("Failed to read blend factor.\n");
1408 return E_FAIL;
1410 break;
1412 default:
1413 FIXME("Unhandled object type %#x\n", o->type);
1414 return E_FAIL;
1416 break;
1418 case D3D10_EOO_PARSED_OBJECT:
1419 /* This is a local object, we've parsed in parse_fx10_local_object. */
1420 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1422 WARN("Failed to get variable name.\n");
1423 return E_FAIL;
1425 TRACE("Variable name %s.\n", debugstr_a(name));
1427 variable = e->lpVtbl->GetVariableByName(e, name);
1428 break;
1430 case D3D10_EOO_PARSED_OBJECT_INDEX:
1431 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1432 if (offset >= data_size || !require_space(offset, 2, sizeof(DWORD), data_size))
1434 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1435 return E_FAIL;
1437 data_ptr = data + offset;
1438 read_dword(&data_ptr, &offset);
1439 read_dword(&data_ptr, &variable_idx);
1441 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1443 WARN("Failed to get variable name.\n");
1444 return E_FAIL;
1447 TRACE("Variable name %s[%u].\n", debugstr_a(name), variable_idx);
1449 variable = e->lpVtbl->GetVariableByName(e, name);
1450 break;
1452 case D3D10_EOO_ANONYMOUS_SHADER:
1453 TRACE("Anonymous shader\n");
1455 /* check anonymous_shader_current for validity */
1456 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1458 ERR("Anonymous shader count is wrong!\n");
1459 return E_FAIL;
1462 if (offset >= data_size || !require_space(offset, 1, sizeof(DWORD), data_size))
1464 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1465 return E_FAIL;
1467 data_ptr = data + offset;
1468 read_dword(&data_ptr, &offset);
1469 TRACE("Effect object starts at offset %#x.\n", offset);
1471 if (FAILED(hr = parse_fx10_anonymous_shader(effect,
1472 &effect->anonymous_shaders[effect->anonymous_shader_current], o->type)))
1473 return hr;
1475 v = &effect->anonymous_shaders[effect->anonymous_shader_current].shader;
1476 variable = &v->ID3D10EffectVariable_iface;
1477 ++effect->anonymous_shader_current;
1479 switch (o->type)
1481 case D3D10_EOT_VERTEXSHADER:
1482 case D3D10_EOT_PIXELSHADER:
1483 case D3D10_EOT_GEOMETRYSHADER:
1484 if (FAILED(hr = parse_fx10_shader(data, data_size, offset, v)))
1485 return hr;
1486 break;
1488 default:
1489 FIXME("Unhandled object type %#x\n", o->type);
1490 return E_FAIL;
1492 break;
1494 default:
1495 FIXME("Unhandled operation %#x.\n", operation);
1496 return E_FAIL;
1499 switch (o->type)
1501 case D3D10_EOT_RASTERIZER_STATE:
1503 ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
1504 if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
1505 return hr;
1506 break;
1509 case D3D10_EOT_DEPTH_STENCIL_STATE:
1511 ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable);
1512 if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds)))
1513 return hr;
1514 break;
1517 case D3D10_EOT_BLEND_STATE:
1519 ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
1520 if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
1521 return hr;
1522 break;
1525 case D3D10_EOT_VERTEXSHADER:
1527 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1528 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1529 return hr;
1530 o->pass->vs.pShaderVariable = sv;
1531 o->pass->vs.ShaderIndex = variable_idx;
1532 break;
1535 case D3D10_EOT_PIXELSHADER:
1537 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1538 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1539 return hr;
1540 o->pass->ps.pShaderVariable = sv;
1541 o->pass->ps.ShaderIndex = variable_idx;
1542 break;
1545 case D3D10_EOT_GEOMETRYSHADER:
1547 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1548 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1549 return hr;
1550 o->pass->gs.pShaderVariable = sv;
1551 o->pass->gs.ShaderIndex = variable_idx;
1552 break;
1555 case D3D10_EOT_STENCIL_REF:
1556 case D3D10_EOT_BLEND_FACTOR:
1557 case D3D10_EOT_SAMPLE_MASK:
1558 break;
1560 default:
1561 FIXME("Unhandled object type %#x.\n", o->type);
1562 return E_FAIL;
1565 return S_OK;
1568 static HRESULT parse_fx10_pass(const char *data, size_t data_size,
1569 const char **ptr, struct d3d10_effect_pass *p)
1571 HRESULT hr = S_OK;
1572 unsigned int i;
1573 DWORD offset;
1575 read_dword(ptr, &offset);
1576 TRACE("Pass name at offset %#x.\n", offset);
1578 if (!fx10_copy_string(data, data_size, offset, &p->name))
1580 ERR("Failed to copy name.\n");
1581 return E_OUTOFMEMORY;
1583 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1585 read_dword(ptr, &p->object_count);
1586 TRACE("Pass has %u effect objects.\n", p->object_count);
1588 read_dword(ptr, &p->annotation_count);
1589 TRACE("Pass has %u annotations.\n", p->annotation_count);
1591 if (!(p->annotations = heap_calloc(p->annotation_count, sizeof(*p->annotations))))
1593 ERR("Failed to allocate pass annotations memory.\n");
1594 return E_OUTOFMEMORY;
1597 for (i = 0; i < p->annotation_count; ++i)
1599 struct d3d10_effect_variable *a = &p->annotations[i];
1601 a->effect = p->technique->effect;
1602 a->buffer = &null_local_buffer;
1604 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1605 return hr;
1608 if (!(p->objects = heap_calloc(p->object_count, sizeof(*p->objects))))
1610 ERR("Failed to allocate effect objects memory.\n");
1611 return E_OUTOFMEMORY;
1614 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1615 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1616 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1618 for (i = 0; i < p->object_count; ++i)
1620 struct d3d10_effect_object *o = &p->objects[i];
1622 o->pass = p;
1624 if (FAILED(hr = parse_fx10_object(data, data_size, ptr, o)))
1625 return hr;
1628 return hr;
1631 static HRESULT parse_fx10_technique(const char *data, size_t data_size,
1632 const char **ptr, struct d3d10_effect_technique *t)
1634 unsigned int i;
1635 DWORD offset;
1636 HRESULT hr;
1638 read_dword(ptr, &offset);
1639 TRACE("Technique name at offset %#x.\n", offset);
1641 if (!fx10_copy_string(data, data_size, offset, &t->name))
1643 ERR("Failed to copy name.\n");
1644 return E_OUTOFMEMORY;
1646 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1648 read_dword(ptr, &t->pass_count);
1649 TRACE("Technique has %u passes\n", t->pass_count);
1651 read_dword(ptr, &t->annotation_count);
1652 TRACE("Technique has %u annotations.\n", t->annotation_count);
1654 if (!(t->annotations = heap_calloc(t->annotation_count, sizeof(*t->annotations))))
1656 ERR("Failed to allocate technique annotations memory.\n");
1657 return E_OUTOFMEMORY;
1660 for (i = 0; i < t->annotation_count; ++i)
1662 struct d3d10_effect_variable *a = &t->annotations[i];
1664 a->effect = t->effect;
1665 a->buffer = &null_local_buffer;
1667 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1668 return hr;
1671 if (!(t->passes = heap_calloc(t->pass_count, sizeof(*t->passes))))
1673 ERR("Failed to allocate passes memory\n");
1674 return E_OUTOFMEMORY;
1677 for (i = 0; i < t->pass_count; ++i)
1679 struct d3d10_effect_pass *p = &t->passes[i];
1681 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1682 p->technique = t;
1684 if (FAILED(hr = parse_fx10_pass(data, data_size, ptr, p)))
1685 return hr;
1688 return S_OK;
1691 static HRESULT parse_fx10_variable(const char *data, size_t data_size,
1692 const char **ptr, struct d3d10_effect_variable *v)
1694 DWORD offset;
1695 unsigned int i;
1696 HRESULT hr;
1698 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1699 return hr;
1701 read_dword(ptr, &offset);
1702 TRACE("Variable semantic at offset %#x.\n", offset);
1704 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1706 ERR("Failed to copy semantic.\n");
1707 return E_OUTOFMEMORY;
1709 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1711 read_dword(ptr, &v->buffer_offset);
1712 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1714 skip_dword_unknown("variable", ptr, 1);
1716 read_dword(ptr, &v->flag);
1717 TRACE("Variable flag: %#x.\n", v->flag);
1719 read_dword(ptr, &v->annotation_count);
1720 TRACE("Variable has %u annotations.\n", v->annotation_count);
1722 if (!(v->annotations = heap_calloc(v->annotation_count, sizeof(*v->annotations))))
1724 ERR("Failed to allocate variable annotations memory.\n");
1725 return E_OUTOFMEMORY;
1728 for (i = 0; i < v->annotation_count; ++i)
1730 struct d3d10_effect_variable *a = &v->annotations[i];
1732 a->effect = v->effect;
1733 a->buffer = &null_local_buffer;
1735 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1736 return hr;
1739 return S_OK;
1742 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1744 ID3D10Device *device = v->effect->device;
1745 HRESULT hr;
1747 switch (v->type->basetype)
1749 case D3D10_SVT_DEPTHSTENCIL:
1750 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1751 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1752 return hr;
1753 break;
1755 case D3D10_SVT_BLEND:
1756 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1757 &v->u.state.desc.blend, &v->u.state.object.blend)))
1758 return hr;
1759 break;
1761 case D3D10_SVT_RASTERIZER:
1762 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1763 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1764 return hr;
1765 break;
1767 case D3D10_SVT_SAMPLER:
1768 if (FAILED(hr = ID3D10Device_CreateSamplerState(device,
1769 &v->u.state.desc.sampler, &v->u.state.object.sampler)))
1770 return hr;
1771 break;
1773 default:
1774 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1775 return E_FAIL;
1778 return S_OK;
1781 static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
1782 const char **ptr, struct d3d10_effect_variable *v)
1784 unsigned int i;
1785 HRESULT hr;
1786 DWORD offset;
1788 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1789 return hr;
1791 read_dword(ptr, &offset);
1792 TRACE("Variable semantic at offset %#x.\n", offset);
1794 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1796 ERR("Failed to copy semantic.\n");
1797 return E_OUTOFMEMORY;
1799 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1801 skip_dword_unknown("local variable", ptr, 1);
1803 switch (v->type->basetype)
1805 case D3D10_SVT_TEXTURE1D:
1806 case D3D10_SVT_TEXTURE1DARRAY:
1807 case D3D10_SVT_TEXTURE2D:
1808 case D3D10_SVT_TEXTURE2DARRAY:
1809 case D3D10_SVT_TEXTURE2DMS:
1810 case D3D10_SVT_TEXTURE2DMSARRAY:
1811 case D3D10_SVT_TEXTURE3D:
1812 case D3D10_SVT_TEXTURECUBE:
1813 case D3D10_SVT_RENDERTARGETVIEW:
1814 case D3D10_SVT_DEPTHSTENCILVIEW:
1815 case D3D10_SVT_BUFFER:
1816 TRACE("SVT could not have elements.\n");
1817 break;
1819 case D3D10_SVT_VERTEXSHADER:
1820 case D3D10_SVT_PIXELSHADER:
1821 case D3D10_SVT_GEOMETRYSHADER:
1822 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1823 for (i = 0; i < max(v->type->element_count, 1); ++i)
1825 DWORD shader_offset;
1826 struct d3d10_effect_variable *var;
1828 if (!v->type->element_count)
1830 var = v;
1832 else
1834 var = &v->elements[i];
1837 read_dword(ptr, &shader_offset);
1838 TRACE("Shader offset: %#x.\n", shader_offset);
1840 if (FAILED(hr = parse_fx10_shader(data, data_size, shader_offset, var)))
1841 return hr;
1843 break;
1845 case D3D10_SVT_DEPTHSTENCIL:
1846 case D3D10_SVT_BLEND:
1847 case D3D10_SVT_RASTERIZER:
1848 case D3D10_SVT_SAMPLER:
1850 const struct d3d10_effect_state_storage_info *storage_info;
1851 unsigned int count = max(v->type->element_count, 1);
1853 if (!(storage_info = get_storage_info(v->type->basetype)))
1855 FIXME("Failed to get backing store info for type %s.\n",
1856 debug_d3d10_shader_variable_type(v->type->basetype));
1857 return E_FAIL;
1860 if (storage_info->size > sizeof(v->u.state.desc))
1862 ERR("Invalid storage size %#lx.\n", storage_info->size);
1863 return E_FAIL;
1866 for (i = 0; i < count; ++i)
1868 struct d3d10_effect_variable *var;
1870 if (v->type->element_count)
1871 var = &v->elements[i];
1872 else
1873 var = v;
1875 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1876 if (!parse_fx10_state_group(data, data_size, ptr, var->type->basetype, &var->u.state.desc))
1878 ERR("Failed to read property list.\n");
1879 return E_FAIL;
1882 if (FAILED(hr = create_state_object(v)))
1883 return hr;
1886 break;
1888 default:
1889 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1890 return E_FAIL;
1893 read_dword(ptr, &v->annotation_count);
1894 TRACE("Variable has %u annotations.\n", v->annotation_count);
1896 if (!(v->annotations = heap_calloc(v->annotation_count, sizeof(*v->annotations))))
1898 ERR("Failed to allocate variable annotations memory.\n");
1899 return E_OUTOFMEMORY;
1902 for (i = 0; i < v->annotation_count; ++i)
1904 struct d3d10_effect_variable *a = &v->annotations[i];
1906 a->effect = v->effect;
1907 a->buffer = &null_local_buffer;
1909 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1910 return hr;
1913 return S_OK;
1916 static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
1917 const char **ptr, struct d3d10_effect_variable *l)
1919 unsigned int i;
1920 DWORD offset;
1921 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1922 HRESULT hr;
1923 unsigned int stride = 0;
1925 /* Generate our own type, it isn't in the fx blob. */
1926 if (!(l->type = heap_alloc_zero(sizeof(*l->type))))
1928 ERR("Failed to allocate local buffer type memory.\n");
1929 return E_OUTOFMEMORY;
1931 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1932 l->type->type_class = D3D10_SVC_OBJECT;
1933 l->type->effect = l->effect;
1935 read_dword(ptr, &offset);
1936 TRACE("Local buffer name at offset %#x.\n", offset);
1938 if (!fx10_copy_string(data, data_size, offset, &l->name))
1940 ERR("Failed to copy name.\n");
1941 return E_OUTOFMEMORY;
1943 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1945 read_dword(ptr, &l->data_size);
1946 TRACE("Local buffer data size: %#x.\n", l->data_size);
1948 read_dword(ptr, &d3d10_cbuffer_type);
1949 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1951 switch(d3d10_cbuffer_type)
1953 case D3D10_CT_CBUFFER:
1954 l->type->basetype = D3D10_SVT_CBUFFER;
1955 if (!copy_name("cbuffer", &l->type->name))
1957 ERR("Failed to copy name.\n");
1958 return E_OUTOFMEMORY;
1960 break;
1962 case D3D10_CT_TBUFFER:
1963 l->type->basetype = D3D10_SVT_TBUFFER;
1964 if (!copy_name("tbuffer", &l->type->name))
1966 ERR("Failed to copy name.\n");
1967 return E_OUTOFMEMORY;
1969 break;
1971 default:
1972 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1973 return E_FAIL;
1976 read_dword(ptr, &l->type->member_count);
1977 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1979 skip_dword_unknown("local buffer", ptr, 1);
1981 read_dword(ptr, &l->annotation_count);
1982 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1984 if (!(l->annotations = heap_calloc(l->annotation_count, sizeof(*l->annotations))))
1986 ERR("Failed to allocate local buffer annotations memory.\n");
1987 return E_OUTOFMEMORY;
1990 for (i = 0; i < l->annotation_count; ++i)
1992 struct d3d10_effect_variable *a = &l->annotations[i];
1994 a->effect = l->effect;
1995 a->buffer = &null_local_buffer;
1997 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1998 return hr;
2001 if (!(l->members = heap_calloc(l->type->member_count, sizeof(*l->members))))
2003 ERR("Failed to allocate members memory.\n");
2004 return E_OUTOFMEMORY;
2007 if (!(l->type->members = heap_calloc(l->type->member_count, sizeof(*l->type->members))))
2009 ERR("Failed to allocate type members memory.\n");
2010 return E_OUTOFMEMORY;
2013 for (i = 0; i < l->type->member_count; ++i)
2015 struct d3d10_effect_variable *v = &l->members[i];
2016 struct d3d10_effect_type_member *typem = &l->type->members[i];
2018 v->buffer = l;
2019 v->effect = l->effect;
2021 if (FAILED(hr = parse_fx10_variable(data, data_size, ptr, v)))
2022 return hr;
2025 * Copy the values from the variable type to the constant buffers type
2026 * members structure, because it is our own generated type.
2028 typem->type = v->type;
2030 if (!copy_name(v->name, &typem->name))
2032 ERR("Failed to copy name.\n");
2033 return E_OUTOFMEMORY;
2035 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
2037 if (!copy_name(v->semantic, &typem->semantic))
2039 ERR("Failed to copy name.\n");
2040 return E_OUTOFMEMORY;
2042 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
2044 typem->buffer_offset = v->buffer_offset;
2045 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
2047 l->type->size_packed += v->type->size_packed;
2050 * For the complete constantbuffer the size_unpacked = stride,
2051 * the stride is calculated like this:
2053 * 1) if the constant buffer variables are packed with packoffset
2054 * - stride = the highest used constant
2055 * - the complete stride has to be a multiple of 0x10
2057 * 2) if the constant buffer variables are NOT packed with packoffset
2058 * - sum of unpacked size for all variables which fit in a 0x10 part
2059 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
2060 * and a new part is started
2061 * - if the variable is a struct it is always used a new part
2062 * - the complete stride has to be a multiple of 0x10
2064 * e.g.:
2065 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
2066 * part 0x10 0x10 0x20 -> 0x40
2068 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2070 if ((v->type->size_unpacked + v->buffer_offset) > stride)
2072 stride = v->type->size_unpacked + v->buffer_offset;
2075 else
2077 if (v->type->type_class == D3D10_SVC_STRUCT)
2079 stride = (stride + 0xf) & ~0xf;
2082 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
2084 stride = (stride + 0xf) & ~0xf;
2087 stride += v->type->size_unpacked;
2090 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
2092 TRACE("Constant buffer:\n");
2093 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
2094 TRACE("\tElement count: %u.\n", l->type->element_count);
2095 TRACE("\tMember count: %u.\n", l->type->member_count);
2096 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
2097 TRACE("\tStride: %#x.\n", l->type->stride);
2098 TRACE("\tPacked size %#x.\n", l->type->size_packed);
2099 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
2100 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
2102 return S_OK;
2105 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
2107 TRACE("effect type member %p.\n", typem);
2109 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
2110 heap_free(typem->semantic);
2111 heap_free(typem->name);
2114 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
2116 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
2118 TRACE("effect type %p.\n", t);
2120 if (t->elementtype)
2122 heap_free(t->elementtype->name);
2123 heap_free(t->elementtype);
2126 if (t->members)
2128 unsigned int i;
2130 for (i = 0; i < t->member_count; ++i)
2132 d3d10_effect_type_member_destroy(&t->members[i]);
2134 heap_free(t->members);
2137 heap_free(t->name);
2138 heap_free(t);
2141 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
2143 const char *ptr;
2144 unsigned int i;
2145 HRESULT hr;
2147 if (e->index_offset >= data_size)
2149 WARN("Invalid index offset %#x (data size %#x).\n", e->index_offset, data_size);
2150 return E_FAIL;
2152 ptr = data + e->index_offset;
2154 if (!(e->local_buffers = heap_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
2156 ERR("Failed to allocate local buffer memory.\n");
2157 return E_OUTOFMEMORY;
2160 if (!(e->local_variables = heap_calloc(e->local_variable_count, sizeof(*e->local_variables))))
2162 ERR("Failed to allocate local variable memory.\n");
2163 return E_OUTOFMEMORY;
2166 if (!(e->anonymous_shaders = heap_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
2168 ERR("Failed to allocate anonymous shaders memory\n");
2169 return E_OUTOFMEMORY;
2172 if (!(e->used_shaders = heap_calloc(e->used_shader_count, sizeof(*e->used_shaders))))
2174 ERR("Failed to allocate used shaders memory\n");
2175 return E_OUTOFMEMORY;
2178 if (!(e->techniques = heap_calloc(e->technique_count, sizeof(*e->techniques))))
2180 ERR("Failed to allocate techniques memory\n");
2181 return E_OUTOFMEMORY;
2184 for (i = 0; i < e->local_buffer_count; ++i)
2186 struct d3d10_effect_variable *l = &e->local_buffers[i];
2187 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2188 l->effect = e;
2189 l->buffer = &null_local_buffer;
2191 if (FAILED(hr = parse_fx10_local_buffer(data, data_size, &ptr, l)))
2192 return hr;
2195 for (i = 0; i < e->local_variable_count; ++i)
2197 struct d3d10_effect_variable *v = &e->local_variables[i];
2199 v->effect = e;
2200 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2201 v->buffer = &null_local_buffer;
2203 if (FAILED(hr = parse_fx10_local_variable(data, data_size, &ptr, v)))
2204 return hr;
2207 for (i = 0; i < e->technique_count; ++i)
2209 struct d3d10_effect_technique *t = &e->techniques[i];
2211 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2212 t->effect = e;
2214 if (FAILED(hr = parse_fx10_technique(data, data_size, &ptr, t)))
2215 return hr;
2218 return S_OK;
2221 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2223 const char *ptr = data;
2224 DWORD unknown;
2226 if (!require_space(0, 19, sizeof(DWORD), data_size))
2228 WARN("Invalid data size %#x.\n", data_size);
2229 return E_INVALIDARG;
2232 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2233 read_dword(&ptr, &e->version);
2234 TRACE("Target: %#x\n", e->version);
2236 read_dword(&ptr, &e->local_buffer_count);
2237 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2239 read_dword(&ptr, &e->variable_count);
2240 TRACE("Variable count: %u\n", e->variable_count);
2242 read_dword(&ptr, &e->local_variable_count);
2243 TRACE("Object count: %u\n", e->local_variable_count);
2245 read_dword(&ptr, &e->sharedbuffers_count);
2246 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2248 /* Number of variables in shared buffers? */
2249 read_dword(&ptr, &unknown);
2250 FIXME("Unknown 0: %u\n", unknown);
2252 read_dword(&ptr, &e->sharedobjects_count);
2253 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2255 read_dword(&ptr, &e->technique_count);
2256 TRACE("Technique count: %u\n", e->technique_count);
2258 read_dword(&ptr, &e->index_offset);
2259 TRACE("Index offset: %#x\n", e->index_offset);
2261 read_dword(&ptr, &unknown);
2262 FIXME("Unknown 1: %u\n", unknown);
2264 read_dword(&ptr, &e->texture_count);
2265 TRACE("Texture count: %u\n", e->texture_count);
2267 read_dword(&ptr, &e->depthstencilstate_count);
2268 TRACE("Depthstencilstate count: %u\n", e->depthstencilstate_count);
2270 read_dword(&ptr, &e->blendstate_count);
2271 TRACE("Blendstate count: %u\n", e->blendstate_count);
2273 read_dword(&ptr, &e->rasterizerstate_count);
2274 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2276 read_dword(&ptr, &e->samplerstate_count);
2277 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2279 read_dword(&ptr, &e->rendertargetview_count);
2280 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2282 read_dword(&ptr, &e->depthstencilview_count);
2283 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2285 read_dword(&ptr, &e->used_shader_count);
2286 TRACE("Used shader count: %u\n", e->used_shader_count);
2288 read_dword(&ptr, &e->anonymous_shader_count);
2289 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2291 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2294 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2296 struct d3d10_effect *e = ctx;
2298 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2300 TRACE("chunk size: %#x\n", data_size);
2302 switch(tag)
2304 case TAG_FX10:
2305 return parse_fx10(e, data, data_size);
2307 default:
2308 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2309 return S_OK;
2313 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2315 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2318 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2320 ID3D10Device *device = o->pass->technique->effect->device;
2322 TRACE("effect object %p, type %#x.\n", o, o->type);
2324 switch(o->type)
2326 case D3D10_EOT_RASTERIZER_STATE:
2327 ID3D10Device_RSSetState(device, o->object.rs);
2328 return S_OK;
2330 case D3D10_EOT_DEPTH_STENCIL_STATE:
2331 ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
2332 return S_OK;
2334 case D3D10_EOT_BLEND_STATE:
2335 ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
2336 return S_OK;
2338 case D3D10_EOT_VERTEXSHADER:
2339 ID3D10Device_VSSetShader(device, o->object.vs);
2340 return S_OK;
2342 case D3D10_EOT_PIXELSHADER:
2343 ID3D10Device_PSSetShader(device, o->object.ps);
2344 return S_OK;
2346 case D3D10_EOT_GEOMETRYSHADER:
2347 ID3D10Device_GSSetShader(device, o->object.gs);
2348 return S_OK;
2350 case D3D10_EOT_STENCIL_REF:
2351 case D3D10_EOT_BLEND_FACTOR:
2352 case D3D10_EOT_SAMPLE_MASK:
2353 return S_OK;
2355 default:
2356 FIXME("Unhandled effect object type %#x.\n", o->type);
2357 return E_FAIL;
2361 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2362 D3D10_SHADER_VARIABLE_TYPE type)
2364 shader_free_signature(&s->input_signature);
2365 shader_free_signature(&s->output_signature);
2367 switch (type)
2369 case D3D10_SVT_VERTEXSHADER:
2370 if (s->shader.vs)
2371 ID3D10VertexShader_Release(s->shader.vs);
2372 break;
2374 case D3D10_SVT_PIXELSHADER:
2375 if (s->shader.ps)
2376 ID3D10PixelShader_Release(s->shader.ps);
2377 break;
2379 case D3D10_SVT_GEOMETRYSHADER:
2380 if (s->shader.gs)
2381 ID3D10GeometryShader_Release(s->shader.gs);
2382 break;
2384 default:
2385 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2386 break;
2390 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2392 unsigned int i;
2394 TRACE("variable %p.\n", v);
2396 heap_free(v->name);
2397 heap_free(v->semantic);
2398 if (v->annotations)
2400 for (i = 0; i < v->annotation_count; ++i)
2402 d3d10_effect_variable_destroy(&v->annotations[i]);
2404 heap_free(v->annotations);
2407 if (v->members)
2409 for (i = 0; i < v->type->member_count; ++i)
2411 d3d10_effect_variable_destroy(&v->members[i]);
2413 heap_free(v->members);
2416 if (v->elements)
2418 for (i = 0; i < v->type->element_count; ++i)
2420 d3d10_effect_variable_destroy(&v->elements[i]);
2422 heap_free(v->elements);
2425 if (v->type)
2427 switch (v->type->basetype)
2429 case D3D10_SVT_VERTEXSHADER:
2430 case D3D10_SVT_PIXELSHADER:
2431 case D3D10_SVT_GEOMETRYSHADER:
2432 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2433 break;
2435 case D3D10_SVT_DEPTHSTENCIL:
2436 if (v->u.state.object.depth_stencil)
2437 ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
2438 break;
2440 case D3D10_SVT_BLEND:
2441 if (v->u.state.object.blend)
2442 ID3D10BlendState_Release(v->u.state.object.blend);
2443 break;
2445 case D3D10_SVT_RASTERIZER:
2446 if (v->u.state.object.rasterizer)
2447 ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
2448 break;
2450 case D3D10_SVT_SAMPLER:
2451 if (v->u.state.object.sampler)
2452 ID3D10SamplerState_Release(v->u.state.object.sampler);
2453 break;
2455 default:
2456 break;
2461 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2463 switch (o->type)
2465 case D3D10_EOT_RASTERIZER_STATE:
2466 if (o->object.rs)
2467 ID3D10RasterizerState_Release(o->object.rs);
2468 break;
2470 case D3D10_EOT_DEPTH_STENCIL_STATE:
2471 if (o->object.ds)
2472 ID3D10DepthStencilState_Release(o->object.ds);
2473 break;
2475 case D3D10_EOT_BLEND_STATE:
2476 if (o->object.bs)
2477 ID3D10BlendState_Release(o->object.bs);
2478 break;
2480 case D3D10_EOT_VERTEXSHADER:
2481 if (o->object.vs)
2482 ID3D10VertexShader_Release(o->object.vs);
2483 break;
2485 case D3D10_EOT_PIXELSHADER:
2486 if (o->object.ps)
2487 ID3D10PixelShader_Release(o->object.ps);
2488 break;
2490 case D3D10_EOT_GEOMETRYSHADER:
2491 if (o->object.gs)
2492 ID3D10GeometryShader_Release(o->object.gs);
2493 break;
2495 default:
2496 break;
2500 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2502 unsigned int i;
2504 TRACE("pass %p\n", p);
2506 heap_free(p->name);
2508 if (p->objects)
2510 for (i = 0; i < p->object_count; ++i)
2512 d3d10_effect_object_destroy(&p->objects[i]);
2514 heap_free(p->objects);
2517 if (p->annotations)
2519 for (i = 0; i < p->annotation_count; ++i)
2521 d3d10_effect_variable_destroy(&p->annotations[i]);
2523 heap_free(p->annotations);
2527 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2529 unsigned int i;
2531 TRACE("technique %p\n", t);
2533 heap_free(t->name);
2534 if (t->passes)
2536 for (i = 0; i < t->pass_count; ++i)
2538 d3d10_effect_pass_destroy(&t->passes[i]);
2540 heap_free(t->passes);
2543 if (t->annotations)
2545 for (i = 0; i < t->annotation_count; ++i)
2547 d3d10_effect_variable_destroy(&t->annotations[i]);
2549 heap_free(t->annotations);
2553 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2555 unsigned int i;
2557 TRACE("local buffer %p.\n", l);
2559 heap_free(l->name);
2560 if (l->members)
2562 for (i = 0; i < l->type->member_count; ++i)
2564 d3d10_effect_variable_destroy(&l->members[i]);
2566 heap_free(l->members);
2569 if (l->type)
2570 d3d10_effect_type_destroy(&l->type->entry, NULL);
2572 if (l->annotations)
2574 for (i = 0; i < l->annotation_count; ++i)
2576 d3d10_effect_variable_destroy(&l->annotations[i]);
2578 heap_free(l->annotations);
2582 /* IUnknown methods */
2584 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2586 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2589 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2591 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2593 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2594 || IsEqualGUID(riid, &IID_IUnknown))
2596 IUnknown_AddRef(iface);
2597 *object = iface;
2598 return S_OK;
2601 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2603 *object = NULL;
2604 return E_NOINTERFACE;
2607 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2609 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2610 ULONG refcount = InterlockedIncrement(&This->refcount);
2612 TRACE("%p increasing refcount to %u\n", This, refcount);
2614 return refcount;
2617 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2619 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2620 ULONG refcount = InterlockedDecrement(&This->refcount);
2622 TRACE("%p decreasing refcount to %u\n", This, refcount);
2624 if (!refcount)
2626 unsigned int i;
2628 if (This->techniques)
2630 for (i = 0; i < This->technique_count; ++i)
2632 d3d10_effect_technique_destroy(&This->techniques[i]);
2634 heap_free(This->techniques);
2637 if (This->local_variables)
2639 for (i = 0; i < This->local_variable_count; ++i)
2641 d3d10_effect_variable_destroy(&This->local_variables[i]);
2643 heap_free(This->local_variables);
2646 if (This->local_buffers)
2648 for (i = 0; i < This->local_buffer_count; ++i)
2650 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2652 heap_free(This->local_buffers);
2655 if (This->anonymous_shaders)
2657 for (i = 0; i < This->anonymous_shader_count; ++i)
2659 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2660 heap_free(This->anonymous_shaders[i].type.name);
2662 heap_free(This->anonymous_shaders);
2665 heap_free(This->used_shaders);
2667 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2669 ID3D10Device_Release(This->device);
2670 heap_free(This);
2673 return refcount;
2676 /* ID3D10Effect methods */
2678 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2680 FIXME("iface %p stub!\n", iface);
2682 return FALSE;
2685 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2687 FIXME("iface %p stub!\n", iface);
2689 return FALSE;
2692 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2694 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2696 TRACE("iface %p, device %p\n", iface, device);
2698 ID3D10Device_AddRef(This->device);
2699 *device = This->device;
2701 return S_OK;
2704 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2706 FIXME("iface %p, desc %p stub!\n", iface, desc);
2708 return E_NOTIMPL;
2711 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2712 UINT index)
2714 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2715 struct d3d10_effect_variable *l;
2717 TRACE("iface %p, index %u\n", iface, index);
2719 if (index >= This->local_buffer_count)
2721 WARN("Invalid index specified\n");
2722 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2725 l = &This->local_buffers[index];
2727 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2729 return (ID3D10EffectConstantBuffer *)l;
2732 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2733 const char *name)
2735 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2736 unsigned int i;
2738 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2740 for (i = 0; i < This->local_buffer_count; ++i)
2742 struct d3d10_effect_variable *l = &This->local_buffers[i];
2744 if (l->name && !strcmp(l->name, name))
2746 TRACE("Returning buffer %p.\n", l);
2747 return (ID3D10EffectConstantBuffer *)l;
2751 WARN("Invalid name specified\n");
2753 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2756 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2758 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2759 unsigned int i;
2761 TRACE("iface %p, index %u\n", iface, index);
2763 for (i = 0; i < This->local_buffer_count; ++i)
2765 struct d3d10_effect_variable *l = &This->local_buffers[i];
2767 if (index < l->type->member_count)
2769 struct d3d10_effect_variable *v = &l->members[index];
2771 TRACE("Returning variable %p.\n", v);
2772 return &v->ID3D10EffectVariable_iface;
2774 index -= l->type->member_count;
2777 if (index < This->local_variable_count)
2779 struct d3d10_effect_variable *v = &This->local_variables[index];
2781 TRACE("Returning variable %p.\n", v);
2782 return &v->ID3D10EffectVariable_iface;
2785 WARN("Invalid index specified\n");
2787 return &null_variable.ID3D10EffectVariable_iface;
2790 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface,
2791 const char *name)
2793 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2794 unsigned int i;
2796 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2798 if (!name)
2800 WARN("Invalid name specified\n");
2801 return &null_variable.ID3D10EffectVariable_iface;
2804 for (i = 0; i < This->local_buffer_count; ++i)
2806 struct d3d10_effect_variable *l = &This->local_buffers[i];
2807 unsigned int j;
2809 for (j = 0; j < l->type->member_count; ++j)
2811 struct d3d10_effect_variable *v = &l->members[j];
2813 if (v->name && !strcmp(v->name, name))
2815 TRACE("Returning variable %p.\n", v);
2816 return &v->ID3D10EffectVariable_iface;
2821 for (i = 0; i < This->local_variable_count; ++i)
2823 struct d3d10_effect_variable *v = &This->local_variables[i];
2825 if (v->name && !strcmp(v->name, name))
2827 TRACE("Returning variable %p.\n", v);
2828 return &v->ID3D10EffectVariable_iface;
2832 WARN("Invalid name specified\n");
2834 return &null_variable.ID3D10EffectVariable_iface;
2837 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2838 const char *semantic)
2840 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2841 unsigned int i;
2843 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2845 if (!semantic)
2847 WARN("Invalid semantic specified\n");
2848 return &null_variable.ID3D10EffectVariable_iface;
2851 for (i = 0; i < This->local_buffer_count; ++i)
2853 struct d3d10_effect_variable *l = &This->local_buffers[i];
2854 unsigned int j;
2856 for (j = 0; j < l->type->member_count; ++j)
2858 struct d3d10_effect_variable *v = &l->members[j];
2860 if (v->semantic && !strcmp(v->semantic, semantic))
2862 TRACE("Returning variable %p.\n", v);
2863 return &v->ID3D10EffectVariable_iface;
2868 for (i = 0; i < This->local_variable_count; ++i)
2870 struct d3d10_effect_variable *v = &This->local_variables[i];
2872 if (v->semantic && !strcmp(v->semantic, semantic))
2874 TRACE("Returning variable %p.\n", v);
2875 return &v->ID3D10EffectVariable_iface;
2879 WARN("Invalid semantic specified\n");
2881 return &null_variable.ID3D10EffectVariable_iface;
2884 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2885 UINT index)
2887 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2888 struct d3d10_effect_technique *t;
2890 TRACE("iface %p, index %u\n", iface, index);
2892 if (index >= This->technique_count)
2894 WARN("Invalid index specified\n");
2895 return &null_technique.ID3D10EffectTechnique_iface;
2898 t = &This->techniques[index];
2900 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2902 return &t->ID3D10EffectTechnique_iface;
2905 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2906 const char *name)
2908 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2909 unsigned int i;
2911 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2913 if (!name)
2915 WARN("Invalid name specified\n");
2916 return &null_technique.ID3D10EffectTechnique_iface;
2919 for (i = 0; i < This->technique_count; ++i)
2921 struct d3d10_effect_technique *t = &This->techniques[i];
2922 if (t->name && !strcmp(t->name, name))
2924 TRACE("Returning technique %p\n", t);
2925 return &t->ID3D10EffectTechnique_iface;
2929 WARN("Invalid name specified\n");
2931 return &null_technique.ID3D10EffectTechnique_iface;
2934 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2936 FIXME("iface %p stub!\n", iface);
2938 return E_NOTIMPL;
2941 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2943 FIXME("iface %p stub!\n", iface);
2945 return FALSE;
2948 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2950 /* IUnknown methods */
2951 d3d10_effect_QueryInterface,
2952 d3d10_effect_AddRef,
2953 d3d10_effect_Release,
2954 /* ID3D10Effect methods */
2955 d3d10_effect_IsValid,
2956 d3d10_effect_IsPool,
2957 d3d10_effect_GetDevice,
2958 d3d10_effect_GetDesc,
2959 d3d10_effect_GetConstantBufferByIndex,
2960 d3d10_effect_GetConstantBufferByName,
2961 d3d10_effect_GetVariableByIndex,
2962 d3d10_effect_GetVariableByName,
2963 d3d10_effect_GetVariableBySemantic,
2964 d3d10_effect_GetTechniqueByIndex,
2965 d3d10_effect_GetTechniqueByName,
2966 d3d10_effect_Optimize,
2967 d3d10_effect_IsOptimized,
2970 /* ID3D10EffectTechnique methods */
2972 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2974 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2977 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2979 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2981 TRACE("iface %p\n", iface);
2983 return This != &null_technique;
2986 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2987 D3D10_TECHNIQUE_DESC *desc)
2989 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2991 TRACE("iface %p, desc %p\n", iface, desc);
2993 if(This == &null_technique)
2995 WARN("Null technique specified\n");
2996 return E_FAIL;
2999 if(!desc)
3001 WARN("Invalid argument specified\n");
3002 return E_INVALIDARG;
3005 desc->Name = This->name;
3006 desc->Passes = This->pass_count;
3007 desc->Annotations = This->annotation_count;
3009 return S_OK;
3012 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
3013 ID3D10EffectTechnique *iface, UINT index)
3015 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3016 struct d3d10_effect_variable *a;
3018 TRACE("iface %p, index %u\n", iface, index);
3020 if (index >= This->annotation_count)
3022 WARN("Invalid index specified\n");
3023 return &null_variable.ID3D10EffectVariable_iface;
3026 a = &This->annotations[index];
3028 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3030 return &a->ID3D10EffectVariable_iface;
3033 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
3034 ID3D10EffectTechnique *iface, const char *name)
3036 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3037 unsigned int i;
3039 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3041 for (i = 0; i < This->annotation_count; ++i)
3043 struct d3d10_effect_variable *a = &This->annotations[i];
3044 if (a->name && !strcmp(a->name, name))
3046 TRACE("Returning annotation %p\n", a);
3047 return &a->ID3D10EffectVariable_iface;
3051 WARN("Invalid name specified\n");
3053 return &null_variable.ID3D10EffectVariable_iface;
3056 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
3057 UINT index)
3059 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3060 struct d3d10_effect_pass *p;
3062 TRACE("iface %p, index %u\n", iface, index);
3064 if (index >= This->pass_count)
3066 WARN("Invalid index specified\n");
3067 return &null_pass.ID3D10EffectPass_iface;
3070 p = &This->passes[index];
3072 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
3074 return &p->ID3D10EffectPass_iface;
3077 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
3078 const char *name)
3080 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3081 unsigned int i;
3083 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3085 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
3087 for (i = 0; i < This->pass_count; ++i)
3089 struct d3d10_effect_pass *p = &This->passes[i];
3090 if (p->name && !strcmp(p->name, name))
3092 TRACE("Returning pass %p\n", p);
3093 return &p->ID3D10EffectPass_iface;
3097 WARN("Invalid name specified\n");
3099 return &null_pass.ID3D10EffectPass_iface;
3102 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
3103 D3D10_STATE_BLOCK_MASK *mask)
3105 FIXME("iface %p,mask %p stub!\n", iface, mask);
3107 return E_NOTIMPL;
3110 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
3112 /* ID3D10EffectTechnique methods */
3113 d3d10_effect_technique_IsValid,
3114 d3d10_effect_technique_GetDesc,
3115 d3d10_effect_technique_GetAnnotationByIndex,
3116 d3d10_effect_technique_GetAnnotationByName,
3117 d3d10_effect_technique_GetPassByIndex,
3118 d3d10_effect_technique_GetPassByName,
3119 d3d10_effect_technique_ComputeStateBlockMask,
3122 /* ID3D10EffectPass methods */
3124 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
3126 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
3129 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
3131 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3133 TRACE("iface %p\n", iface);
3135 return This != &null_pass;
3138 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
3139 D3D10_PASS_DESC *desc)
3141 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3142 struct d3d10_effect_shader_variable *s;
3144 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
3146 if(This == &null_pass)
3148 WARN("Null pass specified\n");
3149 return E_FAIL;
3152 if(!desc)
3154 WARN("Invalid argument specified\n");
3155 return E_INVALIDARG;
3158 memset(desc, 0, sizeof(*desc));
3159 desc->Name = This->name;
3161 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3162 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3163 desc->IAInputSignatureSize = s->input_signature.signature_size;
3165 desc->StencilRef = This->stencil_ref;
3166 desc->SampleMask = This->sample_mask;
3167 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3169 return S_OK;
3172 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3173 D3D10_PASS_SHADER_DESC *desc)
3175 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3177 TRACE("iface %p, desc %p\n", iface, desc);
3179 if (This == &null_pass)
3181 WARN("Null pass specified\n");
3182 return E_FAIL;
3185 if (!desc)
3187 WARN("Invalid argument specified\n");
3188 return E_INVALIDARG;
3191 *desc = This->vs;
3193 return S_OK;
3196 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3197 D3D10_PASS_SHADER_DESC *desc)
3199 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3201 TRACE("iface %p, desc %p\n", iface, desc);
3203 if (This == &null_pass)
3205 WARN("Null pass specified\n");
3206 return E_FAIL;
3209 if (!desc)
3211 WARN("Invalid argument specified\n");
3212 return E_INVALIDARG;
3215 *desc = This->gs;
3217 return S_OK;
3220 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3221 D3D10_PASS_SHADER_DESC *desc)
3223 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3225 TRACE("iface %p, desc %p\n", iface, desc);
3227 if (This == &null_pass)
3229 WARN("Null pass specified\n");
3230 return E_FAIL;
3233 if (!desc)
3235 WARN("Invalid argument specified\n");
3236 return E_INVALIDARG;
3239 *desc = This->ps;
3241 return S_OK;
3244 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3245 UINT index)
3247 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3248 struct d3d10_effect_variable *a;
3250 TRACE("iface %p, index %u\n", iface, index);
3252 if (index >= This->annotation_count)
3254 WARN("Invalid index specified\n");
3255 return &null_variable.ID3D10EffectVariable_iface;
3258 a = &This->annotations[index];
3260 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3262 return &a->ID3D10EffectVariable_iface;
3265 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3266 const char *name)
3268 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3269 unsigned int i;
3271 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3273 for (i = 0; i < This->annotation_count; ++i)
3275 struct d3d10_effect_variable *a = &This->annotations[i];
3276 if (a->name && !strcmp(a->name, name))
3278 TRACE("Returning annotation %p\n", a);
3279 return &a->ID3D10EffectVariable_iface;
3283 WARN("Invalid name specified\n");
3285 return &null_variable.ID3D10EffectVariable_iface;
3288 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3290 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3291 HRESULT hr = S_OK;
3292 unsigned int i;
3294 TRACE("iface %p, flags %#x\n", iface, flags);
3296 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3298 for (i = 0; i < This->object_count; ++i)
3300 hr = d3d10_effect_object_apply(&This->objects[i]);
3301 if (FAILED(hr)) break;
3304 return hr;
3307 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3308 D3D10_STATE_BLOCK_MASK *mask)
3310 FIXME("iface %p, mask %p stub!\n", iface, mask);
3312 return E_NOTIMPL;
3315 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3317 /* ID3D10EffectPass methods */
3318 d3d10_effect_pass_IsValid,
3319 d3d10_effect_pass_GetDesc,
3320 d3d10_effect_pass_GetVertexShaderDesc,
3321 d3d10_effect_pass_GetGeometryShaderDesc,
3322 d3d10_effect_pass_GetPixelShaderDesc,
3323 d3d10_effect_pass_GetAnnotationByIndex,
3324 d3d10_effect_pass_GetAnnotationByName,
3325 d3d10_effect_pass_Apply,
3326 d3d10_effect_pass_ComputeStateBlockMask,
3329 /* ID3D10EffectVariable methods */
3331 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3333 TRACE("iface %p\n", iface);
3335 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3338 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3340 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3342 TRACE("iface %p\n", iface);
3344 return &This->type->ID3D10EffectType_iface;
3347 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3348 D3D10_EFFECT_VARIABLE_DESC *desc)
3350 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3352 TRACE("iface %p, desc %p\n", iface, desc);
3354 if (!iface->lpVtbl->IsValid(iface))
3356 WARN("Null variable specified\n");
3357 return E_FAIL;
3360 if (!desc)
3362 WARN("Invalid argument specified\n");
3363 return E_INVALIDARG;
3366 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3367 memset(desc, 0, sizeof(*desc));
3368 desc->Name = This->name;
3369 desc->Semantic = This->semantic;
3370 desc->Flags = This->flag;
3371 desc->Annotations = This->annotation_count;
3372 desc->BufferOffset = This->buffer_offset;
3374 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3376 desc->ExplicitBindPoint = This->buffer_offset;
3379 return S_OK;
3382 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3383 ID3D10EffectVariable *iface, UINT index)
3385 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3386 struct d3d10_effect_variable *a;
3388 TRACE("iface %p, index %u\n", iface, index);
3390 if (index >= This->annotation_count)
3392 WARN("Invalid index specified\n");
3393 return &null_variable.ID3D10EffectVariable_iface;
3396 a = &This->annotations[index];
3398 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3400 return &a->ID3D10EffectVariable_iface;
3403 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3404 ID3D10EffectVariable *iface, const char *name)
3406 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3407 unsigned int i;
3409 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3411 for (i = 0; i < This->annotation_count; ++i)
3413 struct d3d10_effect_variable *a = &This->annotations[i];
3414 if (a->name && !strcmp(a->name, name))
3416 TRACE("Returning annotation %p\n", a);
3417 return &a->ID3D10EffectVariable_iface;
3421 WARN("Invalid name specified\n");
3423 return &null_variable.ID3D10EffectVariable_iface;
3426 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3427 ID3D10EffectVariable *iface, UINT index)
3429 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3430 struct d3d10_effect_variable *m;
3432 TRACE("iface %p, index %u\n", iface, index);
3434 if (index >= This->type->member_count)
3436 WARN("Invalid index specified\n");
3437 return &null_variable.ID3D10EffectVariable_iface;
3440 m = &This->members[index];
3442 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3444 return &m->ID3D10EffectVariable_iface;
3447 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3448 ID3D10EffectVariable *iface, const char *name)
3450 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3451 unsigned int i;
3453 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3455 if (!name)
3457 WARN("Invalid name specified\n");
3458 return &null_variable.ID3D10EffectVariable_iface;
3461 for (i = 0; i < This->type->member_count; ++i)
3463 struct d3d10_effect_variable *m = &This->members[i];
3465 if (m->name && !strcmp(m->name, name))
3467 TRACE("Returning member %p\n", m);
3468 return &m->ID3D10EffectVariable_iface;
3472 WARN("Invalid name specified\n");
3474 return &null_variable.ID3D10EffectVariable_iface;
3477 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3478 ID3D10EffectVariable *iface, const char *semantic)
3480 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3481 unsigned int i;
3483 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3485 if (!semantic)
3487 WARN("Invalid semantic specified\n");
3488 return &null_variable.ID3D10EffectVariable_iface;
3491 for (i = 0; i < This->type->member_count; ++i)
3493 struct d3d10_effect_variable *m = &This->members[i];
3495 if (m->semantic && !strcmp(m->semantic, semantic))
3497 TRACE("Returning member %p\n", m);
3498 return &m->ID3D10EffectVariable_iface;
3502 WARN("Invalid semantic specified\n");
3504 return &null_variable.ID3D10EffectVariable_iface;
3507 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3508 ID3D10EffectVariable *iface, UINT index)
3510 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3511 struct d3d10_effect_variable *v;
3513 TRACE("iface %p, index %u\n", iface, index);
3515 if (index >= This->type->element_count)
3517 WARN("Invalid index specified\n");
3518 return &null_variable.ID3D10EffectVariable_iface;
3521 v = &This->elements[index];
3523 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3525 return &v->ID3D10EffectVariable_iface;
3528 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3529 ID3D10EffectVariable *iface)
3531 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3533 TRACE("iface %p\n", iface);
3535 return (ID3D10EffectConstantBuffer *)This->buffer;
3538 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3539 ID3D10EffectVariable *iface)
3541 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3543 TRACE("iface %p\n", iface);
3545 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3546 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3548 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3551 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3552 ID3D10EffectVariable *iface)
3554 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3556 TRACE("iface %p\n", iface);
3558 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3559 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3561 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3564 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3565 ID3D10EffectVariable *iface)
3567 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3569 TRACE("iface %p\n", iface);
3571 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3572 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3574 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3577 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3578 ID3D10EffectVariable *iface)
3580 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3582 TRACE("iface %p\n", iface);
3584 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3585 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3587 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3590 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3591 ID3D10EffectVariable *iface)
3593 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3595 TRACE("iface %p\n", iface);
3597 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3598 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3600 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3603 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3604 ID3D10EffectVariable *iface)
3606 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3608 TRACE("iface %p\n", iface);
3610 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3611 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3613 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3616 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3617 ID3D10EffectVariable *iface)
3619 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3621 TRACE("iface %p\n", iface);
3623 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3624 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3626 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3629 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3630 ID3D10EffectVariable *iface)
3632 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3634 TRACE("iface %p\n", iface);
3636 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3637 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3639 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3642 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3643 ID3D10EffectVariable *iface)
3645 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3647 TRACE("iface %p\n", iface);
3649 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3650 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3652 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3655 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3657 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3659 TRACE("iface %p\n", iface);
3661 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3662 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3664 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3667 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3668 ID3D10EffectVariable *iface)
3670 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3672 TRACE("iface %p\n", iface);
3674 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3675 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3677 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3680 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3681 ID3D10EffectVariable *iface)
3683 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3685 TRACE("iface %p\n", iface);
3687 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3688 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3690 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3693 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3694 ID3D10EffectVariable *iface)
3696 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3698 TRACE("iface %p\n", iface);
3700 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3701 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3703 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3706 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3707 void *data, UINT offset, UINT count)
3709 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3711 return E_NOTIMPL;
3714 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3715 void *data, UINT offset, UINT count)
3717 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3719 return E_NOTIMPL;
3722 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3724 /* ID3D10EffectVariable methods */
3725 d3d10_effect_variable_IsValid,
3726 d3d10_effect_variable_GetType,
3727 d3d10_effect_variable_GetDesc,
3728 d3d10_effect_variable_GetAnnotationByIndex,
3729 d3d10_effect_variable_GetAnnotationByName,
3730 d3d10_effect_variable_GetMemberByIndex,
3731 d3d10_effect_variable_GetMemberByName,
3732 d3d10_effect_variable_GetMemberBySemantic,
3733 d3d10_effect_variable_GetElement,
3734 d3d10_effect_variable_GetParentConstantBuffer,
3735 d3d10_effect_variable_AsScalar,
3736 d3d10_effect_variable_AsVector,
3737 d3d10_effect_variable_AsMatrix,
3738 d3d10_effect_variable_AsString,
3739 d3d10_effect_variable_AsShaderResource,
3740 d3d10_effect_variable_AsRenderTargetView,
3741 d3d10_effect_variable_AsDepthStencilView,
3742 d3d10_effect_variable_AsConstantBuffer,
3743 d3d10_effect_variable_AsShader,
3744 d3d10_effect_variable_AsBlend,
3745 d3d10_effect_variable_AsDepthStencil,
3746 d3d10_effect_variable_AsRasterizer,
3747 d3d10_effect_variable_AsSampler,
3748 d3d10_effect_variable_SetRawValue,
3749 d3d10_effect_variable_GetRawValue,
3752 /* ID3D10EffectVariable methods */
3753 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3755 TRACE("iface %p\n", iface);
3757 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3760 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3762 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3765 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3766 D3D10_EFFECT_VARIABLE_DESC *desc)
3768 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3771 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3772 ID3D10EffectConstantBuffer *iface, UINT index)
3774 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3777 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3778 ID3D10EffectConstantBuffer *iface, const char *name)
3780 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3783 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3784 ID3D10EffectConstantBuffer *iface, UINT index)
3786 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3789 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3790 ID3D10EffectConstantBuffer *iface, const char *name)
3792 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3795 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3796 ID3D10EffectConstantBuffer *iface, const char *semantic)
3798 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3801 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3802 ID3D10EffectConstantBuffer *iface, UINT index)
3804 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3807 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3808 ID3D10EffectConstantBuffer *iface)
3810 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3813 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3814 ID3D10EffectConstantBuffer *iface)
3816 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3819 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3820 ID3D10EffectConstantBuffer *iface)
3822 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3825 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3826 ID3D10EffectConstantBuffer *iface)
3828 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3831 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3832 ID3D10EffectConstantBuffer *iface)
3834 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3837 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3838 ID3D10EffectConstantBuffer *iface)
3840 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3843 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3844 ID3D10EffectConstantBuffer *iface)
3846 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3849 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3850 ID3D10EffectConstantBuffer *iface)
3852 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3855 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3856 ID3D10EffectConstantBuffer *iface)
3858 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3861 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3862 ID3D10EffectConstantBuffer *iface)
3864 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3867 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3869 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3872 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3873 ID3D10EffectConstantBuffer *iface)
3875 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3878 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3879 ID3D10EffectConstantBuffer *iface)
3881 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3884 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3885 ID3D10EffectConstantBuffer *iface)
3887 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3890 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3891 void *data, UINT offset, UINT count)
3893 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3896 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3897 void *data, UINT offset, UINT count)
3899 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3902 /* ID3D10EffectConstantBuffer methods */
3903 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3904 ID3D10Buffer *buffer)
3906 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3908 return E_NOTIMPL;
3911 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3912 ID3D10Buffer **buffer)
3914 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3916 return E_NOTIMPL;
3919 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3920 ID3D10ShaderResourceView *view)
3922 FIXME("iface %p, view %p stub!\n", iface, view);
3924 return E_NOTIMPL;
3927 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3928 ID3D10ShaderResourceView **view)
3930 FIXME("iface %p, view %p stub!\n", iface, view);
3932 return E_NOTIMPL;
3935 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3937 /* ID3D10EffectVariable methods */
3938 d3d10_effect_constant_buffer_IsValid,
3939 d3d10_effect_constant_buffer_GetType,
3940 d3d10_effect_constant_buffer_GetDesc,
3941 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3942 d3d10_effect_constant_buffer_GetAnnotationByName,
3943 d3d10_effect_constant_buffer_GetMemberByIndex,
3944 d3d10_effect_constant_buffer_GetMemberByName,
3945 d3d10_effect_constant_buffer_GetMemberBySemantic,
3946 d3d10_effect_constant_buffer_GetElement,
3947 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3948 d3d10_effect_constant_buffer_AsScalar,
3949 d3d10_effect_constant_buffer_AsVector,
3950 d3d10_effect_constant_buffer_AsMatrix,
3951 d3d10_effect_constant_buffer_AsString,
3952 d3d10_effect_constant_buffer_AsShaderResource,
3953 d3d10_effect_constant_buffer_AsRenderTargetView,
3954 d3d10_effect_constant_buffer_AsDepthStencilView,
3955 d3d10_effect_constant_buffer_AsConstantBuffer,
3956 d3d10_effect_constant_buffer_AsShader,
3957 d3d10_effect_constant_buffer_AsBlend,
3958 d3d10_effect_constant_buffer_AsDepthStencil,
3959 d3d10_effect_constant_buffer_AsRasterizer,
3960 d3d10_effect_constant_buffer_AsSampler,
3961 d3d10_effect_constant_buffer_SetRawValue,
3962 d3d10_effect_constant_buffer_GetRawValue,
3963 /* ID3D10EffectConstantBuffer methods */
3964 d3d10_effect_constant_buffer_SetConstantBuffer,
3965 d3d10_effect_constant_buffer_GetConstantBuffer,
3966 d3d10_effect_constant_buffer_SetTextureBuffer,
3967 d3d10_effect_constant_buffer_GetTextureBuffer,
3970 /* ID3D10EffectVariable methods */
3972 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3974 TRACE("iface %p\n", iface);
3976 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3979 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3980 ID3D10EffectScalarVariable *iface)
3982 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3985 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3986 D3D10_EFFECT_VARIABLE_DESC *desc)
3988 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3991 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3992 ID3D10EffectScalarVariable *iface, UINT index)
3994 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3997 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3998 ID3D10EffectScalarVariable *iface, const char *name)
4000 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4003 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
4004 ID3D10EffectScalarVariable *iface, UINT index)
4006 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4009 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
4010 ID3D10EffectScalarVariable *iface, const char *name)
4012 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4015 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
4016 ID3D10EffectScalarVariable *iface, const char *semantic)
4018 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4021 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
4022 ID3D10EffectScalarVariable *iface, UINT index)
4024 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4027 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
4028 ID3D10EffectScalarVariable *iface)
4030 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4033 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
4034 ID3D10EffectScalarVariable *iface)
4036 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4039 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
4040 ID3D10EffectScalarVariable *iface)
4042 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4045 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
4046 ID3D10EffectScalarVariable *iface)
4048 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4051 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
4052 ID3D10EffectScalarVariable *iface)
4054 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4057 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
4058 ID3D10EffectScalarVariable *iface)
4060 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4063 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
4064 ID3D10EffectScalarVariable *iface)
4066 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4069 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
4070 ID3D10EffectScalarVariable *iface)
4072 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4075 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
4076 ID3D10EffectScalarVariable *iface)
4078 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4081 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
4082 ID3D10EffectScalarVariable *iface)
4084 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4087 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
4088 ID3D10EffectScalarVariable *iface)
4090 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4093 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
4094 ID3D10EffectScalarVariable *iface)
4096 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4099 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
4100 ID3D10EffectScalarVariable *iface)
4102 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4105 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
4106 ID3D10EffectScalarVariable *iface)
4108 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4111 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
4112 void *data, UINT offset, UINT count)
4114 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4117 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
4118 void *data, UINT offset, UINT count)
4120 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4123 /* ID3D10EffectScalarVariable methods */
4125 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
4126 float value)
4128 FIXME("iface %p, value %.8e stub!\n", iface, value);
4130 return E_NOTIMPL;
4133 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
4134 float *value)
4136 FIXME("iface %p, value %p stub!\n", iface, value);
4138 return E_NOTIMPL;
4141 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
4142 float *values, UINT offset, UINT count)
4144 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4146 return E_NOTIMPL;
4149 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4150 float *values, UINT offset, UINT count)
4152 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4154 return E_NOTIMPL;
4157 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
4158 int value)
4160 FIXME("iface %p, value %d stub!\n", iface, value);
4162 return E_NOTIMPL;
4165 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4166 int *value)
4168 FIXME("iface %p, value %p stub!\n", iface, value);
4170 return E_NOTIMPL;
4173 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4174 int *values, UINT offset, UINT count)
4176 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4178 return E_NOTIMPL;
4181 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4182 int *values, UINT offset, UINT count)
4184 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4186 return E_NOTIMPL;
4189 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4190 BOOL value)
4192 FIXME("iface %p, value %d stub!\n", iface, value);
4194 return E_NOTIMPL;
4197 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4198 BOOL *value)
4200 FIXME("iface %p, value %p stub!\n", iface, value);
4202 return E_NOTIMPL;
4205 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4206 BOOL *values, UINT offset, UINT count)
4208 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4210 return E_NOTIMPL;
4213 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4214 BOOL *values, UINT offset, UINT count)
4216 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4218 return E_NOTIMPL;
4221 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4223 /* ID3D10EffectVariable methods */
4224 d3d10_effect_scalar_variable_IsValid,
4225 d3d10_effect_scalar_variable_GetType,
4226 d3d10_effect_scalar_variable_GetDesc,
4227 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4228 d3d10_effect_scalar_variable_GetAnnotationByName,
4229 d3d10_effect_scalar_variable_GetMemberByIndex,
4230 d3d10_effect_scalar_variable_GetMemberByName,
4231 d3d10_effect_scalar_variable_GetMemberBySemantic,
4232 d3d10_effect_scalar_variable_GetElement,
4233 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4234 d3d10_effect_scalar_variable_AsScalar,
4235 d3d10_effect_scalar_variable_AsVector,
4236 d3d10_effect_scalar_variable_AsMatrix,
4237 d3d10_effect_scalar_variable_AsString,
4238 d3d10_effect_scalar_variable_AsShaderResource,
4239 d3d10_effect_scalar_variable_AsRenderTargetView,
4240 d3d10_effect_scalar_variable_AsDepthStencilView,
4241 d3d10_effect_scalar_variable_AsConstantBuffer,
4242 d3d10_effect_scalar_variable_AsShader,
4243 d3d10_effect_scalar_variable_AsBlend,
4244 d3d10_effect_scalar_variable_AsDepthStencil,
4245 d3d10_effect_scalar_variable_AsRasterizer,
4246 d3d10_effect_scalar_variable_AsSampler,
4247 d3d10_effect_scalar_variable_SetRawValue,
4248 d3d10_effect_scalar_variable_GetRawValue,
4249 /* ID3D10EffectScalarVariable methods */
4250 d3d10_effect_scalar_variable_SetFloat,
4251 d3d10_effect_scalar_variable_GetFloat,
4252 d3d10_effect_scalar_variable_SetFloatArray,
4253 d3d10_effect_scalar_variable_GetFloatArray,
4254 d3d10_effect_scalar_variable_SetInt,
4255 d3d10_effect_scalar_variable_GetInt,
4256 d3d10_effect_scalar_variable_SetIntArray,
4257 d3d10_effect_scalar_variable_GetIntArray,
4258 d3d10_effect_scalar_variable_SetBool,
4259 d3d10_effect_scalar_variable_GetBool,
4260 d3d10_effect_scalar_variable_SetBoolArray,
4261 d3d10_effect_scalar_variable_GetBoolArray,
4264 /* ID3D10EffectVariable methods */
4266 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4268 TRACE("iface %p\n", iface);
4270 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4273 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4274 ID3D10EffectVectorVariable *iface)
4276 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4279 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4280 D3D10_EFFECT_VARIABLE_DESC *desc)
4282 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4285 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4286 ID3D10EffectVectorVariable *iface, UINT index)
4288 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4291 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4292 ID3D10EffectVectorVariable *iface, const char *name)
4294 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4297 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4298 ID3D10EffectVectorVariable *iface, UINT index)
4300 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4303 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4304 ID3D10EffectVectorVariable *iface, const char *name)
4306 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4309 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4310 ID3D10EffectVectorVariable *iface, const char *semantic)
4312 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4315 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4316 ID3D10EffectVectorVariable *iface, UINT index)
4318 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4321 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4322 ID3D10EffectVectorVariable *iface)
4324 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4327 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4328 ID3D10EffectVectorVariable *iface)
4330 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4333 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4334 ID3D10EffectVectorVariable *iface)
4336 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4339 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4340 ID3D10EffectVectorVariable *iface)
4342 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4345 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4346 ID3D10EffectVectorVariable *iface)
4348 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4351 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4352 ID3D10EffectVectorVariable *iface)
4354 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4357 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4358 ID3D10EffectVectorVariable *iface)
4360 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4363 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4364 ID3D10EffectVectorVariable *iface)
4366 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4369 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4370 ID3D10EffectVectorVariable *iface)
4372 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4375 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4376 ID3D10EffectVectorVariable *iface)
4378 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4381 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4382 ID3D10EffectVectorVariable *iface)
4384 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4387 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4388 ID3D10EffectVectorVariable *iface)
4390 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4393 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4394 ID3D10EffectVectorVariable *iface)
4396 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4399 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4400 ID3D10EffectVectorVariable *iface)
4402 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4405 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4406 void *data, UINT offset, UINT count)
4408 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4411 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4412 void *data, UINT offset, UINT count)
4414 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4417 /* ID3D10EffectVectorVariable methods */
4419 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4420 BOOL *value)
4422 FIXME("iface %p, value %p stub!\n", iface, value);
4424 return E_NOTIMPL;
4427 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4428 int *value)
4430 FIXME("iface %p, value %p stub!\n", iface, value);
4432 return E_NOTIMPL;
4435 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4436 float *value)
4438 FIXME("iface %p, value %p stub!\n", iface, value);
4440 return E_NOTIMPL;
4443 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4444 BOOL *value)
4446 FIXME("iface %p, value %p stub!\n", iface, value);
4448 return E_NOTIMPL;
4451 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4452 int *value)
4454 FIXME("iface %p, value %p stub!\n", iface, value);
4456 return E_NOTIMPL;
4459 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4460 float *value)
4462 FIXME("iface %p, value %p stub!\n", iface, value);
4464 return E_NOTIMPL;
4467 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4468 BOOL *values, UINT offset, UINT count)
4470 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4472 return E_NOTIMPL;
4475 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4476 int *values, UINT offset, UINT count)
4478 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4480 return E_NOTIMPL;
4483 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4484 float *values, UINT offset, UINT count)
4486 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4488 return E_NOTIMPL;
4491 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4492 BOOL *values, UINT offset, UINT count)
4494 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4496 return E_NOTIMPL;
4499 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4500 int *values, UINT offset, UINT count)
4502 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4504 return E_NOTIMPL;
4507 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4508 float *values, UINT offset, UINT count)
4510 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4512 return E_NOTIMPL;
4515 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4517 /* ID3D10EffectVariable methods */
4518 d3d10_effect_vector_variable_IsValid,
4519 d3d10_effect_vector_variable_GetType,
4520 d3d10_effect_vector_variable_GetDesc,
4521 d3d10_effect_vector_variable_GetAnnotationByIndex,
4522 d3d10_effect_vector_variable_GetAnnotationByName,
4523 d3d10_effect_vector_variable_GetMemberByIndex,
4524 d3d10_effect_vector_variable_GetMemberByName,
4525 d3d10_effect_vector_variable_GetMemberBySemantic,
4526 d3d10_effect_vector_variable_GetElement,
4527 d3d10_effect_vector_variable_GetParentConstantBuffer,
4528 d3d10_effect_vector_variable_AsScalar,
4529 d3d10_effect_vector_variable_AsVector,
4530 d3d10_effect_vector_variable_AsMatrix,
4531 d3d10_effect_vector_variable_AsString,
4532 d3d10_effect_vector_variable_AsShaderResource,
4533 d3d10_effect_vector_variable_AsRenderTargetView,
4534 d3d10_effect_vector_variable_AsDepthStencilView,
4535 d3d10_effect_vector_variable_AsConstantBuffer,
4536 d3d10_effect_vector_variable_AsShader,
4537 d3d10_effect_vector_variable_AsBlend,
4538 d3d10_effect_vector_variable_AsDepthStencil,
4539 d3d10_effect_vector_variable_AsRasterizer,
4540 d3d10_effect_vector_variable_AsSampler,
4541 d3d10_effect_vector_variable_SetRawValue,
4542 d3d10_effect_vector_variable_GetRawValue,
4543 /* ID3D10EffectVectorVariable methods */
4544 d3d10_effect_vector_variable_SetBoolVector,
4545 d3d10_effect_vector_variable_SetIntVector,
4546 d3d10_effect_vector_variable_SetFloatVector,
4547 d3d10_effect_vector_variable_GetBoolVector,
4548 d3d10_effect_vector_variable_GetIntVector,
4549 d3d10_effect_vector_variable_GetFloatVector,
4550 d3d10_effect_vector_variable_SetBoolVectorArray,
4551 d3d10_effect_vector_variable_SetIntVectorArray,
4552 d3d10_effect_vector_variable_SetFloatVectorArray,
4553 d3d10_effect_vector_variable_GetBoolVectorArray,
4554 d3d10_effect_vector_variable_GetIntVectorArray,
4555 d3d10_effect_vector_variable_GetFloatVectorArray,
4558 /* ID3D10EffectVariable methods */
4560 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4562 TRACE("iface %p\n", iface);
4564 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4567 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4568 ID3D10EffectMatrixVariable *iface)
4570 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4573 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4574 D3D10_EFFECT_VARIABLE_DESC *desc)
4576 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4579 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4580 ID3D10EffectMatrixVariable *iface, UINT index)
4582 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4585 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4586 ID3D10EffectMatrixVariable *iface, const char *name)
4588 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4591 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4592 ID3D10EffectMatrixVariable *iface, UINT index)
4594 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4597 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4598 ID3D10EffectMatrixVariable *iface, const char *name)
4600 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4603 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4604 ID3D10EffectMatrixVariable *iface, const char *semantic)
4606 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4609 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4610 ID3D10EffectMatrixVariable *iface, UINT index)
4612 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4615 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4616 ID3D10EffectMatrixVariable *iface)
4618 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4621 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4622 ID3D10EffectMatrixVariable *iface)
4624 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4627 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4628 ID3D10EffectMatrixVariable *iface)
4630 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4633 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4634 ID3D10EffectMatrixVariable *iface)
4636 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4639 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4640 ID3D10EffectMatrixVariable *iface)
4642 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4645 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4646 ID3D10EffectMatrixVariable *iface)
4648 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4651 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4652 ID3D10EffectMatrixVariable *iface)
4654 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4657 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4658 ID3D10EffectMatrixVariable *iface)
4660 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4663 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4664 ID3D10EffectMatrixVariable *iface)
4666 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4669 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4670 ID3D10EffectMatrixVariable *iface)
4672 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4675 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4676 ID3D10EffectMatrixVariable *iface)
4678 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4681 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4682 ID3D10EffectMatrixVariable *iface)
4684 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4687 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4688 ID3D10EffectMatrixVariable *iface)
4690 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4693 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4694 ID3D10EffectMatrixVariable *iface)
4696 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4699 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4700 void *data, UINT offset, UINT count)
4702 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4705 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4706 void *data, UINT offset, UINT count)
4708 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4711 /* ID3D10EffectMatrixVariable methods */
4713 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4714 float *data)
4716 FIXME("iface %p, data %p stub!\n", iface, data);
4718 return E_NOTIMPL;
4721 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4722 float *data)
4724 FIXME("iface %p, data %p stub!\n", iface, data);
4726 return E_NOTIMPL;
4729 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4730 float *data, UINT offset, UINT count)
4732 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4734 return E_NOTIMPL;
4737 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4738 float *data, UINT offset, UINT count)
4740 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4742 return E_NOTIMPL;
4745 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4746 float *data)
4748 FIXME("iface %p, data %p stub!\n", iface, data);
4750 return E_NOTIMPL;
4753 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4754 float *data)
4756 FIXME("iface %p, data %p stub!\n", iface, data);
4758 return E_NOTIMPL;
4761 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4762 float *data, UINT offset, UINT count)
4764 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4766 return E_NOTIMPL;
4769 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4770 float *data, UINT offset, UINT count)
4772 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4774 return E_NOTIMPL;
4778 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4780 /* ID3D10EffectVariable methods */
4781 d3d10_effect_matrix_variable_IsValid,
4782 d3d10_effect_matrix_variable_GetType,
4783 d3d10_effect_matrix_variable_GetDesc,
4784 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4785 d3d10_effect_matrix_variable_GetAnnotationByName,
4786 d3d10_effect_matrix_variable_GetMemberByIndex,
4787 d3d10_effect_matrix_variable_GetMemberByName,
4788 d3d10_effect_matrix_variable_GetMemberBySemantic,
4789 d3d10_effect_matrix_variable_GetElement,
4790 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4791 d3d10_effect_matrix_variable_AsScalar,
4792 d3d10_effect_matrix_variable_AsVector,
4793 d3d10_effect_matrix_variable_AsMatrix,
4794 d3d10_effect_matrix_variable_AsString,
4795 d3d10_effect_matrix_variable_AsShaderResource,
4796 d3d10_effect_matrix_variable_AsRenderTargetView,
4797 d3d10_effect_matrix_variable_AsDepthStencilView,
4798 d3d10_effect_matrix_variable_AsConstantBuffer,
4799 d3d10_effect_matrix_variable_AsShader,
4800 d3d10_effect_matrix_variable_AsBlend,
4801 d3d10_effect_matrix_variable_AsDepthStencil,
4802 d3d10_effect_matrix_variable_AsRasterizer,
4803 d3d10_effect_matrix_variable_AsSampler,
4804 d3d10_effect_matrix_variable_SetRawValue,
4805 d3d10_effect_matrix_variable_GetRawValue,
4806 /* ID3D10EffectMatrixVariable methods */
4807 d3d10_effect_matrix_variable_SetMatrix,
4808 d3d10_effect_matrix_variable_GetMatrix,
4809 d3d10_effect_matrix_variable_SetMatrixArray,
4810 d3d10_effect_matrix_variable_GetMatrixArray,
4811 d3d10_effect_matrix_variable_SetMatrixTranspose,
4812 d3d10_effect_matrix_variable_GetMatrixTranspose,
4813 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4814 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4817 /* ID3D10EffectVariable methods */
4819 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4821 TRACE("iface %p\n", iface);
4823 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4826 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4827 ID3D10EffectStringVariable *iface)
4829 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4832 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4833 D3D10_EFFECT_VARIABLE_DESC *desc)
4835 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4838 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4839 ID3D10EffectStringVariable *iface, UINT index)
4841 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4844 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4845 ID3D10EffectStringVariable *iface, const char *name)
4847 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4850 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4851 ID3D10EffectStringVariable *iface, UINT index)
4853 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4856 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4857 ID3D10EffectStringVariable *iface, const char *name)
4859 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4862 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4863 ID3D10EffectStringVariable *iface, const char *semantic)
4865 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4868 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4869 ID3D10EffectStringVariable *iface, UINT index)
4871 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4874 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4875 ID3D10EffectStringVariable *iface)
4877 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4880 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4881 ID3D10EffectStringVariable *iface)
4883 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4886 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4887 ID3D10EffectStringVariable *iface)
4889 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4892 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4893 ID3D10EffectStringVariable *iface)
4895 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4898 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4899 ID3D10EffectStringVariable *iface)
4901 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4904 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4905 ID3D10EffectStringVariable *iface)
4907 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4910 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4911 ID3D10EffectStringVariable *iface)
4913 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4916 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4917 ID3D10EffectStringVariable *iface)
4919 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4922 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4923 ID3D10EffectStringVariable *iface)
4925 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4928 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4929 ID3D10EffectStringVariable *iface)
4931 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4934 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4935 ID3D10EffectStringVariable *iface)
4937 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4940 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4941 ID3D10EffectStringVariable *iface)
4943 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4946 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4947 ID3D10EffectStringVariable *iface)
4949 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4952 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4953 ID3D10EffectStringVariable *iface)
4955 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4958 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4959 void *data, UINT offset, UINT count)
4961 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4964 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4965 void *data, UINT offset, UINT count)
4967 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4970 /* ID3D10EffectStringVariable methods */
4972 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4973 const char **str)
4975 FIXME("iface %p, str %p stub!\n", iface, str);
4977 return E_NOTIMPL;
4980 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4981 const char **strs, UINT offset, UINT count)
4983 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4985 return E_NOTIMPL;
4989 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4991 /* ID3D10EffectVariable methods */
4992 d3d10_effect_string_variable_IsValid,
4993 d3d10_effect_string_variable_GetType,
4994 d3d10_effect_string_variable_GetDesc,
4995 d3d10_effect_string_variable_GetAnnotationByIndex,
4996 d3d10_effect_string_variable_GetAnnotationByName,
4997 d3d10_effect_string_variable_GetMemberByIndex,
4998 d3d10_effect_string_variable_GetMemberByName,
4999 d3d10_effect_string_variable_GetMemberBySemantic,
5000 d3d10_effect_string_variable_GetElement,
5001 d3d10_effect_string_variable_GetParentConstantBuffer,
5002 d3d10_effect_string_variable_AsScalar,
5003 d3d10_effect_string_variable_AsVector,
5004 d3d10_effect_string_variable_AsMatrix,
5005 d3d10_effect_string_variable_AsString,
5006 d3d10_effect_string_variable_AsShaderResource,
5007 d3d10_effect_string_variable_AsRenderTargetView,
5008 d3d10_effect_string_variable_AsDepthStencilView,
5009 d3d10_effect_string_variable_AsConstantBuffer,
5010 d3d10_effect_string_variable_AsShader,
5011 d3d10_effect_string_variable_AsBlend,
5012 d3d10_effect_string_variable_AsDepthStencil,
5013 d3d10_effect_string_variable_AsRasterizer,
5014 d3d10_effect_string_variable_AsSampler,
5015 d3d10_effect_string_variable_SetRawValue,
5016 d3d10_effect_string_variable_GetRawValue,
5017 /* ID3D10EffectStringVariable methods */
5018 d3d10_effect_string_variable_GetString,
5019 d3d10_effect_string_variable_GetStringArray,
5022 /* ID3D10EffectVariable methods */
5024 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
5026 TRACE("iface %p\n", iface);
5028 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
5031 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
5032 ID3D10EffectShaderResourceVariable *iface)
5034 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5037 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
5038 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5040 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5043 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
5044 ID3D10EffectShaderResourceVariable *iface, UINT index)
5046 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5049 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
5050 ID3D10EffectShaderResourceVariable *iface, const char *name)
5052 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5055 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
5056 ID3D10EffectShaderResourceVariable *iface, UINT index)
5058 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5061 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
5062 ID3D10EffectShaderResourceVariable *iface, const char *name)
5064 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5067 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
5068 ID3D10EffectShaderResourceVariable *iface, const char *semantic)
5070 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5073 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
5074 ID3D10EffectShaderResourceVariable *iface, UINT index)
5076 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5079 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
5080 ID3D10EffectShaderResourceVariable *iface)
5082 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5085 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
5086 ID3D10EffectShaderResourceVariable *iface)
5088 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5091 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
5092 ID3D10EffectShaderResourceVariable *iface)
5094 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5097 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
5098 ID3D10EffectShaderResourceVariable *iface)
5100 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5103 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
5104 ID3D10EffectShaderResourceVariable *iface)
5106 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5109 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
5110 ID3D10EffectShaderResourceVariable *iface)
5112 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5115 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
5116 ID3D10EffectShaderResourceVariable *iface)
5118 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5121 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
5122 ID3D10EffectShaderResourceVariable *iface)
5124 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5127 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
5128 ID3D10EffectShaderResourceVariable *iface)
5130 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5133 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
5134 ID3D10EffectShaderResourceVariable *iface)
5136 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5139 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
5140 ID3D10EffectShaderResourceVariable *iface)
5142 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5145 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
5146 ID3D10EffectShaderResourceVariable *iface)
5148 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5151 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5152 ID3D10EffectShaderResourceVariable *iface)
5154 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5157 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5158 ID3D10EffectShaderResourceVariable *iface)
5160 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5163 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5164 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5166 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5169 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5170 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5172 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5175 /* ID3D10EffectShaderResourceVariable methods */
5177 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5178 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5180 FIXME("iface %p, resource %p stub!\n", iface, resource);
5182 return E_NOTIMPL;
5185 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5186 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5188 FIXME("iface %p, resource %p stub!\n", iface, resource);
5190 return E_NOTIMPL;
5193 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5194 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5196 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5198 return E_NOTIMPL;
5201 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5202 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5204 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5206 return E_NOTIMPL;
5210 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5212 /* ID3D10EffectVariable methods */
5213 d3d10_effect_shader_resource_variable_IsValid,
5214 d3d10_effect_shader_resource_variable_GetType,
5215 d3d10_effect_shader_resource_variable_GetDesc,
5216 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5217 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5218 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5219 d3d10_effect_shader_resource_variable_GetMemberByName,
5220 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5221 d3d10_effect_shader_resource_variable_GetElement,
5222 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5223 d3d10_effect_shader_resource_variable_AsScalar,
5224 d3d10_effect_shader_resource_variable_AsVector,
5225 d3d10_effect_shader_resource_variable_AsMatrix,
5226 d3d10_effect_shader_resource_variable_AsString,
5227 d3d10_effect_shader_resource_variable_AsShaderResource,
5228 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5229 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5230 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5231 d3d10_effect_shader_resource_variable_AsShader,
5232 d3d10_effect_shader_resource_variable_AsBlend,
5233 d3d10_effect_shader_resource_variable_AsDepthStencil,
5234 d3d10_effect_shader_resource_variable_AsRasterizer,
5235 d3d10_effect_shader_resource_variable_AsSampler,
5236 d3d10_effect_shader_resource_variable_SetRawValue,
5237 d3d10_effect_shader_resource_variable_GetRawValue,
5238 /* ID3D10EffectShaderResourceVariable methods */
5239 d3d10_effect_shader_resource_variable_SetResource,
5240 d3d10_effect_shader_resource_variable_GetResource,
5241 d3d10_effect_shader_resource_variable_SetResourceArray,
5242 d3d10_effect_shader_resource_variable_GetResourceArray,
5245 /* ID3D10EffectVariable methods */
5247 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5248 ID3D10EffectRenderTargetViewVariable *iface)
5250 TRACE("iface %p\n", iface);
5252 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5255 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5256 ID3D10EffectRenderTargetViewVariable *iface)
5258 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5261 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5262 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5264 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5267 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5268 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5270 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5273 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5274 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5276 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5279 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5280 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5282 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5285 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5286 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5288 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5291 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5292 ID3D10EffectRenderTargetViewVariable *iface, const char *semantic)
5294 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5297 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5298 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5300 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5303 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5304 ID3D10EffectRenderTargetViewVariable *iface)
5306 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5309 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5310 ID3D10EffectRenderTargetViewVariable *iface)
5312 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5315 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5316 ID3D10EffectRenderTargetViewVariable *iface)
5318 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5321 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5322 ID3D10EffectRenderTargetViewVariable *iface)
5324 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5327 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5328 ID3D10EffectRenderTargetViewVariable *iface)
5330 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5333 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5334 ID3D10EffectRenderTargetViewVariable *iface)
5336 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5339 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5340 ID3D10EffectRenderTargetViewVariable *iface)
5342 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5345 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5346 ID3D10EffectRenderTargetViewVariable *iface)
5348 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5351 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5352 ID3D10EffectRenderTargetViewVariable *iface)
5354 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5357 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5358 ID3D10EffectRenderTargetViewVariable *iface)
5360 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5363 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5364 ID3D10EffectRenderTargetViewVariable *iface)
5366 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5369 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5370 ID3D10EffectRenderTargetViewVariable *iface)
5372 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5375 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5376 ID3D10EffectRenderTargetViewVariable *iface)
5378 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5381 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5382 ID3D10EffectRenderTargetViewVariable *iface)
5384 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5387 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5388 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5390 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5393 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5394 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5396 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5399 /* ID3D10EffectRenderTargetViewVariable methods */
5401 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5402 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5404 FIXME("iface %p, view %p stub!\n", iface, view);
5406 return E_NOTIMPL;
5409 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5410 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5412 FIXME("iface %p, view %p stub!\n", iface, view);
5414 return E_NOTIMPL;
5417 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5418 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5420 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5422 return E_NOTIMPL;
5425 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5426 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5428 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5430 return E_NOTIMPL;
5434 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5436 /* ID3D10EffectVariable methods */
5437 d3d10_effect_render_target_view_variable_IsValid,
5438 d3d10_effect_render_target_view_variable_GetType,
5439 d3d10_effect_render_target_view_variable_GetDesc,
5440 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5441 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5442 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5443 d3d10_effect_render_target_view_variable_GetMemberByName,
5444 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5445 d3d10_effect_render_target_view_variable_GetElement,
5446 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5447 d3d10_effect_render_target_view_variable_AsScalar,
5448 d3d10_effect_render_target_view_variable_AsVector,
5449 d3d10_effect_render_target_view_variable_AsMatrix,
5450 d3d10_effect_render_target_view_variable_AsString,
5451 d3d10_effect_render_target_view_variable_AsShaderResource,
5452 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5453 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5454 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5455 d3d10_effect_render_target_view_variable_AsShader,
5456 d3d10_effect_render_target_view_variable_AsBlend,
5457 d3d10_effect_render_target_view_variable_AsDepthStencil,
5458 d3d10_effect_render_target_view_variable_AsRasterizer,
5459 d3d10_effect_render_target_view_variable_AsSampler,
5460 d3d10_effect_render_target_view_variable_SetRawValue,
5461 d3d10_effect_render_target_view_variable_GetRawValue,
5462 /* ID3D10EffectRenderTargetViewVariable methods */
5463 d3d10_effect_render_target_view_variable_SetRenderTarget,
5464 d3d10_effect_render_target_view_variable_GetRenderTarget,
5465 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5466 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5469 /* ID3D10EffectVariable methods */
5471 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5472 ID3D10EffectDepthStencilViewVariable *iface)
5474 TRACE("iface %p\n", iface);
5476 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5479 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5480 ID3D10EffectDepthStencilViewVariable *iface)
5482 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5485 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5486 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5488 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5491 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5492 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5494 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5497 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5498 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5500 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5503 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5504 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5506 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5509 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5510 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5512 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5515 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5516 ID3D10EffectDepthStencilViewVariable *iface, const char *semantic)
5518 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5521 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5522 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5524 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5527 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5528 ID3D10EffectDepthStencilViewVariable *iface)
5530 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5533 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5534 ID3D10EffectDepthStencilViewVariable *iface)
5536 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5539 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5540 ID3D10EffectDepthStencilViewVariable *iface)
5542 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5545 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5546 ID3D10EffectDepthStencilViewVariable *iface)
5548 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5551 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5552 ID3D10EffectDepthStencilViewVariable *iface)
5554 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5557 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5558 ID3D10EffectDepthStencilViewVariable *iface)
5560 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5563 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5564 ID3D10EffectDepthStencilViewVariable *iface)
5566 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5569 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5570 ID3D10EffectDepthStencilViewVariable *iface)
5572 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5575 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5576 ID3D10EffectDepthStencilViewVariable *iface)
5578 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5581 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5582 ID3D10EffectDepthStencilViewVariable *iface)
5584 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5587 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5588 ID3D10EffectDepthStencilViewVariable *iface)
5590 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5593 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5594 ID3D10EffectDepthStencilViewVariable *iface)
5596 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5599 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5600 ID3D10EffectDepthStencilViewVariable *iface)
5602 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5605 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5606 ID3D10EffectDepthStencilViewVariable *iface)
5608 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5611 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5612 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5614 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5617 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5618 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5620 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5623 /* ID3D10EffectDepthStencilViewVariable methods */
5625 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5626 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5628 FIXME("iface %p, view %p stub!\n", iface, view);
5630 return E_NOTIMPL;
5633 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5634 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5636 FIXME("iface %p, view %p stub!\n", iface, view);
5638 return E_NOTIMPL;
5641 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5642 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5644 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5646 return E_NOTIMPL;
5649 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5650 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5652 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5654 return E_NOTIMPL;
5658 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5660 /* ID3D10EffectVariable methods */
5661 d3d10_effect_depth_stencil_view_variable_IsValid,
5662 d3d10_effect_depth_stencil_view_variable_GetType,
5663 d3d10_effect_depth_stencil_view_variable_GetDesc,
5664 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5665 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5666 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5667 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5668 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5669 d3d10_effect_depth_stencil_view_variable_GetElement,
5670 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5671 d3d10_effect_depth_stencil_view_variable_AsScalar,
5672 d3d10_effect_depth_stencil_view_variable_AsVector,
5673 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5674 d3d10_effect_depth_stencil_view_variable_AsString,
5675 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5676 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5677 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5678 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5679 d3d10_effect_depth_stencil_view_variable_AsShader,
5680 d3d10_effect_depth_stencil_view_variable_AsBlend,
5681 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5682 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5683 d3d10_effect_depth_stencil_view_variable_AsSampler,
5684 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5685 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5686 /* ID3D10EffectDepthStencilViewVariable methods */
5687 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5688 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5689 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5690 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5693 /* ID3D10EffectVariable methods */
5695 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5697 TRACE("iface %p\n", iface);
5699 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5702 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5703 ID3D10EffectShaderVariable *iface)
5705 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5708 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5709 D3D10_EFFECT_VARIABLE_DESC *desc)
5711 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5714 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5715 ID3D10EffectShaderVariable *iface, UINT index)
5717 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5720 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5721 ID3D10EffectShaderVariable *iface, const char *name)
5723 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5726 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5727 ID3D10EffectShaderVariable *iface, UINT index)
5729 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5732 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5733 ID3D10EffectShaderVariable *iface, const char *name)
5735 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5738 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5739 ID3D10EffectShaderVariable *iface, const char *semantic)
5741 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5744 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5745 ID3D10EffectShaderVariable *iface, UINT index)
5747 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5750 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5751 ID3D10EffectShaderVariable *iface)
5753 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5756 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5757 ID3D10EffectShaderVariable *iface)
5759 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5762 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5763 ID3D10EffectShaderVariable *iface)
5765 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5768 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5769 ID3D10EffectShaderVariable *iface)
5771 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5774 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5775 ID3D10EffectShaderVariable *iface)
5777 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5780 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5781 ID3D10EffectShaderVariable *iface)
5783 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5786 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5787 ID3D10EffectShaderVariable *iface)
5789 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5792 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5793 ID3D10EffectShaderVariable *iface)
5795 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5798 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5799 ID3D10EffectShaderVariable *iface)
5801 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5804 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5805 ID3D10EffectShaderVariable *iface)
5807 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5810 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5811 ID3D10EffectShaderVariable *iface)
5813 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5816 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5817 ID3D10EffectShaderVariable *iface)
5819 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5822 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5823 ID3D10EffectShaderVariable *iface)
5825 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5828 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5829 ID3D10EffectShaderVariable *iface)
5831 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5834 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5835 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5837 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5840 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5841 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5843 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5846 /* ID3D10EffectShaderVariable methods */
5848 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5849 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5851 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5853 return E_NOTIMPL;
5856 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5857 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5859 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5861 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5863 if (v->type->element_count)
5864 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5866 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5868 WARN("Shader is not a vertex shader.\n");
5869 return E_FAIL;
5872 if ((*shader = v->u.shader.shader.vs))
5873 ID3D10VertexShader_AddRef(*shader);
5875 return S_OK;
5878 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5879 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5881 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5883 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5885 if (v->type->element_count)
5886 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5888 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5890 WARN("Shader is not a geometry shader.\n");
5891 return E_FAIL;
5894 if ((*shader = v->u.shader.shader.gs))
5895 ID3D10GeometryShader_AddRef(*shader);
5897 return S_OK;
5900 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5901 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5903 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5905 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5907 if (v->type->element_count)
5908 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5910 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5912 WARN("Shader is not a pixel shader.\n");
5913 return E_FAIL;
5916 if ((*shader = v->u.shader.shader.ps))
5917 ID3D10PixelShader_AddRef(*shader);
5919 return S_OK;
5922 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5923 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5924 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5926 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5927 struct d3d10_effect_shader_variable *s;
5928 D3D10_SIGNATURE_PARAMETER_DESC *d;
5930 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5931 iface, shader_index, element_index, desc);
5933 if (!iface->lpVtbl->IsValid(iface))
5935 WARN("Null variable specified\n");
5936 return E_FAIL;
5939 /* Check shader_index, this crashes on W7/DX10 */
5940 if (shader_index >= This->effect->used_shader_count)
5942 WARN("This should crash on W7/DX10!\n");
5943 return E_FAIL;
5946 s = &This->effect->used_shaders[shader_index]->u.shader;
5947 if (!s->input_signature.signature)
5949 WARN("No shader signature\n");
5950 return D3DERR_INVALIDCALL;
5953 /* Check desc for NULL, this crashes on W7/DX10 */
5954 if (!desc)
5956 WARN("This should crash on W7/DX10!\n");
5957 return E_FAIL;
5960 if (element_index >= s->input_signature.element_count)
5962 WARN("Invalid element index specified\n");
5963 return E_INVALIDARG;
5966 d = &s->input_signature.elements[element_index];
5967 desc->SemanticName = d->SemanticName;
5968 desc->SemanticIndex = d->SemanticIndex;
5969 desc->SystemValueType = d->SystemValueType;
5970 desc->ComponentType = d->ComponentType;
5971 desc->Register = d->Register;
5972 desc->ReadWriteMask = d->ReadWriteMask;
5973 desc->Mask = d->Mask;
5975 return S_OK;
5978 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5979 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5980 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5982 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5983 struct d3d10_effect_shader_variable *s;
5984 D3D10_SIGNATURE_PARAMETER_DESC *d;
5986 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5987 iface, shader_index, element_index, desc);
5989 if (!iface->lpVtbl->IsValid(iface))
5991 WARN("Null variable specified\n");
5992 return E_FAIL;
5995 /* Check shader_index, this crashes on W7/DX10 */
5996 if (shader_index >= This->effect->used_shader_count)
5998 WARN("This should crash on W7/DX10!\n");
5999 return E_FAIL;
6002 s = &This->effect->used_shaders[shader_index]->u.shader;
6003 if (!s->output_signature.signature)
6005 WARN("No shader signature\n");
6006 return D3DERR_INVALIDCALL;
6009 /* Check desc for NULL, this crashes on W7/DX10 */
6010 if (!desc)
6012 WARN("This should crash on W7/DX10!\n");
6013 return E_FAIL;
6016 if (element_index >= s->output_signature.element_count)
6018 WARN("Invalid element index specified\n");
6019 return E_INVALIDARG;
6022 d = &s->output_signature.elements[element_index];
6023 desc->SemanticName = d->SemanticName;
6024 desc->SemanticIndex = d->SemanticIndex;
6025 desc->SystemValueType = d->SystemValueType;
6026 desc->ComponentType = d->ComponentType;
6027 desc->Register = d->Register;
6028 desc->ReadWriteMask = d->ReadWriteMask;
6029 desc->Mask = d->Mask;
6031 return S_OK;
6035 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
6037 /* ID3D10EffectVariable methods */
6038 d3d10_effect_shader_variable_IsValid,
6039 d3d10_effect_shader_variable_GetType,
6040 d3d10_effect_shader_variable_GetDesc,
6041 d3d10_effect_shader_variable_GetAnnotationByIndex,
6042 d3d10_effect_shader_variable_GetAnnotationByName,
6043 d3d10_effect_shader_variable_GetMemberByIndex,
6044 d3d10_effect_shader_variable_GetMemberByName,
6045 d3d10_effect_shader_variable_GetMemberBySemantic,
6046 d3d10_effect_shader_variable_GetElement,
6047 d3d10_effect_shader_variable_GetParentConstantBuffer,
6048 d3d10_effect_shader_variable_AsScalar,
6049 d3d10_effect_shader_variable_AsVector,
6050 d3d10_effect_shader_variable_AsMatrix,
6051 d3d10_effect_shader_variable_AsString,
6052 d3d10_effect_shader_variable_AsShaderResource,
6053 d3d10_effect_shader_variable_AsRenderTargetView,
6054 d3d10_effect_shader_variable_AsDepthStencilView,
6055 d3d10_effect_shader_variable_AsConstantBuffer,
6056 d3d10_effect_shader_variable_AsShader,
6057 d3d10_effect_shader_variable_AsBlend,
6058 d3d10_effect_shader_variable_AsDepthStencil,
6059 d3d10_effect_shader_variable_AsRasterizer,
6060 d3d10_effect_shader_variable_AsSampler,
6061 d3d10_effect_shader_variable_SetRawValue,
6062 d3d10_effect_shader_variable_GetRawValue,
6063 /* ID3D10EffectShaderVariable methods */
6064 d3d10_effect_shader_variable_GetShaderDesc,
6065 d3d10_effect_shader_variable_GetVertexShader,
6066 d3d10_effect_shader_variable_GetGeometryShader,
6067 d3d10_effect_shader_variable_GetPixelShader,
6068 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
6069 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
6072 /* ID3D10EffectVariable methods */
6074 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
6076 TRACE("iface %p\n", iface);
6078 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
6081 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
6082 ID3D10EffectBlendVariable *iface)
6084 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6087 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
6088 D3D10_EFFECT_VARIABLE_DESC *desc)
6090 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6093 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
6094 ID3D10EffectBlendVariable *iface, UINT index)
6096 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6099 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
6100 ID3D10EffectBlendVariable *iface, const char *name)
6102 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6105 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
6106 ID3D10EffectBlendVariable *iface, UINT index)
6108 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6111 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
6112 ID3D10EffectBlendVariable *iface, const char *name)
6114 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6117 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
6118 ID3D10EffectBlendVariable *iface, const char *semantic)
6120 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6123 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
6124 ID3D10EffectBlendVariable *iface, UINT index)
6126 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6129 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
6130 ID3D10EffectBlendVariable *iface)
6132 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6135 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
6136 ID3D10EffectBlendVariable *iface)
6138 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6141 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
6142 ID3D10EffectBlendVariable *iface)
6144 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6147 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6148 ID3D10EffectBlendVariable *iface)
6150 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6153 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6154 ID3D10EffectBlendVariable *iface)
6156 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6159 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6160 ID3D10EffectBlendVariable *iface)
6162 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6165 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6166 ID3D10EffectBlendVariable *iface)
6168 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6171 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6172 ID3D10EffectBlendVariable *iface)
6174 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6177 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6178 ID3D10EffectBlendVariable *iface)
6180 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6183 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6184 ID3D10EffectBlendVariable *iface)
6186 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6189 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6190 ID3D10EffectBlendVariable *iface)
6192 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6195 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6196 ID3D10EffectBlendVariable *iface)
6198 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6201 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6202 ID3D10EffectBlendVariable *iface)
6204 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6207 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6208 ID3D10EffectBlendVariable *iface)
6210 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6213 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6214 void *data, UINT offset, UINT count)
6216 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6219 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6220 void *data, UINT offset, UINT count)
6222 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6225 /* ID3D10EffectBlendVariable methods */
6227 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6228 UINT index, ID3D10BlendState **blend_state)
6230 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6232 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6234 if (v->type->element_count)
6235 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6236 else if (index)
6237 return E_FAIL;
6239 if (v->type->basetype != D3D10_SVT_BLEND)
6241 WARN("Variable is not a blend state.\n");
6242 return E_FAIL;
6245 if ((*blend_state = v->u.state.object.blend))
6246 ID3D10BlendState_AddRef(*blend_state);
6248 return S_OK;
6251 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6252 UINT index, D3D10_BLEND_DESC *desc)
6254 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6256 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6258 if (v->type->element_count)
6259 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6261 if (v->type->basetype != D3D10_SVT_BLEND)
6263 WARN("Variable is not a blend state.\n");
6264 return E_FAIL;
6267 *desc = v->u.state.desc.blend;
6269 return S_OK;
6273 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6275 /* ID3D10EffectVariable methods */
6276 d3d10_effect_blend_variable_IsValid,
6277 d3d10_effect_blend_variable_GetType,
6278 d3d10_effect_blend_variable_GetDesc,
6279 d3d10_effect_blend_variable_GetAnnotationByIndex,
6280 d3d10_effect_blend_variable_GetAnnotationByName,
6281 d3d10_effect_blend_variable_GetMemberByIndex,
6282 d3d10_effect_blend_variable_GetMemberByName,
6283 d3d10_effect_blend_variable_GetMemberBySemantic,
6284 d3d10_effect_blend_variable_GetElement,
6285 d3d10_effect_blend_variable_GetParentConstantBuffer,
6286 d3d10_effect_blend_variable_AsScalar,
6287 d3d10_effect_blend_variable_AsVector,
6288 d3d10_effect_blend_variable_AsMatrix,
6289 d3d10_effect_blend_variable_AsString,
6290 d3d10_effect_blend_variable_AsShaderResource,
6291 d3d10_effect_blend_variable_AsRenderTargetView,
6292 d3d10_effect_blend_variable_AsDepthStencilView,
6293 d3d10_effect_blend_variable_AsConstantBuffer,
6294 d3d10_effect_blend_variable_AsShader,
6295 d3d10_effect_blend_variable_AsBlend,
6296 d3d10_effect_blend_variable_AsDepthStencil,
6297 d3d10_effect_blend_variable_AsRasterizer,
6298 d3d10_effect_blend_variable_AsSampler,
6299 d3d10_effect_blend_variable_SetRawValue,
6300 d3d10_effect_blend_variable_GetRawValue,
6301 /* ID3D10EffectBlendVariable methods */
6302 d3d10_effect_blend_variable_GetBlendState,
6303 d3d10_effect_blend_variable_GetBackingStore,
6306 /* ID3D10EffectVariable methods */
6308 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6310 TRACE("iface %p\n", iface);
6312 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6315 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6316 ID3D10EffectDepthStencilVariable *iface)
6318 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6321 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6322 D3D10_EFFECT_VARIABLE_DESC *desc)
6324 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6327 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6328 ID3D10EffectDepthStencilVariable *iface, UINT index)
6330 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6333 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6334 ID3D10EffectDepthStencilVariable *iface, const char *name)
6336 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6339 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6340 ID3D10EffectDepthStencilVariable *iface, UINT index)
6342 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6345 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6346 ID3D10EffectDepthStencilVariable *iface, const char *name)
6348 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6351 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6352 ID3D10EffectDepthStencilVariable *iface, const char *semantic)
6354 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6357 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6358 ID3D10EffectDepthStencilVariable *iface, UINT index)
6360 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6363 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6364 ID3D10EffectDepthStencilVariable *iface)
6366 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6369 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6370 ID3D10EffectDepthStencilVariable *iface)
6372 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6375 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6376 ID3D10EffectDepthStencilVariable *iface)
6378 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6381 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6382 ID3D10EffectDepthStencilVariable *iface)
6384 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6387 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6388 ID3D10EffectDepthStencilVariable *iface)
6390 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6393 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6394 ID3D10EffectDepthStencilVariable *iface)
6396 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6399 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6400 ID3D10EffectDepthStencilVariable *iface)
6402 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6405 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6406 ID3D10EffectDepthStencilVariable *iface)
6408 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6411 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6412 ID3D10EffectDepthStencilVariable *iface)
6414 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6417 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6418 ID3D10EffectDepthStencilVariable *iface)
6420 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6423 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6424 ID3D10EffectDepthStencilVariable *iface)
6426 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6429 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6430 ID3D10EffectDepthStencilVariable *iface)
6432 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6435 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6436 ID3D10EffectDepthStencilVariable *iface)
6438 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6441 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6442 ID3D10EffectDepthStencilVariable *iface)
6444 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6447 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6448 void *data, UINT offset, UINT count)
6450 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6453 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6454 void *data, UINT offset, UINT count)
6456 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6459 /* ID3D10EffectDepthStencilVariable methods */
6461 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6462 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6464 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6466 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6468 if (v->type->element_count)
6469 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6470 else if (index)
6471 return E_FAIL;
6473 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6475 WARN("Variable is not a depth stencil state.\n");
6476 return E_FAIL;
6479 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6480 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6482 return S_OK;
6485 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6486 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6488 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6490 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6492 if (v->type->element_count)
6493 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6495 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6497 WARN("Variable is not a depth stencil state.\n");
6498 return E_FAIL;
6501 *desc = v->u.state.desc.depth_stencil;
6503 return S_OK;
6507 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6509 /* ID3D10EffectVariable methods */
6510 d3d10_effect_depth_stencil_variable_IsValid,
6511 d3d10_effect_depth_stencil_variable_GetType,
6512 d3d10_effect_depth_stencil_variable_GetDesc,
6513 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6514 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6515 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6516 d3d10_effect_depth_stencil_variable_GetMemberByName,
6517 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6518 d3d10_effect_depth_stencil_variable_GetElement,
6519 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6520 d3d10_effect_depth_stencil_variable_AsScalar,
6521 d3d10_effect_depth_stencil_variable_AsVector,
6522 d3d10_effect_depth_stencil_variable_AsMatrix,
6523 d3d10_effect_depth_stencil_variable_AsString,
6524 d3d10_effect_depth_stencil_variable_AsShaderResource,
6525 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6526 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6527 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6528 d3d10_effect_depth_stencil_variable_AsShader,
6529 d3d10_effect_depth_stencil_variable_AsBlend,
6530 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6531 d3d10_effect_depth_stencil_variable_AsRasterizer,
6532 d3d10_effect_depth_stencil_variable_AsSampler,
6533 d3d10_effect_depth_stencil_variable_SetRawValue,
6534 d3d10_effect_depth_stencil_variable_GetRawValue,
6535 /* ID3D10EffectDepthStencilVariable methods */
6536 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6537 d3d10_effect_depth_stencil_variable_GetBackingStore,
6540 /* ID3D10EffectVariable methods */
6542 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6544 TRACE("iface %p\n", iface);
6546 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6549 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6550 ID3D10EffectRasterizerVariable *iface)
6552 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6555 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6556 D3D10_EFFECT_VARIABLE_DESC *desc)
6558 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6561 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6562 ID3D10EffectRasterizerVariable *iface, UINT index)
6564 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6567 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6568 ID3D10EffectRasterizerVariable *iface, const char *name)
6570 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6573 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6574 ID3D10EffectRasterizerVariable *iface, UINT index)
6576 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6579 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6580 ID3D10EffectRasterizerVariable *iface, const char *name)
6582 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6585 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6586 ID3D10EffectRasterizerVariable *iface, const char *semantic)
6588 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6591 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6592 ID3D10EffectRasterizerVariable *iface, UINT index)
6594 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6597 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6598 ID3D10EffectRasterizerVariable *iface)
6600 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6603 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6604 ID3D10EffectRasterizerVariable *iface)
6606 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6609 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6610 ID3D10EffectRasterizerVariable *iface)
6612 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6615 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6616 ID3D10EffectRasterizerVariable *iface)
6618 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6621 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6622 ID3D10EffectRasterizerVariable *iface)
6624 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6627 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6628 ID3D10EffectRasterizerVariable *iface)
6630 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6633 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6634 ID3D10EffectRasterizerVariable *iface)
6636 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6639 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6640 ID3D10EffectRasterizerVariable *iface)
6642 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6645 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6646 ID3D10EffectRasterizerVariable *iface)
6648 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6651 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6652 ID3D10EffectRasterizerVariable *iface)
6654 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6657 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6658 ID3D10EffectRasterizerVariable *iface)
6660 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6663 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6664 ID3D10EffectRasterizerVariable *iface)
6666 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6669 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6670 ID3D10EffectRasterizerVariable *iface)
6672 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6675 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6676 ID3D10EffectRasterizerVariable *iface)
6678 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6681 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6682 void *data, UINT offset, UINT count)
6684 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6687 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6688 void *data, UINT offset, UINT count)
6690 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6693 /* ID3D10EffectRasterizerVariable methods */
6695 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6696 UINT index, ID3D10RasterizerState **rasterizer_state)
6698 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6700 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6702 if (v->type->element_count)
6703 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6704 else if (index)
6705 return E_FAIL;
6707 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6709 WARN("Variable is not a rasterizer state.\n");
6710 return E_FAIL;
6713 if ((*rasterizer_state = v->u.state.object.rasterizer))
6714 ID3D10RasterizerState_AddRef(*rasterizer_state);
6716 return S_OK;
6719 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6720 UINT index, D3D10_RASTERIZER_DESC *desc)
6722 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6724 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6726 if (v->type->element_count)
6727 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6729 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6731 WARN("Variable is not a rasterizer state.\n");
6732 return E_FAIL;
6735 *desc = v->u.state.desc.rasterizer;
6737 return S_OK;
6741 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6743 /* ID3D10EffectVariable methods */
6744 d3d10_effect_rasterizer_variable_IsValid,
6745 d3d10_effect_rasterizer_variable_GetType,
6746 d3d10_effect_rasterizer_variable_GetDesc,
6747 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6748 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6749 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6750 d3d10_effect_rasterizer_variable_GetMemberByName,
6751 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6752 d3d10_effect_rasterizer_variable_GetElement,
6753 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6754 d3d10_effect_rasterizer_variable_AsScalar,
6755 d3d10_effect_rasterizer_variable_AsVector,
6756 d3d10_effect_rasterizer_variable_AsMatrix,
6757 d3d10_effect_rasterizer_variable_AsString,
6758 d3d10_effect_rasterizer_variable_AsShaderResource,
6759 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6760 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6761 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6762 d3d10_effect_rasterizer_variable_AsShader,
6763 d3d10_effect_rasterizer_variable_AsBlend,
6764 d3d10_effect_rasterizer_variable_AsDepthStencil,
6765 d3d10_effect_rasterizer_variable_AsRasterizer,
6766 d3d10_effect_rasterizer_variable_AsSampler,
6767 d3d10_effect_rasterizer_variable_SetRawValue,
6768 d3d10_effect_rasterizer_variable_GetRawValue,
6769 /* ID3D10EffectRasterizerVariable methods */
6770 d3d10_effect_rasterizer_variable_GetRasterizerState,
6771 d3d10_effect_rasterizer_variable_GetBackingStore,
6774 /* ID3D10EffectVariable methods */
6776 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6778 TRACE("iface %p\n", iface);
6780 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6783 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6784 ID3D10EffectSamplerVariable *iface)
6786 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6789 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6790 D3D10_EFFECT_VARIABLE_DESC *desc)
6792 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6795 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6796 ID3D10EffectSamplerVariable *iface, UINT index)
6798 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6801 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6802 ID3D10EffectSamplerVariable *iface, const char *name)
6804 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6807 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6808 ID3D10EffectSamplerVariable *iface, UINT index)
6810 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6813 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6814 ID3D10EffectSamplerVariable *iface, const char *name)
6816 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6819 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6820 ID3D10EffectSamplerVariable *iface, const char *semantic)
6822 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6825 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6826 ID3D10EffectSamplerVariable *iface, UINT index)
6828 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6831 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6832 ID3D10EffectSamplerVariable *iface)
6834 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6837 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6838 ID3D10EffectSamplerVariable *iface)
6840 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6843 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6844 ID3D10EffectSamplerVariable *iface)
6846 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6849 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6850 ID3D10EffectSamplerVariable *iface)
6852 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6855 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6856 ID3D10EffectSamplerVariable *iface)
6858 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6861 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6862 ID3D10EffectSamplerVariable *iface)
6864 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6867 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6868 ID3D10EffectSamplerVariable *iface)
6870 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6873 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6874 ID3D10EffectSamplerVariable *iface)
6876 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6879 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6880 ID3D10EffectSamplerVariable *iface)
6882 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6885 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6886 ID3D10EffectSamplerVariable *iface)
6888 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6891 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6892 ID3D10EffectSamplerVariable *iface)
6894 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6897 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6898 ID3D10EffectSamplerVariable *iface)
6900 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6903 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6904 ID3D10EffectSamplerVariable *iface)
6906 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6909 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6910 ID3D10EffectSamplerVariable *iface)
6912 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6915 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6916 void *data, UINT offset, UINT count)
6918 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6921 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6922 void *data, UINT offset, UINT count)
6924 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6927 /* ID3D10EffectSamplerVariable methods */
6929 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6930 UINT index, ID3D10SamplerState **sampler)
6932 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6934 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6936 if (v->type->element_count)
6937 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6938 else if (index)
6939 return E_FAIL;
6941 if (v->type->basetype != D3D10_SVT_SAMPLER)
6943 WARN("Variable is not a sampler state.\n");
6944 return E_FAIL;
6947 if ((*sampler = v->u.state.object.sampler))
6948 ID3D10SamplerState_AddRef(*sampler);
6950 return S_OK;
6953 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6954 UINT index, D3D10_SAMPLER_DESC *desc)
6956 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6958 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6960 if (v->type->element_count)
6961 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6963 if (v->type->basetype != D3D10_SVT_SAMPLER)
6965 WARN("Variable is not a sampler state.\n");
6966 return E_FAIL;
6969 *desc = v->u.state.desc.sampler;
6971 return S_OK;
6975 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6977 /* ID3D10EffectVariable methods */
6978 d3d10_effect_sampler_variable_IsValid,
6979 d3d10_effect_sampler_variable_GetType,
6980 d3d10_effect_sampler_variable_GetDesc,
6981 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6982 d3d10_effect_sampler_variable_GetAnnotationByName,
6983 d3d10_effect_sampler_variable_GetMemberByIndex,
6984 d3d10_effect_sampler_variable_GetMemberByName,
6985 d3d10_effect_sampler_variable_GetMemberBySemantic,
6986 d3d10_effect_sampler_variable_GetElement,
6987 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6988 d3d10_effect_sampler_variable_AsScalar,
6989 d3d10_effect_sampler_variable_AsVector,
6990 d3d10_effect_sampler_variable_AsMatrix,
6991 d3d10_effect_sampler_variable_AsString,
6992 d3d10_effect_sampler_variable_AsShaderResource,
6993 d3d10_effect_sampler_variable_AsRenderTargetView,
6994 d3d10_effect_sampler_variable_AsDepthStencilView,
6995 d3d10_effect_sampler_variable_AsConstantBuffer,
6996 d3d10_effect_sampler_variable_AsShader,
6997 d3d10_effect_sampler_variable_AsBlend,
6998 d3d10_effect_sampler_variable_AsDepthStencil,
6999 d3d10_effect_sampler_variable_AsRasterizer,
7000 d3d10_effect_sampler_variable_AsSampler,
7001 d3d10_effect_sampler_variable_SetRawValue,
7002 d3d10_effect_sampler_variable_GetRawValue,
7003 /* ID3D10EffectSamplerVariable methods */
7004 d3d10_effect_sampler_variable_GetSampler,
7005 d3d10_effect_sampler_variable_GetBackingStore,
7008 /* ID3D10EffectType methods */
7010 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
7012 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
7015 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
7017 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7019 TRACE("iface %p\n", iface);
7021 return This != &null_type;
7024 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
7026 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7028 TRACE("iface %p, desc %p\n", iface, desc);
7030 if (This == &null_type)
7032 WARN("Null type specified\n");
7033 return E_FAIL;
7036 if (!desc)
7038 WARN("Invalid argument specified\n");
7039 return E_INVALIDARG;
7042 desc->TypeName = This->name;
7043 desc->Class = This->type_class;
7044 desc->Type = This->basetype;
7045 desc->Elements = This->element_count;
7046 desc->Members = This->member_count;
7047 desc->Rows = This->row_count;
7048 desc->Columns = This->column_count;
7049 desc->PackedSize = This->size_packed;
7050 desc->UnpackedSize = This->size_unpacked;
7051 desc->Stride = This->stride;
7053 return S_OK;
7056 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
7057 UINT index)
7059 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7060 struct d3d10_effect_type *t;
7062 TRACE("iface %p, index %u\n", iface, index);
7064 if (index >= This->member_count)
7066 WARN("Invalid index specified\n");
7067 return &null_type.ID3D10EffectType_iface;
7070 t = (&This->members[index])->type;
7072 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
7074 return &t->ID3D10EffectType_iface;
7077 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
7078 const char *name)
7080 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7081 unsigned int i;
7083 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
7085 if (!name)
7087 WARN("Invalid name specified\n");
7088 return &null_type.ID3D10EffectType_iface;
7091 for (i = 0; i < This->member_count; ++i)
7093 struct d3d10_effect_type_member *typem = &This->members[i];
7095 if (typem->name && !strcmp(typem->name, name))
7097 TRACE("Returning type %p.\n", typem->type);
7098 return &typem->type->ID3D10EffectType_iface;
7102 WARN("Invalid name specified\n");
7104 return &null_type.ID3D10EffectType_iface;
7107 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
7108 const char *semantic)
7110 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7111 unsigned int i;
7113 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
7115 if (!semantic)
7117 WARN("Invalid semantic specified\n");
7118 return &null_type.ID3D10EffectType_iface;
7121 for (i = 0; i < This->member_count; ++i)
7123 struct d3d10_effect_type_member *typem = &This->members[i];
7125 if (typem->semantic && !strcmp(typem->semantic, semantic))
7127 TRACE("Returning type %p.\n", typem->type);
7128 return &typem->type->ID3D10EffectType_iface;
7132 WARN("Invalid semantic specified\n");
7134 return &null_type.ID3D10EffectType_iface;
7137 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
7139 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7140 struct d3d10_effect_type_member *typem;
7142 TRACE("iface %p, index %u\n", iface, index);
7144 if (index >= This->member_count)
7146 WARN("Invalid index specified\n");
7147 return NULL;
7150 typem = &This->members[index];
7152 TRACE("Returning name %s\n", debugstr_a(typem->name));
7154 return typem->name;
7157 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7159 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7160 struct d3d10_effect_type_member *typem;
7162 TRACE("iface %p, index %u\n", iface, index);
7164 if (index >= This->member_count)
7166 WARN("Invalid index specified\n");
7167 return NULL;
7170 typem = &This->members[index];
7172 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7174 return typem->semantic;
7177 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7179 /* ID3D10EffectType */
7180 d3d10_effect_type_IsValid,
7181 d3d10_effect_type_GetDesc,
7182 d3d10_effect_type_GetMemberTypeByIndex,
7183 d3d10_effect_type_GetMemberTypeByName,
7184 d3d10_effect_type_GetMemberTypeBySemantic,
7185 d3d10_effect_type_GetMemberName,
7186 d3d10_effect_type_GetMemberSemantic,