gdiplus: Add option to save metafile tests to files.
[wine/multimedia.git] / dlls / d3d10 / effect.c
blobcda9bbdabbb552d6222c1efd99216610f20f181d
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, const char *data, DWORD offset);
115 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
117 return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
120 struct d3d10_effect_state_property_info
122 UINT id;
123 const char *name;
124 D3D_SHADER_VARIABLE_TYPE type;
125 UINT size;
126 UINT count;
127 D3D_SHADER_VARIABLE_TYPE container_type;
128 LONG offset;
131 static const struct d3d10_effect_state_property_info property_info[] =
133 {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
134 {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
135 {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
136 {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
137 {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
138 {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
139 {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
140 {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
141 {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
142 {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
143 {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
144 {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
145 {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
146 {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
147 {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
148 {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
149 {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
150 {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
151 {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
152 {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
153 {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
154 {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
155 {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
156 {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
157 {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
158 {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
159 {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
160 {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
161 {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
162 {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
163 {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
164 {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
165 {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
166 {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
167 {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
168 {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
169 {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
170 {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
171 {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
172 {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
173 {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
174 {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
175 {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
178 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
180 D3D10_FILL_SOLID,
181 D3D10_CULL_BACK,
182 FALSE,
184 0.0f,
185 0.0f,
186 TRUE,
187 FALSE,
188 FALSE,
189 FALSE,
192 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
194 TRUE,
195 D3D10_DEPTH_WRITE_MASK_ALL,
196 D3D10_COMPARISON_LESS,
197 FALSE,
198 D3D10_DEFAULT_STENCIL_READ_MASK,
199 D3D10_DEFAULT_STENCIL_WRITE_MASK,
200 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
201 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
204 static const D3D10_BLEND_DESC default_blend_desc =
206 FALSE,
207 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
208 D3D10_BLEND_SRC_ALPHA,
209 D3D10_BLEND_INV_SRC_ALPHA,
210 D3D10_BLEND_OP_ADD,
211 D3D10_BLEND_SRC_ALPHA,
212 D3D10_BLEND_INV_SRC_ALPHA,
213 D3D10_BLEND_OP_ADD,
214 {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
217 static const D3D10_SAMPLER_DESC default_sampler_desc =
219 D3D10_FILTER_MIN_MAG_MIP_POINT,
220 D3D10_TEXTURE_ADDRESS_WRAP,
221 D3D10_TEXTURE_ADDRESS_WRAP,
222 D3D10_TEXTURE_ADDRESS_WRAP,
223 0.0f,
225 D3D10_COMPARISON_NEVER,
226 {0.0f, 0.0f, 0.0f, 0.0f},
227 0.0f,
228 FLT_MAX,
231 struct d3d10_effect_state_storage_info
233 D3D_SHADER_VARIABLE_TYPE id;
234 SIZE_T size;
235 const void *default_state;
238 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
240 {D3D10_SVT_RASTERIZER, sizeof(default_rasterizer_desc), &default_rasterizer_desc },
241 {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
242 {D3D10_SVT_BLEND, sizeof(default_blend_desc), &default_blend_desc },
243 {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc },
246 static BOOL copy_name(const char *ptr, char **name)
248 size_t name_len;
250 if (!ptr) return TRUE;
252 name_len = strlen(ptr) + 1;
253 if (name_len == 1)
255 return TRUE;
258 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
259 if (!*name)
261 ERR("Failed to allocate name memory.\n");
262 return FALSE;
265 memcpy(*name, ptr, name_len);
267 return TRUE;
270 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
272 D3D10_SIGNATURE_PARAMETER_DESC *e;
273 const char *ptr = data;
274 unsigned int i;
275 DWORD count;
277 read_dword(&ptr, &count);
278 TRACE("%u elements\n", count);
280 skip_dword_unknown("shader signature", &ptr, 1);
282 e = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*e));
283 if (!e)
285 ERR("Failed to allocate signature memory.\n");
286 return E_OUTOFMEMORY;
289 for (i = 0; i < count; ++i)
291 UINT name_offset;
292 UINT mask;
294 read_dword(&ptr, &name_offset);
295 e[i].SemanticName = data + name_offset;
296 read_dword(&ptr, &e[i].SemanticIndex);
297 read_dword(&ptr, &e[i].SystemValueType);
298 read_dword(&ptr, &e[i].ComponentType);
299 read_dword(&ptr, &e[i].Register);
300 read_dword(&ptr, &mask);
302 e[i].ReadWriteMask = mask >> 8;
303 e[i].Mask = mask & 0xff;
305 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
306 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
307 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
308 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
311 s->elements = e;
312 s->element_count = count;
314 return S_OK;
317 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
319 HeapFree(GetProcessHeap(), 0, s->signature);
320 HeapFree(GetProcessHeap(), 0, s->elements);
323 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
325 struct d3d10_effect_shader_variable *s = ctx;
326 HRESULT hr;
328 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
330 TRACE("chunk size: %#x\n", data_size);
332 switch(tag)
334 case TAG_ISGN:
335 case TAG_OSGN:
337 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
338 UINT size = 44 + data_size;
339 struct d3d10_effect_shader_signature *sig;
340 char *ptr;
342 if (tag == TAG_ISGN) sig = &s->input_signature;
343 else sig = &s->output_signature;
345 sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
346 if (!sig->signature)
348 ERR("Failed to allocate input signature data\n");
349 return E_OUTOFMEMORY;
351 sig->signature_size = size;
353 ptr = sig->signature;
355 write_dword(&ptr, TAG_DXBC);
357 /* signature(?) */
358 write_dword_unknown(&ptr, 0);
359 write_dword_unknown(&ptr, 0);
360 write_dword_unknown(&ptr, 0);
361 write_dword_unknown(&ptr, 0);
363 /* seems to be always 1 */
364 write_dword_unknown(&ptr, 1);
366 /* DXBC size */
367 write_dword(&ptr, size);
369 /* chunk count */
370 write_dword(&ptr, 1);
372 /* chunk index */
373 write_dword(&ptr, (ptr - sig->signature) + 4);
375 /* chunk */
376 write_dword(&ptr, tag);
377 write_dword(&ptr, data_size);
378 memcpy(ptr, data, data_size);
380 hr = shader_parse_signature(ptr, data_size, sig);
381 if (FAILED(hr))
383 ERR("Failed to parse shader, hr %#x\n", hr);
384 shader_free_signature(sig);
387 break;
390 default:
391 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
392 break;
395 return S_OK;
398 static HRESULT parse_shader(ID3D10EffectVariable *variable, const char *data)
400 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(variable);
401 ID3D10Device *device = v->effect->device;
402 const char *ptr = data;
403 DWORD dxbc_size;
404 HRESULT hr;
406 if (v->effect->used_shader_current >= v->effect->used_shader_count)
408 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
409 return E_FAIL;
412 v->effect->used_shaders[v->effect->used_shader_current] = v;
413 ++v->effect->used_shader_current;
415 if (!ptr) return S_OK;
417 read_dword(&ptr, &dxbc_size);
418 TRACE("dxbc size: %#x\n", dxbc_size);
420 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
421 if (!dxbc_size) return S_OK;
423 switch (v->type->basetype)
425 case D3D10_SVT_VERTEXSHADER:
426 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &v->u.shader.shader.vs);
427 if (FAILED(hr)) return hr;
428 break;
430 case D3D10_SVT_PIXELSHADER:
431 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &v->u.shader.shader.ps);
432 if (FAILED(hr)) return hr;
433 break;
435 case D3D10_SVT_GEOMETRYSHADER:
436 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &v->u.shader.shader.gs);
437 if (FAILED(hr)) return hr;
438 break;
440 default:
441 ERR("This should not happen!\n");
442 return E_FAIL;
445 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, &v->u.shader);
448 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
450 switch (c)
452 case 1: return D3D10_SVC_SCALAR;
453 case 2: return D3D10_SVC_VECTOR;
454 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
455 else return D3D10_SVC_MATRIX_ROWS;
456 default:
457 FIXME("Unknown variable class %#x.\n", c);
458 return 0;
462 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
464 if(is_object)
466 switch (t)
468 case 1: return D3D10_SVT_STRING;
469 case 2: return D3D10_SVT_BLEND;
470 case 3: return D3D10_SVT_DEPTHSTENCIL;
471 case 4: return D3D10_SVT_RASTERIZER;
472 case 5: return D3D10_SVT_PIXELSHADER;
473 case 6: return D3D10_SVT_VERTEXSHADER;
474 case 7: return D3D10_SVT_GEOMETRYSHADER;
476 case 10: return D3D10_SVT_TEXTURE1D;
477 case 11: return D3D10_SVT_TEXTURE1DARRAY;
478 case 12: return D3D10_SVT_TEXTURE2D;
479 case 13: return D3D10_SVT_TEXTURE2DARRAY;
480 case 14: return D3D10_SVT_TEXTURE2DMS;
481 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
482 case 16: return D3D10_SVT_TEXTURE3D;
483 case 17: return D3D10_SVT_TEXTURECUBE;
485 case 19: return D3D10_SVT_RENDERTARGETVIEW;
486 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
487 case 21: return D3D10_SVT_SAMPLER;
488 case 22: return D3D10_SVT_BUFFER;
489 default:
490 FIXME("Unknown variable type %#x.\n", t);
491 return D3D10_SVT_VOID;
494 else
496 switch (t)
498 case 1: return D3D10_SVT_FLOAT;
499 case 2: return D3D10_SVT_INT;
500 case 3: return D3D10_SVT_UINT;
501 case 4: return D3D10_SVT_BOOL;
502 default:
503 FIXME("Unknown variable type %#x.\n", t);
504 return D3D10_SVT_VOID;
509 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
511 DWORD unknown0;
512 DWORD offset;
513 DWORD typeinfo;
514 unsigned int i;
516 read_dword(&ptr, &offset);
517 TRACE("Type name at offset %#x.\n", offset);
519 if (!copy_name(data + offset, &t->name))
521 ERR("Failed to copy name.\n");
522 return E_OUTOFMEMORY;
524 TRACE("Type name: %s.\n", debugstr_a(t->name));
526 read_dword(&ptr, &unknown0);
527 TRACE("Unknown 0: %u.\n", unknown0);
529 read_dword(&ptr, &t->element_count);
530 TRACE("Element count: %u.\n", t->element_count);
532 read_dword(&ptr, &t->size_unpacked);
533 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
535 read_dword(&ptr, &t->stride);
536 TRACE("Stride: %#x.\n", t->stride);
538 read_dword(&ptr, &t->size_packed);
539 TRACE("Packed size %#x.\n", t->size_packed);
541 switch (unknown0)
543 case 1:
544 t->member_count = 0;
546 read_dword(&ptr, &typeinfo);
547 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
548 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
549 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
550 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);
552 TRACE("Type description: %#x.\n", typeinfo);
553 TRACE("\tcolumns: %u.\n", t->column_count);
554 TRACE("\trows: %u.\n", t->row_count);
555 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
556 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
557 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
558 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
559 break;
561 case 2:
562 TRACE("Type is an object.\n");
564 t->member_count = 0;
565 t->column_count = 0;
566 t->row_count = 0;
567 t->type_class = D3D10_SVC_OBJECT;
569 read_dword(&ptr, &typeinfo);
570 t->basetype = d3d10_variable_type(typeinfo, TRUE);
572 TRACE("Type description: %#x.\n", typeinfo);
573 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
574 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
575 break;
577 case 3:
578 TRACE("Type is a structure.\n");
580 read_dword(&ptr, &t->member_count);
581 TRACE("Member count: %u.\n", t->member_count);
583 t->column_count = 0;
584 t->row_count = 0;
585 t->basetype = 0;
586 t->type_class = D3D10_SVC_STRUCT;
588 t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
589 if (!t->members)
591 ERR("Failed to allocate members memory.\n");
592 return E_OUTOFMEMORY;
595 for (i = 0; i < t->member_count; ++i)
597 struct d3d10_effect_type_member *typem = &t->members[i];
599 read_dword(&ptr, &offset);
600 TRACE("Member name at offset %#x.\n", offset);
602 if (!copy_name(data + offset, &typem->name))
604 ERR("Failed to copy name.\n");
605 return E_OUTOFMEMORY;
607 TRACE("Member name: %s.\n", debugstr_a(typem->name));
609 read_dword(&ptr, &offset);
610 TRACE("Member semantic at offset %#x.\n", offset);
612 if (!copy_name(data + offset, &typem->semantic))
614 ERR("Failed to copy semantic.\n");
615 return E_OUTOFMEMORY;
617 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
619 read_dword(&ptr, &typem->buffer_offset);
620 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
622 read_dword(&ptr, &offset);
623 TRACE("Member type info at offset %#x.\n", offset);
625 typem->type = get_fx10_type(t->effect, data, offset);
626 if (!typem->type)
628 ERR("Failed to get variable type.\n");
629 return E_FAIL;
632 break;
634 default:
635 FIXME("Unhandled case %#x.\n", unknown0);
636 return E_FAIL;
639 if (t->element_count)
641 TRACE("Elementtype for type at offset: %#x\n", t->id);
643 /* allocate elementtype - we need only one, because all elements have the same type */
644 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
645 if (!t->elementtype)
647 ERR("Failed to allocate members memory.\n");
648 return E_OUTOFMEMORY;
651 /* create a copy of the original type with some minor changes */
652 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
653 t->elementtype->effect = t->effect;
655 if (!copy_name(t->name, &t->elementtype->name))
657 ERR("Failed to copy name.\n");
658 return E_OUTOFMEMORY;
660 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
662 t->elementtype->element_count = 0;
663 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
666 * Not sure if this calculation is 100% correct, but a test
667 * shows that these values work.
669 t->elementtype->size_unpacked = t->size_packed / t->element_count;
670 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
672 t->elementtype->stride = t->stride;
673 TRACE("\tStride: %#x.\n", t->elementtype->stride);
675 t->elementtype->size_packed = t->size_packed / t->element_count;
676 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
678 t->elementtype->member_count = t->member_count;
679 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
681 t->elementtype->column_count = t->column_count;
682 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
684 t->elementtype->row_count = t->row_count;
685 TRACE("\tRows: %u.\n", t->elementtype->row_count);
687 t->elementtype->basetype = t->basetype;
688 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
690 t->elementtype->type_class = t->type_class;
691 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
693 t->elementtype->members = t->members;
696 return S_OK;
699 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
701 struct d3d10_effect_type *type;
702 struct wine_rb_entry *entry;
703 HRESULT hr;
705 entry = wine_rb_get(&effect->types, &offset);
706 if (entry)
708 TRACE("Returning existing type.\n");
709 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
712 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
713 if (!type)
715 ERR("Failed to allocate type memory.\n");
716 return NULL;
719 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
720 type->id = offset;
721 type->effect = effect;
722 hr = parse_fx10_type(type, data + offset, data);
723 if (FAILED(hr))
725 ERR("Failed to parse type info, hr %#x.\n", hr);
726 HeapFree(GetProcessHeap(), 0, type);
727 return NULL;
730 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
732 ERR("Failed to insert type entry.\n");
733 HeapFree(GetProcessHeap(), 0, type);
734 return NULL;
737 return type;
740 static void set_variable_vtbl(struct d3d10_effect_variable *v)
742 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
744 switch (v->type->type_class)
746 case D3D10_SVC_SCALAR:
747 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
748 break;
750 case D3D10_SVC_VECTOR:
751 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
752 break;
754 case D3D10_SVC_MATRIX_ROWS:
755 case D3D10_SVC_MATRIX_COLUMNS:
756 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
757 break;
759 case D3D10_SVC_STRUCT:
760 *vtbl = &d3d10_effect_variable_vtbl;
761 break;
763 case D3D10_SVC_OBJECT:
764 switch(v->type->basetype)
766 case D3D10_SVT_STRING:
767 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
768 break;
770 case D3D10_SVT_TEXTURE1D:
771 case D3D10_SVT_TEXTURE1DARRAY:
772 case D3D10_SVT_TEXTURE2D:
773 case D3D10_SVT_TEXTURE2DARRAY:
774 case D3D10_SVT_TEXTURE2DMS:
775 case D3D10_SVT_TEXTURE2DMSARRAY:
776 case D3D10_SVT_TEXTURE3D:
777 case D3D10_SVT_TEXTURECUBE:
778 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
779 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
780 break;
782 case D3D10_SVT_RENDERTARGETVIEW:
783 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
784 break;
786 case D3D10_SVT_DEPTHSTENCILVIEW:
787 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
788 break;
790 case D3D10_SVT_DEPTHSTENCIL:
791 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
792 break;
794 case D3D10_SVT_VERTEXSHADER:
795 case D3D10_SVT_GEOMETRYSHADER:
796 case D3D10_SVT_PIXELSHADER:
797 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
798 break;
800 case D3D10_SVT_BLEND:
801 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
802 break;
804 case D3D10_SVT_RASTERIZER:
805 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
806 break;
808 case D3D10_SVT_SAMPLER:
809 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
810 break;
812 default:
813 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
814 *vtbl = &d3d10_effect_variable_vtbl;
815 break;
817 break;
819 default:
820 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
821 *vtbl = &d3d10_effect_variable_vtbl;
822 break;
826 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
828 unsigned int i;
829 HRESULT hr;
831 if (v->type->member_count)
833 v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
834 if (!v->members)
836 ERR("Failed to allocate members memory.\n");
837 return E_OUTOFMEMORY;
840 for (i = 0; i < v->type->member_count; ++i)
842 struct d3d10_effect_variable *var = &v->members[i];
843 struct d3d10_effect_type_member *typem = &v->type->members[i];
845 var->buffer = v->buffer;
846 var->effect = v->effect;
847 var->type = typem->type;
848 set_variable_vtbl(var);
850 if (!copy_name(typem->name, &var->name))
852 ERR("Failed to copy name.\n");
853 return E_OUTOFMEMORY;
855 TRACE("Variable name: %s.\n", debugstr_a(var->name));
857 if (!copy_name(typem->semantic, &var->semantic))
859 ERR("Failed to copy name.\n");
860 return E_OUTOFMEMORY;
862 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
864 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
865 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
867 hr = copy_variableinfo_from_type(var);
868 if (FAILED(hr)) return hr;
872 if (v->type->element_count)
874 unsigned int bufferoffset = v->buffer_offset;
876 v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
877 if (!v->elements)
879 ERR("Failed to allocate elements memory.\n");
880 return E_OUTOFMEMORY;
883 for (i = 0; i < v->type->element_count; ++i)
885 struct d3d10_effect_variable *var = &v->elements[i];
887 var->buffer = v->buffer;
888 var->effect = v->effect;
889 var->type = v->type->elementtype;
890 set_variable_vtbl(var);
892 if (!copy_name(v->name, &var->name))
894 ERR("Failed to copy name.\n");
895 return E_OUTOFMEMORY;
897 TRACE("Variable name: %s.\n", debugstr_a(var->name));
899 if (!copy_name(v->semantic, &var->semantic))
901 ERR("Failed to copy name.\n");
902 return E_OUTOFMEMORY;
904 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
906 if (i != 0)
908 bufferoffset += v->type->stride;
910 var->buffer_offset = bufferoffset;
911 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
913 hr = copy_variableinfo_from_type(var);
914 if (FAILED(hr)) return hr;
918 return S_OK;
921 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
923 DWORD offset;
925 read_dword(ptr, &offset);
926 TRACE("Variable name at offset %#x.\n", offset);
928 if (!copy_name(data + offset, &v->name))
930 ERR("Failed to copy name.\n");
931 return E_OUTOFMEMORY;
933 TRACE("Variable name: %s.\n", debugstr_a(v->name));
935 read_dword(ptr, &offset);
936 TRACE("Variable type info at offset %#x.\n", offset);
938 v->type = get_fx10_type(v->effect, data, offset);
939 if (!v->type)
941 ERR("Failed to get variable type.\n");
942 return E_FAIL;
944 set_variable_vtbl(v);
946 return copy_variableinfo_from_type(v);
949 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
951 HRESULT hr;
953 hr = parse_fx10_variable_head(a, ptr, data);
954 if (FAILED(hr)) return hr;
956 skip_dword_unknown("annotation", ptr, 1);
958 /* mark the variable as annotation */
959 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
961 return S_OK;
964 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
965 enum d3d10_effect_object_type otype)
967 struct d3d10_effect_variable *v = &s->shader;
968 struct d3d10_effect_type *t = &s->type;
969 const char *shader = NULL;
971 switch (otype)
973 case D3D10_EOT_VERTEXSHADER:
974 shader = "vertexshader";
975 t->basetype = D3D10_SVT_VERTEXSHADER;
976 break;
978 case D3D10_EOT_PIXELSHADER:
979 shader = "pixelshader";
980 t->basetype = D3D10_SVT_PIXELSHADER;
981 break;
983 case D3D10_EOT_GEOMETRYSHADER:
984 shader = "geometryshader";
985 t->basetype = D3D10_SVT_GEOMETRYSHADER;
986 break;
988 default:
989 FIXME("Unhandled object type %#x.\n", otype);
990 return E_FAIL;
993 if (!copy_name(shader, &t->name))
995 ERR("Failed to copy name.\n");
996 return E_OUTOFMEMORY;
998 TRACE("Type name: %s.\n", debugstr_a(t->name));
1000 t->type_class = D3D10_SVC_OBJECT;
1002 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1004 v->type = t;
1005 v->effect = e;
1006 set_variable_vtbl(v);
1008 if (!copy_name("$Anonymous", &v->name))
1010 ERR("Failed to copy semantic.\n");
1011 return E_OUTOFMEMORY;
1013 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1015 if (!copy_name(NULL, &v->semantic))
1017 ERR("Failed to copy semantic.\n");
1018 return E_OUTOFMEMORY;
1020 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1022 return S_OK;
1025 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1027 unsigned int i;
1029 for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1031 if (property_info[i].id == id)
1032 return &property_info[i];
1035 return NULL;
1038 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1040 unsigned int i;
1042 for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1044 if (d3d10_effect_state_storage_info[i].id == id)
1045 return &d3d10_effect_state_storage_info[i];
1048 return NULL;
1051 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1053 switch (in_type)
1055 case D3D10_SVT_FLOAT:
1056 out_data[idx] = *(float *)&value;
1057 return TRUE;
1059 case D3D10_SVT_INT:
1060 out_data[idx] = (INT)value;
1061 return TRUE;
1063 default:
1064 FIXME("Unhandled in_type %#x.\n", in_type);
1065 return FALSE;
1069 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1071 switch (in_type)
1073 case D3D10_SVT_FLOAT:
1074 out_data[idx] = *(float *)&value;
1075 return TRUE;
1077 case D3D10_SVT_INT:
1078 case D3D10_SVT_UINT:
1079 case D3D10_SVT_BOOL:
1080 out_data[idx] = value;
1081 return TRUE;
1083 default:
1084 FIXME("Unhandled in_type %#x.\n", in_type);
1085 return FALSE;
1089 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1091 switch (in_type)
1093 case D3D10_SVT_INT:
1094 case D3D10_SVT_UINT:
1095 out_data[idx] = value;
1096 return TRUE;
1098 default:
1099 FIXME("Unhandled in_type %#x.\n", in_type);
1100 return FALSE;
1104 static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
1105 UINT out_base, UINT out_size, void *out_data)
1107 D3D_SHADER_VARIABLE_TYPE in_type;
1108 DWORD t, value;
1109 DWORD count, i;
1111 read_dword(&ptr, &count);
1112 if (count != out_size)
1113 return FALSE;
1115 TRACE("%u values:\n", count);
1116 for (i = 0; i < count; ++i)
1118 UINT out_idx = out_base * out_size + i;
1120 read_dword(&ptr, &t);
1121 read_dword(&ptr, &value);
1123 in_type = d3d10_variable_type(t, FALSE);
1124 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1126 switch (out_type)
1128 case D3D10_SVT_FLOAT:
1129 if (!read_float_value(value, in_type, out_data, out_idx))
1130 return FALSE;
1131 break;
1133 case D3D10_SVT_INT:
1134 case D3D10_SVT_UINT:
1135 case D3D10_SVT_BOOL:
1136 if (!read_int32_value(value, in_type, out_data, out_idx))
1137 return FALSE;
1138 break;
1140 case D3D10_SVT_UINT8:
1141 if (!read_int8_value(value, in_type, out_data, out_idx))
1142 return FALSE;
1143 break;
1145 default:
1146 FIXME("Unhandled out_type %#x.\n", out_type);
1147 return FALSE;
1151 return TRUE;
1154 static BOOL parse_fx10_state_group(const char **ptr, const char *data,
1155 D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1157 const struct d3d10_effect_state_property_info *property_info;
1158 UINT value_offset;
1159 unsigned int i;
1160 DWORD count;
1161 UINT idx;
1162 UINT id;
1164 read_dword(ptr, &count);
1165 TRACE("Property count: %#x.\n", count);
1167 for (i = 0; i < count; ++i)
1169 read_dword(ptr, &id);
1170 read_dword(ptr, &idx);
1171 skip_dword_unknown("read property", ptr, 1);
1172 read_dword(ptr, &value_offset);
1174 if (!(property_info = get_property_info(id)))
1176 FIXME("Failed to find property info for property %#x.\n", id);
1177 return FALSE;
1180 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1181 property_info->name, idx, value_offset);
1183 if (property_info->container_type != container_type)
1185 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1186 return FALSE;
1189 if (idx >= property_info->count)
1191 ERR("Invalid index %#x for property %#x.\n", idx, id);
1192 return FALSE;
1195 if (!read_value_list(data + value_offset, property_info->type, idx,
1196 property_info->size, (char *)container + property_info->offset))
1198 ERR("Failed to read values for property %#x.\n", id);
1199 return FALSE;
1203 return TRUE;
1206 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
1208 ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface;
1209 const char *data_ptr = NULL;
1210 DWORD offset;
1211 enum d3d10_effect_object_operation operation;
1212 HRESULT hr;
1213 struct d3d10_effect *effect = o->pass->technique->effect;
1214 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1215 DWORD tmp, variable_idx = 0;
1217 read_dword(ptr, &o->type);
1218 TRACE("Effect object is of type %#x.\n", o->type);
1220 read_dword(ptr, &tmp);
1221 TRACE("Effect object index %#x.\n", tmp);
1223 read_dword(ptr, &operation);
1224 TRACE("Effect object operation %#x.\n", operation);
1226 read_dword(ptr, &offset);
1227 TRACE("Effect object idx is at offset %#x.\n", offset);
1229 switch(operation)
1231 case D3D10_EOO_VALUE:
1232 TRACE("Copy variable values\n");
1234 switch (o->type)
1236 case D3D10_EOT_VERTEXSHADER:
1237 TRACE("Vertex shader\n");
1238 variable = &anonymous_vs.ID3D10EffectVariable_iface;
1239 break;
1241 case D3D10_EOT_PIXELSHADER:
1242 TRACE("Pixel shader\n");
1243 variable = &anonymous_ps.ID3D10EffectVariable_iface;
1244 break;
1246 case D3D10_EOT_GEOMETRYSHADER:
1247 TRACE("Geometry shader\n");
1248 variable = &anonymous_gs.ID3D10EffectVariable_iface;
1249 break;
1251 case D3D10_EOT_STENCIL_REF:
1252 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1254 ERR("Failed to read stencil ref.\n");
1255 return E_FAIL;
1257 break;
1259 case D3D10_EOT_SAMPLE_MASK:
1260 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1262 FIXME("Failed to read sample mask.\n");
1263 return E_FAIL;
1265 break;
1267 case D3D10_EOT_BLEND_FACTOR:
1268 if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1270 FIXME("Failed to read blend factor.\n");
1271 return E_FAIL;
1273 break;
1275 default:
1276 FIXME("Unhandled object type %#x\n", o->type);
1277 return E_FAIL;
1279 break;
1281 case D3D10_EOO_PARSED_OBJECT:
1282 /* This is a local object, we've parsed in parse_fx10_local_object. */
1283 TRACE("Variable name %s.\n", debugstr_a(data + offset));
1285 variable = e->lpVtbl->GetVariableByName(e, data + offset);
1286 break;
1288 case D3D10_EOO_PARSED_OBJECT_INDEX:
1289 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1290 data_ptr = data + offset;
1291 read_dword(&data_ptr, &offset);
1292 read_dword(&data_ptr, &variable_idx);
1293 TRACE("Variable name %s[%u].\n", debugstr_a(data + offset), variable_idx);
1295 variable = e->lpVtbl->GetVariableByName(e, data + offset);
1296 break;
1298 case D3D10_EOO_ANONYMOUS_SHADER:
1299 TRACE("Anonymous shader\n");
1301 /* check anonymous_shader_current for validity */
1302 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1304 ERR("Anonymous shader count is wrong!\n");
1305 return E_FAIL;
1308 data_ptr = data + offset;
1309 read_dword(&data_ptr, &offset);
1310 TRACE("Effect object starts at offset %#x.\n", offset);
1312 data_ptr = data + offset;
1314 hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type);
1315 if (FAILED(hr)) return hr;
1317 variable = &effect->anonymous_shaders[effect->anonymous_shader_current].shader.ID3D10EffectVariable_iface;
1318 ++effect->anonymous_shader_current;
1320 switch (o->type)
1322 case D3D10_EOT_VERTEXSHADER:
1323 case D3D10_EOT_PIXELSHADER:
1324 case D3D10_EOT_GEOMETRYSHADER:
1325 if (FAILED(hr = parse_shader(variable, data_ptr)))
1326 return hr;
1327 break;
1329 default:
1330 FIXME("Unhandled object type %#x\n", o->type);
1331 return E_FAIL;
1333 break;
1335 default:
1336 FIXME("Unhandled operation %#x.\n", operation);
1337 return E_FAIL;
1340 switch (o->type)
1342 case D3D10_EOT_RASTERIZER_STATE:
1344 ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
1345 if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
1346 return hr;
1347 break;
1350 case D3D10_EOT_DEPTH_STENCIL_STATE:
1352 ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable);
1353 if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds)))
1354 return hr;
1355 break;
1358 case D3D10_EOT_BLEND_STATE:
1360 ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
1361 if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
1362 return hr;
1363 break;
1366 case D3D10_EOT_VERTEXSHADER:
1368 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1369 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1370 return hr;
1371 o->pass->vs.pShaderVariable = sv;
1372 o->pass->vs.ShaderIndex = variable_idx;
1373 break;
1376 case D3D10_EOT_PIXELSHADER:
1378 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1379 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1380 return hr;
1381 o->pass->ps.pShaderVariable = sv;
1382 o->pass->ps.ShaderIndex = variable_idx;
1383 break;
1386 case D3D10_EOT_GEOMETRYSHADER:
1388 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1389 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1390 return hr;
1391 o->pass->gs.pShaderVariable = sv;
1392 o->pass->gs.ShaderIndex = variable_idx;
1393 break;
1396 case D3D10_EOT_STENCIL_REF:
1397 case D3D10_EOT_BLEND_FACTOR:
1398 case D3D10_EOT_SAMPLE_MASK:
1399 break;
1401 default:
1402 FIXME("Unhandled object type %#x.\n", o->type);
1403 return E_FAIL;
1406 return S_OK;
1409 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
1411 HRESULT hr = S_OK;
1412 unsigned int i;
1413 DWORD offset;
1415 read_dword(ptr, &offset);
1416 TRACE("Pass name at offset %#x.\n", offset);
1418 if (!copy_name(data + offset, &p->name))
1420 ERR("Failed to copy name.\n");
1421 return E_OUTOFMEMORY;
1423 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1425 read_dword(ptr, &p->object_count);
1426 TRACE("Pass has %u effect objects.\n", p->object_count);
1428 read_dword(ptr, &p->annotation_count);
1429 TRACE("Pass has %u annotations.\n", p->annotation_count);
1431 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
1432 if (!p->annotations)
1434 ERR("Failed to allocate pass annotations memory.\n");
1435 return E_OUTOFMEMORY;
1438 for (i = 0; i < p->annotation_count; ++i)
1440 struct d3d10_effect_variable *a = &p->annotations[i];
1442 a->effect = p->technique->effect;
1443 a->buffer = &null_local_buffer;
1445 hr = parse_fx10_annotation(a, ptr, data);
1446 if (FAILED(hr)) return hr;
1449 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
1450 if (!p->objects)
1452 ERR("Failed to allocate effect objects memory.\n");
1453 return E_OUTOFMEMORY;
1456 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1457 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1458 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1460 for (i = 0; i < p->object_count; ++i)
1462 struct d3d10_effect_object *o = &p->objects[i];
1464 o->pass = p;
1466 hr = parse_fx10_object(o, ptr, data);
1467 if (FAILED(hr)) return hr;
1470 return hr;
1473 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
1475 unsigned int i;
1476 DWORD offset;
1477 HRESULT hr;
1479 read_dword(ptr, &offset);
1480 TRACE("Technique name at offset %#x.\n", offset);
1482 if (!copy_name(data + offset, &t->name))
1484 ERR("Failed to copy name.\n");
1485 return E_OUTOFMEMORY;
1487 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1489 read_dword(ptr, &t->pass_count);
1490 TRACE("Technique has %u passes\n", t->pass_count);
1492 read_dword(ptr, &t->annotation_count);
1493 TRACE("Technique has %u annotations.\n", t->annotation_count);
1495 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
1496 if (!t->annotations)
1498 ERR("Failed to allocate technique annotations memory.\n");
1499 return E_OUTOFMEMORY;
1502 for (i = 0; i < t->annotation_count; ++i)
1504 struct d3d10_effect_variable *a = &t->annotations[i];
1506 a->effect = t->effect;
1507 a->buffer = &null_local_buffer;
1509 hr = parse_fx10_annotation(a, ptr, data);
1510 if (FAILED(hr)) return hr;
1513 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
1514 if (!t->passes)
1516 ERR("Failed to allocate passes memory\n");
1517 return E_OUTOFMEMORY;
1520 for (i = 0; i < t->pass_count; ++i)
1522 struct d3d10_effect_pass *p = &t->passes[i];
1524 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1525 p->technique = t;
1527 hr = parse_fx10_pass(p, ptr, data);
1528 if (FAILED(hr)) return hr;
1531 return S_OK;
1534 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1536 DWORD offset;
1537 unsigned int i;
1538 HRESULT hr;
1540 hr = parse_fx10_variable_head(v, ptr, data);
1541 if (FAILED(hr)) return hr;
1543 read_dword(ptr, &offset);
1544 TRACE("Variable semantic at offset %#x.\n", offset);
1546 if (!copy_name(data + offset, &v->semantic))
1548 ERR("Failed to copy semantic.\n");
1549 return E_OUTOFMEMORY;
1551 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1553 read_dword(ptr, &v->buffer_offset);
1554 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1556 skip_dword_unknown("variable", ptr, 1);
1558 read_dword(ptr, &v->flag);
1559 TRACE("Variable flag: %#x.\n", v->flag);
1561 read_dword(ptr, &v->annotation_count);
1562 TRACE("Variable has %u annotations.\n", v->annotation_count);
1564 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1565 if (!v->annotations)
1567 ERR("Failed to allocate variable annotations memory.\n");
1568 return E_OUTOFMEMORY;
1571 for (i = 0; i < v->annotation_count; ++i)
1573 struct d3d10_effect_variable *a = &v->annotations[i];
1575 a->effect = v->effect;
1576 a->buffer = &null_local_buffer;
1578 hr = parse_fx10_annotation(a, ptr, data);
1579 if (FAILED(hr)) return hr;
1582 return S_OK;
1585 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1587 ID3D10Device *device = v->effect->device;
1588 HRESULT hr;
1590 switch (v->type->basetype)
1592 case D3D10_SVT_DEPTHSTENCIL:
1593 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1594 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1595 return hr;
1596 break;
1598 case D3D10_SVT_BLEND:
1599 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1600 &v->u.state.desc.blend, &v->u.state.object.blend)))
1601 return hr;
1602 break;
1604 case D3D10_SVT_RASTERIZER:
1605 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1606 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1607 return hr;
1608 break;
1610 case D3D10_SVT_SAMPLER:
1611 if (FAILED(hr = ID3D10Device_CreateSamplerState(device,
1612 &v->u.state.desc.sampler, &v->u.state.object.sampler)))
1613 return hr;
1614 break;
1616 default:
1617 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1618 return E_FAIL;
1621 return S_OK;
1624 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1626 unsigned int i;
1627 HRESULT hr;
1628 DWORD offset;
1630 hr = parse_fx10_variable_head(v, ptr, data);
1631 if (FAILED(hr)) return hr;
1633 read_dword(ptr, &offset);
1634 TRACE("Variable semantic at offset %#x.\n", offset);
1636 if (!copy_name(data + offset, &v->semantic))
1638 ERR("Failed to copy semantic.\n");
1639 return E_OUTOFMEMORY;
1641 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1643 skip_dword_unknown("local variable", ptr, 1);
1645 switch (v->type->basetype)
1647 case D3D10_SVT_TEXTURE1D:
1648 case D3D10_SVT_TEXTURE1DARRAY:
1649 case D3D10_SVT_TEXTURE2D:
1650 case D3D10_SVT_TEXTURE2DARRAY:
1651 case D3D10_SVT_TEXTURE2DMS:
1652 case D3D10_SVT_TEXTURE2DMSARRAY:
1653 case D3D10_SVT_TEXTURE3D:
1654 case D3D10_SVT_TEXTURECUBE:
1655 case D3D10_SVT_RENDERTARGETVIEW:
1656 case D3D10_SVT_DEPTHSTENCILVIEW:
1657 case D3D10_SVT_BUFFER:
1658 TRACE("SVT could not have elements.\n");
1659 break;
1661 case D3D10_SVT_VERTEXSHADER:
1662 case D3D10_SVT_PIXELSHADER:
1663 case D3D10_SVT_GEOMETRYSHADER:
1664 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1665 for (i = 0; i < max(v->type->element_count, 1); ++i)
1667 DWORD shader_offset;
1668 struct d3d10_effect_variable *var;
1670 if (!v->type->element_count)
1672 var = v;
1674 else
1676 var = &v->elements[i];
1679 read_dword(ptr, &shader_offset);
1680 TRACE("Shader offset: %#x.\n", shader_offset);
1682 hr = parse_shader(&var->ID3D10EffectVariable_iface, data + shader_offset);
1683 if (FAILED(hr)) return hr;
1685 break;
1687 case D3D10_SVT_DEPTHSTENCIL:
1688 case D3D10_SVT_BLEND:
1689 case D3D10_SVT_RASTERIZER:
1690 case D3D10_SVT_SAMPLER:
1692 const struct d3d10_effect_state_storage_info *storage_info;
1693 unsigned int count = max(v->type->element_count, 1);
1695 if (!(storage_info = get_storage_info(v->type->basetype)))
1697 FIXME("Failed to get backing store info for type %s.\n",
1698 debug_d3d10_shader_variable_type(v->type->basetype));
1699 return E_FAIL;
1702 if (storage_info->size > sizeof(v->u.state.desc))
1704 ERR("Invalid storage size %#lx.\n", storage_info->size);
1705 return E_FAIL;
1708 for (i = 0; i < count; ++i)
1710 struct d3d10_effect_variable *var;
1712 if (v->type->element_count)
1713 var = &v->elements[i];
1714 else
1715 var = v;
1717 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1718 if (!parse_fx10_state_group(ptr, data, var->type->basetype, &var->u.state.desc))
1720 ERR("Failed to read property list.\n");
1721 return E_FAIL;
1724 if (FAILED(hr = create_state_object(v)))
1725 return hr;
1728 break;
1730 default:
1731 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1732 return E_FAIL;
1735 read_dword(ptr, &v->annotation_count);
1736 TRACE("Variable has %u annotations.\n", v->annotation_count);
1738 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1739 if (!v->annotations)
1741 ERR("Failed to allocate variable annotations memory.\n");
1742 return E_OUTOFMEMORY;
1745 for (i = 0; i < v->annotation_count; ++i)
1747 struct d3d10_effect_variable *a = &v->annotations[i];
1749 a->effect = v->effect;
1750 a->buffer = &null_local_buffer;
1752 hr = parse_fx10_annotation(a, ptr, data);
1753 if (FAILED(hr)) return hr;
1756 return S_OK;
1759 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1761 unsigned int i;
1762 DWORD offset;
1763 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1764 HRESULT hr;
1765 unsigned int stride = 0;
1767 /* Generate our own type, it isn't in the fx blob. */
1768 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1769 if (!l->type)
1771 ERR("Failed to allocate local buffer type memory.\n");
1772 return E_OUTOFMEMORY;
1774 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1775 l->type->type_class = D3D10_SVC_OBJECT;
1776 l->type->effect = l->effect;
1778 read_dword(ptr, &offset);
1779 TRACE("Local buffer name at offset %#x.\n", offset);
1781 if (!copy_name(data + offset, &l->name))
1783 ERR("Failed to copy name.\n");
1784 return E_OUTOFMEMORY;
1786 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1788 read_dword(ptr, &l->data_size);
1789 TRACE("Local buffer data size: %#x.\n", l->data_size);
1791 read_dword(ptr, &d3d10_cbuffer_type);
1792 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1794 switch(d3d10_cbuffer_type)
1796 case D3D10_CT_CBUFFER:
1797 l->type->basetype = D3D10_SVT_CBUFFER;
1798 if (!copy_name("cbuffer", &l->type->name))
1800 ERR("Failed to copy name.\n");
1801 return E_OUTOFMEMORY;
1803 break;
1805 case D3D10_CT_TBUFFER:
1806 l->type->basetype = D3D10_SVT_TBUFFER;
1807 if (!copy_name("tbuffer", &l->type->name))
1809 ERR("Failed to copy name.\n");
1810 return E_OUTOFMEMORY;
1812 break;
1814 default:
1815 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1816 return E_FAIL;
1819 read_dword(ptr, &l->type->member_count);
1820 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1822 skip_dword_unknown("local buffer", ptr, 1);
1824 read_dword(ptr, &l->annotation_count);
1825 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1827 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1828 if (!l->annotations)
1830 ERR("Failed to allocate local buffer annotations memory.\n");
1831 return E_OUTOFMEMORY;
1834 for (i = 0; i < l->annotation_count; ++i)
1836 struct d3d10_effect_variable *a = &l->annotations[i];
1838 a->effect = l->effect;
1839 a->buffer = &null_local_buffer;
1841 hr = parse_fx10_annotation(a, ptr, data);
1842 if (FAILED(hr)) return hr;
1845 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1846 if (!l->members)
1848 ERR("Failed to allocate members memory.\n");
1849 return E_OUTOFMEMORY;
1852 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1853 if (!l->type->members)
1855 ERR("Failed to allocate type members memory.\n");
1856 return E_OUTOFMEMORY;
1859 for (i = 0; i < l->type->member_count; ++i)
1861 struct d3d10_effect_variable *v = &l->members[i];
1862 struct d3d10_effect_type_member *typem = &l->type->members[i];
1864 v->buffer = l;
1865 v->effect = l->effect;
1867 hr = parse_fx10_variable(v, ptr, data);
1868 if (FAILED(hr)) return hr;
1871 * Copy the values from the variable type to the constant buffers type
1872 * members structure, because it is our own generated type.
1874 typem->type = v->type;
1876 if (!copy_name(v->name, &typem->name))
1878 ERR("Failed to copy name.\n");
1879 return E_OUTOFMEMORY;
1881 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1883 if (!copy_name(v->semantic, &typem->semantic))
1885 ERR("Failed to copy name.\n");
1886 return E_OUTOFMEMORY;
1888 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1890 typem->buffer_offset = v->buffer_offset;
1891 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1893 l->type->size_packed += v->type->size_packed;
1896 * For the complete constantbuffer the size_unpacked = stride,
1897 * the stride is calculated like this:
1899 * 1) if the constant buffer variables are packed with packoffset
1900 * - stride = the highest used constant
1901 * - the complete stride has to be a multiple of 0x10
1903 * 2) if the constant buffer variables are NOT packed with packoffset
1904 * - sum of unpacked size for all variables which fit in a 0x10 part
1905 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
1906 * and a new part is started
1907 * - if the variable is a struct it is always used a new part
1908 * - the complete stride has to be a multiple of 0x10
1910 * e.g.:
1911 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1912 * part 0x10 0x10 0x20 -> 0x40
1914 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1916 if ((v->type->size_unpacked + v->buffer_offset) > stride)
1918 stride = v->type->size_unpacked + v->buffer_offset;
1921 else
1923 if (v->type->type_class == D3D10_SVC_STRUCT)
1925 stride = (stride + 0xf) & ~0xf;
1928 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1930 stride = (stride + 0xf) & ~0xf;
1933 stride += v->type->size_unpacked;
1936 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1938 TRACE("Constant buffer:\n");
1939 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1940 TRACE("\tElement count: %u.\n", l->type->element_count);
1941 TRACE("\tMember count: %u.\n", l->type->member_count);
1942 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1943 TRACE("\tStride: %#x.\n", l->type->stride);
1944 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1945 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1946 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1948 return S_OK;
1951 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1953 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1954 const DWORD *id = key;
1956 return *id - t->id;
1959 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1961 TRACE("effect type member %p.\n", typem);
1963 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1964 HeapFree(GetProcessHeap(), 0, typem->semantic);
1965 HeapFree(GetProcessHeap(), 0, typem->name);
1968 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1970 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1972 TRACE("effect type %p.\n", t);
1974 if (t->elementtype)
1976 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1977 HeapFree(GetProcessHeap(), 0, t->elementtype);
1980 if (t->members)
1982 unsigned int i;
1984 for (i = 0; i < t->member_count; ++i)
1986 d3d10_effect_type_member_destroy(&t->members[i]);
1988 HeapFree(GetProcessHeap(), 0, t->members);
1991 HeapFree(GetProcessHeap(), 0, t->name);
1992 HeapFree(GetProcessHeap(), 0, t);
1995 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1997 d3d10_rb_alloc,
1998 d3d10_rb_realloc,
1999 d3d10_rb_free,
2000 d3d10_effect_type_compare,
2003 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
2005 const char *ptr = data + e->index_offset;
2006 unsigned int i;
2007 HRESULT hr;
2009 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
2011 ERR("Failed to initialize type rbtree.\n");
2012 return E_FAIL;
2015 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
2016 if (!e->local_buffers)
2018 ERR("Failed to allocate local buffer memory.\n");
2019 return E_OUTOFMEMORY;
2022 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
2023 if (!e->local_variables)
2025 ERR("Failed to allocate local variable memory.\n");
2026 return E_OUTOFMEMORY;
2029 e->anonymous_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->anonymous_shader_count * sizeof(*e->anonymous_shaders));
2030 if (!e->anonymous_shaders)
2032 ERR("Failed to allocate anonymous shaders memory\n");
2033 return E_OUTOFMEMORY;
2036 e->used_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->used_shader_count * sizeof(*e->used_shaders));
2037 if (!e->used_shaders)
2039 ERR("Failed to allocate used shaders memory\n");
2040 return E_OUTOFMEMORY;
2043 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
2044 if (!e->techniques)
2046 ERR("Failed to allocate techniques memory\n");
2047 return E_OUTOFMEMORY;
2050 for (i = 0; i < e->local_buffer_count; ++i)
2052 struct d3d10_effect_variable *l = &e->local_buffers[i];
2053 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2054 l->effect = e;
2055 l->buffer = &null_local_buffer;
2057 hr = parse_fx10_local_buffer(l, &ptr, data);
2058 if (FAILED(hr)) return hr;
2061 for (i = 0; i < e->local_variable_count; ++i)
2063 struct d3d10_effect_variable *v = &e->local_variables[i];
2065 v->effect = e;
2066 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2067 v->buffer = &null_local_buffer;
2069 hr = parse_fx10_local_variable(v, &ptr, data);
2070 if (FAILED(hr)) return hr;
2073 for (i = 0; i < e->technique_count; ++i)
2075 struct d3d10_effect_technique *t = &e->techniques[i];
2077 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2078 t->effect = e;
2080 hr = parse_fx10_technique(t, &ptr, data);
2081 if (FAILED(hr)) return hr;
2084 return S_OK;
2087 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2089 const char *ptr = data;
2090 DWORD unknown;
2092 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2093 read_dword(&ptr, &e->version);
2094 TRACE("Target: %#x\n", e->version);
2096 read_dword(&ptr, &e->local_buffer_count);
2097 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2099 read_dword(&ptr, &e->variable_count);
2100 TRACE("Variable count: %u\n", e->variable_count);
2102 read_dword(&ptr, &e->local_variable_count);
2103 TRACE("Object count: %u\n", e->local_variable_count);
2105 read_dword(&ptr, &e->sharedbuffers_count);
2106 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2108 /* Number of variables in shared buffers? */
2109 read_dword(&ptr, &unknown);
2110 FIXME("Unknown 0: %u\n", unknown);
2112 read_dword(&ptr, &e->sharedobjects_count);
2113 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2115 read_dword(&ptr, &e->technique_count);
2116 TRACE("Technique count: %u\n", e->technique_count);
2118 read_dword(&ptr, &e->index_offset);
2119 TRACE("Index offset: %#x\n", e->index_offset);
2121 read_dword(&ptr, &unknown);
2122 FIXME("Unknown 1: %u\n", unknown);
2124 read_dword(&ptr, &e->texture_count);
2125 TRACE("Texture count: %u\n", e->texture_count);
2127 read_dword(&ptr, &e->dephstencilstate_count);
2128 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2130 read_dword(&ptr, &e->blendstate_count);
2131 TRACE("Blendstate count: %u\n", e->blendstate_count);
2133 read_dword(&ptr, &e->rasterizerstate_count);
2134 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2136 read_dword(&ptr, &e->samplerstate_count);
2137 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2139 read_dword(&ptr, &e->rendertargetview_count);
2140 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2142 read_dword(&ptr, &e->depthstencilview_count);
2143 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2145 read_dword(&ptr, &e->used_shader_count);
2146 TRACE("Used shader count: %u\n", e->used_shader_count);
2148 read_dword(&ptr, &e->anonymous_shader_count);
2149 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2151 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2154 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2156 struct d3d10_effect *e = ctx;
2158 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2160 TRACE("chunk size: %#x\n", data_size);
2162 switch(tag)
2164 case TAG_FX10:
2165 return parse_fx10(e, data, data_size);
2167 default:
2168 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2169 return S_OK;
2173 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2175 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2178 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2180 ID3D10Device *device = o->pass->technique->effect->device;
2182 TRACE("effect object %p, type %#x.\n", o, o->type);
2184 switch(o->type)
2186 case D3D10_EOT_RASTERIZER_STATE:
2187 ID3D10Device_RSSetState(device, o->object.rs);
2188 return S_OK;
2190 case D3D10_EOT_DEPTH_STENCIL_STATE:
2191 ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
2192 return S_OK;
2194 case D3D10_EOT_BLEND_STATE:
2195 ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
2196 return S_OK;
2198 case D3D10_EOT_VERTEXSHADER:
2199 ID3D10Device_VSSetShader(device, o->object.vs);
2200 return S_OK;
2202 case D3D10_EOT_PIXELSHADER:
2203 ID3D10Device_PSSetShader(device, o->object.ps);
2204 return S_OK;
2206 case D3D10_EOT_GEOMETRYSHADER:
2207 ID3D10Device_GSSetShader(device, o->object.gs);
2208 return S_OK;
2210 case D3D10_EOT_STENCIL_REF:
2211 case D3D10_EOT_BLEND_FACTOR:
2212 case D3D10_EOT_SAMPLE_MASK:
2213 return S_OK;
2215 default:
2216 FIXME("Unhandled effect object type %#x.\n", o->type);
2217 return E_FAIL;
2221 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2222 D3D10_SHADER_VARIABLE_TYPE type)
2224 shader_free_signature(&s->input_signature);
2225 shader_free_signature(&s->output_signature);
2227 switch (type)
2229 case D3D10_SVT_VERTEXSHADER:
2230 if (s->shader.vs)
2231 ID3D10VertexShader_Release(s->shader.vs);
2232 break;
2234 case D3D10_SVT_PIXELSHADER:
2235 if (s->shader.ps)
2236 ID3D10PixelShader_Release(s->shader.ps);
2237 break;
2239 case D3D10_SVT_GEOMETRYSHADER:
2240 if (s->shader.gs)
2241 ID3D10GeometryShader_Release(s->shader.gs);
2242 break;
2244 default:
2245 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2246 break;
2250 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2252 unsigned int i;
2254 TRACE("variable %p.\n", v);
2256 HeapFree(GetProcessHeap(), 0, v->name);
2257 HeapFree(GetProcessHeap(), 0, v->semantic);
2258 if (v->annotations)
2260 for (i = 0; i < v->annotation_count; ++i)
2262 d3d10_effect_variable_destroy(&v->annotations[i]);
2264 HeapFree(GetProcessHeap(), 0, v->annotations);
2267 if (v->members)
2269 for (i = 0; i < v->type->member_count; ++i)
2271 d3d10_effect_variable_destroy(&v->members[i]);
2273 HeapFree(GetProcessHeap(), 0, v->members);
2276 if (v->elements)
2278 for (i = 0; i < v->type->element_count; ++i)
2280 d3d10_effect_variable_destroy(&v->elements[i]);
2282 HeapFree(GetProcessHeap(), 0, v->elements);
2285 switch(v->type->basetype)
2287 case D3D10_SVT_VERTEXSHADER:
2288 case D3D10_SVT_PIXELSHADER:
2289 case D3D10_SVT_GEOMETRYSHADER:
2290 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2291 break;
2293 default:
2294 break;
2298 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2300 switch (o->type)
2302 case D3D10_EOT_RASTERIZER_STATE:
2303 if (o->object.rs)
2304 ID3D10RasterizerState_Release(o->object.rs);
2305 break;
2307 case D3D10_EOT_DEPTH_STENCIL_STATE:
2308 if (o->object.ds)
2309 ID3D10DepthStencilState_Release(o->object.ds);
2310 break;
2312 case D3D10_EOT_BLEND_STATE:
2313 if (o->object.bs)
2314 ID3D10BlendState_Release(o->object.bs);
2315 break;
2317 case D3D10_EOT_VERTEXSHADER:
2318 if (o->object.vs)
2319 ID3D10VertexShader_Release(o->object.vs);
2320 break;
2322 case D3D10_EOT_PIXELSHADER:
2323 if (o->object.ps)
2324 ID3D10PixelShader_Release(o->object.ps);
2325 break;
2327 case D3D10_EOT_GEOMETRYSHADER:
2328 if (o->object.gs)
2329 ID3D10GeometryShader_Release(o->object.gs);
2330 break;
2332 default:
2333 break;
2337 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2339 unsigned int i;
2341 TRACE("pass %p\n", p);
2343 HeapFree(GetProcessHeap(), 0, p->name);
2345 if (p->objects)
2347 for (i = 0; i < p->object_count; ++i)
2349 d3d10_effect_object_destroy(&p->objects[i]);
2351 HeapFree(GetProcessHeap(), 0, p->objects);
2354 if (p->annotations)
2356 for (i = 0; i < p->annotation_count; ++i)
2358 d3d10_effect_variable_destroy(&p->annotations[i]);
2360 HeapFree(GetProcessHeap(), 0, p->annotations);
2364 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2366 unsigned int i;
2368 TRACE("technique %p\n", t);
2370 HeapFree(GetProcessHeap(), 0, t->name);
2371 if (t->passes)
2373 for (i = 0; i < t->pass_count; ++i)
2375 d3d10_effect_pass_destroy(&t->passes[i]);
2377 HeapFree(GetProcessHeap(), 0, t->passes);
2380 if (t->annotations)
2382 for (i = 0; i < t->annotation_count; ++i)
2384 d3d10_effect_variable_destroy(&t->annotations[i]);
2386 HeapFree(GetProcessHeap(), 0, t->annotations);
2390 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2392 unsigned int i;
2394 TRACE("local buffer %p.\n", l);
2396 HeapFree(GetProcessHeap(), 0, l->name);
2397 if (l->members)
2399 for (i = 0; i < l->type->member_count; ++i)
2401 d3d10_effect_variable_destroy(&l->members[i]);
2403 HeapFree(GetProcessHeap(), 0, l->members);
2406 if (l->type->members)
2408 for (i = 0; i < l->type->member_count; ++i)
2410 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2411 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2412 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2414 HeapFree(GetProcessHeap(), 0, l->type->members);
2416 HeapFree(GetProcessHeap(), 0, l->type->name);
2417 HeapFree(GetProcessHeap(), 0, l->type);
2419 if (l->annotations)
2421 for (i = 0; i < l->annotation_count; ++i)
2423 d3d10_effect_variable_destroy(&l->annotations[i]);
2425 HeapFree(GetProcessHeap(), 0, l->annotations);
2429 /* IUnknown methods */
2431 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2433 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2436 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2438 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2440 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2441 || IsEqualGUID(riid, &IID_IUnknown))
2443 IUnknown_AddRef(iface);
2444 *object = iface;
2445 return S_OK;
2448 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2450 *object = NULL;
2451 return E_NOINTERFACE;
2454 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2456 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2457 ULONG refcount = InterlockedIncrement(&This->refcount);
2459 TRACE("%p increasing refcount to %u\n", This, refcount);
2461 return refcount;
2464 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2466 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2467 ULONG refcount = InterlockedDecrement(&This->refcount);
2469 TRACE("%p decreasing refcount to %u\n", This, refcount);
2471 if (!refcount)
2473 unsigned int i;
2475 if (This->techniques)
2477 for (i = 0; i < This->technique_count; ++i)
2479 d3d10_effect_technique_destroy(&This->techniques[i]);
2481 HeapFree(GetProcessHeap(), 0, This->techniques);
2484 if (This->local_variables)
2486 for (i = 0; i < This->local_variable_count; ++i)
2488 d3d10_effect_variable_destroy(&This->local_variables[i]);
2490 HeapFree(GetProcessHeap(), 0, This->local_variables);
2493 if (This->local_buffers)
2495 for (i = 0; i < This->local_buffer_count; ++i)
2497 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2499 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2502 if (This->anonymous_shaders)
2504 for (i = 0; i < This->anonymous_shader_count; ++i)
2506 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2507 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2509 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2512 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2514 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2516 ID3D10Device_Release(This->device);
2517 HeapFree(GetProcessHeap(), 0, This);
2520 return refcount;
2523 /* ID3D10Effect methods */
2525 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2527 FIXME("iface %p stub!\n", iface);
2529 return FALSE;
2532 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2534 FIXME("iface %p stub!\n", iface);
2536 return FALSE;
2539 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2541 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2543 TRACE("iface %p, device %p\n", iface, device);
2545 ID3D10Device_AddRef(This->device);
2546 *device = This->device;
2548 return S_OK;
2551 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2553 FIXME("iface %p, desc %p stub!\n", iface, desc);
2555 return E_NOTIMPL;
2558 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2559 UINT index)
2561 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2562 struct d3d10_effect_variable *l;
2564 TRACE("iface %p, index %u\n", iface, index);
2566 if (index >= This->local_buffer_count)
2568 WARN("Invalid index specified\n");
2569 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2572 l = &This->local_buffers[index];
2574 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2576 return (ID3D10EffectConstantBuffer *)l;
2579 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2580 const char *name)
2582 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2583 unsigned int i;
2585 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2587 for (i = 0; i < This->local_buffer_count; ++i)
2589 struct d3d10_effect_variable *l = &This->local_buffers[i];
2591 if (!strcmp(l->name, name))
2593 TRACE("Returning buffer %p.\n", l);
2594 return (ID3D10EffectConstantBuffer *)l;
2598 WARN("Invalid name specified\n");
2600 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2603 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2605 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2606 unsigned int i;
2608 TRACE("iface %p, index %u\n", iface, index);
2610 for (i = 0; i < This->local_buffer_count; ++i)
2612 struct d3d10_effect_variable *l = &This->local_buffers[i];
2614 if (index < l->type->member_count)
2616 struct d3d10_effect_variable *v = &l->members[index];
2618 TRACE("Returning variable %p.\n", v);
2619 return &v->ID3D10EffectVariable_iface;
2621 index -= l->type->member_count;
2624 if (index < This->local_variable_count)
2626 struct d3d10_effect_variable *v = &This->local_variables[index];
2628 TRACE("Returning variable %p.\n", v);
2629 return &v->ID3D10EffectVariable_iface;
2632 WARN("Invalid index specified\n");
2634 return &null_variable.ID3D10EffectVariable_iface;
2637 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface,
2638 const char *name)
2640 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2641 unsigned int i;
2643 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2645 if (!name)
2647 WARN("Invalid name specified\n");
2648 return &null_variable.ID3D10EffectVariable_iface;
2651 for (i = 0; i < This->local_buffer_count; ++i)
2653 struct d3d10_effect_variable *l = &This->local_buffers[i];
2654 unsigned int j;
2656 for (j = 0; j < l->type->member_count; ++j)
2658 struct d3d10_effect_variable *v = &l->members[j];
2660 if (!strcmp(v->name, name))
2662 TRACE("Returning variable %p.\n", v);
2663 return &v->ID3D10EffectVariable_iface;
2668 for (i = 0; i < This->local_variable_count; ++i)
2670 struct d3d10_effect_variable *v = &This->local_variables[i];
2672 if (!strcmp(v->name, name))
2674 TRACE("Returning variable %p.\n", v);
2675 return &v->ID3D10EffectVariable_iface;
2679 WARN("Invalid name specified\n");
2681 return &null_variable.ID3D10EffectVariable_iface;
2684 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2685 const char *semantic)
2687 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2688 unsigned int i;
2690 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2692 if (!semantic)
2694 WARN("Invalid semantic specified\n");
2695 return &null_variable.ID3D10EffectVariable_iface;
2698 for (i = 0; i < This->local_buffer_count; ++i)
2700 struct d3d10_effect_variable *l = &This->local_buffers[i];
2701 unsigned int j;
2703 for (j = 0; j < l->type->member_count; ++j)
2705 struct d3d10_effect_variable *v = &l->members[j];
2707 if (!strcmp(v->semantic, semantic))
2709 TRACE("Returning variable %p.\n", v);
2710 return &v->ID3D10EffectVariable_iface;
2715 for (i = 0; i < This->local_variable_count; ++i)
2717 struct d3d10_effect_variable *v = &This->local_variables[i];
2719 if (!strcmp(v->semantic, semantic))
2721 TRACE("Returning variable %p.\n", v);
2722 return &v->ID3D10EffectVariable_iface;
2726 WARN("Invalid semantic specified\n");
2728 return &null_variable.ID3D10EffectVariable_iface;
2731 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2732 UINT index)
2734 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2735 struct d3d10_effect_technique *t;
2737 TRACE("iface %p, index %u\n", iface, index);
2739 if (index >= This->technique_count)
2741 WARN("Invalid index specified\n");
2742 return &null_technique.ID3D10EffectTechnique_iface;
2745 t = &This->techniques[index];
2747 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2749 return &t->ID3D10EffectTechnique_iface;
2752 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2753 const char *name)
2755 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2756 unsigned int i;
2758 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2760 if (!name)
2762 WARN("Invalid name specified\n");
2763 return &null_technique.ID3D10EffectTechnique_iface;
2766 for (i = 0; i < This->technique_count; ++i)
2768 struct d3d10_effect_technique *t = &This->techniques[i];
2769 if (!strcmp(t->name, name))
2771 TRACE("Returning technique %p\n", t);
2772 return &t->ID3D10EffectTechnique_iface;
2776 WARN("Invalid name specified\n");
2778 return &null_technique.ID3D10EffectTechnique_iface;
2781 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2783 FIXME("iface %p stub!\n", iface);
2785 return E_NOTIMPL;
2788 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2790 FIXME("iface %p stub!\n", iface);
2792 return FALSE;
2795 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2797 /* IUnknown methods */
2798 d3d10_effect_QueryInterface,
2799 d3d10_effect_AddRef,
2800 d3d10_effect_Release,
2801 /* ID3D10Effect methods */
2802 d3d10_effect_IsValid,
2803 d3d10_effect_IsPool,
2804 d3d10_effect_GetDevice,
2805 d3d10_effect_GetDesc,
2806 d3d10_effect_GetConstantBufferByIndex,
2807 d3d10_effect_GetConstantBufferByName,
2808 d3d10_effect_GetVariableByIndex,
2809 d3d10_effect_GetVariableByName,
2810 d3d10_effect_GetVariableBySemantic,
2811 d3d10_effect_GetTechniqueByIndex,
2812 d3d10_effect_GetTechniqueByName,
2813 d3d10_effect_Optimize,
2814 d3d10_effect_IsOptimized,
2817 /* ID3D10EffectTechnique methods */
2819 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2821 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2824 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2826 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2828 TRACE("iface %p\n", iface);
2830 return This != &null_technique;
2833 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2834 D3D10_TECHNIQUE_DESC *desc)
2836 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2838 TRACE("iface %p, desc %p\n", iface, desc);
2840 if(This == &null_technique)
2842 WARN("Null technique specified\n");
2843 return E_FAIL;
2846 if(!desc)
2848 WARN("Invalid argument specified\n");
2849 return E_INVALIDARG;
2852 desc->Name = This->name;
2853 desc->Passes = This->pass_count;
2854 desc->Annotations = This->annotation_count;
2856 return S_OK;
2859 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2860 ID3D10EffectTechnique *iface, UINT index)
2862 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2863 struct d3d10_effect_variable *a;
2865 TRACE("iface %p, index %u\n", iface, index);
2867 if (index >= This->annotation_count)
2869 WARN("Invalid index specified\n");
2870 return &null_variable.ID3D10EffectVariable_iface;
2873 a = &This->annotations[index];
2875 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2877 return &a->ID3D10EffectVariable_iface;
2880 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2881 ID3D10EffectTechnique *iface, const char *name)
2883 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2884 unsigned int i;
2886 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2888 for (i = 0; i < This->annotation_count; ++i)
2890 struct d3d10_effect_variable *a = &This->annotations[i];
2891 if (!strcmp(a->name, name))
2893 TRACE("Returning annotation %p\n", a);
2894 return &a->ID3D10EffectVariable_iface;
2898 WARN("Invalid name specified\n");
2900 return &null_variable.ID3D10EffectVariable_iface;
2903 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2904 UINT index)
2906 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2907 struct d3d10_effect_pass *p;
2909 TRACE("iface %p, index %u\n", iface, index);
2911 if (index >= This->pass_count)
2913 WARN("Invalid index specified\n");
2914 return &null_pass.ID3D10EffectPass_iface;
2917 p = &This->passes[index];
2919 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2921 return &p->ID3D10EffectPass_iface;
2924 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2925 const char *name)
2927 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2928 unsigned int i;
2930 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2932 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2934 for (i = 0; i < This->pass_count; ++i)
2936 struct d3d10_effect_pass *p = &This->passes[i];
2937 if (!strcmp(p->name, name))
2939 TRACE("Returning pass %p\n", p);
2940 return &p->ID3D10EffectPass_iface;
2944 WARN("Invalid name specified\n");
2946 return &null_pass.ID3D10EffectPass_iface;
2949 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2950 D3D10_STATE_BLOCK_MASK *mask)
2952 FIXME("iface %p,mask %p stub!\n", iface, mask);
2954 return E_NOTIMPL;
2957 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2959 /* ID3D10EffectTechnique methods */
2960 d3d10_effect_technique_IsValid,
2961 d3d10_effect_technique_GetDesc,
2962 d3d10_effect_technique_GetAnnotationByIndex,
2963 d3d10_effect_technique_GetAnnotationByName,
2964 d3d10_effect_technique_GetPassByIndex,
2965 d3d10_effect_technique_GetPassByName,
2966 d3d10_effect_technique_ComputeStateBlockMask,
2969 /* ID3D10EffectPass methods */
2971 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2973 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2976 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2978 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2980 TRACE("iface %p\n", iface);
2982 return This != &null_pass;
2985 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
2986 D3D10_PASS_DESC *desc)
2988 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2989 struct d3d10_effect_shader_variable *s;
2991 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2993 if(This == &null_pass)
2995 WARN("Null pass specified\n");
2996 return E_FAIL;
2999 if(!desc)
3001 WARN("Invalid argument specified\n");
3002 return E_INVALIDARG;
3005 memset(desc, 0, sizeof(*desc));
3006 desc->Name = This->name;
3008 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3009 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3010 desc->IAInputSignatureSize = s->input_signature.signature_size;
3012 desc->StencilRef = This->stencil_ref;
3013 desc->SampleMask = This->sample_mask;
3014 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3016 return S_OK;
3019 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3020 D3D10_PASS_SHADER_DESC *desc)
3022 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3024 TRACE("iface %p, desc %p\n", iface, desc);
3026 if (This == &null_pass)
3028 WARN("Null pass specified\n");
3029 return E_FAIL;
3032 if (!desc)
3034 WARN("Invalid argument specified\n");
3035 return E_INVALIDARG;
3038 *desc = This->vs;
3040 return S_OK;
3043 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3044 D3D10_PASS_SHADER_DESC *desc)
3046 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3048 TRACE("iface %p, desc %p\n", iface, desc);
3050 if (This == &null_pass)
3052 WARN("Null pass specified\n");
3053 return E_FAIL;
3056 if (!desc)
3058 WARN("Invalid argument specified\n");
3059 return E_INVALIDARG;
3062 *desc = This->gs;
3064 return S_OK;
3067 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3068 D3D10_PASS_SHADER_DESC *desc)
3070 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3072 TRACE("iface %p, desc %p\n", iface, desc);
3074 if (This == &null_pass)
3076 WARN("Null pass specified\n");
3077 return E_FAIL;
3080 if (!desc)
3082 WARN("Invalid argument specified\n");
3083 return E_INVALIDARG;
3086 *desc = This->ps;
3088 return S_OK;
3091 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3092 UINT index)
3094 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3095 struct d3d10_effect_variable *a;
3097 TRACE("iface %p, index %u\n", iface, index);
3099 if (index >= This->annotation_count)
3101 WARN("Invalid index specified\n");
3102 return &null_variable.ID3D10EffectVariable_iface;
3105 a = &This->annotations[index];
3107 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3109 return &a->ID3D10EffectVariable_iface;
3112 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3113 const char *name)
3115 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3116 unsigned int i;
3118 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3120 for (i = 0; i < This->annotation_count; ++i)
3122 struct d3d10_effect_variable *a = &This->annotations[i];
3123 if (!strcmp(a->name, name))
3125 TRACE("Returning annotation %p\n", a);
3126 return &a->ID3D10EffectVariable_iface;
3130 WARN("Invalid name specified\n");
3132 return &null_variable.ID3D10EffectVariable_iface;
3135 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3137 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3138 HRESULT hr = S_OK;
3139 unsigned int i;
3141 TRACE("iface %p, flags %#x\n", iface, flags);
3143 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3145 for (i = 0; i < This->object_count; ++i)
3147 hr = d3d10_effect_object_apply(&This->objects[i]);
3148 if (FAILED(hr)) break;
3151 return hr;
3154 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3155 D3D10_STATE_BLOCK_MASK *mask)
3157 FIXME("iface %p, mask %p stub!\n", iface, mask);
3159 return E_NOTIMPL;
3162 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3164 /* ID3D10EffectPass methods */
3165 d3d10_effect_pass_IsValid,
3166 d3d10_effect_pass_GetDesc,
3167 d3d10_effect_pass_GetVertexShaderDesc,
3168 d3d10_effect_pass_GetGeometryShaderDesc,
3169 d3d10_effect_pass_GetPixelShaderDesc,
3170 d3d10_effect_pass_GetAnnotationByIndex,
3171 d3d10_effect_pass_GetAnnotationByName,
3172 d3d10_effect_pass_Apply,
3173 d3d10_effect_pass_ComputeStateBlockMask,
3176 /* ID3D10EffectVariable methods */
3178 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3180 TRACE("iface %p\n", iface);
3182 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3185 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3187 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3189 TRACE("iface %p\n", iface);
3191 return &This->type->ID3D10EffectType_iface;
3194 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3195 D3D10_EFFECT_VARIABLE_DESC *desc)
3197 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3199 TRACE("iface %p, desc %p\n", iface, desc);
3201 if (!iface->lpVtbl->IsValid(iface))
3203 WARN("Null variable specified\n");
3204 return E_FAIL;
3207 if (!desc)
3209 WARN("Invalid argument specified\n");
3210 return E_INVALIDARG;
3213 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3214 memset(desc, 0, sizeof(*desc));
3215 desc->Name = This->name;
3216 desc->Semantic = This->semantic;
3217 desc->Flags = This->flag;
3218 desc->Annotations = This->annotation_count;
3219 desc->BufferOffset = This->buffer_offset;
3221 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3223 desc->ExplicitBindPoint = This->buffer_offset;
3226 return S_OK;
3229 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3230 ID3D10EffectVariable *iface, UINT index)
3232 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3233 struct d3d10_effect_variable *a;
3235 TRACE("iface %p, index %u\n", iface, index);
3237 if (index >= This->annotation_count)
3239 WARN("Invalid index specified\n");
3240 return &null_variable.ID3D10EffectVariable_iface;
3243 a = &This->annotations[index];
3245 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3247 return &a->ID3D10EffectVariable_iface;
3250 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3251 ID3D10EffectVariable *iface, const char *name)
3253 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3254 unsigned int i;
3256 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3258 for (i = 0; i < This->annotation_count; ++i)
3260 struct d3d10_effect_variable *a = &This->annotations[i];
3261 if (!strcmp(a->name, name))
3263 TRACE("Returning annotation %p\n", a);
3264 return &a->ID3D10EffectVariable_iface;
3268 WARN("Invalid name specified\n");
3270 return &null_variable.ID3D10EffectVariable_iface;
3273 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3274 ID3D10EffectVariable *iface, UINT index)
3276 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3277 struct d3d10_effect_variable *m;
3279 TRACE("iface %p, index %u\n", iface, index);
3281 if (index >= This->type->member_count)
3283 WARN("Invalid index specified\n");
3284 return &null_variable.ID3D10EffectVariable_iface;
3287 m = &This->members[index];
3289 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3291 return &m->ID3D10EffectVariable_iface;
3294 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3295 ID3D10EffectVariable *iface, const char *name)
3297 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3298 unsigned int i;
3300 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3302 if (!name)
3304 WARN("Invalid name specified\n");
3305 return &null_variable.ID3D10EffectVariable_iface;
3308 for (i = 0; i < This->type->member_count; ++i)
3310 struct d3d10_effect_variable *m = &This->members[i];
3312 if (m->name)
3314 if (!strcmp(m->name, name))
3316 TRACE("Returning member %p\n", m);
3317 return &m->ID3D10EffectVariable_iface;
3322 WARN("Invalid name specified\n");
3324 return &null_variable.ID3D10EffectVariable_iface;
3327 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3328 ID3D10EffectVariable *iface, const char *semantic)
3330 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3331 unsigned int i;
3333 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3335 if (!semantic)
3337 WARN("Invalid semantic specified\n");
3338 return &null_variable.ID3D10EffectVariable_iface;
3341 for (i = 0; i < This->type->member_count; ++i)
3343 struct d3d10_effect_variable *m = &This->members[i];
3345 if (m->semantic)
3347 if (!strcmp(m->semantic, semantic))
3349 TRACE("Returning member %p\n", m);
3350 return &m->ID3D10EffectVariable_iface;
3355 WARN("Invalid semantic specified\n");
3357 return &null_variable.ID3D10EffectVariable_iface;
3360 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3361 ID3D10EffectVariable *iface, UINT index)
3363 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3364 struct d3d10_effect_variable *v;
3366 TRACE("iface %p, index %u\n", iface, index);
3368 if (index >= This->type->element_count)
3370 WARN("Invalid index specified\n");
3371 return &null_variable.ID3D10EffectVariable_iface;
3374 v = &This->elements[index];
3376 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3378 return &v->ID3D10EffectVariable_iface;
3381 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3382 ID3D10EffectVariable *iface)
3384 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3386 TRACE("iface %p\n", iface);
3388 return (ID3D10EffectConstantBuffer *)This->buffer;
3391 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3392 ID3D10EffectVariable *iface)
3394 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3396 TRACE("iface %p\n", iface);
3398 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3399 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3401 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3404 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3405 ID3D10EffectVariable *iface)
3407 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3409 TRACE("iface %p\n", iface);
3411 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3412 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3414 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3417 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3418 ID3D10EffectVariable *iface)
3420 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3422 TRACE("iface %p\n", iface);
3424 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3425 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3427 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3430 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3431 ID3D10EffectVariable *iface)
3433 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3435 TRACE("iface %p\n", iface);
3437 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3438 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3440 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3443 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3444 ID3D10EffectVariable *iface)
3446 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3448 TRACE("iface %p\n", iface);
3450 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3451 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3453 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3456 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3457 ID3D10EffectVariable *iface)
3459 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3461 TRACE("iface %p\n", iface);
3463 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3464 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3466 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3469 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3470 ID3D10EffectVariable *iface)
3472 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3474 TRACE("iface %p\n", iface);
3476 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3477 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3479 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3482 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3483 ID3D10EffectVariable *iface)
3485 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3487 TRACE("iface %p\n", iface);
3489 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3490 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3492 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3495 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3496 ID3D10EffectVariable *iface)
3498 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3500 TRACE("iface %p\n", iface);
3502 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3503 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3505 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3508 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3510 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3512 TRACE("iface %p\n", iface);
3514 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3515 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3517 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3520 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3521 ID3D10EffectVariable *iface)
3523 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3525 TRACE("iface %p\n", iface);
3527 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3528 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3530 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3533 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3534 ID3D10EffectVariable *iface)
3536 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3538 TRACE("iface %p\n", iface);
3540 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3541 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3543 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3546 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3547 ID3D10EffectVariable *iface)
3549 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3551 TRACE("iface %p\n", iface);
3553 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3554 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3556 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3559 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3560 void *data, UINT offset, UINT count)
3562 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3564 return E_NOTIMPL;
3567 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3568 void *data, UINT offset, UINT count)
3570 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3572 return E_NOTIMPL;
3575 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3577 /* ID3D10EffectVariable methods */
3578 d3d10_effect_variable_IsValid,
3579 d3d10_effect_variable_GetType,
3580 d3d10_effect_variable_GetDesc,
3581 d3d10_effect_variable_GetAnnotationByIndex,
3582 d3d10_effect_variable_GetAnnotationByName,
3583 d3d10_effect_variable_GetMemberByIndex,
3584 d3d10_effect_variable_GetMemberByName,
3585 d3d10_effect_variable_GetMemberBySemantic,
3586 d3d10_effect_variable_GetElement,
3587 d3d10_effect_variable_GetParentConstantBuffer,
3588 d3d10_effect_variable_AsScalar,
3589 d3d10_effect_variable_AsVector,
3590 d3d10_effect_variable_AsMatrix,
3591 d3d10_effect_variable_AsString,
3592 d3d10_effect_variable_AsShaderResource,
3593 d3d10_effect_variable_AsRenderTargetView,
3594 d3d10_effect_variable_AsDepthStencilView,
3595 d3d10_effect_variable_AsConstantBuffer,
3596 d3d10_effect_variable_AsShader,
3597 d3d10_effect_variable_AsBlend,
3598 d3d10_effect_variable_AsDepthStencil,
3599 d3d10_effect_variable_AsRasterizer,
3600 d3d10_effect_variable_AsSampler,
3601 d3d10_effect_variable_SetRawValue,
3602 d3d10_effect_variable_GetRawValue,
3605 /* ID3D10EffectVariable methods */
3606 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3608 TRACE("iface %p\n", iface);
3610 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3613 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3615 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3618 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3619 D3D10_EFFECT_VARIABLE_DESC *desc)
3621 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3624 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3625 ID3D10EffectConstantBuffer *iface, UINT index)
3627 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3630 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3631 ID3D10EffectConstantBuffer *iface, const char *name)
3633 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3636 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3637 ID3D10EffectConstantBuffer *iface, UINT index)
3639 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3642 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3643 ID3D10EffectConstantBuffer *iface, const char *name)
3645 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3648 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3649 ID3D10EffectConstantBuffer *iface, const char *semantic)
3651 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3654 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3655 ID3D10EffectConstantBuffer *iface, UINT index)
3657 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3660 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3661 ID3D10EffectConstantBuffer *iface)
3663 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3666 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3667 ID3D10EffectConstantBuffer *iface)
3669 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3672 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3673 ID3D10EffectConstantBuffer *iface)
3675 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3678 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3679 ID3D10EffectConstantBuffer *iface)
3681 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3684 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3685 ID3D10EffectConstantBuffer *iface)
3687 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3690 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3691 ID3D10EffectConstantBuffer *iface)
3693 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3696 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3697 ID3D10EffectConstantBuffer *iface)
3699 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3702 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3703 ID3D10EffectConstantBuffer *iface)
3705 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3708 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3709 ID3D10EffectConstantBuffer *iface)
3711 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3714 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3715 ID3D10EffectConstantBuffer *iface)
3717 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3720 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3722 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3725 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3726 ID3D10EffectConstantBuffer *iface)
3728 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3731 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3732 ID3D10EffectConstantBuffer *iface)
3734 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3737 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3738 ID3D10EffectConstantBuffer *iface)
3740 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3743 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3744 void *data, UINT offset, UINT count)
3746 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3749 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3750 void *data, UINT offset, UINT count)
3752 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3755 /* ID3D10EffectConstantBuffer methods */
3756 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3757 ID3D10Buffer *buffer)
3759 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3761 return E_NOTIMPL;
3764 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3765 ID3D10Buffer **buffer)
3767 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3769 return E_NOTIMPL;
3772 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3773 ID3D10ShaderResourceView *view)
3775 FIXME("iface %p, view %p stub!\n", iface, view);
3777 return E_NOTIMPL;
3780 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3781 ID3D10ShaderResourceView **view)
3783 FIXME("iface %p, view %p stub!\n", iface, view);
3785 return E_NOTIMPL;
3788 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3790 /* ID3D10EffectVariable methods */
3791 d3d10_effect_constant_buffer_IsValid,
3792 d3d10_effect_constant_buffer_GetType,
3793 d3d10_effect_constant_buffer_GetDesc,
3794 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3795 d3d10_effect_constant_buffer_GetAnnotationByName,
3796 d3d10_effect_constant_buffer_GetMemberByIndex,
3797 d3d10_effect_constant_buffer_GetMemberByName,
3798 d3d10_effect_constant_buffer_GetMemberBySemantic,
3799 d3d10_effect_constant_buffer_GetElement,
3800 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3801 d3d10_effect_constant_buffer_AsScalar,
3802 d3d10_effect_constant_buffer_AsVector,
3803 d3d10_effect_constant_buffer_AsMatrix,
3804 d3d10_effect_constant_buffer_AsString,
3805 d3d10_effect_constant_buffer_AsShaderResource,
3806 d3d10_effect_constant_buffer_AsRenderTargetView,
3807 d3d10_effect_constant_buffer_AsDepthStencilView,
3808 d3d10_effect_constant_buffer_AsConstantBuffer,
3809 d3d10_effect_constant_buffer_AsShader,
3810 d3d10_effect_constant_buffer_AsBlend,
3811 d3d10_effect_constant_buffer_AsDepthStencil,
3812 d3d10_effect_constant_buffer_AsRasterizer,
3813 d3d10_effect_constant_buffer_AsSampler,
3814 d3d10_effect_constant_buffer_SetRawValue,
3815 d3d10_effect_constant_buffer_GetRawValue,
3816 /* ID3D10EffectConstantBuffer methods */
3817 d3d10_effect_constant_buffer_SetConstantBuffer,
3818 d3d10_effect_constant_buffer_GetConstantBuffer,
3819 d3d10_effect_constant_buffer_SetTextureBuffer,
3820 d3d10_effect_constant_buffer_GetTextureBuffer,
3823 /* ID3D10EffectVariable methods */
3825 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3827 TRACE("iface %p\n", iface);
3829 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3832 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3833 ID3D10EffectScalarVariable *iface)
3835 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3838 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3839 D3D10_EFFECT_VARIABLE_DESC *desc)
3841 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3844 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3845 ID3D10EffectScalarVariable *iface, UINT index)
3847 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3850 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3851 ID3D10EffectScalarVariable *iface, const char *name)
3853 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3856 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3857 ID3D10EffectScalarVariable *iface, UINT index)
3859 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3862 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3863 ID3D10EffectScalarVariable *iface, const char *name)
3865 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3868 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3869 ID3D10EffectScalarVariable *iface, const char *semantic)
3871 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3874 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3875 ID3D10EffectScalarVariable *iface, UINT index)
3877 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3880 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3881 ID3D10EffectScalarVariable *iface)
3883 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3886 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3887 ID3D10EffectScalarVariable *iface)
3889 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3892 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3893 ID3D10EffectScalarVariable *iface)
3895 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3898 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3899 ID3D10EffectScalarVariable *iface)
3901 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3904 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3905 ID3D10EffectScalarVariable *iface)
3907 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3910 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3911 ID3D10EffectScalarVariable *iface)
3913 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3916 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3917 ID3D10EffectScalarVariable *iface)
3919 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3922 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3923 ID3D10EffectScalarVariable *iface)
3925 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3928 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3929 ID3D10EffectScalarVariable *iface)
3931 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3934 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3935 ID3D10EffectScalarVariable *iface)
3937 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3940 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3941 ID3D10EffectScalarVariable *iface)
3943 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3946 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3947 ID3D10EffectScalarVariable *iface)
3949 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3952 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3953 ID3D10EffectScalarVariable *iface)
3955 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3958 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3959 ID3D10EffectScalarVariable *iface)
3961 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3964 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3965 void *data, UINT offset, UINT count)
3967 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3970 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3971 void *data, UINT offset, UINT count)
3973 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3976 /* ID3D10EffectScalarVariable methods */
3978 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3979 float value)
3981 FIXME("iface %p, value %.8e stub!\n", iface, value);
3983 return E_NOTIMPL;
3986 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3987 float *value)
3989 FIXME("iface %p, value %p stub!\n", iface, value);
3991 return E_NOTIMPL;
3994 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3995 float *values, UINT offset, UINT count)
3997 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3999 return E_NOTIMPL;
4002 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4003 float *values, UINT offset, UINT count)
4005 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4007 return E_NOTIMPL;
4010 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
4011 int value)
4013 FIXME("iface %p, value %d stub!\n", iface, value);
4015 return E_NOTIMPL;
4018 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4019 int *value)
4021 FIXME("iface %p, value %p stub!\n", iface, value);
4023 return E_NOTIMPL;
4026 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4027 int *values, UINT offset, UINT count)
4029 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4031 return E_NOTIMPL;
4034 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4035 int *values, UINT offset, UINT count)
4037 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4039 return E_NOTIMPL;
4042 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4043 BOOL value)
4045 FIXME("iface %p, value %d stub!\n", iface, value);
4047 return E_NOTIMPL;
4050 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4051 BOOL *value)
4053 FIXME("iface %p, value %p stub!\n", iface, value);
4055 return E_NOTIMPL;
4058 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4059 BOOL *values, UINT offset, UINT count)
4061 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4063 return E_NOTIMPL;
4066 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4067 BOOL *values, UINT offset, UINT count)
4069 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4071 return E_NOTIMPL;
4074 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4076 /* ID3D10EffectVariable methods */
4077 d3d10_effect_scalar_variable_IsValid,
4078 d3d10_effect_scalar_variable_GetType,
4079 d3d10_effect_scalar_variable_GetDesc,
4080 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4081 d3d10_effect_scalar_variable_GetAnnotationByName,
4082 d3d10_effect_scalar_variable_GetMemberByIndex,
4083 d3d10_effect_scalar_variable_GetMemberByName,
4084 d3d10_effect_scalar_variable_GetMemberBySemantic,
4085 d3d10_effect_scalar_variable_GetElement,
4086 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4087 d3d10_effect_scalar_variable_AsScalar,
4088 d3d10_effect_scalar_variable_AsVector,
4089 d3d10_effect_scalar_variable_AsMatrix,
4090 d3d10_effect_scalar_variable_AsString,
4091 d3d10_effect_scalar_variable_AsShaderResource,
4092 d3d10_effect_scalar_variable_AsRenderTargetView,
4093 d3d10_effect_scalar_variable_AsDepthStencilView,
4094 d3d10_effect_scalar_variable_AsConstantBuffer,
4095 d3d10_effect_scalar_variable_AsShader,
4096 d3d10_effect_scalar_variable_AsBlend,
4097 d3d10_effect_scalar_variable_AsDepthStencil,
4098 d3d10_effect_scalar_variable_AsRasterizer,
4099 d3d10_effect_scalar_variable_AsSampler,
4100 d3d10_effect_scalar_variable_SetRawValue,
4101 d3d10_effect_scalar_variable_GetRawValue,
4102 /* ID3D10EffectScalarVariable methods */
4103 d3d10_effect_scalar_variable_SetFloat,
4104 d3d10_effect_scalar_variable_GetFloat,
4105 d3d10_effect_scalar_variable_SetFloatArray,
4106 d3d10_effect_scalar_variable_GetFloatArray,
4107 d3d10_effect_scalar_variable_SetInt,
4108 d3d10_effect_scalar_variable_GetInt,
4109 d3d10_effect_scalar_variable_SetIntArray,
4110 d3d10_effect_scalar_variable_GetIntArray,
4111 d3d10_effect_scalar_variable_SetBool,
4112 d3d10_effect_scalar_variable_GetBool,
4113 d3d10_effect_scalar_variable_SetBoolArray,
4114 d3d10_effect_scalar_variable_GetBoolArray,
4117 /* ID3D10EffectVariable methods */
4119 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4121 TRACE("iface %p\n", iface);
4123 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4126 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4127 ID3D10EffectVectorVariable *iface)
4129 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4132 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4133 D3D10_EFFECT_VARIABLE_DESC *desc)
4135 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4138 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4139 ID3D10EffectVectorVariable *iface, UINT index)
4141 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4144 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4145 ID3D10EffectVectorVariable *iface, const char *name)
4147 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4150 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4151 ID3D10EffectVectorVariable *iface, UINT index)
4153 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4156 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4157 ID3D10EffectVectorVariable *iface, const char *name)
4159 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4162 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4163 ID3D10EffectVectorVariable *iface, const char *semantic)
4165 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4168 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4169 ID3D10EffectVectorVariable *iface, UINT index)
4171 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4174 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4175 ID3D10EffectVectorVariable *iface)
4177 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4180 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4181 ID3D10EffectVectorVariable *iface)
4183 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4186 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4187 ID3D10EffectVectorVariable *iface)
4189 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4192 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4193 ID3D10EffectVectorVariable *iface)
4195 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4198 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4199 ID3D10EffectVectorVariable *iface)
4201 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4204 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4205 ID3D10EffectVectorVariable *iface)
4207 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4210 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4211 ID3D10EffectVectorVariable *iface)
4213 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4216 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4217 ID3D10EffectVectorVariable *iface)
4219 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4222 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4223 ID3D10EffectVectorVariable *iface)
4225 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4228 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4229 ID3D10EffectVectorVariable *iface)
4231 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4234 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4235 ID3D10EffectVectorVariable *iface)
4237 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4240 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4241 ID3D10EffectVectorVariable *iface)
4243 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4246 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4247 ID3D10EffectVectorVariable *iface)
4249 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4252 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4253 ID3D10EffectVectorVariable *iface)
4255 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4258 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4259 void *data, UINT offset, UINT count)
4261 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4264 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4265 void *data, UINT offset, UINT count)
4267 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4270 /* ID3D10EffectVectorVariable methods */
4272 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4273 BOOL *value)
4275 FIXME("iface %p, value %p stub!\n", iface, value);
4277 return E_NOTIMPL;
4280 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4281 int *value)
4283 FIXME("iface %p, value %p stub!\n", iface, value);
4285 return E_NOTIMPL;
4288 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4289 float *value)
4291 FIXME("iface %p, value %p stub!\n", iface, value);
4293 return E_NOTIMPL;
4296 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4297 BOOL *value)
4299 FIXME("iface %p, value %p stub!\n", iface, value);
4301 return E_NOTIMPL;
4304 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4305 int *value)
4307 FIXME("iface %p, value %p stub!\n", iface, value);
4309 return E_NOTIMPL;
4312 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4313 float *value)
4315 FIXME("iface %p, value %p stub!\n", iface, value);
4317 return E_NOTIMPL;
4320 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4321 BOOL *values, UINT offset, UINT count)
4323 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4325 return E_NOTIMPL;
4328 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4329 int *values, UINT offset, UINT count)
4331 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4333 return E_NOTIMPL;
4336 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4337 float *values, UINT offset, UINT count)
4339 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4341 return E_NOTIMPL;
4344 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4345 BOOL *values, UINT offset, UINT count)
4347 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4349 return E_NOTIMPL;
4352 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4353 int *values, UINT offset, UINT count)
4355 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4357 return E_NOTIMPL;
4360 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4361 float *values, UINT offset, UINT count)
4363 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4365 return E_NOTIMPL;
4368 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4370 /* ID3D10EffectVariable methods */
4371 d3d10_effect_vector_variable_IsValid,
4372 d3d10_effect_vector_variable_GetType,
4373 d3d10_effect_vector_variable_GetDesc,
4374 d3d10_effect_vector_variable_GetAnnotationByIndex,
4375 d3d10_effect_vector_variable_GetAnnotationByName,
4376 d3d10_effect_vector_variable_GetMemberByIndex,
4377 d3d10_effect_vector_variable_GetMemberByName,
4378 d3d10_effect_vector_variable_GetMemberBySemantic,
4379 d3d10_effect_vector_variable_GetElement,
4380 d3d10_effect_vector_variable_GetParentConstantBuffer,
4381 d3d10_effect_vector_variable_AsScalar,
4382 d3d10_effect_vector_variable_AsVector,
4383 d3d10_effect_vector_variable_AsMatrix,
4384 d3d10_effect_vector_variable_AsString,
4385 d3d10_effect_vector_variable_AsShaderResource,
4386 d3d10_effect_vector_variable_AsRenderTargetView,
4387 d3d10_effect_vector_variable_AsDepthStencilView,
4388 d3d10_effect_vector_variable_AsConstantBuffer,
4389 d3d10_effect_vector_variable_AsShader,
4390 d3d10_effect_vector_variable_AsBlend,
4391 d3d10_effect_vector_variable_AsDepthStencil,
4392 d3d10_effect_vector_variable_AsRasterizer,
4393 d3d10_effect_vector_variable_AsSampler,
4394 d3d10_effect_vector_variable_SetRawValue,
4395 d3d10_effect_vector_variable_GetRawValue,
4396 /* ID3D10EffectVectorVariable methods */
4397 d3d10_effect_vector_variable_SetBoolVector,
4398 d3d10_effect_vector_variable_SetIntVector,
4399 d3d10_effect_vector_variable_SetFloatVector,
4400 d3d10_effect_vector_variable_GetBoolVector,
4401 d3d10_effect_vector_variable_GetIntVector,
4402 d3d10_effect_vector_variable_GetFloatVector,
4403 d3d10_effect_vector_variable_SetBoolVectorArray,
4404 d3d10_effect_vector_variable_SetIntVectorArray,
4405 d3d10_effect_vector_variable_SetFloatVectorArray,
4406 d3d10_effect_vector_variable_GetBoolVectorArray,
4407 d3d10_effect_vector_variable_GetIntVectorArray,
4408 d3d10_effect_vector_variable_GetFloatVectorArray,
4411 /* ID3D10EffectVariable methods */
4413 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4415 TRACE("iface %p\n", iface);
4417 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4420 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4421 ID3D10EffectMatrixVariable *iface)
4423 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4426 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4427 D3D10_EFFECT_VARIABLE_DESC *desc)
4429 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4432 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4433 ID3D10EffectMatrixVariable *iface, UINT index)
4435 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4438 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4439 ID3D10EffectMatrixVariable *iface, const char *name)
4441 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4444 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4445 ID3D10EffectMatrixVariable *iface, UINT index)
4447 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4450 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4451 ID3D10EffectMatrixVariable *iface, const char *name)
4453 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4456 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4457 ID3D10EffectMatrixVariable *iface, const char *semantic)
4459 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4462 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4463 ID3D10EffectMatrixVariable *iface, UINT index)
4465 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4468 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4469 ID3D10EffectMatrixVariable *iface)
4471 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4474 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4475 ID3D10EffectMatrixVariable *iface)
4477 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4480 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4481 ID3D10EffectMatrixVariable *iface)
4483 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4486 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4487 ID3D10EffectMatrixVariable *iface)
4489 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4492 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4493 ID3D10EffectMatrixVariable *iface)
4495 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4498 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4499 ID3D10EffectMatrixVariable *iface)
4501 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4504 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4505 ID3D10EffectMatrixVariable *iface)
4507 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4510 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4511 ID3D10EffectMatrixVariable *iface)
4513 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4516 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4517 ID3D10EffectMatrixVariable *iface)
4519 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4522 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4523 ID3D10EffectMatrixVariable *iface)
4525 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4528 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4529 ID3D10EffectMatrixVariable *iface)
4531 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4534 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4535 ID3D10EffectMatrixVariable *iface)
4537 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4540 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4541 ID3D10EffectMatrixVariable *iface)
4543 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4546 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4547 ID3D10EffectMatrixVariable *iface)
4549 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4552 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4553 void *data, UINT offset, UINT count)
4555 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4558 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4559 void *data, UINT offset, UINT count)
4561 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4564 /* ID3D10EffectMatrixVariable methods */
4566 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4567 float *data)
4569 FIXME("iface %p, data %p stub!\n", iface, data);
4571 return E_NOTIMPL;
4574 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4575 float *data)
4577 FIXME("iface %p, data %p stub!\n", iface, data);
4579 return E_NOTIMPL;
4582 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4583 float *data, UINT offset, UINT count)
4585 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4587 return E_NOTIMPL;
4590 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4591 float *data, UINT offset, UINT count)
4593 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4595 return E_NOTIMPL;
4598 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4599 float *data)
4601 FIXME("iface %p, data %p stub!\n", iface, data);
4603 return E_NOTIMPL;
4606 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4607 float *data)
4609 FIXME("iface %p, data %p stub!\n", iface, data);
4611 return E_NOTIMPL;
4614 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4615 float *data, UINT offset, UINT count)
4617 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4619 return E_NOTIMPL;
4622 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4623 float *data, UINT offset, UINT count)
4625 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4627 return E_NOTIMPL;
4631 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4633 /* ID3D10EffectVariable methods */
4634 d3d10_effect_matrix_variable_IsValid,
4635 d3d10_effect_matrix_variable_GetType,
4636 d3d10_effect_matrix_variable_GetDesc,
4637 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4638 d3d10_effect_matrix_variable_GetAnnotationByName,
4639 d3d10_effect_matrix_variable_GetMemberByIndex,
4640 d3d10_effect_matrix_variable_GetMemberByName,
4641 d3d10_effect_matrix_variable_GetMemberBySemantic,
4642 d3d10_effect_matrix_variable_GetElement,
4643 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4644 d3d10_effect_matrix_variable_AsScalar,
4645 d3d10_effect_matrix_variable_AsVector,
4646 d3d10_effect_matrix_variable_AsMatrix,
4647 d3d10_effect_matrix_variable_AsString,
4648 d3d10_effect_matrix_variable_AsShaderResource,
4649 d3d10_effect_matrix_variable_AsRenderTargetView,
4650 d3d10_effect_matrix_variable_AsDepthStencilView,
4651 d3d10_effect_matrix_variable_AsConstantBuffer,
4652 d3d10_effect_matrix_variable_AsShader,
4653 d3d10_effect_matrix_variable_AsBlend,
4654 d3d10_effect_matrix_variable_AsDepthStencil,
4655 d3d10_effect_matrix_variable_AsRasterizer,
4656 d3d10_effect_matrix_variable_AsSampler,
4657 d3d10_effect_matrix_variable_SetRawValue,
4658 d3d10_effect_matrix_variable_GetRawValue,
4659 /* ID3D10EffectMatrixVariable methods */
4660 d3d10_effect_matrix_variable_SetMatrix,
4661 d3d10_effect_matrix_variable_GetMatrix,
4662 d3d10_effect_matrix_variable_SetMatrixArray,
4663 d3d10_effect_matrix_variable_GetMatrixArray,
4664 d3d10_effect_matrix_variable_SetMatrixTranspose,
4665 d3d10_effect_matrix_variable_GetMatrixTranspose,
4666 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4667 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4670 /* ID3D10EffectVariable methods */
4672 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4674 TRACE("iface %p\n", iface);
4676 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4679 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4680 ID3D10EffectStringVariable *iface)
4682 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4685 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4686 D3D10_EFFECT_VARIABLE_DESC *desc)
4688 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4691 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4692 ID3D10EffectStringVariable *iface, UINT index)
4694 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4697 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4698 ID3D10EffectStringVariable *iface, const char *name)
4700 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4703 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4704 ID3D10EffectStringVariable *iface, UINT index)
4706 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4709 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4710 ID3D10EffectStringVariable *iface, const char *name)
4712 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4715 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4716 ID3D10EffectStringVariable *iface, const char *semantic)
4718 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4721 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4722 ID3D10EffectStringVariable *iface, UINT index)
4724 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4727 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4728 ID3D10EffectStringVariable *iface)
4730 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4733 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4734 ID3D10EffectStringVariable *iface)
4736 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4739 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4740 ID3D10EffectStringVariable *iface)
4742 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4745 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4746 ID3D10EffectStringVariable *iface)
4748 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4751 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4752 ID3D10EffectStringVariable *iface)
4754 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4757 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4758 ID3D10EffectStringVariable *iface)
4760 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4763 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4764 ID3D10EffectStringVariable *iface)
4766 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4769 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4770 ID3D10EffectStringVariable *iface)
4772 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4775 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4776 ID3D10EffectStringVariable *iface)
4778 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4781 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4782 ID3D10EffectStringVariable *iface)
4784 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4787 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4788 ID3D10EffectStringVariable *iface)
4790 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4793 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4794 ID3D10EffectStringVariable *iface)
4796 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4799 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4800 ID3D10EffectStringVariable *iface)
4802 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4805 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4806 ID3D10EffectStringVariable *iface)
4808 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4811 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4812 void *data, UINT offset, UINT count)
4814 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4817 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4818 void *data, UINT offset, UINT count)
4820 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4823 /* ID3D10EffectStringVariable methods */
4825 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4826 const char **str)
4828 FIXME("iface %p, str %p stub!\n", iface, str);
4830 return E_NOTIMPL;
4833 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4834 const char **strs, UINT offset, UINT count)
4836 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4838 return E_NOTIMPL;
4842 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4844 /* ID3D10EffectVariable methods */
4845 d3d10_effect_string_variable_IsValid,
4846 d3d10_effect_string_variable_GetType,
4847 d3d10_effect_string_variable_GetDesc,
4848 d3d10_effect_string_variable_GetAnnotationByIndex,
4849 d3d10_effect_string_variable_GetAnnotationByName,
4850 d3d10_effect_string_variable_GetMemberByIndex,
4851 d3d10_effect_string_variable_GetMemberByName,
4852 d3d10_effect_string_variable_GetMemberBySemantic,
4853 d3d10_effect_string_variable_GetElement,
4854 d3d10_effect_string_variable_GetParentConstantBuffer,
4855 d3d10_effect_string_variable_AsScalar,
4856 d3d10_effect_string_variable_AsVector,
4857 d3d10_effect_string_variable_AsMatrix,
4858 d3d10_effect_string_variable_AsString,
4859 d3d10_effect_string_variable_AsShaderResource,
4860 d3d10_effect_string_variable_AsRenderTargetView,
4861 d3d10_effect_string_variable_AsDepthStencilView,
4862 d3d10_effect_string_variable_AsConstantBuffer,
4863 d3d10_effect_string_variable_AsShader,
4864 d3d10_effect_string_variable_AsBlend,
4865 d3d10_effect_string_variable_AsDepthStencil,
4866 d3d10_effect_string_variable_AsRasterizer,
4867 d3d10_effect_string_variable_AsSampler,
4868 d3d10_effect_string_variable_SetRawValue,
4869 d3d10_effect_string_variable_GetRawValue,
4870 /* ID3D10EffectStringVariable methods */
4871 d3d10_effect_string_variable_GetString,
4872 d3d10_effect_string_variable_GetStringArray,
4875 /* ID3D10EffectVariable methods */
4877 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4879 TRACE("iface %p\n", iface);
4881 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4884 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4885 ID3D10EffectShaderResourceVariable *iface)
4887 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4890 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4891 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4893 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4896 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4897 ID3D10EffectShaderResourceVariable *iface, UINT index)
4899 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4902 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4903 ID3D10EffectShaderResourceVariable *iface, const char *name)
4905 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4908 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4909 ID3D10EffectShaderResourceVariable *iface, UINT index)
4911 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4914 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4915 ID3D10EffectShaderResourceVariable *iface, const char *name)
4917 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4920 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4921 ID3D10EffectShaderResourceVariable *iface, const char *semantic)
4923 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4926 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4927 ID3D10EffectShaderResourceVariable *iface, UINT index)
4929 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4932 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4933 ID3D10EffectShaderResourceVariable *iface)
4935 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4938 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4939 ID3D10EffectShaderResourceVariable *iface)
4941 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4944 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4945 ID3D10EffectShaderResourceVariable *iface)
4947 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4950 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4951 ID3D10EffectShaderResourceVariable *iface)
4953 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4956 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4957 ID3D10EffectShaderResourceVariable *iface)
4959 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4962 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4963 ID3D10EffectShaderResourceVariable *iface)
4965 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4968 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4969 ID3D10EffectShaderResourceVariable *iface)
4971 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4974 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4975 ID3D10EffectShaderResourceVariable *iface)
4977 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4980 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
4981 ID3D10EffectShaderResourceVariable *iface)
4983 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4986 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
4987 ID3D10EffectShaderResourceVariable *iface)
4989 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4992 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
4993 ID3D10EffectShaderResourceVariable *iface)
4995 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4998 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
4999 ID3D10EffectShaderResourceVariable *iface)
5001 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5004 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5005 ID3D10EffectShaderResourceVariable *iface)
5007 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5010 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5011 ID3D10EffectShaderResourceVariable *iface)
5013 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5016 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5017 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5019 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5022 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5023 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5025 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5028 /* ID3D10EffectShaderResourceVariable methods */
5030 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5031 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5033 FIXME("iface %p, resource %p stub!\n", iface, resource);
5035 return E_NOTIMPL;
5038 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5039 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5041 FIXME("iface %p, resource %p stub!\n", iface, resource);
5043 return E_NOTIMPL;
5046 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5047 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5049 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5051 return E_NOTIMPL;
5054 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5055 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5057 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5059 return E_NOTIMPL;
5063 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5065 /* ID3D10EffectVariable methods */
5066 d3d10_effect_shader_resource_variable_IsValid,
5067 d3d10_effect_shader_resource_variable_GetType,
5068 d3d10_effect_shader_resource_variable_GetDesc,
5069 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5070 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5071 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5072 d3d10_effect_shader_resource_variable_GetMemberByName,
5073 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5074 d3d10_effect_shader_resource_variable_GetElement,
5075 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5076 d3d10_effect_shader_resource_variable_AsScalar,
5077 d3d10_effect_shader_resource_variable_AsVector,
5078 d3d10_effect_shader_resource_variable_AsMatrix,
5079 d3d10_effect_shader_resource_variable_AsString,
5080 d3d10_effect_shader_resource_variable_AsShaderResource,
5081 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5082 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5083 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5084 d3d10_effect_shader_resource_variable_AsShader,
5085 d3d10_effect_shader_resource_variable_AsBlend,
5086 d3d10_effect_shader_resource_variable_AsDepthStencil,
5087 d3d10_effect_shader_resource_variable_AsRasterizer,
5088 d3d10_effect_shader_resource_variable_AsSampler,
5089 d3d10_effect_shader_resource_variable_SetRawValue,
5090 d3d10_effect_shader_resource_variable_GetRawValue,
5091 /* ID3D10EffectShaderResourceVariable methods */
5092 d3d10_effect_shader_resource_variable_SetResource,
5093 d3d10_effect_shader_resource_variable_GetResource,
5094 d3d10_effect_shader_resource_variable_SetResourceArray,
5095 d3d10_effect_shader_resource_variable_GetResourceArray,
5098 /* ID3D10EffectVariable methods */
5100 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5101 ID3D10EffectRenderTargetViewVariable *iface)
5103 TRACE("iface %p\n", iface);
5105 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5108 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5109 ID3D10EffectRenderTargetViewVariable *iface)
5111 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5114 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5115 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5117 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5120 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5121 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5123 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5126 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5127 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5129 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5132 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5133 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5135 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5138 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5139 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5141 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5144 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5145 ID3D10EffectRenderTargetViewVariable *iface, const char *semantic)
5147 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5150 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5151 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5153 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5156 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5157 ID3D10EffectRenderTargetViewVariable *iface)
5159 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5162 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5163 ID3D10EffectRenderTargetViewVariable *iface)
5165 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5168 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5169 ID3D10EffectRenderTargetViewVariable *iface)
5171 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5174 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5175 ID3D10EffectRenderTargetViewVariable *iface)
5177 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5180 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5181 ID3D10EffectRenderTargetViewVariable *iface)
5183 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5186 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5187 ID3D10EffectRenderTargetViewVariable *iface)
5189 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5192 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5193 ID3D10EffectRenderTargetViewVariable *iface)
5195 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5198 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5199 ID3D10EffectRenderTargetViewVariable *iface)
5201 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5204 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5205 ID3D10EffectRenderTargetViewVariable *iface)
5207 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5210 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5211 ID3D10EffectRenderTargetViewVariable *iface)
5213 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5216 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5217 ID3D10EffectRenderTargetViewVariable *iface)
5219 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5222 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5223 ID3D10EffectRenderTargetViewVariable *iface)
5225 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5228 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5229 ID3D10EffectRenderTargetViewVariable *iface)
5231 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5234 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5235 ID3D10EffectRenderTargetViewVariable *iface)
5237 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5240 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5241 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5243 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5246 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5247 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5249 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5252 /* ID3D10EffectRenderTargetViewVariable methods */
5254 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5255 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5257 FIXME("iface %p, view %p stub!\n", iface, view);
5259 return E_NOTIMPL;
5262 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5263 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5265 FIXME("iface %p, view %p stub!\n", iface, view);
5267 return E_NOTIMPL;
5270 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5271 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5273 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5275 return E_NOTIMPL;
5278 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5279 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5281 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5283 return E_NOTIMPL;
5287 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5289 /* ID3D10EffectVariable methods */
5290 d3d10_effect_render_target_view_variable_IsValid,
5291 d3d10_effect_render_target_view_variable_GetType,
5292 d3d10_effect_render_target_view_variable_GetDesc,
5293 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5294 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5295 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5296 d3d10_effect_render_target_view_variable_GetMemberByName,
5297 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5298 d3d10_effect_render_target_view_variable_GetElement,
5299 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5300 d3d10_effect_render_target_view_variable_AsScalar,
5301 d3d10_effect_render_target_view_variable_AsVector,
5302 d3d10_effect_render_target_view_variable_AsMatrix,
5303 d3d10_effect_render_target_view_variable_AsString,
5304 d3d10_effect_render_target_view_variable_AsShaderResource,
5305 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5306 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5307 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5308 d3d10_effect_render_target_view_variable_AsShader,
5309 d3d10_effect_render_target_view_variable_AsBlend,
5310 d3d10_effect_render_target_view_variable_AsDepthStencil,
5311 d3d10_effect_render_target_view_variable_AsRasterizer,
5312 d3d10_effect_render_target_view_variable_AsSampler,
5313 d3d10_effect_render_target_view_variable_SetRawValue,
5314 d3d10_effect_render_target_view_variable_GetRawValue,
5315 /* ID3D10EffectRenderTargetViewVariable methods */
5316 d3d10_effect_render_target_view_variable_SetRenderTarget,
5317 d3d10_effect_render_target_view_variable_GetRenderTarget,
5318 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5319 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5322 /* ID3D10EffectVariable methods */
5324 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5325 ID3D10EffectDepthStencilViewVariable *iface)
5327 TRACE("iface %p\n", iface);
5329 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5332 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5333 ID3D10EffectDepthStencilViewVariable *iface)
5335 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5338 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5339 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5341 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5344 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5345 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5347 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5350 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5351 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5353 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5356 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5357 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5359 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5362 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5363 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5365 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5368 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5369 ID3D10EffectDepthStencilViewVariable *iface, const char *semantic)
5371 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5374 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5375 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5377 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5380 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5381 ID3D10EffectDepthStencilViewVariable *iface)
5383 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5386 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5387 ID3D10EffectDepthStencilViewVariable *iface)
5389 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5392 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5393 ID3D10EffectDepthStencilViewVariable *iface)
5395 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5398 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5399 ID3D10EffectDepthStencilViewVariable *iface)
5401 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5404 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5405 ID3D10EffectDepthStencilViewVariable *iface)
5407 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5410 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5411 ID3D10EffectDepthStencilViewVariable *iface)
5413 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5416 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5417 ID3D10EffectDepthStencilViewVariable *iface)
5419 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5422 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5423 ID3D10EffectDepthStencilViewVariable *iface)
5425 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5428 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5429 ID3D10EffectDepthStencilViewVariable *iface)
5431 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5434 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5435 ID3D10EffectDepthStencilViewVariable *iface)
5437 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5440 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5441 ID3D10EffectDepthStencilViewVariable *iface)
5443 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5446 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5447 ID3D10EffectDepthStencilViewVariable *iface)
5449 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5452 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5453 ID3D10EffectDepthStencilViewVariable *iface)
5455 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5458 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5459 ID3D10EffectDepthStencilViewVariable *iface)
5461 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5464 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5465 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5467 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5470 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5471 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5473 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5476 /* ID3D10EffectDepthStencilViewVariable methods */
5478 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5479 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5481 FIXME("iface %p, view %p stub!\n", iface, view);
5483 return E_NOTIMPL;
5486 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5487 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5489 FIXME("iface %p, view %p stub!\n", iface, view);
5491 return E_NOTIMPL;
5494 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5495 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5497 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5499 return E_NOTIMPL;
5502 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5503 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5505 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5507 return E_NOTIMPL;
5511 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5513 /* ID3D10EffectVariable methods */
5514 d3d10_effect_depth_stencil_view_variable_IsValid,
5515 d3d10_effect_depth_stencil_view_variable_GetType,
5516 d3d10_effect_depth_stencil_view_variable_GetDesc,
5517 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5518 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5519 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5520 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5521 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5522 d3d10_effect_depth_stencil_view_variable_GetElement,
5523 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5524 d3d10_effect_depth_stencil_view_variable_AsScalar,
5525 d3d10_effect_depth_stencil_view_variable_AsVector,
5526 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5527 d3d10_effect_depth_stencil_view_variable_AsString,
5528 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5529 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5530 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5531 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5532 d3d10_effect_depth_stencil_view_variable_AsShader,
5533 d3d10_effect_depth_stencil_view_variable_AsBlend,
5534 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5535 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5536 d3d10_effect_depth_stencil_view_variable_AsSampler,
5537 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5538 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5539 /* ID3D10EffectDepthStencilViewVariable methods */
5540 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5541 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5542 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5543 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5546 /* ID3D10EffectVariable methods */
5548 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5550 TRACE("iface %p\n", iface);
5552 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5555 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5556 ID3D10EffectShaderVariable *iface)
5558 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5561 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5562 D3D10_EFFECT_VARIABLE_DESC *desc)
5564 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5567 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5568 ID3D10EffectShaderVariable *iface, UINT index)
5570 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5573 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5574 ID3D10EffectShaderVariable *iface, const char *name)
5576 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5579 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5580 ID3D10EffectShaderVariable *iface, UINT index)
5582 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5585 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5586 ID3D10EffectShaderVariable *iface, const char *name)
5588 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5591 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5592 ID3D10EffectShaderVariable *iface, const char *semantic)
5594 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5597 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5598 ID3D10EffectShaderVariable *iface, UINT index)
5600 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5603 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5604 ID3D10EffectShaderVariable *iface)
5606 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5609 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5610 ID3D10EffectShaderVariable *iface)
5612 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5615 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5616 ID3D10EffectShaderVariable *iface)
5618 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5621 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5622 ID3D10EffectShaderVariable *iface)
5624 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5627 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5628 ID3D10EffectShaderVariable *iface)
5630 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5633 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5634 ID3D10EffectShaderVariable *iface)
5636 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5639 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5640 ID3D10EffectShaderVariable *iface)
5642 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5645 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5646 ID3D10EffectShaderVariable *iface)
5648 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5651 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5652 ID3D10EffectShaderVariable *iface)
5654 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5657 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5658 ID3D10EffectShaderVariable *iface)
5660 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5663 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5664 ID3D10EffectShaderVariable *iface)
5666 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5669 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5670 ID3D10EffectShaderVariable *iface)
5672 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5675 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5676 ID3D10EffectShaderVariable *iface)
5678 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5681 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5682 ID3D10EffectShaderVariable *iface)
5684 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5687 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5688 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5690 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5693 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5694 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5696 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5699 /* ID3D10EffectShaderVariable methods */
5701 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5702 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5704 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5706 return E_NOTIMPL;
5709 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5710 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5712 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5714 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5716 if (v->type->element_count)
5717 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5719 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5721 WARN("Shader is not a vertex shader.\n");
5722 return E_FAIL;
5725 if ((*shader = v->u.shader.shader.vs))
5726 ID3D10VertexShader_AddRef(*shader);
5728 return S_OK;
5731 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5732 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5734 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5736 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5738 if (v->type->element_count)
5739 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5741 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5743 WARN("Shader is not a geometry shader.\n");
5744 return E_FAIL;
5747 if ((*shader = v->u.shader.shader.gs))
5748 ID3D10GeometryShader_AddRef(*shader);
5750 return S_OK;
5753 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5754 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5756 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5758 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5760 if (v->type->element_count)
5761 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5763 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5765 WARN("Shader is not a pixel shader.\n");
5766 return E_FAIL;
5769 if ((*shader = v->u.shader.shader.ps))
5770 ID3D10PixelShader_AddRef(*shader);
5772 return S_OK;
5775 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5776 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5777 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5779 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5780 struct d3d10_effect_shader_variable *s;
5781 D3D10_SIGNATURE_PARAMETER_DESC *d;
5783 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5784 iface, shader_index, element_index, desc);
5786 if (!iface->lpVtbl->IsValid(iface))
5788 WARN("Null variable specified\n");
5789 return E_FAIL;
5792 /* Check shader_index, this crashes on W7/DX10 */
5793 if (shader_index >= This->effect->used_shader_count)
5795 WARN("This should crash on W7/DX10!\n");
5796 return E_FAIL;
5799 s = &This->effect->used_shaders[shader_index]->u.shader;
5800 if (!s->input_signature.signature)
5802 WARN("No shader signature\n");
5803 return D3DERR_INVALIDCALL;
5806 /* Check desc for NULL, this crashes on W7/DX10 */
5807 if (!desc)
5809 WARN("This should crash on W7/DX10!\n");
5810 return E_FAIL;
5813 if (element_index >= s->input_signature.element_count)
5815 WARN("Invalid element index specified\n");
5816 return E_INVALIDARG;
5819 d = &s->input_signature.elements[element_index];
5820 desc->SemanticName = d->SemanticName;
5821 desc->SemanticIndex = d->SemanticIndex;
5822 desc->SystemValueType = d->SystemValueType;
5823 desc->ComponentType = d->ComponentType;
5824 desc->Register = d->Register;
5825 desc->ReadWriteMask = d->ReadWriteMask;
5826 desc->Mask = d->Mask;
5828 return S_OK;
5831 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5832 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5833 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5835 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5836 struct d3d10_effect_shader_variable *s;
5837 D3D10_SIGNATURE_PARAMETER_DESC *d;
5839 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5840 iface, shader_index, element_index, desc);
5842 if (!iface->lpVtbl->IsValid(iface))
5844 WARN("Null variable specified\n");
5845 return E_FAIL;
5848 /* Check shader_index, this crashes on W7/DX10 */
5849 if (shader_index >= This->effect->used_shader_count)
5851 WARN("This should crash on W7/DX10!\n");
5852 return E_FAIL;
5855 s = &This->effect->used_shaders[shader_index]->u.shader;
5856 if (!s->output_signature.signature)
5858 WARN("No shader signature\n");
5859 return D3DERR_INVALIDCALL;
5862 /* Check desc for NULL, this crashes on W7/DX10 */
5863 if (!desc)
5865 WARN("This should crash on W7/DX10!\n");
5866 return E_FAIL;
5869 if (element_index >= s->output_signature.element_count)
5871 WARN("Invalid element index specified\n");
5872 return E_INVALIDARG;
5875 d = &s->output_signature.elements[element_index];
5876 desc->SemanticName = d->SemanticName;
5877 desc->SemanticIndex = d->SemanticIndex;
5878 desc->SystemValueType = d->SystemValueType;
5879 desc->ComponentType = d->ComponentType;
5880 desc->Register = d->Register;
5881 desc->ReadWriteMask = d->ReadWriteMask;
5882 desc->Mask = d->Mask;
5884 return S_OK;
5888 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5890 /* ID3D10EffectVariable methods */
5891 d3d10_effect_shader_variable_IsValid,
5892 d3d10_effect_shader_variable_GetType,
5893 d3d10_effect_shader_variable_GetDesc,
5894 d3d10_effect_shader_variable_GetAnnotationByIndex,
5895 d3d10_effect_shader_variable_GetAnnotationByName,
5896 d3d10_effect_shader_variable_GetMemberByIndex,
5897 d3d10_effect_shader_variable_GetMemberByName,
5898 d3d10_effect_shader_variable_GetMemberBySemantic,
5899 d3d10_effect_shader_variable_GetElement,
5900 d3d10_effect_shader_variable_GetParentConstantBuffer,
5901 d3d10_effect_shader_variable_AsScalar,
5902 d3d10_effect_shader_variable_AsVector,
5903 d3d10_effect_shader_variable_AsMatrix,
5904 d3d10_effect_shader_variable_AsString,
5905 d3d10_effect_shader_variable_AsShaderResource,
5906 d3d10_effect_shader_variable_AsRenderTargetView,
5907 d3d10_effect_shader_variable_AsDepthStencilView,
5908 d3d10_effect_shader_variable_AsConstantBuffer,
5909 d3d10_effect_shader_variable_AsShader,
5910 d3d10_effect_shader_variable_AsBlend,
5911 d3d10_effect_shader_variable_AsDepthStencil,
5912 d3d10_effect_shader_variable_AsRasterizer,
5913 d3d10_effect_shader_variable_AsSampler,
5914 d3d10_effect_shader_variable_SetRawValue,
5915 d3d10_effect_shader_variable_GetRawValue,
5916 /* ID3D10EffectShaderVariable methods */
5917 d3d10_effect_shader_variable_GetShaderDesc,
5918 d3d10_effect_shader_variable_GetVertexShader,
5919 d3d10_effect_shader_variable_GetGeometryShader,
5920 d3d10_effect_shader_variable_GetPixelShader,
5921 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5922 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5925 /* ID3D10EffectVariable methods */
5927 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5929 TRACE("iface %p\n", iface);
5931 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5934 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5935 ID3D10EffectBlendVariable *iface)
5937 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5940 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5941 D3D10_EFFECT_VARIABLE_DESC *desc)
5943 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5946 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5947 ID3D10EffectBlendVariable *iface, UINT index)
5949 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5952 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5953 ID3D10EffectBlendVariable *iface, const char *name)
5955 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5958 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5959 ID3D10EffectBlendVariable *iface, UINT index)
5961 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5964 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5965 ID3D10EffectBlendVariable *iface, const char *name)
5967 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5970 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5971 ID3D10EffectBlendVariable *iface, const char *semantic)
5973 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5976 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5977 ID3D10EffectBlendVariable *iface, UINT index)
5979 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5982 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
5983 ID3D10EffectBlendVariable *iface)
5985 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5988 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
5989 ID3D10EffectBlendVariable *iface)
5991 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5994 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
5995 ID3D10EffectBlendVariable *iface)
5997 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6000 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6001 ID3D10EffectBlendVariable *iface)
6003 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6006 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6007 ID3D10EffectBlendVariable *iface)
6009 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6012 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6013 ID3D10EffectBlendVariable *iface)
6015 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6018 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6019 ID3D10EffectBlendVariable *iface)
6021 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6024 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6025 ID3D10EffectBlendVariable *iface)
6027 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6030 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6031 ID3D10EffectBlendVariable *iface)
6033 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6036 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6037 ID3D10EffectBlendVariable *iface)
6039 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6042 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6043 ID3D10EffectBlendVariable *iface)
6045 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6048 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6049 ID3D10EffectBlendVariable *iface)
6051 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6054 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6055 ID3D10EffectBlendVariable *iface)
6057 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6060 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6061 ID3D10EffectBlendVariable *iface)
6063 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6066 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6067 void *data, UINT offset, UINT count)
6069 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6072 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6073 void *data, UINT offset, UINT count)
6075 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6078 /* ID3D10EffectBlendVariable methods */
6080 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6081 UINT index, ID3D10BlendState **blend_state)
6083 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6085 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6087 if (v->type->element_count)
6088 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6089 else if (index)
6090 return E_FAIL;
6092 if (v->type->basetype != D3D10_SVT_BLEND)
6094 WARN("Variable is not a blend state.\n");
6095 return E_FAIL;
6098 if ((*blend_state = v->u.state.object.blend))
6099 ID3D10BlendState_AddRef(*blend_state);
6101 return S_OK;
6104 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6105 UINT index, D3D10_BLEND_DESC *desc)
6107 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6109 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6111 if (v->type->element_count)
6112 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6114 if (v->type->basetype != D3D10_SVT_BLEND)
6116 WARN("Variable is not a blend state.\n");
6117 return E_FAIL;
6120 *desc = v->u.state.desc.blend;
6122 return S_OK;
6126 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6128 /* ID3D10EffectVariable methods */
6129 d3d10_effect_blend_variable_IsValid,
6130 d3d10_effect_blend_variable_GetType,
6131 d3d10_effect_blend_variable_GetDesc,
6132 d3d10_effect_blend_variable_GetAnnotationByIndex,
6133 d3d10_effect_blend_variable_GetAnnotationByName,
6134 d3d10_effect_blend_variable_GetMemberByIndex,
6135 d3d10_effect_blend_variable_GetMemberByName,
6136 d3d10_effect_blend_variable_GetMemberBySemantic,
6137 d3d10_effect_blend_variable_GetElement,
6138 d3d10_effect_blend_variable_GetParentConstantBuffer,
6139 d3d10_effect_blend_variable_AsScalar,
6140 d3d10_effect_blend_variable_AsVector,
6141 d3d10_effect_blend_variable_AsMatrix,
6142 d3d10_effect_blend_variable_AsString,
6143 d3d10_effect_blend_variable_AsShaderResource,
6144 d3d10_effect_blend_variable_AsRenderTargetView,
6145 d3d10_effect_blend_variable_AsDepthStencilView,
6146 d3d10_effect_blend_variable_AsConstantBuffer,
6147 d3d10_effect_blend_variable_AsShader,
6148 d3d10_effect_blend_variable_AsBlend,
6149 d3d10_effect_blend_variable_AsDepthStencil,
6150 d3d10_effect_blend_variable_AsRasterizer,
6151 d3d10_effect_blend_variable_AsSampler,
6152 d3d10_effect_blend_variable_SetRawValue,
6153 d3d10_effect_blend_variable_GetRawValue,
6154 /* ID3D10EffectBlendVariable methods */
6155 d3d10_effect_blend_variable_GetBlendState,
6156 d3d10_effect_blend_variable_GetBackingStore,
6159 /* ID3D10EffectVariable methods */
6161 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6163 TRACE("iface %p\n", iface);
6165 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6168 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6169 ID3D10EffectDepthStencilVariable *iface)
6171 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6174 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6175 D3D10_EFFECT_VARIABLE_DESC *desc)
6177 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6180 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6181 ID3D10EffectDepthStencilVariable *iface, UINT index)
6183 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6186 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6187 ID3D10EffectDepthStencilVariable *iface, const char *name)
6189 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6192 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6193 ID3D10EffectDepthStencilVariable *iface, UINT index)
6195 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6198 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6199 ID3D10EffectDepthStencilVariable *iface, const char *name)
6201 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6204 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6205 ID3D10EffectDepthStencilVariable *iface, const char *semantic)
6207 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6210 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6211 ID3D10EffectDepthStencilVariable *iface, UINT index)
6213 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6216 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6217 ID3D10EffectDepthStencilVariable *iface)
6219 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6222 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6223 ID3D10EffectDepthStencilVariable *iface)
6225 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6228 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6229 ID3D10EffectDepthStencilVariable *iface)
6231 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6234 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6235 ID3D10EffectDepthStencilVariable *iface)
6237 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6240 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6241 ID3D10EffectDepthStencilVariable *iface)
6243 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6246 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6247 ID3D10EffectDepthStencilVariable *iface)
6249 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6252 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6253 ID3D10EffectDepthStencilVariable *iface)
6255 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6258 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6259 ID3D10EffectDepthStencilVariable *iface)
6261 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6264 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6265 ID3D10EffectDepthStencilVariable *iface)
6267 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6270 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6271 ID3D10EffectDepthStencilVariable *iface)
6273 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6276 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6277 ID3D10EffectDepthStencilVariable *iface)
6279 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6282 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6283 ID3D10EffectDepthStencilVariable *iface)
6285 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6288 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6289 ID3D10EffectDepthStencilVariable *iface)
6291 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6294 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6295 ID3D10EffectDepthStencilVariable *iface)
6297 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6300 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6301 void *data, UINT offset, UINT count)
6303 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6306 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6307 void *data, UINT offset, UINT count)
6309 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6312 /* ID3D10EffectDepthStencilVariable methods */
6314 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6315 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6317 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6319 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6321 if (v->type->element_count)
6322 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6323 else if (index)
6324 return E_FAIL;
6326 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6328 WARN("Variable is not a depth stencil state.\n");
6329 return E_FAIL;
6332 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6333 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6335 return S_OK;
6338 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6339 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6341 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6343 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6345 if (v->type->element_count)
6346 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6348 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6350 WARN("Variable is not a depth stencil state.\n");
6351 return E_FAIL;
6354 *desc = v->u.state.desc.depth_stencil;
6356 return S_OK;
6360 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6362 /* ID3D10EffectVariable methods */
6363 d3d10_effect_depth_stencil_variable_IsValid,
6364 d3d10_effect_depth_stencil_variable_GetType,
6365 d3d10_effect_depth_stencil_variable_GetDesc,
6366 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6367 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6368 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6369 d3d10_effect_depth_stencil_variable_GetMemberByName,
6370 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6371 d3d10_effect_depth_stencil_variable_GetElement,
6372 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6373 d3d10_effect_depth_stencil_variable_AsScalar,
6374 d3d10_effect_depth_stencil_variable_AsVector,
6375 d3d10_effect_depth_stencil_variable_AsMatrix,
6376 d3d10_effect_depth_stencil_variable_AsString,
6377 d3d10_effect_depth_stencil_variable_AsShaderResource,
6378 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6379 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6380 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6381 d3d10_effect_depth_stencil_variable_AsShader,
6382 d3d10_effect_depth_stencil_variable_AsBlend,
6383 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6384 d3d10_effect_depth_stencil_variable_AsRasterizer,
6385 d3d10_effect_depth_stencil_variable_AsSampler,
6386 d3d10_effect_depth_stencil_variable_SetRawValue,
6387 d3d10_effect_depth_stencil_variable_GetRawValue,
6388 /* ID3D10EffectDepthStencilVariable methods */
6389 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6390 d3d10_effect_depth_stencil_variable_GetBackingStore,
6393 /* ID3D10EffectVariable methods */
6395 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6397 TRACE("iface %p\n", iface);
6399 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6402 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6403 ID3D10EffectRasterizerVariable *iface)
6405 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6408 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6409 D3D10_EFFECT_VARIABLE_DESC *desc)
6411 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6414 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6415 ID3D10EffectRasterizerVariable *iface, UINT index)
6417 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6420 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6421 ID3D10EffectRasterizerVariable *iface, const char *name)
6423 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6426 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6427 ID3D10EffectRasterizerVariable *iface, UINT index)
6429 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6432 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6433 ID3D10EffectRasterizerVariable *iface, const char *name)
6435 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6438 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6439 ID3D10EffectRasterizerVariable *iface, const char *semantic)
6441 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6444 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6445 ID3D10EffectRasterizerVariable *iface, UINT index)
6447 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6450 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6451 ID3D10EffectRasterizerVariable *iface)
6453 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6456 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6457 ID3D10EffectRasterizerVariable *iface)
6459 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6462 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6463 ID3D10EffectRasterizerVariable *iface)
6465 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6468 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6469 ID3D10EffectRasterizerVariable *iface)
6471 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6474 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6475 ID3D10EffectRasterizerVariable *iface)
6477 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6480 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6481 ID3D10EffectRasterizerVariable *iface)
6483 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6486 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6487 ID3D10EffectRasterizerVariable *iface)
6489 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6492 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6493 ID3D10EffectRasterizerVariable *iface)
6495 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6498 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6499 ID3D10EffectRasterizerVariable *iface)
6501 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6504 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6505 ID3D10EffectRasterizerVariable *iface)
6507 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6510 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6511 ID3D10EffectRasterizerVariable *iface)
6513 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6516 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6517 ID3D10EffectRasterizerVariable *iface)
6519 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6522 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6523 ID3D10EffectRasterizerVariable *iface)
6525 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6528 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6529 ID3D10EffectRasterizerVariable *iface)
6531 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6534 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6535 void *data, UINT offset, UINT count)
6537 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6540 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6541 void *data, UINT offset, UINT count)
6543 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6546 /* ID3D10EffectRasterizerVariable methods */
6548 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6549 UINT index, ID3D10RasterizerState **rasterizer_state)
6551 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6553 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6555 if (v->type->element_count)
6556 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6557 else if (index)
6558 return E_FAIL;
6560 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6562 WARN("Variable is not a rasterizer state.\n");
6563 return E_FAIL;
6566 if ((*rasterizer_state = v->u.state.object.rasterizer))
6567 ID3D10RasterizerState_AddRef(*rasterizer_state);
6569 return S_OK;
6572 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6573 UINT index, D3D10_RASTERIZER_DESC *desc)
6575 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6577 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6579 if (v->type->element_count)
6580 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6582 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6584 WARN("Variable is not a rasterizer state.\n");
6585 return E_FAIL;
6588 *desc = v->u.state.desc.rasterizer;
6590 return S_OK;
6594 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6596 /* ID3D10EffectVariable methods */
6597 d3d10_effect_rasterizer_variable_IsValid,
6598 d3d10_effect_rasterizer_variable_GetType,
6599 d3d10_effect_rasterizer_variable_GetDesc,
6600 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6601 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6602 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6603 d3d10_effect_rasterizer_variable_GetMemberByName,
6604 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6605 d3d10_effect_rasterizer_variable_GetElement,
6606 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6607 d3d10_effect_rasterizer_variable_AsScalar,
6608 d3d10_effect_rasterizer_variable_AsVector,
6609 d3d10_effect_rasterizer_variable_AsMatrix,
6610 d3d10_effect_rasterizer_variable_AsString,
6611 d3d10_effect_rasterizer_variable_AsShaderResource,
6612 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6613 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6614 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6615 d3d10_effect_rasterizer_variable_AsShader,
6616 d3d10_effect_rasterizer_variable_AsBlend,
6617 d3d10_effect_rasterizer_variable_AsDepthStencil,
6618 d3d10_effect_rasterizer_variable_AsRasterizer,
6619 d3d10_effect_rasterizer_variable_AsSampler,
6620 d3d10_effect_rasterizer_variable_SetRawValue,
6621 d3d10_effect_rasterizer_variable_GetRawValue,
6622 /* ID3D10EffectRasterizerVariable methods */
6623 d3d10_effect_rasterizer_variable_GetRasterizerState,
6624 d3d10_effect_rasterizer_variable_GetBackingStore,
6627 /* ID3D10EffectVariable methods */
6629 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6631 TRACE("iface %p\n", iface);
6633 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6636 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6637 ID3D10EffectSamplerVariable *iface)
6639 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6642 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6643 D3D10_EFFECT_VARIABLE_DESC *desc)
6645 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6648 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6649 ID3D10EffectSamplerVariable *iface, UINT index)
6651 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6654 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6655 ID3D10EffectSamplerVariable *iface, const char *name)
6657 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6660 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6661 ID3D10EffectSamplerVariable *iface, UINT index)
6663 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6666 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6667 ID3D10EffectSamplerVariable *iface, const char *name)
6669 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6672 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6673 ID3D10EffectSamplerVariable *iface, const char *semantic)
6675 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6678 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6679 ID3D10EffectSamplerVariable *iface, UINT index)
6681 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6684 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6685 ID3D10EffectSamplerVariable *iface)
6687 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6690 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6691 ID3D10EffectSamplerVariable *iface)
6693 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6696 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6697 ID3D10EffectSamplerVariable *iface)
6699 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6702 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6703 ID3D10EffectSamplerVariable *iface)
6705 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6708 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6709 ID3D10EffectSamplerVariable *iface)
6711 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6714 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6715 ID3D10EffectSamplerVariable *iface)
6717 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6720 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6721 ID3D10EffectSamplerVariable *iface)
6723 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6726 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6727 ID3D10EffectSamplerVariable *iface)
6729 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6732 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6733 ID3D10EffectSamplerVariable *iface)
6735 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6738 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6739 ID3D10EffectSamplerVariable *iface)
6741 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6744 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6745 ID3D10EffectSamplerVariable *iface)
6747 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6750 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6751 ID3D10EffectSamplerVariable *iface)
6753 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6756 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6757 ID3D10EffectSamplerVariable *iface)
6759 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6762 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6763 ID3D10EffectSamplerVariable *iface)
6765 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6768 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6769 void *data, UINT offset, UINT count)
6771 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6774 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6775 void *data, UINT offset, UINT count)
6777 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6780 /* ID3D10EffectSamplerVariable methods */
6782 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6783 UINT index, ID3D10SamplerState **sampler)
6785 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6787 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6789 if (v->type->element_count)
6790 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6791 else if (index)
6792 return E_FAIL;
6794 if (v->type->basetype != D3D10_SVT_SAMPLER)
6796 WARN("Variable is not a sampler state.\n");
6797 return E_FAIL;
6800 if ((*sampler = v->u.state.object.sampler))
6801 ID3D10SamplerState_AddRef(*sampler);
6803 return S_OK;
6806 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6807 UINT index, D3D10_SAMPLER_DESC *desc)
6809 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6811 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6813 if (v->type->element_count)
6814 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6816 if (v->type->basetype != D3D10_SVT_SAMPLER)
6818 WARN("Variable is not a sampler state.\n");
6819 return E_FAIL;
6822 *desc = v->u.state.desc.sampler;
6824 return S_OK;
6828 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6830 /* ID3D10EffectVariable methods */
6831 d3d10_effect_sampler_variable_IsValid,
6832 d3d10_effect_sampler_variable_GetType,
6833 d3d10_effect_sampler_variable_GetDesc,
6834 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6835 d3d10_effect_sampler_variable_GetAnnotationByName,
6836 d3d10_effect_sampler_variable_GetMemberByIndex,
6837 d3d10_effect_sampler_variable_GetMemberByName,
6838 d3d10_effect_sampler_variable_GetMemberBySemantic,
6839 d3d10_effect_sampler_variable_GetElement,
6840 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6841 d3d10_effect_sampler_variable_AsScalar,
6842 d3d10_effect_sampler_variable_AsVector,
6843 d3d10_effect_sampler_variable_AsMatrix,
6844 d3d10_effect_sampler_variable_AsString,
6845 d3d10_effect_sampler_variable_AsShaderResource,
6846 d3d10_effect_sampler_variable_AsRenderTargetView,
6847 d3d10_effect_sampler_variable_AsDepthStencilView,
6848 d3d10_effect_sampler_variable_AsConstantBuffer,
6849 d3d10_effect_sampler_variable_AsShader,
6850 d3d10_effect_sampler_variable_AsBlend,
6851 d3d10_effect_sampler_variable_AsDepthStencil,
6852 d3d10_effect_sampler_variable_AsRasterizer,
6853 d3d10_effect_sampler_variable_AsSampler,
6854 d3d10_effect_sampler_variable_SetRawValue,
6855 d3d10_effect_sampler_variable_GetRawValue,
6856 /* ID3D10EffectSamplerVariable methods */
6857 d3d10_effect_sampler_variable_GetSampler,
6858 d3d10_effect_sampler_variable_GetBackingStore,
6861 /* ID3D10EffectType methods */
6863 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6865 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6868 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6870 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6872 TRACE("iface %p\n", iface);
6874 return This != &null_type;
6877 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6879 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6881 TRACE("iface %p, desc %p\n", iface, desc);
6883 if (This == &null_type)
6885 WARN("Null type specified\n");
6886 return E_FAIL;
6889 if (!desc)
6891 WARN("Invalid argument specified\n");
6892 return E_INVALIDARG;
6895 desc->TypeName = This->name;
6896 desc->Class = This->type_class;
6897 desc->Type = This->basetype;
6898 desc->Elements = This->element_count;
6899 desc->Members = This->member_count;
6900 desc->Rows = This->row_count;
6901 desc->Columns = This->column_count;
6902 desc->PackedSize = This->size_packed;
6903 desc->UnpackedSize = This->size_unpacked;
6904 desc->Stride = This->stride;
6906 return S_OK;
6909 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6910 UINT index)
6912 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6913 struct d3d10_effect_type *t;
6915 TRACE("iface %p, index %u\n", iface, index);
6917 if (index >= This->member_count)
6919 WARN("Invalid index specified\n");
6920 return &null_type.ID3D10EffectType_iface;
6923 t = (&This->members[index])->type;
6925 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6927 return &t->ID3D10EffectType_iface;
6930 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6931 const char *name)
6933 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6934 unsigned int i;
6936 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6938 if (!name)
6940 WARN("Invalid name specified\n");
6941 return &null_type.ID3D10EffectType_iface;
6944 for (i = 0; i < This->member_count; ++i)
6946 struct d3d10_effect_type_member *typem = &This->members[i];
6948 if (typem->name)
6950 if (!strcmp(typem->name, name))
6952 TRACE("Returning type %p.\n", typem->type);
6953 return &typem->type->ID3D10EffectType_iface;
6958 WARN("Invalid name specified\n");
6960 return &null_type.ID3D10EffectType_iface;
6963 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6964 const char *semantic)
6966 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6967 unsigned int i;
6969 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6971 if (!semantic)
6973 WARN("Invalid semantic specified\n");
6974 return &null_type.ID3D10EffectType_iface;
6977 for (i = 0; i < This->member_count; ++i)
6979 struct d3d10_effect_type_member *typem = &This->members[i];
6981 if (typem->semantic)
6983 if (!strcmp(typem->semantic, semantic))
6985 TRACE("Returning type %p.\n", typem->type);
6986 return &typem->type->ID3D10EffectType_iface;
6991 WARN("Invalid semantic specified\n");
6993 return &null_type.ID3D10EffectType_iface;
6996 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
6998 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6999 struct d3d10_effect_type_member *typem;
7001 TRACE("iface %p, index %u\n", iface, index);
7003 if (index >= This->member_count)
7005 WARN("Invalid index specified\n");
7006 return NULL;
7009 typem = &This->members[index];
7011 TRACE("Returning name %s\n", debugstr_a(typem->name));
7013 return typem->name;
7016 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7018 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7019 struct d3d10_effect_type_member *typem;
7021 TRACE("iface %p, index %u\n", iface, index);
7023 if (index >= This->member_count)
7025 WARN("Invalid index specified\n");
7026 return NULL;
7029 typem = &This->members[index];
7031 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7033 return typem->semantic;
7036 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7038 /* ID3D10EffectType */
7039 d3d10_effect_type_IsValid,
7040 d3d10_effect_type_GetDesc,
7041 d3d10_effect_type_GetMemberTypeByIndex,
7042 d3d10_effect_type_GetMemberTypeByName,
7043 d3d10_effect_type_GetMemberTypeBySemantic,
7044 d3d10_effect_type_GetMemberName,
7045 d3d10_effect_type_GetMemberSemantic,