d3d8/tests: Make the window client rect match the d3d swapchain size.
[wine.git] / dlls / d3d10 / effect.c
blob4760489d0852385b143479356cbd6e116c2f56a1
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2009 Rico Schüller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include "d3d10_private.h"
26 #include <float.h>
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
30 #define D3D10_FX10_TYPE_COLUMN_SHIFT 11
31 #define D3D10_FX10_TYPE_COLUMN_MASK (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
33 #define D3D10_FX10_TYPE_ROW_SHIFT 8
34 #define D3D10_FX10_TYPE_ROW_MASK (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
36 #define D3D10_FX10_TYPE_BASETYPE_SHIFT 3
37 #define D3D10_FX10_TYPE_BASETYPE_MASK (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
39 #define D3D10_FX10_TYPE_CLASS_SHIFT 0
40 #define D3D10_FX10_TYPE_CLASS_MASK (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
42 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
44 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
45 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
46 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
47 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
48 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
49 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
50 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
51 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl;
52 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl;
53 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl;
54 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl;
55 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl;
56 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
57 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl;
58 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl;
59 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl;
60 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
62 /* null objects - needed for invalid calls */
63 static struct d3d10_effect_technique null_technique = {{&d3d10_effect_technique_vtbl}};
64 static struct d3d10_effect_pass null_pass = {{&d3d10_effect_pass_vtbl}};
65 static struct d3d10_effect_type null_type = {{&d3d10_effect_type_vtbl}};
66 static struct d3d10_effect_variable null_local_buffer = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl},
67 &null_local_buffer, &null_type};
68 static struct d3d10_effect_variable null_variable = {{&d3d10_effect_variable_vtbl},
69 &null_local_buffer, &null_type};
70 static struct d3d10_effect_variable null_scalar_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl},
71 &null_local_buffer, &null_type};
72 static struct d3d10_effect_variable null_vector_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl},
73 &null_local_buffer, &null_type};
74 static struct d3d10_effect_variable null_matrix_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl},
75 &null_local_buffer, &null_type};
76 static struct d3d10_effect_variable null_string_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl},
77 &null_local_buffer, &null_type};
78 static struct d3d10_effect_variable null_shader_resource_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl},
79 &null_local_buffer, &null_type};
80 static struct d3d10_effect_variable null_render_target_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl},
81 &null_local_buffer, &null_type};
82 static struct d3d10_effect_variable null_depth_stencil_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl},
83 &null_local_buffer, &null_type};
84 static struct d3d10_effect_variable null_shader_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
85 &null_local_buffer, &null_type};
86 static struct d3d10_effect_variable null_blend_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl},
87 &null_local_buffer, &null_type};
88 static struct d3d10_effect_variable null_depth_stencil_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl},
89 &null_local_buffer, &null_type};
90 static struct d3d10_effect_variable null_rasterizer_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl},
91 &null_local_buffer, &null_type};
92 static struct d3d10_effect_variable null_sampler_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl},
93 &null_local_buffer, &null_type};
95 /* anonymous_shader_type and anonymous_shader */
96 static char anonymous_name[] = "$Anonymous";
97 static char anonymous_vertexshader_name[] = "vertexshader";
98 static char anonymous_pixelshader_name[] = "pixelshader";
99 static char anonymous_geometryshader_name[] = "geometryshader";
100 static struct d3d10_effect_type anonymous_vs_type = {{&d3d10_effect_type_vtbl},
101 anonymous_vertexshader_name, D3D10_SVT_VERTEXSHADER, D3D10_SVC_OBJECT};
102 static struct d3d10_effect_type anonymous_ps_type = {{&d3d10_effect_type_vtbl},
103 anonymous_pixelshader_name, D3D10_SVT_PIXELSHADER, D3D10_SVC_OBJECT};
104 static struct d3d10_effect_type anonymous_gs_type = {{&d3d10_effect_type_vtbl},
105 anonymous_geometryshader_name, D3D10_SVT_GEOMETRYSHADER, D3D10_SVC_OBJECT};
106 static struct d3d10_effect_variable anonymous_vs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
107 &null_local_buffer, &anonymous_vs_type, anonymous_name};
108 static struct d3d10_effect_variable anonymous_ps = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
109 &null_local_buffer, &anonymous_ps_type, anonymous_name};
110 static struct d3d10_effect_variable anonymous_gs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
111 &null_local_buffer, &anonymous_gs_type, anonymous_name};
113 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
114 const char *data, size_t data_size, DWORD offset);
116 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
118 return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
121 struct d3d10_effect_state_property_info
123 UINT id;
124 const char *name;
125 D3D_SHADER_VARIABLE_TYPE type;
126 UINT size;
127 UINT count;
128 D3D_SHADER_VARIABLE_TYPE container_type;
129 LONG offset;
132 static const struct d3d10_effect_state_property_info property_info[] =
134 {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
135 {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
136 {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
137 {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
138 {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
139 {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
140 {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
141 {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
142 {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
143 {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
144 {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
145 {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
146 {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
147 {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
148 {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
149 {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
150 {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
151 {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
152 {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
153 {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
154 {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
155 {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
156 {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
157 {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
158 {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
159 {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
160 {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
161 {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
162 {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
163 {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
164 {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
165 {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
166 {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
167 {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
168 {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
169 {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
170 {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
171 {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
172 {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
173 {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
174 {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
175 {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
176 {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
179 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
181 D3D10_FILL_SOLID,
182 D3D10_CULL_BACK,
183 FALSE,
185 0.0f,
186 0.0f,
187 TRUE,
188 FALSE,
189 FALSE,
190 FALSE,
193 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
195 TRUE,
196 D3D10_DEPTH_WRITE_MASK_ALL,
197 D3D10_COMPARISON_LESS,
198 FALSE,
199 D3D10_DEFAULT_STENCIL_READ_MASK,
200 D3D10_DEFAULT_STENCIL_WRITE_MASK,
201 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
202 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
205 static const D3D10_BLEND_DESC default_blend_desc =
207 FALSE,
208 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
209 D3D10_BLEND_SRC_ALPHA,
210 D3D10_BLEND_INV_SRC_ALPHA,
211 D3D10_BLEND_OP_ADD,
212 D3D10_BLEND_SRC_ALPHA,
213 D3D10_BLEND_INV_SRC_ALPHA,
214 D3D10_BLEND_OP_ADD,
215 {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
218 static const D3D10_SAMPLER_DESC default_sampler_desc =
220 D3D10_FILTER_MIN_MAG_MIP_POINT,
221 D3D10_TEXTURE_ADDRESS_WRAP,
222 D3D10_TEXTURE_ADDRESS_WRAP,
223 D3D10_TEXTURE_ADDRESS_WRAP,
224 0.0f,
226 D3D10_COMPARISON_NEVER,
227 {0.0f, 0.0f, 0.0f, 0.0f},
228 0.0f,
229 FLT_MAX,
232 struct d3d10_effect_state_storage_info
234 D3D_SHADER_VARIABLE_TYPE id;
235 SIZE_T size;
236 const void *default_state;
239 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
241 {D3D10_SVT_RASTERIZER, sizeof(default_rasterizer_desc), &default_rasterizer_desc },
242 {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
243 {D3D10_SVT_BLEND, sizeof(default_blend_desc), &default_blend_desc },
244 {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc },
247 static BOOL fx10_get_string(const char *data, size_t data_size, DWORD offset, const char **s, size_t *l)
249 size_t len, max_len;
251 if (offset >= data_size)
253 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
254 return FALSE;
257 max_len = data_size - offset;
258 if (!(len = strnlen(data + offset, max_len)))
260 *s = NULL;
261 *l = 0;
262 return TRUE;
265 if (len == max_len)
266 return FALSE;
268 *s = data + offset;
269 *l = ++len;
271 return TRUE;
274 static BOOL fx10_copy_string(const char *data, size_t data_size, DWORD offset, char **s)
276 const char *p;
277 size_t len;
279 if (!fx10_get_string(data, data_size, offset, &p, &len))
280 return FALSE;
282 if (!p)
284 *s = NULL;
285 return TRUE;
288 if (!(*s = HeapAlloc(GetProcessHeap(), 0, len)))
290 ERR("Failed to allocate string memory.\n");
291 return FALSE;
294 memcpy(*s, p, len);
296 return TRUE;
299 static BOOL copy_name(const char *ptr, char **name)
301 size_t name_len;
303 if (!ptr) return TRUE;
305 name_len = strlen(ptr) + 1;
306 if (name_len == 1)
308 return TRUE;
311 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
312 if (!*name)
314 ERR("Failed to allocate name memory.\n");
315 return FALSE;
318 memcpy(*name, ptr, name_len);
320 return TRUE;
323 static const char *shader_get_string(const char *data, size_t data_size, DWORD offset)
325 const char *s;
326 size_t l;
328 if (!fx10_get_string(data, data_size, offset, &s, &l))
329 return NULL;
331 return l ? s : "";
334 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
336 D3D10_SIGNATURE_PARAMETER_DESC *e;
337 const char *ptr = data;
338 unsigned int i;
339 DWORD count;
341 if (!require_space(0, 2, sizeof(DWORD), data_size))
343 WARN("Invalid data size %#x.\n", data_size);
344 return E_INVALIDARG;
347 read_dword(&ptr, &count);
348 TRACE("%u elements\n", count);
350 skip_dword_unknown("shader signature", &ptr, 1);
352 if (!require_space(ptr - data, count, 6 * sizeof(DWORD), data_size))
354 WARN("Invalid count %#x (data size %#x).\n", count, data_size);
355 return E_INVALIDARG;
358 if (!(e = d3d10_calloc(count, sizeof(*e))))
360 ERR("Failed to allocate signature memory.\n");
361 return E_OUTOFMEMORY;
364 for (i = 0; i < count; ++i)
366 UINT name_offset;
367 UINT mask;
369 read_dword(&ptr, &name_offset);
370 if (!(e[i].SemanticName = shader_get_string(data, data_size, name_offset)))
372 WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
373 HeapFree(GetProcessHeap(), 0, e);
374 return E_INVALIDARG;
376 read_dword(&ptr, &e[i].SemanticIndex);
377 read_dword(&ptr, &e[i].SystemValueType);
378 read_dword(&ptr, &e[i].ComponentType);
379 read_dword(&ptr, &e[i].Register);
380 read_dword(&ptr, &mask);
382 e[i].ReadWriteMask = mask >> 8;
383 e[i].Mask = mask & 0xff;
385 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
386 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
387 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
388 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
391 s->elements = e;
392 s->element_count = count;
394 return S_OK;
397 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
399 HeapFree(GetProcessHeap(), 0, s->signature);
400 HeapFree(GetProcessHeap(), 0, s->elements);
403 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
405 struct d3d10_effect_shader_variable *s = ctx;
406 HRESULT hr;
408 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
410 TRACE("chunk size: %#x\n", data_size);
412 switch(tag)
414 case TAG_ISGN:
415 case TAG_OSGN:
417 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
418 UINT size = 44 + data_size;
419 struct d3d10_effect_shader_signature *sig;
420 char *ptr;
422 if (tag == TAG_ISGN) sig = &s->input_signature;
423 else sig = &s->output_signature;
425 sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
426 if (!sig->signature)
428 ERR("Failed to allocate input signature data\n");
429 return E_OUTOFMEMORY;
431 sig->signature_size = size;
433 ptr = sig->signature;
435 write_dword(&ptr, TAG_DXBC);
437 /* signature(?) */
438 write_dword_unknown(&ptr, 0);
439 write_dword_unknown(&ptr, 0);
440 write_dword_unknown(&ptr, 0);
441 write_dword_unknown(&ptr, 0);
443 /* seems to be always 1 */
444 write_dword_unknown(&ptr, 1);
446 /* DXBC size */
447 write_dword(&ptr, size);
449 /* chunk count */
450 write_dword(&ptr, 1);
452 /* chunk index */
453 write_dword(&ptr, (ptr - sig->signature) + 4);
455 /* chunk */
456 write_dword(&ptr, tag);
457 write_dword(&ptr, data_size);
458 memcpy(ptr, data, data_size);
460 hr = shader_parse_signature(ptr, data_size, sig);
461 if (FAILED(hr))
463 ERR("Failed to parse shader, hr %#x\n", hr);
464 shader_free_signature(sig);
467 break;
470 default:
471 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
472 break;
475 return S_OK;
478 static HRESULT parse_fx10_shader(const char *data, size_t data_size, DWORD offset, struct d3d10_effect_variable *v)
480 ID3D10Device *device = v->effect->device;
481 DWORD dxbc_size;
482 const char *ptr;
483 HRESULT hr;
485 if (v->effect->used_shader_current >= v->effect->used_shader_count)
487 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
488 return E_FAIL;
491 v->effect->used_shaders[v->effect->used_shader_current] = v;
492 ++v->effect->used_shader_current;
494 if (offset >= data_size || !require_space(offset, 1, sizeof(dxbc_size), data_size))
496 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
497 return E_FAIL;
500 ptr = data + offset;
501 read_dword(&ptr, &dxbc_size);
502 TRACE("dxbc size: %#x\n", dxbc_size);
504 if (!require_space(ptr - data, 1, dxbc_size, data_size))
506 WARN("Invalid dxbc size %#x (data size %#lx, offset %#x).\n", offset, (long)data_size, offset);
507 return E_FAIL;
510 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
511 if (!dxbc_size) return S_OK;
513 switch (v->type->basetype)
515 case D3D10_SVT_VERTEXSHADER:
516 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &v->u.shader.shader.vs);
517 if (FAILED(hr)) return hr;
518 break;
520 case D3D10_SVT_PIXELSHADER:
521 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &v->u.shader.shader.ps);
522 if (FAILED(hr)) return hr;
523 break;
525 case D3D10_SVT_GEOMETRYSHADER:
526 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &v->u.shader.shader.gs);
527 if (FAILED(hr)) return hr;
528 break;
530 default:
531 ERR("This should not happen!\n");
532 return E_FAIL;
535 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, &v->u.shader);
538 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
540 switch (c)
542 case 1: return D3D10_SVC_SCALAR;
543 case 2: return D3D10_SVC_VECTOR;
544 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
545 else return D3D10_SVC_MATRIX_ROWS;
546 default:
547 FIXME("Unknown variable class %#x.\n", c);
548 return 0;
552 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
554 if(is_object)
556 switch (t)
558 case 1: return D3D10_SVT_STRING;
559 case 2: return D3D10_SVT_BLEND;
560 case 3: return D3D10_SVT_DEPTHSTENCIL;
561 case 4: return D3D10_SVT_RASTERIZER;
562 case 5: return D3D10_SVT_PIXELSHADER;
563 case 6: return D3D10_SVT_VERTEXSHADER;
564 case 7: return D3D10_SVT_GEOMETRYSHADER;
566 case 10: return D3D10_SVT_TEXTURE1D;
567 case 11: return D3D10_SVT_TEXTURE1DARRAY;
568 case 12: return D3D10_SVT_TEXTURE2D;
569 case 13: return D3D10_SVT_TEXTURE2DARRAY;
570 case 14: return D3D10_SVT_TEXTURE2DMS;
571 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
572 case 16: return D3D10_SVT_TEXTURE3D;
573 case 17: return D3D10_SVT_TEXTURECUBE;
575 case 19: return D3D10_SVT_RENDERTARGETVIEW;
576 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
577 case 21: return D3D10_SVT_SAMPLER;
578 case 22: return D3D10_SVT_BUFFER;
579 default:
580 FIXME("Unknown variable type %#x.\n", t);
581 return D3D10_SVT_VOID;
584 else
586 switch (t)
588 case 1: return D3D10_SVT_FLOAT;
589 case 2: return D3D10_SVT_INT;
590 case 3: return D3D10_SVT_UINT;
591 case 4: return D3D10_SVT_BOOL;
592 default:
593 FIXME("Unknown variable type %#x.\n", t);
594 return D3D10_SVT_VOID;
599 static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset, struct d3d10_effect_type *t)
601 const char *ptr;
602 DWORD unknown0;
603 DWORD typeinfo;
604 unsigned int i;
606 if (offset >= data_size || !require_space(offset, 6, sizeof(DWORD), data_size))
608 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
609 return E_FAIL;
612 ptr = data + offset;
613 read_dword(&ptr, &offset);
614 TRACE("Type name at offset %#x.\n", offset);
616 if (!fx10_copy_string(data, data_size, offset, &t->name))
618 ERR("Failed to copy name.\n");
619 return E_OUTOFMEMORY;
621 TRACE("Type name: %s.\n", debugstr_a(t->name));
623 read_dword(&ptr, &unknown0);
624 TRACE("Unknown 0: %u.\n", unknown0);
626 read_dword(&ptr, &t->element_count);
627 TRACE("Element count: %u.\n", t->element_count);
629 read_dword(&ptr, &t->size_unpacked);
630 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
632 read_dword(&ptr, &t->stride);
633 TRACE("Stride: %#x.\n", t->stride);
635 read_dword(&ptr, &t->size_packed);
636 TRACE("Packed size %#x.\n", t->size_packed);
638 switch (unknown0)
640 case 1:
641 if (!require_space(ptr - data, 1, sizeof(typeinfo), data_size))
643 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
644 return E_FAIL;
647 read_dword(&ptr, &typeinfo);
648 t->member_count = 0;
649 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
650 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
651 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
652 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);
654 TRACE("Type description: %#x.\n", typeinfo);
655 TRACE("\tcolumns: %u.\n", t->column_count);
656 TRACE("\trows: %u.\n", t->row_count);
657 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
658 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
659 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
660 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
661 break;
663 case 2:
664 TRACE("Type is an object.\n");
666 if (!require_space(ptr - data, 1, sizeof(typeinfo), data_size))
668 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
669 return E_FAIL;
672 read_dword(&ptr, &typeinfo);
673 t->member_count = 0;
674 t->column_count = 0;
675 t->row_count = 0;
676 t->basetype = d3d10_variable_type(typeinfo, TRUE);
677 t->type_class = D3D10_SVC_OBJECT;
679 TRACE("Type description: %#x.\n", typeinfo);
680 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
681 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
682 break;
684 case 3:
685 TRACE("Type is a structure.\n");
687 if (!require_space(ptr - data, 1, sizeof(t->member_count), data_size))
689 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
690 return E_FAIL;
693 read_dword(&ptr, &t->member_count);
694 TRACE("Member count: %u.\n", t->member_count);
696 t->column_count = 0;
697 t->row_count = 0;
698 t->basetype = 0;
699 t->type_class = D3D10_SVC_STRUCT;
701 if (!(t->members = d3d10_calloc(t->member_count, sizeof(*t->members))))
703 ERR("Failed to allocate members memory.\n");
704 return E_OUTOFMEMORY;
707 if (!require_space(ptr - data, t->member_count, 4 * sizeof(DWORD), data_size))
709 WARN("Invalid member count %#x (data size %#lx, offset %#x).\n",
710 t->member_count, (long)data_size, offset);
711 return E_FAIL;
714 for (i = 0; i < t->member_count; ++i)
716 struct d3d10_effect_type_member *typem = &t->members[i];
718 read_dword(&ptr, &offset);
719 TRACE("Member name at offset %#x.\n", offset);
721 if (!fx10_copy_string(data, data_size, offset, &typem->name))
723 ERR("Failed to copy name.\n");
724 return E_OUTOFMEMORY;
726 TRACE("Member name: %s.\n", debugstr_a(typem->name));
728 read_dword(&ptr, &offset);
729 TRACE("Member semantic at offset %#x.\n", offset);
731 if (!fx10_copy_string(data, data_size, offset, &typem->semantic))
733 ERR("Failed to copy semantic.\n");
734 return E_OUTOFMEMORY;
736 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
738 read_dword(&ptr, &typem->buffer_offset);
739 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
741 read_dword(&ptr, &offset);
742 TRACE("Member type info at offset %#x.\n", offset);
744 if (!(typem->type = get_fx10_type(t->effect, data, data_size, offset)))
746 ERR("Failed to get variable type.\n");
747 return E_FAIL;
750 break;
752 default:
753 FIXME("Unhandled case %#x.\n", unknown0);
754 return E_FAIL;
757 if (t->element_count)
759 TRACE("Elementtype for type at offset: %#x\n", t->id);
761 /* allocate elementtype - we need only one, because all elements have the same type */
762 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
763 if (!t->elementtype)
765 ERR("Failed to allocate members memory.\n");
766 return E_OUTOFMEMORY;
769 /* create a copy of the original type with some minor changes */
770 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
771 t->elementtype->effect = t->effect;
773 if (!copy_name(t->name, &t->elementtype->name))
775 ERR("Failed to copy name.\n");
776 return E_OUTOFMEMORY;
778 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
780 t->elementtype->element_count = 0;
781 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
784 * Not sure if this calculation is 100% correct, but a test
785 * shows that these values work.
787 t->elementtype->size_unpacked = t->size_packed / t->element_count;
788 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
790 t->elementtype->stride = t->stride;
791 TRACE("\tStride: %#x.\n", t->elementtype->stride);
793 t->elementtype->size_packed = t->size_packed / t->element_count;
794 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
796 t->elementtype->member_count = t->member_count;
797 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
799 t->elementtype->column_count = t->column_count;
800 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
802 t->elementtype->row_count = t->row_count;
803 TRACE("\tRows: %u.\n", t->elementtype->row_count);
805 t->elementtype->basetype = t->basetype;
806 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
808 t->elementtype->type_class = t->type_class;
809 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
811 t->elementtype->members = t->members;
814 return S_OK;
817 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
818 const char *data, size_t data_size, DWORD offset)
820 struct d3d10_effect_type *type;
821 struct wine_rb_entry *entry;
822 HRESULT hr;
824 entry = wine_rb_get(&effect->types, &offset);
825 if (entry)
827 TRACE("Returning existing type.\n");
828 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
831 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
832 if (!type)
834 ERR("Failed to allocate type memory.\n");
835 return NULL;
838 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
839 type->id = offset;
840 type->effect = effect;
841 if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
843 ERR("Failed to parse type info, hr %#x.\n", hr);
844 HeapFree(GetProcessHeap(), 0, type);
845 return NULL;
848 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
850 ERR("Failed to insert type entry.\n");
851 HeapFree(GetProcessHeap(), 0, type);
852 return NULL;
855 return type;
858 static void set_variable_vtbl(struct d3d10_effect_variable *v)
860 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
862 switch (v->type->type_class)
864 case D3D10_SVC_SCALAR:
865 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
866 break;
868 case D3D10_SVC_VECTOR:
869 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
870 break;
872 case D3D10_SVC_MATRIX_ROWS:
873 case D3D10_SVC_MATRIX_COLUMNS:
874 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
875 break;
877 case D3D10_SVC_STRUCT:
878 *vtbl = &d3d10_effect_variable_vtbl;
879 break;
881 case D3D10_SVC_OBJECT:
882 switch(v->type->basetype)
884 case D3D10_SVT_STRING:
885 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
886 break;
888 case D3D10_SVT_TEXTURE1D:
889 case D3D10_SVT_TEXTURE1DARRAY:
890 case D3D10_SVT_TEXTURE2D:
891 case D3D10_SVT_TEXTURE2DARRAY:
892 case D3D10_SVT_TEXTURE2DMS:
893 case D3D10_SVT_TEXTURE2DMSARRAY:
894 case D3D10_SVT_TEXTURE3D:
895 case D3D10_SVT_TEXTURECUBE:
896 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
897 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
898 break;
900 case D3D10_SVT_RENDERTARGETVIEW:
901 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
902 break;
904 case D3D10_SVT_DEPTHSTENCILVIEW:
905 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
906 break;
908 case D3D10_SVT_DEPTHSTENCIL:
909 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
910 break;
912 case D3D10_SVT_VERTEXSHADER:
913 case D3D10_SVT_GEOMETRYSHADER:
914 case D3D10_SVT_PIXELSHADER:
915 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
916 break;
918 case D3D10_SVT_BLEND:
919 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
920 break;
922 case D3D10_SVT_RASTERIZER:
923 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
924 break;
926 case D3D10_SVT_SAMPLER:
927 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
928 break;
930 default:
931 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
932 *vtbl = &d3d10_effect_variable_vtbl;
933 break;
935 break;
937 default:
938 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
939 *vtbl = &d3d10_effect_variable_vtbl;
940 break;
944 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
946 unsigned int i;
947 HRESULT hr;
949 if (v->type->member_count)
951 if (!(v->members = d3d10_calloc(v->type->member_count, sizeof(*v->members))))
953 ERR("Failed to allocate members memory.\n");
954 return E_OUTOFMEMORY;
957 for (i = 0; i < v->type->member_count; ++i)
959 struct d3d10_effect_variable *var = &v->members[i];
960 struct d3d10_effect_type_member *typem = &v->type->members[i];
962 var->buffer = v->buffer;
963 var->effect = v->effect;
964 var->type = typem->type;
965 set_variable_vtbl(var);
967 if (!copy_name(typem->name, &var->name))
969 ERR("Failed to copy name.\n");
970 return E_OUTOFMEMORY;
972 TRACE("Variable name: %s.\n", debugstr_a(var->name));
974 if (!copy_name(typem->semantic, &var->semantic))
976 ERR("Failed to copy name.\n");
977 return E_OUTOFMEMORY;
979 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
981 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
982 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
984 hr = copy_variableinfo_from_type(var);
985 if (FAILED(hr)) return hr;
989 if (v->type->element_count)
991 unsigned int bufferoffset = v->buffer_offset;
993 if (!(v->elements = d3d10_calloc(v->type->element_count, sizeof(*v->elements))))
995 ERR("Failed to allocate elements memory.\n");
996 return E_OUTOFMEMORY;
999 for (i = 0; i < v->type->element_count; ++i)
1001 struct d3d10_effect_variable *var = &v->elements[i];
1003 var->buffer = v->buffer;
1004 var->effect = v->effect;
1005 var->type = v->type->elementtype;
1006 set_variable_vtbl(var);
1008 if (!copy_name(v->name, &var->name))
1010 ERR("Failed to copy name.\n");
1011 return E_OUTOFMEMORY;
1013 TRACE("Variable name: %s.\n", debugstr_a(var->name));
1015 if (!copy_name(v->semantic, &var->semantic))
1017 ERR("Failed to copy name.\n");
1018 return E_OUTOFMEMORY;
1020 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
1022 if (i != 0)
1024 bufferoffset += v->type->stride;
1026 var->buffer_offset = bufferoffset;
1027 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
1029 hr = copy_variableinfo_from_type(var);
1030 if (FAILED(hr)) return hr;
1034 return S_OK;
1037 static HRESULT parse_fx10_variable_head(const char *data, size_t data_size,
1038 const char **ptr, struct d3d10_effect_variable *v)
1040 DWORD offset;
1042 read_dword(ptr, &offset);
1043 TRACE("Variable name at offset %#x.\n", offset);
1045 if (!fx10_copy_string(data, data_size, offset, &v->name))
1047 ERR("Failed to copy name.\n");
1048 return E_OUTOFMEMORY;
1050 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1052 read_dword(ptr, &offset);
1053 TRACE("Variable type info at offset %#x.\n", offset);
1055 if (!(v->type = get_fx10_type(v->effect, data, data_size, offset)))
1057 ERR("Failed to get variable type.\n");
1058 return E_FAIL;
1060 set_variable_vtbl(v);
1062 return copy_variableinfo_from_type(v);
1065 static HRESULT parse_fx10_annotation(const char *data, size_t data_size,
1066 const char **ptr, struct d3d10_effect_variable *a)
1068 HRESULT hr;
1070 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, a)))
1071 return hr;
1073 skip_dword_unknown("annotation", ptr, 1);
1075 /* mark the variable as annotation */
1076 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
1078 return S_OK;
1081 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
1082 enum d3d10_effect_object_type otype)
1084 struct d3d10_effect_variable *v = &s->shader;
1085 struct d3d10_effect_type *t = &s->type;
1086 const char *shader = NULL;
1088 switch (otype)
1090 case D3D10_EOT_VERTEXSHADER:
1091 shader = "vertexshader";
1092 t->basetype = D3D10_SVT_VERTEXSHADER;
1093 break;
1095 case D3D10_EOT_PIXELSHADER:
1096 shader = "pixelshader";
1097 t->basetype = D3D10_SVT_PIXELSHADER;
1098 break;
1100 case D3D10_EOT_GEOMETRYSHADER:
1101 shader = "geometryshader";
1102 t->basetype = D3D10_SVT_GEOMETRYSHADER;
1103 break;
1105 default:
1106 FIXME("Unhandled object type %#x.\n", otype);
1107 return E_FAIL;
1110 if (!copy_name(shader, &t->name))
1112 ERR("Failed to copy name.\n");
1113 return E_OUTOFMEMORY;
1115 TRACE("Type name: %s.\n", debugstr_a(t->name));
1117 t->type_class = D3D10_SVC_OBJECT;
1119 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1121 v->type = t;
1122 v->effect = e;
1123 set_variable_vtbl(v);
1125 if (!copy_name("$Anonymous", &v->name))
1127 ERR("Failed to copy semantic.\n");
1128 return E_OUTOFMEMORY;
1130 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1132 if (!copy_name(NULL, &v->semantic))
1134 ERR("Failed to copy semantic.\n");
1135 return E_OUTOFMEMORY;
1137 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1139 return S_OK;
1142 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1144 unsigned int i;
1146 for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1148 if (property_info[i].id == id)
1149 return &property_info[i];
1152 return NULL;
1155 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1157 unsigned int i;
1159 for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1161 if (d3d10_effect_state_storage_info[i].id == id)
1162 return &d3d10_effect_state_storage_info[i];
1165 return NULL;
1168 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1170 switch (in_type)
1172 case D3D10_SVT_FLOAT:
1173 out_data[idx] = *(float *)&value;
1174 return TRUE;
1176 case D3D10_SVT_INT:
1177 out_data[idx] = (INT)value;
1178 return TRUE;
1180 default:
1181 FIXME("Unhandled in_type %#x.\n", in_type);
1182 return FALSE;
1186 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1188 switch (in_type)
1190 case D3D10_SVT_FLOAT:
1191 out_data[idx] = *(float *)&value;
1192 return TRUE;
1194 case D3D10_SVT_INT:
1195 case D3D10_SVT_UINT:
1196 case D3D10_SVT_BOOL:
1197 out_data[idx] = value;
1198 return TRUE;
1200 default:
1201 FIXME("Unhandled in_type %#x.\n", in_type);
1202 return FALSE;
1206 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1208 switch (in_type)
1210 case D3D10_SVT_INT:
1211 case D3D10_SVT_UINT:
1212 out_data[idx] = value;
1213 return TRUE;
1215 default:
1216 FIXME("Unhandled in_type %#x.\n", in_type);
1217 return FALSE;
1221 static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
1222 D3D_SHADER_VARIABLE_TYPE out_type, UINT out_base, UINT out_size, void *out_data)
1224 D3D_SHADER_VARIABLE_TYPE in_type;
1225 const char *ptr;
1226 DWORD t, value;
1227 DWORD count, i;
1229 if (offset >= data_size || !require_space(offset, 1, sizeof(count), data_size))
1231 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1232 return FALSE;
1235 ptr = data + offset;
1236 read_dword(&ptr, &count);
1237 if (count != out_size)
1238 return FALSE;
1240 if (!require_space(ptr - data, count, 2 * sizeof(DWORD), data_size))
1242 WARN("Invalid value count %#x (offset %#x, data size %#lx).\n", count, offset, (long)data_size);
1243 return FALSE;
1246 TRACE("%u values:\n", count);
1247 for (i = 0; i < count; ++i)
1249 UINT out_idx = out_base * out_size + i;
1251 read_dword(&ptr, &t);
1252 read_dword(&ptr, &value);
1254 in_type = d3d10_variable_type(t, FALSE);
1255 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1257 switch (out_type)
1259 case D3D10_SVT_FLOAT:
1260 if (!read_float_value(value, in_type, out_data, out_idx))
1261 return FALSE;
1262 break;
1264 case D3D10_SVT_INT:
1265 case D3D10_SVT_UINT:
1266 case D3D10_SVT_BOOL:
1267 if (!read_int32_value(value, in_type, out_data, out_idx))
1268 return FALSE;
1269 break;
1271 case D3D10_SVT_UINT8:
1272 if (!read_int8_value(value, in_type, out_data, out_idx))
1273 return FALSE;
1274 break;
1276 default:
1277 FIXME("Unhandled out_type %#x.\n", out_type);
1278 return FALSE;
1282 return TRUE;
1285 static BOOL parse_fx10_state_group(const char *data, size_t data_size,
1286 const char **ptr, D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1288 const struct d3d10_effect_state_property_info *property_info;
1289 UINT value_offset;
1290 unsigned int i;
1291 DWORD count;
1292 UINT idx;
1293 UINT id;
1295 read_dword(ptr, &count);
1296 TRACE("Property count: %#x.\n", count);
1298 for (i = 0; i < count; ++i)
1300 read_dword(ptr, &id);
1301 read_dword(ptr, &idx);
1302 skip_dword_unknown("read property", ptr, 1);
1303 read_dword(ptr, &value_offset);
1305 if (!(property_info = get_property_info(id)))
1307 FIXME("Failed to find property info for property %#x.\n", id);
1308 return FALSE;
1311 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1312 property_info->name, idx, value_offset);
1314 if (property_info->container_type != container_type)
1316 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1317 return FALSE;
1320 if (idx >= property_info->count)
1322 ERR("Invalid index %#x for property %#x.\n", idx, id);
1323 return FALSE;
1326 if (!read_value_list(data, data_size, value_offset, property_info->type, idx,
1327 property_info->size, (char *)container + property_info->offset))
1329 ERR("Failed to read values for property %#x.\n", id);
1330 return FALSE;
1334 return TRUE;
1337 static HRESULT parse_fx10_object(const char *data, size_t data_size,
1338 const char **ptr, struct d3d10_effect_object *o)
1340 ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface;
1341 const char *data_ptr = NULL;
1342 DWORD offset;
1343 enum d3d10_effect_object_operation operation;
1344 HRESULT hr;
1345 struct d3d10_effect *effect = o->pass->technique->effect;
1346 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1347 struct d3d10_effect_variable *v;
1348 DWORD tmp, variable_idx = 0;
1349 const char *name;
1350 size_t name_len;
1352 if (!require_space(*ptr - data, 4, sizeof(DWORD), data_size))
1354 WARN("Invalid offset %#lx (data size %#lx).\n", (long)(*ptr - data), (long)data_size);
1355 return E_FAIL;
1358 read_dword(ptr, &o->type);
1359 TRACE("Effect object is of type %#x.\n", o->type);
1361 read_dword(ptr, &tmp);
1362 TRACE("Effect object index %#x.\n", tmp);
1364 read_dword(ptr, &operation);
1365 TRACE("Effect object operation %#x.\n", operation);
1367 read_dword(ptr, &offset);
1368 TRACE("Effect object idx is at offset %#x.\n", offset);
1370 switch(operation)
1372 case D3D10_EOO_VALUE:
1373 TRACE("Copy variable values\n");
1375 switch (o->type)
1377 case D3D10_EOT_VERTEXSHADER:
1378 TRACE("Vertex shader\n");
1379 variable = &anonymous_vs.ID3D10EffectVariable_iface;
1380 break;
1382 case D3D10_EOT_PIXELSHADER:
1383 TRACE("Pixel shader\n");
1384 variable = &anonymous_ps.ID3D10EffectVariable_iface;
1385 break;
1387 case D3D10_EOT_GEOMETRYSHADER:
1388 TRACE("Geometry shader\n");
1389 variable = &anonymous_gs.ID3D10EffectVariable_iface;
1390 break;
1392 case D3D10_EOT_STENCIL_REF:
1393 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1395 ERR("Failed to read stencil ref.\n");
1396 return E_FAIL;
1398 break;
1400 case D3D10_EOT_SAMPLE_MASK:
1401 if (!read_value_list(data, data_size, offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1403 FIXME("Failed to read sample mask.\n");
1404 return E_FAIL;
1406 break;
1408 case D3D10_EOT_BLEND_FACTOR:
1409 if (!read_value_list(data, data_size, offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1411 FIXME("Failed to read blend factor.\n");
1412 return E_FAIL;
1414 break;
1416 default:
1417 FIXME("Unhandled object type %#x\n", o->type);
1418 return E_FAIL;
1420 break;
1422 case D3D10_EOO_PARSED_OBJECT:
1423 /* This is a local object, we've parsed in parse_fx10_local_object. */
1424 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1426 WARN("Failed to get variable name.\n");
1427 return E_FAIL;
1429 TRACE("Variable name %s.\n", debugstr_a(name));
1431 variable = e->lpVtbl->GetVariableByName(e, name);
1432 break;
1434 case D3D10_EOO_PARSED_OBJECT_INDEX:
1435 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1436 if (offset >= data_size || !require_space(offset, 2, sizeof(DWORD), data_size))
1438 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1439 return E_FAIL;
1441 data_ptr = data + offset;
1442 read_dword(&data_ptr, &offset);
1443 read_dword(&data_ptr, &variable_idx);
1445 if (!fx10_get_string(data, data_size, offset, &name, &name_len))
1447 WARN("Failed to get variable name.\n");
1448 return E_FAIL;
1451 TRACE("Variable name %s[%u].\n", debugstr_a(name), variable_idx);
1453 variable = e->lpVtbl->GetVariableByName(e, name);
1454 break;
1456 case D3D10_EOO_ANONYMOUS_SHADER:
1457 TRACE("Anonymous shader\n");
1459 /* check anonymous_shader_current for validity */
1460 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1462 ERR("Anonymous shader count is wrong!\n");
1463 return E_FAIL;
1466 if (offset >= data_size || !require_space(offset, 1, sizeof(DWORD), data_size))
1468 WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
1469 return E_FAIL;
1471 data_ptr = data + offset;
1472 read_dword(&data_ptr, &offset);
1473 TRACE("Effect object starts at offset %#x.\n", offset);
1475 if (FAILED(hr = parse_fx10_anonymous_shader(effect,
1476 &effect->anonymous_shaders[effect->anonymous_shader_current], o->type)))
1477 return hr;
1479 v = &effect->anonymous_shaders[effect->anonymous_shader_current].shader;
1480 variable = &v->ID3D10EffectVariable_iface;
1481 ++effect->anonymous_shader_current;
1483 switch (o->type)
1485 case D3D10_EOT_VERTEXSHADER:
1486 case D3D10_EOT_PIXELSHADER:
1487 case D3D10_EOT_GEOMETRYSHADER:
1488 if (FAILED(hr = parse_fx10_shader(data, data_size, offset, v)))
1489 return hr;
1490 break;
1492 default:
1493 FIXME("Unhandled object type %#x\n", o->type);
1494 return E_FAIL;
1496 break;
1498 default:
1499 FIXME("Unhandled operation %#x.\n", operation);
1500 return E_FAIL;
1503 switch (o->type)
1505 case D3D10_EOT_RASTERIZER_STATE:
1507 ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
1508 if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
1509 return hr;
1510 break;
1513 case D3D10_EOT_DEPTH_STENCIL_STATE:
1515 ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable);
1516 if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds)))
1517 return hr;
1518 break;
1521 case D3D10_EOT_BLEND_STATE:
1523 ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
1524 if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
1525 return hr;
1526 break;
1529 case D3D10_EOT_VERTEXSHADER:
1531 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1532 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1533 return hr;
1534 o->pass->vs.pShaderVariable = sv;
1535 o->pass->vs.ShaderIndex = variable_idx;
1536 break;
1539 case D3D10_EOT_PIXELSHADER:
1541 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1542 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1543 return hr;
1544 o->pass->ps.pShaderVariable = sv;
1545 o->pass->ps.ShaderIndex = variable_idx;
1546 break;
1549 case D3D10_EOT_GEOMETRYSHADER:
1551 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1552 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1553 return hr;
1554 o->pass->gs.pShaderVariable = sv;
1555 o->pass->gs.ShaderIndex = variable_idx;
1556 break;
1559 case D3D10_EOT_STENCIL_REF:
1560 case D3D10_EOT_BLEND_FACTOR:
1561 case D3D10_EOT_SAMPLE_MASK:
1562 break;
1564 default:
1565 FIXME("Unhandled object type %#x.\n", o->type);
1566 return E_FAIL;
1569 return S_OK;
1572 static HRESULT parse_fx10_pass(const char *data, size_t data_size,
1573 const char **ptr, struct d3d10_effect_pass *p)
1575 HRESULT hr = S_OK;
1576 unsigned int i;
1577 DWORD offset;
1579 read_dword(ptr, &offset);
1580 TRACE("Pass name at offset %#x.\n", offset);
1582 if (!fx10_copy_string(data, data_size, offset, &p->name))
1584 ERR("Failed to copy name.\n");
1585 return E_OUTOFMEMORY;
1587 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1589 read_dword(ptr, &p->object_count);
1590 TRACE("Pass has %u effect objects.\n", p->object_count);
1592 read_dword(ptr, &p->annotation_count);
1593 TRACE("Pass has %u annotations.\n", p->annotation_count);
1595 if (!(p->annotations = d3d10_calloc(p->annotation_count, sizeof(*p->annotations))))
1597 ERR("Failed to allocate pass annotations memory.\n");
1598 return E_OUTOFMEMORY;
1601 for (i = 0; i < p->annotation_count; ++i)
1603 struct d3d10_effect_variable *a = &p->annotations[i];
1605 a->effect = p->technique->effect;
1606 a->buffer = &null_local_buffer;
1608 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1609 return hr;
1612 if (!(p->objects = d3d10_calloc(p->object_count, sizeof(*p->objects))))
1614 ERR("Failed to allocate effect objects memory.\n");
1615 return E_OUTOFMEMORY;
1618 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1619 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1620 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1622 for (i = 0; i < p->object_count; ++i)
1624 struct d3d10_effect_object *o = &p->objects[i];
1626 o->pass = p;
1628 if (FAILED(hr = parse_fx10_object(data, data_size, ptr, o)))
1629 return hr;
1632 return hr;
1635 static HRESULT parse_fx10_technique(const char *data, size_t data_size,
1636 const char **ptr, struct d3d10_effect_technique *t)
1638 unsigned int i;
1639 DWORD offset;
1640 HRESULT hr;
1642 read_dword(ptr, &offset);
1643 TRACE("Technique name at offset %#x.\n", offset);
1645 if (!fx10_copy_string(data, data_size, offset, &t->name))
1647 ERR("Failed to copy name.\n");
1648 return E_OUTOFMEMORY;
1650 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1652 read_dword(ptr, &t->pass_count);
1653 TRACE("Technique has %u passes\n", t->pass_count);
1655 read_dword(ptr, &t->annotation_count);
1656 TRACE("Technique has %u annotations.\n", t->annotation_count);
1658 if (!(t->annotations = d3d10_calloc(t->annotation_count, sizeof(*t->annotations))))
1660 ERR("Failed to allocate technique annotations memory.\n");
1661 return E_OUTOFMEMORY;
1664 for (i = 0; i < t->annotation_count; ++i)
1666 struct d3d10_effect_variable *a = &t->annotations[i];
1668 a->effect = t->effect;
1669 a->buffer = &null_local_buffer;
1671 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1672 return hr;
1675 if (!(t->passes = d3d10_calloc(t->pass_count, sizeof(*t->passes))))
1677 ERR("Failed to allocate passes memory\n");
1678 return E_OUTOFMEMORY;
1681 for (i = 0; i < t->pass_count; ++i)
1683 struct d3d10_effect_pass *p = &t->passes[i];
1685 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1686 p->technique = t;
1688 if (FAILED(hr = parse_fx10_pass(data, data_size, ptr, p)))
1689 return hr;
1692 return S_OK;
1695 static HRESULT parse_fx10_variable(const char *data, size_t data_size,
1696 const char **ptr, struct d3d10_effect_variable *v)
1698 DWORD offset;
1699 unsigned int i;
1700 HRESULT hr;
1702 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1703 return hr;
1705 read_dword(ptr, &offset);
1706 TRACE("Variable semantic at offset %#x.\n", offset);
1708 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1710 ERR("Failed to copy semantic.\n");
1711 return E_OUTOFMEMORY;
1713 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1715 read_dword(ptr, &v->buffer_offset);
1716 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1718 skip_dword_unknown("variable", ptr, 1);
1720 read_dword(ptr, &v->flag);
1721 TRACE("Variable flag: %#x.\n", v->flag);
1723 read_dword(ptr, &v->annotation_count);
1724 TRACE("Variable has %u annotations.\n", v->annotation_count);
1726 if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
1728 ERR("Failed to allocate variable annotations memory.\n");
1729 return E_OUTOFMEMORY;
1732 for (i = 0; i < v->annotation_count; ++i)
1734 struct d3d10_effect_variable *a = &v->annotations[i];
1736 a->effect = v->effect;
1737 a->buffer = &null_local_buffer;
1739 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1740 return hr;
1743 return S_OK;
1746 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1748 ID3D10Device *device = v->effect->device;
1749 HRESULT hr;
1751 switch (v->type->basetype)
1753 case D3D10_SVT_DEPTHSTENCIL:
1754 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1755 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1756 return hr;
1757 break;
1759 case D3D10_SVT_BLEND:
1760 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1761 &v->u.state.desc.blend, &v->u.state.object.blend)))
1762 return hr;
1763 break;
1765 case D3D10_SVT_RASTERIZER:
1766 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1767 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1768 return hr;
1769 break;
1771 case D3D10_SVT_SAMPLER:
1772 if (FAILED(hr = ID3D10Device_CreateSamplerState(device,
1773 &v->u.state.desc.sampler, &v->u.state.object.sampler)))
1774 return hr;
1775 break;
1777 default:
1778 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1779 return E_FAIL;
1782 return S_OK;
1785 static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
1786 const char **ptr, struct d3d10_effect_variable *v)
1788 unsigned int i;
1789 HRESULT hr;
1790 DWORD offset;
1792 if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
1793 return hr;
1795 read_dword(ptr, &offset);
1796 TRACE("Variable semantic at offset %#x.\n", offset);
1798 if (!fx10_copy_string(data, data_size, offset, &v->semantic))
1800 ERR("Failed to copy semantic.\n");
1801 return E_OUTOFMEMORY;
1803 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1805 skip_dword_unknown("local variable", ptr, 1);
1807 switch (v->type->basetype)
1809 case D3D10_SVT_TEXTURE1D:
1810 case D3D10_SVT_TEXTURE1DARRAY:
1811 case D3D10_SVT_TEXTURE2D:
1812 case D3D10_SVT_TEXTURE2DARRAY:
1813 case D3D10_SVT_TEXTURE2DMS:
1814 case D3D10_SVT_TEXTURE2DMSARRAY:
1815 case D3D10_SVT_TEXTURE3D:
1816 case D3D10_SVT_TEXTURECUBE:
1817 case D3D10_SVT_RENDERTARGETVIEW:
1818 case D3D10_SVT_DEPTHSTENCILVIEW:
1819 case D3D10_SVT_BUFFER:
1820 TRACE("SVT could not have elements.\n");
1821 break;
1823 case D3D10_SVT_VERTEXSHADER:
1824 case D3D10_SVT_PIXELSHADER:
1825 case D3D10_SVT_GEOMETRYSHADER:
1826 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1827 for (i = 0; i < max(v->type->element_count, 1); ++i)
1829 DWORD shader_offset;
1830 struct d3d10_effect_variable *var;
1832 if (!v->type->element_count)
1834 var = v;
1836 else
1838 var = &v->elements[i];
1841 read_dword(ptr, &shader_offset);
1842 TRACE("Shader offset: %#x.\n", shader_offset);
1844 if (FAILED(hr = parse_fx10_shader(data, data_size, shader_offset, var)))
1845 return hr;
1847 break;
1849 case D3D10_SVT_DEPTHSTENCIL:
1850 case D3D10_SVT_BLEND:
1851 case D3D10_SVT_RASTERIZER:
1852 case D3D10_SVT_SAMPLER:
1854 const struct d3d10_effect_state_storage_info *storage_info;
1855 unsigned int count = max(v->type->element_count, 1);
1857 if (!(storage_info = get_storage_info(v->type->basetype)))
1859 FIXME("Failed to get backing store info for type %s.\n",
1860 debug_d3d10_shader_variable_type(v->type->basetype));
1861 return E_FAIL;
1864 if (storage_info->size > sizeof(v->u.state.desc))
1866 ERR("Invalid storage size %#lx.\n", storage_info->size);
1867 return E_FAIL;
1870 for (i = 0; i < count; ++i)
1872 struct d3d10_effect_variable *var;
1874 if (v->type->element_count)
1875 var = &v->elements[i];
1876 else
1877 var = v;
1879 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1880 if (!parse_fx10_state_group(data, data_size, ptr, var->type->basetype, &var->u.state.desc))
1882 ERR("Failed to read property list.\n");
1883 return E_FAIL;
1886 if (FAILED(hr = create_state_object(v)))
1887 return hr;
1890 break;
1892 default:
1893 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1894 return E_FAIL;
1897 read_dword(ptr, &v->annotation_count);
1898 TRACE("Variable has %u annotations.\n", v->annotation_count);
1900 if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
1902 ERR("Failed to allocate variable annotations memory.\n");
1903 return E_OUTOFMEMORY;
1906 for (i = 0; i < v->annotation_count; ++i)
1908 struct d3d10_effect_variable *a = &v->annotations[i];
1910 a->effect = v->effect;
1911 a->buffer = &null_local_buffer;
1913 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
1914 return hr;
1917 return S_OK;
1920 static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
1921 const char **ptr, struct d3d10_effect_variable *l)
1923 unsigned int i;
1924 DWORD offset;
1925 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1926 HRESULT hr;
1927 unsigned int stride = 0;
1929 /* Generate our own type, it isn't in the fx blob. */
1930 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1931 if (!l->type)
1933 ERR("Failed to allocate local buffer type memory.\n");
1934 return E_OUTOFMEMORY;
1936 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1937 l->type->type_class = D3D10_SVC_OBJECT;
1938 l->type->effect = l->effect;
1940 read_dword(ptr, &offset);
1941 TRACE("Local buffer name at offset %#x.\n", offset);
1943 if (!fx10_copy_string(data, data_size, offset, &l->name))
1945 ERR("Failed to copy name.\n");
1946 return E_OUTOFMEMORY;
1948 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1950 read_dword(ptr, &l->data_size);
1951 TRACE("Local buffer data size: %#x.\n", l->data_size);
1953 read_dword(ptr, &d3d10_cbuffer_type);
1954 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1956 switch(d3d10_cbuffer_type)
1958 case D3D10_CT_CBUFFER:
1959 l->type->basetype = D3D10_SVT_CBUFFER;
1960 if (!copy_name("cbuffer", &l->type->name))
1962 ERR("Failed to copy name.\n");
1963 return E_OUTOFMEMORY;
1965 break;
1967 case D3D10_CT_TBUFFER:
1968 l->type->basetype = D3D10_SVT_TBUFFER;
1969 if (!copy_name("tbuffer", &l->type->name))
1971 ERR("Failed to copy name.\n");
1972 return E_OUTOFMEMORY;
1974 break;
1976 default:
1977 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1978 return E_FAIL;
1981 read_dword(ptr, &l->type->member_count);
1982 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1984 skip_dword_unknown("local buffer", ptr, 1);
1986 read_dword(ptr, &l->annotation_count);
1987 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1989 if (!(l->annotations = d3d10_calloc(l->annotation_count, sizeof(*l->annotations))))
1991 ERR("Failed to allocate local buffer annotations memory.\n");
1992 return E_OUTOFMEMORY;
1995 for (i = 0; i < l->annotation_count; ++i)
1997 struct d3d10_effect_variable *a = &l->annotations[i];
1999 a->effect = l->effect;
2000 a->buffer = &null_local_buffer;
2002 if (FAILED(hr = parse_fx10_annotation(data, data_size, ptr, a)))
2003 return hr;
2006 if (!(l->members = d3d10_calloc(l->type->member_count, sizeof(*l->members))))
2008 ERR("Failed to allocate members memory.\n");
2009 return E_OUTOFMEMORY;
2012 if (!(l->type->members = d3d10_calloc(l->type->member_count, sizeof(*l->type->members))))
2014 ERR("Failed to allocate type members memory.\n");
2015 return E_OUTOFMEMORY;
2018 for (i = 0; i < l->type->member_count; ++i)
2020 struct d3d10_effect_variable *v = &l->members[i];
2021 struct d3d10_effect_type_member *typem = &l->type->members[i];
2023 v->buffer = l;
2024 v->effect = l->effect;
2026 if (FAILED(hr = parse_fx10_variable(data, data_size, ptr, v)))
2027 return hr;
2030 * Copy the values from the variable type to the constant buffers type
2031 * members structure, because it is our own generated type.
2033 typem->type = v->type;
2035 if (!copy_name(v->name, &typem->name))
2037 ERR("Failed to copy name.\n");
2038 return E_OUTOFMEMORY;
2040 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
2042 if (!copy_name(v->semantic, &typem->semantic))
2044 ERR("Failed to copy name.\n");
2045 return E_OUTOFMEMORY;
2047 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
2049 typem->buffer_offset = v->buffer_offset;
2050 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
2052 l->type->size_packed += v->type->size_packed;
2055 * For the complete constantbuffer the size_unpacked = stride,
2056 * the stride is calculated like this:
2058 * 1) if the constant buffer variables are packed with packoffset
2059 * - stride = the highest used constant
2060 * - the complete stride has to be a multiple of 0x10
2062 * 2) if the constant buffer variables are NOT packed with packoffset
2063 * - sum of unpacked size for all variables which fit in a 0x10 part
2064 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
2065 * and a new part is started
2066 * - if the variable is a struct it is always used a new part
2067 * - the complete stride has to be a multiple of 0x10
2069 * e.g.:
2070 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
2071 * part 0x10 0x10 0x20 -> 0x40
2073 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
2075 if ((v->type->size_unpacked + v->buffer_offset) > stride)
2077 stride = v->type->size_unpacked + v->buffer_offset;
2080 else
2082 if (v->type->type_class == D3D10_SVC_STRUCT)
2084 stride = (stride + 0xf) & ~0xf;
2087 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
2089 stride = (stride + 0xf) & ~0xf;
2092 stride += v->type->size_unpacked;
2095 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
2097 TRACE("Constant buffer:\n");
2098 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
2099 TRACE("\tElement count: %u.\n", l->type->element_count);
2100 TRACE("\tMember count: %u.\n", l->type->member_count);
2101 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
2102 TRACE("\tStride: %#x.\n", l->type->stride);
2103 TRACE("\tPacked size %#x.\n", l->type->size_packed);
2104 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
2105 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
2107 return S_OK;
2110 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
2112 TRACE("effect type member %p.\n", typem);
2114 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
2115 HeapFree(GetProcessHeap(), 0, typem->semantic);
2116 HeapFree(GetProcessHeap(), 0, typem->name);
2119 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
2121 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
2123 TRACE("effect type %p.\n", t);
2125 if (t->elementtype)
2127 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
2128 HeapFree(GetProcessHeap(), 0, t->elementtype);
2131 if (t->members)
2133 unsigned int i;
2135 for (i = 0; i < t->member_count; ++i)
2137 d3d10_effect_type_member_destroy(&t->members[i]);
2139 HeapFree(GetProcessHeap(), 0, t->members);
2142 HeapFree(GetProcessHeap(), 0, t->name);
2143 HeapFree(GetProcessHeap(), 0, t);
2146 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
2148 const char *ptr;
2149 unsigned int i;
2150 HRESULT hr;
2152 if (e->index_offset >= data_size)
2154 WARN("Invalid index offset %#x (data size %#x).\n", e->index_offset, data_size);
2155 return E_FAIL;
2157 ptr = data + e->index_offset;
2159 if (!(e->local_buffers = d3d10_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
2161 ERR("Failed to allocate local buffer memory.\n");
2162 return E_OUTOFMEMORY;
2165 if (!(e->local_variables = d3d10_calloc(e->local_variable_count, sizeof(*e->local_variables))))
2167 ERR("Failed to allocate local variable memory.\n");
2168 return E_OUTOFMEMORY;
2171 if (!(e->anonymous_shaders = d3d10_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
2173 ERR("Failed to allocate anonymous shaders memory\n");
2174 return E_OUTOFMEMORY;
2177 if (!(e->used_shaders = d3d10_calloc(e->used_shader_count, sizeof(*e->used_shaders))))
2179 ERR("Failed to allocate used shaders memory\n");
2180 return E_OUTOFMEMORY;
2183 if (!(e->techniques = d3d10_calloc(e->technique_count, sizeof(*e->techniques))))
2185 ERR("Failed to allocate techniques memory\n");
2186 return E_OUTOFMEMORY;
2189 for (i = 0; i < e->local_buffer_count; ++i)
2191 struct d3d10_effect_variable *l = &e->local_buffers[i];
2192 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2193 l->effect = e;
2194 l->buffer = &null_local_buffer;
2196 if (FAILED(hr = parse_fx10_local_buffer(data, data_size, &ptr, l)))
2197 return hr;
2200 for (i = 0; i < e->local_variable_count; ++i)
2202 struct d3d10_effect_variable *v = &e->local_variables[i];
2204 v->effect = e;
2205 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2206 v->buffer = &null_local_buffer;
2208 if (FAILED(hr = parse_fx10_local_variable(data, data_size, &ptr, v)))
2209 return hr;
2212 for (i = 0; i < e->technique_count; ++i)
2214 struct d3d10_effect_technique *t = &e->techniques[i];
2216 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2217 t->effect = e;
2219 if (FAILED(hr = parse_fx10_technique(data, data_size, &ptr, t)))
2220 return hr;
2223 return S_OK;
2226 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2228 const char *ptr = data;
2229 DWORD unknown;
2231 if (!require_space(0, 19, sizeof(DWORD), data_size))
2233 WARN("Invalid data size %#x.\n", data_size);
2234 return E_INVALIDARG;
2237 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2238 read_dword(&ptr, &e->version);
2239 TRACE("Target: %#x\n", e->version);
2241 read_dword(&ptr, &e->local_buffer_count);
2242 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2244 read_dword(&ptr, &e->variable_count);
2245 TRACE("Variable count: %u\n", e->variable_count);
2247 read_dword(&ptr, &e->local_variable_count);
2248 TRACE("Object count: %u\n", e->local_variable_count);
2250 read_dword(&ptr, &e->sharedbuffers_count);
2251 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2253 /* Number of variables in shared buffers? */
2254 read_dword(&ptr, &unknown);
2255 FIXME("Unknown 0: %u\n", unknown);
2257 read_dword(&ptr, &e->sharedobjects_count);
2258 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2260 read_dword(&ptr, &e->technique_count);
2261 TRACE("Technique count: %u\n", e->technique_count);
2263 read_dword(&ptr, &e->index_offset);
2264 TRACE("Index offset: %#x\n", e->index_offset);
2266 read_dword(&ptr, &unknown);
2267 FIXME("Unknown 1: %u\n", unknown);
2269 read_dword(&ptr, &e->texture_count);
2270 TRACE("Texture count: %u\n", e->texture_count);
2272 read_dword(&ptr, &e->depthstencilstate_count);
2273 TRACE("Depthstencilstate count: %u\n", e->depthstencilstate_count);
2275 read_dword(&ptr, &e->blendstate_count);
2276 TRACE("Blendstate count: %u\n", e->blendstate_count);
2278 read_dword(&ptr, &e->rasterizerstate_count);
2279 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2281 read_dword(&ptr, &e->samplerstate_count);
2282 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2284 read_dword(&ptr, &e->rendertargetview_count);
2285 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2287 read_dword(&ptr, &e->depthstencilview_count);
2288 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2290 read_dword(&ptr, &e->used_shader_count);
2291 TRACE("Used shader count: %u\n", e->used_shader_count);
2293 read_dword(&ptr, &e->anonymous_shader_count);
2294 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2296 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2299 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2301 struct d3d10_effect *e = ctx;
2303 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2305 TRACE("chunk size: %#x\n", data_size);
2307 switch(tag)
2309 case TAG_FX10:
2310 return parse_fx10(e, data, data_size);
2312 default:
2313 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2314 return S_OK;
2318 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2320 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2323 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2325 ID3D10Device *device = o->pass->technique->effect->device;
2327 TRACE("effect object %p, type %#x.\n", o, o->type);
2329 switch(o->type)
2331 case D3D10_EOT_RASTERIZER_STATE:
2332 ID3D10Device_RSSetState(device, o->object.rs);
2333 return S_OK;
2335 case D3D10_EOT_DEPTH_STENCIL_STATE:
2336 ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
2337 return S_OK;
2339 case D3D10_EOT_BLEND_STATE:
2340 ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
2341 return S_OK;
2343 case D3D10_EOT_VERTEXSHADER:
2344 ID3D10Device_VSSetShader(device, o->object.vs);
2345 return S_OK;
2347 case D3D10_EOT_PIXELSHADER:
2348 ID3D10Device_PSSetShader(device, o->object.ps);
2349 return S_OK;
2351 case D3D10_EOT_GEOMETRYSHADER:
2352 ID3D10Device_GSSetShader(device, o->object.gs);
2353 return S_OK;
2355 case D3D10_EOT_STENCIL_REF:
2356 case D3D10_EOT_BLEND_FACTOR:
2357 case D3D10_EOT_SAMPLE_MASK:
2358 return S_OK;
2360 default:
2361 FIXME("Unhandled effect object type %#x.\n", o->type);
2362 return E_FAIL;
2366 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2367 D3D10_SHADER_VARIABLE_TYPE type)
2369 shader_free_signature(&s->input_signature);
2370 shader_free_signature(&s->output_signature);
2372 switch (type)
2374 case D3D10_SVT_VERTEXSHADER:
2375 if (s->shader.vs)
2376 ID3D10VertexShader_Release(s->shader.vs);
2377 break;
2379 case D3D10_SVT_PIXELSHADER:
2380 if (s->shader.ps)
2381 ID3D10PixelShader_Release(s->shader.ps);
2382 break;
2384 case D3D10_SVT_GEOMETRYSHADER:
2385 if (s->shader.gs)
2386 ID3D10GeometryShader_Release(s->shader.gs);
2387 break;
2389 default:
2390 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2391 break;
2395 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2397 unsigned int i;
2399 TRACE("variable %p.\n", v);
2401 HeapFree(GetProcessHeap(), 0, v->name);
2402 HeapFree(GetProcessHeap(), 0, v->semantic);
2403 if (v->annotations)
2405 for (i = 0; i < v->annotation_count; ++i)
2407 d3d10_effect_variable_destroy(&v->annotations[i]);
2409 HeapFree(GetProcessHeap(), 0, v->annotations);
2412 if (v->members)
2414 for (i = 0; i < v->type->member_count; ++i)
2416 d3d10_effect_variable_destroy(&v->members[i]);
2418 HeapFree(GetProcessHeap(), 0, v->members);
2421 if (v->elements)
2423 for (i = 0; i < v->type->element_count; ++i)
2425 d3d10_effect_variable_destroy(&v->elements[i]);
2427 HeapFree(GetProcessHeap(), 0, v->elements);
2430 if (v->type)
2432 switch (v->type->basetype)
2434 case D3D10_SVT_VERTEXSHADER:
2435 case D3D10_SVT_PIXELSHADER:
2436 case D3D10_SVT_GEOMETRYSHADER:
2437 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2438 break;
2440 case D3D10_SVT_DEPTHSTENCIL:
2441 if (v->u.state.object.depth_stencil)
2442 ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
2443 break;
2445 case D3D10_SVT_BLEND:
2446 if (v->u.state.object.blend)
2447 ID3D10BlendState_Release(v->u.state.object.blend);
2448 break;
2450 case D3D10_SVT_RASTERIZER:
2451 if (v->u.state.object.rasterizer)
2452 ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
2453 break;
2455 case D3D10_SVT_SAMPLER:
2456 if (v->u.state.object.sampler)
2457 ID3D10SamplerState_Release(v->u.state.object.sampler);
2458 break;
2460 default:
2461 break;
2466 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2468 switch (o->type)
2470 case D3D10_EOT_RASTERIZER_STATE:
2471 if (o->object.rs)
2472 ID3D10RasterizerState_Release(o->object.rs);
2473 break;
2475 case D3D10_EOT_DEPTH_STENCIL_STATE:
2476 if (o->object.ds)
2477 ID3D10DepthStencilState_Release(o->object.ds);
2478 break;
2480 case D3D10_EOT_BLEND_STATE:
2481 if (o->object.bs)
2482 ID3D10BlendState_Release(o->object.bs);
2483 break;
2485 case D3D10_EOT_VERTEXSHADER:
2486 if (o->object.vs)
2487 ID3D10VertexShader_Release(o->object.vs);
2488 break;
2490 case D3D10_EOT_PIXELSHADER:
2491 if (o->object.ps)
2492 ID3D10PixelShader_Release(o->object.ps);
2493 break;
2495 case D3D10_EOT_GEOMETRYSHADER:
2496 if (o->object.gs)
2497 ID3D10GeometryShader_Release(o->object.gs);
2498 break;
2500 default:
2501 break;
2505 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2507 unsigned int i;
2509 TRACE("pass %p\n", p);
2511 HeapFree(GetProcessHeap(), 0, p->name);
2513 if (p->objects)
2515 for (i = 0; i < p->object_count; ++i)
2517 d3d10_effect_object_destroy(&p->objects[i]);
2519 HeapFree(GetProcessHeap(), 0, p->objects);
2522 if (p->annotations)
2524 for (i = 0; i < p->annotation_count; ++i)
2526 d3d10_effect_variable_destroy(&p->annotations[i]);
2528 HeapFree(GetProcessHeap(), 0, p->annotations);
2532 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2534 unsigned int i;
2536 TRACE("technique %p\n", t);
2538 HeapFree(GetProcessHeap(), 0, t->name);
2539 if (t->passes)
2541 for (i = 0; i < t->pass_count; ++i)
2543 d3d10_effect_pass_destroy(&t->passes[i]);
2545 HeapFree(GetProcessHeap(), 0, t->passes);
2548 if (t->annotations)
2550 for (i = 0; i < t->annotation_count; ++i)
2552 d3d10_effect_variable_destroy(&t->annotations[i]);
2554 HeapFree(GetProcessHeap(), 0, t->annotations);
2558 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2560 unsigned int i;
2562 TRACE("local buffer %p.\n", l);
2564 HeapFree(GetProcessHeap(), 0, l->name);
2565 if (l->members)
2567 for (i = 0; i < l->type->member_count; ++i)
2569 d3d10_effect_variable_destroy(&l->members[i]);
2571 HeapFree(GetProcessHeap(), 0, l->members);
2574 if (l->type)
2575 d3d10_effect_type_destroy(&l->type->entry, NULL);
2577 if (l->annotations)
2579 for (i = 0; i < l->annotation_count; ++i)
2581 d3d10_effect_variable_destroy(&l->annotations[i]);
2583 HeapFree(GetProcessHeap(), 0, l->annotations);
2587 /* IUnknown methods */
2589 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2591 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2594 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2596 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2598 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2599 || IsEqualGUID(riid, &IID_IUnknown))
2601 IUnknown_AddRef(iface);
2602 *object = iface;
2603 return S_OK;
2606 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2608 *object = NULL;
2609 return E_NOINTERFACE;
2612 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2614 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2615 ULONG refcount = InterlockedIncrement(&This->refcount);
2617 TRACE("%p increasing refcount to %u\n", This, refcount);
2619 return refcount;
2622 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2624 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2625 ULONG refcount = InterlockedDecrement(&This->refcount);
2627 TRACE("%p decreasing refcount to %u\n", This, refcount);
2629 if (!refcount)
2631 unsigned int i;
2633 if (This->techniques)
2635 for (i = 0; i < This->technique_count; ++i)
2637 d3d10_effect_technique_destroy(&This->techniques[i]);
2639 HeapFree(GetProcessHeap(), 0, This->techniques);
2642 if (This->local_variables)
2644 for (i = 0; i < This->local_variable_count; ++i)
2646 d3d10_effect_variable_destroy(&This->local_variables[i]);
2648 HeapFree(GetProcessHeap(), 0, This->local_variables);
2651 if (This->local_buffers)
2653 for (i = 0; i < This->local_buffer_count; ++i)
2655 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2657 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2660 if (This->anonymous_shaders)
2662 for (i = 0; i < This->anonymous_shader_count; ++i)
2664 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2665 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2667 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2670 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2672 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2674 ID3D10Device_Release(This->device);
2675 HeapFree(GetProcessHeap(), 0, This);
2678 return refcount;
2681 /* ID3D10Effect methods */
2683 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2685 FIXME("iface %p stub!\n", iface);
2687 return FALSE;
2690 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2692 FIXME("iface %p stub!\n", iface);
2694 return FALSE;
2697 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2699 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2701 TRACE("iface %p, device %p\n", iface, device);
2703 ID3D10Device_AddRef(This->device);
2704 *device = This->device;
2706 return S_OK;
2709 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2711 FIXME("iface %p, desc %p stub!\n", iface, desc);
2713 return E_NOTIMPL;
2716 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2717 UINT index)
2719 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2720 struct d3d10_effect_variable *l;
2722 TRACE("iface %p, index %u\n", iface, index);
2724 if (index >= This->local_buffer_count)
2726 WARN("Invalid index specified\n");
2727 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2730 l = &This->local_buffers[index];
2732 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2734 return (ID3D10EffectConstantBuffer *)l;
2737 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2738 const char *name)
2740 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2741 unsigned int i;
2743 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2745 for (i = 0; i < This->local_buffer_count; ++i)
2747 struct d3d10_effect_variable *l = &This->local_buffers[i];
2749 if (l->name && !strcmp(l->name, name))
2751 TRACE("Returning buffer %p.\n", l);
2752 return (ID3D10EffectConstantBuffer *)l;
2756 WARN("Invalid name specified\n");
2758 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2761 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2763 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2764 unsigned int i;
2766 TRACE("iface %p, index %u\n", iface, index);
2768 for (i = 0; i < This->local_buffer_count; ++i)
2770 struct d3d10_effect_variable *l = &This->local_buffers[i];
2772 if (index < l->type->member_count)
2774 struct d3d10_effect_variable *v = &l->members[index];
2776 TRACE("Returning variable %p.\n", v);
2777 return &v->ID3D10EffectVariable_iface;
2779 index -= l->type->member_count;
2782 if (index < This->local_variable_count)
2784 struct d3d10_effect_variable *v = &This->local_variables[index];
2786 TRACE("Returning variable %p.\n", v);
2787 return &v->ID3D10EffectVariable_iface;
2790 WARN("Invalid index specified\n");
2792 return &null_variable.ID3D10EffectVariable_iface;
2795 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface,
2796 const char *name)
2798 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2799 unsigned int i;
2801 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2803 if (!name)
2805 WARN("Invalid name specified\n");
2806 return &null_variable.ID3D10EffectVariable_iface;
2809 for (i = 0; i < This->local_buffer_count; ++i)
2811 struct d3d10_effect_variable *l = &This->local_buffers[i];
2812 unsigned int j;
2814 for (j = 0; j < l->type->member_count; ++j)
2816 struct d3d10_effect_variable *v = &l->members[j];
2818 if (v->name && !strcmp(v->name, name))
2820 TRACE("Returning variable %p.\n", v);
2821 return &v->ID3D10EffectVariable_iface;
2826 for (i = 0; i < This->local_variable_count; ++i)
2828 struct d3d10_effect_variable *v = &This->local_variables[i];
2830 if (v->name && !strcmp(v->name, name))
2832 TRACE("Returning variable %p.\n", v);
2833 return &v->ID3D10EffectVariable_iface;
2837 WARN("Invalid name specified\n");
2839 return &null_variable.ID3D10EffectVariable_iface;
2842 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2843 const char *semantic)
2845 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2846 unsigned int i;
2848 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2850 if (!semantic)
2852 WARN("Invalid semantic specified\n");
2853 return &null_variable.ID3D10EffectVariable_iface;
2856 for (i = 0; i < This->local_buffer_count; ++i)
2858 struct d3d10_effect_variable *l = &This->local_buffers[i];
2859 unsigned int j;
2861 for (j = 0; j < l->type->member_count; ++j)
2863 struct d3d10_effect_variable *v = &l->members[j];
2865 if (v->semantic && !strcmp(v->semantic, semantic))
2867 TRACE("Returning variable %p.\n", v);
2868 return &v->ID3D10EffectVariable_iface;
2873 for (i = 0; i < This->local_variable_count; ++i)
2875 struct d3d10_effect_variable *v = &This->local_variables[i];
2877 if (v->semantic && !strcmp(v->semantic, semantic))
2879 TRACE("Returning variable %p.\n", v);
2880 return &v->ID3D10EffectVariable_iface;
2884 WARN("Invalid semantic specified\n");
2886 return &null_variable.ID3D10EffectVariable_iface;
2889 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2890 UINT index)
2892 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2893 struct d3d10_effect_technique *t;
2895 TRACE("iface %p, index %u\n", iface, index);
2897 if (index >= This->technique_count)
2899 WARN("Invalid index specified\n");
2900 return &null_technique.ID3D10EffectTechnique_iface;
2903 t = &This->techniques[index];
2905 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2907 return &t->ID3D10EffectTechnique_iface;
2910 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2911 const char *name)
2913 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2914 unsigned int i;
2916 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2918 if (!name)
2920 WARN("Invalid name specified\n");
2921 return &null_technique.ID3D10EffectTechnique_iface;
2924 for (i = 0; i < This->technique_count; ++i)
2926 struct d3d10_effect_technique *t = &This->techniques[i];
2927 if (t->name && !strcmp(t->name, name))
2929 TRACE("Returning technique %p\n", t);
2930 return &t->ID3D10EffectTechnique_iface;
2934 WARN("Invalid name specified\n");
2936 return &null_technique.ID3D10EffectTechnique_iface;
2939 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2941 FIXME("iface %p stub!\n", iface);
2943 return E_NOTIMPL;
2946 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2948 FIXME("iface %p stub!\n", iface);
2950 return FALSE;
2953 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2955 /* IUnknown methods */
2956 d3d10_effect_QueryInterface,
2957 d3d10_effect_AddRef,
2958 d3d10_effect_Release,
2959 /* ID3D10Effect methods */
2960 d3d10_effect_IsValid,
2961 d3d10_effect_IsPool,
2962 d3d10_effect_GetDevice,
2963 d3d10_effect_GetDesc,
2964 d3d10_effect_GetConstantBufferByIndex,
2965 d3d10_effect_GetConstantBufferByName,
2966 d3d10_effect_GetVariableByIndex,
2967 d3d10_effect_GetVariableByName,
2968 d3d10_effect_GetVariableBySemantic,
2969 d3d10_effect_GetTechniqueByIndex,
2970 d3d10_effect_GetTechniqueByName,
2971 d3d10_effect_Optimize,
2972 d3d10_effect_IsOptimized,
2975 /* ID3D10EffectTechnique methods */
2977 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2979 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2982 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2984 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2986 TRACE("iface %p\n", iface);
2988 return This != &null_technique;
2991 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2992 D3D10_TECHNIQUE_DESC *desc)
2994 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2996 TRACE("iface %p, desc %p\n", iface, desc);
2998 if(This == &null_technique)
3000 WARN("Null technique specified\n");
3001 return E_FAIL;
3004 if(!desc)
3006 WARN("Invalid argument specified\n");
3007 return E_INVALIDARG;
3010 desc->Name = This->name;
3011 desc->Passes = This->pass_count;
3012 desc->Annotations = This->annotation_count;
3014 return S_OK;
3017 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
3018 ID3D10EffectTechnique *iface, UINT index)
3020 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3021 struct d3d10_effect_variable *a;
3023 TRACE("iface %p, index %u\n", iface, index);
3025 if (index >= This->annotation_count)
3027 WARN("Invalid index specified\n");
3028 return &null_variable.ID3D10EffectVariable_iface;
3031 a = &This->annotations[index];
3033 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3035 return &a->ID3D10EffectVariable_iface;
3038 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
3039 ID3D10EffectTechnique *iface, const char *name)
3041 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3042 unsigned int i;
3044 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3046 for (i = 0; i < This->annotation_count; ++i)
3048 struct d3d10_effect_variable *a = &This->annotations[i];
3049 if (a->name && !strcmp(a->name, name))
3051 TRACE("Returning annotation %p\n", a);
3052 return &a->ID3D10EffectVariable_iface;
3056 WARN("Invalid name specified\n");
3058 return &null_variable.ID3D10EffectVariable_iface;
3061 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
3062 UINT index)
3064 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3065 struct d3d10_effect_pass *p;
3067 TRACE("iface %p, index %u\n", iface, index);
3069 if (index >= This->pass_count)
3071 WARN("Invalid index specified\n");
3072 return &null_pass.ID3D10EffectPass_iface;
3075 p = &This->passes[index];
3077 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
3079 return &p->ID3D10EffectPass_iface;
3082 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
3083 const char *name)
3085 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
3086 unsigned int i;
3088 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3090 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
3092 for (i = 0; i < This->pass_count; ++i)
3094 struct d3d10_effect_pass *p = &This->passes[i];
3095 if (p->name && !strcmp(p->name, name))
3097 TRACE("Returning pass %p\n", p);
3098 return &p->ID3D10EffectPass_iface;
3102 WARN("Invalid name specified\n");
3104 return &null_pass.ID3D10EffectPass_iface;
3107 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
3108 D3D10_STATE_BLOCK_MASK *mask)
3110 FIXME("iface %p,mask %p stub!\n", iface, mask);
3112 return E_NOTIMPL;
3115 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
3117 /* ID3D10EffectTechnique methods */
3118 d3d10_effect_technique_IsValid,
3119 d3d10_effect_technique_GetDesc,
3120 d3d10_effect_technique_GetAnnotationByIndex,
3121 d3d10_effect_technique_GetAnnotationByName,
3122 d3d10_effect_technique_GetPassByIndex,
3123 d3d10_effect_technique_GetPassByName,
3124 d3d10_effect_technique_ComputeStateBlockMask,
3127 /* ID3D10EffectPass methods */
3129 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
3131 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
3134 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
3136 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3138 TRACE("iface %p\n", iface);
3140 return This != &null_pass;
3143 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
3144 D3D10_PASS_DESC *desc)
3146 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3147 struct d3d10_effect_shader_variable *s;
3149 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
3151 if(This == &null_pass)
3153 WARN("Null pass specified\n");
3154 return E_FAIL;
3157 if(!desc)
3159 WARN("Invalid argument specified\n");
3160 return E_INVALIDARG;
3163 memset(desc, 0, sizeof(*desc));
3164 desc->Name = This->name;
3166 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3167 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3168 desc->IAInputSignatureSize = s->input_signature.signature_size;
3170 desc->StencilRef = This->stencil_ref;
3171 desc->SampleMask = This->sample_mask;
3172 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3174 return S_OK;
3177 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3178 D3D10_PASS_SHADER_DESC *desc)
3180 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3182 TRACE("iface %p, desc %p\n", iface, desc);
3184 if (This == &null_pass)
3186 WARN("Null pass specified\n");
3187 return E_FAIL;
3190 if (!desc)
3192 WARN("Invalid argument specified\n");
3193 return E_INVALIDARG;
3196 *desc = This->vs;
3198 return S_OK;
3201 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3202 D3D10_PASS_SHADER_DESC *desc)
3204 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3206 TRACE("iface %p, desc %p\n", iface, desc);
3208 if (This == &null_pass)
3210 WARN("Null pass specified\n");
3211 return E_FAIL;
3214 if (!desc)
3216 WARN("Invalid argument specified\n");
3217 return E_INVALIDARG;
3220 *desc = This->gs;
3222 return S_OK;
3225 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3226 D3D10_PASS_SHADER_DESC *desc)
3228 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3230 TRACE("iface %p, desc %p\n", iface, desc);
3232 if (This == &null_pass)
3234 WARN("Null pass specified\n");
3235 return E_FAIL;
3238 if (!desc)
3240 WARN("Invalid argument specified\n");
3241 return E_INVALIDARG;
3244 *desc = This->ps;
3246 return S_OK;
3249 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3250 UINT index)
3252 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3253 struct d3d10_effect_variable *a;
3255 TRACE("iface %p, index %u\n", iface, index);
3257 if (index >= This->annotation_count)
3259 WARN("Invalid index specified\n");
3260 return &null_variable.ID3D10EffectVariable_iface;
3263 a = &This->annotations[index];
3265 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3267 return &a->ID3D10EffectVariable_iface;
3270 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3271 const char *name)
3273 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3274 unsigned int i;
3276 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3278 for (i = 0; i < This->annotation_count; ++i)
3280 struct d3d10_effect_variable *a = &This->annotations[i];
3281 if (a->name && !strcmp(a->name, name))
3283 TRACE("Returning annotation %p\n", a);
3284 return &a->ID3D10EffectVariable_iface;
3288 WARN("Invalid name specified\n");
3290 return &null_variable.ID3D10EffectVariable_iface;
3293 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3295 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3296 HRESULT hr = S_OK;
3297 unsigned int i;
3299 TRACE("iface %p, flags %#x\n", iface, flags);
3301 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3303 for (i = 0; i < This->object_count; ++i)
3305 hr = d3d10_effect_object_apply(&This->objects[i]);
3306 if (FAILED(hr)) break;
3309 return hr;
3312 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3313 D3D10_STATE_BLOCK_MASK *mask)
3315 FIXME("iface %p, mask %p stub!\n", iface, mask);
3317 return E_NOTIMPL;
3320 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3322 /* ID3D10EffectPass methods */
3323 d3d10_effect_pass_IsValid,
3324 d3d10_effect_pass_GetDesc,
3325 d3d10_effect_pass_GetVertexShaderDesc,
3326 d3d10_effect_pass_GetGeometryShaderDesc,
3327 d3d10_effect_pass_GetPixelShaderDesc,
3328 d3d10_effect_pass_GetAnnotationByIndex,
3329 d3d10_effect_pass_GetAnnotationByName,
3330 d3d10_effect_pass_Apply,
3331 d3d10_effect_pass_ComputeStateBlockMask,
3334 /* ID3D10EffectVariable methods */
3336 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3338 TRACE("iface %p\n", iface);
3340 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3343 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3345 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3347 TRACE("iface %p\n", iface);
3349 return &This->type->ID3D10EffectType_iface;
3352 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3353 D3D10_EFFECT_VARIABLE_DESC *desc)
3355 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3357 TRACE("iface %p, desc %p\n", iface, desc);
3359 if (!iface->lpVtbl->IsValid(iface))
3361 WARN("Null variable specified\n");
3362 return E_FAIL;
3365 if (!desc)
3367 WARN("Invalid argument specified\n");
3368 return E_INVALIDARG;
3371 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3372 memset(desc, 0, sizeof(*desc));
3373 desc->Name = This->name;
3374 desc->Semantic = This->semantic;
3375 desc->Flags = This->flag;
3376 desc->Annotations = This->annotation_count;
3377 desc->BufferOffset = This->buffer_offset;
3379 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3381 desc->ExplicitBindPoint = This->buffer_offset;
3384 return S_OK;
3387 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3388 ID3D10EffectVariable *iface, UINT index)
3390 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3391 struct d3d10_effect_variable *a;
3393 TRACE("iface %p, index %u\n", iface, index);
3395 if (index >= This->annotation_count)
3397 WARN("Invalid index specified\n");
3398 return &null_variable.ID3D10EffectVariable_iface;
3401 a = &This->annotations[index];
3403 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3405 return &a->ID3D10EffectVariable_iface;
3408 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3409 ID3D10EffectVariable *iface, const char *name)
3411 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3412 unsigned int i;
3414 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3416 for (i = 0; i < This->annotation_count; ++i)
3418 struct d3d10_effect_variable *a = &This->annotations[i];
3419 if (a->name && !strcmp(a->name, name))
3421 TRACE("Returning annotation %p\n", a);
3422 return &a->ID3D10EffectVariable_iface;
3426 WARN("Invalid name specified\n");
3428 return &null_variable.ID3D10EffectVariable_iface;
3431 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3432 ID3D10EffectVariable *iface, UINT index)
3434 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3435 struct d3d10_effect_variable *m;
3437 TRACE("iface %p, index %u\n", iface, index);
3439 if (index >= This->type->member_count)
3441 WARN("Invalid index specified\n");
3442 return &null_variable.ID3D10EffectVariable_iface;
3445 m = &This->members[index];
3447 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3449 return &m->ID3D10EffectVariable_iface;
3452 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3453 ID3D10EffectVariable *iface, const char *name)
3455 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3456 unsigned int i;
3458 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3460 if (!name)
3462 WARN("Invalid name specified\n");
3463 return &null_variable.ID3D10EffectVariable_iface;
3466 for (i = 0; i < This->type->member_count; ++i)
3468 struct d3d10_effect_variable *m = &This->members[i];
3470 if (m->name && !strcmp(m->name, name))
3472 TRACE("Returning member %p\n", m);
3473 return &m->ID3D10EffectVariable_iface;
3477 WARN("Invalid name specified\n");
3479 return &null_variable.ID3D10EffectVariable_iface;
3482 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3483 ID3D10EffectVariable *iface, const char *semantic)
3485 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3486 unsigned int i;
3488 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3490 if (!semantic)
3492 WARN("Invalid semantic specified\n");
3493 return &null_variable.ID3D10EffectVariable_iface;
3496 for (i = 0; i < This->type->member_count; ++i)
3498 struct d3d10_effect_variable *m = &This->members[i];
3500 if (m->semantic && !strcmp(m->semantic, semantic))
3502 TRACE("Returning member %p\n", m);
3503 return &m->ID3D10EffectVariable_iface;
3507 WARN("Invalid semantic specified\n");
3509 return &null_variable.ID3D10EffectVariable_iface;
3512 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3513 ID3D10EffectVariable *iface, UINT index)
3515 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3516 struct d3d10_effect_variable *v;
3518 TRACE("iface %p, index %u\n", iface, index);
3520 if (index >= This->type->element_count)
3522 WARN("Invalid index specified\n");
3523 return &null_variable.ID3D10EffectVariable_iface;
3526 v = &This->elements[index];
3528 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3530 return &v->ID3D10EffectVariable_iface;
3533 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3534 ID3D10EffectVariable *iface)
3536 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3538 TRACE("iface %p\n", iface);
3540 return (ID3D10EffectConstantBuffer *)This->buffer;
3543 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3544 ID3D10EffectVariable *iface)
3546 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3548 TRACE("iface %p\n", iface);
3550 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3551 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3553 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3556 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3557 ID3D10EffectVariable *iface)
3559 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3561 TRACE("iface %p\n", iface);
3563 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3564 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3566 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3569 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3570 ID3D10EffectVariable *iface)
3572 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3574 TRACE("iface %p\n", iface);
3576 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3577 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3579 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3582 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3583 ID3D10EffectVariable *iface)
3585 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3587 TRACE("iface %p\n", iface);
3589 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3590 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3592 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3595 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3596 ID3D10EffectVariable *iface)
3598 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3600 TRACE("iface %p\n", iface);
3602 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3603 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3605 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3608 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3609 ID3D10EffectVariable *iface)
3611 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3613 TRACE("iface %p\n", iface);
3615 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3616 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3618 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3621 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3622 ID3D10EffectVariable *iface)
3624 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3626 TRACE("iface %p\n", iface);
3628 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3629 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3631 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3634 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3635 ID3D10EffectVariable *iface)
3637 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3639 TRACE("iface %p\n", iface);
3641 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3642 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3644 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3647 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3648 ID3D10EffectVariable *iface)
3650 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3652 TRACE("iface %p\n", iface);
3654 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3655 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3657 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3660 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3662 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3664 TRACE("iface %p\n", iface);
3666 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3667 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3669 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3672 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3673 ID3D10EffectVariable *iface)
3675 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3677 TRACE("iface %p\n", iface);
3679 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3680 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3682 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3685 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3686 ID3D10EffectVariable *iface)
3688 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3690 TRACE("iface %p\n", iface);
3692 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3693 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3695 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3698 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3699 ID3D10EffectVariable *iface)
3701 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3703 TRACE("iface %p\n", iface);
3705 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3706 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3708 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3711 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3712 void *data, UINT offset, UINT count)
3714 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3716 return E_NOTIMPL;
3719 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3720 void *data, UINT offset, UINT count)
3722 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3724 return E_NOTIMPL;
3727 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3729 /* ID3D10EffectVariable methods */
3730 d3d10_effect_variable_IsValid,
3731 d3d10_effect_variable_GetType,
3732 d3d10_effect_variable_GetDesc,
3733 d3d10_effect_variable_GetAnnotationByIndex,
3734 d3d10_effect_variable_GetAnnotationByName,
3735 d3d10_effect_variable_GetMemberByIndex,
3736 d3d10_effect_variable_GetMemberByName,
3737 d3d10_effect_variable_GetMemberBySemantic,
3738 d3d10_effect_variable_GetElement,
3739 d3d10_effect_variable_GetParentConstantBuffer,
3740 d3d10_effect_variable_AsScalar,
3741 d3d10_effect_variable_AsVector,
3742 d3d10_effect_variable_AsMatrix,
3743 d3d10_effect_variable_AsString,
3744 d3d10_effect_variable_AsShaderResource,
3745 d3d10_effect_variable_AsRenderTargetView,
3746 d3d10_effect_variable_AsDepthStencilView,
3747 d3d10_effect_variable_AsConstantBuffer,
3748 d3d10_effect_variable_AsShader,
3749 d3d10_effect_variable_AsBlend,
3750 d3d10_effect_variable_AsDepthStencil,
3751 d3d10_effect_variable_AsRasterizer,
3752 d3d10_effect_variable_AsSampler,
3753 d3d10_effect_variable_SetRawValue,
3754 d3d10_effect_variable_GetRawValue,
3757 /* ID3D10EffectVariable methods */
3758 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3760 TRACE("iface %p\n", iface);
3762 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3765 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3767 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3770 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3771 D3D10_EFFECT_VARIABLE_DESC *desc)
3773 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3776 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3777 ID3D10EffectConstantBuffer *iface, UINT index)
3779 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3782 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3783 ID3D10EffectConstantBuffer *iface, const char *name)
3785 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3788 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3789 ID3D10EffectConstantBuffer *iface, UINT index)
3791 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3794 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3795 ID3D10EffectConstantBuffer *iface, const char *name)
3797 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3800 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3801 ID3D10EffectConstantBuffer *iface, const char *semantic)
3803 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3806 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3807 ID3D10EffectConstantBuffer *iface, UINT index)
3809 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3812 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3813 ID3D10EffectConstantBuffer *iface)
3815 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3818 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3819 ID3D10EffectConstantBuffer *iface)
3821 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3824 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3825 ID3D10EffectConstantBuffer *iface)
3827 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3830 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3831 ID3D10EffectConstantBuffer *iface)
3833 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3836 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3837 ID3D10EffectConstantBuffer *iface)
3839 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3842 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3843 ID3D10EffectConstantBuffer *iface)
3845 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3848 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3849 ID3D10EffectConstantBuffer *iface)
3851 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3854 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3855 ID3D10EffectConstantBuffer *iface)
3857 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3860 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3861 ID3D10EffectConstantBuffer *iface)
3863 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3866 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3867 ID3D10EffectConstantBuffer *iface)
3869 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3872 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3874 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3877 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3878 ID3D10EffectConstantBuffer *iface)
3880 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3883 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3884 ID3D10EffectConstantBuffer *iface)
3886 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3889 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3890 ID3D10EffectConstantBuffer *iface)
3892 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3895 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3896 void *data, UINT offset, UINT count)
3898 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3901 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3902 void *data, UINT offset, UINT count)
3904 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3907 /* ID3D10EffectConstantBuffer methods */
3908 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3909 ID3D10Buffer *buffer)
3911 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3913 return E_NOTIMPL;
3916 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3917 ID3D10Buffer **buffer)
3919 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3921 return E_NOTIMPL;
3924 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3925 ID3D10ShaderResourceView *view)
3927 FIXME("iface %p, view %p stub!\n", iface, view);
3929 return E_NOTIMPL;
3932 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3933 ID3D10ShaderResourceView **view)
3935 FIXME("iface %p, view %p stub!\n", iface, view);
3937 return E_NOTIMPL;
3940 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3942 /* ID3D10EffectVariable methods */
3943 d3d10_effect_constant_buffer_IsValid,
3944 d3d10_effect_constant_buffer_GetType,
3945 d3d10_effect_constant_buffer_GetDesc,
3946 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3947 d3d10_effect_constant_buffer_GetAnnotationByName,
3948 d3d10_effect_constant_buffer_GetMemberByIndex,
3949 d3d10_effect_constant_buffer_GetMemberByName,
3950 d3d10_effect_constant_buffer_GetMemberBySemantic,
3951 d3d10_effect_constant_buffer_GetElement,
3952 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3953 d3d10_effect_constant_buffer_AsScalar,
3954 d3d10_effect_constant_buffer_AsVector,
3955 d3d10_effect_constant_buffer_AsMatrix,
3956 d3d10_effect_constant_buffer_AsString,
3957 d3d10_effect_constant_buffer_AsShaderResource,
3958 d3d10_effect_constant_buffer_AsRenderTargetView,
3959 d3d10_effect_constant_buffer_AsDepthStencilView,
3960 d3d10_effect_constant_buffer_AsConstantBuffer,
3961 d3d10_effect_constant_buffer_AsShader,
3962 d3d10_effect_constant_buffer_AsBlend,
3963 d3d10_effect_constant_buffer_AsDepthStencil,
3964 d3d10_effect_constant_buffer_AsRasterizer,
3965 d3d10_effect_constant_buffer_AsSampler,
3966 d3d10_effect_constant_buffer_SetRawValue,
3967 d3d10_effect_constant_buffer_GetRawValue,
3968 /* ID3D10EffectConstantBuffer methods */
3969 d3d10_effect_constant_buffer_SetConstantBuffer,
3970 d3d10_effect_constant_buffer_GetConstantBuffer,
3971 d3d10_effect_constant_buffer_SetTextureBuffer,
3972 d3d10_effect_constant_buffer_GetTextureBuffer,
3975 /* ID3D10EffectVariable methods */
3977 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3979 TRACE("iface %p\n", iface);
3981 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3984 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3985 ID3D10EffectScalarVariable *iface)
3987 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3990 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3991 D3D10_EFFECT_VARIABLE_DESC *desc)
3993 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3996 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3997 ID3D10EffectScalarVariable *iface, UINT index)
3999 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4002 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
4003 ID3D10EffectScalarVariable *iface, const char *name)
4005 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4008 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
4009 ID3D10EffectScalarVariable *iface, UINT index)
4011 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4014 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
4015 ID3D10EffectScalarVariable *iface, const char *name)
4017 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4020 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
4021 ID3D10EffectScalarVariable *iface, const char *semantic)
4023 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4026 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
4027 ID3D10EffectScalarVariable *iface, UINT index)
4029 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4032 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
4033 ID3D10EffectScalarVariable *iface)
4035 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4038 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
4039 ID3D10EffectScalarVariable *iface)
4041 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4044 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
4045 ID3D10EffectScalarVariable *iface)
4047 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4050 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
4051 ID3D10EffectScalarVariable *iface)
4053 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4056 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
4057 ID3D10EffectScalarVariable *iface)
4059 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4062 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
4063 ID3D10EffectScalarVariable *iface)
4065 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4068 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
4069 ID3D10EffectScalarVariable *iface)
4071 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4074 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
4075 ID3D10EffectScalarVariable *iface)
4077 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4080 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
4081 ID3D10EffectScalarVariable *iface)
4083 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4086 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
4087 ID3D10EffectScalarVariable *iface)
4089 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4092 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
4093 ID3D10EffectScalarVariable *iface)
4095 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4098 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
4099 ID3D10EffectScalarVariable *iface)
4101 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4104 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
4105 ID3D10EffectScalarVariable *iface)
4107 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4110 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
4111 ID3D10EffectScalarVariable *iface)
4113 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4116 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
4117 void *data, UINT offset, UINT count)
4119 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4122 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
4123 void *data, UINT offset, UINT count)
4125 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4128 /* ID3D10EffectScalarVariable methods */
4130 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
4131 float value)
4133 FIXME("iface %p, value %.8e stub!\n", iface, value);
4135 return E_NOTIMPL;
4138 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
4139 float *value)
4141 FIXME("iface %p, value %p stub!\n", iface, value);
4143 return E_NOTIMPL;
4146 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
4147 float *values, UINT offset, UINT count)
4149 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4151 return E_NOTIMPL;
4154 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4155 float *values, UINT offset, UINT count)
4157 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4159 return E_NOTIMPL;
4162 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
4163 int value)
4165 FIXME("iface %p, value %d stub!\n", iface, value);
4167 return E_NOTIMPL;
4170 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4171 int *value)
4173 FIXME("iface %p, value %p stub!\n", iface, value);
4175 return E_NOTIMPL;
4178 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4179 int *values, UINT offset, UINT count)
4181 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4183 return E_NOTIMPL;
4186 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4187 int *values, UINT offset, UINT count)
4189 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4191 return E_NOTIMPL;
4194 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4195 BOOL value)
4197 FIXME("iface %p, value %d stub!\n", iface, value);
4199 return E_NOTIMPL;
4202 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4203 BOOL *value)
4205 FIXME("iface %p, value %p stub!\n", iface, value);
4207 return E_NOTIMPL;
4210 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4211 BOOL *values, UINT offset, UINT count)
4213 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4215 return E_NOTIMPL;
4218 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4219 BOOL *values, UINT offset, UINT count)
4221 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4223 return E_NOTIMPL;
4226 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4228 /* ID3D10EffectVariable methods */
4229 d3d10_effect_scalar_variable_IsValid,
4230 d3d10_effect_scalar_variable_GetType,
4231 d3d10_effect_scalar_variable_GetDesc,
4232 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4233 d3d10_effect_scalar_variable_GetAnnotationByName,
4234 d3d10_effect_scalar_variable_GetMemberByIndex,
4235 d3d10_effect_scalar_variable_GetMemberByName,
4236 d3d10_effect_scalar_variable_GetMemberBySemantic,
4237 d3d10_effect_scalar_variable_GetElement,
4238 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4239 d3d10_effect_scalar_variable_AsScalar,
4240 d3d10_effect_scalar_variable_AsVector,
4241 d3d10_effect_scalar_variable_AsMatrix,
4242 d3d10_effect_scalar_variable_AsString,
4243 d3d10_effect_scalar_variable_AsShaderResource,
4244 d3d10_effect_scalar_variable_AsRenderTargetView,
4245 d3d10_effect_scalar_variable_AsDepthStencilView,
4246 d3d10_effect_scalar_variable_AsConstantBuffer,
4247 d3d10_effect_scalar_variable_AsShader,
4248 d3d10_effect_scalar_variable_AsBlend,
4249 d3d10_effect_scalar_variable_AsDepthStencil,
4250 d3d10_effect_scalar_variable_AsRasterizer,
4251 d3d10_effect_scalar_variable_AsSampler,
4252 d3d10_effect_scalar_variable_SetRawValue,
4253 d3d10_effect_scalar_variable_GetRawValue,
4254 /* ID3D10EffectScalarVariable methods */
4255 d3d10_effect_scalar_variable_SetFloat,
4256 d3d10_effect_scalar_variable_GetFloat,
4257 d3d10_effect_scalar_variable_SetFloatArray,
4258 d3d10_effect_scalar_variable_GetFloatArray,
4259 d3d10_effect_scalar_variable_SetInt,
4260 d3d10_effect_scalar_variable_GetInt,
4261 d3d10_effect_scalar_variable_SetIntArray,
4262 d3d10_effect_scalar_variable_GetIntArray,
4263 d3d10_effect_scalar_variable_SetBool,
4264 d3d10_effect_scalar_variable_GetBool,
4265 d3d10_effect_scalar_variable_SetBoolArray,
4266 d3d10_effect_scalar_variable_GetBoolArray,
4269 /* ID3D10EffectVariable methods */
4271 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4273 TRACE("iface %p\n", iface);
4275 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4278 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4279 ID3D10EffectVectorVariable *iface)
4281 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4284 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4285 D3D10_EFFECT_VARIABLE_DESC *desc)
4287 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4290 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4291 ID3D10EffectVectorVariable *iface, UINT index)
4293 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4296 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4297 ID3D10EffectVectorVariable *iface, const char *name)
4299 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4302 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4303 ID3D10EffectVectorVariable *iface, UINT index)
4305 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4308 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4309 ID3D10EffectVectorVariable *iface, const char *name)
4311 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4314 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4315 ID3D10EffectVectorVariable *iface, const char *semantic)
4317 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4320 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4321 ID3D10EffectVectorVariable *iface, UINT index)
4323 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4326 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4327 ID3D10EffectVectorVariable *iface)
4329 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4332 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4333 ID3D10EffectVectorVariable *iface)
4335 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4338 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4339 ID3D10EffectVectorVariable *iface)
4341 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4344 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4345 ID3D10EffectVectorVariable *iface)
4347 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4350 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4351 ID3D10EffectVectorVariable *iface)
4353 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4356 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4357 ID3D10EffectVectorVariable *iface)
4359 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4362 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4363 ID3D10EffectVectorVariable *iface)
4365 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4368 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4369 ID3D10EffectVectorVariable *iface)
4371 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4374 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4375 ID3D10EffectVectorVariable *iface)
4377 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4380 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4381 ID3D10EffectVectorVariable *iface)
4383 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4386 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4387 ID3D10EffectVectorVariable *iface)
4389 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4392 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4393 ID3D10EffectVectorVariable *iface)
4395 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4398 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4399 ID3D10EffectVectorVariable *iface)
4401 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4404 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4405 ID3D10EffectVectorVariable *iface)
4407 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4410 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4411 void *data, UINT offset, UINT count)
4413 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4416 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4417 void *data, UINT offset, UINT count)
4419 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4422 /* ID3D10EffectVectorVariable methods */
4424 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4425 BOOL *value)
4427 FIXME("iface %p, value %p stub!\n", iface, value);
4429 return E_NOTIMPL;
4432 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4433 int *value)
4435 FIXME("iface %p, value %p stub!\n", iface, value);
4437 return E_NOTIMPL;
4440 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4441 float *value)
4443 FIXME("iface %p, value %p stub!\n", iface, value);
4445 return E_NOTIMPL;
4448 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4449 BOOL *value)
4451 FIXME("iface %p, value %p stub!\n", iface, value);
4453 return E_NOTIMPL;
4456 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4457 int *value)
4459 FIXME("iface %p, value %p stub!\n", iface, value);
4461 return E_NOTIMPL;
4464 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4465 float *value)
4467 FIXME("iface %p, value %p stub!\n", iface, value);
4469 return E_NOTIMPL;
4472 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4473 BOOL *values, UINT offset, UINT count)
4475 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4477 return E_NOTIMPL;
4480 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4481 int *values, UINT offset, UINT count)
4483 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4485 return E_NOTIMPL;
4488 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4489 float *values, UINT offset, UINT count)
4491 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4493 return E_NOTIMPL;
4496 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4497 BOOL *values, UINT offset, UINT count)
4499 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4501 return E_NOTIMPL;
4504 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4505 int *values, UINT offset, UINT count)
4507 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4509 return E_NOTIMPL;
4512 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4513 float *values, UINT offset, UINT count)
4515 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4517 return E_NOTIMPL;
4520 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4522 /* ID3D10EffectVariable methods */
4523 d3d10_effect_vector_variable_IsValid,
4524 d3d10_effect_vector_variable_GetType,
4525 d3d10_effect_vector_variable_GetDesc,
4526 d3d10_effect_vector_variable_GetAnnotationByIndex,
4527 d3d10_effect_vector_variable_GetAnnotationByName,
4528 d3d10_effect_vector_variable_GetMemberByIndex,
4529 d3d10_effect_vector_variable_GetMemberByName,
4530 d3d10_effect_vector_variable_GetMemberBySemantic,
4531 d3d10_effect_vector_variable_GetElement,
4532 d3d10_effect_vector_variable_GetParentConstantBuffer,
4533 d3d10_effect_vector_variable_AsScalar,
4534 d3d10_effect_vector_variable_AsVector,
4535 d3d10_effect_vector_variable_AsMatrix,
4536 d3d10_effect_vector_variable_AsString,
4537 d3d10_effect_vector_variable_AsShaderResource,
4538 d3d10_effect_vector_variable_AsRenderTargetView,
4539 d3d10_effect_vector_variable_AsDepthStencilView,
4540 d3d10_effect_vector_variable_AsConstantBuffer,
4541 d3d10_effect_vector_variable_AsShader,
4542 d3d10_effect_vector_variable_AsBlend,
4543 d3d10_effect_vector_variable_AsDepthStencil,
4544 d3d10_effect_vector_variable_AsRasterizer,
4545 d3d10_effect_vector_variable_AsSampler,
4546 d3d10_effect_vector_variable_SetRawValue,
4547 d3d10_effect_vector_variable_GetRawValue,
4548 /* ID3D10EffectVectorVariable methods */
4549 d3d10_effect_vector_variable_SetBoolVector,
4550 d3d10_effect_vector_variable_SetIntVector,
4551 d3d10_effect_vector_variable_SetFloatVector,
4552 d3d10_effect_vector_variable_GetBoolVector,
4553 d3d10_effect_vector_variable_GetIntVector,
4554 d3d10_effect_vector_variable_GetFloatVector,
4555 d3d10_effect_vector_variable_SetBoolVectorArray,
4556 d3d10_effect_vector_variable_SetIntVectorArray,
4557 d3d10_effect_vector_variable_SetFloatVectorArray,
4558 d3d10_effect_vector_variable_GetBoolVectorArray,
4559 d3d10_effect_vector_variable_GetIntVectorArray,
4560 d3d10_effect_vector_variable_GetFloatVectorArray,
4563 /* ID3D10EffectVariable methods */
4565 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4567 TRACE("iface %p\n", iface);
4569 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4572 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4573 ID3D10EffectMatrixVariable *iface)
4575 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4578 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4579 D3D10_EFFECT_VARIABLE_DESC *desc)
4581 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4584 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4585 ID3D10EffectMatrixVariable *iface, UINT index)
4587 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4590 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4591 ID3D10EffectMatrixVariable *iface, const char *name)
4593 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4596 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4597 ID3D10EffectMatrixVariable *iface, UINT index)
4599 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4602 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4603 ID3D10EffectMatrixVariable *iface, const char *name)
4605 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4608 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4609 ID3D10EffectMatrixVariable *iface, const char *semantic)
4611 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4614 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4615 ID3D10EffectMatrixVariable *iface, UINT index)
4617 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4620 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4621 ID3D10EffectMatrixVariable *iface)
4623 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4626 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4627 ID3D10EffectMatrixVariable *iface)
4629 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4632 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4633 ID3D10EffectMatrixVariable *iface)
4635 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4638 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4639 ID3D10EffectMatrixVariable *iface)
4641 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4644 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4645 ID3D10EffectMatrixVariable *iface)
4647 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4650 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4651 ID3D10EffectMatrixVariable *iface)
4653 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4656 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4657 ID3D10EffectMatrixVariable *iface)
4659 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4662 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4663 ID3D10EffectMatrixVariable *iface)
4665 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4668 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4669 ID3D10EffectMatrixVariable *iface)
4671 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4674 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4675 ID3D10EffectMatrixVariable *iface)
4677 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4680 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4681 ID3D10EffectMatrixVariable *iface)
4683 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4686 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4687 ID3D10EffectMatrixVariable *iface)
4689 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4692 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4693 ID3D10EffectMatrixVariable *iface)
4695 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4698 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4699 ID3D10EffectMatrixVariable *iface)
4701 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4704 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4705 void *data, UINT offset, UINT count)
4707 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4710 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4711 void *data, UINT offset, UINT count)
4713 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4716 /* ID3D10EffectMatrixVariable methods */
4718 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4719 float *data)
4721 FIXME("iface %p, data %p stub!\n", iface, data);
4723 return E_NOTIMPL;
4726 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4727 float *data)
4729 FIXME("iface %p, data %p stub!\n", iface, data);
4731 return E_NOTIMPL;
4734 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4735 float *data, UINT offset, UINT count)
4737 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4739 return E_NOTIMPL;
4742 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4743 float *data, UINT offset, UINT count)
4745 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4747 return E_NOTIMPL;
4750 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4751 float *data)
4753 FIXME("iface %p, data %p stub!\n", iface, data);
4755 return E_NOTIMPL;
4758 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4759 float *data)
4761 FIXME("iface %p, data %p stub!\n", iface, data);
4763 return E_NOTIMPL;
4766 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4767 float *data, UINT offset, UINT count)
4769 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4771 return E_NOTIMPL;
4774 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4775 float *data, UINT offset, UINT count)
4777 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4779 return E_NOTIMPL;
4783 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4785 /* ID3D10EffectVariable methods */
4786 d3d10_effect_matrix_variable_IsValid,
4787 d3d10_effect_matrix_variable_GetType,
4788 d3d10_effect_matrix_variable_GetDesc,
4789 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4790 d3d10_effect_matrix_variable_GetAnnotationByName,
4791 d3d10_effect_matrix_variable_GetMemberByIndex,
4792 d3d10_effect_matrix_variable_GetMemberByName,
4793 d3d10_effect_matrix_variable_GetMemberBySemantic,
4794 d3d10_effect_matrix_variable_GetElement,
4795 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4796 d3d10_effect_matrix_variable_AsScalar,
4797 d3d10_effect_matrix_variable_AsVector,
4798 d3d10_effect_matrix_variable_AsMatrix,
4799 d3d10_effect_matrix_variable_AsString,
4800 d3d10_effect_matrix_variable_AsShaderResource,
4801 d3d10_effect_matrix_variable_AsRenderTargetView,
4802 d3d10_effect_matrix_variable_AsDepthStencilView,
4803 d3d10_effect_matrix_variable_AsConstantBuffer,
4804 d3d10_effect_matrix_variable_AsShader,
4805 d3d10_effect_matrix_variable_AsBlend,
4806 d3d10_effect_matrix_variable_AsDepthStencil,
4807 d3d10_effect_matrix_variable_AsRasterizer,
4808 d3d10_effect_matrix_variable_AsSampler,
4809 d3d10_effect_matrix_variable_SetRawValue,
4810 d3d10_effect_matrix_variable_GetRawValue,
4811 /* ID3D10EffectMatrixVariable methods */
4812 d3d10_effect_matrix_variable_SetMatrix,
4813 d3d10_effect_matrix_variable_GetMatrix,
4814 d3d10_effect_matrix_variable_SetMatrixArray,
4815 d3d10_effect_matrix_variable_GetMatrixArray,
4816 d3d10_effect_matrix_variable_SetMatrixTranspose,
4817 d3d10_effect_matrix_variable_GetMatrixTranspose,
4818 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4819 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4822 /* ID3D10EffectVariable methods */
4824 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4826 TRACE("iface %p\n", iface);
4828 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4831 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4832 ID3D10EffectStringVariable *iface)
4834 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4837 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4838 D3D10_EFFECT_VARIABLE_DESC *desc)
4840 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4843 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4844 ID3D10EffectStringVariable *iface, UINT index)
4846 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4849 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4850 ID3D10EffectStringVariable *iface, const char *name)
4852 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4855 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4856 ID3D10EffectStringVariable *iface, UINT index)
4858 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4861 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4862 ID3D10EffectStringVariable *iface, const char *name)
4864 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4867 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4868 ID3D10EffectStringVariable *iface, const char *semantic)
4870 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4873 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4874 ID3D10EffectStringVariable *iface, UINT index)
4876 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4879 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4880 ID3D10EffectStringVariable *iface)
4882 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4885 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4886 ID3D10EffectStringVariable *iface)
4888 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4891 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4892 ID3D10EffectStringVariable *iface)
4894 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4897 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4898 ID3D10EffectStringVariable *iface)
4900 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4903 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4904 ID3D10EffectStringVariable *iface)
4906 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4909 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4910 ID3D10EffectStringVariable *iface)
4912 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4915 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4916 ID3D10EffectStringVariable *iface)
4918 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4921 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4922 ID3D10EffectStringVariable *iface)
4924 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4927 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4928 ID3D10EffectStringVariable *iface)
4930 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4933 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4934 ID3D10EffectStringVariable *iface)
4936 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4939 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4940 ID3D10EffectStringVariable *iface)
4942 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4945 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4946 ID3D10EffectStringVariable *iface)
4948 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4951 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4952 ID3D10EffectStringVariable *iface)
4954 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4957 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4958 ID3D10EffectStringVariable *iface)
4960 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4963 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4964 void *data, UINT offset, UINT count)
4966 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4969 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4970 void *data, UINT offset, UINT count)
4972 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4975 /* ID3D10EffectStringVariable methods */
4977 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4978 const char **str)
4980 FIXME("iface %p, str %p stub!\n", iface, str);
4982 return E_NOTIMPL;
4985 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4986 const char **strs, UINT offset, UINT count)
4988 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4990 return E_NOTIMPL;
4994 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4996 /* ID3D10EffectVariable methods */
4997 d3d10_effect_string_variable_IsValid,
4998 d3d10_effect_string_variable_GetType,
4999 d3d10_effect_string_variable_GetDesc,
5000 d3d10_effect_string_variable_GetAnnotationByIndex,
5001 d3d10_effect_string_variable_GetAnnotationByName,
5002 d3d10_effect_string_variable_GetMemberByIndex,
5003 d3d10_effect_string_variable_GetMemberByName,
5004 d3d10_effect_string_variable_GetMemberBySemantic,
5005 d3d10_effect_string_variable_GetElement,
5006 d3d10_effect_string_variable_GetParentConstantBuffer,
5007 d3d10_effect_string_variable_AsScalar,
5008 d3d10_effect_string_variable_AsVector,
5009 d3d10_effect_string_variable_AsMatrix,
5010 d3d10_effect_string_variable_AsString,
5011 d3d10_effect_string_variable_AsShaderResource,
5012 d3d10_effect_string_variable_AsRenderTargetView,
5013 d3d10_effect_string_variable_AsDepthStencilView,
5014 d3d10_effect_string_variable_AsConstantBuffer,
5015 d3d10_effect_string_variable_AsShader,
5016 d3d10_effect_string_variable_AsBlend,
5017 d3d10_effect_string_variable_AsDepthStencil,
5018 d3d10_effect_string_variable_AsRasterizer,
5019 d3d10_effect_string_variable_AsSampler,
5020 d3d10_effect_string_variable_SetRawValue,
5021 d3d10_effect_string_variable_GetRawValue,
5022 /* ID3D10EffectStringVariable methods */
5023 d3d10_effect_string_variable_GetString,
5024 d3d10_effect_string_variable_GetStringArray,
5027 /* ID3D10EffectVariable methods */
5029 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
5031 TRACE("iface %p\n", iface);
5033 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
5036 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
5037 ID3D10EffectShaderResourceVariable *iface)
5039 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5042 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
5043 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5045 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5048 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
5049 ID3D10EffectShaderResourceVariable *iface, UINT index)
5051 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5054 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
5055 ID3D10EffectShaderResourceVariable *iface, const char *name)
5057 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5060 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
5061 ID3D10EffectShaderResourceVariable *iface, UINT index)
5063 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5066 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
5067 ID3D10EffectShaderResourceVariable *iface, const char *name)
5069 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5072 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
5073 ID3D10EffectShaderResourceVariable *iface, const char *semantic)
5075 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5078 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
5079 ID3D10EffectShaderResourceVariable *iface, UINT index)
5081 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5084 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
5085 ID3D10EffectShaderResourceVariable *iface)
5087 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5090 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
5091 ID3D10EffectShaderResourceVariable *iface)
5093 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5096 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
5097 ID3D10EffectShaderResourceVariable *iface)
5099 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5102 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
5103 ID3D10EffectShaderResourceVariable *iface)
5105 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5108 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
5109 ID3D10EffectShaderResourceVariable *iface)
5111 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5114 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
5115 ID3D10EffectShaderResourceVariable *iface)
5117 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5120 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
5121 ID3D10EffectShaderResourceVariable *iface)
5123 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5126 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
5127 ID3D10EffectShaderResourceVariable *iface)
5129 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5132 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
5133 ID3D10EffectShaderResourceVariable *iface)
5135 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5138 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
5139 ID3D10EffectShaderResourceVariable *iface)
5141 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5144 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
5145 ID3D10EffectShaderResourceVariable *iface)
5147 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5150 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
5151 ID3D10EffectShaderResourceVariable *iface)
5153 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5156 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5157 ID3D10EffectShaderResourceVariable *iface)
5159 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5162 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5163 ID3D10EffectShaderResourceVariable *iface)
5165 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5168 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5169 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5171 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5174 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5175 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5177 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5180 /* ID3D10EffectShaderResourceVariable methods */
5182 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5183 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5185 FIXME("iface %p, resource %p stub!\n", iface, resource);
5187 return E_NOTIMPL;
5190 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5191 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5193 FIXME("iface %p, resource %p stub!\n", iface, resource);
5195 return E_NOTIMPL;
5198 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5199 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5201 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5203 return E_NOTIMPL;
5206 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5207 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5209 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5211 return E_NOTIMPL;
5215 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5217 /* ID3D10EffectVariable methods */
5218 d3d10_effect_shader_resource_variable_IsValid,
5219 d3d10_effect_shader_resource_variable_GetType,
5220 d3d10_effect_shader_resource_variable_GetDesc,
5221 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5222 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5223 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5224 d3d10_effect_shader_resource_variable_GetMemberByName,
5225 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5226 d3d10_effect_shader_resource_variable_GetElement,
5227 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5228 d3d10_effect_shader_resource_variable_AsScalar,
5229 d3d10_effect_shader_resource_variable_AsVector,
5230 d3d10_effect_shader_resource_variable_AsMatrix,
5231 d3d10_effect_shader_resource_variable_AsString,
5232 d3d10_effect_shader_resource_variable_AsShaderResource,
5233 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5234 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5235 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5236 d3d10_effect_shader_resource_variable_AsShader,
5237 d3d10_effect_shader_resource_variable_AsBlend,
5238 d3d10_effect_shader_resource_variable_AsDepthStencil,
5239 d3d10_effect_shader_resource_variable_AsRasterizer,
5240 d3d10_effect_shader_resource_variable_AsSampler,
5241 d3d10_effect_shader_resource_variable_SetRawValue,
5242 d3d10_effect_shader_resource_variable_GetRawValue,
5243 /* ID3D10EffectShaderResourceVariable methods */
5244 d3d10_effect_shader_resource_variable_SetResource,
5245 d3d10_effect_shader_resource_variable_GetResource,
5246 d3d10_effect_shader_resource_variable_SetResourceArray,
5247 d3d10_effect_shader_resource_variable_GetResourceArray,
5250 /* ID3D10EffectVariable methods */
5252 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5253 ID3D10EffectRenderTargetViewVariable *iface)
5255 TRACE("iface %p\n", iface);
5257 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5260 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5261 ID3D10EffectRenderTargetViewVariable *iface)
5263 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5266 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5267 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5269 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5272 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5273 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5275 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5278 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5279 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5281 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5284 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5285 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5287 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5290 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5291 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5293 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5296 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5297 ID3D10EffectRenderTargetViewVariable *iface, const char *semantic)
5299 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5302 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5303 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5305 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5308 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5309 ID3D10EffectRenderTargetViewVariable *iface)
5311 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5314 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5315 ID3D10EffectRenderTargetViewVariable *iface)
5317 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5320 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5321 ID3D10EffectRenderTargetViewVariable *iface)
5323 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5326 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5327 ID3D10EffectRenderTargetViewVariable *iface)
5329 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5332 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5333 ID3D10EffectRenderTargetViewVariable *iface)
5335 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5338 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5339 ID3D10EffectRenderTargetViewVariable *iface)
5341 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5344 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5345 ID3D10EffectRenderTargetViewVariable *iface)
5347 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5350 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5351 ID3D10EffectRenderTargetViewVariable *iface)
5353 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5356 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5357 ID3D10EffectRenderTargetViewVariable *iface)
5359 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5362 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5363 ID3D10EffectRenderTargetViewVariable *iface)
5365 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5368 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5369 ID3D10EffectRenderTargetViewVariable *iface)
5371 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5374 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5375 ID3D10EffectRenderTargetViewVariable *iface)
5377 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5380 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5381 ID3D10EffectRenderTargetViewVariable *iface)
5383 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5386 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5387 ID3D10EffectRenderTargetViewVariable *iface)
5389 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5392 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5393 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5395 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5398 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5399 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5401 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5404 /* ID3D10EffectRenderTargetViewVariable methods */
5406 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5407 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5409 FIXME("iface %p, view %p stub!\n", iface, view);
5411 return E_NOTIMPL;
5414 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5415 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5417 FIXME("iface %p, view %p stub!\n", iface, view);
5419 return E_NOTIMPL;
5422 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5423 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5425 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5427 return E_NOTIMPL;
5430 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5431 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5433 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5435 return E_NOTIMPL;
5439 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5441 /* ID3D10EffectVariable methods */
5442 d3d10_effect_render_target_view_variable_IsValid,
5443 d3d10_effect_render_target_view_variable_GetType,
5444 d3d10_effect_render_target_view_variable_GetDesc,
5445 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5446 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5447 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5448 d3d10_effect_render_target_view_variable_GetMemberByName,
5449 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5450 d3d10_effect_render_target_view_variable_GetElement,
5451 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5452 d3d10_effect_render_target_view_variable_AsScalar,
5453 d3d10_effect_render_target_view_variable_AsVector,
5454 d3d10_effect_render_target_view_variable_AsMatrix,
5455 d3d10_effect_render_target_view_variable_AsString,
5456 d3d10_effect_render_target_view_variable_AsShaderResource,
5457 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5458 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5459 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5460 d3d10_effect_render_target_view_variable_AsShader,
5461 d3d10_effect_render_target_view_variable_AsBlend,
5462 d3d10_effect_render_target_view_variable_AsDepthStencil,
5463 d3d10_effect_render_target_view_variable_AsRasterizer,
5464 d3d10_effect_render_target_view_variable_AsSampler,
5465 d3d10_effect_render_target_view_variable_SetRawValue,
5466 d3d10_effect_render_target_view_variable_GetRawValue,
5467 /* ID3D10EffectRenderTargetViewVariable methods */
5468 d3d10_effect_render_target_view_variable_SetRenderTarget,
5469 d3d10_effect_render_target_view_variable_GetRenderTarget,
5470 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5471 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5474 /* ID3D10EffectVariable methods */
5476 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5477 ID3D10EffectDepthStencilViewVariable *iface)
5479 TRACE("iface %p\n", iface);
5481 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5484 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5485 ID3D10EffectDepthStencilViewVariable *iface)
5487 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5490 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5491 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5493 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5496 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5497 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5499 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5502 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5503 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5505 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5508 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5509 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5511 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5514 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5515 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5517 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5520 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5521 ID3D10EffectDepthStencilViewVariable *iface, const char *semantic)
5523 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5526 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5527 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5529 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5532 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5533 ID3D10EffectDepthStencilViewVariable *iface)
5535 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5538 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5539 ID3D10EffectDepthStencilViewVariable *iface)
5541 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5544 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5545 ID3D10EffectDepthStencilViewVariable *iface)
5547 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5550 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5551 ID3D10EffectDepthStencilViewVariable *iface)
5553 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5556 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5557 ID3D10EffectDepthStencilViewVariable *iface)
5559 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5562 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5563 ID3D10EffectDepthStencilViewVariable *iface)
5565 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5568 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5569 ID3D10EffectDepthStencilViewVariable *iface)
5571 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5574 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5575 ID3D10EffectDepthStencilViewVariable *iface)
5577 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5580 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5581 ID3D10EffectDepthStencilViewVariable *iface)
5583 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5586 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5587 ID3D10EffectDepthStencilViewVariable *iface)
5589 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5592 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5593 ID3D10EffectDepthStencilViewVariable *iface)
5595 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5598 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5599 ID3D10EffectDepthStencilViewVariable *iface)
5601 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5604 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5605 ID3D10EffectDepthStencilViewVariable *iface)
5607 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5610 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5611 ID3D10EffectDepthStencilViewVariable *iface)
5613 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5616 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5617 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5619 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5622 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5623 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5625 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5628 /* ID3D10EffectDepthStencilViewVariable methods */
5630 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5631 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5633 FIXME("iface %p, view %p stub!\n", iface, view);
5635 return E_NOTIMPL;
5638 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5639 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5641 FIXME("iface %p, view %p stub!\n", iface, view);
5643 return E_NOTIMPL;
5646 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5647 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5649 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5651 return E_NOTIMPL;
5654 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5655 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5657 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5659 return E_NOTIMPL;
5663 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5665 /* ID3D10EffectVariable methods */
5666 d3d10_effect_depth_stencil_view_variable_IsValid,
5667 d3d10_effect_depth_stencil_view_variable_GetType,
5668 d3d10_effect_depth_stencil_view_variable_GetDesc,
5669 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5670 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5671 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5672 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5673 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5674 d3d10_effect_depth_stencil_view_variable_GetElement,
5675 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5676 d3d10_effect_depth_stencil_view_variable_AsScalar,
5677 d3d10_effect_depth_stencil_view_variable_AsVector,
5678 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5679 d3d10_effect_depth_stencil_view_variable_AsString,
5680 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5681 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5682 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5683 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5684 d3d10_effect_depth_stencil_view_variable_AsShader,
5685 d3d10_effect_depth_stencil_view_variable_AsBlend,
5686 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5687 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5688 d3d10_effect_depth_stencil_view_variable_AsSampler,
5689 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5690 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5691 /* ID3D10EffectDepthStencilViewVariable methods */
5692 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5693 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5694 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5695 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5698 /* ID3D10EffectVariable methods */
5700 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5702 TRACE("iface %p\n", iface);
5704 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5707 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5708 ID3D10EffectShaderVariable *iface)
5710 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5713 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5714 D3D10_EFFECT_VARIABLE_DESC *desc)
5716 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5719 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5720 ID3D10EffectShaderVariable *iface, UINT index)
5722 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5725 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5726 ID3D10EffectShaderVariable *iface, const char *name)
5728 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5731 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5732 ID3D10EffectShaderVariable *iface, UINT index)
5734 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5737 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5738 ID3D10EffectShaderVariable *iface, const char *name)
5740 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5743 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5744 ID3D10EffectShaderVariable *iface, const char *semantic)
5746 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5749 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5750 ID3D10EffectShaderVariable *iface, UINT index)
5752 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5755 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5756 ID3D10EffectShaderVariable *iface)
5758 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5761 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5762 ID3D10EffectShaderVariable *iface)
5764 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5767 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5768 ID3D10EffectShaderVariable *iface)
5770 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5773 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5774 ID3D10EffectShaderVariable *iface)
5776 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5779 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5780 ID3D10EffectShaderVariable *iface)
5782 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5785 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5786 ID3D10EffectShaderVariable *iface)
5788 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5791 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5792 ID3D10EffectShaderVariable *iface)
5794 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5797 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5798 ID3D10EffectShaderVariable *iface)
5800 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5803 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5804 ID3D10EffectShaderVariable *iface)
5806 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5809 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5810 ID3D10EffectShaderVariable *iface)
5812 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5815 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5816 ID3D10EffectShaderVariable *iface)
5818 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5821 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5822 ID3D10EffectShaderVariable *iface)
5824 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5827 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5828 ID3D10EffectShaderVariable *iface)
5830 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5833 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5834 ID3D10EffectShaderVariable *iface)
5836 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5839 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5840 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5842 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5845 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5846 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5848 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5851 /* ID3D10EffectShaderVariable methods */
5853 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5854 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5856 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5858 return E_NOTIMPL;
5861 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5862 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5864 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5866 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5868 if (v->type->element_count)
5869 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5871 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5873 WARN("Shader is not a vertex shader.\n");
5874 return E_FAIL;
5877 if ((*shader = v->u.shader.shader.vs))
5878 ID3D10VertexShader_AddRef(*shader);
5880 return S_OK;
5883 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5884 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5886 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5888 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5890 if (v->type->element_count)
5891 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5893 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5895 WARN("Shader is not a geometry shader.\n");
5896 return E_FAIL;
5899 if ((*shader = v->u.shader.shader.gs))
5900 ID3D10GeometryShader_AddRef(*shader);
5902 return S_OK;
5905 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5906 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5908 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5910 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5912 if (v->type->element_count)
5913 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5915 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5917 WARN("Shader is not a pixel shader.\n");
5918 return E_FAIL;
5921 if ((*shader = v->u.shader.shader.ps))
5922 ID3D10PixelShader_AddRef(*shader);
5924 return S_OK;
5927 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5928 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5929 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5931 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5932 struct d3d10_effect_shader_variable *s;
5933 D3D10_SIGNATURE_PARAMETER_DESC *d;
5935 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5936 iface, shader_index, element_index, desc);
5938 if (!iface->lpVtbl->IsValid(iface))
5940 WARN("Null variable specified\n");
5941 return E_FAIL;
5944 /* Check shader_index, this crashes on W7/DX10 */
5945 if (shader_index >= This->effect->used_shader_count)
5947 WARN("This should crash on W7/DX10!\n");
5948 return E_FAIL;
5951 s = &This->effect->used_shaders[shader_index]->u.shader;
5952 if (!s->input_signature.signature)
5954 WARN("No shader signature\n");
5955 return D3DERR_INVALIDCALL;
5958 /* Check desc for NULL, this crashes on W7/DX10 */
5959 if (!desc)
5961 WARN("This should crash on W7/DX10!\n");
5962 return E_FAIL;
5965 if (element_index >= s->input_signature.element_count)
5967 WARN("Invalid element index specified\n");
5968 return E_INVALIDARG;
5971 d = &s->input_signature.elements[element_index];
5972 desc->SemanticName = d->SemanticName;
5973 desc->SemanticIndex = d->SemanticIndex;
5974 desc->SystemValueType = d->SystemValueType;
5975 desc->ComponentType = d->ComponentType;
5976 desc->Register = d->Register;
5977 desc->ReadWriteMask = d->ReadWriteMask;
5978 desc->Mask = d->Mask;
5980 return S_OK;
5983 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5984 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5985 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5987 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5988 struct d3d10_effect_shader_variable *s;
5989 D3D10_SIGNATURE_PARAMETER_DESC *d;
5991 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5992 iface, shader_index, element_index, desc);
5994 if (!iface->lpVtbl->IsValid(iface))
5996 WARN("Null variable specified\n");
5997 return E_FAIL;
6000 /* Check shader_index, this crashes on W7/DX10 */
6001 if (shader_index >= This->effect->used_shader_count)
6003 WARN("This should crash on W7/DX10!\n");
6004 return E_FAIL;
6007 s = &This->effect->used_shaders[shader_index]->u.shader;
6008 if (!s->output_signature.signature)
6010 WARN("No shader signature\n");
6011 return D3DERR_INVALIDCALL;
6014 /* Check desc for NULL, this crashes on W7/DX10 */
6015 if (!desc)
6017 WARN("This should crash on W7/DX10!\n");
6018 return E_FAIL;
6021 if (element_index >= s->output_signature.element_count)
6023 WARN("Invalid element index specified\n");
6024 return E_INVALIDARG;
6027 d = &s->output_signature.elements[element_index];
6028 desc->SemanticName = d->SemanticName;
6029 desc->SemanticIndex = d->SemanticIndex;
6030 desc->SystemValueType = d->SystemValueType;
6031 desc->ComponentType = d->ComponentType;
6032 desc->Register = d->Register;
6033 desc->ReadWriteMask = d->ReadWriteMask;
6034 desc->Mask = d->Mask;
6036 return S_OK;
6040 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
6042 /* ID3D10EffectVariable methods */
6043 d3d10_effect_shader_variable_IsValid,
6044 d3d10_effect_shader_variable_GetType,
6045 d3d10_effect_shader_variable_GetDesc,
6046 d3d10_effect_shader_variable_GetAnnotationByIndex,
6047 d3d10_effect_shader_variable_GetAnnotationByName,
6048 d3d10_effect_shader_variable_GetMemberByIndex,
6049 d3d10_effect_shader_variable_GetMemberByName,
6050 d3d10_effect_shader_variable_GetMemberBySemantic,
6051 d3d10_effect_shader_variable_GetElement,
6052 d3d10_effect_shader_variable_GetParentConstantBuffer,
6053 d3d10_effect_shader_variable_AsScalar,
6054 d3d10_effect_shader_variable_AsVector,
6055 d3d10_effect_shader_variable_AsMatrix,
6056 d3d10_effect_shader_variable_AsString,
6057 d3d10_effect_shader_variable_AsShaderResource,
6058 d3d10_effect_shader_variable_AsRenderTargetView,
6059 d3d10_effect_shader_variable_AsDepthStencilView,
6060 d3d10_effect_shader_variable_AsConstantBuffer,
6061 d3d10_effect_shader_variable_AsShader,
6062 d3d10_effect_shader_variable_AsBlend,
6063 d3d10_effect_shader_variable_AsDepthStencil,
6064 d3d10_effect_shader_variable_AsRasterizer,
6065 d3d10_effect_shader_variable_AsSampler,
6066 d3d10_effect_shader_variable_SetRawValue,
6067 d3d10_effect_shader_variable_GetRawValue,
6068 /* ID3D10EffectShaderVariable methods */
6069 d3d10_effect_shader_variable_GetShaderDesc,
6070 d3d10_effect_shader_variable_GetVertexShader,
6071 d3d10_effect_shader_variable_GetGeometryShader,
6072 d3d10_effect_shader_variable_GetPixelShader,
6073 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
6074 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
6077 /* ID3D10EffectVariable methods */
6079 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
6081 TRACE("iface %p\n", iface);
6083 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
6086 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
6087 ID3D10EffectBlendVariable *iface)
6089 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6092 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
6093 D3D10_EFFECT_VARIABLE_DESC *desc)
6095 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6098 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
6099 ID3D10EffectBlendVariable *iface, UINT index)
6101 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6104 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
6105 ID3D10EffectBlendVariable *iface, const char *name)
6107 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6110 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
6111 ID3D10EffectBlendVariable *iface, UINT index)
6113 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6116 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
6117 ID3D10EffectBlendVariable *iface, const char *name)
6119 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6122 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
6123 ID3D10EffectBlendVariable *iface, const char *semantic)
6125 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6128 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
6129 ID3D10EffectBlendVariable *iface, UINT index)
6131 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6134 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
6135 ID3D10EffectBlendVariable *iface)
6137 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6140 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
6141 ID3D10EffectBlendVariable *iface)
6143 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6146 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
6147 ID3D10EffectBlendVariable *iface)
6149 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6152 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6153 ID3D10EffectBlendVariable *iface)
6155 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6158 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6159 ID3D10EffectBlendVariable *iface)
6161 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6164 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6165 ID3D10EffectBlendVariable *iface)
6167 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6170 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6171 ID3D10EffectBlendVariable *iface)
6173 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6176 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6177 ID3D10EffectBlendVariable *iface)
6179 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6182 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6183 ID3D10EffectBlendVariable *iface)
6185 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6188 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6189 ID3D10EffectBlendVariable *iface)
6191 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6194 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6195 ID3D10EffectBlendVariable *iface)
6197 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6200 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6201 ID3D10EffectBlendVariable *iface)
6203 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6206 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6207 ID3D10EffectBlendVariable *iface)
6209 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6212 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6213 ID3D10EffectBlendVariable *iface)
6215 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6218 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6219 void *data, UINT offset, UINT count)
6221 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6224 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6225 void *data, UINT offset, UINT count)
6227 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6230 /* ID3D10EffectBlendVariable methods */
6232 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6233 UINT index, ID3D10BlendState **blend_state)
6235 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6237 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6239 if (v->type->element_count)
6240 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6241 else if (index)
6242 return E_FAIL;
6244 if (v->type->basetype != D3D10_SVT_BLEND)
6246 WARN("Variable is not a blend state.\n");
6247 return E_FAIL;
6250 if ((*blend_state = v->u.state.object.blend))
6251 ID3D10BlendState_AddRef(*blend_state);
6253 return S_OK;
6256 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6257 UINT index, D3D10_BLEND_DESC *desc)
6259 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6261 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6263 if (v->type->element_count)
6264 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6266 if (v->type->basetype != D3D10_SVT_BLEND)
6268 WARN("Variable is not a blend state.\n");
6269 return E_FAIL;
6272 *desc = v->u.state.desc.blend;
6274 return S_OK;
6278 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6280 /* ID3D10EffectVariable methods */
6281 d3d10_effect_blend_variable_IsValid,
6282 d3d10_effect_blend_variable_GetType,
6283 d3d10_effect_blend_variable_GetDesc,
6284 d3d10_effect_blend_variable_GetAnnotationByIndex,
6285 d3d10_effect_blend_variable_GetAnnotationByName,
6286 d3d10_effect_blend_variable_GetMemberByIndex,
6287 d3d10_effect_blend_variable_GetMemberByName,
6288 d3d10_effect_blend_variable_GetMemberBySemantic,
6289 d3d10_effect_blend_variable_GetElement,
6290 d3d10_effect_blend_variable_GetParentConstantBuffer,
6291 d3d10_effect_blend_variable_AsScalar,
6292 d3d10_effect_blend_variable_AsVector,
6293 d3d10_effect_blend_variable_AsMatrix,
6294 d3d10_effect_blend_variable_AsString,
6295 d3d10_effect_blend_variable_AsShaderResource,
6296 d3d10_effect_blend_variable_AsRenderTargetView,
6297 d3d10_effect_blend_variable_AsDepthStencilView,
6298 d3d10_effect_blend_variable_AsConstantBuffer,
6299 d3d10_effect_blend_variable_AsShader,
6300 d3d10_effect_blend_variable_AsBlend,
6301 d3d10_effect_blend_variable_AsDepthStencil,
6302 d3d10_effect_blend_variable_AsRasterizer,
6303 d3d10_effect_blend_variable_AsSampler,
6304 d3d10_effect_blend_variable_SetRawValue,
6305 d3d10_effect_blend_variable_GetRawValue,
6306 /* ID3D10EffectBlendVariable methods */
6307 d3d10_effect_blend_variable_GetBlendState,
6308 d3d10_effect_blend_variable_GetBackingStore,
6311 /* ID3D10EffectVariable methods */
6313 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6315 TRACE("iface %p\n", iface);
6317 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6320 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6321 ID3D10EffectDepthStencilVariable *iface)
6323 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6326 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6327 D3D10_EFFECT_VARIABLE_DESC *desc)
6329 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6332 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6333 ID3D10EffectDepthStencilVariable *iface, UINT index)
6335 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6338 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6339 ID3D10EffectDepthStencilVariable *iface, const char *name)
6341 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6344 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6345 ID3D10EffectDepthStencilVariable *iface, UINT index)
6347 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6350 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6351 ID3D10EffectDepthStencilVariable *iface, const char *name)
6353 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6356 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6357 ID3D10EffectDepthStencilVariable *iface, const char *semantic)
6359 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6362 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6363 ID3D10EffectDepthStencilVariable *iface, UINT index)
6365 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6368 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6369 ID3D10EffectDepthStencilVariable *iface)
6371 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6374 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6375 ID3D10EffectDepthStencilVariable *iface)
6377 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6380 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6381 ID3D10EffectDepthStencilVariable *iface)
6383 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6386 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6387 ID3D10EffectDepthStencilVariable *iface)
6389 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6392 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6393 ID3D10EffectDepthStencilVariable *iface)
6395 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6398 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6399 ID3D10EffectDepthStencilVariable *iface)
6401 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6404 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6405 ID3D10EffectDepthStencilVariable *iface)
6407 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6410 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6411 ID3D10EffectDepthStencilVariable *iface)
6413 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6416 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6417 ID3D10EffectDepthStencilVariable *iface)
6419 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6422 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6423 ID3D10EffectDepthStencilVariable *iface)
6425 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6428 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6429 ID3D10EffectDepthStencilVariable *iface)
6431 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6434 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6435 ID3D10EffectDepthStencilVariable *iface)
6437 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6440 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6441 ID3D10EffectDepthStencilVariable *iface)
6443 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6446 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6447 ID3D10EffectDepthStencilVariable *iface)
6449 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6452 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6453 void *data, UINT offset, UINT count)
6455 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6458 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6459 void *data, UINT offset, UINT count)
6461 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6464 /* ID3D10EffectDepthStencilVariable methods */
6466 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6467 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6469 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6471 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6473 if (v->type->element_count)
6474 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6475 else if (index)
6476 return E_FAIL;
6478 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6480 WARN("Variable is not a depth stencil state.\n");
6481 return E_FAIL;
6484 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6485 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6487 return S_OK;
6490 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6491 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6493 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6495 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6497 if (v->type->element_count)
6498 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6500 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6502 WARN("Variable is not a depth stencil state.\n");
6503 return E_FAIL;
6506 *desc = v->u.state.desc.depth_stencil;
6508 return S_OK;
6512 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6514 /* ID3D10EffectVariable methods */
6515 d3d10_effect_depth_stencil_variable_IsValid,
6516 d3d10_effect_depth_stencil_variable_GetType,
6517 d3d10_effect_depth_stencil_variable_GetDesc,
6518 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6519 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6520 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6521 d3d10_effect_depth_stencil_variable_GetMemberByName,
6522 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6523 d3d10_effect_depth_stencil_variable_GetElement,
6524 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6525 d3d10_effect_depth_stencil_variable_AsScalar,
6526 d3d10_effect_depth_stencil_variable_AsVector,
6527 d3d10_effect_depth_stencil_variable_AsMatrix,
6528 d3d10_effect_depth_stencil_variable_AsString,
6529 d3d10_effect_depth_stencil_variable_AsShaderResource,
6530 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6531 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6532 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6533 d3d10_effect_depth_stencil_variable_AsShader,
6534 d3d10_effect_depth_stencil_variable_AsBlend,
6535 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6536 d3d10_effect_depth_stencil_variable_AsRasterizer,
6537 d3d10_effect_depth_stencil_variable_AsSampler,
6538 d3d10_effect_depth_stencil_variable_SetRawValue,
6539 d3d10_effect_depth_stencil_variable_GetRawValue,
6540 /* ID3D10EffectDepthStencilVariable methods */
6541 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6542 d3d10_effect_depth_stencil_variable_GetBackingStore,
6545 /* ID3D10EffectVariable methods */
6547 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6549 TRACE("iface %p\n", iface);
6551 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6554 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6555 ID3D10EffectRasterizerVariable *iface)
6557 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6560 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6561 D3D10_EFFECT_VARIABLE_DESC *desc)
6563 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6566 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6567 ID3D10EffectRasterizerVariable *iface, UINT index)
6569 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6572 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6573 ID3D10EffectRasterizerVariable *iface, const char *name)
6575 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6578 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6579 ID3D10EffectRasterizerVariable *iface, UINT index)
6581 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6584 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6585 ID3D10EffectRasterizerVariable *iface, const char *name)
6587 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6590 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6591 ID3D10EffectRasterizerVariable *iface, const char *semantic)
6593 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6596 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6597 ID3D10EffectRasterizerVariable *iface, UINT index)
6599 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6602 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6603 ID3D10EffectRasterizerVariable *iface)
6605 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6608 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6609 ID3D10EffectRasterizerVariable *iface)
6611 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6614 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6615 ID3D10EffectRasterizerVariable *iface)
6617 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6620 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6621 ID3D10EffectRasterizerVariable *iface)
6623 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6626 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6627 ID3D10EffectRasterizerVariable *iface)
6629 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6632 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6633 ID3D10EffectRasterizerVariable *iface)
6635 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6638 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6639 ID3D10EffectRasterizerVariable *iface)
6641 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6644 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6645 ID3D10EffectRasterizerVariable *iface)
6647 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6650 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6651 ID3D10EffectRasterizerVariable *iface)
6653 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6656 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6657 ID3D10EffectRasterizerVariable *iface)
6659 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6662 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6663 ID3D10EffectRasterizerVariable *iface)
6665 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6668 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6669 ID3D10EffectRasterizerVariable *iface)
6671 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6674 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6675 ID3D10EffectRasterizerVariable *iface)
6677 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6680 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6681 ID3D10EffectRasterizerVariable *iface)
6683 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6686 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6687 void *data, UINT offset, UINT count)
6689 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6692 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6693 void *data, UINT offset, UINT count)
6695 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6698 /* ID3D10EffectRasterizerVariable methods */
6700 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6701 UINT index, ID3D10RasterizerState **rasterizer_state)
6703 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6705 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6707 if (v->type->element_count)
6708 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6709 else if (index)
6710 return E_FAIL;
6712 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6714 WARN("Variable is not a rasterizer state.\n");
6715 return E_FAIL;
6718 if ((*rasterizer_state = v->u.state.object.rasterizer))
6719 ID3D10RasterizerState_AddRef(*rasterizer_state);
6721 return S_OK;
6724 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6725 UINT index, D3D10_RASTERIZER_DESC *desc)
6727 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6729 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6731 if (v->type->element_count)
6732 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6734 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6736 WARN("Variable is not a rasterizer state.\n");
6737 return E_FAIL;
6740 *desc = v->u.state.desc.rasterizer;
6742 return S_OK;
6746 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6748 /* ID3D10EffectVariable methods */
6749 d3d10_effect_rasterizer_variable_IsValid,
6750 d3d10_effect_rasterizer_variable_GetType,
6751 d3d10_effect_rasterizer_variable_GetDesc,
6752 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6753 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6754 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6755 d3d10_effect_rasterizer_variable_GetMemberByName,
6756 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6757 d3d10_effect_rasterizer_variable_GetElement,
6758 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6759 d3d10_effect_rasterizer_variable_AsScalar,
6760 d3d10_effect_rasterizer_variable_AsVector,
6761 d3d10_effect_rasterizer_variable_AsMatrix,
6762 d3d10_effect_rasterizer_variable_AsString,
6763 d3d10_effect_rasterizer_variable_AsShaderResource,
6764 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6765 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6766 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6767 d3d10_effect_rasterizer_variable_AsShader,
6768 d3d10_effect_rasterizer_variable_AsBlend,
6769 d3d10_effect_rasterizer_variable_AsDepthStencil,
6770 d3d10_effect_rasterizer_variable_AsRasterizer,
6771 d3d10_effect_rasterizer_variable_AsSampler,
6772 d3d10_effect_rasterizer_variable_SetRawValue,
6773 d3d10_effect_rasterizer_variable_GetRawValue,
6774 /* ID3D10EffectRasterizerVariable methods */
6775 d3d10_effect_rasterizer_variable_GetRasterizerState,
6776 d3d10_effect_rasterizer_variable_GetBackingStore,
6779 /* ID3D10EffectVariable methods */
6781 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6783 TRACE("iface %p\n", iface);
6785 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6788 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6789 ID3D10EffectSamplerVariable *iface)
6791 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6794 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6795 D3D10_EFFECT_VARIABLE_DESC *desc)
6797 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6800 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6801 ID3D10EffectSamplerVariable *iface, UINT index)
6803 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6806 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6807 ID3D10EffectSamplerVariable *iface, const char *name)
6809 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6812 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6813 ID3D10EffectSamplerVariable *iface, UINT index)
6815 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6818 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6819 ID3D10EffectSamplerVariable *iface, const char *name)
6821 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6824 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6825 ID3D10EffectSamplerVariable *iface, const char *semantic)
6827 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6830 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6831 ID3D10EffectSamplerVariable *iface, UINT index)
6833 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6836 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6837 ID3D10EffectSamplerVariable *iface)
6839 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6842 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6843 ID3D10EffectSamplerVariable *iface)
6845 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6848 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6849 ID3D10EffectSamplerVariable *iface)
6851 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6854 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6855 ID3D10EffectSamplerVariable *iface)
6857 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6860 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6861 ID3D10EffectSamplerVariable *iface)
6863 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6866 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6867 ID3D10EffectSamplerVariable *iface)
6869 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6872 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6873 ID3D10EffectSamplerVariable *iface)
6875 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6878 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6879 ID3D10EffectSamplerVariable *iface)
6881 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6884 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6885 ID3D10EffectSamplerVariable *iface)
6887 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6890 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6891 ID3D10EffectSamplerVariable *iface)
6893 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6896 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6897 ID3D10EffectSamplerVariable *iface)
6899 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6902 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6903 ID3D10EffectSamplerVariable *iface)
6905 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6908 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6909 ID3D10EffectSamplerVariable *iface)
6911 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6914 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6915 ID3D10EffectSamplerVariable *iface)
6917 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6920 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6921 void *data, UINT offset, UINT count)
6923 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6926 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6927 void *data, UINT offset, UINT count)
6929 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6932 /* ID3D10EffectSamplerVariable methods */
6934 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6935 UINT index, ID3D10SamplerState **sampler)
6937 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6939 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6941 if (v->type->element_count)
6942 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6943 else if (index)
6944 return E_FAIL;
6946 if (v->type->basetype != D3D10_SVT_SAMPLER)
6948 WARN("Variable is not a sampler state.\n");
6949 return E_FAIL;
6952 if ((*sampler = v->u.state.object.sampler))
6953 ID3D10SamplerState_AddRef(*sampler);
6955 return S_OK;
6958 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6959 UINT index, D3D10_SAMPLER_DESC *desc)
6961 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6963 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6965 if (v->type->element_count)
6966 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6968 if (v->type->basetype != D3D10_SVT_SAMPLER)
6970 WARN("Variable is not a sampler state.\n");
6971 return E_FAIL;
6974 *desc = v->u.state.desc.sampler;
6976 return S_OK;
6980 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6982 /* ID3D10EffectVariable methods */
6983 d3d10_effect_sampler_variable_IsValid,
6984 d3d10_effect_sampler_variable_GetType,
6985 d3d10_effect_sampler_variable_GetDesc,
6986 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6987 d3d10_effect_sampler_variable_GetAnnotationByName,
6988 d3d10_effect_sampler_variable_GetMemberByIndex,
6989 d3d10_effect_sampler_variable_GetMemberByName,
6990 d3d10_effect_sampler_variable_GetMemberBySemantic,
6991 d3d10_effect_sampler_variable_GetElement,
6992 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6993 d3d10_effect_sampler_variable_AsScalar,
6994 d3d10_effect_sampler_variable_AsVector,
6995 d3d10_effect_sampler_variable_AsMatrix,
6996 d3d10_effect_sampler_variable_AsString,
6997 d3d10_effect_sampler_variable_AsShaderResource,
6998 d3d10_effect_sampler_variable_AsRenderTargetView,
6999 d3d10_effect_sampler_variable_AsDepthStencilView,
7000 d3d10_effect_sampler_variable_AsConstantBuffer,
7001 d3d10_effect_sampler_variable_AsShader,
7002 d3d10_effect_sampler_variable_AsBlend,
7003 d3d10_effect_sampler_variable_AsDepthStencil,
7004 d3d10_effect_sampler_variable_AsRasterizer,
7005 d3d10_effect_sampler_variable_AsSampler,
7006 d3d10_effect_sampler_variable_SetRawValue,
7007 d3d10_effect_sampler_variable_GetRawValue,
7008 /* ID3D10EffectSamplerVariable methods */
7009 d3d10_effect_sampler_variable_GetSampler,
7010 d3d10_effect_sampler_variable_GetBackingStore,
7013 /* ID3D10EffectType methods */
7015 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
7017 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
7020 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
7022 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7024 TRACE("iface %p\n", iface);
7026 return This != &null_type;
7029 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
7031 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7033 TRACE("iface %p, desc %p\n", iface, desc);
7035 if (This == &null_type)
7037 WARN("Null type specified\n");
7038 return E_FAIL;
7041 if (!desc)
7043 WARN("Invalid argument specified\n");
7044 return E_INVALIDARG;
7047 desc->TypeName = This->name;
7048 desc->Class = This->type_class;
7049 desc->Type = This->basetype;
7050 desc->Elements = This->element_count;
7051 desc->Members = This->member_count;
7052 desc->Rows = This->row_count;
7053 desc->Columns = This->column_count;
7054 desc->PackedSize = This->size_packed;
7055 desc->UnpackedSize = This->size_unpacked;
7056 desc->Stride = This->stride;
7058 return S_OK;
7061 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
7062 UINT index)
7064 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7065 struct d3d10_effect_type *t;
7067 TRACE("iface %p, index %u\n", iface, index);
7069 if (index >= This->member_count)
7071 WARN("Invalid index specified\n");
7072 return &null_type.ID3D10EffectType_iface;
7075 t = (&This->members[index])->type;
7077 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
7079 return &t->ID3D10EffectType_iface;
7082 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
7083 const char *name)
7085 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7086 unsigned int i;
7088 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
7090 if (!name)
7092 WARN("Invalid name specified\n");
7093 return &null_type.ID3D10EffectType_iface;
7096 for (i = 0; i < This->member_count; ++i)
7098 struct d3d10_effect_type_member *typem = &This->members[i];
7100 if (typem->name && !strcmp(typem->name, name))
7102 TRACE("Returning type %p.\n", typem->type);
7103 return &typem->type->ID3D10EffectType_iface;
7107 WARN("Invalid name specified\n");
7109 return &null_type.ID3D10EffectType_iface;
7112 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
7113 const char *semantic)
7115 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7116 unsigned int i;
7118 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
7120 if (!semantic)
7122 WARN("Invalid semantic specified\n");
7123 return &null_type.ID3D10EffectType_iface;
7126 for (i = 0; i < This->member_count; ++i)
7128 struct d3d10_effect_type_member *typem = &This->members[i];
7130 if (typem->semantic && !strcmp(typem->semantic, semantic))
7132 TRACE("Returning type %p.\n", typem->type);
7133 return &typem->type->ID3D10EffectType_iface;
7137 WARN("Invalid semantic specified\n");
7139 return &null_type.ID3D10EffectType_iface;
7142 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
7144 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7145 struct d3d10_effect_type_member *typem;
7147 TRACE("iface %p, index %u\n", iface, index);
7149 if (index >= This->member_count)
7151 WARN("Invalid index specified\n");
7152 return NULL;
7155 typem = &This->members[index];
7157 TRACE("Returning name %s\n", debugstr_a(typem->name));
7159 return typem->name;
7162 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7164 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7165 struct d3d10_effect_type_member *typem;
7167 TRACE("iface %p, index %u\n", iface, index);
7169 if (index >= This->member_count)
7171 WARN("Invalid index specified\n");
7172 return NULL;
7175 typem = &This->members[index];
7177 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7179 return typem->semantic;
7182 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7184 /* ID3D10EffectType */
7185 d3d10_effect_type_IsValid,
7186 d3d10_effect_type_GetDesc,
7187 d3d10_effect_type_GetMemberTypeByIndex,
7188 d3d10_effect_type_GetMemberTypeByName,
7189 d3d10_effect_type_GetMemberTypeBySemantic,
7190 d3d10_effect_type_GetMemberName,
7191 d3d10_effect_type_GetMemberSemantic,